vis.js is a dynamic, browser-based visualization library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
220 KiB

10 years ago
  1. /**
  2. * vis.js
  3. * https://github.com/almende/vis
  4. *
  5. * A dynamic, browser-based visualization library.
  6. *
  7. * @version 0.5.0-SNAPSHOT
  8. * @date 2014-02-08
  9. *
  10. * @license
  11. * Copyright (C) 2011-2014 Almende B.V, http://almende.com
  12. *
  13. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  14. * use this file except in compliance with the License. You may obtain a copy
  15. * of the License at
  16. *
  17. * http://www.apache.org/licenses/LICENSE-2.0
  18. *
  19. * Unless required by applicable law or agreed to in writing, software
  20. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  21. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  22. * License for the specific language governing permissions and limitations under
  23. * the License.
  24. */
  25. !function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.vis=t()}}(function(){var define,module,exports;return function t(e,i,n){function s(r,a){if(!i[r]){if(!e[r]){var h="function"==typeof require&&require;if(!a&&h)return h(r,!0);if(o)return o(r,!0);throw new Error("Cannot find module '"+r+"'")}var l=i[r]={exports:{}};e[r][0].call(l.exports,function(t){var i=e[r][1][t];return s(i?i:t)},l,l.exports,t,e,i,n)}return i[r].exports}for(var o="function"==typeof require&&require,r=0;r<n.length;r++)s(n[r]);return s}({1:[function(require,module,exports){function EventBus(){this.subscriptions=[]}function DataSet(t){if(this.id=util.randomUUID(),this.options=t||{},this.data={},this.fieldId=this.options.fieldId||"id",this.convert={},this.showInternalIds=this.options.showInternalIds||!1,this.options.convert)for(var e in this.options.convert)if(this.options.convert.hasOwnProperty(e)){var i=this.options.convert[e];this.convert[e]="Date"==i||"ISODate"==i||"ASPDate"==i?"Date":i}this.subscribers={},this.internalIds={}}function DataView(t,e){this.id=util.randomUUID(),this.data=null,this.ids={},this.options=e||{},this.fieldId="id",this.subscribers={};var i=this;this.listener=function(){i._onEvent.apply(i,arguments)},this.setData(t)}function Stack(t,e){this.parent=t,this.options=e||{},this.defaultOptions={order:function(t,e){if(t instanceof ItemRange){if(e instanceof ItemRange){var i=t.data.end-t.data.start,n=e.data.end-e.data.start;return i-n||t.data.start-e.data.start}return-1}return e instanceof ItemRange?1:t.data.start-e.data.start},margin:{item:10}},this.ordered=[]}function Range(t){this.id=util.randomUUID(),this.start=null,this.end=null,this.options=t||{},this.setOptions(t)}function validateDirection(t){if("horizontal"!=t&&"vertical"!=t)throw new TypeError('Unknown direction "'+t+'". Choose "horizontal" or "vertical".')}function getPointer(t,e){return{x:t.pageX-vis.util.getAbsoluteLeft(e),y:t.pageY-vis.util.getAbsoluteTop(e)}}function Controller(){this.id=util.randomUUID(),this.components={},this.repaintTimer=void 0,this.reflowTimer=void 0}function Component(){this.id=null,this.parent=null,this.depends=null,this.controller=null,this.options=null,this.frame=null,this.top=0,this.left=0,this.width=0,this.height=0}function Panel(t,e,i){this.id=util.randomUUID(),this.parent=t,this.depends=e,this.options=i||{}}function RootPanel(t,e){this.id=util.randomUUID(),this.container=t,this.options=e||{},this.defaultOptions={autoResize:!0},this.listeners={}}function TimeAxis(t,e,i){this.id=util.randomUUID(),this.parent=t,this.depends=e,this.dom={majorLines:[],majorTexts:[],minorLines:[],minorTexts:[],redundant:{majorLines:[],majorTexts:[],minorLines:[],minorTexts:[]}},this.props={range:{start:0,end:0,minimumStep:0},lineTop:0},this.options=i||{},this.defaultOptions={orientation:"bottom",showMinorLabels:!0,showMajorLabels:!0},this.conversion=null,this.range=null}function CurrentTime(t,e,i){this.id=util.randomUUID(),this.parent=t,this.depends=e,this.options=i||{},this.defaultOptions={showCurrentTime:!1}}function CustomTime(t,e,i){this.id=util.randomUUID(),this.parent=t,this.depends=e,this.options=i||{},this.defaultOptions={showCustomTime:!1},this.listeners=[],this.customTime=new Date}function ItemSet(t,e,i){this.id=util.randomUUID(),this.parent=t,this.depends=e,this.options=i||{},this.defaultOptions={type:"box",align:"center",orientation:"bottom",margin:{axis:20,item:10},padding:5},this.dom={};var n=this;this.itemsData=null,this.range=null,this.listeners={add:function(t,e,i){i!=n.id&&n._onAdd(e.items)},update:function(t,e,i){i!=n.id&&n._onUpdate(e.items)},remove:function(t,e,i){i!=n.id&&n._onRemove(e.items)}},this.items={},this.selection=[],this.queue={},this.stack=new Stack(this,Object.create(this.options)),this.conversion=null}function Item(t,e,i,n){this.parent=t,this.data=e,this.dom=null,this.options=i||{},this.defaultOptions=n||{},this.selected=!1,this.visible=!1,this.top=0,
  26. i=t&&t.filter?n?function(e){return n(e)&&t.filter(e)}:t.filter:n,e=this.data.getIds({filter:i,order:t&&t.order})}else e=[];return e},DataView.prototype._onEvent=function(t,e,i){var n,s,o,r,a=e&&e.items,h=this.data,l=[],c=[],d=[];if(a&&h){switch(t){case"add":for(n=0,s=a.length;s>n;n++)o=a[n],r=this.get(o),r&&(this.ids[o]=!0,l.push(o));break;case"update":for(n=0,s=a.length;s>n;n++)o=a[n],r=this.get(o),r?this.ids[o]?c.push(o):(this.ids[o]=!0,l.push(o)):this.ids[o]&&(delete this.ids[o],d.push(o));break;case"remove":for(n=0,s=a.length;s>n;n++)o=a[n],this.ids[o]&&(delete this.ids[o],d.push(o))}l.length&&this._trigger("add",{items:l},i),c.length&&this._trigger("update",{items:c},i),d.length&&this._trigger("remove",{items:d},i)}},DataView.prototype.subscribe=DataSet.prototype.subscribe,DataView.prototype.unsubscribe=DataSet.prototype.unsubscribe,DataView.prototype._trigger=DataSet.prototype._trigger,TimeStep=function(t,e,i){this.current=new Date,this._start=new Date,this._end=new Date,this.autoScale=!0,this.scale=TimeStep.SCALE.DAY,this.step=1,this.setRange(t,e,i)},TimeStep.SCALE={MILLISECOND:1,SECOND:2,MINUTE:3,HOUR:4,DAY:5,WEEKDAY:6,MONTH:7,YEAR:8},TimeStep.prototype.setRange=function(t,e,i){if(!(t instanceof Date&&e instanceof Date))throw"No legal start or end date in method setRange";this._start=void 0!=t?new Date(t.valueOf()):new Date,this._end=void 0!=e?new Date(e.valueOf()):new Date,this.autoScale&&this.setMinimumStep(i)},TimeStep.prototype.first=function(){this.current=new Date(this._start.valueOf()),this.roundToMinor()},TimeStep.prototype.roundToMinor=function(){switch(this.scale){case TimeStep.SCALE.YEAR:this.current.setFullYear(this.step*Math.floor(this.current.getFullYear()/this.step)),this.current.setMonth(0);case TimeStep.SCALE.MONTH:this.current.setDate(1);case TimeStep.SCALE.DAY:case TimeStep.SCALE.WEEKDAY:this.current.setHours(0);case TimeStep.SCALE.HOUR:this.current.setMinutes(0);case TimeStep.SCALE.MINUTE:this.current.setSeconds(0);case TimeStep.SCALE.SECOND:this.current.setMilliseconds(0)}if(1!=this.step)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current.setMilliseconds(this.current.getMilliseconds()-this.current.getMilliseconds()%this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()-this.current.getSeconds()%this.step);break;case TimeStep.SCALE.MINUTE:this.current.setMinutes(this.current.getMinutes()-this.current.getMinutes()%this.step);break;case TimeStep.SCALE.HOUR:this.current.setHours(this.current.getHours()-this.current.getHours()%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()-1-(this.current.getDate()-1)%this.step+1);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()-this.current.getMonth()%this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()-this.current.getFullYear()%this.step)}},TimeStep.prototype.hasNext=function(){return this.current.valueOf()<=this._end.valueOf()},TimeStep.prototype.next=function(){var t=this.current.valueOf();if(this.current.getMonth()<6)switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current=new Date(this.current.valueOf()+1e3*this.step);break;case TimeStep.SCALE.MINUTE:this.current=new Date(this.current.valueOf()+1e3*this.step*60);break;case TimeStep.SCALE.HOUR:this.current=new Date(this.current.valueOf()+1e3*this.step*60*60);var e=this.current.getHours();this.current.setHours(e-e%this.step);break;case TimeStep.SCALE.WEEKDAY:case TimeStep.SCALE.DAY:this.current.setDate(this.current.getDate()+this.step);break;case TimeStep.SCALE.MONTH:this.current.setMonth(this.current.getMonth()+this.step);break;case TimeStep.SCALE.YEAR:this.current.setFullYear(this.current.getFullYear()+this.step)}else switch(this.scale){case TimeStep.SCALE.MILLISECOND:this.current=new Date(this.current.valueOf()+this.step);break;case TimeStep.SCALE.SECOND:this.current.setSeconds(this.current.getSeconds()+this.step);break;case Ti
  27. },ItemSet.prototype=new Panel,ItemSet.types={box:ItemBox,range:ItemRange,rangeoverflow:ItemRangeOverflow,point:ItemPoint},ItemSet.prototype.setOptions=Component.prototype.setOptions,ItemSet.prototype.setRange=function(t){if(!(t instanceof Range||t&&t.start&&t.end))throw new TypeError("Range must be an instance of Range, or an object containing start and end.");this.range=t},ItemSet.prototype.setSelection=function(t){var e,i,n,s,o;if(t){if(!Array.isArray(t))throw new TypeError("Array expected");for(e=0,i=this.selection.length;i>e;e++)n=this.selection[e],s=this.items[n],s&&s.unselect();for(this.selection=[],e=0,i=t.length;i>e;e++)n=t[e],s=this.items[n],s&&(this.selection.push(n),s.select());o=this.selection.concat([]),events.trigger(this,"select",{ids:o}),this.controller&&this.requestRepaint()}},ItemSet.prototype.getSelection=function(){return this.selection.concat([])},ItemSet.prototype._deselect=function(t){for(var e=this.selection,i=0,n=e.length;n>i;i++)if(e[i]==t){e.splice(i,1);break}},ItemSet.prototype.repaint=function(){var t=0,e=util.updateProperty,i=util.option.asSize,n=this.options,s=this.getOption("orientation"),o=this.defaultOptions,r=this.frame;if(!r){r=document.createElement("div"),r.className="itemset";var a=n.className;a&&util.addClassName(r,util.option.asString(a));var h=document.createElement("div");h.className="background",r.appendChild(h),this.dom.background=h;var l=document.createElement("div");l.className="foreground",r.appendChild(l),this.dom.foreground=l;var c=document.createElement("div");c.className="itemset-axis",this.dom.axis=c,this.frame=r,t+=1}if(!this.parent)throw new Error("Cannot repaint itemset: no parent attached");var d=this.parent.getContainer();if(!d)throw new Error("Cannot repaint itemset: parent has no container element");r.parentNode||(d.appendChild(r),t+=1),this.dom.axis.parentNode||(d.appendChild(this.dom.axis),t+=1),t+=e(r.style,"left",i(n.left,"0px")),t+=e(r.style,"top",i(n.top,"0px")),t+=e(r.style,"width",i(n.width,"100%")),t+=e(r.style,"height",i(n.height,this.height+"px")),t+=e(this.dom.axis.style,"left",i(n.left,"0px")),t+=e(this.dom.axis.style,"width",i(n.width,"100%")),t+="bottom"==s?e(this.dom.axis.style,"top",this.height+this.top+"px"):e(this.dom.axis.style,"top",this.top+"px"),this._updateConversion();var u=this,p=this.queue,f=this.itemsData,g=this.items,m={};for(var v in p)if(p.hasOwnProperty(v)){var y=p[v],_=g[v],b=y.action;switch(b){case"add":case"update":var w=f&&f.get(v,m);if(w){var S=w.type||w.start&&w.end&&"range"||n.type||"box",T=ItemSet.types[S];if(_&&(T&&_ instanceof T?(_.data=w,t++):(t+=_.hide(),_=null)),!_){if(!T)throw new TypeError('Unknown item type "'+S+'"');_=new T(u,w,n,o),_.id=y.id,t++}_.repaint(),g[v]=_}delete p[v];break;case"remove":_&&(_.selected&&u._deselect(v),t+=_.hide()),delete g[v],delete p[v];break;default:console.log('Error: unknown action "'+b+'"')}}return util.forEach(this.items,function(e){e.visible?(t+=e.show(),e.reposition()):t+=e.hide()}),t>0},ItemSet.prototype.getForeground=function(){return this.dom.foreground},ItemSet.prototype.getBackground=function(){return this.dom.background},ItemSet.prototype.getAxis=function(){return this.dom.axis},ItemSet.prototype.reflow=function(){var t=0,e=this.options,i=e.margin&&e.margin.axis||this.defaultOptions.margin.axis,n=e.margin&&e.margin.item||this.defaultOptions.margin.item,s=util.updateProperty,o=util.option.asNumber,r=util.option.asSize,a=this.frame;if(a){this._updateConversion(),util.forEach(this.items,function(e){t+=e.reflow()}),this.stack.update();var h,l=o(e.maxHeight),c=null!=r(e.height);if(c)h=a.offsetHeight;else{var d=this.stack.ordered;if(d.length){var u=d[0].top,p=d[0].top+d[0].height;util.forEach(d,function(t){u=Math.min(u,t.top),p=Math.max(p,t.top+t.height)}),h=p-u+i+n}else h=i+n}null!=l&&(h=Math.min(h,l)),t+=s(this,"height",h),t+=s(this,"top",a.offsetTop),t+=s(this,"left",a.offsetLeft),t+=s(this,"width",a.offsetWidth)}else t+=1;return t>0},ItemSet.prototype.hide=function(){var t=!1;return this.frame&&this.frame.parentNode&&(this.frame.parentNode.removeChild(this.frame),t=!0),this.do
  28. this.beginPath(),this.moveTo(c,p),this.bezierCurveTo(c,p+l,u+h,d,u,d),this.bezierCurveTo(u-h,d,t,p+l,t,p),this.bezierCurveTo(t,p-l,u-h,e,u,e),this.bezierCurveTo(u+h,e,c,p-l,c,p),this.lineTo(c,f),this.bezierCurveTo(c,f+l,u+h,g,u,g),this.bezierCurveTo(u-h,g,t,f+l,t,f),this.lineTo(t,p)},CanvasRenderingContext2D.prototype.arrow=function(t,e,i,n){var s=t-n*Math.cos(i),o=e-n*Math.sin(i),r=t-.9*n*Math.cos(i),a=e-.9*n*Math.sin(i),h=s+n/3*Math.cos(i+.5*Math.PI),l=o+n/3*Math.sin(i+.5*Math.PI),c=s+n/3*Math.cos(i-.5*Math.PI),d=o+n/3*Math.sin(i-.5*Math.PI);this.beginPath(),this.moveTo(t,e),this.lineTo(h,l),this.lineTo(r,a),this.lineTo(c,d),this.closePath()},CanvasRenderingContext2D.prototype.dashedLine=function(t,e,i,n,s){s||(s=[10,5]),0==u&&(u=.001);var o=s.length;this.moveTo(t,e);for(var r=i-t,a=n-e,h=a/r,l=Math.sqrt(r*r+a*a),c=0,d=!0;l>=.1;){var u=s[c++%o];u>l&&(u=l);var p=Math.sqrt(u*u/(1+h*h));0>r&&(p=-p),t+=p,e+=h*p,this[d?"lineTo":"moveTo"](t,e),l-=u,d=!d}}),Node.prototype.resetCluster=function(){this.formationScale=void 0,this.clusterSize=1,this.containedNodes={},this.containedEdges={},this.clusterSessions=[]},Node.prototype.attachEdge=function(t){-1==this.edges.indexOf(t)&&this.edges.push(t),-1==this.dynamicEdges.indexOf(t)&&this.dynamicEdges.push(t),this.dynamicEdgesLength=this.dynamicEdges.length,this._updateMass()},Node.prototype.detachEdge=function(t){var e=this.edges.indexOf(t);-1!=e&&(this.edges.splice(e,1),this.dynamicEdges.splice(e,1)),this.dynamicEdgesLength=this.dynamicEdges.length,this._updateMass()},Node.prototype._updateMass=function(){this.mass=1},Node.prototype.setProperties=function(t,e){if(t){if(this.originalLabel=void 0,void 0!==t.id&&(this.id=t.id),void 0!==t.label&&(this.label=t.label,this.originalLabel=t.label),void 0!==t.title&&(this.title=t.title),void 0!==t.group&&(this.group=t.group),void 0!==t.x&&(this.x=t.x),void 0!==t.y&&(this.y=t.y),void 0!==t.value&&(this.value=t.value),void 0!==t.horizontalAlignLeft&&(this.horizontalAlignLeft=t.horizontalAlignLeft),void 0!==t.verticalAlignTop&&(this.verticalAlignTop=t.verticalAlignTop),void 0!==t.triggerFunction&&(this.triggerFunction=t.triggerFunction),void 0===this.id)throw"Node must have an id";if(this.group){var i=this.grouplist.get(this.group);for(var n in i)i.hasOwnProperty(n)&&(this[n]=i[n])}if(void 0!==t.shape&&(this.shape=t.shape),void 0!==t.image&&(this.image=t.image),void 0!==t.radius&&(this.radius=t.radius),void 0!==t.color&&(this.color=Node.parseColor(t.color)),void 0!==t.fontColor&&(this.fontColor=t.fontColor),void 0!==t.fontSize&&(this.fontSize=t.fontSize),void 0!==t.fontFace&&(this.fontFace=t.fontFace),void 0!==this.image){if(!this.imagelist)throw"No imagelist provided";this.imageObj=this.imagelist.load(this.image)}switch(this.xFixed=this.xFixed||void 0!==t.x&&t.fixed,this.yFixed=this.yFixed||void 0!==t.y&&t.fixed,this.radiusFixed=this.radiusFixed||void 0!==t.radius,"image"==this.shape&&(this.radiusMin=e.nodes.widthMin,this.radiusMax=e.nodes.widthMax),this.shape){case"database":this.draw=this._drawDatabase,this.resize=this._resizeDatabase;break;case"box":this.draw=this._drawBox,this.resize=this._resizeBox;break;case"circle":this.draw=this._drawCircle,this.resize=this._resizeCircle;break;case"ellipse":this.draw=this._drawEllipse,this.resize=this._resizeEllipse;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._drawEllipse,this.resize=this._resizeEllipse}this._reset()}},Node.parseColor=function(t){var e;return util.isString(t)?e={border:t,background:t,highlight:{border:t,background:t}}:(e={},e.background=t.background||"white",e.border=t.border||e
  29. var n=document.getElementById("manipulate-delete");n.onclick=this._createDeletionToolbar.bind(this)},_createAddToolbar:function(){this._clearManipulatorBar(),this.off("select",this.boundFunction),this.manipulationDiv.innerHTML="<span class='manipulationUI back' id='manipulate-back'><span class='manipulationLabel'>Back</span></span><div class='seperatorLine'></div><span class='manipulationUI none' id='manipulate-back'><span class='manipulationLabel'>Click in an empty space to place a new node</span></span>";var t=document.getElementById("manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.boundFunction=this._addNode.bind(this),this.on("select",this.boundFunction)},_createEditToolbar:function(){this.blockConnectingEdgeSelection=!1,this._clearManipulatorBar(),this.off("select",this.boundFunction);var t="";if(this._selectionIsEmpty()?t="Select a node or edge to edit.":this._getSelectedObjectCount()>1?(t="Select a single node or edge to edit.",this._unselectAll(!0)):this._clusterInSelection()?(t="You cannot edit a cluster.",this._unselectAll(!0)):this._getSelectedNodeCount()>0?this._createEditNodeToolbar():this._createEditEdgeToolbar(),""!=t){this.blockConnectingEdgeSelection=!0,this.manipulationDiv.innerHTML="<span class='manipulationUI back' id='manipulate-back'><span class='manipulationLabel'>Back</span></span><div class='seperatorLine'></div><span class='manipulationUI none' id='manipulate-back'><span class='manipulationLabel'>"+t+"</span></span>";var e=document.getElementById("manipulate-back");e.onclick=this._createManipulatorBar.bind(this),this.boundFunction=this._createEditToolbar.bind(this),this.on("select",this.boundFunction)}},_createEditNodeToolbar:function(){this.blockConnectingEdgeSelection=!1,this._clearManipulatorBar(),this.off("select",this.boundFunction);var t=this._getEditObject();this.manipulationDiv.innerHTML="<span class='manipulationUI back' id='manipulate-back'><span class='manipulationLabel'>Cancel</span></span><div class='seperatorLine'></div><span class='manipulationUI none'>label: <input type='text' class='manipulatorInput' value='"+t.label+"' id='manipulator-obj-label' /></span><div class='seperatorLine'></div><span class='manipulationUI none'>color: <input type='text' class='manipulatorInput' value='"+t.color.background+"' id='manipulator-obj-color' /></span><div class='seperatorLine'></div><span class='manipulationUI none'><input type='button' class='manipulatorInput' value='save' id='manipulator-obj-save' /></span>";var e=document.getElementById("manipulate-back");e.onclick=this._createManipulatorBar.bind(this);var i=document.getElementById("manipulator-obj-save");i.onclick=this._saveNodeData.bind(this),this.boundFunction=this._createManipulatorBar.bind(this),this.on("select",this.boundFunction)},_saveNodeData:function(){var t=this._getEditObject().id,e=document.getElementById("manipulator-obj-label").value,i=document.getElementById("manipulator-obj-color").value,n=util.hexToHSV(i),s={h:n.h,s:.45*n.s,v:Math.min(1,1.05*n.v)},o={h:n.h,s:Math.min(1,1.25*n.v),v:.6*n.v},r=util.HSVToHex(o.h,o.h,o.v),a=util.HSVToHex(s.h,s.s,s.v),h={id:t,label:e,color:{background:i,border:r,highlight:{background:a,border:r}}};this.nodesData.update(h),this._createManipulatorBar()},_createEditEdgeToolbar:function(){this.blockConnectingEdgeSelection=!1,this._clearManipulatorBar(),this.off("select",this.boundFunction),this.manipulationDiv.innerHTML="<span class='manipulationUI back' id='manipulate-back'><span class='manipulationLabel'>Back</span></span><div class='seperatorLine'></div><span class='manipulationUI none' id='manipulate-back'><span class='manipulationLabel'>Currently only nodes can be edited.</span></span>";var t=document.getElementById("manipulate-back");t.onclick=this._createManipulatorBar.bind(this),this.boundFunction=this._createManipulatorBar.bind(this),this.on("select",this.boundFunction)},_createConnectToolbar:function(){this._clearManipulatorBar(),this.off("select",this.boundFunction),this._unselectAll(),this.forceAppendSelection=!1,this.blockConnectingEdgeSelection=!0,this.manipula
  30. },_zoomIn:function(t){this._highlightNavigationElement("navigation_plus"),this.zoomIncrement=this.constants.keyboard.speed.zoom,this.start(),this._preventDefault(t)},_zoomOut:function(){this._highlightNavigationElement("navigation_min"),this.zoomIncrement=-this.constants.keyboard.speed.zoom,this.start(),this._preventDefault(event)},_stopZoom:function(){this._unHighlightNavigationElement("navigation_plus"),this._unHighlightNavigationElement("navigation_min"),this.zoomIncrement=0},_yStopMoving:function(){this._unHighlightNavigationElement("navigation_up"),this._unHighlightNavigationElement("navigation_down"),this.yIncrement=0},_xStopMoving:function(){this._unHighlightNavigationElement("navigation_left"),this._unHighlightNavigationElement("navigation_right"),this.xIncrement=0}};Graph.prototype._getScriptPath=function(){for(var t=document.getElementsByTagName("script"),e=0;e<t.length;e++){var i=t[e].src,n=i&&/\/?vis(.min)?\.js$/.exec(i);if(n)return i.substring(0,i.length-n[0].length)}return null},Graph.prototype._getRange=function(){for(var t,e=1e9,i=-1e9,n=1e9,s=-1e9,o=0;o<this.nodeIndices.length;o++)t=this.nodes[this.nodeIndices[o]],n>t.x-t.width&&(n=t.x-t.width),s<t.x+t.width&&(s=t.x+t.width),e>t.y-t.height&&(e=t.y-t.height),i<t.y+t.height&&(i=t.y+t.height);return{minX:n,maxX:s,minY:e,maxY:i}},Graph.prototype._findCenter=function(t){var e={x:.5*(t.maxX+t.minX),y:.5*(t.maxY+t.minY)};return e},Graph.prototype._centerGraph=function(t){var e=this._findCenter(t);e.x*=this.scale,e.y*=this.scale,e.x-=.5*this.frame.canvas.clientWidth,e.y-=.5*this.frame.canvas.clientHeight,this._setTranslation(-e.x,-e.y)},Graph.prototype.zoomToFit=function(t){void 0===t&&(t=!1);var e=this.nodeIndices.length,i=this._getRange();if(1==t)if(1==this.constants.clustering.enabled&&e>=this.constants.clustering.initialMaxNodes)var n=38.8467/(e-14.50184)+.0116;else var n=42.54117319/(e+39.31966387)+.1944405;else{var s=1.1*(Math.abs(i.minX)+Math.abs(i.maxX)),o=1.1*(Math.abs(i.minY)+Math.abs(i.maxY)),r=this.frame.canvas.clientWidth/s,a=this.frame.canvas.clientHeight/o;n=a>=r?r:a}n>1&&(n=1),this.pinch.mousewheelScale=n,this._setScale(n),this._centerGraph(i),this.start()},Graph.prototype._updateNodeIndexList=function(){this._clearNodeIndexList();for(var t in this.nodes)this.nodes.hasOwnProperty(t)&&this.nodeIndices.push(t)},Graph.prototype.setData=function(t,e){if(void 0===e&&(e=!1),t&&t.dot&&(t.nodes||t.edges))throw new SyntaxError('Data must contain either parameter "dot" or parameter pair "nodes" and "edges", but not both.');if(this.setOptions(t&&t.options),t&&t.dot){if(t&&t.dot){var i=vis.util.DOTToGraph(t.dot);return void this.setData(i)}}else this._setNodes(t&&t.nodes),this._setEdges(t&&t.edges);this._putDataInSector(),e||(this.stabilize&&this._doStabilize(),this.moving=!0,this.start())},Graph.prototype.setOptions=function(t){if(t){if(void 0!==t.width&&(this.width=t.width),void 0!==t.height&&(this.height=t.height),void 0!==t.stabilize&&(this.stabilize=t.stabilize),void 0!==t.selectable&&(this.selectable=t.selectable),t.clustering){this.constants.clustering.enabled=!0;for(var e in t.clustering)t.clustering.hasOwnProperty(e)&&(this.constants.clustering[e]=t.clustering[e])}else void 0!==t.clustering&&(this.constants.clustering.enabled=!1);if(t.navigation){this.constants.navigation.enabled=!0;for(var e in t.navigation)t.navigation.hasOwnProperty(e)&&(this.constants.navigation[e]=t.navigation[e])}else void 0!==t.navigation&&(this.constants.navigation.enabled=!1);if(t.keyboard){this.constants.keyboard.enabled=!0;for(var e in t.keyboard)t.keyboard.hasOwnProperty(e)&&(this.constants.keyboard[e]=t.keyboard[e])}else void 0!==t.keyboard&&(this.constants.keyboard.enabled=!1);if(t.dataManipulationToolbar){this.constants.dataManipulationToolbar.enabled=!0;for(var e in t.dataManipulationToolbar)t.dataManipulationToolbar.hasOwnProperty(e)&&(this.constants.dataManipulationToolbar[e]=t.dataManipulationToolbar[e])}else void 0!==t.dataManipulationToolbar&&(this.constants.dataManipulationToolbar.enabled=!1);if(t.edges){for(e in t.edges)t.edges.hasOwnProperty(e)&&(this.const
  31. if(!(e.options.drag_max_touches>0&&t.touches.length>e.options.drag_max_touches))switch(t.eventType){case s.EVENT_START:this.triggered=!1;break;case s.EVENT_MOVE:if(t.distance<e.options.drag_min_distance&&s.detection.current.name!=this.name)return;s.detection.current.name=this.name,(s.detection.current.lastEvent.drag_locked_to_axis||e.options.drag_lock_to_axis&&e.options.drag_lock_min_distance<=t.distance)&&(t.drag_locked_to_axis=!0);var i=s.detection.current.lastEvent.direction;t.drag_locked_to_axis&&i!==t.direction&&(t.direction=s.utils.isVertical(i)?t.deltaY<0?s.DIRECTION_UP:s.DIRECTION_DOWN:t.deltaX<0?s.DIRECTION_LEFT:s.DIRECTION_RIGHT),this.triggered||(e.trigger(this.name+"start",t),this.triggered=!0),e.trigger(this.name,t),e.trigger(this.name+t.direction,t),(e.options.drag_block_vertical&&s.utils.isVertical(t.direction)||e.options.drag_block_horizontal&&!s.utils.isVertical(t.direction))&&t.preventDefault();break;case s.EVENT_END:this.triggered&&e.trigger(this.name+"end",t),this.triggered=!1}}},s.gestures.Transform={name:"transform",index:45,defaults:{transform_min_scale:.01,transform_min_rotation:1,transform_always_block:!1},triggered:!1,handler:function(t,e){if(s.detection.current.name!=this.name&&this.triggered)return e.trigger(this.name+"end",t),void(this.triggered=!1);if(!(t.touches.length<2))switch(e.options.transform_always_block&&t.preventDefault(),t.eventType){case s.EVENT_START:this.triggered=!1;break;case s.EVENT_MOVE:var i=Math.abs(1-t.scale),n=Math.abs(t.rotation);if(i<e.options.transform_min_scale&&n<e.options.transform_min_rotation)return;s.detection.current.name=this.name,this.triggered||(e.trigger(this.name+"start",t),this.triggered=!0),e.trigger(this.name,t),n>e.options.transform_min_rotation&&e.trigger("rotate",t),i>e.options.transform_min_scale&&(e.trigger("pinch",t),e.trigger("pinch"+(t.scale<1?"in":"out"),t));break;case s.EVENT_END:this.triggered&&e.trigger(this.name+"end",t),this.triggered=!1}}},s.gestures.Touch={name:"touch",index:-1/0,defaults:{prevent_default:!1,prevent_mouseevents:!1},handler:function(t,e){return e.options.prevent_mouseevents&&t.pointerType==s.POINTER_MOUSE?void t.stopDetect():(e.options.prevent_default&&t.preventDefault(),void(t.eventType==s.EVENT_START&&e.trigger(this.name,t)))}},s.gestures.Release={name:"release",index:1/0,handler:function(t,e){t.eventType==s.EVENT_END&&e.trigger(this.name,t)}},"object"==typeof e&&"object"==typeof e.exports?e.exports=s:(t.Hammer=s,"function"==typeof t.define&&t.define.amd&&t.define("hammer",[],function(){return s}))}(this)},{}],3:[function(t,e){(function(i){function n(){return{empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}function s(t,e){return function(i){return u(t.call(this,i),e)}}function o(t,e){return function(i){return this.lang().ordinal(t.call(this,i),e)}}function r(){}function a(t){E(t),l(this,t)}function h(t){var e=y(t),i=e.year||0,n=e.month||0,s=e.week||0,o=e.day||0,r=e.hour||0,a=e.minute||0,h=e.second||0,l=e.millisecond||0;this._milliseconds=+l+1e3*h+6e4*a+36e5*r,this._days=+o+7*s,this._months=+n+12*i,this._data={},this._bubble()}function l(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return e.hasOwnProperty("toString")&&(t.toString=e.toString),e.hasOwnProperty("valueOf")&&(t.valueOf=e.valueOf),t}function c(t){var e,i={};for(e in t)t.hasOwnProperty(e)&&ye.hasOwnProperty(e)&&(i[e]=t[e]);return i}function d(t){return 0>t?Math.ceil(t):Math.floor(t)}function u(t,e,i){for(var n=""+Math.abs(t),s=t>=0;n.length<e;)n="0"+n;return(s?i?"+":"":"-")+n}function p(t,e,i,n){var s,o,r=e._milliseconds,a=e._days,h=e._months;r&&t._d.setTime(+t._d+r*i),(a||h)&&(s=t.minute(),o=t.hour()),a&&t.date(t.date()+a*i),h&&t.month(t.month()+h*i),r&&!n&&oe.updateOffset(t),(a||h)&&(t.minute(s),t.hour(o))}function f(t){return"[object Array]"===Object.prototype.toString.call(t)}function g(t){return"[object Date]"===Object.prototype.toString.call(t)||t instanceof Date}function m(t,e,i){var n,s=Math.min(t.length,e.length),o=Math.abs(t.length-e.length),r=0;for