iqvoc 4.0.1 → 4.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/app/assets/stylesheets/iqvoc/components.css.scss +6 -0
- data/app/controllers/concepts_controller.rb +8 -5
- data/app/helpers/concepts_helper.rb +5 -1
- data/app/helpers/dashboard_helper.rb +2 -2
- data/app/helpers/navigation_helper.rb +10 -0
- data/app/models/collection/member/base.rb +5 -0
- data/app/models/collection/member/skos/base.rb +37 -0
- data/app/models/collection/skos/base.rb +35 -0
- data/app/models/collection/unordered.rb +1 -1
- data/app/views/collections/_form.html.erb +3 -1
- data/app/views/concepts/_form.html.erb +3 -1
- data/app/views/concepts/sidebars/_singular.html.erb +1 -0
- data/app/views/dashboard/index.html.erb +2 -2
- data/app/views/errors/not_found.html.erb +2 -5
- data/app/views/layouts/_navigation.html.erb +1 -1
- data/config/locales/de.yml +4 -3
- data/config/locales/en.yml +3 -2
- data/db/schema.rb +1 -10
- data/lib/iqvoc/configuration/collection.rb +7 -1
- data/lib/iqvoc/skos_importer.rb +7 -2
- data/lib/iqvoc/version.rb +1 -1
- data/test/unit/hygiene_test.rb +1 -1
- data/test/unit/skos_import_test.rb +67 -0
- metadata +26 -145
- data/public/assets/ajax-loader-dada1fbb71d7fb80d8dde7a031ae6cd0.gif +0 -0
- data/public/assets/ajax-loader.gif +0 -0
- data/public/assets/arrow_down-07c5dea12928d65fcc31c08279366170.gif +0 -0
- data/public/assets/arrow_down.gif +0 -0
- data/public/assets/arrow_up-51ede92c113b9a870e7a306907360ba8.gif +0 -0
- data/public/assets/arrow_up.gif +0 -0
- data/public/assets/bootstrap/bootstrap-2012a68e8267282c0a2c177d7005ae6d.css +0 -9
- data/public/assets/bootstrap/bootstrap-2012a68e8267282c0a2c177d7005ae6d.css.gz +0 -0
- data/public/assets/bootstrap/bootstrap-2c6144df0bc0f1c9958a69dd77b4f2c2.js +0 -19
- data/public/assets/bootstrap/bootstrap-2c6144df0bc0f1c9958a69dd77b4f2c2.js.gz +0 -0
- data/public/assets/bootstrap/bootstrap-responsive-609b376f4bb032588c054b563d4bca1f.css +0 -9
- data/public/assets/bootstrap/bootstrap-responsive-609b376f4bb032588c054b563d4bca1f.css.gz +0 -0
- data/public/assets/bootstrap/bootstrap-responsive.css +0 -9
- data/public/assets/bootstrap/bootstrap-responsive.css.gz +0 -0
- data/public/assets/bootstrap/bootstrap.css +0 -9
- data/public/assets/bootstrap/bootstrap.css.gz +0 -0
- data/public/assets/bootstrap/bootstrap.js +0 -19
- data/public/assets/bootstrap/bootstrap.js.gz +0 -0
- data/public/assets/bootstrap/glyphicons-halflings-0e7ff93d8f48fe1f5f762e4312e78da7.png +0 -0
- data/public/assets/bootstrap/glyphicons-halflings-white-ef3d5b8d6a297804352b4a46fdb5466d.png +0 -0
- data/public/assets/bootstrap/glyphicons-halflings-white.png +0 -0
- data/public/assets/bootstrap/glyphicons-halflings.png +0 -0
- data/public/assets/excanvas-41add5296511313d9ceaddebef8ca888.js +0 -14
- data/public/assets/excanvas-41add5296511313d9ceaddebef8ca888.js.gz +0 -0
- data/public/assets/excanvas.js +0 -14
- data/public/assets/excanvas.js.gz +0 -0
- data/public/assets/file-58ce0b58f19dfe871b25270e98cff66c.gif +0 -0
- data/public/assets/file.gif +0 -0
- data/public/assets/folder-5c5b1fd2f1ece710f9159f05cc2aaaa8.gif +0 -0
- data/public/assets/folder-closed-8b61fc55011d534f0216c1150994f229.gif +0 -0
- data/public/assets/folder-closed.gif +0 -0
- data/public/assets/folder.gif +0 -0
- data/public/assets/html5-e59131c9bbee37c5d248ab5563f80112.js +0 -3
- data/public/assets/html5-e59131c9bbee37c5d248ab5563f80112.js.gz +0 -0
- data/public/assets/html5.js +0 -3
- data/public/assets/html5.js.gz +0 -0
- data/public/assets/iqvoc/ie_fixes-6a106c21d979ccdd1f6bf1cb129a0e69.css +0 -1
- data/public/assets/iqvoc/ie_fixes-6a106c21d979ccdd1f6bf1cb129a0e69.css.gz +0 -0
- data/public/assets/iqvoc/ie_fixes.css +0 -1
- data/public/assets/iqvoc/ie_fixes.css.gz +0 -0
- data/public/assets/iqvoc/visualization-85d0de8ba646bf7ba8c05255f38e19e6.js +0 -4
- data/public/assets/iqvoc/visualization-85d0de8ba646bf7ba8c05255f38e19e6.js.gz +0 -0
- data/public/assets/iqvoc/visualization.js +0 -4
- data/public/assets/iqvoc/visualization.js.gz +0 -0
- data/public/assets/iqvoc_logo-316859a511c646918fe75e92fa0bf6ac.png +0 -0
- data/public/assets/iqvoc_logo.png +0 -0
- data/public/assets/jit_rgraph-887e8bf5872bfb759cec78efe5e6c62e.js +0 -25
- data/public/assets/jit_rgraph-887e8bf5872bfb759cec78efe5e6c62e.js.gz +0 -0
- data/public/assets/jit_rgraph.js +0 -25
- data/public/assets/jit_rgraph.js.gz +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-a1eb3e0764573ed4b261ca742ed96ac3.png +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_55_fbec88_40x100-439ee8e6c8ce855f43ed4d7b90684720.png +0 -0
- data/public/assets/jquery-ui/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_75_d0e5f5_1x400-9357836db77954d0d8c5feb259635223.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_85_dfeffc_1x400-7beb11d1590fb2fb1ef5c754100a078a.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_95_fef1ec_1x400-c723e9a2b50006c6054836a10b76bb84.png +0 -0
- data/public/assets/jquery-ui/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/jquery-ui/ui-bg_gloss-wave_55_5c9ccc_500x100-cb26f48ac4912c23ce301c69c474d306.png +0 -0
- data/public/assets/jquery-ui/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_f5f8f9_1x100-519299e2aa31bffdd4fed34b4fac603d.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_fcfdfd_1x100-27e08524d3d56bb59e354435b663c3ac.png +0 -0
- data/public/assets/jquery-ui/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/public/assets/jquery-ui/ui-icons_217bc0_256x240-ed26778199d8722ae064038a1e841bc8.png +0 -0
- data/public/assets/jquery-ui/ui-icons_217bc0_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_2e83ff_256x240-94086d0ce953eb0887ab1b8140903af9.png +0 -0
- data/public/assets/jquery-ui/ui-icons_2e83ff_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_469bdd_256x240-188717a27b4d5504885a03e4ad8e34d1.png +0 -0
- data/public/assets/jquery-ui/ui-icons_469bdd_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_6da8d5_256x240-8f5b417c5604f1b7b5965c98754c33b9.png +0 -0
- data/public/assets/jquery-ui/ui-icons_6da8d5_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_cd0a0a_256x240-8b44e266bdc1f57f1393579591f89222.png +0 -0
- data/public/assets/jquery-ui/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_d8e7f3_256x240-1b415e411069df902e6f417cc014172c.png +0 -0
- data/public/assets/jquery-ui/ui-icons_d8e7f3_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_f9bd01_256x240-4553d0576c0498ca4c776aa77aa80833.png +0 -0
- data/public/assets/jquery-ui/ui-icons_f9bd01_256x240.png +0 -0
- data/public/assets/json2-fedf627b8fba2c78ab3d5cae6e76914d.js +0 -157
- data/public/assets/json2-fedf627b8fba2c78ab3d5cae6e76914d.js.gz +0 -0
- data/public/assets/json2.js +0 -157
- data/public/assets/json2.js.gz +0 -0
- data/public/assets/manifest-c97d5faf4a7e78bd05753f8155b4995d.css +0 -51
- data/public/assets/manifest-c97d5faf4a7e78bd05753f8155b4995d.css.gz +0 -0
- data/public/assets/manifest-cd131c4bf01ad6a09c034157c8cba00a.js +0 -21
- data/public/assets/manifest-cd131c4bf01ad6a09c034157c8cba00a.js.gz +0 -0
- data/public/assets/manifest.css +0 -51
- data/public/assets/manifest.css.gz +0 -0
- data/public/assets/manifest.js +0 -21
- data/public/assets/manifest.js.gz +0 -0
- data/public/assets/manifest.yml +0 -59
- data/public/assets/minus-1d0fae0720bab52bd98598218e8345c0.gif +0 -0
- data/public/assets/minus.gif +0 -0
- data/public/assets/plus-1a29e46532f839ed9c977ef4613d079f.gif +0 -0
- data/public/assets/plus.gif +0 -0
- data/public/assets/spinner_16x16-17dcf941457ae4e702f4600e714b21c1.gif +0 -0
- data/public/assets/spinner_16x16.gif +0 -0
- data/public/assets/spinner_24x24-78c707c1921b93962ea5edd7f4a74134.gif +0 -0
- data/public/assets/spinner_24x24.gif +0 -0
- data/public/assets/treeview-black-c46d96020e5d79c652af0fb0c6656384.gif +0 -0
- data/public/assets/treeview-black-line-0903c58efd34c3203d132e6f873049f6.gif +0 -0
- data/public/assets/treeview-black-line.gif +0 -0
- data/public/assets/treeview-black.gif +0 -0
- data/public/assets/treeview-default-ee6298d311205d21dc57c01c0696df70.gif +0 -0
- data/public/assets/treeview-default-line-2c4106cfd4d322c6e6565f80702c27cb.gif +0 -0
- data/public/assets/treeview-default-line.gif +0 -0
- data/public/assets/treeview-default.gif +0 -0
- data/public/assets/treeview-famfamfam-20dfef13cd5fd1e08fb61ee68eb9d3fa.gif +0 -0
- data/public/assets/treeview-famfamfam-line-a02cce2b80977e066df83137aae71fa8.gif +0 -0
- data/public/assets/treeview-famfamfam-line.gif +0 -0
- data/public/assets/treeview-famfamfam.gif +0 -0
- data/public/assets/treeview-gray-01bfdcd116e081e23daf13024fd3e4e0.gif +0 -0
- data/public/assets/treeview-gray-line-029b3a7b92ed10ea6c4b6289cb9fa0e3.gif +0 -0
- data/public/assets/treeview-gray-line.gif +0 -0
- data/public/assets/treeview-gray.gif +0 -0
- data/public/assets/treeview-red-2a5abbce598d05c864d845998381eef6.gif +0 -0
- data/public/assets/treeview-red-line-f51e6c30aa3b0ff856900ba85d769f1c.gif +0 -0
- data/public/assets/treeview-red-line.gif +0 -0
- data/public/assets/treeview-red.gif +0 -0
@@ -1,25 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2011 Sencha Inc. - Author: Nicolas Garcia Belmonte (http://philogb.github.com/)
|
3
|
-
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
of this software and associated documentation files (the "Software"), to deal
|
6
|
-
in the Software without restriction, including without limitation the rights
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the Software is
|
9
|
-
furnished to do so, subject to the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be included in
|
12
|
-
all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
THE SOFTWARE.
|
21
|
-
|
22
|
-
*/
|
23
|
-
(function(){window.$jit=function(a){var a=a||window,b;for(b in $jit)$jit[b].$extend&&(a[b]=$jit[b])},$jit.version="2.0.1";var a=function(a){return document.getElementById(a)};a.empty=function(){},a.extend=function(a,b){for(var c in b||{})a[c]=b[c];return a},a.lambda=function(a){return typeof a=="function"?a:function(){return a}},a.time=Date.now||function(){return+(new Date)},a.splat=function(b){var c=a.type(b);return c?c!="array"?[b]:b:[]},a.type=function(b){var c=a.type.s.call(b).match(/^\[object\s(.*)\]$/)[1].toLowerCase();return c!="object"?c:b&&b.$$family?b.$$family:b&&b.nodeName&&b.nodeType==1?"element":c},a.type.s=Object.prototype.toString,a.each=function(b,c){if(a.type(b)=="object")for(var d in b)c(b[d],d);else{d=0;for(var e=b.length;d<e;d++)c(b[d],d)}},a.indexOf=function(a,b){if(Array.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},a.map=function(b,c){var d=[];return a.each(b,function(a,b){d.push(c(a,b))}),d},a.reduce=function(a,b,c){var d=a.length;if(d==0)return c;for(var e=arguments.length==3?c:a[--d];d--;)e=b(e,a[d]);return e},a.merge=function(){for(var b={},c=0,d=arguments.length;c<d;c++){var e=arguments[c];if(a.type(e)=="object")for(var f in e){var g=e[f],h=b[f];b[f]=h&&a.type(g)=="object"&&a.type(h)=="object"?a.merge(h,g):a.unlink(g)}}return b},a.unlink=function(b){var c;switch(a.type(b)){case"object":c={};for(var d in b)c[d]=a.unlink(b[d]);break;case"array":c=[],d=0;for(var e=b.length;d<e;d++)c[d]=a.unlink(b[d]);break;default:return b}return c},a.zip=function(){if(arguments.length===0)return[];for(var a=0,b=[],c=arguments.length,d=arguments[0].length;a<d;a++){for(var e=0,f=[];e<c;e++)f.push(arguments[e][a]);b.push(f)}return b},a.rgbToHex=function(a,b){if(a.length<3)return null;if(a.length==4&&a[3]==0&&!b)return"transparent";for(var c=[],d=0;d<3;d++){var e=(a[d]-0).toString(16);c.push(e.length==1?"0"+e:e)}return b?c:"#"+c.join("")},a.hexToRgb=function(a){if(a.length!=7){a=a.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/),a.shift();if(a.length!=3)return null;for(var b=[],c=0;c<3;c++){var d=a[c];d.length==1&&(d+=d),b.push(parseInt(d,16))}return b}return a=parseInt(a.slice(1),16),[a>>16,a>>8&255,a&255]},a.destroy=function(b){a.clean(b),b.parentNode&&b.parentNode.removeChild(b),b.clearAttributes&&b.clearAttributes()},a.clean=function(b){for(var b=b.childNodes,c=0,d=b.length;c<d;c++)a.destroy(b[c])},a.addEvent=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},a.addEvents=function(b,c){for(var d in c)a.addEvent(b,d,c[d])},a.hasClass=function(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")>-1},a.addClass=function(b,c){a.hasClass(b,c)||(b.className=b.className+" "+c)},a.removeClass=function(a,b){a.className=a.className.replace(RegExp("(^|\\s)"+b+"(?:\\s|$)"),"$1")},a.getPos=function(a){var b=function(a){for(var b={x:0,y:0};a&&!/^(?:body|html)$/i.test(a.tagName);)b.x+=a.offsetLeft,b.y+=a.offsetTop,a=a.offsetParent;return b}(a),a=function(a){for(var b={x:0,y:0};a&&!/^(?:body|html)$/i.test(a.tagName);)b.x+=a.scrollLeft,b.y+=a.scrollTop,a=a.parentNode;return b}(a);return{x:b.x-a.x,y:b.y-a.y}},a.event={get:function(a,b){return a||(b||window).event},getWheel:function(a){return a.wheelDelta?a.wheelDelta/120:-(a.detail||0)/3},isRightClick:function(a){return a.which==3||a.button==2},getPos:function(a,b){var b=b||window,a=a||b.event,c=b.document,c=c.documentElement||c.body;return a.touches&&a.touches.length&&(a=a.touches[0]),{x:a.pageX||a.clientX+c.scrollLeft,y:a.pageY||a.clientY+c.scrollTop}},stop:function(a){a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,a.preventDefault?a.preventDefault():a.returnValue=!1}},$jit.util=$jit.id=a;var b=function(c){var c=c||{},d=function(){for(var c in this)typeof this[c]!="function"&&(this[c]=a.unlink(this[c]));return this.constructor=d,b.prototyping?this:(c=this.initialize?this.initialize.apply(this,arguments):this,this.$$family="class",c)},e;for(e in b.Mutators)c[e]&&(c=b.Mutators[e](c,c[e]),delete c[e]);return a.extend(d,this),d.constructor=b,d.prototype=c,d};b.Mutators={Implements:function(c,d){return a.each(a.splat(d),function(a){b.prototyping=a;var a=typeof a=="function"?new a:a,d;for(d in a)d in c||(c[d]=a[d]);delete b.prototyping}),c}},a.extend(b,{inherit:function(c,d){for(var e in d){var f=d[e],g=c[e],h=a.type(f);g&&h=="function"?f!=g&&b.override(c,e,f):c[e]=h=="object"?a.merge(g,f):f}return c},override:function(a,c,d){var e=b.prototyping;e&&a[c]!=e[c]&&(e=null),a[c]=function(){var b=this.parent;this.parent=e?e[c]:a[c];var f=d.apply(this,arguments);return this.parent=b,f}}}),b.prototype.implement=function(){var c=this.prototype;return a.each(Array.prototype.slice.call(arguments||[]),function(a){b.inherit(c,a)}),this},$jit.Class=b,$jit.json={prune:function(a,b){this.each(a,function(a,c){c==b&&a.children&&(delete a.children,a.children=[])})},getParent:function(a,b){if(a.id==b)return!1;var c=a.children;if(c&&c.length>0)for(var d=0;d<c.length;d++){if(c[d].id==b)return a;var e=this.getParent(c[d],b);if(e)return e}return!1},getSubtree:function(a,b){if(a.id==b)return a;for(var c=0,d=a.children;d&&c<d.length;c++){var e=this.getSubtree(d[c],b);if(e!=null)return e}return null},eachLevel:function(a,b,c,d){if(b<=c&&(d(a,b),a.children))for(var e=0,a=a.children;e<a.length;e++)this.eachLevel(a[e],b+1,c,d)},each:function(a,b){this.eachLevel(a,0,Number.MAX_VALUE,b)}},$jit.Trans={$extend:!0,linear:function(a){return a}};var c=$jit.Trans;(function(){var b=function(b,c){return c=a.splat(c),a.extend(b,{easeIn:function(a){return b(a,c)},easeOut:function(a){return 1-b(1-a,c)},easeInOut:function(a){return a<=.5?b(2*a,c)/2:(2-b(2*(1-a),c))/2}})};a.each({Pow:function(a,b){return Math.pow(a,b[0]||6)},Expo:function(a){return Math.pow(2,8*(a-1))},Circ:function(a){return 1-Math.sin(Math.acos(a))},Sine:function(a){return 1-Math.sin((1-a)*Math.PI/2)},Back:function(a,b){return b=b[0]||1.618,Math.pow(a,2)*((b+1)*a-b)},Bounce:function(a){for(var b,c=0,d=1;;c+=d,d/=2)if(a>=(7-4*c)/11){b=d*d-Math.pow((11-6*c-11*a)/4,2);break}return b},Elastic:function(a,b){return Math.pow(2,10*--a)*Math.cos(20*a*Math.PI*(b[0]||1)/3)}},function(a,d){c[d]=b(a)}),a.each(["Quad","Cubic","Quart","Quint"],function(a,d){c[a]=b(function(a){return Math.pow(a,[d+2])})})})();var d=new b({initialize:function(a){this.setOptions(a)},setOptions:function(b){return this.opt=a.merge({duration:2500,fps:40,transition:c.Quart.easeInOut,compute:a.empty,complete:a.empty,link:"ignore"},b||{}),this},step:function(){var b=a.time(),c=this.opt;b<this.time+c.duration?(b=c.transition((b-this.time)/c.duration),c.compute(b)):(this.timer=clearInterval(this.timer),c.compute(1),c.complete())},start:function(){return this.check()?(this.time=0,this.startTimer(),this):this},startTimer:function(){var b=this,c=this.opt.fps;return this.timer?!1:(this.time=a.time()-this.time,this.timer=setInterval(function(){b.step()},Math.round(1e3/c)),!0)},pause:function(){return this.stopTimer(),this},resume:function(){return this.startTimer(),this},stopTimer:function(){return this.timer?(this.time=a.time()-this.time,this.timer=clearInterval(this.timer),!0):!1},check:function(){return this.timer?this.opt.link=="cancel"?(this.stopTimer(),!0):!1:!0}}),e=function(){for(var b=arguments,c=0,d=b.length,f={};c<d;c++){var g=e[b[c]];g.$extend?a.extend(f,g):f[b[c]]=g}return f};e.Canvas={$extend:!0,injectInto:"id",type:"2D",width:!1,height:!1,useCanvas:!1,withLabels:!0,background:!1,Scene:{Lighting:{enable:!1,ambient:[1,1,1],directional:{direction:{x:-100,y:-100,z:-100},color:[.5,.3,.1]}}}},e.Node={$extend:!1,overridable:!1,type:"circle",color:"#ccb",alpha:1,dim:3,height:20,width:90,autoHeight:!1,autoWidth:!1,lineWidth:1,transform:!0,align:"center",angularWidth:1,span:1,CanvasStyles:{}},e.Edge={$extend:!1,overridable:!1,type:"line",color:"#ccb",lineWidth:1,dim:15,alpha:1,epsilon:7,CanvasStyles:{}},e.Fx={$extend:!0,fps:40,duration:2500,transition:$jit.Trans.Quart.easeInOut,clearCanvas:!0},e.Label={$extend:!1,overridable:!1,type:"HTML",style:" ",size:10,family:"sans-serif",textAlign:"center",textBaseline:"alphabetic",color:"#fff"},e.Tips={$extend:!1,enable:!1,type:"auto",offsetX:20,offsetY:20,force:!1,onShow:a.empty,onHide:a.empty},e.NodeStyles={$extend:!1,enable:!1,type:"auto",stylesHover:!1,stylesClick:!1},e.Events={$extend:!1,enable:!1,enableForEdges:!1,type:"auto",onClick:a.empty,onRightClick:a.empty,onMouseMove:a.empty,onMouseEnter:a.empty,onMouseLeave:a.empty,onDragStart:a.empty,onDragMove:a.empty,onDragCancel:a.empty,onDragEnd:a.empty,onTouchStart:a.empty,onTouchMove:a.empty,onTouchEnd:a.empty,onMouseWheel:a.empty},e.Navigation={$extend:!1,enable:!1,type:"auto",panning:!1,zooming:!1},e.Controller={$extend:!0,onBeforeCompute:a.empty,onAfterCompute:a.empty,onCreateLabel:a.empty,onPlaceLabel:a.empty,onComplete:a.empty,onBeforePlotLine:a.empty,onAfterPlotLine:a.empty,onBeforePlotNode:a.empty,onAfterPlotNode:a.empty,request:!1};var f={initialize:function(a,b){this.viz=b,this.canvas=b.canvas,this.config=b.config[a],this.nodeTypes=b.fx.nodeTypes;var c=this.config.type;this.labelContainer=(this.dom=c=="auto"?b.config.Label.type!="Native":c!="Native")&&b.labels.getLabelContainer(),this.isEnabled()&&this.initializePost()},initializePost:a.empty,setAsProperty:a.lambda(!1),isEnabled:function(){return this.config.enable},isLabel:function(b,c,d){var b=a.event.get(b,c),c=this.labelContainer,e=b.target||b.srcElement,b=b.relatedTarget;return d?b&&b==this.viz.canvas.getCtx().canvas&&!!e&&this.isDescendantOf(e,c):this.isDescendantOf(e,c)},isDescendantOf:function(a,b){for(;a&&a.parentNode;){if(a.parentNode==b)return a;a=a.parentNode}return!1}},g={onMouseUp:a.empty,onMouseDown:a.empty,onMouseMove:a.empty,onMouseOver:a.empty,onMouseOut:a.empty,onMouseWheel:a.empty,onTouchStart:a.empty,onTouchMove:a.empty,onTouchEnd:a.empty,onTouchCancel:a.empty},h=new b({initialize:function(a){this.viz=a,this.canvas=a.canvas,this.edge=this.node=!1,this.registeredObjects=[],this.attachEvents()},attachEvents:function(){var b=this.canvas.getElement(),c=this;b.oncontextmenu=a.lambda(!1),a.addEvents(b,{mouseup:function(b,d){var e=a.event.get(b,d);c.handleEvent("MouseUp",b,d,c.makeEventObject(b,d),a.event.isRightClick(e))},mousedown:function(b,d){var e=a.event.get(b,d);c.handleEvent("MouseDown",b,d,c.makeEventObject(b,d),a.event.isRightClick(e))},mousemove:function(a,b){c.handleEvent("MouseMove",a,b,c.makeEventObject(a,b))},mouseover:function(a,b){c.handleEvent("MouseOver",a,b,c.makeEventObject(a,b))},mouseout:function(a,b){c.handleEvent("MouseOut",a,b,c.makeEventObject(a,b))},touchstart:function(a,b){c.handleEvent("TouchStart",a,b,c.makeEventObject(a,b))},touchmove:function(a,b){c.handleEvent("TouchMove",a,b,c.makeEventObject(a,b))},touchend:function(a,b){c.handleEvent("TouchEnd",a,b,c.makeEventObject(a,b))}});var d=function(b,d){var e=a.event.get(b,d),e=a.event.getWheel(e);c.handleEvent("MouseWheel",b,d,e)};!document.getBoxObjectFor&&window.mozInnerScreenX==null?a.addEvent(b,"mousewheel",d):b.addEventListener("DOMMouseScroll",d,!1)},register:function(a){this.registeredObjects.push(a)},handleEvent:function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=0,d=this.registeredObjects,e=d.length;c<e;c++)d[c]["on"+b].apply(d[c],a)},makeEventObject:function(b,c){var d=this,e=this.viz.graph,f=this.viz.fx,g=f.nodeTypes,h=f.edgeTypes;return{pos:!1,node:!1,edge:!1,contains:!1,getNodeCalled:!1,getEdgeCalled:!1,getPos:function(){var e=d.viz.canvas,f=e.getSize(),g=e.getPos(),h=e.translateOffsetX,i=e.translateOffsetY,j=e.scaleOffsetX,e=e.scaleOffsetY,k=a.event.getPos(b,c);return this.pos={x:(k.x-g.x-f.width/2-h)*1/j,y:(k.y-g.y-f.height/2-i)*1/e}},getNode:function(){if(this.getNodeCalled)return this.node;this.getNodeCalled=!0;for(var a in e.nodes){var b=e.nodes[a],c=b&&g[b.getData("type")];if(c=c&&c.contains&&c.contains.call(f,b,this.getPos()))return this.contains=c,d.node=this.node=b}return d.node=this.node=!1},getEdge:function(){if(this.getEdgeCalled)return this.edge;this.getEdgeCalled=!0;var a={},b;for(b in e.edges){var c=e.edges[b];a[b]=!0;for(var g in c)if(!(g in a)){var i=c[g],j=i&&h[i.getData("type")];if(j=j&&j.contains&&j.contains.call(f,i,this.getPos()))return this.contains=j,d.edge=this.edge=i}}return d.edge=this.edge=!1},getContains:function(){return this.getNodeCalled?this.contains:(this.getNode(),this.contains)}}}}),i={initializeExtras:function(){var b=new h(this),c=this;a.each(["NodeStyles","Tips","Navigation","Events"],function(a){var d=new i.Classes[a](a,c);d.isEnabled()&&b.register(d),d.setAsProperty()&&(c[a.toLowerCase()]=d)})},Classes:{}};i.Classes.Events=new b({Implements:[f,g],initializePost:function(){this.fx=this.viz.fx,this.ntypes=this.viz.fx.nodeTypes,this.etypes=this.viz.fx.edgeTypes,this.moved=this.touchMoved=this.touched=this.pressed=this.hovered=!1},setAsProperty:a.lambda(!0),onMouseUp:function(b,c,d,e){b=a.event.get(b,c),this.moved||(e?this.config.onRightClick(this.hovered,d,b):this.config.onClick(this.pressed,d,b)),this.pressed&&(this.moved?this.config.onDragEnd(this.pressed,d,b):this.config.onDragCancel(this.pressed,d,b),this.pressed=this.moved=!1)},onMouseOut:function(b,c,d){var e=a.event.get(b,c),f;if(this.dom&&(f=this.isLabel(b,c,!0)))this.config.onMouseLeave(this.viz.graph.getNode(f.id),d,e),this.hovered=!1;else{b=e.relatedTarget;for(c=this.canvas.getElement();b&&b.parentNode;){if(c==b.parentNode)return;b=b.parentNode}this.hovered&&(this.config.onMouseLeave(this.hovered,d,e),this.hovered=!1)}},onMouseOver:function(b,c,d){var e=a.event.get(b,c),f;this.dom&&(f=this.isLabel(b,c,!0))&&(this.hovered=this.viz.graph.getNode(f.id),this.config.onMouseEnter(this.hovered,d,e))},onMouseMove:function(b,c,d){b=a.event.get(b,c);if(this.pressed)this.moved=!0,this.config.onDragMove(this.pressed,d,b);else if(this.dom)this.config.onMouseMove(this.hovered,d,b);else{if(this.hovered){var c=this.hovered,e=c.nodeFrom?this.etypes[c.getData("type")]:this.ntypes[c.getData("type")];if(e&&e.contains&&e.contains.call(this.fx,c,d.getPos())){this.config.onMouseMove(c,d,b);return}this.config.onMouseLeave(c,d,b),this.hovered=!1}(this.hovered=d.getNode()||this.config.enableForEdges&&d.getEdge())?this.config.onMouseEnter(this.hovered,d,b):this.config.onMouseMove(!1,d,b)}},onMouseWheel:function(b,c,d){this.config.onMouseWheel(d,a.event.get(b,c))},onMouseDown:function(b,c,d){var e=a.event.get(b,c);if(this.dom){if(b=this.isLabel(b,c))this.pressed=this.viz.graph.getNode(b.id)}else this.pressed=d.getNode()||this.config.enableForEdges&&d.getEdge();this.pressed&&this.config.onDragStart(this.pressed,d,e)},onTouchStart:function(b,c,d){var e=a.event.get(b,c),f;(this.touched=this.dom&&(f=this.isLabel(b,c))?this.viz.graph.getNode(f.id):d.getNode()||this.config.enableForEdges&&d.getEdge())&&this.config.onTouchStart(this.touched,d,e)},onTouchMove:function(b,c,d){b=a.event.get(b,c),this.touched&&(this.touchMoved=!0,this.config.onTouchMove(this.touched,d,b))},onTouchEnd:function(b,c,d){b=a.event.get(b,c),this.touched&&(this.touchMoved?this.config.onTouchEnd(this.touched,d,b):this.config.onTouchCancel(this.touched,d,b),this.touched=this.touchMoved=!1)}}),i.Classes.Tips=new b({Implements:[f,g],initializePost:function(){if(document.body){var b=a("_tooltip")||document.createElement("div");b.id="_tooltip",b.className="tip",a.extend(b.style,{position:"absolute",display:"none",zIndex:13e3}),document.body.appendChild(b),this.tip=b,this.node=!1}},setAsProperty:a.lambda(!0),onMouseOut:function(b,c){a.event.get(b,c);if(this.dom&&this.isLabel(b,c,!0))this.hide(!0);else{for(var d=b.relatedTarget,e=this.canvas.getElement();d&&d.parentNode;){if(e==d.parentNode)return;d=d.parentNode}this.hide(!1)}},onMouseOver:function(a,b){var c;this.dom&&(c=this.isLabel(a,b,!1))&&(this.node=this.viz.graph.getNode(c.id),this.config.onShow(this.tip,this.node,c))},onMouseMove:function(b,c,d){this.dom&&this.isLabel(b,c)&&this.setTooltipPosition(a.event.getPos(b,c));if(!this.dom){var e=d.getNode();if(e){if(this.config.force||!this.node||this.node.id!=e.id)this.node=e,this.config.onShow(this.tip,e,d.getContains());this.setTooltipPosition(a.event.getPos(b,c))}else this.hide(!0)}},setTooltipPosition:function(a){var b=this.tip,c=b.style,d=this.config;c.display="";var e={height:document.body.clientHeight,width:document.body.clientWidth},b={width:b.offsetWidth,height:b.offsetHeight},f=d.offsetX,d=d.offsetY;c.top=(a.y+d+b.height>e.height?a.y-b.height-d:a.y+d)+"px",c.left=(a.x+b.width+f>e.width?a.x-b.width-f:a.x+f)+"px"},hide:function(a){this.tip.style.display="none",a&&this.config.onHide()}}),i.Classes.NodeStyles=new b({Implements:[f,g],initializePost:function(){this.fx=this.viz.fx,this.types=this.viz.fx.nodeTypes,this.nStyles=this.config,this.nodeStylesOnHover=this.nStyles.stylesHover,this.nodeStylesOnClick=this.nStyles.stylesClick,this.hoveredNode=!1,this.fx.nodeFxAnimation=new d,this.move=this.down=!1},onMouseOut:function(a,b){this.down=this.move=!1;if(this.hoveredNode){this.dom&&this.isLabel(a,b,!0)&&this.toggleStylesOnHover(this.hoveredNode,!1);for(var c=a.relatedTarget,d=this.canvas.getElement();c&&c.parentNode;){if(d==c.parentNode)return;c=c.parentNode}this.toggleStylesOnHover(this.hoveredNode,!1),this.hoveredNode=!1}},onMouseOver:function(a,b){var c;this.dom&&(c=this.isLabel(a,b,!0))&&(c=this.viz.graph.getNode(c.id),!c.selected)&&(this.hoveredNode=c,this.toggleStylesOnHover(this.hoveredNode,!0))},onMouseDown:function(a,b,c,d){if(!d){var e;this.dom&&(e=this.isLabel(a,b))?this.down=this.viz.graph.getNode(e.id):this.dom||(this.down=c.getNode()),this.move=!1}},onMouseUp:function(a,b,c,d){d||(this.move||this.onClick(c.getNode()),this.down=this.move=!1)},getRestoredStyles:function(a,b){var c={},d=this["nodeStylesOn"+b],e;for(e in d)c[e]=a.styles["$"+e];return c},toggleStylesOnHover:function(a,b){this.nodeStylesOnHover&&this.toggleStylesOn("Hover",a,b)},toggleStylesOnClick:function(a,b){this.nodeStylesOnClick&&this.toggleStylesOn("Click",a,b)},toggleStylesOn:function(b,d,e){var f=this.viz;if(e){d.styles||(d.styles=a.merge(d.data,{}));for(var g in this["nodeStylesOn"+b])e="$"+g,e in d.styles||(d.styles[e]=d.getData(g));f.fx.nodeFx(a.extend({elements:{id:d.id,properties:this["nodeStylesOn"+b]},transition:c.Quart.easeOut,duration:300,fps:40},this.config))}else b=this.getRestoredStyles(d,b),f.fx.nodeFx(a.extend({elements:{id:d.id,properties:b},transition:c.Quart.easeOut,duration:300,fps:40},this.config))},onClick:function(a){if(a){var b=this.nodeStylesOnClick;b&&(a.selected?(this.toggleStylesOnClick(a,!1),delete a.selected):(this.viz.graph.eachNode(function(a){if(a.selected){for(var c in b)a.setData(c,a.styles["$"+c],"end");delete a.selected}}),this.toggleStylesOnClick(a,!0),a.selected=!0,delete a.hovered,this.hoveredNode=!1))}},onMouseMove:function(a,b,c){this.down&&(this.move=!0);if(!this.dom||!this.isLabel(a,b)){var d=this.nodeStylesOnHover;if(d&&!this.dom){if(this.hoveredNode&&(a=this.types[this.hoveredNode.getData("type")])&&a.contains&&a.contains.call(this.fx,this.hoveredNode,c.getPos()))return;c=c.getNode(),(this.hoveredNode||c)&&!c.hovered&&(c&&!c.selected?(this.fx.nodeFxAnimation.stopTimer(),this.viz.graph.eachNode(function(a){if(a.hovered&&!a.selected){for(var b in d)a.setData(b,a.styles["$"+b],"end");delete a.hovered}}),c.hovered=!0,this.hoveredNode=c,this.toggleStylesOnHover(c,!0)):this.hoveredNode&&!this.hoveredNode.selected&&(this.fx.nodeFxAnimation.stopTimer(),this.toggleStylesOnHover(this.hoveredNode,!1),delete this.hoveredNode.hovered,this.hoveredNode=!1))}}}}),i.Classes.Navigation=new b({Implements:[f,g],initializePost:function(){this.pressed=this.pos=!1},onMouseWheel:function(b,c,d){this.config.zooming&&(a.event.stop(a.event.get(b,c)),b=1+d*(this.config.zooming/1e3),this.canvas.scale(b,b))},onMouseDown:function(a,b,c){if(this.config.panning&&(this.config.panning!="avoid nodes"||(this.dom?!this.isLabel(a,b):!c.getNode()))){this.pressed=!0,this.pos=c.getPos();var a=this.canvas,b=a.translateOffsetX,c=a.translateOffsetY,d=a.scaleOffsetY;this.pos.x*=a.scaleOffsetX,this.pos.x+=b,this.pos.y*=d,this.pos.y+=c}},onMouseMove:function(a,b,c){if(this.config.panning&&this.pressed&&(this.config.panning!="avoid nodes"||(this.dom?!this.isLabel(a,b):!c.getNode()))){var a=this.pos,c=c.getPos(),d=this.canvas,e=d.translateOffsetX,f=d.translateOffsetY,b=d.scaleOffsetX,d=d.scaleOffsetY;c.x*=b,c.y*=d,c.x+=e,c.y+=f,e=c.x-a.x,a=c.y-a.y,this.pos=c,this.canvas.translate(e*1/b,a*1/d)}},onMouseUp:function(){this.config.panning&&(this.pressed=!1)}});var j;(function(){function c(b,c){var d=document.createElement(b),f;for(f in c)typeof c[f]=="object"?a.extend(d[f],c[f]):d[f]=c[f];return b=="canvas"&&!e&&G_vmlCanvasManager&&(d=G_vmlCanvasManager.initElement(document.body.appendChild(d))),d}var d=typeof HTMLCanvasElement,e=d=="object"||d=="function";$jit.Canvas=j=new b({canvases:[],pos:!1,element:!1,labelContainer:!1,translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(b,d){this.viz=b,this.opt=this.config=d;var e=a.type(d.injectInto)=="string"?d.injectInto:d.injectInto.id,f=d.type,g=e+"-label",h=a(e),i=d.width||h.offsetWidth,k=d.height||h.offsetHeight;this.id=e;var l={injectInto:e,width:i,height:k};this.element=c("div",{id:e+"-canvaswidget",style:{position:"relative",width:i+"px",height:k+"px"}}),this.labelContainer=this.createLabelContainer(d.Label.type,g,l),this.canvases.push(new j.Base[f]({config:a.extend({idSuffix:"-canvas"},l),plot:function(){b.fx.plot()},resize:function(){b.refresh()}}));if(e=d.background)l=new j.Background[e.type](b,a.extend(e,l)),this.canvases.push(new j.Base[f](l));for(f=this.canvases.length;f--;)this.element.appendChild(this.canvases[f].canvas),f>0&&this.canvases[f].plot();this.element.appendChild(this.labelContainer),h.appendChild(this.element);var m=null,n=this;a.addEvent(window,"scroll",function(){clearTimeout(m),m=setTimeout(function(){n.getPos(!0)},500)})},getCtx:function(a){return this.canvases[a||0].getCtx()},getConfig:function(){return this.opt},getElement:function(){return this.element},getSize:function(a){return this.canvases[a||0].getSize()},resize:function(a,b){this.getPos(!0),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1;for(var c=0,d=this.canvases.length;c<d;c++)this.canvases[c].resize(a,b);c=this.element.style,c.width=a+"px",c.height=b+"px",this.labelContainer&&(this.labelContainer.style.width=a+"px")},translate:function(a,b,c){this.translateOffsetX+=a*this.scaleOffsetX,this.translateOffsetY+=b*this.scaleOffsetY;for(var d=0,e=this.canvases.length;d<e;d++)this.canvases[d].translate(a,b,c)},scale:function(a,b){var c=this.scaleOffsetX*a,d=this.scaleOffsetY*b,e=this.translateOffsetX*(a-1)/c,f=this.translateOffsetY*(b-1)/d;this.scaleOffsetX=c,this.scaleOffsetY=d,c=0;for(d=this.canvases.length;c<d;c++)this.canvases[c].scale(a,b,!0);this.translate(e,f,!1)},getPos:function(b){return b||!this.pos?this.pos=a.getPos(this.getElement()):this.pos},clear:function(a){this.canvases[a||0].clear()},path:function(a,b){var c=this.canvases[0].getCtx();c.beginPath(),b(c),c[a](),c.closePath()},createLabelContainer:function(a,b,d){if(a=="HTML"||a=="Native")return c("div",{id:b,style:{overflow:"visible",position:"absolute",top:0,left:0,width:d.width+"px",height:0}});if(a=="SVG"){a=document.createElementNS("http://www.w3.org/2000/svg","svg:svg"),a.setAttribute("width",d.width),a.setAttribute("height",d.height);var e=a.style;return e.position="absolute",e.left=e.top="0px",e=document.createElementNS("http://www.w3.org/2000/svg","svg:g"),e.setAttribute("width",d.width),e.setAttribute("height",d.height),e.setAttribute("x",0),e.setAttribute("y",0),e.setAttribute("id",b),a.appendChild(e),a}}}),j.Base={},j.Base["2D"]=new b({translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(a){this.viz=a,this.opt=a.config,this.size=!1,this.createCanvas(),this.translateToCenter()},createCanvas:function(){var a=this.opt,b=a.width,d=a.height;this.canvas=c("canvas",{id:a.injectInto+a.idSuffix,width:b,height:d,style:{position:"absolute",top:0,left:0,width:b+"px",height:d+"px"}})},getCtx:function(){return this.ctx?this.ctx:this.ctx=this.canvas.getContext("2d")},getSize:function(){if(this.size)return this.size;var a=this.canvas;return this.size={width:a.width,height:a.height}},translateToCenter:function(a){var b=this.getSize(),c=a?b.width-a.width-this.translateOffsetX*2:b.width;height=a?b.height-a.height-this.translateOffsetY*2:b.height,b=this.getCtx(),a&&b.scale(1/this.scaleOffsetX,1/this.scaleOffsetY),b.translate(c/2,height/2)},resize:function(a,b){var c=this.getSize(),d=this.canvas,f=d.style;this.size=!1,d.width=a,d.height=b,f.width=a+"px",f.height=b+"px",e?this.translateToCenter():this.translateToCenter(c),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1,this.clear(),this.viz.resize(a,b,this)},translate:function(a,b,c){var d=this.scaleOffsetY;this.translateOffsetX+=a*this.scaleOffsetX,this.translateOffsetY+=b*d,this.getCtx().translate(a,b),!c&&this.plot()},scale:function(a,b,c){this.scaleOffsetX*=a,this.scaleOffsetY*=b,this.getCtx().scale(a,b),!c&&this.plot()},clear:function(){var a=this.getSize(),b=this.translateOffsetX,c=this.translateOffsetY,d=this.scaleOffsetX,e=this.scaleOffsetY;this.getCtx().clearRect((-a.width/2-b)*1/d,(-a.height/2-c)*1/e,a.width*1/d,a.height*1/e)},plot:function(){this.clear(),this.viz.plot(this)}}),j.Background={},j.Background.Circles=new b({initialize:function(b,c){this.viz=b,this.config=a.merge({idSuffix:"-bkcanvas",levelDistance:100,numberOfCircles:6,CanvasStyles:{},offset:0},c)},resize:function(a,b,c){this.plot(c)},plot:function(a){var a=a.getCtx(),b=this.config,c=b.CanvasStyles,d;for(d in c)a[d]=c[d];d=b.numberOfCircles,b=b.levelDistance;for(c=1;c<=d;c++)a.beginPath(),a.arc(0,0,b*c,0,2*Math.PI,!1),a.stroke(),a.closePath()}})})();var k=function(a,b){this.theta=a||0,this.rho=b||0};$jit.Polar=k,k.prototype={getc:function(a){return this.toComplex(a)},getp:function(){return this},set:function(a){a=a.getp(),this.theta=a.theta,this.rho=a.rho},setc:function(a,b){this.rho=Math.sqrt(a*a+b*b),this.theta=Math.atan2(b,a),this.theta<0&&(this.theta+=Math.PI*2)},setp:function(a,b){this.theta=a,this.rho=b},clone:function(){return new k(this.theta,this.rho)},toComplex:function(a){var b=Math.cos(this.theta)*this.rho,c=Math.sin(this.theta)*this.rho;return a?{x:b,y:c}:new l(b,c)},add:function(a){return new k(this.theta+a.theta,this.rho+a.rho)},scale:function(a){return new k(this.theta,this.rho*a)},equals:function(a){return this.theta==a.theta&&this.rho==a.rho},$add:function(a){return this.theta+=a.theta,this.rho+=a.rho,this},$madd:function(a){return this.theta=(this.theta+a.theta)%(Math.PI*2),this.rho+=a.rho,this},$scale:function(a){return this.rho*=a,this},isZero:function(){var a=Math.abs;return a(this.theta)<1e-4&&a(this.rho)<1e-4},interpolate:function(a,b){var c=Math.PI,d=c*2,e=function(a){return a<0?a%d+d:a%d},f=this.theta,g=a.theta,h=Math.abs(f-g);return{theta:h==c?f>g?e(g+(f-d-g)*b):e(g-d+(f-g)*b):h>=c?f>g?e(g+(f-d-g)*b):e(g-d+(f-(g-d))*b):e(g+(f-g)*b),rho:(this.rho-a.rho)*b+a.rho}}},k.KER=new k(0,0);var l=function(a,b){this.x=a||0,this.y=b||0};$jit.Complex=l,l.prototype={getc:function(){return this},getp:function(a){return this.toPolar(a)},set:function(a){a=a.getc(!0),this.x=a.x,this.y=a.y},setc:function(a,b){this.x=a,this.y=b},setp:function(a,b){this.x=Math.cos(a)*b,this.y=Math.sin(a)*b},clone:function(){return new l(this.x,this.y)},toPolar:function(a){var b=this.norm(),c=Math.atan2(this.y,this.x);return c<0&&(c+=Math.PI*2),a?{theta:c,rho:b}:new k(c,b)},norm:function(){return Math.sqrt(this.squaredNorm())},squaredNorm:function(){return this.x*this.x+this.y*this.y},add:function(a){return new l(this.x+a.x,this.y+a.y)},prod:function(a){return new l(this.x*a.x-this.y*a.y,this.y*a.x+this.x*a.y)},conjugate:function(){return new l(this.x,-this.y)},scale:function(a){return new l(this.x*a,this.y*a)},equals:function(a){return this.x==a.x&&this.y==a.y},$add:function(a){return this.x+=a.x,this.y+=a.y,this},$prod:function(a){var b=this.x,c=this.y;return this.x=b*a.x-c*a.y,this.y=c*a.x+b*a.y,this},$conjugate:function(){return this.y=-this.y,this},$scale:function(a){return this.x*=a,this.y*=a,this},$div:function(a){var b=this.x,c=this.y,d=a.squaredNorm();return this.x=b*a.x+c*a.y,this.y=c*a.x-b*a.y,this.$scale(1/d)},isZero:function(){var a=Math.abs;return a(this.x)<1e-4&&a(this.y)<1e-4}},l.KER=new l(0,0),$jit.Graph=new b({initialize:function(b,c,d,e){var f={klass:l,Node:{}};this.Node=c,this.Edge=d,this.Label=e,this.opt=a.merge(f,b||{}),this.nodes={},this.edges={};var g=this;this.nodeList={};for(var h in n)g.nodeList[h]=function(a){return function(){var b=Array.prototype.slice.call(arguments);g.eachNode(function(c){c[a].apply(c,b)})}}(h)},getNode:function(a){return this.hasNode(a)?this.nodes[a]:!1},get:function(a){return this.getNode(a)},getByName:function(a){for(var b in this.nodes){var c=this.nodes[b];if(c.name==a)return c}return!1},getAdjacence:function(a,b){return a in this.edges?this.edges[a][b]:!1},addNode:function(b){if(!this.nodes[b.id]){var c=this.edges[b.id]={};this.nodes[b.id]=new m.Node(a.extend({id:b.id,name:b.name,data:a.merge(b.data||{},{}),adjacencies:c},this.opt.Node),this.opt.klass,this.Node,this.Edge,this.Label)}return this.nodes[b.id]},addAdjacence:function(a,b,c){this.hasNode(a.id)||this.addNode(a),this.hasNode(b.id)||this.addNode(b),a=this.nodes[a.id],b=this.nodes[b.id];if(!a.adjacentTo(b)){var d=this.edges[a.id]=this.edges[a.id]||{},e=this.edges[b.id]=this.edges[b.id]||{};return d[b.id]=e[a.id]=new m.Adjacence(a,b,c,this.Edge,this.Label),d[b.id]}return this.edges[a.id][b.id]},removeNode:function(a){if(this.hasNode(a)){delete this.nodes[a];var b=this.edges[a],c;for(c in b)delete this.edges[c][a];delete this.edges[a]}},removeAdjacence:function(a,b){delete this.edges[a][b],delete this.edges[b][a]},hasNode:function(a){return a in this.nodes},empty:function(){this.nodes={},this.edges={}}});var m=$jit.Graph,n;(function(){var b=function(a,b,c,d,e){var f,c=c||"current";return c=="current"?f=this.data:c=="start"?f=this.startData:c=="end"&&(f=this.endData),a="$"+(a?a+"-":"")+b,d?f[a]:this.Config.overridable?a in f?f[a]:a in this.data?this.data[a]:e[b]||0:e[b]||0},c=function(a,b,c,d){var d=d||"current",e;d=="current"?e=this.data:d=="start"?e=this.startData:d=="end"&&(e=this.endData),e["$"+(a?a+"-":"")+b]=c},d=function(b,c){var b="$"+(b?b+"-":""),d=this;a.each(c,function(a){a=b+a,delete d.data[a],delete d.endData[a],delete d.startData[a]})};n={getData:function(a,c,d){return b.call(this,"",a,c,d,this.Config)},setData:function(a,b,d){c.call(this,"",a,b,d)},setDataset:function(b,c){var b=a.splat(b),d;for(d in c)for(var e=0,f=a.splat(c[d]),g=b.length;e<g;e++)this.setData(d,f[e],b[e])},removeData:function(){d.call(this,"",Array.prototype.slice.call(arguments))},getCanvasStyle:function(a,c,d){return b.call(this,"canvas",a,c,d,this.Config.CanvasStyles)},setCanvasStyle:function(a,b,d){c.call(this,"canvas",a,b,d)},setCanvasStyles:function(b,c){var b=a.splat(b),d;for(d in c)for(var e=0,f=a.splat(c[d]),g=b.length;e<g;e++)this.setCanvasStyle(d,f[e],b[e])},removeCanvasStyle:function(){d.call(this,"canvas",Array.prototype.slice.call(arguments))},getLabelData:function(a,c,d){return b.call(this,"label",a,c,d,this.Label)},setLabelData:function(a,b,d){c.call(this,"label",a,b,d)},setLabelDataset:function(b,c){var b=a.splat(b),d;for(d in c)for(var e=0,f=a.splat(c[d]),g=b.length;e<g;e++)this.setLabelData(d,f[e],b[e])},removeLabelData:function(){d.call(this,"label",Array.prototype.slice.call(arguments))}}})(),m.Node=new b({initialize:function(b,c,d,e,f){c={id:"",name:"",data:{},startData:{},endData:{},adjacencies:{},selected
|
24
|
-
:!1,drawn:!1,exist:!1,angleSpan:{begin:0,end:0},pos:new c,startPos:new c,endPos:new c},a.extend(this,a.extend(c,b)),this.Config=this.Node=d,this.Edge=e,this.Label=f},adjacentTo:function(a){return a.id in this.adjacencies},getAdjacency:function(a){return this.adjacencies[a]},getPos:function(a){a=a||"current";if(a=="current")return this.pos;if(a=="end")return this.endPos;if(a=="start")return this.startPos},setPos:function(a,b){var b=b||"current",c;b=="current"?c=this.pos:b=="end"?c=this.endPos:b=="start"&&(c=this.startPos),c.set(a)}}),m.Node.implement(n),m.Adjacence=new b({initialize:function(a,b,c,d,e){this.nodeFrom=a,this.nodeTo=b,this.data=c||{},this.startData={},this.endData={},this.Config=this.Edge=d,this.Label=e}}),m.Adjacence.implement(n),m.Util={filter:function(b){if(!b||a.type(b)!="string")return function(){return!0};var c=b.split(" ");return function(a){for(var b=0;b<c.length;b++)if(a[c[b]])return!1;return!0}},getNode:function(a,b){return a.nodes[b]},eachNode:function(a,b,c){var c=this.filter(c),d;for(d in a.nodes)c(a.nodes[d])&&b(a.nodes[d])},each:function(a,b,c){this.eachNode(a,b,c)},eachAdjacency:function(a,b,c){var d=a.adjacencies,c=this.filter(c),e;for(e in d){var f=d[e];if(c(f)){if(f.nodeFrom!=a){var g=f.nodeFrom;f.nodeFrom=f.nodeTo,f.nodeTo=g}b(f,e)}}},computeLevels:function(a,b,c,d){var c=c||0,e=this.filter(d);this.eachNode(a,function(a){a._flag=!1,a._depth=-1},d),a=a.getNode(b),a._depth=c;for(var f=[a];f.length!=0;){var g=f.pop();g._flag=!0,this.eachAdjacency(g,function(a){a=a.nodeTo,a._flag==0&&e(a)&&(a._depth<0&&(a._depth=g._depth+1+c),f.unshift(a))},d)}},eachBFS:function(a,b,c,d){var e=this.filter(d);this.clean(a);for(var f=[a.getNode(b)];f.length!=0;)a=f.pop(),a._flag=!0,c(a,a._depth),this.eachAdjacency(a,function(a){a=a.nodeTo,a._flag==0&&e(a)&&(a._flag=!0,f.unshift(a))},d)},eachLevel:function(a,b,c,d,e){var f=a._depth,g=this.filter(e),h=this,c=c===!1?Number.MAX_VALUE-f:c;(function i(a,b,c){var e=a._depth;e>=b&&e<=c&&g(a)&&d(a,e),e<c&&h.eachAdjacency(a,function(a){a=a.nodeTo,a._depth>e&&i(a,b,c)})})(a,b+f,c+f)},eachSubgraph:function(a,b,c){this.eachLevel(a,0,!1,b,c)},eachSubnode:function(a,b,c){this.eachLevel(a,1,1,b,c)},anySubnode:function(b,c,d){var e=!1,c=c||a.lambda(!0),f=a.type(c)=="string"?function(a){return a[c]}:c;return this.eachSubnode(b,function(a){f(a)&&(e=!0)},d),e},getSubnodes:function(b,c,d){var e=[],c=c||0,f;return a.type(c)=="array"?(f=c[0],c=c[1]):(f=c,c=Number.MAX_VALUE-b._depth),this.eachLevel(b,f,c,function(a){e.push(a)},d),e},getParents:function(a){var b=[];return this.eachAdjacency(a,function(c){c=c.nodeTo,c._depth<a._depth&&b.push(c)}),b},isDescendantOf:function(a,b){if(a.id==b)return!0;for(var c=this.getParents(a),d=!1,e=0;!d&&e<c.length;e++)d=d||this.isDescendantOf(c[e],b);return d},clean:function(a){this.eachNode(a,function(a){a._flag=!1})},getClosestNodeToOrigin:function(a,b,c){return this.getClosestNodeToPos(a,k.KER,b,c)},getClosestNodeToPos:function(a,b,c,d){var e=null,c=c||"current",b=b&&b.getc(!0)||l.KER,f=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d};return this.eachNode(a,function(a){e=e==null||f(a.getPos(c).getc(!0),b)<f(e.getPos(c).getc(!0),b)?a:e},d),e}},a.each(["get","getNode","each","eachNode","computeLevels","eachBFS","clean","getClosestNodeToPos","getClosestNodeToOrigin"],function(a){m.prototype[a]=function(){return m.Util[a].apply(m.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),a.each(["eachAdjacency","eachLevel","eachSubgraph","eachSubnode","anySubnode","getSubnodes","getParents","isDescendantOf"],function(a){m.Node.prototype[a]=function(){return m.Util[a].apply(m.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),m.Op={options:{type:"nothing",duration:2e3,hideLabels:!0,fps:30},initialize:function(a){this.viz=a},removeNode:function(b,c){var d=this.viz,e=a.merge(this.options,d.controller,c),f=a.splat(b),g,h,i;switch(e.type){case"nothing":for(g=0;g<f.length;g++)d.graph.removeNode(f[g]);break;case"replot":this.removeNode(f,{type:"nothing"}),d.labels.clearLabels(),d.refresh(!0);break;case"fade:seq":case"fade":h=this;for(g=0;g<f.length;g++)i=d.graph.getNode(f[g]),i.setData("alpha",0,"end");d.fx.animate(a.merge(e,{modes:["node-property:alpha"],onComplete:function(){h.removeNode(f,{type:"nothing"}),d.labels.clearLabels(),d.reposition(),d.fx.animate(a.merge(e,{modes:["linear"]}))}}));break;case"fade:con":h=this;for(g=0;g<f.length;g++)i=d.graph.getNode(f[g]),i.setData("alpha",0,"end"),i.ignore=!0;d.reposition(),d.fx.animate(a.merge(e,{modes:["node-property:alpha","linear"],onComplete:function(){h.removeNode(f,{type:"nothing"}),e.onComplete&&e.onComplete()}}));break;case"iter":h=this,d.fx.sequence({condition:function(){return f.length!=0},step:function(){h.removeNode(f.shift(),{type:"nothing"}),d.labels.clearLabels()},onComplete:function(){e.onComplete&&e.onComplete()},duration:Math.ceil(e.duration/f.length)});break;default:this.doError()}},removeEdge:function(b,c){var d=this.viz,e=a.merge(this.options,d.controller,c),f=a.type(b[0])=="string"?[b]:b,g,h,i;switch(e.type){case"nothing":for(g=0;g<f.length;g++)d.graph.removeAdjacence(f[g][0],f[g][1]);break;case"replot":this.removeEdge(f,{type:"nothing"}),d.refresh(!0);break;case"fade:seq":case"fade":h=this;for(g=0;g<f.length;g++)(i=d.graph.getAdjacence(f[g][0],f[g][1]))&&i.setData("alpha",0,"end");d.fx.animate(a.merge(e,{modes:["edge-property:alpha"],onComplete:function(){h.removeEdge(f,{type:"nothing"}),d.reposition(),d.fx.animate(a.merge(e,{modes:["linear"]}))}}));break;case"fade:con":h=this;for(g=0;g<f.length;g++)if(i=d.graph.getAdjacence(f[g][0],f[g][1]))i.setData("alpha",0,"end"),i.ignore=!0;d.reposition(),d.fx.animate(a.merge(e,{modes:["edge-property:alpha","linear"],onComplete:function(){h.removeEdge(f,{type:"nothing"}),e.onComplete&&e.onComplete()}}));break;case"iter":h=this,d.fx.sequence({condition:function(){return f.length!=0},step:function(){h.removeEdge(f.shift(),{type:"nothing"}),d.labels.clearLabels()},onComplete:function(){e.onComplete()},duration:Math.ceil(e.duration/f.length)});break;default:this.doError()}},sum:function(b,c){var d=this.viz,e=a.merge(this.options,d.controller,c),f=d.root,g;d.root=c.id||d.root;switch(e.type){case"nothing":g=d.construct(b),g.eachNode(function(a){a.eachAdjacency(function(a){d.graph.addAdjacence(a.nodeFrom,a.nodeTo,a.data)})});break;case"replot":d.refresh(!0),this.sum(b,{type:"nothing"}),d.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,g=d.construct(b);var h=this.preprocessSum(g)?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];d.reposition(),e.type!="fade:con"?d.fx.animate(a.merge(e,{modes:["linear"],onComplete:function(){d.fx.animate(a.merge(e,{modes:h,onComplete:function(){e.onComplete()}}))}})):(d.graph.eachNode(function(a){a.id!=f&&a.pos.isZero()&&(a.pos.set(a.endPos),a.startPos.set(a.endPos))}),d.fx.animate(a.merge(e,{modes:["linear"].concat(h)})));break;default:this.doError()}},morph:function(b,c,d){var d=d||{},e=this.viz,f=a.merge(this.options,e.controller,c),g=e.root,h;e.root=c.id||e.root;switch(f.type){case"nothing":h=e.construct(b),h.eachNode(function(a){var b=e.graph.hasNode(a.id);a.eachAdjacency(function(a){var b=!!e.graph.getAdjacence(a.nodeFrom.id,a.nodeTo.id);e.graph.addAdjacence(a.nodeFrom,a.nodeTo,a.data);if(b){var b=e.graph.getAdjacence(a.nodeFrom.id,a.nodeTo.id),c;for(c in a.data||{})b.data[c]=a.data[c]}});if(b){var b=e.graph.getNode(a.id),c;for(c in a.data||{})b.data[c]=a.data[c]}}),e.graph.eachNode(function(a){a.eachAdjacency(function(a){h.getAdjacence(a.nodeFrom.id,a.nodeTo.id)||e.graph.removeAdjacence(a.nodeFrom.id,a.nodeTo.id)}),h.hasNode(a.id)||e.graph.removeNode(a.id)});break;case"replot":e.labels.clearLabels(!0),this.morph(b,{type:"nothing"}),e.refresh(!0),e.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,h=e.construct(b);var i="node-property"in d&&a.map(a.splat(d["node-property"]),function(a){return"$"+a});e.graph.eachNode(function(b){var c=h.getNode(b.id);if(c){var c=c.data,d;for(d in c)i&&a.indexOf(i,d)>-1?b.endData[d]=c[d]:b.data[d]=c[d]}else b.setData("alpha",1),b.setData("alpha",1,"start"),b.setData("alpha",0,"end"),b.ignore=!0}),e.graph.eachNode(function(a){a.ignore||a.eachAdjacency(function(a){if(!a.nodeFrom.ignore&&!a.nodeTo.ignore){var b=h.getNode(a.nodeFrom.id),a=h.getNode(a.nodeTo.id);b.adjacentTo(a)||(a=e.graph.getAdjacence(b.id,a.id),j=!0,a.setData("alpha",1),a.setData("alpha",1,"start"),a.setData("alpha",0,"end"))}})});var j=this.preprocessSum(h),b=j?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];b[0]+="node-property"in d?":"+a.splat(d["node-property"]).join(":"):"",b[1]=(b[1]||"edge-property:alpha")+("edge-property"in d?":"+a.splat(d["edge-property"]).join(":"):""),"label-property"in d&&b.push("label-property:"+a.splat(d["label-property"]).join(":")),e.reposition?e.reposition():e.compute("end"),e.graph.eachNode(function(a){a.id!=g&&a.pos.getp().equals(k.KER)&&(a.pos.set(a.endPos),a.startPos.set(a.endPos))}),e.fx.animate(a.merge(f,{modes:[d.position||"polar"].concat(b),onComplete:function(){e.graph.eachNode(function(a){a.ignore&&e.graph.removeNode(a.id)}),e.graph.eachNode(function(a){a.eachAdjacency(function(a){a.ignore&&e.graph.removeAdjacence(a.nodeFrom.id,a.nodeTo.id)})}),f.onComplete()}}))}},contract:function(b,c){var d=this.viz;!b.collapsed&&b.anySubnode(a.lambda(!0))&&(c=a.merge(this.options,d.config,c||{},{modes:["node-property:alpha:span","linear"]}),b.collapsed=!0,function e(a){a.eachSubnode(function(a){a.ignore=!0,a.setData("alpha",0,c.type=="animate"?"end":"current"),e(a)})}(b),c.type=="animate"?(d.compute("end"),d.rotated&&d.rotate(d.rotated,"none",{property:"end"}),function f(a){a.eachSubnode(function(a){a.setPos(b.getPos("end"),"end"),f(a)})}(b),d.fx.animate(c)):c.type=="replot"&&d.refresh())},expand:function(b,c){if("collapsed"in b){var d=this.viz,c=a.merge(this.options,d.config,c||{},{modes:["node-property:alpha:span","linear"]});delete b.collapsed,function e(a){a.eachSubnode(function(a){delete a.ignore,a.setData("alpha",1,c.type=="animate"?"end":"current"),e(a)})}(b),c.type=="animate"?(d.compute("end"),d.rotated&&d.rotate(d.rotated,"none",{property:"end"}),d.fx.animate(c)):c.type=="replot"&&d.refresh()}},preprocessSum:function(a){var b=this.viz;a.eachNode(function(a){b.graph.hasNode(a.id)||(b.graph.addNode(a),a=b.graph.getNode(a.id),a.setData("alpha",0),a.setData("alpha",0,"start"),a.setData("alpha",1,"end"))});var c=!1;return a.eachNode(function(a){a.eachAdjacency(function(a){var d=b.graph.getNode(a.nodeFrom.id),e=b.graph.getNode(a.nodeTo.id);d.adjacentTo(e)||(a=b.graph.addAdjacence(d,e,a.data),d.startAlpha==d.endAlpha&&e.startAlpha==e.endAlpha&&(c=!0,a.setData("alpha",0),a.setData("alpha",0,"start"),a.setData("alpha",1,"end")))})}),c}};var o={none:{render:a.empty,contains:a.lambda(!1)},circle:{render:function(a,b,c,d){d=d.getCtx(),d.beginPath(),d.arc(b.x,b.y,c,0,Math.PI*2,!0),d.closePath(),d[a]()},contains:function(a,b,c){var d=a.x-b.x,a=a.y-b.y;return d*d+a*a<=c*c}},ellipse:{render:function(a,b,c,d,e){var e=e.getCtx(),f=1,g=1,h=1,i=1,j=0;c>d?(j=c/2,g=d/c,i=c/d):(j=d/2,f=c/d,h=d/c),e.save(),e.scale(f,g),e.beginPath(),e.arc(b.x*h,b.y*i,j,0,Math.PI*2,!0),e.closePath(),e[a](),e.restore()},contains:function(a,b,c,d){var e=0,f=1,g=1,h=0,i=0,e=0;return c>d?(e=c/2,g=d/c):(e=d/2,f=c/d),h=(a.x-b.x)*(1/f),i=(a.y-b.y)*(1/g),h*h+i*i<=e*e}},square:{render:function(a,b,c,d){d.getCtx()[a+"Rect"](b.x-c,b.y-c,2*c,2*c)},contains:function(a,b,c){return Math.abs(b.x-a.x)<=c&&Math.abs(b.y-a.y)<=c}},rectangle:{render:function(a,b,c,d,e){e.getCtx()[a+"Rect"](b.x-c/2,b.y-d/2,c,d)},contains:function(a,b,c,d){return Math.abs(b.x-a.x)<=c/2&&Math.abs(b.y-a.y)<=d/2}},triangle:{render:function(a,b,c,d){var d=d.getCtx(),e=b.x,f=b.y-c,g=e-c,b=b.y+c,c=e+c;d.beginPath(),d.moveTo(e,f),d.lineTo(g,b),d.lineTo(c,b),d.closePath(),d[a]()},contains:function(a,b,c){return o.circle.contains(a,b,c)}},star:{render:function(a,b,c,d){var d=d.getCtx(),e=Math.PI/5;d.save(),d.translate(b.x,b.y),d.beginPath(),d.moveTo(c,0);for(b=0;b<9;b++)d.rotate(e),b%2==0?d.lineTo(c/.525731*.200811,0):d.lineTo(c,0);d.closePath(),d[a](),d.restore()},contains:function(a,b,c){return o.circle.contains(a,b,c)}}},p={line:{render:function(a,b,c){c=c.getCtx(),c.beginPath(),c.moveTo(a.x,a.y),c.lineTo(b.x,b.y),c.stroke()},contains:function(a,b,c,d){var e=Math.min,f=Math.max,g=e(a.x,b.x),h=f(a.x,b.x),e=e(a.y,b.y),f=f(a.y,b.y);return c.x>=g&&c.x<=h&&c.y>=e&&c.y<=f?Math.abs(b.x-a.x)<=d?!0:Math.abs((b.y-a.y)/(b.x-a.x)*(c.x-a.x)+a.y-c.y)<=d:!1}},arrow:{render:function(a,b,c,d,e){e=e.getCtx(),d&&(d=a,a=b,b=d),d=new l(b.x-a.x,b.y-a.y),d.$scale(c/d.norm());var c=new l(b.x-d.x,b.y-d.y),f=new l(-d.y/2,d.x/2),d=c.add(f),c=c.$add(f.$scale(-1));e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(b.x,b.y),e.stroke(),e.beginPath(),e.moveTo(d.x,d.y),e.lineTo(c.x,c.y),e.lineTo(b.x,b.y),e.closePath(),e.fill()},contains:function(a,b,c,d){return p.line.contains(a,b,c,d)}},hyperline:{render:function(a,b,c,d){function e(a,b){return a<b?a+Math.PI>b?!1:!0:b+Math.PI>a?!0:!1}var d=d.getCtx(),f=function(a,b){var c=a.x*b.y-a.y*b.x,d=a.squaredNorm(),e=b.squaredNorm();if(c==0)return{x:0,y:0,ratio:-1};var f=(a.y*e-b.y*d+a.y-b.y)/c,c=(b.x*d-a.x*e+b.x-a.x)/c,d=(f*f+c*c)/4-1;return d<0?{x:0,y:0,ratio:-1}:(d=Math.sqrt(d),{x:-f/2,y:-c/2,ratio:d>1e3?-1:d,a:f,b:c})}(a,b);f.a>1e3||f.b>1e3||f.ratio<0?(d.beginPath(),d.moveTo(a.x*c,a.y*c),d.lineTo(b.x*c,b.y*c)):(b=Math.atan2(b.y-f.y,b.x-f.x),a=Math.atan2(a.y-f.y,a.x-f.x),e=e(b,a),d.beginPath(),d.arc(f.x*c,f.y*c,f.ratio*c,b,a,e)),d.stroke()},contains:a.lambda(!1)}};m.Plot={initialize:function(a,b){this.viz=a,this.config=a.config,this.node=a.config.Node,this.edge=a.config.Edge,this.animation=new d,this.nodeTypes=new b.Plot.NodeTypes,this.edgeTypes=new b.Plot.EdgeTypes,this.labels=a.labels},nodeHelper:o,edgeHelper:p,Interpolator:{map:{border:"color",color:"color",width:"number",height:"number",dim:"number",alpha:"number",lineWidth:"number",angularWidth:"number",span:"number",valueArray:"array-number",dimArray:"array-number"},canvas:{globalAlpha:"number",fillStyle:"color",strokeStyle:"color",lineWidth:"number",shadowBlur:"number",shadowColor:"color",shadowOffsetX:"number",shadowOffsetY:"number",miterLimit:"number"},label:{size:"number",color:"color"},compute:function(a,b,c){return a+(b-a)*c},moebius:function(a,b,c,d){b=d.scale(-c);if(b.norm()<1){var c=b.x,d=b.y,e=a.startPos.getc().moebiusTransformation(b);a.pos.setc(e.x,e.y),b.x=c,b.y=d}},linear:function(a,b,c){var b=a.startPos.getc(!0),d=a.endPos.getc(!0);a.pos.setc(this.compute(b.x,d.x,c),this.compute(b.y,d.y,c))},polar:function(a,b,c){b=a.startPos.getp(!0),c=a.endPos.getp().interpolate(b,c),a.pos.setp(c.theta,c.rho)},number:function(a,b,c,d,e){var f=a[d](b,"start"),d=a[d](b,"end");a[e](b,this.compute(f,d,c))},color:function(b,c,d,e,f){var g=a.hexToRgb(b[e](c,"start")),e=a.hexToRgb(b[e](c,"end")),h=this.compute,d=a.rgbToHex([parseInt(h(g[0],e[0],d)),parseInt(h(g[1],e[1],d)),parseInt(h(g[2],e[2],d))]);b[f](c,d)},"array-number":function(a,b,c,d,e){for(var f=a[d](b,"start"),d=a[d](b,"end"),g=[],h=0,i=f.length;h<i;h++){var j=f[h],k=d[h];if(j.length){for(var l=0,m=j.length,n=[];l<m;l++)n.push(this.compute(j[l],k[l],c));g.push(n)}else g.push(this.compute(j,k,c))}a[e](b,g)},node:function(a,b,c,d,e,f){d=this[d];if(b)for(var g=b.length,h=0;h<g;h++){var i=b[h];this[d[i]](a,i,c,e,f)}else for(i in d)this[d[i]](a,i,c,e,f)},edge:function(a,b,c,d,e,f){var a=a.adjacencies,g;for(g in a)this.node(a[g],b,c,d,e,f)},"node-property":function(a,b,c){this.node(a,b,c,"map","getData","setData")},"edge-property":function(a,b,c){this.edge(a,b,c,"map","getData","setData")},"label-property":function(a,b,c){this.node(a,b,c,"label","getLabelData","setLabelData")},"node-style":function(a,b,c){this.node(a,b,c,"canvas","getCanvasStyle","setCanvasStyle")},"edge-style":function(a,b,c){this.edge(a,b,c,"canvas","getCanvasStyle","setCanvasStyle")}},sequence:function(b){var c=this,b=a.merge({condition:a.lambda(!1),step:a.empty,onComplete:a.empty,duration:200},b||{}),d=setInterval(function(){b.condition()?b.step():(clearInterval(d),b.onComplete()),c.viz.refresh(!0)},b.duration)},prepare:function(b){var c=this.viz.graph,d={"node-property":{getter:"getData",setter:"setData"},"edge-property":{getter:"getData",setter:"setData"},"node-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"},"edge-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"}},e={};if(a.type(b)=="array")for(var f=0,g=b.length;f<g;f++){var h=b[f].split(":");e[h.shift()]=h}else for(f in b)f=="position"?e[b.position]=[]:e[f]=a.splat(b[f]);return c.eachNode(function(b){b.startPos.set(b.pos),a.each(["node-property","node-style"],function(a){if(a in e)for(var c=e[a],f=0,g=c.length;f<g;f++)b[d[a].setter](c[f],b[d[a].getter](c[f]),"start")}),a.each(["edge-property","edge-style"],function(a){if(a in e){var c=e[a];b.eachAdjacency(function(b){for(var e=0,f=c.length;e<f;e++)b[d[a].setter](c[e],b[d[a].getter](c[e]),"start")})}})}),e},animate:function(b,c){var b=a.merge(this.viz.config,b||{}),d=this,e=this.viz.graph,f=this.Interpolator,g=b.type==="nodefx"?this.nodeFxAnimation:this.animation,h=this.prepare(b.modes);b.hideLabels&&this.labels.hideLabels(!0),g.setOptions(a.extend(b,{$animating:!1,compute:function(a){e.eachNode(function(b){for(var d in h)f[d](b,h[d],a,c)}),d.plot(b,this.$animating,a),this.$animating=!0},complete:function(){b.hideLabels&&d.labels.hideLabels(!1),d.plot(b),b.onComplete()}})).start()},nodeFx:function(b){var c=this.viz,d=c.graph,e=this.nodeFxAnimation,f=a.merge(this.viz.config,{elements:{id:!1,properties:{}},reposition:!1}),b=a.merge(f,b||{},{onBeforeCompute:a.empty,onAfterCompute:a.empty});e.stopTimer();var g=b.elements.properties;b.elements.id?(e=a.splat(b.elements.id),a.each(e,function(a){if(a=d.getNode(a))for(var b in g)a.setData(b,g[b],"end")})):d.eachNode(function(a){for(var b in g)a.setData(b,g[b],"end")});var e=[],h;for(h in g)e.push(h);h=["node-property:"+e.join(":")],b.reposition&&(h.push("linear"),c.compute("end")),this.animate(a.merge(b,{modes:h,type:"nodefx"}))},plot:function(a,b){var c=this.viz,d=c.graph,e=c.canvas,c=c.root,f=this;e.getCtx(),a=a||this.viz.controller,a.clearCanvas&&e.clear();if(c=d.getNode(c)){var g=!!c.visited;d.eachNode(function(c){var d=c.getData("alpha");c.eachAdjacency(function(d){var h=d.nodeTo;!!h.visited===g&&c.drawn&&h.drawn&&(!b&&a.onBeforePlotLine(d),f.plotLine(d,e,b),!b&&a.onAfterPlotLine(d))}),c.drawn&&(!b&&a.onBeforePlotNode(c),f.plotNode(c,e,b),!b&&a.onAfterPlotNode(c)),!f.labelsHidden&&a.withLabels&&(c.drawn&&d>=.95?f.labels.plotLabel(e,c,a):f.labels.hideLabel(c,!1)),c.visited=!g})}},plotTree:function(a,b,c){var d=this,e=this.viz.canvas;e.getCtx();var f=a.getData("alpha");a.eachSubnode(function(f){if(b.plotSubtree(a,f)&&f.exist&&f.drawn){var g=a.getAdjacency(f.id);!c&&b.onBeforePlotLine(g),d.plotLine(g,e,c),!c&&b.onAfterPlotLine(g),d.plotTree(f,b,c)}}),a.drawn?(!c&&b.onBeforePlotNode(a),this.plotNode(a,e,c),!c&&b.onAfterPlotNode(a),!b.hideLabels&&b.withLabels&&f>=.95?this.labels.plotLabel(e,a,b):this.labels.hideLabel(a,!1)):this.labels.hideLabel(a,!0)},plotNode:function(a,b,c){var d=a.getData("type"),e=this.node.CanvasStyles;if(d!="none"){var f=a.getData("lineWidth"),g=a.getData("color"),h=a.getData("alpha"),i=b.getCtx();i.save(),i.lineWidth=f,i.fillStyle=i.strokeStyle=g,i.globalAlpha=h;for(var j in e)i[j]=a.getCanvasStyle(j);this.nodeTypes[d].render.call(this,a,b,c),i.restore()}},plotLine:function(a,b,c){var d=a.getData("type"),e=this.edge.CanvasStyles;if(d!="none"){var f=a.getData("lineWidth"),g=a.getData("color"),h=b.getCtx(),i=a.nodeFrom,j=a.nodeTo;h.save(),h.lineWidth=f,h.fillStyle=h.strokeStyle=g,h.globalAlpha=Math.min(i.getData("alpha"),j.getData("alpha"),a.getData("alpha"));for(var k in e)h[k]=a.getCanvasStyle(k);this.edgeTypes[d].render.call(this,a,b,c),h.restore()}}},m.Plot3D=a.merge(m.Plot,{Interpolator:{linear:function(a,b,c){var b=a.startPos.getc(!0),d=a.endPos.getc(!0);a.pos.setc(this.compute(b.x,d.x,c),this.compute(b.y,d.y,c),this.compute(b.z,d.z,c))}},plotNode:function(a,b){a.getData("type")!="none"&&this.plotElement(a,b,{getAlpha:function(){return a.getData("alpha")}})},plotLine:function(a,b){a.getData("type")!="none"&&this.plotElement(a,b,{getAlpha:function(){return Math.min(a.nodeFrom.getData("alpha"),a.nodeTo.getData("alpha"),a.getData("alpha"))}})},plotElement:function(b,c,d){var e=c.getCtx(),f=new Matrix4,g=c.config.Scene.Lighting,h=c.canvases[0],c=h.program,h=h.camera;b.geometry||(b.geometry=new(O3D[b.getData("type")])),b.geometry.update(b);if(!b.webGLVertexBuffer){for(var i=[],j=[],k=[],l=0,m=b.geometry,n=0,o=m.vertices,m=m.faces,p=m.length;n<p;n++){var q=m[n],r=o[q.a],s=o[q.b],t=o[q.c],u=q.d?o[q.d]:!1,q=q.normal;i.push(r.x,r.y,r.z),i.push(s.x,s.y,s.z),i.push(t.x,t.y,t.z),u&&i.push(u.x,u.y,u.z),k.push(q.x,q.y,q.z),k.push(q.x,q.y,q.z),k.push(q.x,q.y,q.z),u&&k.push(q.x,q.y,q.z),j.push(l,l+1,l+2),u?(j.push(l,l+2,l+3),l+=4):l+=3}b.webGLVertexBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,b.webGLVertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW),b.webGLFaceBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,b.webGLFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(j),e.STATIC_DRAW),b.webGLFaceCount=j.length,b.webGLNormalBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,b.webGLNormalBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(k),e.STATIC_DRAW)}f.multiply(h.matrix,b.geometry.matrix),e.uniformMatrix4fv(c.viewMatrix,!1,f.flatten()),e.uniformMatrix4fv(c.projectionMatrix,!1,h.projectionMatrix.flatten()),f=Matrix4.makeInvert(f),f.$transpose(),e.uniformMatrix4fv(c.normalMatrix,!1,f.flatten()),f=a.hexToRgb(b.getData("color")),f.push(d.getAlpha()),e.uniform4f(c.color,f[0]/255,f[1]/255,f[2]/255,f[3]),e.uniform1i(c.enableLighting,g.enable),g.enable&&(g.ambient&&(d=g.ambient,e.uniform3f(c.ambientColor,d[0],d[1],d[2])),g.directional&&(g=g.directional,f=g.color,g=g.direction,g=(new Vector3(g.x,g.y,g.z)).normalize().$scale(-1),e.uniform3f(c.lightingDirection,g.x,g.y,g.z),e.uniform3f(c.directionalColor,f[0],f[1],f[2]))),e.bindBuffer(e.ARRAY_BUFFER,b.webGLVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,b.webGLNormalBuffer),e.vertexAttribPointer(c.normal,3,e.FLOAT,!1,0,0),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,b.webGLFaceBuffer),e.drawElements(e.TRIANGLES,b.webGLFaceCount,e.UNSIGNED_SHORT,0)}}),m.Label={},m.Label.Native=new b({initialize:function(a){this.viz=a},plotLabel:function(a,b,c){var d=a.getCtx();b.pos.getc(!0),d.font=b.getLabelData("style")+" "+b.getLabelData("size")+"px "+b.getLabelData("family"),d.textAlign=b.getLabelData("textAlign"),d.fillStyle=d.strokeStyle=b.getLabelData("color"),d.textBaseline=b.getLabelData("textBaseline"),this.renderLabel(a,b,c)},renderLabel:function(a,b){var c=a.getCtx(),d=b.pos.getc(!0);c.fillText(b.name,d.x,d.y+b.getData("height")/2)},hideLabel:a.empty,hideLabels:a.empty}),m.Label.DOM=new b({labelsHidden:!1,labelContainer:!1,labels:{},getLabelContainer:function(){return this.labelContainer?this.labelContainer:this.labelContainer=document.getElementById(this.viz.config.labelContainer)},getLabel:function(a){return a in this.labels&&this.labels[a]!=null?this.labels[a]:this.labels[a]=document.getElementById(a)},hideLabels:function(a){this.getLabelContainer().style.display=a?"none":"",this.labelsHidden=a},clearLabels:function(a){for(var b in this.labels)if(a||!this.viz.graph.hasNode(b))this.disposeLabel(b),delete this.labels[b]},disposeLabel:function(a){(a=this.getLabel(a))&&a.parentNode&&a.parentNode.removeChild(a)},hideLabel:function(b,c){var b=a.splat(b),d=c?"":"none",e=this;a.each(b,function(a){if(a=e.getLabel(a.id))a.style.display=d})},fitsInCanvas:function(a,b){var c=b.getSize();return a.x>=c.width||a.x<0||a.y>=c.height||a.y<0?!1:!0}}),m.Label.HTML=new b({Implements:m.Label.DOM,plotLabel:function(a,b,c){var a=b.id,d=this.getLabel(a);if(!d&&!(d=document.getElementById(a))){var d=document.createElement("div"),e=this.getLabelContainer();d.id=a,d.className="node",d.style.position="absolute",c.onCreateLabel(d,b),e.appendChild(d),this.labels[b.id]=d}this.placeLabel(d,b,c)}}),m.Label.SVG=new b({Implements:m.Label.DOM,plotLabel:function(a,b,c){var a=b.id,d=this.getLabel(a);if(!d&&!(d=document.getElementById(a))){var d=document.createElementNS("http://www.w3.org/2000/svg","svg:text"),e=document.createElementNS("http://www.w3.org/2000/svg","svg:tspan");d.appendChild(e),e=this.getLabelContainer(),d.setAttribute("id",a),d.setAttribute("class","node"),e.appendChild(d),c.onCreateLabel(d,b),this.labels[b.id]=d}this.placeLabel(d,b,c)}});var f=$jit.Layouts={},q={label:null,compute:function(b,c,d){this.initializeLabel(d);var e=this.label,f=e.style;b.eachNode(function(b){var c=b.getData("autoWidth"),d=b.getData("autoHeight");if(c||d){delete b.data.$width,delete b.data.$height,delete b.data.$dim;var g=b.getData("width"),h=b.getData("height");f.width=c?"auto":g+"px",f.height=d?"auto":h+"px",e.innerHTML=b.name,c=e.offsetWidth,d=e.offsetHeight,g=b.getData("type"),a.indexOf(["circle","square","triangle","star"],g)===-1?(b.setData("width",c),b.setData("height",d)):(c=c>d?c:d,b.setData("width",c),b.setData("height",c),b.setData("dim",c))}})},initializeLabel:function(a){this.label||(this.label=document.createElement("div"),document.body.appendChild(this.label)),this.setLabelStyles(a)},setLabelStyles:function(){a.extend(this.label.style,{visibility:"hidden",position:"absolute",width:"auto",height:"auto"}),this.label.className="jit-autoadjust-label"}};f.Radial=new b({compute:function(b){b=a.splat(b||["current","start","end"]),q.compute(this.graph,b,this.config),this.graph.computeLevels(this.root,0,"ignore");var c=this.createLevelDistanceFunc();this.computeAngularWidths(b),this.computePositions(b,c)},computePositions:function(a,b){for(var c=this.graph,d=c.getNode(this.root),e=this.parent,f=0,g=a.length;f<g;f++){var h=a[f];d.setPos(new k(0,0),h),d.setData("span",Math.PI*2,h)}d.angleSpan={begin:0,end:2*Math.PI},c.eachBFS(this.root,function(c){var d=c.angleSpan.end-c.angleSpan.begin,f=c.angleSpan.begin,g=b(c),h=0,i=[],j={};c.eachSubnode(function(b){h+=b._treeAngularWidth;for(var c=0,d=a.length;c<d;c++){var e=a[c],f=b.getData("dim",e);j[e]=e in j?f>j[e]?f:j[e]:f}i.push(b)},"ignore"),e&&e.id==c.id&&i.length>0&&i[0].dist&&i.sort(function(a,b){return(a.dist>=b.dist)-(a.dist<=b.dist)});for(var c=0,l=i.length;c<l;c++){var m=i[c];if(!m._flag){for(var n=m._treeAngularWidth/h*d,o=f+n/2,p=0,q=a.length;p<q;p++){var r=a[p];m.setPos(new k(o,g),r),m.setData("span",n,r),m.setData("dim-quotient",m.getData("dim",r)/j[r],r)}m.angleSpan={begin:f,end:f+n},f+=n}}},"ignore")},setAngularWidthForNodes:function(a){this.graph.eachBFS(this.root,function(b,c){var d=b.getData("angularWidth",a[0])||5;b._angularWidth=d/c},"ignore")},setSubtreesAngularWidth:function(){var a=this;this.graph.eachNode(function(b){a.setSubtreeAngularWidth(b)},"ignore")},setSubtreeAngularWidth:function(a){var b=this,c=a._angularWidth,d=0;a.eachSubnode(function(a){b.setSubtreeAngularWidth(a),d+=a._treeAngularWidth},"ignore"),a._treeAngularWidth=Math.max(c,d)},computeAngularWidths:function(a){this.setAngularWidthForNodes(a),this.setSubtreesAngularWidth()}}),$jit.RGraph=new b({Implements:[{construct:function(b){var c=a.type(b)=="array",d=new m(this.graphOptions,this.config.Node,this.config.Edge,this.config.Label);return c?function(b,c){for(var d=function(a){for(var d=0,e=c.length;d<e;d++)if(c[d].id==a)return c[d];return b.addNode({id:a,name:a})},e=0,f=c.length;e<f;e++){b.addNode(c[e]);var g=c[e].adjacencies;if(g)for(var h=0,i=g.length;h<i;h++){var j=g[h],k={};typeof g[h]!="string"&&(k=a.merge(j.data,{}),j=j.nodeTo),b.addAdjacence(c[e],d(j),k)}}}(d,b):function(a,b){a.addNode(b);if(b.children)for(var c=0,d=b.children;c<d.length;c++)a.addAdjacence(b,d[c]),arguments.callee(a,d[c])}(d,b),d},loadJSON:function(b,c){this.json=b,this.labels&&this.labels.clearLabels&&this.labels.clearLabels(!0),this.graph=this.construct(b),this.root=a.type(b)!="array"?b.id:b[c?c:0].id},toJSON:function(a){if((a||"tree")=="tree")var b={},b=function d(a){var b={};b.id=a.id,b.name=a.name,b.data=a.data;var c=[];return a.eachSubnode(function(a){c.push(d(a))}),b.children=c,b}(this.graph.getNode(this.root));else{var b=[],c=!!this.graph.getNode(this.root).visited;this.graph.eachNode(function(a){var d={};d.id=a.id,d.name=a.name,d.data=a.data;var e=[];a.eachAdjacency(function(a){var b=a.nodeTo;if(!!b.visited===c){var d={};d.nodeTo=b.id,d.data=a.data,e.push(d)}}),d.adjacencies=e,b.push(d),a.visited=!c})}return b}},i,f.Radial],initialize:function(b){var c=$jit.RGraph,b=this.controller=this.config=a.merge(e("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),{interpolation:"linear",levelDistance:100},b);b.useCanvas?(this.canvas=b.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(b.background&&(b.background=a.merge({type:"Circles"},b.background)),this.canvas=new j(this,b),this.config.labelContainer=(typeof b.injectInto=="string"?b.injectInto:b.injectInto.id)+"-label"),this.graphOptions={klass:k,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new m(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new c.Label[b.Label.type](this),this.fx=new c.Plot(this,c),this.op=new c.Op(this),this.root=this.json=null,this.parent=this.busy=!1,this.initializeExtras()},createLevelDistanceFunc:function(){var a=this.config.levelDistance;return function(b){return(b._depth+1)*a}},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},plot:function(){this.fx.plot()},getNodeAndParentAngle:function(a){var b=!1,c=this.graph.getNode(a),a=c.getParents();if(a=a.length>0?a[0]:!1)b=a.pos.getc(),c=c.pos.getc(),b=b.add(c.scale(-1)),b=Math.atan2(b.y,b.x),b<0&&(b+=2*Math.PI);return{parent:a,theta:b}},tagChildren:function(a,b){if(a.angleSpan){var c=[];a.eachAdjacency(function(a){c.push(a.nodeTo)},"ignore");for(var d=c.length,e=0;e<d&&b!=c[e].id;e++);for(var e=(e+1)%d,f=0;b!=c[e].id;e=(e+1)%d)c[e].dist=f++}},onClick:function(b,c){if(this.root!=b&&!this.busy){this.busy=!0,this.root=b;var d=this;this.controller.onBeforeCompute(this.graph.getNode(b));var e=this.getNodeAndParentAngle(b);this.tagChildren(e.parent,b),this.parent=e.parent,this.compute("end");var f=e.theta-e.parent.endPos.theta;this.graph.eachNode(function(a){a.endPos.set(a.endPos.getp().add(new k(f,0)))}),e=this.config.interpolation,c=a.merge({onComplete:a.empty},c||{}),this.fx.animate(a.merge({hideLabels:!0,modes:[e]},c,{onComplete:function(){d.busy=!1,c.onComplete()}}))}}}),$jit.RGraph.$extend=!0,function(c){c.Op=new b({Implements:m.Op}),c.Plot=new b({Implements:m.Plot}),c.Label={},c.Label.Native=new b({Implements:m.Label.Native}),c.Label.SVG=new b({Implements:m.Label.SVG,initialize:function(a){this.viz=a},placeLabel:function(a,b,c){var d=b.pos.getc(!0),e=this.viz.canvas,f=e.translateOffsetX,g=e.translateOffsetY,h=e.scaleOffsetX,i=e.scaleOffsetY,e=e.getSize(),d={x:Math.round(d.x*h+f+e.width/2),y:Math.round(d.y*i+g+e.height/2)};a.setAttribute("x",d.x),a.setAttribute("y",d.y),c.onPlaceLabel(a,b)}}),c.Label.HTML=new b({Implements:m.Label.HTML,initialize:function(a){this.viz=a},placeLabel:function(a,b,c){var d=b.pos.getc(!0),e=this.viz.canvas,f=e.translateOffsetX,g=e.translateOffsetY,h=e.scaleOffsetX,i=e.scaleOffsetY,j=e.getSize(),d={x:Math.round(d.x*h+f+j.width/2),y:Math.round(d.y*i+g+j.height/2)},f=a.style;f.left=d.x+"px",f.top=d.y+"px",f.display=this.fitsInCanvas(d,e)?"":"none",c.onPlaceLabel(a,b)}}),c.Plot.NodeTypes=new b({none:{render:a.empty,contains:a.lambda(!1)},circle:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.circle.render("fill",c,d,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");return this.nodeHelper.circle.contains(c,b,d)}},ellipse:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");this.nodeHelper.ellipse.render("fill",c,d,e,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");return this.nodeHelper.ellipse.contains(c,b,d,e)}},square:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.square.render("fill",c,d,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");return this.nodeHelper.square.contains(c,b,d)}},rectangle:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");this.nodeHelper.rectangle.render("fill",c,d,e,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");return this.nodeHelper.rectangle.contains(c,b,d,e)}},triangle:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.triangle.render("fill",c,d,b)},contains:function(a,b){var c=a.pos
|
25
|
-
.getc(!0),d=a.getData("dim");return this.nodeHelper.triangle.contains(c,b,d)}},star:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.star.render("fill",c,d,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");return this.nodeHelper.star.contains(c,b,d)}}}),c.Plot.EdgeTypes=new b({none:a.empty,line:{render:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0);this.edgeHelper.line.render(c,d,b)},contains:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(c,d,b,this.edge.epsilon)}},arrow:{render:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0),e=a.getData("dim"),f=a.data.$direction;this.edgeHelper.arrow.render(c,d,e,f&&f.length>1&&f[0]!=a.nodeFrom.id,b)},contains:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(c,d,b,this.edge.epsilon)}}})}($jit.RGraph)})();
|
Binary file
|
data/public/assets/jit_rgraph.js
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Copyright (c) 2011 Sencha Inc. - Author: Nicolas Garcia Belmonte (http://philogb.github.com/)
|
3
|
-
|
4
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
-
of this software and associated documentation files (the "Software"), to deal
|
6
|
-
in the Software without restriction, including without limitation the rights
|
7
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the Software is
|
9
|
-
furnished to do so, subject to the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be included in
|
12
|
-
all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
-
THE SOFTWARE.
|
21
|
-
|
22
|
-
*/
|
23
|
-
(function(){window.$jit=function(a){var a=a||window,b;for(b in $jit)$jit[b].$extend&&(a[b]=$jit[b])},$jit.version="2.0.1";var a=function(a){return document.getElementById(a)};a.empty=function(){},a.extend=function(a,b){for(var c in b||{})a[c]=b[c];return a},a.lambda=function(a){return typeof a=="function"?a:function(){return a}},a.time=Date.now||function(){return+(new Date)},a.splat=function(b){var c=a.type(b);return c?c!="array"?[b]:b:[]},a.type=function(b){var c=a.type.s.call(b).match(/^\[object\s(.*)\]$/)[1].toLowerCase();return c!="object"?c:b&&b.$$family?b.$$family:b&&b.nodeName&&b.nodeType==1?"element":c},a.type.s=Object.prototype.toString,a.each=function(b,c){if(a.type(b)=="object")for(var d in b)c(b[d],d);else{d=0;for(var e=b.length;d<e;d++)c(b[d],d)}},a.indexOf=function(a,b){if(Array.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},a.map=function(b,c){var d=[];return a.each(b,function(a,b){d.push(c(a,b))}),d},a.reduce=function(a,b,c){var d=a.length;if(d==0)return c;for(var e=arguments.length==3?c:a[--d];d--;)e=b(e,a[d]);return e},a.merge=function(){for(var b={},c=0,d=arguments.length;c<d;c++){var e=arguments[c];if(a.type(e)=="object")for(var f in e){var g=e[f],h=b[f];b[f]=h&&a.type(g)=="object"&&a.type(h)=="object"?a.merge(h,g):a.unlink(g)}}return b},a.unlink=function(b){var c;switch(a.type(b)){case"object":c={};for(var d in b)c[d]=a.unlink(b[d]);break;case"array":c=[],d=0;for(var e=b.length;d<e;d++)c[d]=a.unlink(b[d]);break;default:return b}return c},a.zip=function(){if(arguments.length===0)return[];for(var a=0,b=[],c=arguments.length,d=arguments[0].length;a<d;a++){for(var e=0,f=[];e<c;e++)f.push(arguments[e][a]);b.push(f)}return b},a.rgbToHex=function(a,b){if(a.length<3)return null;if(a.length==4&&a[3]==0&&!b)return"transparent";for(var c=[],d=0;d<3;d++){var e=(a[d]-0).toString(16);c.push(e.length==1?"0"+e:e)}return b?c:"#"+c.join("")},a.hexToRgb=function(a){if(a.length!=7){a=a.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/),a.shift();if(a.length!=3)return null;for(var b=[],c=0;c<3;c++){var d=a[c];d.length==1&&(d+=d),b.push(parseInt(d,16))}return b}return a=parseInt(a.slice(1),16),[a>>16,a>>8&255,a&255]},a.destroy=function(b){a.clean(b),b.parentNode&&b.parentNode.removeChild(b),b.clearAttributes&&b.clearAttributes()},a.clean=function(b){for(var b=b.childNodes,c=0,d=b.length;c<d;c++)a.destroy(b[c])},a.addEvent=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)},a.addEvents=function(b,c){for(var d in c)a.addEvent(b,d,c[d])},a.hasClass=function(a,b){return(" "+a.className+" ").indexOf(" "+b+" ")>-1},a.addClass=function(b,c){a.hasClass(b,c)||(b.className=b.className+" "+c)},a.removeClass=function(a,b){a.className=a.className.replace(RegExp("(^|\\s)"+b+"(?:\\s|$)"),"$1")},a.getPos=function(a){var b=function(a){for(var b={x:0,y:0};a&&!/^(?:body|html)$/i.test(a.tagName);)b.x+=a.offsetLeft,b.y+=a.offsetTop,a=a.offsetParent;return b}(a),a=function(a){for(var b={x:0,y:0};a&&!/^(?:body|html)$/i.test(a.tagName);)b.x+=a.scrollLeft,b.y+=a.scrollTop,a=a.parentNode;return b}(a);return{x:b.x-a.x,y:b.y-a.y}},a.event={get:function(a,b){return a||(b||window).event},getWheel:function(a){return a.wheelDelta?a.wheelDelta/120:-(a.detail||0)/3},isRightClick:function(a){return a.which==3||a.button==2},getPos:function(a,b){var b=b||window,a=a||b.event,c=b.document,c=c.documentElement||c.body;return a.touches&&a.touches.length&&(a=a.touches[0]),{x:a.pageX||a.clientX+c.scrollLeft,y:a.pageY||a.clientY+c.scrollTop}},stop:function(a){a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,a.preventDefault?a.preventDefault():a.returnValue=!1}},$jit.util=$jit.id=a;var b=function(c){var c=c||{},d=function(){for(var c in this)typeof this[c]!="function"&&(this[c]=a.unlink(this[c]));return this.constructor=d,b.prototyping?this:(c=this.initialize?this.initialize.apply(this,arguments):this,this.$$family="class",c)},e;for(e in b.Mutators)c[e]&&(c=b.Mutators[e](c,c[e]),delete c[e]);return a.extend(d,this),d.constructor=b,d.prototype=c,d};b.Mutators={Implements:function(c,d){return a.each(a.splat(d),function(a){b.prototyping=a;var a=typeof a=="function"?new a:a,d;for(d in a)d in c||(c[d]=a[d]);delete b.prototyping}),c}},a.extend(b,{inherit:function(c,d){for(var e in d){var f=d[e],g=c[e],h=a.type(f);g&&h=="function"?f!=g&&b.override(c,e,f):c[e]=h=="object"?a.merge(g,f):f}return c},override:function(a,c,d){var e=b.prototyping;e&&a[c]!=e[c]&&(e=null),a[c]=function(){var b=this.parent;this.parent=e?e[c]:a[c];var f=d.apply(this,arguments);return this.parent=b,f}}}),b.prototype.implement=function(){var c=this.prototype;return a.each(Array.prototype.slice.call(arguments||[]),function(a){b.inherit(c,a)}),this},$jit.Class=b,$jit.json={prune:function(a,b){this.each(a,function(a,c){c==b&&a.children&&(delete a.children,a.children=[])})},getParent:function(a,b){if(a.id==b)return!1;var c=a.children;if(c&&c.length>0)for(var d=0;d<c.length;d++){if(c[d].id==b)return a;var e=this.getParent(c[d],b);if(e)return e}return!1},getSubtree:function(a,b){if(a.id==b)return a;for(var c=0,d=a.children;d&&c<d.length;c++){var e=this.getSubtree(d[c],b);if(e!=null)return e}return null},eachLevel:function(a,b,c,d){if(b<=c&&(d(a,b),a.children))for(var e=0,a=a.children;e<a.length;e++)this.eachLevel(a[e],b+1,c,d)},each:function(a,b){this.eachLevel(a,0,Number.MAX_VALUE,b)}},$jit.Trans={$extend:!0,linear:function(a){return a}};var c=$jit.Trans;(function(){var b=function(b,c){return c=a.splat(c),a.extend(b,{easeIn:function(a){return b(a,c)},easeOut:function(a){return 1-b(1-a,c)},easeInOut:function(a){return a<=.5?b(2*a,c)/2:(2-b(2*(1-a),c))/2}})};a.each({Pow:function(a,b){return Math.pow(a,b[0]||6)},Expo:function(a){return Math.pow(2,8*(a-1))},Circ:function(a){return 1-Math.sin(Math.acos(a))},Sine:function(a){return 1-Math.sin((1-a)*Math.PI/2)},Back:function(a,b){return b=b[0]||1.618,Math.pow(a,2)*((b+1)*a-b)},Bounce:function(a){for(var b,c=0,d=1;;c+=d,d/=2)if(a>=(7-4*c)/11){b=d*d-Math.pow((11-6*c-11*a)/4,2);break}return b},Elastic:function(a,b){return Math.pow(2,10*--a)*Math.cos(20*a*Math.PI*(b[0]||1)/3)}},function(a,d){c[d]=b(a)}),a.each(["Quad","Cubic","Quart","Quint"],function(a,d){c[a]=b(function(a){return Math.pow(a,[d+2])})})})();var d=new b({initialize:function(a){this.setOptions(a)},setOptions:function(b){return this.opt=a.merge({duration:2500,fps:40,transition:c.Quart.easeInOut,compute:a.empty,complete:a.empty,link:"ignore"},b||{}),this},step:function(){var b=a.time(),c=this.opt;b<this.time+c.duration?(b=c.transition((b-this.time)/c.duration),c.compute(b)):(this.timer=clearInterval(this.timer),c.compute(1),c.complete())},start:function(){return this.check()?(this.time=0,this.startTimer(),this):this},startTimer:function(){var b=this,c=this.opt.fps;return this.timer?!1:(this.time=a.time()-this.time,this.timer=setInterval(function(){b.step()},Math.round(1e3/c)),!0)},pause:function(){return this.stopTimer(),this},resume:function(){return this.startTimer(),this},stopTimer:function(){return this.timer?(this.time=a.time()-this.time,this.timer=clearInterval(this.timer),!0):!1},check:function(){return this.timer?this.opt.link=="cancel"?(this.stopTimer(),!0):!1:!0}}),e=function(){for(var b=arguments,c=0,d=b.length,f={};c<d;c++){var g=e[b[c]];g.$extend?a.extend(f,g):f[b[c]]=g}return f};e.Canvas={$extend:!0,injectInto:"id",type:"2D",width:!1,height:!1,useCanvas:!1,withLabels:!0,background:!1,Scene:{Lighting:{enable:!1,ambient:[1,1,1],directional:{direction:{x:-100,y:-100,z:-100},color:[.5,.3,.1]}}}},e.Node={$extend:!1,overridable:!1,type:"circle",color:"#ccb",alpha:1,dim:3,height:20,width:90,autoHeight:!1,autoWidth:!1,lineWidth:1,transform:!0,align:"center",angularWidth:1,span:1,CanvasStyles:{}},e.Edge={$extend:!1,overridable:!1,type:"line",color:"#ccb",lineWidth:1,dim:15,alpha:1,epsilon:7,CanvasStyles:{}},e.Fx={$extend:!0,fps:40,duration:2500,transition:$jit.Trans.Quart.easeInOut,clearCanvas:!0},e.Label={$extend:!1,overridable:!1,type:"HTML",style:" ",size:10,family:"sans-serif",textAlign:"center",textBaseline:"alphabetic",color:"#fff"},e.Tips={$extend:!1,enable:!1,type:"auto",offsetX:20,offsetY:20,force:!1,onShow:a.empty,onHide:a.empty},e.NodeStyles={$extend:!1,enable:!1,type:"auto",stylesHover:!1,stylesClick:!1},e.Events={$extend:!1,enable:!1,enableForEdges:!1,type:"auto",onClick:a.empty,onRightClick:a.empty,onMouseMove:a.empty,onMouseEnter:a.empty,onMouseLeave:a.empty,onDragStart:a.empty,onDragMove:a.empty,onDragCancel:a.empty,onDragEnd:a.empty,onTouchStart:a.empty,onTouchMove:a.empty,onTouchEnd:a.empty,onMouseWheel:a.empty},e.Navigation={$extend:!1,enable:!1,type:"auto",panning:!1,zooming:!1},e.Controller={$extend:!0,onBeforeCompute:a.empty,onAfterCompute:a.empty,onCreateLabel:a.empty,onPlaceLabel:a.empty,onComplete:a.empty,onBeforePlotLine:a.empty,onAfterPlotLine:a.empty,onBeforePlotNode:a.empty,onAfterPlotNode:a.empty,request:!1};var f={initialize:function(a,b){this.viz=b,this.canvas=b.canvas,this.config=b.config[a],this.nodeTypes=b.fx.nodeTypes;var c=this.config.type;this.labelContainer=(this.dom=c=="auto"?b.config.Label.type!="Native":c!="Native")&&b.labels.getLabelContainer(),this.isEnabled()&&this.initializePost()},initializePost:a.empty,setAsProperty:a.lambda(!1),isEnabled:function(){return this.config.enable},isLabel:function(b,c,d){var b=a.event.get(b,c),c=this.labelContainer,e=b.target||b.srcElement,b=b.relatedTarget;return d?b&&b==this.viz.canvas.getCtx().canvas&&!!e&&this.isDescendantOf(e,c):this.isDescendantOf(e,c)},isDescendantOf:function(a,b){for(;a&&a.parentNode;){if(a.parentNode==b)return a;a=a.parentNode}return!1}},g={onMouseUp:a.empty,onMouseDown:a.empty,onMouseMove:a.empty,onMouseOver:a.empty,onMouseOut:a.empty,onMouseWheel:a.empty,onTouchStart:a.empty,onTouchMove:a.empty,onTouchEnd:a.empty,onTouchCancel:a.empty},h=new b({initialize:function(a){this.viz=a,this.canvas=a.canvas,this.edge=this.node=!1,this.registeredObjects=[],this.attachEvents()},attachEvents:function(){var b=this.canvas.getElement(),c=this;b.oncontextmenu=a.lambda(!1),a.addEvents(b,{mouseup:function(b,d){var e=a.event.get(b,d);c.handleEvent("MouseUp",b,d,c.makeEventObject(b,d),a.event.isRightClick(e))},mousedown:function(b,d){var e=a.event.get(b,d);c.handleEvent("MouseDown",b,d,c.makeEventObject(b,d),a.event.isRightClick(e))},mousemove:function(a,b){c.handleEvent("MouseMove",a,b,c.makeEventObject(a,b))},mouseover:function(a,b){c.handleEvent("MouseOver",a,b,c.makeEventObject(a,b))},mouseout:function(a,b){c.handleEvent("MouseOut",a,b,c.makeEventObject(a,b))},touchstart:function(a,b){c.handleEvent("TouchStart",a,b,c.makeEventObject(a,b))},touchmove:function(a,b){c.handleEvent("TouchMove",a,b,c.makeEventObject(a,b))},touchend:function(a,b){c.handleEvent("TouchEnd",a,b,c.makeEventObject(a,b))}});var d=function(b,d){var e=a.event.get(b,d),e=a.event.getWheel(e);c.handleEvent("MouseWheel",b,d,e)};!document.getBoxObjectFor&&window.mozInnerScreenX==null?a.addEvent(b,"mousewheel",d):b.addEventListener("DOMMouseScroll",d,!1)},register:function(a){this.registeredObjects.push(a)},handleEvent:function(){for(var a=Array.prototype.slice.call(arguments),b=a.shift(),c=0,d=this.registeredObjects,e=d.length;c<e;c++)d[c]["on"+b].apply(d[c],a)},makeEventObject:function(b,c){var d=this,e=this.viz.graph,f=this.viz.fx,g=f.nodeTypes,h=f.edgeTypes;return{pos:!1,node:!1,edge:!1,contains:!1,getNodeCalled:!1,getEdgeCalled:!1,getPos:function(){var e=d.viz.canvas,f=e.getSize(),g=e.getPos(),h=e.translateOffsetX,i=e.translateOffsetY,j=e.scaleOffsetX,e=e.scaleOffsetY,k=a.event.getPos(b,c);return this.pos={x:(k.x-g.x-f.width/2-h)*1/j,y:(k.y-g.y-f.height/2-i)*1/e}},getNode:function(){if(this.getNodeCalled)return this.node;this.getNodeCalled=!0;for(var a in e.nodes){var b=e.nodes[a],c=b&&g[b.getData("type")];if(c=c&&c.contains&&c.contains.call(f,b,this.getPos()))return this.contains=c,d.node=this.node=b}return d.node=this.node=!1},getEdge:function(){if(this.getEdgeCalled)return this.edge;this.getEdgeCalled=!0;var a={},b;for(b in e.edges){var c=e.edges[b];a[b]=!0;for(var g in c)if(!(g in a)){var i=c[g],j=i&&h[i.getData("type")];if(j=j&&j.contains&&j.contains.call(f,i,this.getPos()))return this.contains=j,d.edge=this.edge=i}}return d.edge=this.edge=!1},getContains:function(){return this.getNodeCalled?this.contains:(this.getNode(),this.contains)}}}}),i={initializeExtras:function(){var b=new h(this),c=this;a.each(["NodeStyles","Tips","Navigation","Events"],function(a){var d=new i.Classes[a](a,c);d.isEnabled()&&b.register(d),d.setAsProperty()&&(c[a.toLowerCase()]=d)})},Classes:{}};i.Classes.Events=new b({Implements:[f,g],initializePost:function(){this.fx=this.viz.fx,this.ntypes=this.viz.fx.nodeTypes,this.etypes=this.viz.fx.edgeTypes,this.moved=this.touchMoved=this.touched=this.pressed=this.hovered=!1},setAsProperty:a.lambda(!0),onMouseUp:function(b,c,d,e){b=a.event.get(b,c),this.moved||(e?this.config.onRightClick(this.hovered,d,b):this.config.onClick(this.pressed,d,b)),this.pressed&&(this.moved?this.config.onDragEnd(this.pressed,d,b):this.config.onDragCancel(this.pressed,d,b),this.pressed=this.moved=!1)},onMouseOut:function(b,c,d){var e=a.event.get(b,c),f;if(this.dom&&(f=this.isLabel(b,c,!0)))this.config.onMouseLeave(this.viz.graph.getNode(f.id),d,e),this.hovered=!1;else{b=e.relatedTarget;for(c=this.canvas.getElement();b&&b.parentNode;){if(c==b.parentNode)return;b=b.parentNode}this.hovered&&(this.config.onMouseLeave(this.hovered,d,e),this.hovered=!1)}},onMouseOver:function(b,c,d){var e=a.event.get(b,c),f;this.dom&&(f=this.isLabel(b,c,!0))&&(this.hovered=this.viz.graph.getNode(f.id),this.config.onMouseEnter(this.hovered,d,e))},onMouseMove:function(b,c,d){b=a.event.get(b,c);if(this.pressed)this.moved=!0,this.config.onDragMove(this.pressed,d,b);else if(this.dom)this.config.onMouseMove(this.hovered,d,b);else{if(this.hovered){var c=this.hovered,e=c.nodeFrom?this.etypes[c.getData("type")]:this.ntypes[c.getData("type")];if(e&&e.contains&&e.contains.call(this.fx,c,d.getPos())){this.config.onMouseMove(c,d,b);return}this.config.onMouseLeave(c,d,b),this.hovered=!1}(this.hovered=d.getNode()||this.config.enableForEdges&&d.getEdge())?this.config.onMouseEnter(this.hovered,d,b):this.config.onMouseMove(!1,d,b)}},onMouseWheel:function(b,c,d){this.config.onMouseWheel(d,a.event.get(b,c))},onMouseDown:function(b,c,d){var e=a.event.get(b,c);if(this.dom){if(b=this.isLabel(b,c))this.pressed=this.viz.graph.getNode(b.id)}else this.pressed=d.getNode()||this.config.enableForEdges&&d.getEdge();this.pressed&&this.config.onDragStart(this.pressed,d,e)},onTouchStart:function(b,c,d){var e=a.event.get(b,c),f;(this.touched=this.dom&&(f=this.isLabel(b,c))?this.viz.graph.getNode(f.id):d.getNode()||this.config.enableForEdges&&d.getEdge())&&this.config.onTouchStart(this.touched,d,e)},onTouchMove:function(b,c,d){b=a.event.get(b,c),this.touched&&(this.touchMoved=!0,this.config.onTouchMove(this.touched,d,b))},onTouchEnd:function(b,c,d){b=a.event.get(b,c),this.touched&&(this.touchMoved?this.config.onTouchEnd(this.touched,d,b):this.config.onTouchCancel(this.touched,d,b),this.touched=this.touchMoved=!1)}}),i.Classes.Tips=new b({Implements:[f,g],initializePost:function(){if(document.body){var b=a("_tooltip")||document.createElement("div");b.id="_tooltip",b.className="tip",a.extend(b.style,{position:"absolute",display:"none",zIndex:13e3}),document.body.appendChild(b),this.tip=b,this.node=!1}},setAsProperty:a.lambda(!0),onMouseOut:function(b,c){a.event.get(b,c);if(this.dom&&this.isLabel(b,c,!0))this.hide(!0);else{for(var d=b.relatedTarget,e=this.canvas.getElement();d&&d.parentNode;){if(e==d.parentNode)return;d=d.parentNode}this.hide(!1)}},onMouseOver:function(a,b){var c;this.dom&&(c=this.isLabel(a,b,!1))&&(this.node=this.viz.graph.getNode(c.id),this.config.onShow(this.tip,this.node,c))},onMouseMove:function(b,c,d){this.dom&&this.isLabel(b,c)&&this.setTooltipPosition(a.event.getPos(b,c));if(!this.dom){var e=d.getNode();if(e){if(this.config.force||!this.node||this.node.id!=e.id)this.node=e,this.config.onShow(this.tip,e,d.getContains());this.setTooltipPosition(a.event.getPos(b,c))}else this.hide(!0)}},setTooltipPosition:function(a){var b=this.tip,c=b.style,d=this.config;c.display="";var e={height:document.body.clientHeight,width:document.body.clientWidth},b={width:b.offsetWidth,height:b.offsetHeight},f=d.offsetX,d=d.offsetY;c.top=(a.y+d+b.height>e.height?a.y-b.height-d:a.y+d)+"px",c.left=(a.x+b.width+f>e.width?a.x-b.width-f:a.x+f)+"px"},hide:function(a){this.tip.style.display="none",a&&this.config.onHide()}}),i.Classes.NodeStyles=new b({Implements:[f,g],initializePost:function(){this.fx=this.viz.fx,this.types=this.viz.fx.nodeTypes,this.nStyles=this.config,this.nodeStylesOnHover=this.nStyles.stylesHover,this.nodeStylesOnClick=this.nStyles.stylesClick,this.hoveredNode=!1,this.fx.nodeFxAnimation=new d,this.move=this.down=!1},onMouseOut:function(a,b){this.down=this.move=!1;if(this.hoveredNode){this.dom&&this.isLabel(a,b,!0)&&this.toggleStylesOnHover(this.hoveredNode,!1);for(var c=a.relatedTarget,d=this.canvas.getElement();c&&c.parentNode;){if(d==c.parentNode)return;c=c.parentNode}this.toggleStylesOnHover(this.hoveredNode,!1),this.hoveredNode=!1}},onMouseOver:function(a,b){var c;this.dom&&(c=this.isLabel(a,b,!0))&&(c=this.viz.graph.getNode(c.id),!c.selected)&&(this.hoveredNode=c,this.toggleStylesOnHover(this.hoveredNode,!0))},onMouseDown:function(a,b,c,d){if(!d){var e;this.dom&&(e=this.isLabel(a,b))?this.down=this.viz.graph.getNode(e.id):this.dom||(this.down=c.getNode()),this.move=!1}},onMouseUp:function(a,b,c,d){d||(this.move||this.onClick(c.getNode()),this.down=this.move=!1)},getRestoredStyles:function(a,b){var c={},d=this["nodeStylesOn"+b],e;for(e in d)c[e]=a.styles["$"+e];return c},toggleStylesOnHover:function(a,b){this.nodeStylesOnHover&&this.toggleStylesOn("Hover",a,b)},toggleStylesOnClick:function(a,b){this.nodeStylesOnClick&&this.toggleStylesOn("Click",a,b)},toggleStylesOn:function(b,d,e){var f=this.viz;if(e){d.styles||(d.styles=a.merge(d.data,{}));for(var g in this["nodeStylesOn"+b])e="$"+g,e in d.styles||(d.styles[e]=d.getData(g));f.fx.nodeFx(a.extend({elements:{id:d.id,properties:this["nodeStylesOn"+b]},transition:c.Quart.easeOut,duration:300,fps:40},this.config))}else b=this.getRestoredStyles(d,b),f.fx.nodeFx(a.extend({elements:{id:d.id,properties:b},transition:c.Quart.easeOut,duration:300,fps:40},this.config))},onClick:function(a){if(a){var b=this.nodeStylesOnClick;b&&(a.selected?(this.toggleStylesOnClick(a,!1),delete a.selected):(this.viz.graph.eachNode(function(a){if(a.selected){for(var c in b)a.setData(c,a.styles["$"+c],"end");delete a.selected}}),this.toggleStylesOnClick(a,!0),a.selected=!0,delete a.hovered,this.hoveredNode=!1))}},onMouseMove:function(a,b,c){this.down&&(this.move=!0);if(!this.dom||!this.isLabel(a,b)){var d=this.nodeStylesOnHover;if(d&&!this.dom){if(this.hoveredNode&&(a=this.types[this.hoveredNode.getData("type")])&&a.contains&&a.contains.call(this.fx,this.hoveredNode,c.getPos()))return;c=c.getNode(),(this.hoveredNode||c)&&!c.hovered&&(c&&!c.selected?(this.fx.nodeFxAnimation.stopTimer(),this.viz.graph.eachNode(function(a){if(a.hovered&&!a.selected){for(var b in d)a.setData(b,a.styles["$"+b],"end");delete a.hovered}}),c.hovered=!0,this.hoveredNode=c,this.toggleStylesOnHover(c,!0)):this.hoveredNode&&!this.hoveredNode.selected&&(this.fx.nodeFxAnimation.stopTimer(),this.toggleStylesOnHover(this.hoveredNode,!1),delete this.hoveredNode.hovered,this.hoveredNode=!1))}}}}),i.Classes.Navigation=new b({Implements:[f,g],initializePost:function(){this.pressed=this.pos=!1},onMouseWheel:function(b,c,d){this.config.zooming&&(a.event.stop(a.event.get(b,c)),b=1+d*(this.config.zooming/1e3),this.canvas.scale(b,b))},onMouseDown:function(a,b,c){if(this.config.panning&&(this.config.panning!="avoid nodes"||(this.dom?!this.isLabel(a,b):!c.getNode()))){this.pressed=!0,this.pos=c.getPos();var a=this.canvas,b=a.translateOffsetX,c=a.translateOffsetY,d=a.scaleOffsetY;this.pos.x*=a.scaleOffsetX,this.pos.x+=b,this.pos.y*=d,this.pos.y+=c}},onMouseMove:function(a,b,c){if(this.config.panning&&this.pressed&&(this.config.panning!="avoid nodes"||(this.dom?!this.isLabel(a,b):!c.getNode()))){var a=this.pos,c=c.getPos(),d=this.canvas,e=d.translateOffsetX,f=d.translateOffsetY,b=d.scaleOffsetX,d=d.scaleOffsetY;c.x*=b,c.y*=d,c.x+=e,c.y+=f,e=c.x-a.x,a=c.y-a.y,this.pos=c,this.canvas.translate(e*1/b,a*1/d)}},onMouseUp:function(){this.config.panning&&(this.pressed=!1)}});var j;(function(){function c(b,c){var d=document.createElement(b),f;for(f in c)typeof c[f]=="object"?a.extend(d[f],c[f]):d[f]=c[f];return b=="canvas"&&!e&&G_vmlCanvasManager&&(d=G_vmlCanvasManager.initElement(document.body.appendChild(d))),d}var d=typeof HTMLCanvasElement,e=d=="object"||d=="function";$jit.Canvas=j=new b({canvases:[],pos:!1,element:!1,labelContainer:!1,translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(b,d){this.viz=b,this.opt=this.config=d;var e=a.type(d.injectInto)=="string"?d.injectInto:d.injectInto.id,f=d.type,g=e+"-label",h=a(e),i=d.width||h.offsetWidth,k=d.height||h.offsetHeight;this.id=e;var l={injectInto:e,width:i,height:k};this.element=c("div",{id:e+"-canvaswidget",style:{position:"relative",width:i+"px",height:k+"px"}}),this.labelContainer=this.createLabelContainer(d.Label.type,g,l),this.canvases.push(new j.Base[f]({config:a.extend({idSuffix:"-canvas"},l),plot:function(){b.fx.plot()},resize:function(){b.refresh()}}));if(e=d.background)l=new j.Background[e.type](b,a.extend(e,l)),this.canvases.push(new j.Base[f](l));for(f=this.canvases.length;f--;)this.element.appendChild(this.canvases[f].canvas),f>0&&this.canvases[f].plot();this.element.appendChild(this.labelContainer),h.appendChild(this.element);var m=null,n=this;a.addEvent(window,"scroll",function(){clearTimeout(m),m=setTimeout(function(){n.getPos(!0)},500)})},getCtx:function(a){return this.canvases[a||0].getCtx()},getConfig:function(){return this.opt},getElement:function(){return this.element},getSize:function(a){return this.canvases[a||0].getSize()},resize:function(a,b){this.getPos(!0),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1;for(var c=0,d=this.canvases.length;c<d;c++)this.canvases[c].resize(a,b);c=this.element.style,c.width=a+"px",c.height=b+"px",this.labelContainer&&(this.labelContainer.style.width=a+"px")},translate:function(a,b,c){this.translateOffsetX+=a*this.scaleOffsetX,this.translateOffsetY+=b*this.scaleOffsetY;for(var d=0,e=this.canvases.length;d<e;d++)this.canvases[d].translate(a,b,c)},scale:function(a,b){var c=this.scaleOffsetX*a,d=this.scaleOffsetY*b,e=this.translateOffsetX*(a-1)/c,f=this.translateOffsetY*(b-1)/d;this.scaleOffsetX=c,this.scaleOffsetY=d,c=0;for(d=this.canvases.length;c<d;c++)this.canvases[c].scale(a,b,!0);this.translate(e,f,!1)},getPos:function(b){return b||!this.pos?this.pos=a.getPos(this.getElement()):this.pos},clear:function(a){this.canvases[a||0].clear()},path:function(a,b){var c=this.canvases[0].getCtx();c.beginPath(),b(c),c[a](),c.closePath()},createLabelContainer:function(a,b,d){if(a=="HTML"||a=="Native")return c("div",{id:b,style:{overflow:"visible",position:"absolute",top:0,left:0,width:d.width+"px",height:0}});if(a=="SVG"){a=document.createElementNS("http://www.w3.org/2000/svg","svg:svg"),a.setAttribute("width",d.width),a.setAttribute("height",d.height);var e=a.style;return e.position="absolute",e.left=e.top="0px",e=document.createElementNS("http://www.w3.org/2000/svg","svg:g"),e.setAttribute("width",d.width),e.setAttribute("height",d.height),e.setAttribute("x",0),e.setAttribute("y",0),e.setAttribute("id",b),a.appendChild(e),a}}}),j.Base={},j.Base["2D"]=new b({translateOffsetX:0,translateOffsetY:0,scaleOffsetX:1,scaleOffsetY:1,initialize:function(a){this.viz=a,this.opt=a.config,this.size=!1,this.createCanvas(),this.translateToCenter()},createCanvas:function(){var a=this.opt,b=a.width,d=a.height;this.canvas=c("canvas",{id:a.injectInto+a.idSuffix,width:b,height:d,style:{position:"absolute",top:0,left:0,width:b+"px",height:d+"px"}})},getCtx:function(){return this.ctx?this.ctx:this.ctx=this.canvas.getContext("2d")},getSize:function(){if(this.size)return this.size;var a=this.canvas;return this.size={width:a.width,height:a.height}},translateToCenter:function(a){var b=this.getSize(),c=a?b.width-a.width-this.translateOffsetX*2:b.width;height=a?b.height-a.height-this.translateOffsetY*2:b.height,b=this.getCtx(),a&&b.scale(1/this.scaleOffsetX,1/this.scaleOffsetY),b.translate(c/2,height/2)},resize:function(a,b){var c=this.getSize(),d=this.canvas,f=d.style;this.size=!1,d.width=a,d.height=b,f.width=a+"px",f.height=b+"px",e?this.translateToCenter():this.translateToCenter(c),this.translateOffsetX=this.translateOffsetY=0,this.scaleOffsetX=this.scaleOffsetY=1,this.clear(),this.viz.resize(a,b,this)},translate:function(a,b,c){var d=this.scaleOffsetY;this.translateOffsetX+=a*this.scaleOffsetX,this.translateOffsetY+=b*d,this.getCtx().translate(a,b),!c&&this.plot()},scale:function(a,b,c){this.scaleOffsetX*=a,this.scaleOffsetY*=b,this.getCtx().scale(a,b),!c&&this.plot()},clear:function(){var a=this.getSize(),b=this.translateOffsetX,c=this.translateOffsetY,d=this.scaleOffsetX,e=this.scaleOffsetY;this.getCtx().clearRect((-a.width/2-b)*1/d,(-a.height/2-c)*1/e,a.width*1/d,a.height*1/e)},plot:function(){this.clear(),this.viz.plot(this)}}),j.Background={},j.Background.Circles=new b({initialize:function(b,c){this.viz=b,this.config=a.merge({idSuffix:"-bkcanvas",levelDistance:100,numberOfCircles:6,CanvasStyles:{},offset:0},c)},resize:function(a,b,c){this.plot(c)},plot:function(a){var a=a.getCtx(),b=this.config,c=b.CanvasStyles,d;for(d in c)a[d]=c[d];d=b.numberOfCircles,b=b.levelDistance;for(c=1;c<=d;c++)a.beginPath(),a.arc(0,0,b*c,0,2*Math.PI,!1),a.stroke(),a.closePath()}})})();var k=function(a,b){this.theta=a||0,this.rho=b||0};$jit.Polar=k,k.prototype={getc:function(a){return this.toComplex(a)},getp:function(){return this},set:function(a){a=a.getp(),this.theta=a.theta,this.rho=a.rho},setc:function(a,b){this.rho=Math.sqrt(a*a+b*b),this.theta=Math.atan2(b,a),this.theta<0&&(this.theta+=Math.PI*2)},setp:function(a,b){this.theta=a,this.rho=b},clone:function(){return new k(this.theta,this.rho)},toComplex:function(a){var b=Math.cos(this.theta)*this.rho,c=Math.sin(this.theta)*this.rho;return a?{x:b,y:c}:new l(b,c)},add:function(a){return new k(this.theta+a.theta,this.rho+a.rho)},scale:function(a){return new k(this.theta,this.rho*a)},equals:function(a){return this.theta==a.theta&&this.rho==a.rho},$add:function(a){return this.theta+=a.theta,this.rho+=a.rho,this},$madd:function(a){return this.theta=(this.theta+a.theta)%(Math.PI*2),this.rho+=a.rho,this},$scale:function(a){return this.rho*=a,this},isZero:function(){var a=Math.abs;return a(this.theta)<1e-4&&a(this.rho)<1e-4},interpolate:function(a,b){var c=Math.PI,d=c*2,e=function(a){return a<0?a%d+d:a%d},f=this.theta,g=a.theta,h=Math.abs(f-g);return{theta:h==c?f>g?e(g+(f-d-g)*b):e(g-d+(f-g)*b):h>=c?f>g?e(g+(f-d-g)*b):e(g-d+(f-(g-d))*b):e(g+(f-g)*b),rho:(this.rho-a.rho)*b+a.rho}}},k.KER=new k(0,0);var l=function(a,b){this.x=a||0,this.y=b||0};$jit.Complex=l,l.prototype={getc:function(){return this},getp:function(a){return this.toPolar(a)},set:function(a){a=a.getc(!0),this.x=a.x,this.y=a.y},setc:function(a,b){this.x=a,this.y=b},setp:function(a,b){this.x=Math.cos(a)*b,this.y=Math.sin(a)*b},clone:function(){return new l(this.x,this.y)},toPolar:function(a){var b=this.norm(),c=Math.atan2(this.y,this.x);return c<0&&(c+=Math.PI*2),a?{theta:c,rho:b}:new k(c,b)},norm:function(){return Math.sqrt(this.squaredNorm())},squaredNorm:function(){return this.x*this.x+this.y*this.y},add:function(a){return new l(this.x+a.x,this.y+a.y)},prod:function(a){return new l(this.x*a.x-this.y*a.y,this.y*a.x+this.x*a.y)},conjugate:function(){return new l(this.x,-this.y)},scale:function(a){return new l(this.x*a,this.y*a)},equals:function(a){return this.x==a.x&&this.y==a.y},$add:function(a){return this.x+=a.x,this.y+=a.y,this},$prod:function(a){var b=this.x,c=this.y;return this.x=b*a.x-c*a.y,this.y=c*a.x+b*a.y,this},$conjugate:function(){return this.y=-this.y,this},$scale:function(a){return this.x*=a,this.y*=a,this},$div:function(a){var b=this.x,c=this.y,d=a.squaredNorm();return this.x=b*a.x+c*a.y,this.y=c*a.x-b*a.y,this.$scale(1/d)},isZero:function(){var a=Math.abs;return a(this.x)<1e-4&&a(this.y)<1e-4}},l.KER=new l(0,0),$jit.Graph=new b({initialize:function(b,c,d,e){var f={klass:l,Node:{}};this.Node=c,this.Edge=d,this.Label=e,this.opt=a.merge(f,b||{}),this.nodes={},this.edges={};var g=this;this.nodeList={};for(var h in n)g.nodeList[h]=function(a){return function(){var b=Array.prototype.slice.call(arguments);g.eachNode(function(c){c[a].apply(c,b)})}}(h)},getNode:function(a){return this.hasNode(a)?this.nodes[a]:!1},get:function(a){return this.getNode(a)},getByName:function(a){for(var b in this.nodes){var c=this.nodes[b];if(c.name==a)return c}return!1},getAdjacence:function(a,b){return a in this.edges?this.edges[a][b]:!1},addNode:function(b){if(!this.nodes[b.id]){var c=this.edges[b.id]={};this.nodes[b.id]=new m.Node(a.extend({id:b.id,name:b.name,data:a.merge(b.data||{},{}),adjacencies:c},this.opt.Node),this.opt.klass,this.Node,this.Edge,this.Label)}return this.nodes[b.id]},addAdjacence:function(a,b,c){this.hasNode(a.id)||this.addNode(a),this.hasNode(b.id)||this.addNode(b),a=this.nodes[a.id],b=this.nodes[b.id];if(!a.adjacentTo(b)){var d=this.edges[a.id]=this.edges[a.id]||{},e=this.edges[b.id]=this.edges[b.id]||{};return d[b.id]=e[a.id]=new m.Adjacence(a,b,c,this.Edge,this.Label),d[b.id]}return this.edges[a.id][b.id]},removeNode:function(a){if(this.hasNode(a)){delete this.nodes[a];var b=this.edges[a],c;for(c in b)delete this.edges[c][a];delete this.edges[a]}},removeAdjacence:function(a,b){delete this.edges[a][b],delete this.edges[b][a]},hasNode:function(a){return a in this.nodes},empty:function(){this.nodes={},this.edges={}}});var m=$jit.Graph,n;(function(){var b=function(a,b,c,d,e){var f,c=c||"current";return c=="current"?f=this.data:c=="start"?f=this.startData:c=="end"&&(f=this.endData),a="$"+(a?a+"-":"")+b,d?f[a]:this.Config.overridable?a in f?f[a]:a in this.data?this.data[a]:e[b]||0:e[b]||0},c=function(a,b,c,d){var d=d||"current",e;d=="current"?e=this.data:d=="start"?e=this.startData:d=="end"&&(e=this.endData),e["$"+(a?a+"-":"")+b]=c},d=function(b,c){var b="$"+(b?b+"-":""),d=this;a.each(c,function(a){a=b+a,delete d.data[a],delete d.endData[a],delete d.startData[a]})};n={getData:function(a,c,d){return b.call(this,"",a,c,d,this.Config)},setData:function(a,b,d){c.call(this,"",a,b,d)},setDataset:function(b,c){var b=a.splat(b),d;for(d in c)for(var e=0,f=a.splat(c[d]),g=b.length;e<g;e++)this.setData(d,f[e],b[e])},removeData:function(){d.call(this,"",Array.prototype.slice.call(arguments))},getCanvasStyle:function(a,c,d){return b.call(this,"canvas",a,c,d,this.Config.CanvasStyles)},setCanvasStyle:function(a,b,d){c.call(this,"canvas",a,b,d)},setCanvasStyles:function(b,c){var b=a.splat(b),d;for(d in c)for(var e=0,f=a.splat(c[d]),g=b.length;e<g;e++)this.setCanvasStyle(d,f[e],b[e])},removeCanvasStyle:function(){d.call(this,"canvas",Array.prototype.slice.call(arguments))},getLabelData:function(a,c,d){return b.call(this,"label",a,c,d,this.Label)},setLabelData:function(a,b,d){c.call(this,"label",a,b,d)},setLabelDataset:function(b,c){var b=a.splat(b),d;for(d in c)for(var e=0,f=a.splat(c[d]),g=b.length;e<g;e++)this.setLabelData(d,f[e],b[e])},removeLabelData:function(){d.call(this,"label",Array.prototype.slice.call(arguments))}}})(),m.Node=new b({initialize:function(b,c,d,e,f){c={id:"",name:"",data:{},startData:{},endData:{},adjacencies:{},selected
|
24
|
-
:!1,drawn:!1,exist:!1,angleSpan:{begin:0,end:0},pos:new c,startPos:new c,endPos:new c},a.extend(this,a.extend(c,b)),this.Config=this.Node=d,this.Edge=e,this.Label=f},adjacentTo:function(a){return a.id in this.adjacencies},getAdjacency:function(a){return this.adjacencies[a]},getPos:function(a){a=a||"current";if(a=="current")return this.pos;if(a=="end")return this.endPos;if(a=="start")return this.startPos},setPos:function(a,b){var b=b||"current",c;b=="current"?c=this.pos:b=="end"?c=this.endPos:b=="start"&&(c=this.startPos),c.set(a)}}),m.Node.implement(n),m.Adjacence=new b({initialize:function(a,b,c,d,e){this.nodeFrom=a,this.nodeTo=b,this.data=c||{},this.startData={},this.endData={},this.Config=this.Edge=d,this.Label=e}}),m.Adjacence.implement(n),m.Util={filter:function(b){if(!b||a.type(b)!="string")return function(){return!0};var c=b.split(" ");return function(a){for(var b=0;b<c.length;b++)if(a[c[b]])return!1;return!0}},getNode:function(a,b){return a.nodes[b]},eachNode:function(a,b,c){var c=this.filter(c),d;for(d in a.nodes)c(a.nodes[d])&&b(a.nodes[d])},each:function(a,b,c){this.eachNode(a,b,c)},eachAdjacency:function(a,b,c){var d=a.adjacencies,c=this.filter(c),e;for(e in d){var f=d[e];if(c(f)){if(f.nodeFrom!=a){var g=f.nodeFrom;f.nodeFrom=f.nodeTo,f.nodeTo=g}b(f,e)}}},computeLevels:function(a,b,c,d){var c=c||0,e=this.filter(d);this.eachNode(a,function(a){a._flag=!1,a._depth=-1},d),a=a.getNode(b),a._depth=c;for(var f=[a];f.length!=0;){var g=f.pop();g._flag=!0,this.eachAdjacency(g,function(a){a=a.nodeTo,a._flag==0&&e(a)&&(a._depth<0&&(a._depth=g._depth+1+c),f.unshift(a))},d)}},eachBFS:function(a,b,c,d){var e=this.filter(d);this.clean(a);for(var f=[a.getNode(b)];f.length!=0;)a=f.pop(),a._flag=!0,c(a,a._depth),this.eachAdjacency(a,function(a){a=a.nodeTo,a._flag==0&&e(a)&&(a._flag=!0,f.unshift(a))},d)},eachLevel:function(a,b,c,d,e){var f=a._depth,g=this.filter(e),h=this,c=c===!1?Number.MAX_VALUE-f:c;(function i(a,b,c){var e=a._depth;e>=b&&e<=c&&g(a)&&d(a,e),e<c&&h.eachAdjacency(a,function(a){a=a.nodeTo,a._depth>e&&i(a,b,c)})})(a,b+f,c+f)},eachSubgraph:function(a,b,c){this.eachLevel(a,0,!1,b,c)},eachSubnode:function(a,b,c){this.eachLevel(a,1,1,b,c)},anySubnode:function(b,c,d){var e=!1,c=c||a.lambda(!0),f=a.type(c)=="string"?function(a){return a[c]}:c;return this.eachSubnode(b,function(a){f(a)&&(e=!0)},d),e},getSubnodes:function(b,c,d){var e=[],c=c||0,f;return a.type(c)=="array"?(f=c[0],c=c[1]):(f=c,c=Number.MAX_VALUE-b._depth),this.eachLevel(b,f,c,function(a){e.push(a)},d),e},getParents:function(a){var b=[];return this.eachAdjacency(a,function(c){c=c.nodeTo,c._depth<a._depth&&b.push(c)}),b},isDescendantOf:function(a,b){if(a.id==b)return!0;for(var c=this.getParents(a),d=!1,e=0;!d&&e<c.length;e++)d=d||this.isDescendantOf(c[e],b);return d},clean:function(a){this.eachNode(a,function(a){a._flag=!1})},getClosestNodeToOrigin:function(a,b,c){return this.getClosestNodeToPos(a,k.KER,b,c)},getClosestNodeToPos:function(a,b,c,d){var e=null,c=c||"current",b=b&&b.getc(!0)||l.KER,f=function(a,b){var c=a.x-b.x,d=a.y-b.y;return c*c+d*d};return this.eachNode(a,function(a){e=e==null||f(a.getPos(c).getc(!0),b)<f(e.getPos(c).getc(!0),b)?a:e},d),e}},a.each(["get","getNode","each","eachNode","computeLevels","eachBFS","clean","getClosestNodeToPos","getClosestNodeToOrigin"],function(a){m.prototype[a]=function(){return m.Util[a].apply(m.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),a.each(["eachAdjacency","eachLevel","eachSubgraph","eachSubnode","anySubnode","getSubnodes","getParents","isDescendantOf"],function(a){m.Node.prototype[a]=function(){return m.Util[a].apply(m.Util,[this].concat(Array.prototype.slice.call(arguments)))}}),m.Op={options:{type:"nothing",duration:2e3,hideLabels:!0,fps:30},initialize:function(a){this.viz=a},removeNode:function(b,c){var d=this.viz,e=a.merge(this.options,d.controller,c),f=a.splat(b),g,h,i;switch(e.type){case"nothing":for(g=0;g<f.length;g++)d.graph.removeNode(f[g]);break;case"replot":this.removeNode(f,{type:"nothing"}),d.labels.clearLabels(),d.refresh(!0);break;case"fade:seq":case"fade":h=this;for(g=0;g<f.length;g++)i=d.graph.getNode(f[g]),i.setData("alpha",0,"end");d.fx.animate(a.merge(e,{modes:["node-property:alpha"],onComplete:function(){h.removeNode(f,{type:"nothing"}),d.labels.clearLabels(),d.reposition(),d.fx.animate(a.merge(e,{modes:["linear"]}))}}));break;case"fade:con":h=this;for(g=0;g<f.length;g++)i=d.graph.getNode(f[g]),i.setData("alpha",0,"end"),i.ignore=!0;d.reposition(),d.fx.animate(a.merge(e,{modes:["node-property:alpha","linear"],onComplete:function(){h.removeNode(f,{type:"nothing"}),e.onComplete&&e.onComplete()}}));break;case"iter":h=this,d.fx.sequence({condition:function(){return f.length!=0},step:function(){h.removeNode(f.shift(),{type:"nothing"}),d.labels.clearLabels()},onComplete:function(){e.onComplete&&e.onComplete()},duration:Math.ceil(e.duration/f.length)});break;default:this.doError()}},removeEdge:function(b,c){var d=this.viz,e=a.merge(this.options,d.controller,c),f=a.type(b[0])=="string"?[b]:b,g,h,i;switch(e.type){case"nothing":for(g=0;g<f.length;g++)d.graph.removeAdjacence(f[g][0],f[g][1]);break;case"replot":this.removeEdge(f,{type:"nothing"}),d.refresh(!0);break;case"fade:seq":case"fade":h=this;for(g=0;g<f.length;g++)(i=d.graph.getAdjacence(f[g][0],f[g][1]))&&i.setData("alpha",0,"end");d.fx.animate(a.merge(e,{modes:["edge-property:alpha"],onComplete:function(){h.removeEdge(f,{type:"nothing"}),d.reposition(),d.fx.animate(a.merge(e,{modes:["linear"]}))}}));break;case"fade:con":h=this;for(g=0;g<f.length;g++)if(i=d.graph.getAdjacence(f[g][0],f[g][1]))i.setData("alpha",0,"end"),i.ignore=!0;d.reposition(),d.fx.animate(a.merge(e,{modes:["edge-property:alpha","linear"],onComplete:function(){h.removeEdge(f,{type:"nothing"}),e.onComplete&&e.onComplete()}}));break;case"iter":h=this,d.fx.sequence({condition:function(){return f.length!=0},step:function(){h.removeEdge(f.shift(),{type:"nothing"}),d.labels.clearLabels()},onComplete:function(){e.onComplete()},duration:Math.ceil(e.duration/f.length)});break;default:this.doError()}},sum:function(b,c){var d=this.viz,e=a.merge(this.options,d.controller,c),f=d.root,g;d.root=c.id||d.root;switch(e.type){case"nothing":g=d.construct(b),g.eachNode(function(a){a.eachAdjacency(function(a){d.graph.addAdjacence(a.nodeFrom,a.nodeTo,a.data)})});break;case"replot":d.refresh(!0),this.sum(b,{type:"nothing"}),d.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,g=d.construct(b);var h=this.preprocessSum(g)?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];d.reposition(),e.type!="fade:con"?d.fx.animate(a.merge(e,{modes:["linear"],onComplete:function(){d.fx.animate(a.merge(e,{modes:h,onComplete:function(){e.onComplete()}}))}})):(d.graph.eachNode(function(a){a.id!=f&&a.pos.isZero()&&(a.pos.set(a.endPos),a.startPos.set(a.endPos))}),d.fx.animate(a.merge(e,{modes:["linear"].concat(h)})));break;default:this.doError()}},morph:function(b,c,d){var d=d||{},e=this.viz,f=a.merge(this.options,e.controller,c),g=e.root,h;e.root=c.id||e.root;switch(f.type){case"nothing":h=e.construct(b),h.eachNode(function(a){var b=e.graph.hasNode(a.id);a.eachAdjacency(function(a){var b=!!e.graph.getAdjacence(a.nodeFrom.id,a.nodeTo.id);e.graph.addAdjacence(a.nodeFrom,a.nodeTo,a.data);if(b){var b=e.graph.getAdjacence(a.nodeFrom.id,a.nodeTo.id),c;for(c in a.data||{})b.data[c]=a.data[c]}});if(b){var b=e.graph.getNode(a.id),c;for(c in a.data||{})b.data[c]=a.data[c]}}),e.graph.eachNode(function(a){a.eachAdjacency(function(a){h.getAdjacence(a.nodeFrom.id,a.nodeTo.id)||e.graph.removeAdjacence(a.nodeFrom.id,a.nodeTo.id)}),h.hasNode(a.id)||e.graph.removeNode(a.id)});break;case"replot":e.labels.clearLabels(!0),this.morph(b,{type:"nothing"}),e.refresh(!0),e.refresh(!0);break;case"fade:seq":case"fade":case"fade:con":that=this,h=e.construct(b);var i="node-property"in d&&a.map(a.splat(d["node-property"]),function(a){return"$"+a});e.graph.eachNode(function(b){var c=h.getNode(b.id);if(c){var c=c.data,d;for(d in c)i&&a.indexOf(i,d)>-1?b.endData[d]=c[d]:b.data[d]=c[d]}else b.setData("alpha",1),b.setData("alpha",1,"start"),b.setData("alpha",0,"end"),b.ignore=!0}),e.graph.eachNode(function(a){a.ignore||a.eachAdjacency(function(a){if(!a.nodeFrom.ignore&&!a.nodeTo.ignore){var b=h.getNode(a.nodeFrom.id),a=h.getNode(a.nodeTo.id);b.adjacentTo(a)||(a=e.graph.getAdjacence(b.id,a.id),j=!0,a.setData("alpha",1),a.setData("alpha",1,"start"),a.setData("alpha",0,"end"))}})});var j=this.preprocessSum(h),b=j?["node-property:alpha","edge-property:alpha"]:["node-property:alpha"];b[0]+="node-property"in d?":"+a.splat(d["node-property"]).join(":"):"",b[1]=(b[1]||"edge-property:alpha")+("edge-property"in d?":"+a.splat(d["edge-property"]).join(":"):""),"label-property"in d&&b.push("label-property:"+a.splat(d["label-property"]).join(":")),e.reposition?e.reposition():e.compute("end"),e.graph.eachNode(function(a){a.id!=g&&a.pos.getp().equals(k.KER)&&(a.pos.set(a.endPos),a.startPos.set(a.endPos))}),e.fx.animate(a.merge(f,{modes:[d.position||"polar"].concat(b),onComplete:function(){e.graph.eachNode(function(a){a.ignore&&e.graph.removeNode(a.id)}),e.graph.eachNode(function(a){a.eachAdjacency(function(a){a.ignore&&e.graph.removeAdjacence(a.nodeFrom.id,a.nodeTo.id)})}),f.onComplete()}}))}},contract:function(b,c){var d=this.viz;!b.collapsed&&b.anySubnode(a.lambda(!0))&&(c=a.merge(this.options,d.config,c||{},{modes:["node-property:alpha:span","linear"]}),b.collapsed=!0,function e(a){a.eachSubnode(function(a){a.ignore=!0,a.setData("alpha",0,c.type=="animate"?"end":"current"),e(a)})}(b),c.type=="animate"?(d.compute("end"),d.rotated&&d.rotate(d.rotated,"none",{property:"end"}),function f(a){a.eachSubnode(function(a){a.setPos(b.getPos("end"),"end"),f(a)})}(b),d.fx.animate(c)):c.type=="replot"&&d.refresh())},expand:function(b,c){if("collapsed"in b){var d=this.viz,c=a.merge(this.options,d.config,c||{},{modes:["node-property:alpha:span","linear"]});delete b.collapsed,function e(a){a.eachSubnode(function(a){delete a.ignore,a.setData("alpha",1,c.type=="animate"?"end":"current"),e(a)})}(b),c.type=="animate"?(d.compute("end"),d.rotated&&d.rotate(d.rotated,"none",{property:"end"}),d.fx.animate(c)):c.type=="replot"&&d.refresh()}},preprocessSum:function(a){var b=this.viz;a.eachNode(function(a){b.graph.hasNode(a.id)||(b.graph.addNode(a),a=b.graph.getNode(a.id),a.setData("alpha",0),a.setData("alpha",0,"start"),a.setData("alpha",1,"end"))});var c=!1;return a.eachNode(function(a){a.eachAdjacency(function(a){var d=b.graph.getNode(a.nodeFrom.id),e=b.graph.getNode(a.nodeTo.id);d.adjacentTo(e)||(a=b.graph.addAdjacence(d,e,a.data),d.startAlpha==d.endAlpha&&e.startAlpha==e.endAlpha&&(c=!0,a.setData("alpha",0),a.setData("alpha",0,"start"),a.setData("alpha",1,"end")))})}),c}};var o={none:{render:a.empty,contains:a.lambda(!1)},circle:{render:function(a,b,c,d){d=d.getCtx(),d.beginPath(),d.arc(b.x,b.y,c,0,Math.PI*2,!0),d.closePath(),d[a]()},contains:function(a,b,c){var d=a.x-b.x,a=a.y-b.y;return d*d+a*a<=c*c}},ellipse:{render:function(a,b,c,d,e){var e=e.getCtx(),f=1,g=1,h=1,i=1,j=0;c>d?(j=c/2,g=d/c,i=c/d):(j=d/2,f=c/d,h=d/c),e.save(),e.scale(f,g),e.beginPath(),e.arc(b.x*h,b.y*i,j,0,Math.PI*2,!0),e.closePath(),e[a](),e.restore()},contains:function(a,b,c,d){var e=0,f=1,g=1,h=0,i=0,e=0;return c>d?(e=c/2,g=d/c):(e=d/2,f=c/d),h=(a.x-b.x)*(1/f),i=(a.y-b.y)*(1/g),h*h+i*i<=e*e}},square:{render:function(a,b,c,d){d.getCtx()[a+"Rect"](b.x-c,b.y-c,2*c,2*c)},contains:function(a,b,c){return Math.abs(b.x-a.x)<=c&&Math.abs(b.y-a.y)<=c}},rectangle:{render:function(a,b,c,d,e){e.getCtx()[a+"Rect"](b.x-c/2,b.y-d/2,c,d)},contains:function(a,b,c,d){return Math.abs(b.x-a.x)<=c/2&&Math.abs(b.y-a.y)<=d/2}},triangle:{render:function(a,b,c,d){var d=d.getCtx(),e=b.x,f=b.y-c,g=e-c,b=b.y+c,c=e+c;d.beginPath(),d.moveTo(e,f),d.lineTo(g,b),d.lineTo(c,b),d.closePath(),d[a]()},contains:function(a,b,c){return o.circle.contains(a,b,c)}},star:{render:function(a,b,c,d){var d=d.getCtx(),e=Math.PI/5;d.save(),d.translate(b.x,b.y),d.beginPath(),d.moveTo(c,0);for(b=0;b<9;b++)d.rotate(e),b%2==0?d.lineTo(c/.525731*.200811,0):d.lineTo(c,0);d.closePath(),d[a](),d.restore()},contains:function(a,b,c){return o.circle.contains(a,b,c)}}},p={line:{render:function(a,b,c){c=c.getCtx(),c.beginPath(),c.moveTo(a.x,a.y),c.lineTo(b.x,b.y),c.stroke()},contains:function(a,b,c,d){var e=Math.min,f=Math.max,g=e(a.x,b.x),h=f(a.x,b.x),e=e(a.y,b.y),f=f(a.y,b.y);return c.x>=g&&c.x<=h&&c.y>=e&&c.y<=f?Math.abs(b.x-a.x)<=d?!0:Math.abs((b.y-a.y)/(b.x-a.x)*(c.x-a.x)+a.y-c.y)<=d:!1}},arrow:{render:function(a,b,c,d,e){e=e.getCtx(),d&&(d=a,a=b,b=d),d=new l(b.x-a.x,b.y-a.y),d.$scale(c/d.norm());var c=new l(b.x-d.x,b.y-d.y),f=new l(-d.y/2,d.x/2),d=c.add(f),c=c.$add(f.$scale(-1));e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(b.x,b.y),e.stroke(),e.beginPath(),e.moveTo(d.x,d.y),e.lineTo(c.x,c.y),e.lineTo(b.x,b.y),e.closePath(),e.fill()},contains:function(a,b,c,d){return p.line.contains(a,b,c,d)}},hyperline:{render:function(a,b,c,d){function e(a,b){return a<b?a+Math.PI>b?!1:!0:b+Math.PI>a?!0:!1}var d=d.getCtx(),f=function(a,b){var c=a.x*b.y-a.y*b.x,d=a.squaredNorm(),e=b.squaredNorm();if(c==0)return{x:0,y:0,ratio:-1};var f=(a.y*e-b.y*d+a.y-b.y)/c,c=(b.x*d-a.x*e+b.x-a.x)/c,d=(f*f+c*c)/4-1;return d<0?{x:0,y:0,ratio:-1}:(d=Math.sqrt(d),{x:-f/2,y:-c/2,ratio:d>1e3?-1:d,a:f,b:c})}(a,b);f.a>1e3||f.b>1e3||f.ratio<0?(d.beginPath(),d.moveTo(a.x*c,a.y*c),d.lineTo(b.x*c,b.y*c)):(b=Math.atan2(b.y-f.y,b.x-f.x),a=Math.atan2(a.y-f.y,a.x-f.x),e=e(b,a),d.beginPath(),d.arc(f.x*c,f.y*c,f.ratio*c,b,a,e)),d.stroke()},contains:a.lambda(!1)}};m.Plot={initialize:function(a,b){this.viz=a,this.config=a.config,this.node=a.config.Node,this.edge=a.config.Edge,this.animation=new d,this.nodeTypes=new b.Plot.NodeTypes,this.edgeTypes=new b.Plot.EdgeTypes,this.labels=a.labels},nodeHelper:o,edgeHelper:p,Interpolator:{map:{border:"color",color:"color",width:"number",height:"number",dim:"number",alpha:"number",lineWidth:"number",angularWidth:"number",span:"number",valueArray:"array-number",dimArray:"array-number"},canvas:{globalAlpha:"number",fillStyle:"color",strokeStyle:"color",lineWidth:"number",shadowBlur:"number",shadowColor:"color",shadowOffsetX:"number",shadowOffsetY:"number",miterLimit:"number"},label:{size:"number",color:"color"},compute:function(a,b,c){return a+(b-a)*c},moebius:function(a,b,c,d){b=d.scale(-c);if(b.norm()<1){var c=b.x,d=b.y,e=a.startPos.getc().moebiusTransformation(b);a.pos.setc(e.x,e.y),b.x=c,b.y=d}},linear:function(a,b,c){var b=a.startPos.getc(!0),d=a.endPos.getc(!0);a.pos.setc(this.compute(b.x,d.x,c),this.compute(b.y,d.y,c))},polar:function(a,b,c){b=a.startPos.getp(!0),c=a.endPos.getp().interpolate(b,c),a.pos.setp(c.theta,c.rho)},number:function(a,b,c,d,e){var f=a[d](b,"start"),d=a[d](b,"end");a[e](b,this.compute(f,d,c))},color:function(b,c,d,e,f){var g=a.hexToRgb(b[e](c,"start")),e=a.hexToRgb(b[e](c,"end")),h=this.compute,d=a.rgbToHex([parseInt(h(g[0],e[0],d)),parseInt(h(g[1],e[1],d)),parseInt(h(g[2],e[2],d))]);b[f](c,d)},"array-number":function(a,b,c,d,e){for(var f=a[d](b,"start"),d=a[d](b,"end"),g=[],h=0,i=f.length;h<i;h++){var j=f[h],k=d[h];if(j.length){for(var l=0,m=j.length,n=[];l<m;l++)n.push(this.compute(j[l],k[l],c));g.push(n)}else g.push(this.compute(j,k,c))}a[e](b,g)},node:function(a,b,c,d,e,f){d=this[d];if(b)for(var g=b.length,h=0;h<g;h++){var i=b[h];this[d[i]](a,i,c,e,f)}else for(i in d)this[d[i]](a,i,c,e,f)},edge:function(a,b,c,d,e,f){var a=a.adjacencies,g;for(g in a)this.node(a[g],b,c,d,e,f)},"node-property":function(a,b,c){this.node(a,b,c,"map","getData","setData")},"edge-property":function(a,b,c){this.edge(a,b,c,"map","getData","setData")},"label-property":function(a,b,c){this.node(a,b,c,"label","getLabelData","setLabelData")},"node-style":function(a,b,c){this.node(a,b,c,"canvas","getCanvasStyle","setCanvasStyle")},"edge-style":function(a,b,c){this.edge(a,b,c,"canvas","getCanvasStyle","setCanvasStyle")}},sequence:function(b){var c=this,b=a.merge({condition:a.lambda(!1),step:a.empty,onComplete:a.empty,duration:200},b||{}),d=setInterval(function(){b.condition()?b.step():(clearInterval(d),b.onComplete()),c.viz.refresh(!0)},b.duration)},prepare:function(b){var c=this.viz.graph,d={"node-property":{getter:"getData",setter:"setData"},"edge-property":{getter:"getData",setter:"setData"},"node-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"},"edge-style":{getter:"getCanvasStyle",setter:"setCanvasStyle"}},e={};if(a.type(b)=="array")for(var f=0,g=b.length;f<g;f++){var h=b[f].split(":");e[h.shift()]=h}else for(f in b)f=="position"?e[b.position]=[]:e[f]=a.splat(b[f]);return c.eachNode(function(b){b.startPos.set(b.pos),a.each(["node-property","node-style"],function(a){if(a in e)for(var c=e[a],f=0,g=c.length;f<g;f++)b[d[a].setter](c[f],b[d[a].getter](c[f]),"start")}),a.each(["edge-property","edge-style"],function(a){if(a in e){var c=e[a];b.eachAdjacency(function(b){for(var e=0,f=c.length;e<f;e++)b[d[a].setter](c[e],b[d[a].getter](c[e]),"start")})}})}),e},animate:function(b,c){var b=a.merge(this.viz.config,b||{}),d=this,e=this.viz.graph,f=this.Interpolator,g=b.type==="nodefx"?this.nodeFxAnimation:this.animation,h=this.prepare(b.modes);b.hideLabels&&this.labels.hideLabels(!0),g.setOptions(a.extend(b,{$animating:!1,compute:function(a){e.eachNode(function(b){for(var d in h)f[d](b,h[d],a,c)}),d.plot(b,this.$animating,a),this.$animating=!0},complete:function(){b.hideLabels&&d.labels.hideLabels(!1),d.plot(b),b.onComplete()}})).start()},nodeFx:function(b){var c=this.viz,d=c.graph,e=this.nodeFxAnimation,f=a.merge(this.viz.config,{elements:{id:!1,properties:{}},reposition:!1}),b=a.merge(f,b||{},{onBeforeCompute:a.empty,onAfterCompute:a.empty});e.stopTimer();var g=b.elements.properties;b.elements.id?(e=a.splat(b.elements.id),a.each(e,function(a){if(a=d.getNode(a))for(var b in g)a.setData(b,g[b],"end")})):d.eachNode(function(a){for(var b in g)a.setData(b,g[b],"end")});var e=[],h;for(h in g)e.push(h);h=["node-property:"+e.join(":")],b.reposition&&(h.push("linear"),c.compute("end")),this.animate(a.merge(b,{modes:h,type:"nodefx"}))},plot:function(a,b){var c=this.viz,d=c.graph,e=c.canvas,c=c.root,f=this;e.getCtx(),a=a||this.viz.controller,a.clearCanvas&&e.clear();if(c=d.getNode(c)){var g=!!c.visited;d.eachNode(function(c){var d=c.getData("alpha");c.eachAdjacency(function(d){var h=d.nodeTo;!!h.visited===g&&c.drawn&&h.drawn&&(!b&&a.onBeforePlotLine(d),f.plotLine(d,e,b),!b&&a.onAfterPlotLine(d))}),c.drawn&&(!b&&a.onBeforePlotNode(c),f.plotNode(c,e,b),!b&&a.onAfterPlotNode(c)),!f.labelsHidden&&a.withLabels&&(c.drawn&&d>=.95?f.labels.plotLabel(e,c,a):f.labels.hideLabel(c,!1)),c.visited=!g})}},plotTree:function(a,b,c){var d=this,e=this.viz.canvas;e.getCtx();var f=a.getData("alpha");a.eachSubnode(function(f){if(b.plotSubtree(a,f)&&f.exist&&f.drawn){var g=a.getAdjacency(f.id);!c&&b.onBeforePlotLine(g),d.plotLine(g,e,c),!c&&b.onAfterPlotLine(g),d.plotTree(f,b,c)}}),a.drawn?(!c&&b.onBeforePlotNode(a),this.plotNode(a,e,c),!c&&b.onAfterPlotNode(a),!b.hideLabels&&b.withLabels&&f>=.95?this.labels.plotLabel(e,a,b):this.labels.hideLabel(a,!1)):this.labels.hideLabel(a,!0)},plotNode:function(a,b,c){var d=a.getData("type"),e=this.node.CanvasStyles;if(d!="none"){var f=a.getData("lineWidth"),g=a.getData("color"),h=a.getData("alpha"),i=b.getCtx();i.save(),i.lineWidth=f,i.fillStyle=i.strokeStyle=g,i.globalAlpha=h;for(var j in e)i[j]=a.getCanvasStyle(j);this.nodeTypes[d].render.call(this,a,b,c),i.restore()}},plotLine:function(a,b,c){var d=a.getData("type"),e=this.edge.CanvasStyles;if(d!="none"){var f=a.getData("lineWidth"),g=a.getData("color"),h=b.getCtx(),i=a.nodeFrom,j=a.nodeTo;h.save(),h.lineWidth=f,h.fillStyle=h.strokeStyle=g,h.globalAlpha=Math.min(i.getData("alpha"),j.getData("alpha"),a.getData("alpha"));for(var k in e)h[k]=a.getCanvasStyle(k);this.edgeTypes[d].render.call(this,a,b,c),h.restore()}}},m.Plot3D=a.merge(m.Plot,{Interpolator:{linear:function(a,b,c){var b=a.startPos.getc(!0),d=a.endPos.getc(!0);a.pos.setc(this.compute(b.x,d.x,c),this.compute(b.y,d.y,c),this.compute(b.z,d.z,c))}},plotNode:function(a,b){a.getData("type")!="none"&&this.plotElement(a,b,{getAlpha:function(){return a.getData("alpha")}})},plotLine:function(a,b){a.getData("type")!="none"&&this.plotElement(a,b,{getAlpha:function(){return Math.min(a.nodeFrom.getData("alpha"),a.nodeTo.getData("alpha"),a.getData("alpha"))}})},plotElement:function(b,c,d){var e=c.getCtx(),f=new Matrix4,g=c.config.Scene.Lighting,h=c.canvases[0],c=h.program,h=h.camera;b.geometry||(b.geometry=new(O3D[b.getData("type")])),b.geometry.update(b);if(!b.webGLVertexBuffer){for(var i=[],j=[],k=[],l=0,m=b.geometry,n=0,o=m.vertices,m=m.faces,p=m.length;n<p;n++){var q=m[n],r=o[q.a],s=o[q.b],t=o[q.c],u=q.d?o[q.d]:!1,q=q.normal;i.push(r.x,r.y,r.z),i.push(s.x,s.y,s.z),i.push(t.x,t.y,t.z),u&&i.push(u.x,u.y,u.z),k.push(q.x,q.y,q.z),k.push(q.x,q.y,q.z),k.push(q.x,q.y,q.z),u&&k.push(q.x,q.y,q.z),j.push(l,l+1,l+2),u?(j.push(l,l+2,l+3),l+=4):l+=3}b.webGLVertexBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,b.webGLVertexBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(i),e.STATIC_DRAW),b.webGLFaceBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,b.webGLFaceBuffer),e.bufferData(e.ELEMENT_ARRAY_BUFFER,new Uint16Array(j),e.STATIC_DRAW),b.webGLFaceCount=j.length,b.webGLNormalBuffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,b.webGLNormalBuffer),e.bufferData(e.ARRAY_BUFFER,new Float32Array(k),e.STATIC_DRAW)}f.multiply(h.matrix,b.geometry.matrix),e.uniformMatrix4fv(c.viewMatrix,!1,f.flatten()),e.uniformMatrix4fv(c.projectionMatrix,!1,h.projectionMatrix.flatten()),f=Matrix4.makeInvert(f),f.$transpose(),e.uniformMatrix4fv(c.normalMatrix,!1,f.flatten()),f=a.hexToRgb(b.getData("color")),f.push(d.getAlpha()),e.uniform4f(c.color,f[0]/255,f[1]/255,f[2]/255,f[3]),e.uniform1i(c.enableLighting,g.enable),g.enable&&(g.ambient&&(d=g.ambient,e.uniform3f(c.ambientColor,d[0],d[1],d[2])),g.directional&&(g=g.directional,f=g.color,g=g.direction,g=(new Vector3(g.x,g.y,g.z)).normalize().$scale(-1),e.uniform3f(c.lightingDirection,g.x,g.y,g.z),e.uniform3f(c.directionalColor,f[0],f[1],f[2]))),e.bindBuffer(e.ARRAY_BUFFER,b.webGLVertexBuffer),e.vertexAttribPointer(c.position,3,e.FLOAT,!1,0,0),e.bindBuffer(e.ARRAY_BUFFER,b.webGLNormalBuffer),e.vertexAttribPointer(c.normal,3,e.FLOAT,!1,0,0),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,b.webGLFaceBuffer),e.drawElements(e.TRIANGLES,b.webGLFaceCount,e.UNSIGNED_SHORT,0)}}),m.Label={},m.Label.Native=new b({initialize:function(a){this.viz=a},plotLabel:function(a,b,c){var d=a.getCtx();b.pos.getc(!0),d.font=b.getLabelData("style")+" "+b.getLabelData("size")+"px "+b.getLabelData("family"),d.textAlign=b.getLabelData("textAlign"),d.fillStyle=d.strokeStyle=b.getLabelData("color"),d.textBaseline=b.getLabelData("textBaseline"),this.renderLabel(a,b,c)},renderLabel:function(a,b){var c=a.getCtx(),d=b.pos.getc(!0);c.fillText(b.name,d.x,d.y+b.getData("height")/2)},hideLabel:a.empty,hideLabels:a.empty}),m.Label.DOM=new b({labelsHidden:!1,labelContainer:!1,labels:{},getLabelContainer:function(){return this.labelContainer?this.labelContainer:this.labelContainer=document.getElementById(this.viz.config.labelContainer)},getLabel:function(a){return a in this.labels&&this.labels[a]!=null?this.labels[a]:this.labels[a]=document.getElementById(a)},hideLabels:function(a){this.getLabelContainer().style.display=a?"none":"",this.labelsHidden=a},clearLabels:function(a){for(var b in this.labels)if(a||!this.viz.graph.hasNode(b))this.disposeLabel(b),delete this.labels[b]},disposeLabel:function(a){(a=this.getLabel(a))&&a.parentNode&&a.parentNode.removeChild(a)},hideLabel:function(b,c){var b=a.splat(b),d=c?"":"none",e=this;a.each(b,function(a){if(a=e.getLabel(a.id))a.style.display=d})},fitsInCanvas:function(a,b){var c=b.getSize();return a.x>=c.width||a.x<0||a.y>=c.height||a.y<0?!1:!0}}),m.Label.HTML=new b({Implements:m.Label.DOM,plotLabel:function(a,b,c){var a=b.id,d=this.getLabel(a);if(!d&&!(d=document.getElementById(a))){var d=document.createElement("div"),e=this.getLabelContainer();d.id=a,d.className="node",d.style.position="absolute",c.onCreateLabel(d,b),e.appendChild(d),this.labels[b.id]=d}this.placeLabel(d,b,c)}}),m.Label.SVG=new b({Implements:m.Label.DOM,plotLabel:function(a,b,c){var a=b.id,d=this.getLabel(a);if(!d&&!(d=document.getElementById(a))){var d=document.createElementNS("http://www.w3.org/2000/svg","svg:text"),e=document.createElementNS("http://www.w3.org/2000/svg","svg:tspan");d.appendChild(e),e=this.getLabelContainer(),d.setAttribute("id",a),d.setAttribute("class","node"),e.appendChild(d),c.onCreateLabel(d,b),this.labels[b.id]=d}this.placeLabel(d,b,c)}});var f=$jit.Layouts={},q={label:null,compute:function(b,c,d){this.initializeLabel(d);var e=this.label,f=e.style;b.eachNode(function(b){var c=b.getData("autoWidth"),d=b.getData("autoHeight");if(c||d){delete b.data.$width,delete b.data.$height,delete b.data.$dim;var g=b.getData("width"),h=b.getData("height");f.width=c?"auto":g+"px",f.height=d?"auto":h+"px",e.innerHTML=b.name,c=e.offsetWidth,d=e.offsetHeight,g=b.getData("type"),a.indexOf(["circle","square","triangle","star"],g)===-1?(b.setData("width",c),b.setData("height",d)):(c=c>d?c:d,b.setData("width",c),b.setData("height",c),b.setData("dim",c))}})},initializeLabel:function(a){this.label||(this.label=document.createElement("div"),document.body.appendChild(this.label)),this.setLabelStyles(a)},setLabelStyles:function(){a.extend(this.label.style,{visibility:"hidden",position:"absolute",width:"auto",height:"auto"}),this.label.className="jit-autoadjust-label"}};f.Radial=new b({compute:function(b){b=a.splat(b||["current","start","end"]),q.compute(this.graph,b,this.config),this.graph.computeLevels(this.root,0,"ignore");var c=this.createLevelDistanceFunc();this.computeAngularWidths(b),this.computePositions(b,c)},computePositions:function(a,b){for(var c=this.graph,d=c.getNode(this.root),e=this.parent,f=0,g=a.length;f<g;f++){var h=a[f];d.setPos(new k(0,0),h),d.setData("span",Math.PI*2,h)}d.angleSpan={begin:0,end:2*Math.PI},c.eachBFS(this.root,function(c){var d=c.angleSpan.end-c.angleSpan.begin,f=c.angleSpan.begin,g=b(c),h=0,i=[],j={};c.eachSubnode(function(b){h+=b._treeAngularWidth;for(var c=0,d=a.length;c<d;c++){var e=a[c],f=b.getData("dim",e);j[e]=e in j?f>j[e]?f:j[e]:f}i.push(b)},"ignore"),e&&e.id==c.id&&i.length>0&&i[0].dist&&i.sort(function(a,b){return(a.dist>=b.dist)-(a.dist<=b.dist)});for(var c=0,l=i.length;c<l;c++){var m=i[c];if(!m._flag){for(var n=m._treeAngularWidth/h*d,o=f+n/2,p=0,q=a.length;p<q;p++){var r=a[p];m.setPos(new k(o,g),r),m.setData("span",n,r),m.setData("dim-quotient",m.getData("dim",r)/j[r],r)}m.angleSpan={begin:f,end:f+n},f+=n}}},"ignore")},setAngularWidthForNodes:function(a){this.graph.eachBFS(this.root,function(b,c){var d=b.getData("angularWidth",a[0])||5;b._angularWidth=d/c},"ignore")},setSubtreesAngularWidth:function(){var a=this;this.graph.eachNode(function(b){a.setSubtreeAngularWidth(b)},"ignore")},setSubtreeAngularWidth:function(a){var b=this,c=a._angularWidth,d=0;a.eachSubnode(function(a){b.setSubtreeAngularWidth(a),d+=a._treeAngularWidth},"ignore"),a._treeAngularWidth=Math.max(c,d)},computeAngularWidths:function(a){this.setAngularWidthForNodes(a),this.setSubtreesAngularWidth()}}),$jit.RGraph=new b({Implements:[{construct:function(b){var c=a.type(b)=="array",d=new m(this.graphOptions,this.config.Node,this.config.Edge,this.config.Label);return c?function(b,c){for(var d=function(a){for(var d=0,e=c.length;d<e;d++)if(c[d].id==a)return c[d];return b.addNode({id:a,name:a})},e=0,f=c.length;e<f;e++){b.addNode(c[e]);var g=c[e].adjacencies;if(g)for(var h=0,i=g.length;h<i;h++){var j=g[h],k={};typeof g[h]!="string"&&(k=a.merge(j.data,{}),j=j.nodeTo),b.addAdjacence(c[e],d(j),k)}}}(d,b):function(a,b){a.addNode(b);if(b.children)for(var c=0,d=b.children;c<d.length;c++)a.addAdjacence(b,d[c]),arguments.callee(a,d[c])}(d,b),d},loadJSON:function(b,c){this.json=b,this.labels&&this.labels.clearLabels&&this.labels.clearLabels(!0),this.graph=this.construct(b),this.root=a.type(b)!="array"?b.id:b[c?c:0].id},toJSON:function(a){if((a||"tree")=="tree")var b={},b=function d(a){var b={};b.id=a.id,b.name=a.name,b.data=a.data;var c=[];return a.eachSubnode(function(a){c.push(d(a))}),b.children=c,b}(this.graph.getNode(this.root));else{var b=[],c=!!this.graph.getNode(this.root).visited;this.graph.eachNode(function(a){var d={};d.id=a.id,d.name=a.name,d.data=a.data;var e=[];a.eachAdjacency(function(a){var b=a.nodeTo;if(!!b.visited===c){var d={};d.nodeTo=b.id,d.data=a.data,e.push(d)}}),d.adjacencies=e,b.push(d),a.visited=!c})}return b}},i,f.Radial],initialize:function(b){var c=$jit.RGraph,b=this.controller=this.config=a.merge(e("Canvas","Node","Edge","Fx","Controller","Tips","NodeStyles","Events","Navigation","Label"),{interpolation:"linear",levelDistance:100},b);b.useCanvas?(this.canvas=b.useCanvas,this.config.labelContainer=this.canvas.id+"-label"):(b.background&&(b.background=a.merge({type:"Circles"},b.background)),this.canvas=new j(this,b),this.config.labelContainer=(typeof b.injectInto=="string"?b.injectInto:b.injectInto.id)+"-label"),this.graphOptions={klass:k,Node:{selected:!1,exist:!0,drawn:!0}},this.graph=new m(this.graphOptions,this.config.Node,this.config.Edge),this.labels=new c.Label[b.Label.type](this),this.fx=new c.Plot(this,c),this.op=new c.Op(this),this.root=this.json=null,this.parent=this.busy=!1,this.initializeExtras()},createLevelDistanceFunc:function(){var a=this.config.levelDistance;return function(b){return(b._depth+1)*a}},refresh:function(){this.compute(),this.plot()},reposition:function(){this.compute("end")},plot:function(){this.fx.plot()},getNodeAndParentAngle:function(a){var b=!1,c=this.graph.getNode(a),a=c.getParents();if(a=a.length>0?a[0]:!1)b=a.pos.getc(),c=c.pos.getc(),b=b.add(c.scale(-1)),b=Math.atan2(b.y,b.x),b<0&&(b+=2*Math.PI);return{parent:a,theta:b}},tagChildren:function(a,b){if(a.angleSpan){var c=[];a.eachAdjacency(function(a){c.push(a.nodeTo)},"ignore");for(var d=c.length,e=0;e<d&&b!=c[e].id;e++);for(var e=(e+1)%d,f=0;b!=c[e].id;e=(e+1)%d)c[e].dist=f++}},onClick:function(b,c){if(this.root!=b&&!this.busy){this.busy=!0,this.root=b;var d=this;this.controller.onBeforeCompute(this.graph.getNode(b));var e=this.getNodeAndParentAngle(b);this.tagChildren(e.parent,b),this.parent=e.parent,this.compute("end");var f=e.theta-e.parent.endPos.theta;this.graph.eachNode(function(a){a.endPos.set(a.endPos.getp().add(new k(f,0)))}),e=this.config.interpolation,c=a.merge({onComplete:a.empty},c||{}),this.fx.animate(a.merge({hideLabels:!0,modes:[e]},c,{onComplete:function(){d.busy=!1,c.onComplete()}}))}}}),$jit.RGraph.$extend=!0,function(c){c.Op=new b({Implements:m.Op}),c.Plot=new b({Implements:m.Plot}),c.Label={},c.Label.Native=new b({Implements:m.Label.Native}),c.Label.SVG=new b({Implements:m.Label.SVG,initialize:function(a){this.viz=a},placeLabel:function(a,b,c){var d=b.pos.getc(!0),e=this.viz.canvas,f=e.translateOffsetX,g=e.translateOffsetY,h=e.scaleOffsetX,i=e.scaleOffsetY,e=e.getSize(),d={x:Math.round(d.x*h+f+e.width/2),y:Math.round(d.y*i+g+e.height/2)};a.setAttribute("x",d.x),a.setAttribute("y",d.y),c.onPlaceLabel(a,b)}}),c.Label.HTML=new b({Implements:m.Label.HTML,initialize:function(a){this.viz=a},placeLabel:function(a,b,c){var d=b.pos.getc(!0),e=this.viz.canvas,f=e.translateOffsetX,g=e.translateOffsetY,h=e.scaleOffsetX,i=e.scaleOffsetY,j=e.getSize(),d={x:Math.round(d.x*h+f+j.width/2),y:Math.round(d.y*i+g+j.height/2)},f=a.style;f.left=d.x+"px",f.top=d.y+"px",f.display=this.fitsInCanvas(d,e)?"":"none",c.onPlaceLabel(a,b)}}),c.Plot.NodeTypes=new b({none:{render:a.empty,contains:a.lambda(!1)},circle:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.circle.render("fill",c,d,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");return this.nodeHelper.circle.contains(c,b,d)}},ellipse:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");this.nodeHelper.ellipse.render("fill",c,d,e,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");return this.nodeHelper.ellipse.contains(c,b,d,e)}},square:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.square.render("fill",c,d,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");return this.nodeHelper.square.contains(c,b,d)}},rectangle:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");this.nodeHelper.rectangle.render("fill",c,d,e,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("width"),e=a.getData("height");return this.nodeHelper.rectangle.contains(c,b,d,e)}},triangle:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.triangle.render("fill",c,d,b)},contains:function(a,b){var c=a.pos
|
25
|
-
.getc(!0),d=a.getData("dim");return this.nodeHelper.triangle.contains(c,b,d)}},star:{render:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");this.nodeHelper.star.render("fill",c,d,b)},contains:function(a,b){var c=a.pos.getc(!0),d=a.getData("dim");return this.nodeHelper.star.contains(c,b,d)}}}),c.Plot.EdgeTypes=new b({none:a.empty,line:{render:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0);this.edgeHelper.line.render(c,d,b)},contains:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0);return this.edgeHelper.line.contains(c,d,b,this.edge.epsilon)}},arrow:{render:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0),e=a.getData("dim"),f=a.data.$direction;this.edgeHelper.arrow.render(c,d,e,f&&f.length>1&&f[0]!=a.nodeFrom.id,b)},contains:function(a,b){var c=a.nodeFrom.pos.getc(!0),d=a.nodeTo.pos.getc(!0);return this.edgeHelper.arrow.contains(c,d,b,this.edge.epsilon)}}})}($jit.RGraph)})();
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-a1eb3e0764573ed4b261ca742ed96ac3.png
DELETED
Binary file
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_flat_55_fbec88_40x100-439ee8e6c8ce855f43ed4d7b90684720.png
DELETED
Binary file
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_glass_75_d0e5f5_1x400-9357836db77954d0d8c5feb259635223.png
DELETED
Binary file
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_glass_85_dfeffc_1x400-7beb11d1590fb2fb1ef5c754100a078a.png
DELETED
Binary file
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_glass_95_fef1ec_1x400-c723e9a2b50006c6054836a10b76bb84.png
DELETED
Binary file
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_gloss-wave_55_5c9ccc_500x100-cb26f48ac4912c23ce301c69c474d306.png
DELETED
Binary file
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_inset-hard_100_f5f8f9_1x100-519299e2aa31bffdd4fed34b4fac603d.png
DELETED
Binary file
|
Binary file
|
data/public/assets/jquery-ui/ui-bg_inset-hard_100_fcfdfd_1x100-27e08524d3d56bb59e354435b663c3ac.png
DELETED
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|