text: /*
  
   Licensed under the Apache License, Version 2.0 (the "License"); you may not
   use this file except in compliance with the License. You may obtain a copy
   of the License at
  
   http://www.apache.org/licenses/LICENSE-2.0
  
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   License for the specific language governing permissions and limitations under
   the License.
  
   Copyright (c) 2011-2012 Almende B.V.
  
   @author 	Jos de Jong, <jos@almende.org>
   @date    2013-04-18
   @version 1.4.1
  */
  typeof links==="undefined"&&(links={});typeof google==="undefined"&&(google=void 0);
  links.Network=function(a){this.containerElement=a;this.height=this.width="100%";this.refreshRate=50;this.selectable=this.stabilize=!0;this.constants={nodes:{radiusMin:5,radiusMax:20,radius:5,distance:100,style:"rect",image:void 0,widthMin:16,widthMax:64,fontColor:"black",fontSize:14,fontFace:"arial",borderColor:"#2B7CE9",backgroundColor:"#97C2FC",highlightColor:"#D2E5FF",group:void 0},links:{widthMin:1,widthMax:15,width:1,style:"line",color:"#343434",fontColor:"#343434",fontSize:14,fontFace:"arial",
  length:100,dashlength:10,dashgap:5},packages:{radius:5,radiusMin:5,radiusMax:10,style:"dot",color:"#2B7CE9",image:void 0,widthMin:16,widthMax:64,duration:1},minForce:0.05,minVelocity:0.02,maxIterations:1E3};this.nodes=[];this.links=[];this.packages=[];this.images=new links.Network.Images;this.groups=new links.Network.Groups;this.hasMovingPackages=this.hasMovingNodes=this.hasMovingLinks=!1;this.selection=[];this.timer=void 0;this._create()};
  links.Network.prototype.draw=function(a,b,d,c){var e,f,g;c!=void 0?(e=a,f=b,g=d):d!=void 0?(e=a,f=b,g=void 0,c=d):b!=void 0?(e=a,g=f=void 0,c=b):a!=void 0&&(g=f=e=void 0,c=a);if(c!=void 0){if(c.width!=void 0)this.width=c.width;if(c.height!=void 0)this.height=c.height;if(c.stabilize!=void 0)this.stabilize=c.stabilize;if(c.selectable!=void 0)this.selectable=c.selectable;if(c.links){for(var h in c.links)c.links.hasOwnProperty(h)&&(this.constants.links[h]=c.links[h]);if(c.links.length!=void 0&&c.nodes&&
  c.nodes.distance==void 0)this.constants.links.length=c.links.length,this.constants.nodes.distance=c.links.length*1.25;if(!c.links.fontColor)this.constants.links.fontColor=c.links.color;if(c.links.dashlength!=void 0)this.constants.links.dashlength=c.links.dashlength;if(c.links.dashgap!=void 0)this.constants.links.dashgap=c.links.dashgap;if(c.links.altdashlength!=void 0)this.constants.links.altdashlength=c.links.altdashlength}if(c.nodes)for(h in c.nodes)c.nodes.hasOwnProperty(h)&&(this.constants.nodes[h]=
  c.nodes[h]);if(c.packages)for(h in c.packages)c.packages.hasOwnProperty(h)&&(this.constants.packages[h]=c.packages[h]);if(c.groups)for(var i in c.groups)c.groups.hasOwnProperty(i)&&this.groups.add(i,c.groups[i])}this._setBackgroundColor(c.backgroundColor);this._setSize(this.width,this.height);this._setTranslation(0,0);this._setScale(1);this.hasTimestamps=!1;this.setNodes(e);this.setLinks(f);this.setPackages(g);this._reposition();this.stabilize&&this._doStabilize();this.start();var k=this;this.images.setOnloadCallback(function(){k._redraw()});
  this.trigger("ready")};links.Network.prototype.trigger=function(a,b){links.events.trigger(this,a,b);google&&google.visualization&&google.visualization.events&&google.visualization.events.trigger(this,a,b)};
  links.Network.prototype._create=function(){for(;this.containerElement.hasChildNodes();)this.containerElement.removeChild(this.containerElement.firstChild);this.frame=document.createElement("div");this.frame.className="network-frame";this.frame.style.position="relative";this.frame.style.overflow="hidden";this.frame.canvas=document.createElement("canvas");this.frame.canvas.style.position="relative";this.frame.appendChild(this.frame.canvas);if(!this.frame.canvas.getContext){var a=document.createElement("DIV");
  a.style.color="red";a.style.fontWeight="bold";a.style.padding="10px";a.innerHTML="Error: your browser does not support HTML canvas";this.frame.canvas.appendChild(a)}var b=this;links.Network.addEventListener(this.frame.canvas,"mousedown",function(a){b._onMouseDown(a)});links.Network.addEventListener(this.frame.canvas,"mousemove",function(a){b._onMouseMoveTitle(a)});links.Network.addEventListener(this.frame.canvas,"mousewheel",function(a){b._onMouseWheel(a)});links.Network.addEventListener(this.frame.canvas,
  "touchstart",function(a){b._onTouchStart(a)});this.containerElement.appendChild(this.frame)};
  links.Network.prototype._setBackgroundColor=function(a){var b="white",d="lightgray",c=1;if(typeof a=="string")b=a,d="none",c=0;else if(typeof a=="object"){if(a.fill!=void 0)b=a.fill;if(a.stroke!=void 0)d=a.stroke;if(a.strokeWidth!=void 0)c=a.strokeWidth}else if(a!=void 0)throw"Unsupported type of backgroundColor";this.frame.style.boxSizing="border-box";this.frame.style.backgroundColor=b;this.frame.style.borderColor=d;this.frame.style.borderWidth=c+"px";this.frame.style.borderStyle="solid"};
  links.Network.prototype._onMouseDown=function(a){a=a||window.event;if(this.selectable&&(this.leftButtonDown&&this._onMouseUp(a),(this.leftButtonDown=a.which?a.which==1:a.button==1)||this.touchDown)){var b=this;if(!this.onmousemove)this.onmousemove=function(a){b._onMouseMove(a)},links.Network.addEventListener(document,"mousemove",b.onmousemove);if(!this.onmouseup)this.onmouseup=function(a){b._onMouseUp(a)},links.Network.addEventListener(document,"mouseup",b.onmouseup);links.Network.preventDefault(a);
  this.startMouseX=a.clientX||a.targetTouches[0].clientX;this.startMouseY=a.clientY||a.targetTouches[0].clientY;this.startFrameLeft=links.Network._getAbsoluteLeft(this.frame.canvas);this.startFrameTop=links.Network._getAbsoluteTop(this.frame.canvas);this.startTranslation=this._getTranslation();this.ctrlKeyDown=a.ctrlKey;this.shiftKeyDown=a.shiftKey;a=this._getNodesOverlappingWith({left:this._xToCanvas(this.startMouseX-this.startFrameLeft),top:this._yToCanvas(this.startMouseY-this.startFrameTop),right:this._xToCanvas(this.startMouseX-
  this.startFrameLeft),bottom:this._yToCanvas(this.startMouseY-this.startFrameTop)});if(this.startClickedObj=a.length>0?a[a.length-1]:void 0)a=this.nodes[this.startClickedObj.row],this.startClickedObj.xFixed=a.xFixed,this.startClickedObj.yFixed=a.yFixed,a.xFixed=!0,a.yFixed=!0,!this.ctrlKeyDown||!a.isSelected()?this._selectNodes([this.startClickedObj],this.ctrlKeyDown):this._unselectNodes([this.startClickedObj]),this.hasMovingNodes||this._redraw();else if(!this.shiftKeyDown)this.moved=!1}};
  links.Network.prototype._onMouseMove=function(a){a=a||window.event;if(this.selectable){var b=a.clientX||a.targetTouches&&a.targetTouches[0].clientX||0,d=a.clientY||a.targetTouches&&a.targetTouches[0].clientY||0;this.mouseX=b;this.mouseY=d;if(this.startClickedObj){var c=this.nodes[this.startClickedObj.row];if(!this.startClickedObj.xFixed)c.x=this._xToCanvas(b-this.startFrameLeft);if(!this.startClickedObj.yFixed)c.y=this._yToCanvas(d-this.startFrameTop);if(!this.hasMovingNodes)this.hasMovingNodes=!0,
  this.start()}else if(this.shiftKeyDown){if(this.frame.selRect==void 0)this.frame.selRect=document.createElement("DIV"),this.frame.appendChild(this.frame.selRect),this.frame.selRect.style.position="absolute",this.frame.selRect.style.border="1px dashed red";var c=Math.min(this.startMouseX,b)-this.startFrameLeft,e=Math.min(this.startMouseY,d)-this.startFrameTop,b=Math.max(this.startMouseX,b)-this.startFrameLeft,d=Math.max(this.startMouseY,d)-this.startFrameTop;this.frame.selRect.style.left=c+"px";this.frame.selRect.style.top=
  e+"px";this.frame.selRect.style.width=b-c+"px";this.frame.selRect.style.height=d-e+"px"}else this._setTranslation(this.startTranslation.x+(b-this.startMouseX),this.startTranslation.y+(d-this.startMouseY)),this._redraw(),this.moved=!0;links.Network.preventDefault(a)}};
  links.Network.prototype._onMouseUp=function(a){a=a||window.event;if(this.selectable){if(this.onmousemove)links.Network.removeEventListener(document,"mousemove",this.onmousemove),this.onmousemove=void 0;if(this.onmouseup)links.Network.removeEventListener(document,"mouseup",this.onmouseup),this.onmouseup=void 0;links.Network.preventDefault(a);var b=a.clientX||this.mouseX||0,d=a.clientY||this.mouseY||0,a=a?a.ctrlKey:window.event.ctrlKey;if(this.startClickedObj)b=this.nodes[this.startClickedObj.row],
  b.xFixed=this.startClickedObj.xFixed,b.yFixed=this.startClickedObj.yFixed;else if(this.shiftKeyDown){if(this._selectNodes(this._getNodesOverlappingWith({left:this._xToCanvas(Math.min(this.startMouseX,b)-this.startFrameLeft),top:this._yToCanvas(Math.min(this.startMouseY,d)-this.startFrameTop),right:this._xToCanvas(Math.max(this.startMouseX,b)-this.startFrameLeft),bottom:this._yToCanvas(Math.max(this.startMouseY,d)-this.startFrameTop)}),a),this.redraw(),this.frame.selRect)this.frame.removeChild(this.frame.selRect),
  this.frame.selRect=void 0}else!this.ctrlKeyDown&&!this.moved&&(this._unselectNodes(),this._redraw());this.ctrlKeyDown=this.leftButtonDown=!1}};
  links.Network.prototype._onMouseWheel=function(a){var a=a||window.event,b=a.clientX,d=a.clientY,c=0;a.wheelDelta?c=a.wheelDelta/120:a.detail&&(c=-a.detail/3);if(c){var e=c/10;c<0&&(e/=1-e);c=this._getScale();e=c*(1+e);e<0.01&&(e=0.01);e>10&&(e=10);var f=links.Network._getAbsoluteLeft(this.frame.canvas),g=links.Network._getAbsoluteTop(this.frame.canvas);b-=f;d-=g;g=this._getTranslation();c=e/c;b=(1-c)*b+g.x*c;c=(1-c)*d+g.y*c;this._setScale(e);this._setTranslation(b,c);this._redraw()}links.Network.preventDefault(a)};
  links.Network.prototype._onMouseMoveTitle=function(a){var a=a||window.event,b=a.clientX,a=a.clientY;this.startFrameLeft=this.startFrameLeft||links.Network._getAbsoluteLeft(this.frame.canvas);this.startFrameTop=this.startFrameTop||links.Network._getAbsoluteTop(this.frame.canvas);var d=b-this.startFrameLeft,c=a-this.startFrameTop;this.popupNode&&this._checkHidePopup(d,c);var e=this,b=function(){e._checkShowPopup(d,c)};this.popupTimer&&clearInterval(this.popupTimer);if(!this.leftButtonDown)this.popupTimer=
  setTimeout(b,300)};
  links.Network.prototype._checkShowPopup=function(a,b){var d={left:this._xToCanvas(a),top:this._yToCanvas(b),right:this._xToCanvas(a),bottom:this._yToCanvas(b)},c,e,f=this.popupNode;if(this.popupNode==void 0)for(c=0,e=this.packages.length;c<e;c++){var g=this.packages[c];if(g.getTitle()!=void 0&&g.isOverlappingWith(d)){this.popupNode=g;break}}if(this.popupNode==void 0){e=this.nodes;for(c=e.length-1;c>=0;c--)if(g=e[c],g.getTitle()!=void 0&&g.isOverlappingWith(d)){this.popupNode=g;break}}if(this.popupNode==
  void 0){g=this.links;for(c=0,e=g.length;c<e;c++){var h=g[c];if(h.getTitle()!=void 0&&h.isOverlappingWith(d)){this.popupNode=h;break}}}if(this.popupNode){if(this.popupNode!=f){if(!this.popup)this.popup=new links.Network.Popup(this.frame);this.popup.setPosition(a-3,b-3);this.popup.setText(this.popupNode.getTitle());this.popup.show()}}else this.popup&&this.popup.hide()};
  links.Network.prototype._checkHidePopup=function(a,b){var d={left:a,top:b,right:a,bottom:b};if(!this.popupNode||!this.popupNode.isOverlappingWith(d))this.popupNode=void 0,this.popup&&this.popup.hide()};
  links.Network.prototype._onTouchStart=function(a){links.Network.preventDefault(a);if(!this.touchDown){this.touchDown=!0;var b=this;if(!this.ontouchmove)this.ontouchmove=function(a){b._onTouchMove(a)},links.Network.addEventListener(document,"touchmove",this.ontouchmove);if(!this.ontouchend)this.ontouchend=function(a){b._onTouchEnd(a)},links.Network.addEventListener(document,"touchend",this.ontouchend);this._onMouseDown(a)}};
  links.Network.prototype._onTouchMove=function(a){links.Network.preventDefault(a);this._onMouseMove(a)};links.Network.prototype._onTouchEnd=function(a){links.Network.preventDefault(a);this.touchDown=!1;if(this.ontouchmove)links.Network.removeEventListener(document,"touchmove",this.ontouchmove),this.ontouchmove=void 0;if(this.ontouchend)links.Network.removeEventListener(document,"touchend",this.ontouchend),this.ontouchend=void 0;this._onMouseUp(a)};
  links.Network.prototype._unselectNodes=function(a,b){var d=!1,c,e,f;if(a)for(c=0,e=a.length;c<e;c++){f=a[c].row;this.nodes[f].unselect();for(var g=0;g<this.selection.length;)this.selection[g].row==f?(this.selection.splice(g,1),d=!0):g++}else if(this.selection&&this.selection.length){for(c=0,e=this.selection.length;c<e;c++)f=this.selection[c].row,this.nodes[f].unselect(),d=!0;this.selection=[]}d&&(b==!0||b==void 0)&&this.trigger("select");return d};
  links.Network.prototype._selectNodes=function(a,b){var d=!1,c,e,f=!0;if(a.length!=this.selection.length)f=!1;else for(c=0,e=Math.min(a.length,this.selection.length);c<e;c++)if(a[c].row!=this.selection[c].row){f=!1;break}if(f)return d;if(b==void 0||b==!1)d=this._unselectNodes(void 0,!1);for(c=0,e=a.length;c<e;c++){for(var f=a[c].row,g=!1,h=0,i=this.selection.length;h<i;h++)if(this.selection[h].row==f){g=!0;break}g||(this.nodes[f].select(),this.selection.push(a[c]),d=!0)}d&&this.trigger("select");return d};
  links.Network.prototype._getNodesOverlappingWith=function(a){for(var b=[],d=0;d<this.nodes.length;d++)this.nodes[d].isOverlappingWith(a)&&b.push({row:d});return b};links.Network.prototype.getSelection=function(){for(var a=[],b=0;b<this.selection.length;b++)a.push({row:this.selection[b].row});return a};
  links.Network.prototype.setSelection=function(a){var b,d,c;if(a.length==void 0)throw"Selection must be an array with objects";for(b=0,d=this.selection.length;b<d;b++)c=this.selection[b].row,this.nodes[c].unselect();this.selection=[];for(b=0,d=a.length;b<d;b++){c=a[b].row;if(c==void 0)throw"Parameter row missing in selection object";if(c>this.nodes.length-1)throw"Parameter row out of range";this.selection.push({row:c});this.nodes[c].select()}this.redraw()};
  links.Network.prototype._getConnectionCount=function(a){function b(a){for(var b=[],c=0,e=a.length;c<e;c++)for(var f=a[c],g=0,h=d.length;g<h;g++){var i=null;if(d[g].from==f)i=d[g].to;else if(d[g].to==f)i=d[g].from;var n,q;if(i)for(n=0,q=a.length;n<q;n++)if(a[n]==i){i=null;break}if(i)for(n=0,q=b.length;n<q;n++)if(b[n]==i){i=null;break}i&&b.push(i)}return b}var d=this.links;a==void 0&&(a=1);var c=[],e=this.nodes,f,g;for(f=0,g=e.length;f<g;f++){for(var h=[e[f]],i=0;i<a;i++)h=h.concat(b(h));c.push(h)}a=
  [];for(f=0,len=c.length;f<len;f++)a.push(c[f].length);return a};links.Network.prototype._setSize=function(a,b){this.frame.style.width=a;this.frame.style.height=b;this.frame.canvas.style.width="100%";this.frame.canvas.style.height="100%";this.frame.canvas.width=this.frame.canvas.clientWidth;this.frame.canvas.height=this.frame.canvas.clientHeight;this.slider&&this.slider.redraw()};
  links.Network.tableToArray=function(a){var b=[],d,c=a.getNumberOfColumns(),e={};for(d=0;d<c;d++){var f=a.getColumnLabel(d);e[f]=d}c=a.getNumberOfRows();for(f=0;f<c;f++){var g={};for(d in e)e.hasOwnProperty(d)&&(g[d]=a.getValue(f,e[d]));b.push(g)}return b};
  links.Network.prototype.addNodes=function(a){if(google&&google.visualization&&google.visualization.DataTable&&a instanceof google.visualization.DataTable)a=links.Network.tableToArray(a);else if(!links.Network.isArray(a))return;for(var b=!1,d=a.length,c=0;c<d;c++){var e=a[c];e.value!=void 0&&(b=!0);if(e.id==void 0)throw"Column 'id' missing in table with nodes (row "+c+")";this._createNode(e)}b&&this._updateValueRange(this.nodes);this.start()};
  links.Network.prototype.setNodes=function(a){if(google&&google.visualization&&google.visualization.DataTable&&a instanceof google.visualization.DataTable)a=links.Network.tableToArray(a);else if(!links.Network.isArray(a))return;this.hasMovingNodes=!1;this.nodesTable=a;this.nodes=[];this.selection=[];for(var b=!1,d=a.length,c=0;c<d;c++){var e=a[c];e.value!=void 0&&(b=!0);if(e.timestamp)this.hasTimestamps=this.hasTimestamps||e.timestamp;if(e.id==void 0)throw"Column 'id' missing in table with nodes (row "+
  c+")";this._createNode(e)}b&&this._updateValueRange(this.nodes)};links.Network.prototype._filterNodes=function(a){if(this.nodesTable!=void 0){if(a!==void 0)for(var b=this.nodes,d=0;d<b.length;){var c=b[d].timestamp;c!==void 0&&c>a?b.splice(d,1):d++}b=this.nodesTable;d=b.length;for(c=0;c<d;c++){var e=b[c];if(e.id===void 0)throw"Column 'id' missing in table with nodes (row "+c+")";var f=e.timestamp?e.timestamp:void 0,g=!0;f!==void 0&&a!==void 0&&f>a&&(g=!1);g&&this._createNode(e)}this.start()}};
  links.Network.prototype._createNode=function(a){var b=a.action?a.action:"update",d,c;if(b==="create"){if(c=new links.Network.Node(a,this.images,this.groups,this.constants),d=a.id,b=d!==void 0?this._findNode(d):void 0,b!==void 0?(a=this.nodes[b],this.nodes[b]=c,a.selected&&this._unselectNodes([{row:b}],!1)):this.nodes.push(c),!c.isFixed())this.hasMovingNodes=!0}else if(b==="update"){d=a.id;if(d===void 0)throw"Cannot update a node without id";b=this._findNode(d);if(b!==void 0)this.nodes[b].setProperties(a,
  this.constants);else if(c=new links.Network.Node(a,this.images,this.groups,this.constants),this.nodes.push(c),!c.isFixed())this.hasMovingNodes=!0}else if(b==="delete"){d=a.id;if(d===void 0)throw"Cannot delete node without its id";b=this._findNode(d);if(b!==void 0)a=this.nodes[b],a.selected&&this._unselectNodes([{row:b}],!1),this.nodes.splice(b,1);else throw"Node with id "+d+" not found";}else throw"Unknown action "+b+". Choose 'create', 'update', or 'delete'.";};
  links.Network.prototype._findNode=function(a){for(var b=this.nodes,d=0,c=b.length;d<c;d++)if(b[d].id===a)return d};links.Network.prototype._findNodeByRow=function(a){return this.nodes[a]};
  links.Network.prototype.setLinks=function(a){if(google&&google.visualization&&google.visualization.DataTable&&a instanceof google.visualization.DataTable)a=links.Network.tableToArray(a);else if(!links.Network.isArray(a))return;this.linksTable=a;this.links=[];for(var b=this.hasMovingLinks=!1,d=a.length,c=0;c<d;c++){var e=a[c];if(e.from===void 0)throw"Column 'from' missing in table with links (row "+c+")";if(e.to===void 0)throw"Column 'to' missing in table with links (row "+c+")";if(e.timestamp!=void 0)this.hasTimestamps=
  this.hasTimestamps||e.timestamp;e.value!=void 0&&(b=!0);this._createLink(e)}b&&this._updateValueRange(this.links)};
  links.Network.prototype.addLinks=function(a){if(google&&google.visualization&&google.visualization.DataTable&&a instanceof google.visualization.DataTable)a=links.Network.tableToArray(a);else if(!links.Network.isArray(a))return;for(var b=!1,d=a.length,c=0;c<d;c++){var e=a[c];if(e.from===void 0)throw"Column 'from' missing in table with links (row "+c+")";if(e.to===void 0)throw"Column 'to' missing in table with links (row "+c+")";e.value!=void 0&&(b=!0);this._createLink(e)}b&&this._updateValueRange(this.links);
  this.start()};links.Network.prototype._filterLinks=function(a){if(this.linksTable!=void 0){if(a!==void 0)for(var b=this.links,d=0;d<b.length;){var c=b[d].timestamp;c!==void 0&&c>a?b.splice(d,1):d++}b=this.linksTable;d=b.length;for(c=0;c<d;c++){var e=b[c];if(e.from===void 0)throw"Column 'from' missing in table with links (row "+c+")";if(e.to===void 0)throw"Column 'to' missing in table with links (row "+c+")";var f=e.timestamp?e.timestamp:void 0,g=!0;f!==void 0&&a!==void 0&&f>a&&(g=!1);g&&this._createLink(e)}this.start()}};
  links.Network.prototype._createLink=function(a){var b=a.action?a.action:"create",d;if(b==="create"){if(d=a.id,b=d!==void 0?this._findLink(d):void 0,d=new links.Network.Link(a,this,this.constants),b!==void 0?this.links[b]=d:this.links.push(d),d.isMoving())this.hasMovingLinks=!0}else if(b==="update"){d=a.id;if(d===void 0)throw"Cannot update a link without id";b=this._findLink(d);if(b!==void 0)d=this.links[b],d.setProperties(a,this.constants);else if(d=new links.Network.Link(a,this,this.constants),this.links.push(d),
  d.isMoving())this.hasMovingLinks=!0}else if(b==="delete"){d=a.id;if(d===void 0)throw"Cannot delete link without its id";b=this._findLink(d);if(b!==void 0)this.links.splice(b,1);else throw"Link with id "+d+" not found";}else throw"Unknown action "+b+". Choose 'create', 'update', or 'delete'.";};links.Network.prototype._updateNodeReferences=function(a,b){for(var d=[this.links,this.packages],c=0,e=d.length;c<e;c++)for(var f=d[c],g=0,h=f.length;g<h;g++){if(f.from===a)f.from=b;if(f.to===a)f.to=b}};
  links.Network.prototype._findLink=function(a){for(var b=this.links,d=0,c=b.length;d<c;d++)if(b[d].id===a)return d};links.Network.prototype._findLinkByRow=function(a){return this.links[a]};
  links.Network.prototype.addPackages=function(a){if(google&&google.visualization&&google.visualization.DataTable&&a instanceof google.visualization.DataTable)a=links.Network.tableToArray(a);else if(!links.Network.isArray(a))return;for(var b=a.length,d=0;d<b;d++){var c=a[d];if(c.from===void 0)throw"Column 'from' missing in table with packages (row "+d+")";if(c.to===void 0)throw"Column 'to' missing in table with packages (row "+d+")";this._createPackage(c)}this._updateValueRange(this.packages);this.start()};
  links.Network.prototype.setPackages=function(a){if(google&&google.visualization&&google.visualization.DataTable&&a instanceof google.visualization.DataTable)a=links.Network.tableToArray(a);else if(!links.Network.isArray(a))return;this.packagesTable=a;this.packages=[];for(var b=a.length,d=0;d<b;d++){var c=a[d];if(c.from===void 0)throw"Column 'from' missing in table with packages (row "+d+")";if(c.to===void 0)throw"Column 'to' missing in table with packages (row "+d+")";if(c.timestamp)this.hasTimestamps=
  this.hasTimestamps||c.timestamp;this._createPackage(c)}this._updateValueRange(this.packages)};
  links.Network.prototype._filterPackages=function(a){if(this.packagesTable!=void 0){this.packages=[];for(var b=this.packagesTable,d=b.length,c=0;c<d;c++){var e=b[c];if(e.from===void 0)throw"Column 'from' missing in table with packages (row "+c+")";if(e.to===void 0)throw"Column 'to' missing in table with packages (row "+c+")";var f=e.timestamp?e.timestamp:void 0,g=!0;f!==void 0&&a!==void 0&&f>a&&(g=!1);if(g===!0&&e.progress==void 0){var h=e.duration||this.constants.packages.duration,f=(a.getTime()-
  f.getTime())/1E3;if(f<h){var i=e,e={},k;for(k in i)i.hasOwnProperty(k)&&(e[k]=i[k]);e.progress=f/h}else g=!1}g===!0&&this._createPackage(e)}this.start()}};
  links.Network.prototype._createPackage=function(a){var b=a.action?a.action:"create",d;if(b==="create"){if(d=a.id,b=d!==void 0?this._findPackage(d):void 0,a=new links.Network.Package(a,this,this.images,this.constants),b!==void 0?this.packages[b]=a:this.packages.push(a),a.isMoving())this.hasMovingPackages=!0}else if(b==="update"){d=a.id;if(d===void 0)throw"Cannot update a link without id";b=this._findPackage(d);if(b!==void 0)this.packages[b].setProperties(a,this.constants);else if(a=new links.Network.Package(a,
  this,this.images,this.constants),this.packages.push(a),a.isMoving())this.hasMovingPackages=!0}else if(b==="delete"){d=a.id;if(d===void 0)throw"Cannot delete package without its id";b=this._findPackage(d);if(b!==void 0)this.packages.splice(b,1);else throw"Package with id "+d+" not found";}else throw"Unknown action "+b+". Choose 'create', 'update', or 'delete'.";};links.Network.prototype._findPackage=function(a){for(var b=this.packages,d=0,c=b.length;d<c;d++)if(b[d].id===a)return d};
  links.Network.prototype._findPackageByRow=function(a){return this.packages[a]};links.Network.prototype._getColumnNames=function(a){for(var b=a.getNumberOfColumns(),d={},c=0;c<b;c++){var e=a.getColumnLabel(c);d[e]=c}return d};links.Network.prototype._updateValueRange=function(a){var b=a.length,d,c=void 0,e=void 0;for(d=0;d<b;d++){var f=a[d].getValue();f!==void 0&&(c=c===void 0?f:Math.min(f,c),e=e===void 0?f:Math.max(f,e))}if(c!==void 0&&e!==void 0)for(d=0;d<b;d++)a[d].setValueRange(c,e)};
  links.Network.prototype.setTimestamp=function(a){this._filterNodes(a);this._filterLinks(a);this._filterPackages(a)};
  links.Network.prototype._getRange=function(){for(var a=void 0,b=void 0,d=[this.nodesTable,this.linksTable],c=0,e=d.length;c<e;c++){var f=d[c];if(f!==void 0)for(var g=0,h=f.length;g<h;g++){var i=f[g].timestamp;i&&(i instanceof Date&&(i=i.getTime()),a=a?Math.min(i,a):i,b=b?Math.max(i,b):i)}}if(this.packagesTable){d=this.packagesTable;c=0;for(e=d.length;c<e;c++)g=d[c],i=g.timestamp,f=g.progress,h=g.duration||this.constants.packages.duration,i instanceof Date&&(i=i.getTime()),i!=void 0&&(g=i,i=f?i:i+
  h*1E3,a=a?Math.min(g,a):g,b=b?Math.max(i,b):i)}return{start:new Date(a),end:new Date(b)}};links.Network.prototype.animationStart=function(){this.slider&&this.slider.play()};links.Network.prototype.animationStop=function(){this.slider&&this.slider.stop()};links.Network.prototype.setAnimationFramerate=function(a){this.slider&&this.slider.setFramerate(a)};links.Network.prototype.setAnimationDuration=function(a){this.slider&&this.slider.setDuration(a)};
  links.Network.prototype.setAnimationAcceleration=function(a){this.slider&&this.slider.setAcceleration(a)};links.Network.prototype.redraw=function(){this._setSize(this.width,this.height);this._redraw()};
  links.Network.prototype._redraw=function(){var a=this.frame.canvas.getContext("2d");a.clearRect(0,0,this.frame.canvas.width,this.frame.canvas.height);a.save();a.translate(this.translation.x,this.translation.y);a.scale(this.scale,this.scale);this._drawLinks(a);this._drawNodes(a);this._drawPackages(a);this._drawSlider();a.restore()};
  links.Network.prototype._setTranslation=function(a,b){if(this.translation===void 0)this.translation={x:0,y:0};if(a!==void 0)this.translation.x=a;if(b!==void 0)this.translation.y=b};links.Network.prototype._getTranslation=function(){return{x:this.translation.x,y:this.translation.y}};links.Network.prototype._setScale=function(a){this.scale=a};links.Network.prototype._getScale=function(){return this.scale};links.Network.prototype._xToCanvas=function(a){return(a-this.translation.x)/this.scale};
  links.Network.prototype._canvasToX=function(a){return a*this.scale+this.translation.x};links.Network.prototype._yToCanvas=function(a){return(a-this.translation.y)/this.scale};links.Network.prototype._canvasToY=function(a){return a*this.scale+this.translation.y};links.Network.prototype._getNode=function(a){for(var b=0;b<this.nodes.length;b++)if(this.nodes[b].id==a)return this.nodes[b];return null};
  links.Network.prototype._drawNodes=function(a){for(var b=this.nodes,d=[],c=0,e=b.length;c<e;c++)b[c].isSelected()?d.push(c):b[c].draw(a);c=0;for(e=d.length;c<e;c++)b[d[c]].draw(a)};links.Network.prototype._drawLinks=function(a){for(var b=this.links,d=0,c=b.length;d<c;d++)b[d].draw(a)};links.Network.prototype._drawPackages=function(a){for(var b=this.packages,d=0,c=b.length;d<c;d++)b[d].draw(a)};
  links.Network.prototype._drawSlider=function(){var a;if(this.hasTimestamps){if(a=this.frame.slider,a===void 0){a=document.createElement("div");a.style.position="absolute";a.style.bottom="0px";a.style.left="0px";a.style.right="0px";a.style.backgroundColor="rgba(255, 255, 255, 0.7)";this.frame.slider=a;this.frame.slider.style.padding="10px";this.frame.appendChild(a);var b=this._getRange();this.slider=new links.Network.Slider(a);this.slider.setLoop(!1);this.slider.setRange(b.start,b.end);var d=this;
  a=function(){var a=d.slider.getValue();d.setTimestamp(a);d.redraw()};this.slider.setOnChangeCallback(a);a()}}else if(a=this.frame.slider,a!==void 0)this.frame.removeChild(a),this.slider=this.frame.slider=void 0};
  links.Network.prototype._reposition=function(){for(var a=this.constants.links.length*2,b=this.frame.canvas.clientWidth/2,d=this.frame.canvas.clientHeight/2,c=0;c<this.nodes.length;c++){var e=2*Math.PI*(c/this.nodes.length);if(!this.nodes[c].xFixed)this.nodes[c].x=b+a*Math.cos(e);if(!this.nodes[c].yFixed)this.nodes[c].y=d+a*Math.sin(e)}};
  links.Network.prototype._doStabilize=function(){for(var a=0,b=this.constants.minVelocity,d=!1;!d&&a<this.constants.maxIterations;)this._calculateForces(),this._discreteStepNodes(),d=!this.isMoving(b),a++};
  links.Network.prototype._calculateForces=function(){for(var a=this.nodes,b=this.links,d=this.frame.canvas.clientWidth/2,c=this.frame.canvas.clientHeight/2,e=0;e<a.length;e++){var f=d-a[e].x,g=c-a[e].y,f=Math.atan2(g,f),g=Math.cos(f)*0.01,f=Math.sin(f)*0.01;this.nodes[e]._setForce(g,f)}d=this.constants.nodes.distance;for(e=0;e<a.length;e++)for(c=e+1;c<this.nodes.length;c++){var f=a[c].x-a[e].x,g=a[c].y-a[e].y,h=Math.sqrt(f*f+g*g),f=Math.atan2(g,f),h=1/(1+Math.exp((h/d-1)*10)),g=Math.cos(f)*h,f=Math.sin(f)*
  h;this.nodes[e]._addForce(-g,-f);this.nodes[c]._addForce(g,f)}a=0;for(e=b.length;a<e;a++)d=b[a],f=d.to.x-d.from.x,g=d.to.y-d.from.y,c=d.length,h=Math.sqrt(f*f+g*g),f=Math.atan2(g,f),c=d.stiffness*(c-h),g=Math.cos(f)*c,f=Math.sin(f)*c,d.from._addForce(-g,-f),d.to._addForce(g,f)};links.Network.prototype.isMoving=function(a){for(var b=this.nodes,d=0,c=b.length;d<c;d++)if(b[d].isMoving(a))return!0;return!1};
  links.Network.prototype._discreteStepNodes=function(){for(var a=this.refreshRate/1E3,b=this.nodes,d=0,c=b.length;d<c;d++)b[d].discreteStep(a)};links.Network.prototype._discreteStepPackages=function(){for(var a=this.refreshRate/1E3,b=this.packages,d=0,c=b.length;d<c;d++)b[d].discreteStep(a)};
  links.Network.prototype._deleteFinishedPackages=function(){for(var a=0,b=!1;a<this.packages.length;)this.packages[a].isFinished()?(this.packages.splice(a,1),a--):this.packages[a].isMoving()&&(b=!0),a++;this.hasMovingPackages=b};
  links.Network.prototype.start=function(){if(this.hasMovingNodes)this._calculateForces(),this._discreteStepNodes(),this.hasMovingNodes=this.isMoving(this.constants.minVelocity);this.hasMovingPackages&&(this._discreteStepPackages(),this._deleteFinishedPackages());if(this.hasMovingNodes||this.hasMovingLinks||this.hasMovingPackages){if(!this.timer){var a=this;this.timer=window.setTimeout(function(){a.timer=void 0;a.start();a._redraw()},this.refreshRate)}}else this._redraw()};
  links.Network.prototype.stop=function(){if(this.timer)window.clearInterval(this.timer),this.timer=void 0};links.Network.addEventListener=function(a,b,d,c){a.addEventListener?(c===void 0&&(c=!1),b==="mousewheel"&&navigator.userAgent.indexOf("Firefox")>=0&&(b="DOMMouseScroll"),a.addEventListener(b,d,c)):a.attachEvent("on"+b,d)};
  links.Network.removeEventListener=function(a,b,d,c){a.removeEventListener?(c===void 0&&(c=!1),b==="mousewheel"&&navigator.userAgent.indexOf("Firefox")>=0&&(b="DOMMouseScroll"),a.removeEventListener(b,d,c)):a.detachEvent("on"+b,d)};links.Network.stopPropagation=function(a){if(!a)a=window.event;a.stopPropagation?a.stopPropagation():a.cancelBubble=!0};links.Network.preventDefault=function(a){if(!a)a=window.event;a.preventDefault?a.preventDefault():a.returnValue=!1};
  links.Network._getAbsoluteLeft=function(a){for(var b=0;a!=null;)b+=a.offsetLeft,b-=a.scrollLeft,a=a.offsetParent;!document.body.scrollLeft&&window.pageXOffset&&(b-=window.pageXOffset);return b};links.Network._getAbsoluteTop=function(a){for(var b=0;a!=null;)b+=a.offsetTop,b-=a.scrollTop,a=a.offsetParent;!document.body.scrollTop&&window.pageYOffset&&(b-=window.pageYOffset);return b};
  links.Network.Node=function(a,b,d,c){this.selected=!1;this.group=c.nodes.group;this.fontSize=c.nodes.fontSize;this.fontFace=c.nodes.fontFace;this.fontColor=c.nodes.fontColor;this.borderColor=c.nodes.borderColor;this.backgroundColor=c.nodes.backgroundColor;this.highlightColor=c.nodes.highlightColor;this.id=void 0;this.style=c.nodes.style;this.image=c.nodes.image;this.y=this.x=0;this.yFixed=this.xFixed=!1;this.radius=c.nodes.radius;this.radiusFixed=!1;this.radiusMin=c.nodes.radiusMin;this.radiusMax=
  c.nodes.radiusMax;this.imagelist=b;this.grouplist=d;this.setProperties(a,c);this.mass=50;this.vy=this.vx=this.fy=this.fx=0;this.minForce=c.minForce;this.damping=0.9};
  links.Network.Node.prototype.setProperties=function(a,b){if(a){if(a.id!=void 0)this.id=a.id;if(a.text!=void 0)this.text=a.text;if(a.title!=void 0)this.title=a.title;if(a.group!=void 0)this.group=a.group;if(a.x!=void 0)this.x=a.x;if(a.y!=void 0)this.y=a.y;if(a.value!=void 0)this.value=a.value;if(a.timestamp!=void 0)this.timestamp=a.timestamp;if(this.id===void 0)throw"Node must have an id";if(this.group){var d=this.grouplist.get(this.group),c;for(c in d)d.hasOwnProperty(c)&&(this[c]=d[c])}if(a.style!=
  void 0)this.style=a.style;if(a.image!=void 0)this.image=a.image;if(a.radius!=void 0)this.radius=a.radius;if(a.borderColor!=void 0)this.borderColor=a.borderColor;if(a.backgroundColor!=void 0)this.backgroundColor=a.backgroundColor;if(a.highlightColor!=void 0)this.highlightColor=a.highlightColor;if(a.fontColor!=void 0)this.fontColor=a.fontColor;if(a.fontSize!=void 0)this.fontSize=a.fontSize;if(a.fontFace!=void 0)this.fontFace=a.fontFace;if(this.image!=void 0)if(this.imagelist)this.imageObj=this.imagelist.load(this.image);
  else throw"No imagelist provided";this.xFixed=this.xFixed||a.x!=void 0;this.yFixed=this.yFixed||a.y!=void 0;this.radiusFixed=this.radiusFixed||a.radius!=void 0;if(this.style=="image")this.radiusMin=b.nodes.widthMin,this.radiusMax=b.nodes.widthMax;switch(this.style){case "database":this.draw=this._drawDatabase;this.resize=this._resizeDatabase;break;case "rect":this.draw=this._drawRect;this.resize=this._resizeRect;break;case "circle":this.draw=this._drawCircle;this.resize=this._resizeCircle;break;case "image":this.draw=
  this._drawImage;this.resize=this._resizeImage;break;case "text":this.draw=this._drawText;this.resize=this._resizeText;break;case "dot":this.draw=this._drawDot;this.resize=this._resizeShape;break;case "square":this.draw=this._drawSquare;this.resize=this._resizeShape;break;case "triangle":this.draw=this._drawTriangle;this.resize=this._resizeShape;break;case "triangleDown":this.draw=this._drawTriangleDown;this.resize=this._resizeShape;break;case "star":this.draw=this._drawStar;this.resize=this._resizeShape;
  break;default:this.draw=this._drawRect,this.resize=this._resizeRect}this._reset()}};links.Network.Node.prototype.select=function(){this.selected=!0;this._reset()};links.Network.Node.prototype.unselect=function(){this.selected=!1;this._reset()};links.Network.Node.prototype._reset=function(){this.height=this.width=void 0};links.Network.Node.prototype.getTitle=function(){return this.title};
  links.Network.Node.prototype.distanceToBorder=function(a,b){this.width||this.resize(a);switch(this.style){case "circle":case "dot":return this.radius+1;default:return this.width?Math.min(Math.abs(this.width/2/Math.cos(b)),Math.abs(this.height/2/Math.sin(b)))+1:0}};links.Network.Node.prototype._setForce=function(a,b){this.fx=a;this.fy=b};links.Network.Node.prototype._addForce=function(a,b){this.fx+=a;this.fy+=b};
  links.Network.Node.prototype.discreteStep=function(a){this.xFixed||(this.vx+=(this.fx+-this.damping*this.vx)/this.mass/a,this.x+=this.vx/a);this.yFixed||(this.vy+=(this.fy+-this.damping*this.vy)/this.mass/a,this.y+=this.vy/a)};links.Network.Node.prototype.isFixed=function(){return this.xFixed&&this.yFixed};links.Network.Node.prototype.isMoving=function(a){return Math.abs(this.vx)>a||Math.abs(this.vy)>a||!this.xFixed&&Math.abs(this.fx)>this.minForce||!this.yFixed&&Math.abs(this.fy)>this.minForce};
  links.Network.Node.prototype.isSelected=function(){return this.selected};links.Network.Node.prototype.getValue=function(){return this.value};links.Network.Node.prototype.getDistance=function(a,b){var d=this.x-a,c=this.y-b;return Math.sqrt(d*d+c*c)};links.Network.Node.prototype.setValueRange=function(a,b){if(!this.radiusFixed&&this.value!==void 0)this.radius=(this.value-a)*((this.radiusMax-this.radiusMin)/(b-a))+this.radiusMin};
  links.Network.Node.prototype.draw=function(){throw"Draw method not initialized for node";};links.Network.Node.prototype.resize=function(){throw"Resize method not initialized for node";};links.Network.Node.prototype.isOverlappingWith=function(a){return this.left<a.right&&this.left+this.width>a.left&&this.top<a.bottom&&this.top+this.height>a.top};
  links.Network.Node.prototype._resizeImage=function(){if(!this.width){var a,b;this.value?(b=this.imageObj.height/this.imageObj.width,a=this.radius||this.imageObj.width,b=this.radius*b||this.imageObj.height):(a=this.imageObj.width,b=this.imageObj.height);this.width=a;this.height=b}};
  links.Network.Node.prototype._drawImage=function(a){this._resizeImage(a);this.left=this.x-this.width/2;this.top=this.y-this.height/2;var b;this.imageObj?(a.drawImage(this.imageObj,this.left,this.top,this.width,this.height),b=this.y+this.height/2):b=this.y;this._text(a,this.text,this.x,b,void 0,"top")};links.Network.Node.prototype._resizeRect=function(a){if(!this.width)a=this.getTextSize(a),this.width=a.width+10,this.height=a.height+10};
  links.Network.Node.prototype._drawRect=function(a){this._resizeRect(a);this.left=this.x-this.width/2;this.top=this.y-this.height/2;a.strokeStyle=this.borderColor;a.fillStyle=this.selected?this.highlightColor:this.backgroundColor;a.lineWidth=this.selected?2:1;a.roundRect(this.left,this.top,this.width,this.height,this.radius);a.fill();a.stroke();this._text(a,this.text,this.x,this.y)};
  links.Network.Node.prototype._resizeDatabase=function(a){if(!this.width)this.height=this.width=a=this.getTextSize(a).width+10};
  links.Network.Node.prototype._drawDatabase=function(a){this._resizeDatabase(a);this.left=this.x-this.width/2;this.top=this.y-this.height/2;a.strokeStyle=this.borderColor;a.fillStyle=this.selected?this.highlightColor:this.backgroundColor;a.lineWidth=this.selected?2:1;a.database(this.x-this.width/2,this.y-this.height*0.5,this.width,this.height);a.fill();a.stroke();this._text(a,this.text,this.x,this.y)};
  links.Network.Node.prototype._resizeCircle=function(a){if(!this.width)a=this.getTextSize(a),a=Math.max(a.width,a.height)+10,this.radius=a/2,this.height=this.width=a};
  links.Network.Node.prototype._drawCircle=function(a){this._resizeCircle(a);this.left=this.x-this.width/2;this.top=this.y-this.height/2;a.strokeStyle=this.borderColor;a.fillStyle=this.selected?this.highlightColor:this.backgroundColor;a.lineWidth=this.selected?2:1;a.circle(this.x,this.y,this.radius);a.fill();a.stroke();this._text(a,this.text,this.x,this.y)};links.Network.Node.prototype._drawDot=function(a){this._drawShape(a,"circle")};
  links.Network.Node.prototype._drawTriangle=function(a){this._drawShape(a,"triangle")};links.Network.Node.prototype._drawTriangleDown=function(a){this._drawShape(a,"triangleDown")};links.Network.Node.prototype._drawSquare=function(a){this._drawShape(a,"square")};links.Network.Node.prototype._drawStar=function(a){this._drawShape(a,"star")};links.Network.Node.prototype._resizeShape=function(){if(!this.width){var a=2*this.radius;this.height=this.width=a}};
  links.Network.Node.prototype._drawShape=function(a,b){this._resizeShape(a);this.left=this.x-this.width/2;this.top=this.y-this.height/2;a.strokeStyle=this.borderColor;a.fillStyle=this.selected?this.highlightColor:this.backgroundColor;a.lineWidth=this.selected?2:1;a[b](this.x,this.y,this.radius);a.fill();a.stroke();this.text&&this._text(a,this.text,this.x,this.y+this.height/2,void 0,"top")};
  links.Network.Node.prototype._resizeText=function(a){if(!this.width)a=this.getTextSize(a),this.width=a.width+10,this.height=a.height+10};links.Network.Node.prototype._drawText=function(a){this._resizeText(a);this.left=this.x-this.width/2;this.top=this.y-this.height/2;this._text(a,this.text,this.x,this.y)};
  links.Network.Node.prototype._text=function(a,b,d,c,e,f){if(b){a.font=(this.selected?"bold ":"")+this.fontSize+"px "+this.fontFace;a.fillStyle=this.fontColor||"black";a.textAlign=e||"center";a.textBaseline=f||"middle";b=b.split("\n");e=b.length;f=this.fontSize+4;c+=(1-e)/2*f;for(var g=0;g<e;g++)a.fillText(b[g],d,c),c+=f}};
  links.Network.Node.prototype.getTextSize=function(a){if(this.text!=void 0){a.font=(this.selected?"bold ":"")+this.fontSize+"px "+this.fontFace;for(var b=this.text.split("\n"),d=(this.fontSize+4)*b.length,c=0,e=0,f=b.length;e<f;e++)c=Math.max(c,a.measureText(b[e]).width);return{width:c,height:d}}else return{width:0,height:0}};
  links.Network.Link=function(a,b,d){if(!b)throw"No network provided";this.network=b;this.widthMin=d.links.widthMin;this.widthMax=d.links.widthMax;this.id=void 0;this.style=d.links.style;this.title=void 0;this.width=d.links.width;this.value=void 0;this.length=d.links.length;this.dashlength=d.links.dashlength;this.dashgap=d.links.dashgap;this.altdashlength=d.links.altdashlength;this.stiffness=void 0;this.color=d.links.color;this.timestamp=void 0;this.lengthFixed=this.widthFixed=!1;this.setProperties(a,
  d)};
  links.Network.Link.prototype.setProperties=function(a,b){if(a){if(a.from!=void 0)this.from=this.network._getNode(a.from);if(a.to!=void 0)this.to=this.network._getNode(a.to);if(a.id!=void 0)this.id=a.id;if(a.style!=void 0)this.style=a.style;if(a.text!=void 0)this.text=a.text;if(this.text){this.fontSize=b.links.fontSize;this.fontFace=b.links.fontFace;this.fontColor=b.links.fontColor;if(a.fontColor!=void 0)this.fontColor=a.fontColor;if(a.fontSize!=void 0)this.fontSize=a.fontSize;if(a.fontFace!=void 0)this.fontFace=a.fontFace}if(a.title!=
  void 0)this.title=a.title;if(a.width!=void 0)this.width=a.width;if(a.value!=void 0)this.value=a.value;if(a.length!=void 0)this.length=a.length;if(a.dashlength!=void 0)this.dashlength=a.dashlength;if(a.dashgap!=void 0)this.dashgap=a.dashgap;if(a.altdashlength!=void 0)this.altdashlength=a.altdashlength;if(a.color!=void 0)this.color=a.color;if(a.timestamp!=void 0)this.timestamp=a.timestamp;if(!this.from)throw"Node with id "+a.from+" not found";if(!this.to)throw"Node with id "+a.to+" not found";this.widthFixed=
  this.widthFixed||a.width!=void 0;this.lengthFixed=this.lengthFixed||a.length!=void 0;this.stiffness=1/this.length;if(this.style==="arrow")this.arrows=[0.5],this.animation=!1;else if(this.style==="arrow-end")this.animation=!1;else if(this.style==="moving-arrows"){this.arrows=[];for(var d=0;d<3;d++)this.arrows.push(d/3);this.animation=!0}else this.style==="moving-dot"?(this.dot=0,this.animation=!0):this.animation=!1;switch(this.style){case "line":this.draw=this._drawLine;break;case "arrow":this.draw=
  this._drawArrow;break;case "arrow-end":this.draw=this._drawArrowEnd;break;case "moving-arrows":this.draw=this._drawMovingArrows;break;case "moving-dot":this.draw=this._drawMovingDot;break;case "dash-line":this.draw=this._drawDashLine;break;default:this.draw=this._drawLine}}};links.Network.Link.prototype.isMoving=function(){return this.animation};links.Network.Link.prototype.getTitle=function(){return this.title};links.Network.Link.prototype.getValue=function(){return this.value};
  links.Network.Link.prototype.setValueRange=function(a,b){if(!this.widthFixed&&this.value!==void 0)this.width=(this.value-a)*((this.widthMax-this.widthMin)/(b-a))+this.widthMin};links.Network.Link.prototype.isLengthFixed=function(){return this.lengthFixed};links.Network.Link.prototype.getLength=function(){return this.length};links.Network.Link.prototype.setLength=function(a){if(!this.lengthFixed)this.length=a};links.Network.Link.prototype.getDashLength=function(){return this.dashlength};
  links.Network.Link.prototype.setDashLength=function(a){this.dashlength=a};links.Network.Link.prototype.getDashGap=function(){return this.dashgap};links.Network.Link.prototype.setDashGap=function(a){this.dashgap=a};links.Network.Link.prototype.getAltDashLength=function(){return this.altdashlength};links.Network.Link.prototype.setAltDashLength=function(a){this.altdashlength=a};links.Network.Link.prototype.draw=function(){throw"Method draw not initialized in link";};
  links.Network.Link.prototype.isOverlappingWith=function(a){return links.Network._dist(this.from.x,this.from.y,this.to.x,this.to.y,a.left,a.top)<10};links.Network._dist=function(a,b,d,c,e,f){d-=a;c-=b;var g=((e-a)*d+(f-b)*c)/(d*d+c*c);g>1?g=1:g<0&&(g=0);a=a+g*d-e;b=b+g*c-f;return Math.sqrt(a*a+b*b)};
  links.Network.Link.prototype._drawLine=function(a){a.strokeStyle=this.color;a.lineWidth=this.width;var b;if(this.from!=this.to)this._line(a),this.text&&(b=this._pointOnLine(0.5),this._text(a,this.text,b.x,b.y));else{b=this.length/2/Math.PI;var d,c;c=this.from;c.width||c.resize(a);c.width>c.height?(d=c.x+c.width/2,c=c.y-b):(d=c.x+b,c=c.y-c.height/2);this._circle(a,d,c,b);b=this._pointOnCircle(d,c,b,0.5);this._text(a,this.text,b.x,b.y)}};
  links.Network.Link.prototype._line=function(a){a.beginPath();a.moveTo(this.from.x,this.from.y);a.lineTo(this.to.x,this.to.y);a.stroke()};links.Network.Link.prototype._circle=function(a,b,d,c){a.beginPath();a.arc(b,d,c,0,2*Math.PI,!1);a.stroke()};
  links.Network.Link.prototype._text=function(a,b,d,c){if(b){a.font=this.fontSize+"px "+this.fontFace;a.fillStyle="white";var b=a.measureText(this.text).width,e=this.fontSize;d-=b/2;c-=e/2;a.fillRect(d,c,b,e);a.fillStyle=this.fontColor||"black";a.textAlign="left";a.textBaseline="top";a.fillText(this.text,d,c)}};var CP=window.CanvasRenderingContext2D&&CanvasRenderingContext2D.prototype;
  if(CP&&CP.lineTo)CP.dashedLine=function(a,b,d,c,e){e||(e=[10,5]);var f=e.length;this.moveTo(a,b);d-=a;for(var g=c-b,c=g/d,g=Math.sqrt(d*d+g*g),h=0,i=!0;g>=0.1;){var k=e[h++%f];k>g&&(k=g);var j=Math.sqrt(k*k/(1+c*c));d<0&&(j=-j);a+=j;b+=c*j;this[i?"lineTo":"moveTo"](a,b);g-=k;i=!i}};
  links.Network.Link.prototype._drawDashLine=function(a){a.strokeStyle=this.color;a.lineWidth=this.width;a.beginPath();a.lineCap="round";this.altdashlength!=void 0?a.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y,[this.dashlength,this.dashgap,this.altdashlength,this.dashgap]):this.dashlength!=void 0&&this.dashgap!=void 0?a.dashedLine(this.from.x,this.from.y,this.to.x,this.to.y,[this.dashlength,this.dashgap]):(a.moveTo(this.from.x,this.from.y),a.lineTo(this.to.x,this.to.y));a.stroke();if(this.text){var b=
  this._pointOnLine(0.5);this._text(a,this.text,b.x,b.y)}};links.Network.Link.prototype._pointOnLine=function(a){return{x:(1-a)*this.from.x+a*this.to.x,y:(1-a)*this.from.y+a*this.to.y}};links.Network.Link.prototype._pointOnCircle=function(a,b,d,c){c=(c-0.375)*2*Math.PI;return{x:a+d*Math.cos(c),y:b-d*Math.sin(c)}};
  links.Network.Link.prototype._drawMovingArrows=function(a){this._drawArrow(a);for(var b in this.arrows)this.arrows.hasOwnProperty(b)&&(this.arrows[b]+=0.02,this.arrows[b]>1&&(this.arrows[b]=0))};
  links.Network.Link.prototype._drawMovingDot=function(a){a.strokeStyle=this.color;a.fillStyle=this.color;a.lineWidth=this.width;var b;if(this.from!=this.to){this._line(a);var d=4+this.width*2;b=this._pointOnLine(this.dot);a.circle(b.x,b.y,d);a.fill();this.dot+=0.05;if(this.dot>1)this.dot=0;this.text&&(b=this._pointOnLine(0.5),this._text(a,this.text,b.x,b.y))}};
  links.Network.Link.prototype._drawArrow=function(a){var b;a.strokeStyle=this.color;a.fillStyle=this.color;a.lineWidth=this.width;if(this.from!=this.to){this._line(a);var d=Math.atan2(this.to.y-this.from.y,this.to.x-this.from.x),c=10+5*this.width,e;for(e in this.arrows)this.arrows.hasOwnProperty(e)&&(b=this._pointOnLine(this.arrows[e]),a.arrow(b.x,b.y,d,c),a.fill(),a.stroke());this.text&&(b=this._pointOnLine(0.5),this._text(a,this.text,b.x,b.y))}else{var f=this.length/2/Math.PI,g,h;b=this.from;b.width||
  b.resize(a);b.width>b.height?(g=b.x+b.width/2,h=b.y-f):(g=b.x+f,h=b.y-b.height/2);this._circle(a,g,h,f);d=0.2*Math.PI;c=10+5*this.width;for(e in this.arrows)this.arrows.hasOwnProperty(e)&&(b=this._pointOnCircle(g,h,f,this.arrows[e]),a.arrow(b.x,b.y,d,c),a.fill(),a.stroke());this.text&&(b=this._pointOnCircle(g,h,f,0.5),this._text(a,this.text,b.x,b.y))}};
  links.Network.Link.prototype._drawArrowEnd=function(a){var b,d,c;a.strokeStyle=this.color;a.fillStyle=this.color;a.lineWidth=this.width;var e;if(this.from!=this.to){b=Math.atan2(this.to.y-this.from.y,this.to.x-this.from.x);e=this.to.x-this.from.x;var f=this.to.y-this.from.y,g=Math.sqrt(e*e+f*f);e=this.to.distanceToBorder(a,b+Math.PI);f=(g-e)/g;e=f*this.from.x+(1-f)*this.to.x;var f=f*this.from.y+(1-f)*this.to.y,h=this.to.distanceToBorder(a,b),h=(g-h)/g,g=(1-h)*this.from.x+h*this.to.x,h=(1-h)*this.from.y+
  h*this.to.y;a.beginPath();a.moveTo(e,f);a.lineTo(g,h);a.stroke();e=10+5*this.width;a.arrow(g,h,b,e);a.fill();a.stroke();this.text&&(b=this._pointOnLine(0.5),this._text(a,this.text,b.x,b.y))}else f=this.length/2/Math.PI,e=this.from,e.width||e.resize(a),e.width>e.height?(g=e.x+e.width/2,h=e.y-f,b=g,d=e.y,c=0.9*Math.PI):(g=e.x+f,h=e.y-e.height/2,b=e.x,d=h,c=0.6*Math.PI),a.beginPath(),a.arc(g,h,f,0,2*Math.PI,!1),a.stroke(),e=10+5*this.width,a.arrow(b,d,c,e),a.fill(),a.stroke(),this.text&&(b=this._pointOnCircle(g,
  h,f,0.5),this._text(a,this.text,b.x,b.y))};links.Network.Images=function(){this.images={};this.callback=void 0};links.Network.Images.prototype.setOnloadCallback=function(a){this.callback=a};links.Network.Images.prototype.load=function(a){var b=this.images[a];if(b==void 0){var d=this,b=new Image;this.images[a]=b;b.onload=function(){d.callback&&d.callback(this)};b.src=a}return b};
  links.Network.Package=function(a,b,d,c){if(b==void 0)throw"No network provided";this.radiusMin=c.packages.radiusMin;this.radiusMax=c.packages.radiusMax;this.imagelist=d;this.network=b;this.title=this.to=this.from=this.id=void 0;this.style=c.packages.style;this.radius=c.packages.radius;this.color=c.packages.color;this.image=c.packages.image;this.value=void 0;this.progress=0;this.timestamp=void 0;this.duration=c.packages.duration;this.autoProgress=!0;this.radiusFixed=!1;this.setProperties(a,c)};
  links.Network.Package.DEFAULT_DURATION=1;
  links.Network.Package.prototype.setProperties=function(a,b){if(a){if(a.from!=void 0)this.from=this.network._getNode(a.from);if(a.to!=void 0)this.to=this.network._getNode(a.to);if(!this.from)throw"Node with id "+a.from+" not found";if(!this.to)throw"Node with id "+a.to+" not found";if(a.id!=void 0)this.id=a.id;if(a.title!=void 0)this.title=a.title;if(a.style!=void 0)this.style=a.style;if(a.radius!=void 0)this.radius=a.radius;if(a.value!=void 0)this.value=a.value;if(a.image!=void 0)this.image=a.image;
  if(a.color!=void 0)this.color=a.color;if(a.dashlength!=void 0)this.dashlength=a.dashlength;if(a.dashgap!=void 0)this.dashgap=a.dashgap;if(a.altdashlength!=void 0)this.altdashlength=a.altdashlength;if(a.progress!=void 0)this.progress=a.progress;if(a.timestamp!=void 0)this.timestamp=a.timestamp;if(a.duration!=void 0)this.duration=a.duration;this.radiusFixed=this.radiusFixed||a.radius!=void 0;this.autoProgress=this.autoProgress==!0?a.progress==void 0:!1;if(this.style=="image")this.radiusMin=b.packages.widthMin,
  this.radiusMax=b.packages.widthMax;if(this.progress<0)this.progress=0;if(this.progress>1)this.progress=1;if(this.image!=void 0)if(this.imagelist)this.imageObj=this.imagelist.load(this.image);else throw"No imagelist provided";switch(this.style){case "dot":this.draw=this._drawDot;break;case "square":this.draw=this._drawSquare;break;case "triangle":this.draw=this._drawTriangle;break;case "triangleDown":this.draw=this._drawTriangleDown;break;case "star":this.draw=this._drawStar;break;case "image":this.draw=
  this._drawImage;break;default:this.draw=this._drawDot}}};links.Network.Package.prototype.setProgress=function(a){this.progress=a;this.autoProgress=!1};links.Network.Package.prototype.isFinished=function(){return this.autoProgress==!0&&this.progress>=1};links.Network.Package.prototype.isMoving=function(){return this.autoProgress||this.isFinished()};
  links.Network.Package.prototype.discreteStep=function(a){if(this.autoProgress==!0&&(this.progress+=parseFloat(a)/this.duration,this.progress>1))this.progress=1};links.Network.Package.prototype.draw=function(){throw"Draw method not initialized for package";};links.Network.Package.prototype.isOverlappingWith=function(a){var b=Math.max(this.radius,10),d=this._getPosition();return d.x-b<a.right&&d.x+b>a.left&&d.y-b<a.bottom&&d.y+b>a.top};
  links.Network.Package.prototype._getPosition=function(){return{x:(1-this.progress)*this.from.x+this.progress*this.to.x,y:(1-this.progress)*this.from.y+this.progress*this.to.y}};links.Network.Package.prototype.getTitle=function(){return this.title};links.Network.Package.prototype.getValue=function(){return this.value};links.Network.Package.prototype.getDistance=function(a,b){var d=this._getPosition(),c=d.x-a,d=d.y-b;return Math.sqrt(c*c+d*d)};
  links.Network.Package.prototype.setValueRange=function(a,b){if(!this.radiusFixed&&this.value!==void 0)this.radius=(this.value-a)*((this.radiusMax-this.radiusMin)/(b-a))+this.radiusMin};links.Network.Package.prototype._drawDot=function(a){this._drawShape(a,"circle")};links.Network.Package.prototype._drawTriangle=function(a){this._drawShape(a,"triangle")};links.Network.Package.prototype._drawTriangleDown=function(a){this._drawShape(a,"triangleDown")};
  links.Network.Package.prototype._drawSquare=function(a){this._drawShape(a,"square")};links.Network.Package.prototype._drawStar=function(a){this._drawShape(a,"star")};links.Network.Package.prototype._drawShape=function(a,b){a.fillStyle=this.color;var d=this._getPosition();a[b](d.x,d.y,this.radius);a.fill()};
  links.Network.Package.prototype._drawImage=function(a){if(this.imageObj){var b,d;this.value?(d=this.imageObj.height/this.imageObj.width,b=this.radius||this.imageObj.width,d=this.radius*d||this.imageObj.height):(b=this.imageObj.width,d=this.imageObj.height);var c=this._getPosition();a.drawImage(this.imageObj,c.x-b/2,c.y-d/2,b,d)}else console.log("image still loading...")};links.Network.Groups=function(){this.clear();this.defaultIndex=0};
  links.Network.Groups.DEFAULT=[{borderColor:"#2B7CE9",backgroundColor:"#97C2FC",highlightColor:"#D2E5FF"},{borderColor:"#FFA500",backgroundColor:"#FFFF00",highlightColor:"#FFFFA3"},{borderColor:"#FA0A10",backgroundColor:"#FB7E81",highlightColor:"#FFAFB1"},{borderColor:"#41A906",backgroundColor:"#7BE141",highlightColor:"#A1EC76"},{borderColor:"#E129F0",backgroundColor:"#EB7DF4",highlightColor:"#F0B3F5"},{borderColor:"#7C29F0",backgroundColor:"#AD85E4",highlightColor:"#D3BDF0"},{borderColor:"#C37F00",
  backgroundColor:"#FFA807",highlightColor:"#FFCA66"},{borderColor:"#4220FB",backgroundColor:"#6E6EFD",highlightColor:"#9B9BFD"},{borderColor:"#FD5A77",backgroundColor:"#FFC0CB",highlightColor:"#FFD1D9"},{borderColor:"#4AD63A",backgroundColor:"#C2FABC",highlightColor:"#E6FFE3"}];links.Network.Groups.prototype.clear=function(){this.groups={};this.groups.length=function(){var a=0,b;for(b in this)this.hasOwnProperty(b)&&a++;return a}};
  links.Network.Groups.prototype.get=function(a){var b=this.groups[a];if(b==void 0){var d=this.defaultIndex%links.Network.Groups.DEFAULT.length;this.defaultIndex++;b={};b.borderColor=links.Network.Groups.DEFAULT[d].borderColor;b.backgroundColor=links.Network.Groups.DEFAULT[d].backgroundColor;b.highlightColor=links.Network.Groups.DEFAULT[d].highlightColor;this.groups[a]=b}return b};links.Network.Groups.prototype.add=function(a,b){return this.groups[a]=b};
  links.Network.isArray=function(a){return a instanceof Array?!0:Object.prototype.toString.call(a)==="[object Array]"};
  links.Network.Slider=function(a){if(a===void 0)throw"Error: No container element defined";this.container=a;this.frame=document.createElement("DIV");this.frame.style.width="100%";this.frame.style.position="relative";this.title=document.createElement("DIV");this.title.style.margin="2px";this.title.style.marginBottom="5px";this.title.innerHTML="";this.container.appendChild(this.title);this.frame.prev=document.createElement("INPUT");this.frame.prev.type="BUTTON";this.frame.prev.value="Prev";this.frame.appendChild(this.frame.prev);
  this.frame.play=document.createElement("INPUT");this.frame.play.type="BUTTON";this.frame.play.value="Play";this.frame.appendChild(this.frame.play);this.frame.next=document.createElement("INPUT");this.frame.next.type="BUTTON";this.frame.next.value="Next";this.frame.appendChild(this.frame.next);this.frame.bar=document.createElement("INPUT");this.frame.bar.type="BUTTON";this.frame.bar.style.position="absolute";this.frame.bar.style.border="1px solid red";this.frame.bar.style.width="100px";this.frame.bar.style.height=
  "6px";this.frame.bar.style.borderRadius="2px";this.frame.bar.style.MozBorderRadius="2px";this.frame.bar.style.border="1px solid #7F7F7F";this.frame.bar.style.backgroundColor="#E5E5E5";this.frame.appendChild(this.frame.bar);this.frame.slide=document.createElement("INPUT");this.frame.slide.type="BUTTON";this.frame.slide.style.margin="0px";this.frame.slide.value=" ";this.frame.slide.style.position="relative";this.frame.slide.style.left="-100px";this.frame.appendChild(this.frame.slide);var b=this;this.frame.slide.onmousedown=
  function(a){b._onMouseDown(a)};this.frame.prev.onclick=function(a){b.prev(a)};this.frame.play.onclick=function(a){b.togglePlay(a)};this.frame.next.onclick=function(a){b.next(a)};this.container.appendChild(this.frame);this.playTimeout=this.onChangeCallback=void 0;this.framerate=20;this.duration=10;this.doLoop=!0;this.step=this.value=this.end=this.start=0;this.rangeIsDate=!1;this.redraw()};links.Network.Slider.prototype._updateStep=function(){this.step=(this.end-this.start)/(this.duration*this.framerate)};
  links.Network.Slider.prototype.prev=function(){this._setValue(this.value-this.step)};links.Network.Slider.prototype.next=function(){this._setValue(this.value+this.step)};
  links.Network.Slider.prototype.playNext=function(){var a=new Date;if(!this.leftButtonDown)if(this.value+this.step<this.end)this._setValue(this.value+this.step);else if(this.doLoop)this._setValue(this.start);else{this._setValue(this.end);this.stop();return}var a=Math.max(1E3/this.framerate-(new Date-a),0),b=this;this.playTimeout=setTimeout(function(){b.playNext()},a)};links.Network.Slider.prototype.togglePlay=function(){this.playTimeout===void 0?this.play():this.stop()};
  links.Network.Slider.prototype.play=function(){this.frame.play.value="Stop";this.playNext()};links.Network.Slider.prototype.stop=function(){this.frame.play.value="Play";clearInterval(this.playTimeout);this.playTimeout=void 0};links.Network.Slider.prototype.setOnChangeCallback=function(a){this.onChangeCallback=a};links.Network.Slider.prototype.setFramerate=function(a){this.framerate=a;this._updateStep()};links.Network.Slider.prototype.getFramerate=function(){return this.framerate};
  links.Network.Slider.prototype.setDuration=function(a){this.duration=a;this._updateStep()};links.Network.Slider.prototype.setAcceleration=function(a){this.duration=(this.end-this.start)/1E3/a;this._updateStep()};links.Network.Slider.prototype.setLoop=function(a){this.doLoop=a};links.Network.Slider.prototype.getLoop=function(){return this.doLoop};links.Network.Slider.prototype.onChange=function(){if(this.onChangeCallback!==void 0)this.onChangeCallback()};
  links.Network.Slider.prototype.redraw=function(){var a=this.frame.clientWidth-this.frame.prev.clientWidth-this.frame.play.clientWidth-this.frame.next.clientWidth-30;this.frame.bar.style.top=this.frame.clientHeight/2-this.frame.bar.offsetHeight/2+"px";this.frame.bar.style.width=a+"px";this.frame.slide.title=this.getValue();this.frame.slide.style.left=this._valueToLeft(this.value)+"px";this.title.innerHTML=this.getValue()};
  links.Network.Slider.prototype.setRange=function(a,b){a===void 0||a===null||a===NaN?(this.start=0,this.rangeIsDate=!1):a instanceof Date?(this.start=a.getTime(),this.rangeIsDate=!0):(this.start=a,this.rangeIsDate=!1);this.end=b===void 0||b===null||b===NaN?this.start instanceof Date?new Date(this.start):this.start:b instanceof Date?b.getTime():b;this.value=this.start;this._updateStep();this.redraw()};
  links.Network.Slider.prototype._setValue=function(a){this.value=this._limitValue(a);this.redraw();this.onChange()};links.Network.Slider.prototype.getValue=function(){return this.rangeIsDate?new Date(this.value):this.value};links.Network.Slider.prototype.offset=3;links.Network.Slider.prototype._leftToValue=function(a){var b=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10;return this._limitValue((a-this.offset)/b*(this.end-this.start)+this.start)};
  links.Network.Slider.prototype._valueToLeft=function(a){var b=parseFloat(this.frame.bar.style.width)-this.frame.slide.clientWidth-10;return(this.end>this.start?(a-this.start)/(this.end-this.start)*b:0)+this.offset};links.Network.Slider.prototype._limitValue=function(a){if(a<this.start)a=this.start;if(a>this.end)a=this.end;return a};
  links.Network.Slider.prototype._onMouseDown=function(a){if(this.leftButtonDown=a.which?a.which===1:a.button===1){this.startClientX=a.clientX;this.startSlideX=parseFloat(this.frame.slide.style.left);this.frame.style.cursor="move";var b=this;this.onmousemove=function(a){b._onMouseMove(a)};this.onmouseup=function(a){b._onMouseUp(a)};links.Network.addEventListener(document,"mousemove",this.onmousemove);links.Network.addEventListener(document,"mouseup",this.onmouseup);links.Network.preventDefault(a)}};
  links.Network.Slider.prototype._onMouseMove=function(a){this._setValue(this._leftToValue(this.startSlideX+(a.clientX-this.startClientX)));links.Network.preventDefault(a)};links.Network.Slider.prototype._onMouseUp=function(a){this.frame.style.cursor="auto";this.leftButtonDown=!1;links.Network.removeEventListener(document,"mousemove",this.onmousemove);links.Network.removeEventListener(document,"mouseup",this.onmouseup);links.Network.preventDefault(a)};
  links.Network.Popup=function(a,b,d,c){this.container=a?a:document.body;this.y=this.x=0;this.padding=5;b!==void 0&&d!==void 0&&this.setPosition(b,d);c!==void 0&&this.setText(c);this.frame=document.createElement("div");a=this.frame.style;a.position="absolute";a.visibility="hidden";a.border="1px solid #666";a.color="black";a.padding=this.padding+"px";a.backgroundColor="#FFFFC6";a.borderRadius="3px";a.MozBorderRadius="3px";a.WebkitBorderRadius="3px";a.boxShadow="3px 3px 10px rgba(128, 128, 128, 0.5)";
  a.whiteSpace="nowrap";this.container.appendChild(this.frame)};links.Network.Popup.prototype.setPosition=function(a,b){this.x=parseInt(a);this.y=parseInt(b)};links.Network.Popup.prototype.setText=function(a){this.frame.innerHTML=a};
  links.Network.Popup.prototype.show=function(a){a===void 0&&(a=!0);if(a){var b=this.frame.clientHeight,a=this.frame.clientWidth,d=this.frame.parentNode.clientHeight,c=this.frame.parentNode.clientWidth,e=this.y-b;e+b+this.padding>d&&(e=d-b-this.padding);if(e<this.padding)e=this.padding;b=this.x;b+a+this.padding>c&&(b=c-a-this.padding);if(b<this.padding)b=this.padding;this.frame.style.left=b+"px";this.frame.style.top=e+"px";this.frame.style.visibility="visible"}else this.hide()};
  links.Network.Popup.prototype.hide=function(){this.frame.style.visibility="hidden"};
  links.events=links.events||{listeners:[],indexOf:function(a){for(var b=this.listeners,d=0,c=this.listeners.length;d<c;d++){var e=b[d];if(e&&e.object==a)return d}return-1},addListener:function(a,b,d){var c=this.listeners[this.indexOf(a)];c||(c={object:a,events:{}},this.listeners.push(c));a=c.events[b];a||(a=[],c.events[b]=a);a.indexOf(d)==-1&&a.push(d)},removeListener:function(a,b,d){var a=this.indexOf(a),c=this.listeners[a];if(c){var e=c.events[b];e&&(d=e.indexOf(d),d!=-1&&e.splice(d,1),e.length==
  0&&delete c.events[b]);var b=0,c=c.events,f;for(f in c)c.hasOwnProperty(f)&&b++;b==0&&delete this.listeners[a]}},removeAllListeners:function(){this.listeners=[]},trigger:function(a,b,d){if(a=this.listeners[this.indexOf(a)])if(b=a.events[b])for(var a=0,c=b.length;a<c;a++)b[a](d)}};CanvasRenderingContext2D.prototype.circle=function(a,b,d){this.beginPath();this.arc(a,b,d,0,2*Math.PI,!1)};CanvasRenderingContext2D.prototype.square=function(a,b,d){this.beginPath();this.rect(a-d,b-d,d*2,d*2)};
  CanvasRenderingContext2D.prototype.triangle=function(a,b,d){this.beginPath();var c=d*2,d=c/2,e=Math.sqrt(3)/6*c,c=Math.sqrt(c*c-d*d);this.moveTo(a,b-(c-e));this.lineTo(a+d,b+e);this.lineTo(a-d,b+e);this.lineTo(a,b-(c-e));this.closePath()};CanvasRenderingContext2D.prototype.triangleDown=function(a,b,d){this.beginPath();var c=d*2,d=c/2,e=Math.sqrt(3)/6*c,c=Math.sqrt(c*c-d*d);this.moveTo(a,b+(c-e));this.lineTo(a+d,b-e);this.lineTo(a-d,b-e);this.lineTo(a,b+(c-e));this.closePath()};
  CanvasRenderingContext2D.prototype.star=function(a,b,d){this.beginPath();for(var c=0;c<10;c++){var e=c%2===0?d*1.3:d*0.5;this.lineTo(a+e*Math.sin(c*2*Math.PI/10),b-e*Math.cos(c*2*Math.PI/10))}this.closePath()};
  CanvasRenderingContext2D.prototype.roundRect=function(a,b,d,c,e){var f=Math.PI/180;d-2*e<0&&(e=d/2);c-2*e<0&&(e=c/2);this.beginPath();this.moveTo(a+e,b);this.lineTo(a+d-e,b);this.arc(a+d-e,b+e,e,f*270,f*360,!1);this.lineTo(a+d,b+c-e);this.arc(a+d-e,b+c-e,e,0,f*90,!1);this.lineTo(a+e,b+c);this.arc(a+e,b+c-e,e,f*90,f*180,!1);this.lineTo(a,b+e);this.arc(a+e,b+e,e,f*180,f*270,!1)};
  CanvasRenderingContext2D.prototype.ellipse=function(a,b,d,c){var e=d/2*0.5522848,f=c/2*0.5522848,g=a+d,h=b+c,d=a+d/2,c=b+c/2;this.beginPath();this.moveTo(a,c);this.bezierCurveTo(a,c-f,d-e,b,d,b);this.bezierCurveTo(d+e,b,g,c-f,g,c);this.bezierCurveTo(g,c+f,d+e,h,d,h);this.bezierCurveTo(d-e,h,a,c+f,a,c)};
  CanvasRenderingContext2D.prototype.database=function(a,b,d,c){var e=c*(1/3),f=d/2*0.5522848,g=e/2*0.5522848,h=a+d,i=b+e,d=a+d/2,k=b+e/2,e=b+(c-e/2),c=b+c;this.beginPath();this.moveTo(h,k);this.bezierCurveTo(h,k+g,d+f,i,d,i);this.bezierCurveTo(d-f,i,a,k+g,a,k);this.bezierCurveTo(a,k-g,d-f,b,d,b);this.bezierCurveTo(d+f,b,h,k-g,h,k);this.lineTo(h,e);this.bezierCurveTo(h,e+g,d+f,c,d,c);this.bezierCurveTo(d-f,c,a,e+g,a,e);this.lineTo(a,k)};
  CanvasRenderingContext2D.prototype.arrow=function(a,b,d,c){var e=a-c*Math.cos(d),f=b-c*Math.sin(d),g=a-c*0.9*Math.cos(d),h=b-c*0.9*Math.sin(d),i=e+c/3*Math.cos(d+0.5*Math.PI),k=f+c/3*Math.sin(d+0.5*Math.PI);e+=c/3*Math.cos(d-0.5*Math.PI);d=f+c/3*Math.sin(d-0.5*Math.PI);this.beginPath();this.moveTo(a,b);this.lineTo(i,k);this.lineTo(g,h);this.lineTo(e,d);this.closePath()};links.Network.util={};
  links.Network.util.parseDOT=function(a){function b(a){return a==" "||a=="\t"||a=="\n"||a=="\r"}function d(){k++;j=a[k]}function c(){return"(char "+k+")"}function e(){for(;j&&b(j);)d();var c=a[k-1],f=j+a[k+1];if(f=="/*"){for(;j&&!(j=="*"&&a[k+1]=="/");)d();d();d();e()}else if(f=="//"||j=="#"&&c=="\n"){for(;j&&j!="\n";)d();d();e()}}function f(){e();var a="";if(j=='"'){for(d();j&&j!='"';)a+=j,d();d()}else{for(;j&&!b(j)&&"[]{}();,=->".indexOf(j)==-1;)a+=j,d();var c=Number(a);isNaN(c)?a=="true"?a=!0:a==
  "false"?a=!1:a=="null"&&(a=null):a=c}return a}function g(){e();if(j=="["){d();for(var a={};j&&j!="]";){e();var b=f();if(!b)throw new SyntaxError("Attribute name expected "+c());e();if(j!="=")throw new SyntaxError("Equal sign = expected "+c());d();var g;e();if(j=='"')g=f();else if(g=f(),g!=void 0){var h=Number(g);isNaN(h)?g=="true"?g=!0:g=="false"?g=!1:g=="null"&&(g=null):g=h}if(!g)throw new SyntaxError("Attribute value expected "+c());a[b]=g;e();j==","&&d()}d();return a}}function h(){e();if(j=="-")if(d(),
  j==">"||j=="-"){var a="-"+j;d();return a}else throw new SyntaxError('Arrow "->" or "--" expected '+c());}function i(a,b){var c={id:String(a),attr:b||{}};if(o[a]){var d=o[a].attr,c=c.attr;if(d&&c)for(var e in c)c.hasOwnProperty(e)&&(d[e]=c[e])}else o[a]=c}var k=-1,j="",o={},r=[];for(d();j&&j!="{";)d();if(j!="{")throw new SyntaxError("Invalid data. Curly bracket { expected "+c());for(d();j&&j!="}";){var l=f();if(l==void 0)throw new SyntaxError("String with id expected "+c());var m=g();i(l,m);for(var p=
  h();p;){var s=l,l=f();if(l==void 0)throw new SyntaxError("String with id expected "+c());i(l);m=g();r.push({from:String(s),to:String(l),type:p,attr:m||{}});p=h()}e();j==";"&&d();e()}if(j!="}")throw new SyntaxError("Invalid data. Curly bracket } expected");m=a.indexOf("{");p=a.indexOf("}",m);if(!(m!=-1&&p!=-1)||!a.substring(m+1,p))throw Error("Invalid data. no curly brackets containing data found");m=[];for(l in o)o.hasOwnProperty(l)&&m.push(o[l]);return{nodes:m,edges:r}};
  links.Network.util.DOTToNetwork=function(a){function b(a,b,d){for(var g in b)if(b.hasOwnProperty(g)&&(!d||d.indexOf(g)==-1))a[g]=b[g];if(a.label)a.text=a.label,delete a.label;if(a.shape)a.style=a.shape,delete a.shape}var a=links.Network.util.parseDOT(a),d={nodes:[],edges:[],options:{nodes:{},links:{}}};a.nodes.forEach(function(a){if(a.id.toLowerCase()=="graph")b(d.options,a.attr);else if(a.id.toLowerCase()=="node")b(d.options.nodes,a.attr);else if(a.id.toLowerCase()=="edge")b(d.options.links,a.attr);
  else{var e={};e.id=a.id;e.text=a.id;b(e,a.attr);d.nodes.push(e)}});a.edges.forEach(function(a){var e={};e.from=a.from;e.to=a.to;e.text=a.id;e.style=a.type=="->"?"arrow-end":"line";b(e,a.attr);d.edges.push(e)});return d};
  