From 220999abd56b3b81656f12ccf4e35f4cc2490d8d Mon Sep 17 00:00:00 2001 From: huston Date: Wed, 3 Sep 2014 13:20:36 -0700 Subject: [PATCH] commit dist files for 0.2.1 --- dist/alchemy-white.css | 802 +++++++++++++++++++++++++++++++++++++++++ dist/alchemy.css | 22 ++ dist/alchemy.js | 86 +++-- dist/alchemy.min.css | 2 +- dist/alchemy.min.js | 4 +- 5 files changed, 881 insertions(+), 35 deletions(-) create mode 100644 dist/alchemy-white.css diff --git a/dist/alchemy-white.css b/dist/alchemy-white.css new file mode 100644 index 0000000..7c6cf6b --- /dev/null +++ b/dist/alchemy-white.css @@ -0,0 +1,802 @@ +@-webkit-keyframes fadeIn { + 0% { + opacity: 0; + } + + 25% { + opacity: .3; + } + + 50% { + opacity: .66; + } + + 75% { + opacity: 1; + } +} + +@keyframes fadeIn { + 0% { + opacity: 0; + } + + 25% { + opacity: .3; + } + + 50% { + opacity: .66; + } + + 75% { + opacity: 1; + } +} + +@-webkit-keyframes pulse { + 0% { + text-shadow: 0 0 10px rgba(255,255,255,0.2),0 0 12px rgba(255,255,255,0.2),0 0 16px rgba(255,255,255,0.2); + } + + 25% { + text-shadow: 0 0 12px rgba(255,255,255,0.2),0 0 15px rgba(255,255,255,0.2),0 0 20px rgba(255,255,255,0.2),0 0 6px rgba(104,185,254,0.7),0 0 10px rgba(104,185,254,0.7); + } + + 50% { + text-shadow: 0 0 12px rgba(255,255,255,0.2),0 0 15px rgba(255,255,255,0.2),0 0 20px rgba(255,255,255,0.2),0 0 8px rgba(104,185,254,0.7),0 0 10px rgba(104,185,254,0.7),0 0 15px rgba(104,185,254,0.7); + } + + 75% { + text-shadow: 0 0 12px rgba(255,255,255,0.2),0 0 15px rgba(255,255,255,0.2),0 0 25px rgba(255,255,255,0.2),0 0 8px rgba(104,185,254,0.7),0 0 12px rgba(104,185,254,0.7),0 0 15px rgba(104,185,254,0.7),0 0 20px rgba(104,185,254,0.7); + } +} + +@keyframes pulse { + 0% { + text-shadow: 0 0 10px rgba(255,255,255,0.2),0 0 12px rgba(255,255,255,0.2),0 0 16px rgba(255,255,255,0.2); + } + + 25% { + text-shadow: 0 0 12px rgba(255,255,255,0.2),0 0 15px rgba(255,255,255,0.2),0 0 20px rgba(255,255,255,0.2),0 0 6px rgba(104,185,254,0.7),0 0 10px rgba(104,185,254,0.7); + } + + 50% { + text-shadow: 0 0 12px rgba(255,255,255,0.2),0 0 15px rgba(255,255,255,0.2),0 0 20px rgba(255,255,255,0.2),0 0 8px rgba(104,185,254,0.7),0 0 10px rgba(104,185,254,0.7),0 0 15px rgba(104,185,254,0.7); + } + + 75% { + text-shadow: 0 0 12px rgba(255,255,255,0.2),0 0 15px rgba(255,255,255,0.2),0 0 25px rgba(255,255,255,0.2),0 0 8px rgba(104,185,254,0.7),0 0 12px rgba(104,185,254,0.7),0 0 15px rgba(104,185,254,0.7),0 0 20px rgba(104,185,254,0.7); + } +} + +@-webkit-keyframes slide-in { + 0% { + -webkit-transform: translate(-100%, 0); + transform: translate(-100%, 0); + } + + 100% { + -webkit-transform: translate(0%, 0); + transform: translate(0%, 0); + } +} + +@keyframes slide-in { + 0% { + -webkit-transform: translate(-100%, 0); + transform: translate(-100%, 0); + } + + 100% { + -webkit-transform: translate(0%, 0); + transform: translate(0%, 0); + } +} + +@-webkit-keyframes slide-out { + 0% { + -webkit-transform: translate(0%, 0); + transform: translate(0%, 0); + } + + 100% { + -webkit-transform: translate(-100%, 0); + transform: translate(-100%, 0); + } +} + +@keyframes slide-out { + 100% { + -webkit-transform: translate(-100%, 0); + transform: translate(-100%, 0); + } +} + +svg { + background: white; + position: absolute; + left: 0; + cursor: -webkit-grab; + height: 100%; + width: 100%; + color: #333; +} + +.edge { + stroke-width: 2; + stroke: #ccc; + stroke-opacity: 0.2; +} + +.edge path { + fill: none; +} + +.edge .edge-handler { + stroke: transparent; + fill: none; +} + +.edge text { + display: none; + fill: white; + font-weight: 200; + text-anchor: middle; + z-index: 1000; + text-shadow: 1px 1px #333, -1px 1px #333, 1px -1px #333, -1px -1px #333; +} + +.edge.active { + opacity: 1; +} + +.edge.active text { + display: none; + fill: white; + font-weight: 200; + text-anchor: middle; + z-index: 1000; + text-shadow: 1px 1px #333, -1px 1px #333, 1px -1px #333, -1px -1px #333; +} + +.edge.active:hover, +.edge.active.selected { + cursor: pointer; +} + +.edge.active:hover .edge-line, +.edge.active.selected .edge-line { + stroke: #383838; + stroke-opacity: 1; + stroke-width: 4; +} + +.edge.active:hover text, +.edge.active.selected text { + display: block; +} + +.edge.active.highlight .edge-line { + opacity: .8 !important; + stroke-width: 2px; + stroke-opacity: .7; + stroke: red; +} + +.edge.inactive { + display: none; + opacity: 0; +} + +.edge.inactive.highlight { + opacity: .8 !important; + stroke-width: 2; + stroke-opacity: .5; + stroke: #68b9fe; +} + +#zoom-controls { + background-color: rgba(0,0,0,0.3); + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + box-shadow: 0 0 5px rgba(255,255,255,0.3); + margin-top: 10%; + z-index: 5; + position: relative; + display: block; + width: 55px; +} + +#zoom-controls #zoom-in, +#zoom-controls #zoom-out, +#zoom-controls #zoom-reset { + padding: 12px; + margin: 0; + width: 100%; +} + +#zoom-controls #zoom-in i, +#zoom-controls #zoom-out i, +#zoom-controls #zoom-reset i { + color: #E89619; +} + +#zoom-controls #zoom-in:hover, +#zoom-controls #zoom-out:hover, +#zoom-controls #zoom-reset:hover { + background-color: rgba(255,255,255,0.2); +} + +#zoom-controls #zoom-in:active, +#zoom-controls #zoom-out:active, +#zoom-controls #zoom-reset:active { + border: none; +} + +.fa-caret-right, +.fa-caret-down { + margin: 0 5px; + color: #68b9fe; +} + +#search { + margin-top: 2em; + margin-bottom: 1em; + padding: .5em 1em; + width: 100%; +} + +#search span { + vertical-align: bottom; +} + +#search input { + background-color: transparent; + border: thin dashed #68B9FE; + font-size: 20px; + padding-left: 0.5em; + margin-top: -1px; +} + +#search input::-webkit-input-placeholder { + color: white; +} + +#search input:-moz-placeholder { + color: white; +} + +#search input::-moz-placeholder { + color: white; +} + +#search input:-ms-input-placeholder { + color: white; +} + +#search .search-icon { + height: 22px; + background-color: transparent; + border: thin dashed #68B9FE; + color: white; +} + +#stats { + padding: 0.5em 1em; + background-color: transparent; + border-bottom: thin dashed #68b9fe; +} + +#stats #stats-header { + padding: 10px; +} + +#stats #all-stats { + color: white; + border-radius: none; + border: none; + background: transparent; + overflow: auto; +} + +#stats #all-stats li { + padding: 3px; +} + +#stats #node-stats-graph, +#stats #edge-stats-graph { + height: 250px; +} + +#stats #node-stats-graph svg, +#stats #edge-stats-graph svg { + opacity: .6; + background: transparent; +} + +#stats #node-stats-graph text, +#stats #edge-stats-graph text { + font-size: 16px; + fill: white; + font-weight: 200; + text-anchor: middle; + z-index: 1000; +} + +#stats #node-stats-graph .no-data, +#stats #edge-stats-graph .no-data { + margin: 30px 0; + color: #68b9fe; +} + +#stats .badge { + border-radius: 0; + height: 100%; + background-color: rgba(104,185,254,0.6); +} + +#editor { + padding: 0.5em 1em; + background-color: transparent; + border-bottom: thin dashed #68b9fe; +} + +#editor h3 { + padding: 10px; +} + +#editor #element-options { + display: -webkit-flex; + display: flex; + -webkit-flex-direction: column; + flex-direction: column; + cursor: pointer; + margin-top: 10px; + margin-left: 2%; + color: white; +} + +#editor #element-options .node-property, +#editor #element-options #node-add-property { + display: -webkit-inline-flex; + display: inline-flex; + margin: 4px 0; + width: 100%; +} + +#editor #element-options .property-value, +#editor #element-options #node-add-property #add-property #node-add-prop-value { + border: thin rgba(255,255,255,0.2) solid; + border-left: none; + background-color: black; + color: white; + width: 100%; + border-top-left-radius: 0; + border-bottom-left-radius: 0; +} + +#editor #element-options .property-name, +#editor #element-options #node-add-property #add-property #node-add-prop-key { + text-align: center; + font-weight: 200; + cursor: default; + background: #2E2E2E; + border: thin transparent solid; + color: #68b9fe; + border-right: none; + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +#editor #element-options #node-add-property #add-property { + display: -webkit-flex; + display: flex; + -webkit-flex-grow: 2; + flex-grow: 2; + -webkit-flex-direction: column; + flex-direction: column; +} + +#editor #element-options #node-add-property #add-property #node-add-prop-value { + text-align: center; + width: 100%; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-bottom-left-radius: 4px; + border: thin rgba(255,255,255,0.2) solid; +} + +#editor #element-options #node-add-property #add-property #node-add-prop-key { + cursor: text; + width: 100%; + border-top-left-radius: 4px; + border-bottom-left-radius: 0; +} + +#editor #element-options input[type="submit"], +#editor #element-options #update-properties { + color: #68b9fe; + border-top-right-radius: 4px; + border-bottom-right-radius: 4px; + width: auto; + background: rgba(255,255,255,0.1); + border: thin solid #68b9fe; + text-align: center; +} + +#editor #element-options input[type="submit"]:active, +#editor #element-options #update-properties:active, +#editor #element-options input[type="submit"]:focus, +#editor #element-options #update-properties:focus { + outline: none; +} + +#editor #element-options input[type="submit"]:hover, +#editor #element-options #update-properties:hover { + color: white; + border: thin solid white; +} + +#editor #element-options #update-properties { + border-radius: 4px; + padding: 10px; + width: 100%; + margin-bottom: 20px; +} + +#editor #editor-interactions.active { + color: #68b9fe; +} + +#editor #editor-interactions.inactive { + color: white; +} + +#editor #node-editor.enabled { + -webkit-animation: fadeIn 1s linear; + animation: fadeIn 1s linear; +} + +#control-dash-wrapper { + font-family: 'Source Sans Pro', Helvetica, sans-serif; + letter-spacing: .05em; + height: inherit; + z-index: inherit; + padding: 0; +} + +#control-dash-wrapper.initial { + -webkit-transform: translate(-100%, 0); + transform: translate(-100%, 0); +} + +#control-dash-wrapper.initial #dash-toggle { + color: #68b9fe; + -webkit-animation: 4s pulse linear; + animation: 4s pulse linear; +} + +#control-dash-wrapper.off-canvas { + -webkit-transform: translate(-100%, 0); + transform: translate(-100%, 0); + -webkit-animation: slide-out .75s linear; + animation: slide-out .75s linear; +} + +#control-dash-wrapper.off-canvas #dash-toggle { + color: #68b9fe; + -webkit-animation: 4s pulse linear; + animation: 4s pulse linear; +} + +#control-dash-wrapper.on-canvas { + -webkit-animation: slide-in .75s ease-in-out; + animation: slide-in .75s ease-in-out; +} + +#control-dash-wrapper.on-canvas * { + box-shadow: none !important; +} + +#control-dash-wrapper.on-canvas #dash-toggle { + color: rgba(104,185,254,0.6); +} + +#control-dash-wrapper.on-canvas #dash-toggle:hover { + color: #68b9fe; + -webkit-animation: 4s pulse linear; + animation: 4s pulse linear; +} + +#control-dash-wrapper #control-dash { + overflow-x: hidden; + overflow-y: scroll; + background-color: rgba(0,0,0,0.3); + padding: 0; + height: inherit; + z-index: 5; +} + +#control-dash-wrapper #control-dash h3 { + display: inline; + margin: 0; +} + +#control-dash-wrapper #dash-toggle { + z-index: 5; + background-color: rgba(0,0,0,0.3); + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; + box-shadow: 0 0 5px rgba(255,255,255,0.3); + position: absolute; + left: 0; + top: 50%; + font-size: 2.2em; + color: rgba(255,255,255,0.2); + padding: 10px; +} + +#control-dash-wrapper button { + border-radius: 0; + border: none; + background-color: transparent; +} + +#control-dash-wrapper button:active { + border: none; +} + +#control-dash-wrapper h3 { + font-weight: 200; + margin-top: 10px; + color: white; + cursor: pointer; + vertical-align: top; +} + +#control-dash-wrapper li { + cursor: pointer; + background: transparent; + border: none; + border-radius: 0; +} + +.node { + cursor: pointer; +} + +.node circle { + fill: #68b9fe; + fill-opacity: 0.8; + stroke: #127dc1; + stroke-opacity: 1; +} + +.node circle.root { + fill: #9000ff; + stroke: #90c73d; +} + +.node text.root { + font-size: 32px; +} + +.node text { + display: none; + fill: white; + font-weight: 200; + text-anchor: middle; + z-index: 1000; + text-shadow: 1px 1px #333, -1px 1px #333, 1px -1px #333, -1px -1px #333; +} + +.node.active { + opacity: 1; + fill: white; +} + +.node.active.highlight { + opacity: .8 !important; +} + +.node.active.highlight circle { + fill-opacity: 1; + stroke: #015399; + stroke-width: 3px; + fill: white; +} + +.node.active.selected circle { + stroke-width: 5px; + fill-opacity: .8; + stroke-opacity: 1; + stroke: white; + fill: #68b9fe; +} + +.node.active.selected text { + display: block; +} + +.node.active.selected:hover circle { + stroke-width: 5px; + fill-opacity: .8; + stroke-opacity: 1; + stroke: white; + fill: white; +} + +.node.active:hover circle { + stroke-width: 3px; + fill-opacity: .8; + stroke-opacity: 1; + stroke: #015399; + fill: #9bd0fe; +} + +.node.active:hover text { + display: block; +} + +.node.inactive { + opacity: 0; +} + +.node.inactive.highlight { + opacity: .8 !important; +} + +.node.inactive.highlight circle { + fill-opacity: 1; + stroke: #68b9fe; + stroke-width: 2px; + fill: white; +} + +#loading-spinner { + position: absolute; + right: 0; +} + +#filters { + padding: 0.5em 1em; + background-color: transparent; + border-bottom: thin dashed #68b9fe; + color: white; +} + +#filters form { + width: 100%; +} + +#filters #filter-header { + padding: 10px; +} + +#filters #filter-relationships, +#filters #filter-nodes { + background-color: transparent; + display: inline-block; + width: 45%; + margin-left: 2%; + overflow: auto; + text-align: center; + vertical-align: top; +} + +#filters #filter-relationships #filter-node-header, +#filters #filter-relationships #filter-rel-header, +#filters #filter-nodes #filter-node-header, +#filters #filter-nodes #filter-rel-header { + margin: 10px 0; + cursor: pointer; + background-color: transparent; + border: none; + border-radius: 0; + width: 100%; +} + +#filters #filter-relationships #filter-node-header h4, +#filters #filter-relationships #filter-rel-header h4, +#filters #filter-nodes #filter-node-header h4, +#filters #filter-nodes #filter-rel-header h4 { + font-weight: 200; + display: inline; + color: white; +} + +#filters #filter-relationships #filter-node-header:active, +#filters #filter-relationships #filter-rel-header:active, +#filters #filter-nodes #filter-node-header:active, +#filters #filter-nodes #filter-rel-header:active { + border: none; + box-shadow: none; +} + +#filters #filter-relationships #rel-dropdown, +#filters #filter-relationships #node-dropdown, +#filters #filter-nodes #rel-dropdown, +#filters #filter-nodes #node-dropdown { + margin: 20px 0; + border-radius: none; + border: none; + background: transparent; +} + +#filters #filter-relationships #rel-dropdown li, +#filters #filter-relationships #node-dropdown li, +#filters #filter-nodes #rel-dropdown li, +#filters #filter-nodes #node-dropdown li { + padding: 5px; +} + +#filters #filter-relationships #rel-dropdown li:hover, +#filters #filter-relationships #node-dropdown li:hover, +#filters #filter-nodes #rel-dropdown li:hover, +#filters #filter-nodes #node-dropdown li:hover { + background-color: rgba(255,255,255,0.2); +} + +#filters .disabled { + color: rgba(255,255,255,0.5); +} + +#filters .disabled:hover { + color: #68b9fe; +} + +.alchemy { + position: relative; +} + +.alchemy #search form { + z-index: 2; + display: inline; + margin-left: 100px; +} + +.alchemy #add-tag { + width: 300px; + display: inline-block; +} + +.alchemy #tags input { + max-width: 220px; +} + +.alchemy #tags-list { + padding: 0; +} + +.alchemy #tags-list .icon-remove-sign { + cursor: pointer; +} + +.alchemy #tags-list li { + display: inline-block; + margin-top: 5px; +} + +.alchemy #tags-list span { + background-color: #ccc; + color: #333; + border-radius: 10em; + display: inline-block; + padding: 1px 6px; +} + +.alchemy #filter-nodes label, +.alchemy #filter-relationships label { + font-weight: normal; + margin-right: 1em; +} + +.alchemy .clear { + clear: both; +} + +.alchemy text { + font-weight: 200; + text-anchor: middle; +} \ No newline at end of file diff --git a/dist/alchemy.css b/dist/alchemy.css index 0106e2c..4df3a8d 100644 --- a/dist/alchemy.css +++ b/dist/alchemy.css @@ -653,6 +653,28 @@ defs #arrow path { border-radius: 0; } +#clustering { + padding: 0.5em 1em; + cursor: pointer; + color: white; + border-bottom: thin dashed #E89619; +} + +#clustering #cluster_control_header, +#clustering #cluster-key-container { + padding: 10px 10px 0 10px; +} + +#clustering #cluster-key { + color: #333; + background-color: #000; + border-radius: 4px; + border: thin solid #333; + text-align: center; + display: inline-block; + width: 100%; +} + #filters { padding: 0.5em 1em; background-color: transparent; diff --git a/dist/alchemy.js b/dist/alchemy.js index 7df879f..619aa00 100644 --- a/dist/alchemy.js +++ b/dist/alchemy.js @@ -13,7 +13,7 @@ this.begin = __bind(this.begin, this); this.setState = __bind(this.setState, this); this.getState = __bind(this.getState, this); - this.version = "0.2.0"; + this.version = "0.2.1"; this.layout = {}; this.interactions = {}; this.utils = {}; @@ -231,19 +231,24 @@ alchemy.clusterControls = { init: function() { var changeClusterHTML; - changeClusterHTML = "

Cluster By:

\n"; - d3.select("#clustering-container").append("div").attr("id", "cluster-key-container").html(changeClusterHTML).style("display", "none"); + changeClusterHTML = ""; + d3.select("#clustering-container").append("div").attr("id", "cluster-key-container").attr('class', 'property form-inline form-group').html(changeClusterHTML).style("display", "none"); d3.select("#cluster_control_header").on("click", function() { var display, element; element = d3.select("#cluster-key-container"); display = element.style("display"); - return element.style("display", function(e) { + element.style("display", function(e) { if (display === "block") { return "none"; } else { return "block"; } }); + if (d3.select("#cluster-key-container").style("display") === "none") { + return d3.select("#cluster-arrow").attr("class", "fa fa-2x fa-caret-right"); + } else { + return d3.select("#cluster-arrow").attr("class", "fa fa-2x fa-caret-down"); + } }); return d3.select("#cluster-key").on("keydown", function() { if (d3.event.keyIdentifier === "Enter") { @@ -261,7 +266,7 @@ alchemy.controlDash = { init: function() { var divSelector; - if (alchemy.conf.showControlDash === true) { + if (this.dashIsShown()) { divSelector = alchemy.conf.divSelector; d3.select("" + divSelector).append("div").attr("id", "control-dash-wrapper").attr("class", "col-md-4 initial"); d3.select("#control-dash-wrapper").append("i").attr("id", "dash-toggle").attr("class", "fa fa-flask col-md-offset-12"); @@ -295,14 +300,14 @@ } }, filters: function() { - if (alchemy.conf.showFilters) { + if (alchemy.conf.nodeFilters || alchemy.conf.edgeFilters) { d3.select("#control-dash").append("div").attr("id", "filters"); return alchemy.filters.init(); } }, stats: function() { var stats_html; - if (alchemy.conf.showStats) { + if (alchemy.conf.nodeStats || alchemy.conf.edgeStats) { stats_html = "
\n

\n Statistics\n

\n\n
\n
\n \n \n
"; d3.select("#control-dash").append("div").attr("id", "stats").html(stats_html).select('#stats-header').on('click', function() { if (d3.select('#all-stats').classed("in")) { @@ -317,10 +322,15 @@ clustering: function() { var clusterControl_html; if (alchemy.conf.clusterControl) { - clusterControl_html = "
\n
\n

\n Clustering\n

\n \n
\n
"; + clusterControl_html = "
\n
\n

Clustering

\n \n
\n
"; d3.select("#control-dash").append("div").attr("id", "clustering").html(clusterControl_html).select('#cluster_control_header'); return alchemy.clusterControls.init(); } + }, + dashIsShown: function() { + var conf; + conf = alchemy.conf; + return conf.showEditor || conf.captionToggle || conf.toggleRootNodes || conf.removeElement || conf.clusterControl || conf.nodeStats || conf.edgeStats || conf.edgeFilters || conf.nodeFilters || conf.edgesToggle || conf.nodesToggle || conf.search; } }; @@ -382,7 +392,7 @@ }, show: function() { var filter_html; - filter_html = "
\n

\n Filters\n

\n \n
\n
\n
"; + filter_html = "
\n

Filters

\n \n
\n
\n
"; d3.select('#control-dash #filters').html(filter_html); d3.selectAll('#filter-header').on('click', function() { if (d3.select('#filters>form').classed("in")) { @@ -976,7 +986,7 @@ defs = d3.select("" + alchemy.conf.divSelector + " svg").append("svg:defs"); } if (conf.directedEdges) { - arrowSize = conf.edgeArrowSize; + arrowSize = conf.edgeArrowSize + (conf.edgeWidth() * 2); marker = defs.append("svg:marker").attr("id", "arrow").attr("viewBox", "0 -" + (arrowSize * 0.4) + " " + arrowSize + " " + arrowSize).attr('markerUnits', 'userSpaceOnUse').attr("markerWidth", arrowSize).attr("markerHeight", arrowSize).attr("orient", "auto"); marker.append("svg:path").attr("d", "M " + arrowSize + ",0 L 0," + (arrowSize * 0.4) + " L 0,-" + (arrowSize * 0.4)); if (conf.curvedEdges) { @@ -1180,17 +1190,14 @@ captionToggle: false, toggleRootNodes: false, removeElement: false, - showControlDash: false, cluster: false, clusterKey: "cluster", clusterColours: d3.shuffle(["#DD79FF", "#FFFC00", "#00FF30", "#5168FF", "#00C0FF", "#FF004B", "#00CDCD", "#f83f00", "#f800df", "#ff8d8f", "#ffcd00", "#184fff", "#ff7e00"]), clusterControl: true, - showStats: false, nodeStats: false, edgeStats: false, - showFilters: false, - edgeFilters: false, - nodeFilters: false, + edgeFilters: true, + nodeFilters: true, edgesToggle: false, nodesToggle: false, zoomControls: false, @@ -1209,11 +1216,13 @@ }, edgeTypes: null, curvedEdges: false, - edgeWidth: 4, + edgeWidth: function(d) { + return 4; + }, edgeOverlayWidth: 20, directedEdges: false, edgeArrowSize: 5, - search: true, + search: false, searchMethod: "contains", afterLoad: 'afterLoad', divSelector: '#alchemy', @@ -1260,7 +1269,11 @@ } else { edge.append('line').attr('class', 'edge-line').attr('shape-rendering', 'optimizeSpeed').style('stroke', function(d) { return utils.edgeStyle(d); - }).style('stroke-width', conf.edgeWidth); + }).style('stroke-width', function(d) { + var edgeProperties; + edgeProperties = alchemy._edges[d.id].properties; + return alchemy.conf.edgeWidth(edgeProperties); + }); edge.filter(function(d) { return d.caption != null; }).append('text'); @@ -1274,7 +1287,19 @@ utils = this.utils; if (this.curved) { edge.selectAll('path').attr('d', function(d) { - var dx, dy, endLine, hyp, sourceX, sourceY, startLine, targetX, targetY; + var angle, arrowX, arrowY, dx, dy, endLine, hyp, offsetX, offsetY, sideOfX, sideOfY, sourceX, sourceY, startLine, targetX, targetY; + angle = utils.edgeAngle(d); + sideOfY = Math.abs(angle) > 90 ? -1 : 1; + sideOfX = (function(angle) { + if (angle !== 0) { + if (angle < 0) { + return -1; + } else { + return 1; + } + } + return 0; + })(angle); startLine = utils.startLine(d); endLine = utils.endLine(d); sourceX = startLine.x; @@ -1284,7 +1309,11 @@ dx = targetX - sourceX; dy = targetY - sourceY; hyp = Math.sqrt(dx * dx + dy * dy); - return "M " + sourceX + "," + sourceY + " A " + hyp + ", " + hyp + " " + (utils.captionAngle(d)) + " 0, 1 " + targetX + ", " + targetY; + offsetX = (dx * alchemy.conf.nodeRadius + 2) / hyp; + offsetY = (dy * alchemy.conf.nodeRadius + 2) / hyp; + arrowX = (-sideOfX * conf.edgeArrowSize) + offsetX; + arrowY = (sideOfY * conf.edgeArrowSize) + offsetY; + return "M " + (sourceX - offsetX) + "," + (sourceY - offsetY) + " A " + hyp + ", " + hyp + " " + (utils.edgeAngle(d)) + " 0, 1 " + (targetX - arrowX) + ", " + (targetY - arrowY); }); edge.select('path.edge-line').style('stroke', function(d) { return utils.edgeStyle(d); @@ -1584,18 +1613,11 @@ y: edge.source.y + height * distance / hyp }; } else if (point === 'linkStart') { - if (conf.curvedEdges) { - return { - x: edge.source.x, - y: edge.source.y - }; - } else { - distance = edge.source.r + edge.source['stroke-width']; - return { - x: edge.source.x + width * distance / hyp, - y: edge.source.y + height * distance / hyp - }; - } + distance = edge.source.r + edge.source['stroke-width']; + return { + x: edge.source.x + width * distance / hyp, + y: edge.source.y + height * distance / hyp + }; } else if (point === 'linkEnd') { if (conf.curvedEdges) { distance = hyp; diff --git a/dist/alchemy.min.css b/dist/alchemy.min.css index fdc8f05..c929d6f 100644 --- a/dist/alchemy.min.css +++ b/dist/alchemy.min.css @@ -1 +1 @@ -@-webkit-keyframes fadeIn{0%{opacity:0}25%{opacity:.3}50%{opacity:.66}75%{opacity:1}}@keyframes fadeIn{0%{opacity:0}25%{opacity:.3}50%{opacity:.66}75%{opacity:1}}@-webkit-keyframes pulse{0%{text-shadow:0 0 10px rgba(255,255,255,.2),0 0 12px rgba(255,255,255,.2),0 0 16px rgba(255,255,255,.2)}25%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 6px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7)}50%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7)}75%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 25px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 12px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7),0 0 20px rgba(104,185,254,.7)}}@keyframes pulse{0%{text-shadow:0 0 10px rgba(255,255,255,.2),0 0 12px rgba(255,255,255,.2),0 0 16px rgba(255,255,255,.2)}25%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 6px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7)}50%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7)}75%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 25px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 12px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7),0 0 20px rgba(104,185,254,.7)}}@-webkit-keyframes slide-in{0%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}100%{-webkit-transform:translate(0%,0);transform:translate(0%,0)}}@keyframes slide-in{0%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}100%{-webkit-transform:translate(0%,0);transform:translate(0%,0)}}@-webkit-keyframes slide-out{0%{-webkit-transform:translate(0%,0);transform:translate(0%,0)}100%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}}@keyframes slide-out{100%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}}svg{background:#000;position:absolute;left:0;cursor:-webkit-grab;height:100%;width:100%;color:#333}.node{cursor:pointer}.node circle{fill:#68b9fe;fill-opacity:.8;stroke:#127dc1;stroke-opacity:1}.node circle.root{fill:#9000ff;stroke:#90c73d}.node text.root{font-size:32px}.node text{display:none;fill:#fff;font-weight:200;text-anchor:middle;z-index:1000;text-shadow:1px 1px #333,-1px 1px #333,1px -1px #333,-1px -1px #333}.node.active{opacity:1;fill:#fff}.node.active.highlight{opacity:.8!important}.node.active.highlight circle{fill-opacity:1;stroke:#015399;stroke-width:3px;fill:#fff}.node.active.selected circle{stroke-width:5px;fill-opacity:.8;stroke-opacity:1;stroke:#fff;fill:#68b9fe}.node.active.selected text{display:block}.node.active.selected:hover circle{stroke-width:5px;fill-opacity:.8;stroke-opacity:1;stroke:#fff;fill:#fff}.node.active:hover circle{stroke-width:3px;fill-opacity:.8;stroke-opacity:1;stroke:#015399;fill:#9bd0fe}.node.active:hover text{display:block}.node.inactive{opacity:0}.node.inactive.highlight{opacity:.8!important}.node.inactive.highlight circle{fill-opacity:1;stroke:#e89619;stroke-width:2px;fill:#fff}defs #arrow path{stroke:#CCC;stroke-opacity:.2;fill:#CCC;opacity:1}.edge{stroke-width:2;stroke:#ccc;stroke-opacity:.2}.edge text{stroke-width:0}.edge .edge-handler{fill:none;stroke:none}.edge .edge-line{fill:none}.edge.active{opacity:1}.edge.active text{display:none;fill:#fff;font-weight:200;text-anchor:middle;z-index:1000}.edge.active.selected,.edge.active:hover{cursor:pointer}.edge.active.selected .edge-line,.edge.active:hover .edge-line{stroke:#fff!important;stroke-opacity:1;stroke-width:4}.edge.active.selected text,.edge.active:hover text{display:block}.edge.active.highlight{opacity:.8!important;stroke-width:2;stroke:#fff!important;stroke-opacity:1}.edge.active.highlight text{display:block}.edge.inactive{display:none;opacity:0}.edge.inactive.highlight{opacity:.8!important;stroke-width:2;stroke-opacity:.5;stroke:#e89619}#loading-spinner{position:absolute;right:0}#zoom-controls{background-color:transparent;background-image:url(images/maze-black.png);border-top-right-radius:3px;border-bottom-right-radius:3px;box-shadow:0 0 5px rgba(255,255,255,.3);margin-top:10%;z-index:5;position:relative;display:block;width:55px}#zoom-controls #zoom-in,#zoom-controls #zoom-out,#zoom-controls #zoom-reset{padding:12px;margin:0;width:100%}#zoom-controls #zoom-in i,#zoom-controls #zoom-out i,#zoom-controls #zoom-reset i{color:#E89619}#zoom-controls #zoom-in:hover,#zoom-controls #zoom-out:hover,#zoom-controls #zoom-reset:hover{background-color:rgba(255,255,255,.2)}#zoom-controls #zoom-in:active,#zoom-controls #zoom-out:active,#zoom-controls #zoom-reset:active{border:0}.fa-caret-down,.fa-caret-right,.fa-search{margin:0 5px;color:#e89619}#search{margin-top:2em;margin-bottom:1em;padding:.5em 1em;width:100%}#search span{vertical-align:bottom}#search input{background-color:#000;border:0;font-size:20px;color:#fff;padding-left:.5em}#search .search-icon{height:22px;background-color:#000;border-color:#000;border-right-color:#111}#stats{padding:.5em 1em;background-color:transparent;border-bottom:thin dashed #e89619}#stats #stats-header{padding:10px}#stats #all-stats{color:#fff;border-radius:none;border:0;background:0 0;overflow:auto}#stats #all-stats li{padding:3px}#stats #edge-stats-graph,#stats #node-stats-graph{height:250px}#stats #edge-stats-graph svg,#stats #node-stats-graph svg{opacity:.6;background:0 0}#stats #edge-stats-graph text,#stats #node-stats-graph text{font-size:16px;fill:#fff;font-weight:200;text-anchor:middle;z-index:1000}#stats #edge-stats-graph .no-data,#stats #node-stats-graph .no-data{margin:30px 0;color:#e89619}#stats .badge{border-radius:0;height:100%;background-color:rgba(104,185,254,.6)}#editor{padding:.5em 1em;background-color:transparent;border-bottom:thin dashed #e89619}#editor h3{padding:10px}#editor #element-options{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;cursor:pointer;margin-top:10px;margin-left:2%;color:#fff}#editor #element-options #add-property-form,#editor #element-options .property{display:-webkit-inline-flex;display:inline-flex;margin:4px 0;width:100%}#editor #element-options #add-property-form #add-property #add-prop-value,#editor #element-options .property-value{border:thin rgba(255,255,255,.2) solid;border-left:0;background-color:#000;color:#fff;width:100%;border-top-left-radius:0;border-bottom-left-radius:0}#editor #element-options #add-property-form #add-property #add-prop-key,#editor #element-options .property-name{text-align:center;font-weight:200;cursor:default;background:#2E2E2E;border:thin transparent solid;color:#e89619;border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}#editor #element-options #update-properties,#editor #element-options input[type=submit]{color:#e89619;border-top-right-radius:4px;border-bottom-right-radius:4px;width:auto;background:rgba(255,255,255,.1);border:thin solid #e89619;text-align:center}#editor #element-options #update-properties:active,#editor #element-options #update-properties:focus,#editor #element-options input[type=submit]:active,#editor #element-options input[type=submit]:focus{outline:0}#editor #element-options #update-properties:hover,#editor #element-options input[type=submit]:hover{color:#fff;border:thin solid #fff}#editor #element-options #update-properties{border-radius:4px;padding:10px;width:100%;margin-bottom:20px}#editor #element-options #add-property-form #add-property{display:-webkit-flex;display:flex;-webkit-flex-grow:2;flex-grow:2;-webkit-flex-direction:column;flex-direction:column}#editor #element-options #add-property-form #add-property #add-prop-value{text-align:center;width:100%;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border:thin rgba(255,255,255,.2) solid}#editor #element-options #add-property-form #add-property #add-prop-key{cursor:text;width:100%;border-top-left-radius:4px;border-bottom-left-radius:0}#editor #editor-interactions.active{color:#e89619}#editor #editor-interactions.inactive{color:#fff}#editor #edge-editor.enabled,#editor #node-editor.enabled{-webkit-animation:fadeIn 1s linear;animation:fadeIn 1s linear}#control-dash-wrapper{font-family:'Source Sans Pro',Helvetica,sans-serif;letter-spacing:.05em;height:inherit;z-index:inherit;padding:0}#control-dash-wrapper.initial{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}#control-dash-wrapper.initial #dash-toggle{color:#e89619;-webkit-animation:4s pulse linear;animation:4s pulse linear}#control-dash-wrapper.off-canvas{-webkit-transform:translate(-100%,0);transform:translate(-100%,0);-webkit-animation:slide-out .75s linear;animation:slide-out .75s linear}#control-dash-wrapper.off-canvas #dash-toggle{color:#e89619;-webkit-animation:4s pulse linear;animation:4s pulse linear}#control-dash-wrapper.on-canvas{-webkit-animation:slide-in .75s ease-in-out;animation:slide-in .75s ease-in-out}#control-dash-wrapper.on-canvas *{box-shadow:none!important}#control-dash-wrapper.on-canvas #dash-toggle{color:rgba(232,150,25,.6)}#control-dash-wrapper.on-canvas #dash-toggle:hover{color:#e89619;-webkit-animation:4s pulse linear;animation:4s pulse linear}#control-dash-wrapper #control-dash{overflow-x:hidden;overflow-y:scroll;background-color:transparent;background-image:url(images/maze-black.png);padding:0;height:inherit;z-index:5}#control-dash-wrapper #control-dash h3{display:inline;margin:0}#control-dash-wrapper #dash-toggle{z-index:5;background-color:transparent;background-image:url(images/maze-black.png);border-top-right-radius:3px;border-bottom-right-radius:3px;box-shadow:0 0 5px rgba(255,255,255,.3);position:absolute;left:0;top:50%;font-size:2.2em;color:rgba(255,255,255,.2);padding:10px}#control-dash-wrapper button{border-radius:0;border:0;background-color:transparent}#control-dash-wrapper button:active{border:0}#control-dash-wrapper h3{font-weight:200;margin-top:10px;color:#fff;cursor:pointer;vertical-align:top}#control-dash-wrapper li{cursor:pointer;background:0 0;border:0;border-radius:0}#filters{padding:.5em 1em;background-color:transparent;border-bottom:thin dashed #e89619;color:#fff}#filters form{width:100%}#filters #filter-header{padding:10px}#filters #filter-nodes,#filters #filter-relationships{background-color:transparent;display:inline-block;width:45%;margin-left:2%;overflow:auto;text-align:center;vertical-align:top}#filters #filter-nodes #filter-node-header,#filters #filter-nodes #filter-rel-header,#filters #filter-relationships #filter-node-header,#filters #filter-relationships #filter-rel-header{margin:10px 0;cursor:pointer;background-color:transparent;border:0;border-radius:0;width:100%}#filters #filter-nodes #filter-node-header h4,#filters #filter-nodes #filter-rel-header h4,#filters #filter-relationships #filter-node-header h4,#filters #filter-relationships #filter-rel-header h4{font-weight:200;display:inline;color:#fff}#filters #filter-nodes #filter-node-header:active,#filters #filter-nodes #filter-rel-header:active,#filters #filter-relationships #filter-node-header:active,#filters #filter-relationships #filter-rel-header:active{border:0;box-shadow:none}#filters #filter-nodes #node-dropdown,#filters #filter-nodes #rel-dropdown,#filters #filter-relationships #node-dropdown,#filters #filter-relationships #rel-dropdown{margin:20px 0;border-radius:none;border:0;background:0 0}#filters #filter-nodes #node-dropdown li,#filters #filter-nodes #rel-dropdown li,#filters #filter-relationships #node-dropdown li,#filters #filter-relationships #rel-dropdown li{padding:5px}#filters #filter-nodes #node-dropdown li:hover,#filters #filter-nodes #rel-dropdown li:hover,#filters #filter-relationships #node-dropdown li:hover,#filters #filter-relationships #rel-dropdown li:hover{background-color:rgba(255,255,255,.2)}#filters .disabled{color:rgba(255,255,255,.5)}#filters .disabled:hover{color:#fdc670}.alchemy{position:relative}.alchemy #search form{z-index:2;display:inline;margin-left:100px}.alchemy #add-tag{width:300px;display:inline-block}.alchemy #tags input{max-width:220px}.alchemy #tags-list{padding:0}.alchemy #tags-list .icon-remove-sign{cursor:pointer}.alchemy #tags-list li{display:inline-block;margin-top:5px}.alchemy #tags-list span{background-color:#ccc;color:#333;border-radius:10em;display:inline-block;padding:1px 6px}.alchemy #filter-nodes label,.alchemy #filter-relationships label{font-weight:400;margin-right:1em}.alchemy .clear{clear:both}.alchemy text{font-weight:200;text-anchor:middle} \ No newline at end of file +@-webkit-keyframes fadeIn{0%{opacity:0}25%{opacity:.3}50%{opacity:.66}75%{opacity:1}}@keyframes fadeIn{0%{opacity:0}25%{opacity:.3}50%{opacity:.66}75%{opacity:1}}@-webkit-keyframes pulse{0%{text-shadow:0 0 10px rgba(255,255,255,.2),0 0 12px rgba(255,255,255,.2),0 0 16px rgba(255,255,255,.2)}25%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 6px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7)}50%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7)}75%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 25px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 12px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7),0 0 20px rgba(104,185,254,.7)}}@keyframes pulse{0%{text-shadow:0 0 10px rgba(255,255,255,.2),0 0 12px rgba(255,255,255,.2),0 0 16px rgba(255,255,255,.2)}25%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 6px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7)}50%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 20px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 10px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7)}75%{text-shadow:0 0 12px rgba(255,255,255,.2),0 0 15px rgba(255,255,255,.2),0 0 25px rgba(255,255,255,.2),0 0 8px rgba(104,185,254,.7),0 0 12px rgba(104,185,254,.7),0 0 15px rgba(104,185,254,.7),0 0 20px rgba(104,185,254,.7)}}@-webkit-keyframes slide-in{0%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}100%{-webkit-transform:translate(0%,0);transform:translate(0%,0)}}@keyframes slide-in{0%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}100%{-webkit-transform:translate(0%,0);transform:translate(0%,0)}}@-webkit-keyframes slide-out{0%{-webkit-transform:translate(0%,0);transform:translate(0%,0)}100%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}}@keyframes slide-out{100%{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}}svg{background:#000;position:absolute;left:0;cursor:-webkit-grab;height:100%;width:100%;color:#333}.node{cursor:pointer}.node circle{fill:#68b9fe;fill-opacity:.8;stroke:#127dc1;stroke-opacity:1}.node circle.root{fill:#9000ff;stroke:#90c73d}.node text.root{font-size:32px}.node text{display:none;fill:#fff;font-weight:200;text-anchor:middle;z-index:1000;text-shadow:1px 1px #333,-1px 1px #333,1px -1px #333,-1px -1px #333}.node.active{opacity:1;fill:#fff}.node.active.highlight{opacity:.8!important}.node.active.highlight circle{fill-opacity:1;stroke:#015399;stroke-width:3px;fill:#fff}.node.active.selected circle{stroke-width:5px;fill-opacity:.8;stroke-opacity:1;stroke:#fff;fill:#68b9fe}.node.active.selected text{display:block}.node.active.selected:hover circle{stroke-width:5px;fill-opacity:.8;stroke-opacity:1;stroke:#fff;fill:#fff}.node.active:hover circle{stroke-width:3px;fill-opacity:.8;stroke-opacity:1;stroke:#015399;fill:#9bd0fe}.node.active:hover text{display:block}.node.inactive{opacity:0}.node.inactive.highlight{opacity:.8!important}.node.inactive.highlight circle{fill-opacity:1;stroke:#e89619;stroke-width:2px;fill:#fff}defs #arrow path{stroke:#CCC;stroke-opacity:.2;fill:#CCC;opacity:1}.edge{stroke-width:2;stroke:#ccc;stroke-opacity:.2}.edge text{stroke-width:0}.edge .edge-handler{fill:none;stroke:none}.edge .edge-line{fill:none}.edge.active{opacity:1}.edge.active text{display:none;fill:#fff;font-weight:200;text-anchor:middle;z-index:1000}.edge.active.selected,.edge.active:hover{cursor:pointer}.edge.active.selected .edge-line,.edge.active:hover .edge-line{stroke:#fff!important;stroke-opacity:1;stroke-width:4}.edge.active.selected text,.edge.active:hover text{display:block}.edge.active.highlight{opacity:.8!important;stroke-width:2;stroke:#fff!important;stroke-opacity:1}.edge.active.highlight text{display:block}.edge.inactive{display:none;opacity:0}.edge.inactive.highlight{opacity:.8!important;stroke-width:2;stroke-opacity:.5;stroke:#e89619}#loading-spinner{position:absolute;right:0}#zoom-controls{background-color:transparent;background-image:url(images/maze-black.png);border-top-right-radius:3px;border-bottom-right-radius:3px;box-shadow:0 0 5px rgba(255,255,255,.3);margin-top:10%;z-index:5;position:relative;display:block;width:55px}#zoom-controls #zoom-in,#zoom-controls #zoom-out,#zoom-controls #zoom-reset{padding:12px;margin:0;width:100%}#zoom-controls #zoom-in i,#zoom-controls #zoom-out i,#zoom-controls #zoom-reset i{color:#E89619}#zoom-controls #zoom-in:hover,#zoom-controls #zoom-out:hover,#zoom-controls #zoom-reset:hover{background-color:rgba(255,255,255,.2)}#zoom-controls #zoom-in:active,#zoom-controls #zoom-out:active,#zoom-controls #zoom-reset:active{border:0}.fa-caret-down,.fa-caret-right,.fa-search{margin:0 5px;color:#e89619}#search{margin-top:2em;margin-bottom:1em;padding:.5em 1em;width:100%}#search span{vertical-align:bottom}#search input{background-color:#000;border:0;font-size:20px;color:#fff;padding-left:.5em}#search .search-icon{height:22px;background-color:#000;border-color:#000;border-right-color:#111}#stats{padding:.5em 1em;background-color:transparent;border-bottom:thin dashed #e89619}#stats #stats-header{padding:10px}#stats #all-stats{color:#fff;border-radius:none;border:0;background:0 0;overflow:auto}#stats #all-stats li{padding:3px}#stats #edge-stats-graph,#stats #node-stats-graph{height:250px}#stats #edge-stats-graph svg,#stats #node-stats-graph svg{opacity:.6;background:0 0}#stats #edge-stats-graph text,#stats #node-stats-graph text{font-size:16px;fill:#fff;font-weight:200;text-anchor:middle;z-index:1000}#stats #edge-stats-graph .no-data,#stats #node-stats-graph .no-data{margin:30px 0;color:#e89619}#stats .badge{border-radius:0;height:100%;background-color:rgba(104,185,254,.6)}#editor{padding:.5em 1em;background-color:transparent;border-bottom:thin dashed #e89619}#editor h3{padding:10px}#editor #element-options{display:-webkit-flex;display:flex;-webkit-flex-direction:column;flex-direction:column;cursor:pointer;margin-top:10px;margin-left:2%;color:#fff}#editor #element-options #add-property-form,#editor #element-options .property{display:-webkit-inline-flex;display:inline-flex;margin:4px 0;width:100%}#editor #element-options #add-property-form #add-property #add-prop-value,#editor #element-options .property-value{border:thin rgba(255,255,255,.2) solid;border-left:0;background-color:#000;color:#fff;width:100%;border-top-left-radius:0;border-bottom-left-radius:0}#editor #element-options #add-property-form #add-property #add-prop-key,#editor #element-options .property-name{text-align:center;font-weight:200;cursor:default;background:#2E2E2E;border:thin transparent solid;color:#e89619;border-right:0;border-top-right-radius:0;border-bottom-right-radius:0}#editor #element-options #update-properties,#editor #element-options input[type=submit]{color:#e89619;border-top-right-radius:4px;border-bottom-right-radius:4px;width:auto;background:rgba(255,255,255,.1);border:thin solid #e89619;text-align:center}#editor #element-options #update-properties:active,#editor #element-options #update-properties:focus,#editor #element-options input[type=submit]:active,#editor #element-options input[type=submit]:focus{outline:0}#editor #element-options #update-properties:hover,#editor #element-options input[type=submit]:hover{color:#fff;border:thin solid #fff}#editor #element-options #update-properties{border-radius:4px;padding:10px;width:100%;margin-bottom:20px}#editor #element-options #add-property-form #add-property{display:-webkit-flex;display:flex;-webkit-flex-grow:2;flex-grow:2;-webkit-flex-direction:column;flex-direction:column}#editor #element-options #add-property-form #add-property #add-prop-value{text-align:center;width:100%;border-top-right-radius:0;border-bottom-right-radius:0;border-bottom-left-radius:4px;border:thin rgba(255,255,255,.2) solid}#editor #element-options #add-property-form #add-property #add-prop-key{cursor:text;width:100%;border-top-left-radius:4px;border-bottom-left-radius:0}#editor #editor-interactions.active{color:#e89619}#editor #editor-interactions.inactive{color:#fff}#editor #edge-editor.enabled,#editor #node-editor.enabled{-webkit-animation:fadeIn 1s linear;animation:fadeIn 1s linear}#control-dash-wrapper{font-family:'Source Sans Pro',Helvetica,sans-serif;letter-spacing:.05em;height:inherit;z-index:inherit;padding:0}#control-dash-wrapper.initial{-webkit-transform:translate(-100%,0);transform:translate(-100%,0)}#control-dash-wrapper.initial #dash-toggle{color:#e89619;-webkit-animation:4s pulse linear;animation:4s pulse linear}#control-dash-wrapper.off-canvas{-webkit-transform:translate(-100%,0);transform:translate(-100%,0);-webkit-animation:slide-out .75s linear;animation:slide-out .75s linear}#control-dash-wrapper.off-canvas #dash-toggle{color:#e89619;-webkit-animation:4s pulse linear;animation:4s pulse linear}#control-dash-wrapper.on-canvas{-webkit-animation:slide-in .75s ease-in-out;animation:slide-in .75s ease-in-out}#control-dash-wrapper.on-canvas *{box-shadow:none!important}#control-dash-wrapper.on-canvas #dash-toggle{color:rgba(232,150,25,.6)}#control-dash-wrapper.on-canvas #dash-toggle:hover{color:#e89619;-webkit-animation:4s pulse linear;animation:4s pulse linear}#control-dash-wrapper #control-dash{overflow-x:hidden;overflow-y:scroll;background-color:transparent;background-image:url(images/maze-black.png);padding:0;height:inherit;z-index:5}#control-dash-wrapper #control-dash h3{display:inline;margin:0}#control-dash-wrapper #dash-toggle{z-index:5;background-color:transparent;background-image:url(images/maze-black.png);border-top-right-radius:3px;border-bottom-right-radius:3px;box-shadow:0 0 5px rgba(255,255,255,.3);position:absolute;left:0;top:50%;font-size:2.2em;color:rgba(255,255,255,.2);padding:10px}#control-dash-wrapper button{border-radius:0;border:0;background-color:transparent}#control-dash-wrapper button:active{border:0}#control-dash-wrapper h3{font-weight:200;margin-top:10px;color:#fff;cursor:pointer;vertical-align:top}#control-dash-wrapper li{cursor:pointer;background:0 0;border:0;border-radius:0}#clustering{padding:.5em 1em;cursor:pointer;color:#fff;border-bottom:thin dashed #E89619}#clustering #cluster-key-container,#clustering #cluster_control_header{padding:10px 10px 0}#clustering #cluster-key{color:#333;background-color:#000;border-radius:4px;border:thin solid #333;text-align:center;display:inline-block;width:100%}#filters{padding:.5em 1em;background-color:transparent;border-bottom:thin dashed #e89619;color:#fff}#filters form{width:100%}#filters #filter-header{padding:10px}#filters #filter-nodes,#filters #filter-relationships{background-color:transparent;display:inline-block;width:45%;margin-left:2%;overflow:auto;text-align:center;vertical-align:top}#filters #filter-nodes #filter-node-header,#filters #filter-nodes #filter-rel-header,#filters #filter-relationships #filter-node-header,#filters #filter-relationships #filter-rel-header{margin:10px 0;cursor:pointer;background-color:transparent;border:0;border-radius:0;width:100%}#filters #filter-nodes #filter-node-header h4,#filters #filter-nodes #filter-rel-header h4,#filters #filter-relationships #filter-node-header h4,#filters #filter-relationships #filter-rel-header h4{font-weight:200;display:inline;color:#fff}#filters #filter-nodes #filter-node-header:active,#filters #filter-nodes #filter-rel-header:active,#filters #filter-relationships #filter-node-header:active,#filters #filter-relationships #filter-rel-header:active{border:0;box-shadow:none}#filters #filter-nodes #node-dropdown,#filters #filter-nodes #rel-dropdown,#filters #filter-relationships #node-dropdown,#filters #filter-relationships #rel-dropdown{margin:20px 0;border-radius:none;border:0;background:0 0}#filters #filter-nodes #node-dropdown li,#filters #filter-nodes #rel-dropdown li,#filters #filter-relationships #node-dropdown li,#filters #filter-relationships #rel-dropdown li{padding:5px}#filters #filter-nodes #node-dropdown li:hover,#filters #filter-nodes #rel-dropdown li:hover,#filters #filter-relationships #node-dropdown li:hover,#filters #filter-relationships #rel-dropdown li:hover{background-color:rgba(255,255,255,.2)}#filters .disabled{color:rgba(255,255,255,.5)}#filters .disabled:hover{color:#fdc670}.alchemy{position:relative}.alchemy #search form{z-index:2;display:inline;margin-left:100px}.alchemy #add-tag{width:300px;display:inline-block}.alchemy #tags input{max-width:220px}.alchemy #tags-list{padding:0}.alchemy #tags-list .icon-remove-sign{cursor:pointer}.alchemy #tags-list li{display:inline-block;margin-top:5px}.alchemy #tags-list span{background-color:#ccc;color:#333;border-radius:10em;display:inline-block;padding:1px 6px}.alchemy #filter-nodes label,.alchemy #filter-relationships label{font-weight:400;margin-right:1em}.alchemy .clear{clear:both}.alchemy text{font-weight:200;text-anchor:middle} \ No newline at end of file diff --git a/dist/alchemy.min.js b/dist/alchemy.min.js index 52ea9c3..c1fe6de 100644 --- a/dist/alchemy.min.js +++ b/dist/alchemy.min.js @@ -1,2 +1,2 @@ -(function(){"Alchemy.js is a graph drawing application for the web.\nCopyright (C) 2014 GraphAlchemist, Inc.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program. If not, see .\nlets";var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}},d=[].slice;a=function(){function a(){this.allEdges=c(this.allEdges,this),this.allNodes=c(this.allNodes,this),this.getEdges=c(this.getEdges,this),this.getNodes=c(this.getNodes,this),this.begin=c(this.begin,this),this.setState=c(this.setState,this),this.getState=c(this.getState,this),this.version="0.2.0",this.layout={},this.interactions={},this.utils={},this.visControls={},this.styles={},this.models={},this.drawing={},this.editor={},this.log={},this.state={interactions:"default",layout:"default",filters:{edges:{},nodes:{}}}}return a.prototype.getState=function(){return null!=this.state.key?this.state.key:void 0},a.prototype.setState=function(a,b){return this.state.key=b},a.prototype.begin=function(a){return this.conf=_.assign({},alchemy.defaults,a),"string"==typeof alchemy.conf.dataSource?d3.json(alchemy.conf.dataSource,alchemy.startGraph):"object"==typeof alchemy.conf.dataSource?alchemy.startGraph(alchemy.conf.dataSource):void 0},a.prototype.getNodes=function(){var a,b,c,e,f,g,h;if(a=arguments[0],b=2<=arguments.length?d.call(arguments,1):[]){for(b.push(a),e=_.union(b),f=[],g=0,h=e.length;h>g;g++)c=e[g],f.push(alchemy._nodes[c].properties);return f}return[this._nodes[a].properties]},a.prototype.getEdges=function(a,b){var c,d,e;return null==a&&(a=null),null==b&&(b=null),null!=a&&null!=b?(d=""+a+"-"+b,c=this._edges[d],[c.properties]):null!=a&&null==b?(e=_.map(this._edges,function(b){return b.properties.source===a||b.properties.target===a?b.properties:void 0}),_.compact(e)):void 0},a.prototype.allNodes=function(){return _.map(this._nodes,function(a){return a.properties})},a.prototype.allEdges=function(){return _.map(this._edges,function(a){return a.properties})},a}(),b={},"undefined"!=typeof module&&module.exports?module.exports=new a:this.alchemy=new a}).call(this),function(){alchemy.clustering=function(){function a(){var a,b,c,d,e,f;a=alchemy._nodes,this.clusterKey=alchemy.conf.clusterKey,this.identifyClusters(),b=-500,f=function(b){return a[b.source.id].properties[this.clusterKey]===a[b.target.id].properties[this.clusterKey]?1:1},c=function(){return.7},e=function(b){return a=alchemy._nodes,a[b.source.id].properties.root||a[b.target.id].properties.root?300:a[b.source.id].properties[this.clusterKey]===a[b.target.id].properties[this.clusterKey]?10:600},d=function(a){return 8*a},this.layout={charge:b,linkStrength:function(a){return f(a)},friction:function(){return c()},linkDistancefn:function(a){return e(a)},gravity:function(a){return d(a)}}}return a.prototype.identifyClusters=function(){var a,b,c;return b=alchemy._nodes,a=_.uniq(_.map(_.values(b),function(a){return a.properties[""+alchemy.conf.clusterKey]})),this.clusterMap=_.zipObject(a,function(){c=[];for(var b=0,d=a.length;d>=0?d>=b:b>=d;d>=0?b++:b--)c.push(b);return c}.apply(this))},a.prototype.getClusterColour=function(a){var b;return b=this.clusterMap[a]%alchemy.conf.clusterColours.length,alchemy.conf.clusterColours[b]},a.prototype.edgeGradient=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(c=d3.select(""+alchemy.conf.divSelector+" svg"),b={},j=alchemy._nodes,n=_.map(a,function(a){return a._d3}),l=0,m=n.length;m>l;l++)if(d=n[l],!j[d.source.id].properties.root&&!j[d.target.id].properties.root&&j[d.source.id].properties[this.clusterKey]!==j[d.target.id].properties[this.clusterKey]&&j[d.target.id].properties[this.clusterKey]!==j[d.source.id].properties[this.clusterKey]){if(h=j[d.source.id].properties[this.clusterKey]+"-"+j[d.target.id].properties[this.clusterKey],h in b)continue;h in b||(k=this.getClusterColour(j[d.target.id].properties[this.clusterKey]),e=this.getClusterColour(j[d.source.id].properties[this.clusterKey]),b[h]={startColour:k,endColour:e})}o=[];for(i in b)g="cluster-gradient-"+i,f=c.append("svg:linearGradient").attr("id",g),f.append("svg:stop").attr("offset","0%").attr("stop-color",b[i].startColour),o.push(f.append("svg:stop").attr("offset","100%").attr("stop-color",b[i].endColour));return o},a}(),alchemy.clusterControls={init:function(){var a;return a="

Cluster By:

\n",d3.select("#clustering-container").append("div").attr("id","cluster-key-container").html(a).style("display","none"),d3.select("#cluster_control_header").on("click",function(){var a,b;return b=d3.select("#cluster-key-container"),a=b.style("display"),b.style("display",function(){return"block"===a?"none":"block"})}),d3.select("#cluster-key").on("keydown",function(){return"Enter"===d3.event.keyIdentifier?(alchemy.conf.cluster=!0,alchemy.conf.clusterKey=this.value,alchemy.generateLayout()):void 0})}}}.call(this),function(){alchemy.controlDash={init:function(){var a;return alchemy.conf.showControlDash===!0?(a=alchemy.conf.divSelector,d3.select(""+a).append("div").attr("id","control-dash-wrapper").attr("class","col-md-4 initial"),d3.select("#control-dash-wrapper").append("i").attr("id","dash-toggle").attr("class","fa fa-flask col-md-offset-12"),d3.select("#control-dash-wrapper").append("div").attr("id","control-dash").attr("class","col-md-12"),d3.select("#dash-toggle").on("click",alchemy.interactions.toggleControlDash),alchemy.controlDash.zoomCtrl(),alchemy.controlDash.search(),alchemy.controlDash.filters(),alchemy.controlDash.stats(),alchemy.controlDash.clustering()):void 0},search:function(){return alchemy.conf.search?(d3.select("#control-dash").append("div").attr("id","search").html("
\n \n \n
"),alchemy.search.init()):void 0},zoomCtrl:function(){return alchemy.conf.zoomControls?(d3.select("#control-dash-wrapper").append("div").attr("id","zoom-controls").attr("class","col-md-offset-12").html(" "),d3.select("#zoom-in").on("click",function(){return alchemy.interactions.clickZoom("in")}),d3.select("#zoom-out").on("click",function(){return alchemy.interactions.clickZoom("out")}),d3.select("#zoom-reset").on("click",function(){return alchemy.interactions.clickZoom("reset")})):void 0},filters:function(){return alchemy.conf.showFilters?(d3.select("#control-dash").append("div").attr("id","filters"),alchemy.filters.init()):void 0},stats:function(){var a;return alchemy.conf.showStats?(a='
\n

\n Statistics\n

\n\n
\n
\n
    \n
      \n
      ',d3.select("#control-dash").append("div").attr("id","stats").html(a).select("#stats-header").on("click",function(){return d3.select("#all-stats").classed("in")?d3.select("#stats-header>span").attr("class","fa fa-2x fa-caret-right"):d3.select("#stats-header>span").attr("class","fa fa-2x fa-caret-down")}),alchemy.stats.init()):void 0},clustering:function(){var a;return alchemy.conf.clusterControl?(a='
      \n
      \n

      \n Clustering\n

      \n \n
      \n
      ',d3.select("#control-dash").append("div").attr("id","clustering").html(a).select("#cluster_control_header"),alchemy.clusterControls.init()):void 0}}}.call(this),function(){alchemy.filters={init:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;if(alchemy.filters.show(),alchemy.conf.edgeFilters&&alchemy.filters.showEdgeFilters(),alchemy.conf.nodeFilters&&alchemy.filters.showNodeFilters(),alchemy.conf.nodeTypes){for(e=Object.keys(alchemy.conf.nodeTypes),g="",n=alchemy.conf.nodeTypes[e],h=0,k=n.length;k>h;h++)f=n[h],alchemy.state.filters.nodes[""+f]={active:!0},a=f.replace("_"," "),g+="";$("#node-dropdown").append(g)}if(alchemy.conf.edgeTypes){for(o=d3.selectAll(".edge")[0],i=0,l=o.length;l>i;i++)b=o[i],currentRelationshipTypes[[b].caption]=!0;for(d="",p=alchemy.conf.edgeTypes,j=0,m=p.length;m>j;j++)c=p[j],alchemy.state.filters.edges[""+c]={active:!0},a=c.replace("_"," "),d+="";$("#rel-dropdown").append(d)}return alchemy.conf.captionsToggle&&alchemy.filters.captionsToggle(),alchemy.conf.edgesToggle&&alchemy.filters.edgesToggle(),alchemy.conf.nodesToggle&&alchemy.filters.nodesToggle(),alchemy.filters.update()},show:function(){var a;return a='
      \n

      \n Filters\n

      \n \n
      \n
      \n
      ',d3.select("#control-dash #filters").html(a),d3.selectAll("#filter-header").on("click",function(){return d3.select("#filters>form").classed("in")?d3.select("#filter-header>span").attr("class","fa fa-2x fa-caret-right"):d3.select("#filter-header>span").attr("class","fa fa-2x fa-caret-down")}),$("#filters form").submit(!1)},showEdgeFilters:function(){var a;return a='
      \n
      \n

      \n Edge Types\n

      \n \n
      \n \n
      \n',$("#filters form").append(a),d3.select("#filter-rel-header").on("click",function(){return d3.select("#rel-dropdown").classed("in")?d3.select("#filter-rel-header>span").attr("class","fa fa-lg fa-caret-right"):d3.select("#filter-rel-header>span").attr("class","fa fa-lg fa-caret-down")})},showNodeFilters:function(){var a;return a='
      \n
      \n

      \n Node Types\n

      \n \n
      \n \n
      ',$("#filters form").append(a),d3.select("#filter-node-header").on("click",function(){return d3.select("#node-dropdown").classed("in")?d3.select("#filter-node-header>span").attr("class","fa fa-lg fa-caret-right"):d3.select("#filter-node-header>span").attr("class","fa fa-lg fa-caret-down")})},captionsToggle:function(){return d3.select("#filters form").append("li").attr({id:"toggle-captions","class":"list-group-item active-label toggle"}).html("Show Captions").on("click",function(){var a;return a=d3.select("g text").attr("style"),"display: block"===a?d3.selectAll("g text").attr("style","display: none"):d3.selectAll("g text").attr("style","display: block")})},edgesToggle:function(){return d3.select("#filters form").append("li").attr({id:"toggle-edges","class":"list-group-item active-label toggle"}).html("Toggle Edges").on("click",function(){return 0===d3.selectAll(".edge.hidden")[0].length?d3.selectAll(".edge").classed("hidden",!0):d3.selectAll(".edge").classed("hidden",!1)})},nodesToggle:function(){return d3.select("#filters form").append("li").attr({id:"toggle-nodes","class":"list-group-item active-label toggle"}).html("Toggle Nodes").on("click",function(){var a;return a=alchemy.conf.toggleRootNodes?".node,.edge":".node:not(.root),.edge",0===d3.selectAll(".node.hidden")[0].length?d3.selectAll(a).classed("hidden",!0):d3.selectAll(a).classed("hidden",!1)})},update:function(){var a,b;return a=function(a){var b,c,d;return d=a.attr("name"),c=!a.classed("disabled"),b=a.classed("nodeType")?"nodes":"edges",[d,b,c]},b=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n;if("object"!=typeof a){if(g=d3.selectAll("."+a),g.classed({inactive:c,highlight:d}),"nodes"===b)for(m=g.data(),i=0,k=m.length;k>i;i++)for(h=m[i],n=alchemy._nodes[h.id].adjacentEdges,j=0,l=n.length;l>j;j++)e=n[j],f=alchemy._edges[e],f.allNodesActive()||(c=!0),d3.select("[source-target='"+e+"']").classed({inactive:c,highlight:d});return"edges"===b&&g.classed({inactive:function(a){var b;return b=alchemy._edges[a.id].allNodesActive(),c||!b}}),alchemy.stats.update()}},d3.selectAll(".nodeType, .edgeType").on("mouseenter",function(){var b,c,d,e,f;return b=d3.select(this),f=a(b),e=f[0],c=f[1],d=f[2],d3.selectAll("."+e).classed("highlight",!0)}).on("mouseleave",function(){var b,c,d,e,f;return b=d3.select(this),f=a(b),e=f[0],c=f[1],d=f[2],d3.selectAll("."+e).classed("highlight",!1)}).on("click",function(){var c,d,e,f,g,h;return c=d3.select(this),h=a(c),g=h[0],d=h[1],f=h[2],e=!1,c.classed({disabled:f}),b(g,d,f,e)})}}}.call(this),function(){alchemy.interactions={edgeClick:function(a){var b;return b=alchemy.vis,b.selectAll(".edge").classed({highlight:!1}),d3.select("[source-target='"+a.id+"']").classed({highlight:!0,selected:!0}),d3.event.stopPropagation(),"function"==typeof(null!=alchemy.conf.edgeClick)?alchemy.conf.edgeClick():void 0},nodeMouseOver:function(a){var b;return null==alchemy.conf.nodeMouseOver?null:(b=alchemy._nodes[a.id],"function"==typeof alchemy.conf.nodeMouseOver?alchemy.conf.nodeMouseOver(b):"number"==typeof alchemy.conf.nodeMouseOver?b.properties[alchemy.conf.nodeMouseOver]:void 0)},nodeMouseOut:function(a){return null!=alchemy.conf.nodeMouseOut&&"function"==typeof alchemy.conf.nodeMouseOut?alchemy.conf.nodeMouseOut(a):null},nodeMouseUp:function(){},nodeDoubleClick:function(a){var b,c,d;if(d3.event.stopPropagation(),alchemy.conf.extraDataSource&&!a.expanded&&!alchemy.conf.unexpandable.indexOf(a.type===!1)){$('
      nner').show(),console.log("loading more data for "+a.id),a.expanded=!0,d3.json(alchemy.conf.extraDataSource+a.id,loadMoreNodes),c=findAllEdges(a),d=[];for(b in edges)d.push(edges[b].distance*=2);return d}},nodeClick:function(a){var b;d3.event.stopPropagation(),alchemy.vis.select("#node-"+a.id).empty()||(b=alchemy.vis.select("#node-"+a.id).classed("selected"),alchemy.vis.select("#node-"+a.id).classed("selected",!b)),"function"==typeof alchemy.conf.nodeClick&&alchemy.conf.nodeClick(a)},zoom:function(a){return null==this._zoomBehavior&&(this._zoomBehavior=d3.behavior.zoom()),this._zoomBehavior.scaleExtent(a).on("zoom",function(){return alchemy.vis.attr("transform","translate("+d3.event.translate+") scale("+d3.event.scale+")")})},clickZoom:function(a){var b,c,d,e;return e=alchemy.vis.attr("transform").match(/(-*\d+\.*\d*)/g).map(function(a){return parseFloat(a)}),c=e[0],d=e[1],b=e[2],alchemy.vis.attr("transform",function(){return"in"===a?(balchemy.conf.scaleExtent[0]&&(b-=.2),"translate("+c+","+d+") scale("+b+")"):"reset"===a?"translate(0,0) scale(1)":console.log("error")}),null==this._zoomBehavior&&(this._zoomBehavior=d3.behavior.zoom()),this._zoomBehavior.scale(b).translate([c,d])},toggleControlDash:function(){var a;return a=d3.select("#control-dash-wrapper").classed("off-canvas")||d3.select("#control-dash-wrapper").classed("initial"),d3.select("#control-dash-wrapper").classed({"off-canvas":!a,initial:!1,"on-canvas":a})},nodeDragStarted:function(a){return d3.event.sourceEvent.stopPropagation(),d3.select(this).classed("dragging",!0),a.fixed=!0},nodeDragged:function(a){var b,c,d,e,f,g,h,i;for(a.x+=d3.event.dx,a.y+=d3.event.dy,a.px+=d3.event.dx,a.py+=d3.event.dy,e=d3.select(this),e.attr("transform","translate("+a.x+", "+a.y+")"),c=alchemy._nodes[e.datum().id].adjacentEdges,b=new alchemy.drawing.DrawEdges,i=[],g=0,h=c.length;h>g;g++)d=c[g],f=d3.select("g.edge[source-target='"+d+"']"),i.push(b.updateEdge(f));return i},nodeDragended:function(){return d3.select(this).classed({dragging:!1}),alchemy.conf.forceLocked?void 0:alchemy.force.start()},deselectAll:function(){var a;if(null!=(a=d3.event)?!a.defaultPrevented:!0)return alchemy.vis.selectAll(".node, .edge").classed("selected highlight",!1),d3.select(".alchemy svg").classed({"highlight-active":!1}),alchemy.conf.showEditor===!0&&alchemy.modifyElements.nodeEditorClear(),alchemy.vis.selectAll("line.edge").classed("highlighted connected unconnected",!1),alchemy.vis.selectAll("g.node,circle,text").classed("selected unselected neighbor unconnected connecting",!1),alchemy.conf.deselectAll?alchemy.conf.deselectAll():void 0}}}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.Layout=function(){function b(){this.linkDistancefn=a(this.linkDistancefn,this),this.tick=a(this.tick,this),this.collide=a(this.collide,this),this.linkStrength=a(this.linkStrength,this),this.gravity=a(this.gravity,this);var b,c;b=alchemy.conf,c=alchemy._nodes,this.k=Math.sqrt(Math.log(_.size(alchemy._nodes))/(b.graphWidth()*b.graphHeight())),this._clustering=new alchemy.clustering,this.d3NodeInternals=_.keys(alchemy._nodes),b.cluster?(this._charge=function(){return this._clustering.layout.charge},this._linkStrength=function(a){return this._clustering.layout.linkStrength(a)}):(this._charge=function(){return-10/this.k},this._linkStrength=function(a){return c[a.source.id].properties.root||c[a.target.id].properties.root?1:.9}),b.cluster?this._linkDistancefn=function(a){return this._clustering.layout.linkDistancefn(a)}:"default"===b.linkDistancefn?this._linkDistancefn=function(){return 1/(50*this.k)}:"number"==typeof b.linkDistancefn?this._linkDistancefn=function(){return b.linkDistancefn}:"function"==typeof b.linkDistancefn&&(this._linkDistancefn=function(a){return b.linkDistancefn(a)})}return b.prototype.gravity=function(){return alchemy.conf.cluster?this._clustering.layout.gravity(this.k):50*this.k},b.prototype.linkStrength=function(a){return this._linkStrength(a)},b.prototype.friction=function(){return alchemy.conf.cluster?.7:.9},b.prototype.collide=function(a){var b,c,d,e,f,g;return a=a._d3,b=alchemy.conf,g=2*(a.r+a["stroke-width"])+b.nodeOverlap,c=a.x-g,d=a.x+g,e=a.y-g,f=a.y+g,function(b,h,i,j,k){var l,m,n;return b.point&&b.point!==a&&(m=a.x-Math.abs(b.point.x),n=a.y-b.point.y,l=Math.sqrt(m*m+n*n),g=g,g>l&&(l=(l-g)/l*alchemy.conf.alpha,a.x-=m*=l,a.y-=n*=l,b.point.x+=m,b.point.y+=n)),h>d||c>j||i>f||e>k}},b.prototype.tick=function(){var a,b,c,d,e;if(alchemy.conf.collisionDetection)for(b=d3.geom.quadtree(this.d3NodeInternals),e=_.values(alchemy._nodes),c=0,d=e.length;d>c;c++)a=e[c],b.visit(this.collide(a));return alchemy.node.attr("transform",function(a){return"translate("+a.x+","+a.y+")"}),null==this.drawEdge&&(this.drawEdge=new alchemy.drawing.DrawEdge),this.drawEdge.styleText(alchemy.edge),this.drawEdge.styleLink(alchemy.edge)},b.prototype.positionRootNodes=function(){var a,b,c,d,e,f,g,h,i,j;if(a=alchemy.conf,b={width:a.graphWidth(),height:a.graphHeight()},e=_.filter(alchemy._nodes,function(a){return a.properties.root}),1!==e.length){for(d=0,j=[],f=0,g=e.length;g>f;f++)c=e[f],d++,c._d3.x=b.width/Math.sqrt(e.length*d),c._d3.y=b.height/2,j.push(c._d3.fixed=!0);return j}c=e[0],h=[b.width/2,b.width/2],c._d3.x=h[0],c._d3.px=h[1],i=[b.height/2,b.height/2],c._d3.y=i[0],c._d3.py=i[1],c._d3.fixed=!0},b.prototype.chargeDistance=function(){return 500},b.prototype.linkDistancefn=function(a){return this._linkDistancefn(a)},b.prototype.charge=function(){return this._charge()},b}(),alchemy.generateLayout=function(a){var b;return null==a&&(a=!1),b=alchemy.conf,alchemy.layout=new alchemy.Layout,alchemy.force=d3.layout.force().size([b.graphWidth(),b.graphHeight()]).nodes(_.map(alchemy._nodes,function(a){return a._d3})).links(_.map(alchemy._edges,function(a){return a._d3})),alchemy.force.charge(alchemy.layout.charge()).linkDistance(function(a){return alchemy.layout.linkDistancefn(a)}).theta(1).gravity(alchemy.layout.gravity()).linkStrength(function(a){return alchemy.layout.linkStrength(a)}).friction(alchemy.layout.friction()).chargeDistance(alchemy.layout.chargeDistance()),alchemy.updateGraph()}}.call(this),function(){}.call(this),function(){alchemy.search={init:function(){var a;return a=d3.select("#search input"),a.on("keyup",function(){var b;return b=a[0][0].value.toLowerCase(),d3.selectAll(".node").classed("inactive",!1),d3.selectAll("text").attr("style",function(){return""!==b?"display: inline;":void 0}),d3.selectAll(".node").classed("inactive",function(a){var c,d;return c=d3.select(this),"contains"===alchemy.conf.searchMethod&&(d=c.text().toLowerCase().indexOf(b)<0),"begins"===alchemy.conf.searchMethod&&(d=0!==c.text().toLowerCase().indexOf(b)),d?d3.selectAll("[source-target*='"+a.id+"']").classed("inactive",d):d3.selectAll("[source-target*='"+a.id+"']").classed("inactive",function(a){var b,c,d;return b=[a.source.id,a.target.id],c=d3.select("#node-"+b[0]).classed("inactive"),d=d3.select("#node-"+b[1]).classed("inactive"),d||c}),d})})}}}.call(this),function(){alchemy.startGraph=function(a){var b,c,d,e,f,g;return c=alchemy.conf,d3.select(c.divSelector).empty()&&console.warn(alchemy.utils.warnings.divWarning()),a||alchemy.utils.warnings.dataWarning(),alchemy._nodes={},alchemy._edges={},a.nodes.forEach(function(a){return alchemy._nodes[a.id]=new alchemy.models.Node(a)}),a.edges.forEach(function(a){var b;return b=new alchemy.models.Edge(a),alchemy._edges[b.id]=b}),alchemy.vis=d3.select(c.divSelector).attr("style","width:"+c.graphWidth()+"px; height:"+c.graphHeight()+"px").append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("pointer-events","all").on("dblclick.zoom",null).on("click",alchemy.interactions.deselectAll).call(alchemy.interactions.zoom(c.scaleExtent)).append("g").attr("transform","translate("+c.initialTranslate+") scale("+c.initialScale+")"),f=new alchemy.editor.Interactions,d3.select("body").on("keydown",f.deleteSelected),alchemy.generateLayout(),alchemy.controlDash.init(),c.forceLocked||alchemy.force.on("tick",alchemy.layout.tick).start(),null!=c.afterLoad&&("function"==typeof c.afterLoad?c.afterLoad():"string"==typeof c.afterLoad&&(alchemy[c.afterLoad]=!0)),c.initialScale!==alchemy.defaults.initialScale?void alchemy.interactions.zoom().scale(c.initialScale):c.initialTranslate!==alchemy.defaults.initialTranslate?void alchemy.interactions.zoom().translate(c.initialTranslate):((c.cluster||c.directedEdges)&&(d=d3.select(""+alchemy.conf.divSelector+" svg").append("svg:defs")),c.directedEdges&&(b=c.edgeArrowSize,g=d.append("svg:marker").attr("id","arrow").attr("viewBox","0 -"+.4*b+" "+b+" "+b).attr("markerUnits","userSpaceOnUse").attr("markerWidth",b).attr("markerHeight",b).attr("orient","auto"),g.append("svg:path").attr("d","M "+b+",0 L 0,"+.4*b+" L 0,-"+.4*b),c.curvedEdges?g.attr("refX",b+1):g.attr("refX",1)),c.showEditor?(e=new alchemy.editor.Editor,e.startEditor()):void 0)}}.call(this),function(){alchemy.stats={init:function(){return alchemy.stats.update()},nodeStats:function(){var a,b,c,d,e,f,g,h,i,j,k,l;if(g="",f=d3.selectAll(".node")[0].length,a=d3.selectAll(".node.active")[0].length,c=d3.selectAll(".node.inactive")[0].length,g+="
    • Number of nodes: "+f+"
    • ",g+="
    • Number of active nodes: "+a+"
    • ",g+="
    • Number of inactive nodes: "+c+"
    • ",alchemy.conf.nodeTypes){for(e=Object.keys(alchemy.conf.nodeTypes),i="",l=alchemy.conf.nodeTypes[e],j=0,k=l.length;k>j;j++)h=l[j],b=h.replace("_"," "),f=d3.selectAll("g.node."+h)[0].length,i+="
    • Number of nodes of type "+b+": "+f+"
    • ";g+=i}return d="
    • ",g+=d,$("#node-stats").html(g)},edgeStats:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;if(d=null,f=d3.selectAll(".edge")[0].length,a=d3.selectAll(".edge.active")[0].length,h=d3.selectAll(".edge.inactive")[0].length,e="
    • Number of relationships: "+f+"
    • Number of active relationships: "+a+"
    • Number of inactive relationships: "+h+"
    • ",alchemy.conf.edgeTypes){for(d=[],m=d3.selectAll(".edge")[0],i=0,k=m.length;k>i;i++)c=m[i],currentRelationshipTypes[[c].caption]=!0;for(n=alchemy.conf.edgeTypes,j=0,l=n.length;l>j;j++)g=n[j],g&&(b=g.replace("_"," "),f=d3.selectAll(".edge."+g)[0].length,d.push([""+b,f]))}return $("#rel-stats").html(e),alchemy.stats.insertSVG("edge",d),d},nodeStats:function(){var a,b,c,d,e,f,g,h,i,j,k;if(c=null,h=d3.selectAll(".node")[0].length,a=d3.selectAll(".node.active")[0].length,b=d3.selectAll(".node.inactive")[0].length,alchemy.conf.nodeTypes)for(c=[],e=Object.keys(alchemy.conf.nodeTypes),k=alchemy.conf.nodeTypes[e],i=0,j=k.length;j>i;i++)g=k[i],f=d3.selectAll("g.node."+g)[0].length,c.push([""+g,f]);return d="
    • Number of nodes: "+h+"
    • Number of active nodes: "+a+"
    • Number of inactive nodes: "+b+"
    • ",$("#node-stats").html(d),alchemy.stats.insertSVG("node",c),c},insertSVG:function(a,b){var c,d,e,f,g,h,i,j;return null===b?d3.select("#"+a+"-stats-graph").html("

      There are no "+a+"Types listed in your conf.

      "):(j=.25*alchemy.conf.graphWidth(),f=250,h=j/4,e=d3.scale.category20(),c=d3.svg.arc().outerRadius(h-10).innerRadius(h/2),g=d3.layout.pie().sort(null).value(function(a){return a[1]}),i=d3.select("#"+a+"-stats-graph").append("svg").append("g").style({width:j,height:f}).attr("transform","translate("+j/2+","+f/2+")"),d=i.selectAll(".arc").data(g(b)).enter().append("g").classed("arc",!0).on("mouseover",function(a,c){return d3.select("#"+b[c][0]+"-stat").classed("hidden",!1)}).on("mouseout",function(a,c){return d3.select("#"+b[c][0]+"-stat").classed("hidden",!0)}),d.append("path").attr("d",c).attr("stroke",function(a,b){return e(b)}).attr("stroke-width",2).attr("fill-opacity","0.3"),d.append("text").attr("transform",function(a){return"translate("+c.centroid(a)+")"}).attr("id",function(a,c){return""+b[c][0]+"-stat"}).attr("dy",".35em").classed("hidden",!0).text(function(a,c){return b[c][0]}))},update:function(){return alchemy.conf.nodeStats===!0&&alchemy.stats.nodeStats(),alchemy.conf.edgeStats===!0?alchemy.stats.edgeStats():void 0}}}.call(this),function(){alchemy.updateGraph=function(a){var b,c,d;if(null==a&&(a=!0),alchemy.edge=alchemy.vis.selectAll("g.edge").data(_.map(alchemy._edges,function(a){return a._d3}),function(a){return a.id}),alchemy.node=alchemy.vis.selectAll("g.node").data(_.map(alchemy._nodes,function(a){return a._d3}),function(a){return a.id}),a){for(alchemy.layout.positionRootNodes(),this.force.start();this.force.alpha()>.005;)alchemy.force.tick();b=new alchemy.drawing.DrawEdges,b.createEdge(alchemy.edge),c=new alchemy.drawing.DrawNodes,c.createNode(alchemy.node),d=!0,console.log(Date()+" completed initial computation")}return alchemy.vis.selectAll("g.node").attr("transform",function(a){return"translate("+a.x+", "+a.y+")"}),alchemy.node.exit().remove()}}.call(this),function(){alchemy.defaults={graphWidth:function(){return d3.select(this.divSelector).node().parentElement.clientWidth},graphHeight:function(){return"BODY"===d3.select(this.divSelector).node().parentElement.nodeName?window.innerHeight:d3.select(this.divSelector).node().parentElement.clientHeight},alpha:.5,collisionDetection:!0,nodeOverlap:25,fixNodes:!1,fixRootNodes:!1,forceLocked:!0,linkDistancefn:"default",nodePositions:null,showEditor:!1,captionToggle:!1,toggleRootNodes:!1,removeElement:!1,showControlDash:!1,cluster:!1,clusterKey:"cluster",clusterColours:d3.shuffle(["#DD79FF","#FFFC00","#00FF30","#5168FF","#00C0FF","#FF004B","#00CDCD","#f83f00","#f800df","#ff8d8f","#ffcd00","#184fff","#ff7e00"]),clusterControl:!0,showStats:!1,nodeStats:!1,edgeStats:!1,showFilters:!1,edgeFilters:!1,nodeFilters:!1,edgesToggle:!1,nodesToggle:!1,zoomControls:!1,nodeCaption:"caption",nodeStyle:{},nodeColour:null,nodeMouseOver:"caption",nodeRadius:10,nodeTypes:null,rootNodes:"root",rootNodeRadius:15,edgeCaption:"caption",edgeClick:"default",edgeStyle:function(){return null},edgeTypes:null,curvedEdges:!1,edgeWidth:4,edgeOverlayWidth:20,directedEdges:!1,edgeArrowSize:5,search:!0,searchMethod:"contains",afterLoad:"afterLoad",divSelector:"#alchemy",dataSource:null,initialScale:1,initialTranslate:[0,0],scaleExtent:[.5,2.4],dataWarning:"default",warningMessage:"There be no data! What's going on?"}}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.drawing.DrawEdge=function(){function b(){this.setInteractions=a(this.setInteractions,this),this.styleText=a(this.styleText,this),this.classEdge=a(this.classEdge,this),this.styleLink=a(this.styleLink,this),this.createLink=a(this.createLink,this);var b;b=alchemy.conf,this.curved=b.curvedEdges,this.directed=b.directedEdges,this.utils=new alchemy.drawing.EdgeUtils}return b.prototype.createLink=function(a){var b,c,d;return b=alchemy.conf,c=alchemy.interactions,d=this.utils,this.curved?(a.append("path").attr("class","edge-line").attr("id",function(a){return"path-"+a.id}),a.filter(function(a){return null!=a.caption}).append("text"),a.append("path").attr("class","edge-handler").style("stroke-width",""+b.edgeOverlayWidth)):(a.append("line").attr("class","edge-line").attr("shape-rendering","optimizeSpeed").style("stroke",function(a){return d.edgeStyle(a)}).style("stroke-width",b.edgeWidth),a.filter(function(a){return null!=a.caption}).append("text"),a.append("rect").attr("class","edge-handler"))},b.prototype.styleLink=function(a){var b,c;return b=alchemy.conf,c=this.utils,this.curved?(a.selectAll("path").attr("d",function(a){var b,d,e,f,g,h,i,j,k;return i=c.startLine(a),e=c.endLine(a),g=i.x,h=i.y,j=e.x,k=e.y,b=j-g,d=k-h,f=Math.sqrt(b*b+d*d),"M "+g+","+h+" A "+f+", "+f+" "+c.captionAngle(a)+" 0, 1 "+j+", "+k}),a.select("path.edge-line").style("stroke",function(a){return c.edgeStyle(a)})):(a.select(".edge-line").each(function(a){var b,d;return d=c.startLine(a),b=c.endLine(a),d3.select(this).attr({x1:d.x,y1:d.y,x2:b.x,y2:b.y})}),a.select(".edge-handler").attr("x",0).attr("y",-b.edgeOverlayWidth/2).attr("height",b.edgeOverlayWidth).attr("width",function(a){return c.edgeLength(a)}).attr("transform",function(a){return"translate("+a.source.x+", "+a.source.y+") rotate("+c.edgeAngle(a)+")"})),this.directed?a.select(".edge-line").attr("marker-end","url(#arrow)"):void 0},b.prototype.classEdge=function(a){return a.classed("active",!0)},b.prototype.styleText=function(a){var b;return b=this.utils,this.curved?a.select("text").attr("dx",function(a){return b.middlePath(a).x -}).attr("dy",function(a){return b.middlePath(a).y+20}).attr("transform",function(a){return"rotate("+b.captionAngle(a)+" "+b.middlePath(a).x+" "+b.middlePath(a).y+")"}).text(function(a){return a.caption}):a.select("text").attr("dx",function(a){return b.middleLine(a).x}).attr("dy",function(a){return b.middleLine(a).y-5}).attr("transform",function(a){return"rotate("+b.captionAngle(a)+" "+b.middleLine(a).x+" "+b.middleLine(a).y+")"}).text(function(a){return a.caption})},b.prototype.setInteractions=function(a){var b,c;return b="editor"===alchemy.getState("interactions"),b?(c=new alchemy.editor.Interactions,a.select(".edge-handler").on("click",c.edgeClick)):a.select(".edge-handler").on("click",alchemy.interactions.edgeClick)},b}()}.call(this),function(){alchemy.drawing.DrawEdges=function(){function a(){this.utils=new alchemy.drawing.EdgeUtils,this.drawEdge=new alchemy.drawing.DrawEdge(this.utils)}return a.prototype.createEdge=function(a){return a.enter().append("g").attr("id",function(a){return"edge-"+a.id}).attr("class",function(a){var b;return b=alchemy._edges[a.id].properties.caption,"edge "+b}).attr("source-target",function(a){return""+a.source.id+"-"+a.target.id}),this.drawEdge.createLink(a),this.drawEdge.classEdge(a),this.drawEdge.styleLink(a),this.drawEdge.styleText(a),this.drawEdge.setInteractions(a),a.exit().remove()},a.prototype.updateEdge=function(a){return this.drawEdge.classEdge(a),this.drawEdge.styleLink(a),this.drawEdge.styleText(a),this.drawEdge.setInteractions(a)},a}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.drawing.DrawNode=function(){function b(){this.styleNode=a(this.styleNode,this),this.setInteractions=a(this.setInteractions,this),this.createNode=a(this.createNode,this),this.styleText=a(this.styleText,this);var b,c,d,e;c=alchemy.interactions,b=alchemy.conf,d=alchemy._nodes,c=alchemy.interactions,this.utils=new alchemy.drawing.NodeUtils,e=this.utils,this._styleText=function(a){return a.selectAll("text").attr("dy",function(a){return d[a.id].properties.root?b.rootNodeRadius/2:2*b.nodeRadius-5}).html(function(a){return e.nodeText(a)})},this._createNode=function(a){return a.append("circle").attr("id",function(a){return"circle-"+a.id}),a.append("svg:text").attr("id",function(a){return"text-"+a.id})},this._styleNode=function(a){return a.select("circle").attr("r",function(a){return a.r}).attr("shape-rendering","optimizeSpeed").attr("style",function(a){return e.nodeStyle(a)})},this._setInteractions=function(a){var c,d,e,f,g,h;return e="editor"===alchemy.getState("interactions"),c=alchemy.interactions,d=d3.behavior.drag().origin(Object).on("dragstart",null).on("drag",null).on("dragend",null),e?(f=new alchemy.editor.Interactions,a.on("mouseup",f.nodeMouseUp).on("mouseover",f.nodeMouseOver).on("mouseout",f.nodeMouseOut).on("dblclick",c.nodeDoubleClick).on("click",f.nodeClick)):(a.on("mouseup",null).on("mouseover",c.nodeMouseOver).on("mouseout",c.nodeMouseOut).on("dblclick",c.nodeDoubleClick).on("click",c.nodeClick),d=d3.behavior.drag().origin(Object).on("dragstart",c.nodeDragStarted).on("drag",c.nodeDragged).on("dragend",c.nodeDragended),b.fixNodes||(g=a.filter(function(a){return a.root!==!0}),g.call(d)),b.fixRootNodes?void 0:(h=a.filter(function(a){return a.root===!0}),h.call(d)))}}return b.prototype.styleText=function(a){return this._styleText(a)},b.prototype.createNode=function(a){return this._createNode(a)},b.prototype.setInteractions=function(a){return this._setInteractions(a)},b.prototype.styleNode=function(a){return this._styleNode(a)},b}()}.call(this),function(){alchemy.drawing.DrawNodes=function(){function a(){this.drawNode=new alchemy.drawing.DrawNode}return a.prototype.createNode=function(a){return a.enter().append("g").attr("class",function(a){var b;return b=alchemy._nodes[a.id].getProperties(),null!=a.nodeType?"node "+a.nodeType+" active":"node active"}).attr("id",function(a){return"node-"+a.id}).classed("root",function(a){return a.root}),this.drawNode.createNode(a),this.drawNode.styleNode(a),this.drawNode.styleText(a),this.drawNode.setInteractions(a),a.exit().remove()},a.prototype.updateNode=function(a){return this.drawNode.styleNode(a),this.drawNode.styleText(a),this.drawNode.setInteractions(a)},a}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.drawing.EdgeUtils=function(){function b(){this.captionAngle=a(this.captionAngle,this);var b,c,d,e,f,g,h;d=alchemy.conf,g=alchemy._nodes,e=alchemy._edges,alchemy.conf.cluster?(c=alchemy.layout._clustering,this.edgeStyle=function(a){var b,d,e,f;return b=alchemy.conf.clusterKey,g[a.source.id].properties.root||g[a.target.id].properties.root?(f=g[a.source.id].properties.root?g[a.target.id].properties[b]:g[a.source.id].properties[b],""+c.getClusterColour(f)):g[a.source.id].properties[b]===g[a.target.id].properties[b]?(f=g[a.source.id].properties[b],""+c.getClusterColour(f)):g[a.source.id].properties[b]!==g[a.target.id].properties[b]?(e=""+g[a.source.id].properties[b]+"-"+g[a.target.id].properties[b],d="cluster-gradient-"+e,"url(#"+d+")"):void 0}):this.edgeStyle=null==alchemy.conf.edgeStyle||alchemy.conf.cluster?function(){return""}:function(a){return""+alchemy.conf.edgeStyle(a)},h=function(a){return a*a},f=function(a){var b,c;return c=a.target.x-a.source.x,b=a.target.y-a.source.y,Math.sqrt(b*b+c*c)},this._edgeWalk=function(a,b){var c,e,g;return g=a.target.x-a.source.x,e=a.target.y-a.source.y,f=Math.sqrt(e*e+g*g),"middle"===b?(c=f/2,{x:a.source.x+g*c/f,y:a.source.y+e*c/f}):"linkStart"===b?d.curvedEdges?{x:a.source.x,y:a.source.y}:(c=a.source.r+a.source["stroke-width"],{x:a.source.x+g*c/f,y:a.source.y+e*c/f}):"linkEnd"===b?(c=d.curvedEdges?f:f-(a.target.r+a.target["stroke-width"]),d.directedEdges&&(c-=d.edgeArrowSize),{x:a.source.x+g*c/f,y:a.source.y+e*c/f}):void 0},b=alchemy.conf.edgeCaption,"string"==typeof b?this.edgeCaption=function(a){return e[a.id].properties[b]}:"function"==typeof b&&(this.edgeCaption=function(a){return b(e[a.id])})}return b.prototype.middleLine=function(a){return this._edgeWalk(a,"middle")},b.prototype.startLine=function(a){return this._edgeWalk(a,"linkStart")},b.prototype.endLine=function(a){return this._edgeWalk(a,"linkEnd")},b.prototype.edgeLength=function(a){var b,c,d;return d=a.target.x-a.source.x,b=a.target.y-a.source.y,c=Math.sqrt(b*b+d*d)},b.prototype.edgeAngle=function(a){var b,c;return c=a.target.x-a.source.x,b=a.target.y-a.source.y,Math.atan2(b,c)/Math.PI*180},b.prototype.captionAngle=function(a){var b;return b=this.edgeAngle(a),-90>b||b>90?b+=180:b},b.prototype.hyp=function(a){return hyp(a)},b.prototype.middlePath=function(a){var b,c;return c=d3.select("#path-"+a.id).node(),b=c.getPointAtLength(c.getTotalLength()/2),{x:b.x,y:b.y}},b}()}.call(this),function(){alchemy.drawing.NodeUtils=function(){function a(){var a,b;b=alchemy._nodes,a=alchemy.conf,this.nodeColours=a.cluster?function(b){var c,d,e,f,g;return g=alchemy._nodes[b.id].properties,d=alchemy.layout._clustering.clusterMap,c=alchemy.conf.clusterKey,f=d[g[c]]%a.clusterColours.length,e=a.clusterColours[f],""+e}:function(){var b;return a.nodeColour?b=a.nodeColour:""}}return a.prototype.nodeStyle=function(a){var b,c;return b=this.nodeColours(a),c="editor"===alchemy.getState("interactions")?"#E82C0C":b,"fill: "+b+"; stroke: "+b+"; stroke-width: "+a["stroke-width"]+";"},a.prototype.nodeText=function(a){var b,c;return c=alchemy._nodes[a.id],alchemy.conf.nodeCaption&&"string"==typeof alchemy.conf.nodeCaption?null!=c.properties[alchemy.conf.nodeCaption]?c.properties[alchemy.conf.nodeCaption]:"":alchemy.conf.nodeCaption&&"function"==typeof alchemy.conf.nodeCaption?(b=alchemy.conf.nodeCaption(c),(void 0===b||"undefined"===String(b))&&(alchemy.log.caption="At least one caption returned undefined",alchemy.conf.caption=!1),b):void 0},a}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.editor.Editor=function(){function b(){this.nodeEditor=a(this.nodeEditor,this),this.startEditor=a(this.startEditor,this),this.utils=new alchemy.editor.Utils}return b.prototype.editorContainerHTML='
      \n

      Editor

      \n
      \n
      \n
        \n
      • Remove Selected
      • \n
      • Editor mode enabled, click to disable editor interactions
      • \n
      \n
      ',b.prototype.elementEditorHTML=function(a){return"

      "+a+' Editor

      \n
      \n
      \n \n \n
      \n \n
      \n
      \n \n
      '},b.prototype.startEditor=function(){var a,b,c,d,e;return a=alchemy.conf.divSelector,d=this.editorContainerHTML,b=d3.select(""+a+" #control-dash").append("div").attr("id","editor").html(d),b.select("#editor-header").on("click",function(){return d3.select("#element-options").classed("in")?d3.select("#editor-header>span").attr("class","fa fa-2x fa-caret-right"):d3.select("#editor-header>span").attr("class","fa fa-2x fa-caret-down")}),c=b.select("#element-options ul #editor-interactions").on("click",function(){return d3.select(this).attr("class",function(){return"editor"===alchemy.getState()?(alchemy.setState("interactions","default"),"inactive list-group-item"):(alchemy.setState("interactions","editor"),"active list-group-item")}).html(function(){return"editor"===alchemy.getState()?"Disable Editor Interactions":"Enable Editor Interactions"})}),b.select("#element-options ul #remove").on("click",function(){return alchemy.editor.remove()}),e=this.utils,c.on("click",function(){return d3.select("#editor-interactions").classed("active")?(e.disableEditor(),d3.select("#editor-interactions").classed({active:!1,inactive:!0}).html("Editor mode disabled, click to enable editor interactions")):(e.enableEditor(),d3.select("#editor-interactions").classed({active:!0,inactive:!1}).html("Editor mode enabled, click to disable editor interactions"))})},b.prototype.nodeEditor=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;c=alchemy.conf.divSelector,d=d3.select(""+c+" #control-dash-wrapper #control-dash #editor"),i=d.select("#element-options"),f=this.elementEditorHTML("Node"),e=i.append("div").attr("id","node-editor").html(f),e.attr("class",function(){return d3.select("#editor-interactions").classed("active")?"enabled":"hidden"}),b=d.select("#node-editor form #add-property"),b.select("#node-add-prop-key").attr("placeholder","New Property Name").attr("value",null),b.select("#node-add-prop-value").attr("placeholder","New Property Value").attr("value",null),d3.select("#add-property-form").on("submit",function(){var a,b;return event.preventDefault(),a=d3.select("#add-prop-key").property("value"),a=a.replace(/\s/g,"_"),b=d3.select("#add-prop-value").property("value"),l(a,b,!0),d3.selectAll("#add-property .edited-property").classed({"edited-property":!1}),this.reset()}),g=alchemy._nodes[a.id].getProperties(),d3.select("#node-"+a.id).classed({editing:!0}),k=d.select("#node-editor #properties-list");for(j in g)m=g[j],h=k.append("div").attr("id","node-"+j).attr("class","property form-inline form-group"),h.append("label").attr("for","node-"+j+"-input").attr("class","form-control property-name").text(""+j),h.append("input").attr("id","node-"+j+"-input").attr("class","form-control property-value").attr("value",""+m);return d3.select("#properties-list").on("submit",function(){var a,b,c,d,e,f,g;for(event.preventDefault(),b=d3.selectAll(".edited-property"),g=b[0],e=0,f=g.length;f>e;e++)j=g[e],c=d3.select(j),a=c.select("label").text(),d=c.select("input").attr("value"),l(a,d,!1);return d3.selectAll("#node-properties-list .edited-property").classed({"edited-property":!1}),this.reset()}),d3.selectAll("#add-prop-key, #add-prop-value, .property").on("keydown",function(){return 13===d3.event.keyCode&&event.preventDefault(),d3.select(this).classed({"edited-property":!0})}),l=function(b,c,d){var e,f;return f=a.id,""!==b&&""!==c?(alchemy._nodes[f].setProperty(""+b,""+c),e=new alchemy.drawing.DrawNodes,e.updateNode(d3.select("#node-"+f)),d===!0?(d3.select("#node-add-prop-key").attr("value","property added/updated to key: "+b),d3.select("#node-add-prop-value").attr("value","property at "+b+" updated to: "+c)):d3.select("#node-"+b+"-input").attr("value","property at "+b+" updated to: "+c)):d===!0?(d3.select("#node-add-prop-key").attr("value","null or invalid input"),d3.select("#node-add-prop-value").attr("value","null or invlid input")):d3.select("#node-"+b+"-input").attr("value","null or invalid input")}},b.prototype.editorClear=function(){return d3.selectAll(".node").classed({editing:!1}),d3.selectAll(".edge").classed({editing:!1}),d3.select("#node-editor").remove(),d3.select("#edge-editor").remove(),d3.select("#node-add-prop-submit").attr("placeholder",function(){return d3.selectAll(".selected").empty()?"select a node or edge to edit properties":"add a property to this element"})},b.prototype.edgeEditor=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;c=alchemy.conf.divSelector,f=d3.select(""+c+" #control-dash-wrapper #control-dash #editor"),i=f.select("#element-options"),h=this.elementEditorHTML("Edge"),g=i.append("div").attr("id","edge-editor").html(h),g.attr("class",function(){return d3.select("#editor-interactions").classed("active")?"enabled":"hidden"}),b=f.select("#edge-editor form #add-property"),b.select("#add-prop-key").attr("placeholder","New Property Name").attr("value",null),b.select("#add-prop-value").attr("placeholder","New Property Value").attr("value",null),d=alchemy._edges[a.id].getProperties(),d3.select("#edge-"+a.id).classed({editing:!0}),k=f.select("#edge-editor #properties-list");for(j in d)m=d[j],e=k.append("div").attr("id","edge-"+j).attr("class","property form-inline form-group"),e.append("label").attr("for","edge-"+j+"-input").attr("class","form-control property-name").text(""+j),e.append("input").attr("id","edge-"+j+"-input").attr("class","form-control property-value").attr("value",""+m);return d3.selectAll("#add-prop-key, #add-prop-value, .property").on("keydown",function(){return 13===d3.event.keyCode&&event.preventDefault(),d3.select(this).classed({"edited-property":!0})}),d3.select("#add-property-form").on("submit",function(){var a,b;return event.preventDefault(),a=d3.select("#add-prop-key").property("value"),a=a.replace(/\s/g,"_"),b=d3.select("#add-prop-value").property("value"),l(a,b,!0),d3.selectAll("#add-property .edited-property").classed({"edited-property":!1}),this.reset()}),d3.select("#properties-list").on("submit",function(){var a,b,c,d,e,f,g;for(event.preventDefault(),b=d3.selectAll(".edited-property"),g=b[0],e=0,f=g.length;f>e;e++)j=g[e],c=d3.select(j),a=c.select("label").text(),d=c.select("input").property("value"),l(a,d,!1);return d3.selectAll("#properties-list .edited-property").classed({"edited-property":!1}),this.reset()}),l=function(b,c,d){var e,f,g;return f=a.id,""!==b&&""!==c?(alchemy._edges[f].setProperty(""+b,""+c),g=d3.select("#edge-"+f),e=new alchemy.drawing.DrawEdges,e.updateEdge(d3.select("#edge-"+f)),d===!0?(d3.select("#add-prop-key").attr("value","property added/updated to key: "+b),d3.select("#add-prop-value").attr("value","property at "+b+" updated to: "+c)):d3.select("#edge-"+b+"-input").attr("value","property at "+b+" updated to: "+c)):d===!0?(d3.select("#add-prop-key").attr("value","null or invalid input"),d3.select("#add-prop-value").attr("value","null or invlid input")):d3.select("#edge-"+b+"-input").attr("value","null or invalid input")}},b}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.editor.Interactions=function(){function b(){this.reset=a(this.reset,this),this.deleteSelected=a(this.deleteSelected,this),this.addNodeDragended=a(this.addNodeDragended,this),this.addNodeDragging=a(this.addNodeDragging,this),this.addNodeStart=a(this.addNodeStart,this),this.edgeClick=a(this.edgeClick,this),this.nodeClick=a(this.nodeClick,this),this.nodeMouseUp=a(this.nodeMouseUp,this),this.editor=new alchemy.editor.Editor}return b.prototype.nodeMouseOver=function(){var a;return d3.select(this).select("circle").empty()||(a=d3.select(this).select("circle").attr("r"),d3.select(this).select("circle").attr("r",3*a)),this},b.prototype.nodeMouseUp=function(a){return this.sourceNode!==a?(this.mouseUpNode=!0,this.targetNode=a,this.click=!1):this.click=!0,this},b.prototype.nodeMouseOut=function(){var a;return d3.select(this).select("circle").empty()||(a=d3.select(this).select("circle").attr("r"),d3.select(this).select("circle").attr("r",a/3)),this},b.prototype.nodeClick=function(a){var b;return d3.event.stopPropagation(),alchemy.vis.select("#node-"+a.id).empty()||(b=alchemy.vis.select("#node-"+a.id).classed("selected"),alchemy.vis.select("#node-"+a.id).classed("selected",!b)),this.editor.editorClear(),this.editor.nodeEditor(a)},b.prototype.edgeClick=function(a){return d3.event.stopPropagation(),this.editor.editorClear(),this.editor.edgeEditor(a)},b.prototype.addNodeStart=function(a){return d3.event.sourceEvent.stopPropagation(),this.sourceNode=a,d3.select("#dragline").classed({hidden:!1}),this},b.prototype.addNodeDragging=function(){var a,b;return a=d3.event.x,b=d3.event.y,d3.select("#dragline").attr("x1",this.sourceNode.x).attr("y1",this.sourceNode.y).attr("x2",a).attr("y2",b).attr("style","stroke: #FFF"),this},b.prototype.addNodeDragended=function(){var a,b,c;return this.click||(this.mouseUpNode||(a=d3.select("#dragline"),b=a.attr("x2"),c=a.attr("y2"),this.targetNode={id:""+_.uniqueId("addedNode_"),x:parseFloat(b),y:parseFloat(c),caption:"node added"}),this.newEdge={id:""+this.sourceNode.id+"-"+this.targetNode.id,source:this.sourceNode.id,target:this.targetNode.id,caption:"edited"},alchemy.editor.update(this.targetNode,this.newEdge)),this.reset(),this},b.prototype.deleteSelected=function(){switch(d3.event.keyCode){case 8:case 46:if("INPUT"!==d3.select(d3.event.target).node().tagName)return d3.event.preventDefault(),alchemy.editor.remove()}},b.prototype.reset=function(){return this.mouseUpNode=null,this.sourceNode=null,this.targetNode=null,this.newEdge=null,this.click=null,d3.select("#dragline").classed({hidden:!0}).attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",0),this},b}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.editor.Utils=function(){function b(){this.enableEditor=a(this.enableEditor,this),this.drawNodes=new alchemy.drawing.DrawNodes,this.drawEdges=new alchemy.drawing.DrawEdges}return b.prototype.enableEditor=function(){var a,b,c;return alchemy.setState("interactions","editor"),a=alchemy.vis.append("line").attr("id","dragline"),this.drawNodes.updateNode(alchemy.node),this.drawEdges.updateEdge(alchemy.edge),c=d3.selectAll(".selected"),b=new alchemy.editor.Editor,c.empty()||1!==c.length?c.classed({selected:!1}):c.classed("node")?(b.nodeEditor(c.datum()),d3.select("#node-editor").attr("class","enabled").style("opacity",1)):c.classed("edge")?(b.edgeEditor(c.datum()),d3.select("#edge-editor").attr("class","enabled").style("opacity",1)):void 0},b.prototype.disableEditor=function(){return alchemy.setState("interactions","default"),alchemy.vis.select("#dragline").remove(),d3.select("#node-editor").transition().duration(300).style("opacity",0),d3.select("#node-editor").transition().delay(300).attr("class","hidden"),this.drawNodes.updateNode(alchemy.node),d3.selectAll(".node").classed({selected:!1})},b.prototype.remove=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(e=d3.selectAll(".selected.node"),j=e[0],l=[],f=0,h=j.length;h>f;f++)if(b=j[f],c=d3.select(b).data()[0].id,d=alchemy._nodes[c],null!=d){for(k=d.adjacentEdges,g=0,i=k.length;i>g;g++)a=k[g],alchemy._edges=_.omit(alchemy._edges,""+a),alchemy.edge=alchemy.edge.data(_.map(alchemy._edges,function(a){return a._d3}),function(a){return a.id}),d3.select("#edge-"+a).remove();alchemy._nodes=_.omit(alchemy._nodes,""+c),alchemy.node=alchemy.node.data(_.map(alchemy._nodes,function(a){return a._d3}),function(a){return a.id}),d3.select(b).remove(),l.push("editor"===alchemy.getState("interactions")?alchemy.modifyElements.nodeEditorClear():void 0)}else l.push(void 0);return l},b.prototype.addNode=function(a){var b;return b=alchemy._nodes[a.id]=new alchemy.models.Node({id:""+a.id}),b.setProperty("caption",a.caption),b.setD3Property("x",a.x),b.setD3Property("y",a.y),alchemy.node=alchemy.node.data(_.map(alchemy._nodes,function(a){return a._d3}),function(a){return a.id})},b.prototype.addEdge=function(a){var b;return b=alchemy._edges[a.id]=new alchemy.models.Edge(a),alchemy.edge=alchemy.edge.data(_.map(alchemy._edges,function(a){return a._d3}),function(a){return a.id})},b.prototype.update=function(a,b){return this.mouseUpNode?(alchemy.editor.addEdge(b),this.drawEdges.createEdge(alchemy.edge)):(alchemy.editor.addNode(a),alchemy.editor.addEdge(b),this.drawEdges.createEdge(alchemy.edge),this.drawNodes.createNode(alchemy.node)),alchemy.layout.tick()},b}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.models.Edge=function(){function b(b){this.allNodesActive=a(this.allNodesActive,this),this.getProperties=a(this.getProperties,this),this.setD3Property=a(this.setD3Property,this),this.setProperty=a(this.setProperty,this),this.toPublic=a(this.toPublic,this);var c,d;d=alchemy.conf,this.id=null!=b.id?b.id:""+b.source+"-"+b.target,this.edgeStyle=_.merge(d.edgeStyle,this.edgeStyle),this.state={active:!0},this.properties=b,this._edgeAttributes=new alchemy.models.EdgeAttributes,c=this._edgeAttributes.edgeCaption(this.properties),c&&(this.properties.caption=c),this._d3={id:this.id,source:alchemy._nodes[this.properties.source]._d3,target:alchemy._nodes[this.properties.target]._d3,caption:c},alchemy._nodes[""+b.source].addEdge(this.id),alchemy._nodes[""+b.target].addEdge(this.id)}return b.prototype.toPublic=function(){var a;return a=_.keys(this.properties),_.pick(this,a)},b.prototype.setProperty=function(a,b){return this.properties[a]=b,"source"===a||"target"===a?this.setD3Property(a,alchemy._nodes[b]._d3):void 0},b.prototype.setD3Property=function(a,b){return this._d3[a]=b},b.prototype.getProperties=function(){return this.properties},b.prototype.allNodesActive=function(){var a,b;return a=d3.select("#node-"+this.properties.source),b=d3.select("#node-"+this.properties.target),!a.classed("inactive")&&!b.classed("inactive")},b}()}.call(this),function(){alchemy.models.EdgeAttributes=function(){function a(){var a,b;b=alchemy.conf,a=b.edgeCaption,"string"==typeof a?this.edgeCaption=function(b){return b[a]}:"function"==typeof a&&(this.edgeCaption=function(b){return a(b)})}return a}()}.call(this),function(){}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.models.Node=function(){function b(c){this.removeProperty=a(this.removeProperty,this),this.setD3Property=a(this.setD3Property,this),this.setProperty=a(this.setProperty,this),this.getProperties=a(this.getProperties,this);var d,e,f;d=alchemy.conf,e=new alchemy.models.NodeAttributes,f=e.nodeSize(c),this.id=c.id,this.properties=c,this.state={active:!0},this._d3={id:c.id,r:f,"stroke-width":e.strokeWidth(f),root:this.properties[d.rootNodes]},this.nodeStyle=_.merge(d.nodeStyle,this.nodeStyle),this.adjacentEdges=[],b.prototype.all.push(this.id),d.nodeTypes&&(this.nodeType=this.properties[Object.keys(alchemy.conf.nodeTypes)],this.nodeType&&(this._d3.nodeType=this.nodeType))}return b.prototype.addEdge=function(a){return this.adjacentEdges.push(a),this.adjacentEdges=_.uniq(this.adjacentEdges)},b.prototype.outDegree=function(){return this.adjacentEdges.length},b.prototype.neighbors=function(){var a;return a=new RegExp("[("+this.id+"\\-)(\\-"+this.id+")]","g"),_.map(this.adjacentEdges,function(b){return b.replace(a,"")})},b.prototype.getProperties=function(){return this.properties},b.prototype.setProperty=function(a,b){return this.properties[a]=b},b.prototype.setD3Property=function(a,b){return this._d3[a]=b},b.prototype.removeProperty=function(a){return null!=this.properties.property?_.omit(this.properties,a):void 0},b.prototype.all=[],b}()}.call(this),function(){alchemy.models.NodeAttributes=function(){function a(){var a;a=alchemy.conf.rootNodes,"function"==typeof alchemy.conf.nodeRadius?this.nodeSize=function(b){return null!=b[a]&&d[a]?alchemy.conf.rootNodeRadius(b):alchemy.conf.nodeRadius(b)}:"string"==typeof alchemy.conf.nodeRadius?this.nodeSize=function(b){var c;return c=alchemy.conf.nodeRadius,null!=b[a]?alchemy.conf.rootNodeRadius:null!=b[c]?b[c]:alchemy.defaults.rootNodeRadius}:"number"==typeof alchemy.conf.nodeRadius&&(this.nodeSize=function(b){return null!=b[a]?alchemy.conf.rootNodeRadius:alchemy.conf.nodeRadius})}return a.prototype.strokeWidth=function(a){return a/3},a}()}.call(this),function(){alchemy.utils.warnings={dataWarning:function(){var a;return alchemy.conf.dataWarning&&"function"==typeof alchemy.conf.dataWarning?alchemy.conf.dataWarning():void("default"===alchemy.conf.dataWarning&&(a='',$("body").append(a),$("#no-results").modal("show"),$("#loading-spinner").hide()))},divWarning:function(){return"create an element that matches the value for 'divSelector' in your conf.\nFor instance, if you are using the default 'divSelector' conf, simply provide\n
      ."}}}.call(this); \ No newline at end of file +(function(){"Alchemy.js is a graph drawing application for the web.\nCopyright (C) 2014 GraphAlchemist, Inc.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Affero General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\nGNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License\nalong with this program. If not, see .\nlets";var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}},d=[].slice;a=function(){function a(){this.allEdges=c(this.allEdges,this),this.allNodes=c(this.allNodes,this),this.getEdges=c(this.getEdges,this),this.getNodes=c(this.getNodes,this),this.begin=c(this.begin,this),this.setState=c(this.setState,this),this.getState=c(this.getState,this),this.version="0.2.1",this.layout={},this.interactions={},this.utils={},this.visControls={},this.styles={},this.models={},this.drawing={},this.editor={},this.log={},this.state={interactions:"default",layout:"default",filters:{edges:{},nodes:{}}}}return a.prototype.getState=function(){return null!=this.state.key?this.state.key:void 0},a.prototype.setState=function(a,b){return this.state.key=b},a.prototype.begin=function(a){return this.conf=_.assign({},alchemy.defaults,a),"string"==typeof alchemy.conf.dataSource?d3.json(alchemy.conf.dataSource,alchemy.startGraph):"object"==typeof alchemy.conf.dataSource?alchemy.startGraph(alchemy.conf.dataSource):void 0},a.prototype.getNodes=function(){var a,b,c,e,f,g,h;if(a=arguments[0],b=2<=arguments.length?d.call(arguments,1):[]){for(b.push(a),e=_.union(b),f=[],g=0,h=e.length;h>g;g++)c=e[g],f.push(alchemy._nodes[c].properties);return f}return[this._nodes[a].properties]},a.prototype.getEdges=function(a,b){var c,d,e;return null==a&&(a=null),null==b&&(b=null),null!=a&&null!=b?(d=""+a+"-"+b,c=this._edges[d],[c.properties]):null!=a&&null==b?(e=_.map(this._edges,function(b){return b.properties.source===a||b.properties.target===a?b.properties:void 0}),_.compact(e)):void 0},a.prototype.allNodes=function(){return _.map(this._nodes,function(a){return a.properties})},a.prototype.allEdges=function(){return _.map(this._edges,function(a){return a.properties})},a}(),b={},"undefined"!=typeof module&&module.exports?module.exports=new a:this.alchemy=new a}).call(this),function(){alchemy.clustering=function(){function a(){var a,b,c,d,e,f;a=alchemy._nodes,this.clusterKey=alchemy.conf.clusterKey,this.identifyClusters(),b=-500,f=function(b){return a[b.source.id].properties[this.clusterKey]===a[b.target.id].properties[this.clusterKey]?1:1},c=function(){return.7},e=function(b){return a=alchemy._nodes,a[b.source.id].properties.root||a[b.target.id].properties.root?300:a[b.source.id].properties[this.clusterKey]===a[b.target.id].properties[this.clusterKey]?10:600},d=function(a){return 8*a},this.layout={charge:b,linkStrength:function(a){return f(a)},friction:function(){return c()},linkDistancefn:function(a){return e(a)},gravity:function(a){return d(a)}}}return a.prototype.identifyClusters=function(){var a,b,c;return b=alchemy._nodes,a=_.uniq(_.map(_.values(b),function(a){return a.properties[""+alchemy.conf.clusterKey]})),this.clusterMap=_.zipObject(a,function(){c=[];for(var b=0,d=a.length;d>=0?d>=b:b>=d;d>=0?b++:b--)c.push(b);return c}.apply(this))},a.prototype.getClusterColour=function(a){var b;return b=this.clusterMap[a]%alchemy.conf.clusterColours.length,alchemy.conf.clusterColours[b]},a.prototype.edgeGradient=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o;for(c=d3.select(""+alchemy.conf.divSelector+" svg"),b={},j=alchemy._nodes,n=_.map(a,function(a){return a._d3}),l=0,m=n.length;m>l;l++)if(d=n[l],!j[d.source.id].properties.root&&!j[d.target.id].properties.root&&j[d.source.id].properties[this.clusterKey]!==j[d.target.id].properties[this.clusterKey]&&j[d.target.id].properties[this.clusterKey]!==j[d.source.id].properties[this.clusterKey]){if(h=j[d.source.id].properties[this.clusterKey]+"-"+j[d.target.id].properties[this.clusterKey],h in b)continue;h in b||(k=this.getClusterColour(j[d.target.id].properties[this.clusterKey]),e=this.getClusterColour(j[d.source.id].properties[this.clusterKey]),b[h]={startColour:k,endColour:e})}o=[];for(i in b)g="cluster-gradient-"+i,f=c.append("svg:linearGradient").attr("id",g),f.append("svg:stop").attr("offset","0%").attr("stop-color",b[i].startColour),o.push(f.append("svg:stop").attr("offset","100%").attr("stop-color",b[i].endColour));return o},a}(),alchemy.clusterControls={init:function(){var a;return a="",d3.select("#clustering-container").append("div").attr("id","cluster-key-container").attr("class","property form-inline form-group").html(a).style("display","none"),d3.select("#cluster_control_header").on("click",function(){var a,b;return b=d3.select("#cluster-key-container"),a=b.style("display"),b.style("display",function(){return"block"===a?"none":"block"}),"none"===d3.select("#cluster-key-container").style("display")?d3.select("#cluster-arrow").attr("class","fa fa-2x fa-caret-right"):d3.select("#cluster-arrow").attr("class","fa fa-2x fa-caret-down")}),d3.select("#cluster-key").on("keydown",function(){return"Enter"===d3.event.keyIdentifier?(alchemy.conf.cluster=!0,alchemy.conf.clusterKey=this.value,alchemy.generateLayout()):void 0})}}}.call(this),function(){alchemy.controlDash={init:function(){var a;return this.dashIsShown()?(a=alchemy.conf.divSelector,d3.select(""+a).append("div").attr("id","control-dash-wrapper").attr("class","col-md-4 initial"),d3.select("#control-dash-wrapper").append("i").attr("id","dash-toggle").attr("class","fa fa-flask col-md-offset-12"),d3.select("#control-dash-wrapper").append("div").attr("id","control-dash").attr("class","col-md-12"),d3.select("#dash-toggle").on("click",alchemy.interactions.toggleControlDash),alchemy.controlDash.zoomCtrl(),alchemy.controlDash.search(),alchemy.controlDash.filters(),alchemy.controlDash.stats(),alchemy.controlDash.clustering()):void 0},search:function(){return alchemy.conf.search?(d3.select("#control-dash").append("div").attr("id","search").html("
      \n \n \n
      "),alchemy.search.init()):void 0},zoomCtrl:function(){return alchemy.conf.zoomControls?(d3.select("#control-dash-wrapper").append("div").attr("id","zoom-controls").attr("class","col-md-offset-12").html(" "),d3.select("#zoom-in").on("click",function(){return alchemy.interactions.clickZoom("in")}),d3.select("#zoom-out").on("click",function(){return alchemy.interactions.clickZoom("out")}),d3.select("#zoom-reset").on("click",function(){return alchemy.interactions.clickZoom("reset")})):void 0},filters:function(){return alchemy.conf.nodeFilters||alchemy.conf.edgeFilters?(d3.select("#control-dash").append("div").attr("id","filters"),alchemy.filters.init()):void 0},stats:function(){var a;return alchemy.conf.nodeStats||alchemy.conf.edgeStats?(a='
      \n

      \n Statistics\n

      \n\n
      \n
      \n
        \n
          \n
          ',d3.select("#control-dash").append("div").attr("id","stats").html(a).select("#stats-header").on("click",function(){return d3.select("#all-stats").classed("in")?d3.select("#stats-header>span").attr("class","fa fa-2x fa-caret-right"):d3.select("#stats-header>span").attr("class","fa fa-2x fa-caret-down")}),alchemy.stats.init()):void 0},clustering:function(){var a;return alchemy.conf.clusterControl?(a='
          \n
          \n

          Clustering

          \n \n
          \n
          ',d3.select("#control-dash").append("div").attr("id","clustering").html(a).select("#cluster_control_header"),alchemy.clusterControls.init()):void 0},dashIsShown:function(){var a;return a=alchemy.conf,a.showEditor||a.captionToggle||a.toggleRootNodes||a.removeElement||a.clusterControl||a.nodeStats||a.edgeStats||a.edgeFilters||a.nodeFilters||a.edgesToggle||a.nodesToggle||a.search}}}.call(this),function(){alchemy.filters={init:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p;if(alchemy.filters.show(),alchemy.conf.edgeFilters&&alchemy.filters.showEdgeFilters(),alchemy.conf.nodeFilters&&alchemy.filters.showNodeFilters(),alchemy.conf.nodeTypes){for(e=Object.keys(alchemy.conf.nodeTypes),g="",n=alchemy.conf.nodeTypes[e],h=0,k=n.length;k>h;h++)f=n[h],alchemy.state.filters.nodes[""+f]={active:!0},a=f.replace("_"," "),g+="";$("#node-dropdown").append(g)}if(alchemy.conf.edgeTypes){for(o=d3.selectAll(".edge")[0],i=0,l=o.length;l>i;i++)b=o[i],currentRelationshipTypes[[b].caption]=!0;for(d="",p=alchemy.conf.edgeTypes,j=0,m=p.length;m>j;j++)c=p[j],alchemy.state.filters.edges[""+c]={active:!0},a=c.replace("_"," "),d+="";$("#rel-dropdown").append(d)}return alchemy.conf.captionsToggle&&alchemy.filters.captionsToggle(),alchemy.conf.edgesToggle&&alchemy.filters.edgesToggle(),alchemy.conf.nodesToggle&&alchemy.filters.nodesToggle(),alchemy.filters.update()},show:function(){var a;return a='
          \n

          Filters

          \n \n
          \n
          \n
          ',d3.select("#control-dash #filters").html(a),d3.selectAll("#filter-header").on("click",function(){return d3.select("#filters>form").classed("in")?d3.select("#filter-header>span").attr("class","fa fa-2x fa-caret-right"):d3.select("#filter-header>span").attr("class","fa fa-2x fa-caret-down")}),$("#filters form").submit(!1)},showEdgeFilters:function(){var a;return a='
          \n
          \n

          \n Edge Types\n

          \n \n
          \n \n
          \n',$("#filters form").append(a),d3.select("#filter-rel-header").on("click",function(){return d3.select("#rel-dropdown").classed("in")?d3.select("#filter-rel-header>span").attr("class","fa fa-lg fa-caret-right"):d3.select("#filter-rel-header>span").attr("class","fa fa-lg fa-caret-down")})},showNodeFilters:function(){var a;return a='
          \n
          \n

          \n Node Types\n

          \n \n
          \n \n
          ',$("#filters form").append(a),d3.select("#filter-node-header").on("click",function(){return d3.select("#node-dropdown").classed("in")?d3.select("#filter-node-header>span").attr("class","fa fa-lg fa-caret-right"):d3.select("#filter-node-header>span").attr("class","fa fa-lg fa-caret-down")})},captionsToggle:function(){return d3.select("#filters form").append("li").attr({id:"toggle-captions","class":"list-group-item active-label toggle"}).html("Show Captions").on("click",function(){var a;return a=d3.select("g text").attr("style"),"display: block"===a?d3.selectAll("g text").attr("style","display: none"):d3.selectAll("g text").attr("style","display: block")})},edgesToggle:function(){return d3.select("#filters form").append("li").attr({id:"toggle-edges","class":"list-group-item active-label toggle"}).html("Toggle Edges").on("click",function(){return 0===d3.selectAll(".edge.hidden")[0].length?d3.selectAll(".edge").classed("hidden",!0):d3.selectAll(".edge").classed("hidden",!1)})},nodesToggle:function(){return d3.select("#filters form").append("li").attr({id:"toggle-nodes","class":"list-group-item active-label toggle"}).html("Toggle Nodes").on("click",function(){var a;return a=alchemy.conf.toggleRootNodes?".node,.edge":".node:not(.root),.edge",0===d3.selectAll(".node.hidden")[0].length?d3.selectAll(a).classed("hidden",!0):d3.selectAll(a).classed("hidden",!1)})},update:function(){var a,b;return a=function(a){var b,c,d;return d=a.attr("name"),c=!a.classed("disabled"),b=a.classed("nodeType")?"nodes":"edges",[d,b,c]},b=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n;if("object"!=typeof a){if(g=d3.selectAll("."+a),g.classed({inactive:c,highlight:d}),"nodes"===b)for(m=g.data(),i=0,k=m.length;k>i;i++)for(h=m[i],n=alchemy._nodes[h.id].adjacentEdges,j=0,l=n.length;l>j;j++)e=n[j],f=alchemy._edges[e],f.allNodesActive()||(c=!0),d3.select("[source-target='"+e+"']").classed({inactive:c,highlight:d});return"edges"===b&&g.classed({inactive:function(a){var b;return b=alchemy._edges[a.id].allNodesActive(),c||!b}}),alchemy.stats.update()}},d3.selectAll(".nodeType, .edgeType").on("mouseenter",function(){var b,c,d,e,f;return b=d3.select(this),f=a(b),e=f[0],c=f[1],d=f[2],d3.selectAll("."+e).classed("highlight",!0)}).on("mouseleave",function(){var b,c,d,e,f;return b=d3.select(this),f=a(b),e=f[0],c=f[1],d=f[2],d3.selectAll("."+e).classed("highlight",!1)}).on("click",function(){var c,d,e,f,g,h;return c=d3.select(this),h=a(c),g=h[0],d=h[1],f=h[2],e=!1,c.classed({disabled:f}),b(g,d,f,e)})}}}.call(this),function(){alchemy.interactions={edgeClick:function(a){var b;return b=alchemy.vis,b.selectAll(".edge").classed({highlight:!1}),d3.select("[source-target='"+a.id+"']").classed({highlight:!0,selected:!0}),d3.event.stopPropagation(),"function"==typeof(null!=alchemy.conf.edgeClick)?alchemy.conf.edgeClick():void 0},nodeMouseOver:function(a){var b;return null==alchemy.conf.nodeMouseOver?null:(b=alchemy._nodes[a.id],"function"==typeof alchemy.conf.nodeMouseOver?alchemy.conf.nodeMouseOver(b):"number"==typeof alchemy.conf.nodeMouseOver?b.properties[alchemy.conf.nodeMouseOver]:void 0)},nodeMouseOut:function(a){return null!=alchemy.conf.nodeMouseOut&&"function"==typeof alchemy.conf.nodeMouseOut?alchemy.conf.nodeMouseOut(a):null},nodeMouseUp:function(){},nodeDoubleClick:function(a){var b,c,d;if(d3.event.stopPropagation(),alchemy.conf.extraDataSource&&!a.expanded&&!alchemy.conf.unexpandable.indexOf(a.type===!1)){$('
          nner').show(),console.log("loading more data for "+a.id),a.expanded=!0,d3.json(alchemy.conf.extraDataSource+a.id,loadMoreNodes),c=findAllEdges(a),d=[];for(b in edges)d.push(edges[b].distance*=2);return d}},nodeClick:function(a){var b;d3.event.stopPropagation(),alchemy.vis.select("#node-"+a.id).empty()||(b=alchemy.vis.select("#node-"+a.id).classed("selected"),alchemy.vis.select("#node-"+a.id).classed("selected",!b)),"function"==typeof alchemy.conf.nodeClick&&alchemy.conf.nodeClick(a)},zoom:function(a){return null==this._zoomBehavior&&(this._zoomBehavior=d3.behavior.zoom()),this._zoomBehavior.scaleExtent(a).on("zoom",function(){return alchemy.vis.attr("transform","translate("+d3.event.translate+") scale("+d3.event.scale+")")})},clickZoom:function(a){var b,c,d,e;return e=alchemy.vis.attr("transform").match(/(-*\d+\.*\d*)/g).map(function(a){return parseFloat(a)}),c=e[0],d=e[1],b=e[2],alchemy.vis.attr("transform",function(){return"in"===a?(balchemy.conf.scaleExtent[0]&&(b-=.2),"translate("+c+","+d+") scale("+b+")"):"reset"===a?"translate(0,0) scale(1)":console.log("error")}),null==this._zoomBehavior&&(this._zoomBehavior=d3.behavior.zoom()),this._zoomBehavior.scale(b).translate([c,d])},toggleControlDash:function(){var a;return a=d3.select("#control-dash-wrapper").classed("off-canvas")||d3.select("#control-dash-wrapper").classed("initial"),d3.select("#control-dash-wrapper").classed({"off-canvas":!a,initial:!1,"on-canvas":a})},nodeDragStarted:function(a){return d3.event.sourceEvent.stopPropagation(),d3.select(this).classed("dragging",!0),a.fixed=!0},nodeDragged:function(a){var b,c,d,e,f,g,h,i;for(a.x+=d3.event.dx,a.y+=d3.event.dy,a.px+=d3.event.dx,a.py+=d3.event.dy,e=d3.select(this),e.attr("transform","translate("+a.x+", "+a.y+")"),c=alchemy._nodes[e.datum().id].adjacentEdges,b=new alchemy.drawing.DrawEdges,i=[],g=0,h=c.length;h>g;g++)d=c[g],f=d3.select("g.edge[source-target='"+d+"']"),i.push(b.updateEdge(f));return i},nodeDragended:function(){return d3.select(this).classed({dragging:!1}),alchemy.conf.forceLocked?void 0:alchemy.force.start()},deselectAll:function(){var a;if(null!=(a=d3.event)?!a.defaultPrevented:!0)return alchemy.vis.selectAll(".node, .edge").classed("selected highlight",!1),d3.select(".alchemy svg").classed({"highlight-active":!1}),alchemy.conf.showEditor===!0&&alchemy.modifyElements.nodeEditorClear(),alchemy.vis.selectAll("line.edge").classed("highlighted connected unconnected",!1),alchemy.vis.selectAll("g.node,circle,text").classed("selected unselected neighbor unconnected connecting",!1),alchemy.conf.deselectAll?alchemy.conf.deselectAll():void 0}}}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.Layout=function(){function b(){this.linkDistancefn=a(this.linkDistancefn,this),this.tick=a(this.tick,this),this.collide=a(this.collide,this),this.linkStrength=a(this.linkStrength,this),this.gravity=a(this.gravity,this);var b,c;b=alchemy.conf,c=alchemy._nodes,this.k=Math.sqrt(Math.log(_.size(alchemy._nodes))/(b.graphWidth()*b.graphHeight())),this._clustering=new alchemy.clustering,this.d3NodeInternals=_.keys(alchemy._nodes),b.cluster?(this._charge=function(){return this._clustering.layout.charge},this._linkStrength=function(a){return this._clustering.layout.linkStrength(a)}):(this._charge=function(){return-10/this.k},this._linkStrength=function(a){return c[a.source.id].properties.root||c[a.target.id].properties.root?1:.9}),b.cluster?this._linkDistancefn=function(a){return this._clustering.layout.linkDistancefn(a)}:"default"===b.linkDistancefn?this._linkDistancefn=function(){return 1/(50*this.k)}:"number"==typeof b.linkDistancefn?this._linkDistancefn=function(){return b.linkDistancefn}:"function"==typeof b.linkDistancefn&&(this._linkDistancefn=function(a){return b.linkDistancefn(a)})}return b.prototype.gravity=function(){return alchemy.conf.cluster?this._clustering.layout.gravity(this.k):50*this.k},b.prototype.linkStrength=function(a){return this._linkStrength(a)},b.prototype.friction=function(){return alchemy.conf.cluster?.7:.9},b.prototype.collide=function(a){var b,c,d,e,f,g;return a=a._d3,b=alchemy.conf,g=2*(a.r+a["stroke-width"])+b.nodeOverlap,c=a.x-g,d=a.x+g,e=a.y-g,f=a.y+g,function(b,h,i,j,k){var l,m,n;return b.point&&b.point!==a&&(m=a.x-Math.abs(b.point.x),n=a.y-b.point.y,l=Math.sqrt(m*m+n*n),g=g,g>l&&(l=(l-g)/l*alchemy.conf.alpha,a.x-=m*=l,a.y-=n*=l,b.point.x+=m,b.point.y+=n)),h>d||c>j||i>f||e>k}},b.prototype.tick=function(){var a,b,c,d,e;if(alchemy.conf.collisionDetection)for(b=d3.geom.quadtree(this.d3NodeInternals),e=_.values(alchemy._nodes),c=0,d=e.length;d>c;c++)a=e[c],b.visit(this.collide(a));return alchemy.node.attr("transform",function(a){return"translate("+a.x+","+a.y+")"}),null==this.drawEdge&&(this.drawEdge=new alchemy.drawing.DrawEdge),this.drawEdge.styleText(alchemy.edge),this.drawEdge.styleLink(alchemy.edge)},b.prototype.positionRootNodes=function(){var a,b,c,d,e,f,g,h,i,j;if(a=alchemy.conf,b={width:a.graphWidth(),height:a.graphHeight()},e=_.filter(alchemy._nodes,function(a){return a.properties.root}),1!==e.length){for(d=0,j=[],f=0,g=e.length;g>f;f++)c=e[f],d++,c._d3.x=b.width/Math.sqrt(e.length*d),c._d3.y=b.height/2,j.push(c._d3.fixed=!0);return j}c=e[0],h=[b.width/2,b.width/2],c._d3.x=h[0],c._d3.px=h[1],i=[b.height/2,b.height/2],c._d3.y=i[0],c._d3.py=i[1],c._d3.fixed=!0},b.prototype.chargeDistance=function(){return 500},b.prototype.linkDistancefn=function(a){return this._linkDistancefn(a)},b.prototype.charge=function(){return this._charge()},b}(),alchemy.generateLayout=function(a){var b;return null==a&&(a=!1),b=alchemy.conf,alchemy.layout=new alchemy.Layout,alchemy.force=d3.layout.force().size([b.graphWidth(),b.graphHeight()]).nodes(_.map(alchemy._nodes,function(a){return a._d3})).links(_.map(alchemy._edges,function(a){return a._d3})),alchemy.force.charge(alchemy.layout.charge()).linkDistance(function(a){return alchemy.layout.linkDistancefn(a)}).theta(1).gravity(alchemy.layout.gravity()).linkStrength(function(a){return alchemy.layout.linkStrength(a)}).friction(alchemy.layout.friction()).chargeDistance(alchemy.layout.chargeDistance()),alchemy.updateGraph()}}.call(this),function(){}.call(this),function(){alchemy.search={init:function(){var a;return a=d3.select("#search input"),a.on("keyup",function(){var b;return b=a[0][0].value.toLowerCase(),d3.selectAll(".node").classed("inactive",!1),d3.selectAll("text").attr("style",function(){return""!==b?"display: inline;":void 0}),d3.selectAll(".node").classed("inactive",function(a){var c,d;return c=d3.select(this),"contains"===alchemy.conf.searchMethod&&(d=c.text().toLowerCase().indexOf(b)<0),"begins"===alchemy.conf.searchMethod&&(d=0!==c.text().toLowerCase().indexOf(b)),d?d3.selectAll("[source-target*='"+a.id+"']").classed("inactive",d):d3.selectAll("[source-target*='"+a.id+"']").classed("inactive",function(a){var b,c,d;return b=[a.source.id,a.target.id],c=d3.select("#node-"+b[0]).classed("inactive"),d=d3.select("#node-"+b[1]).classed("inactive"),d||c}),d})})}}}.call(this),function(){alchemy.startGraph=function(a){var b,c,d,e,f,g;return c=alchemy.conf,d3.select(c.divSelector).empty()&&console.warn(alchemy.utils.warnings.divWarning()),a||alchemy.utils.warnings.dataWarning(),alchemy._nodes={},alchemy._edges={},a.nodes.forEach(function(a){return alchemy._nodes[a.id]=new alchemy.models.Node(a)}),a.edges.forEach(function(a){var b;return b=new alchemy.models.Edge(a),alchemy._edges[b.id]=b}),alchemy.vis=d3.select(c.divSelector).attr("style","width:"+c.graphWidth()+"px; height:"+c.graphHeight()+"px").append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("pointer-events","all").on("dblclick.zoom",null).on("click",alchemy.interactions.deselectAll).call(alchemy.interactions.zoom(c.scaleExtent)).append("g").attr("transform","translate("+c.initialTranslate+") scale("+c.initialScale+")"),f=new alchemy.editor.Interactions,d3.select("body").on("keydown",f.deleteSelected),alchemy.generateLayout(),alchemy.controlDash.init(),c.forceLocked||alchemy.force.on("tick",alchemy.layout.tick).start(),null!=c.afterLoad&&("function"==typeof c.afterLoad?c.afterLoad():"string"==typeof c.afterLoad&&(alchemy[c.afterLoad]=!0)),c.initialScale!==alchemy.defaults.initialScale?void alchemy.interactions.zoom().scale(c.initialScale):c.initialTranslate!==alchemy.defaults.initialTranslate?void alchemy.interactions.zoom().translate(c.initialTranslate):((c.cluster||c.directedEdges)&&(d=d3.select(""+alchemy.conf.divSelector+" svg").append("svg:defs")),c.directedEdges&&(b=c.edgeArrowSize+2*c.edgeWidth(),g=d.append("svg:marker").attr("id","arrow").attr("viewBox","0 -"+.4*b+" "+b+" "+b).attr("markerUnits","userSpaceOnUse").attr("markerWidth",b).attr("markerHeight",b).attr("orient","auto"),g.append("svg:path").attr("d","M "+b+",0 L 0,"+.4*b+" L 0,-"+.4*b),c.curvedEdges?g.attr("refX",b+1):g.attr("refX",1)),c.showEditor?(e=new alchemy.editor.Editor,e.startEditor()):void 0)}}.call(this),function(){alchemy.stats={init:function(){return alchemy.stats.update()},nodeStats:function(){var a,b,c,d,e,f,g,h,i,j,k,l;if(g="",f=d3.selectAll(".node")[0].length,a=d3.selectAll(".node.active")[0].length,c=d3.selectAll(".node.inactive")[0].length,g+="
        • Number of nodes: "+f+"
        • ",g+="
        • Number of active nodes: "+a+"
        • ",g+="
        • Number of inactive nodes: "+c+"
        • ",alchemy.conf.nodeTypes){for(e=Object.keys(alchemy.conf.nodeTypes),i="",l=alchemy.conf.nodeTypes[e],j=0,k=l.length;k>j;j++)h=l[j],b=h.replace("_"," "),f=d3.selectAll("g.node."+h)[0].length,i+="
        • Number of nodes of type "+b+": "+f+"
        • ";g+=i}return d="
        • ",g+=d,$("#node-stats").html(g)},edgeStats:function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n;if(d=null,f=d3.selectAll(".edge")[0].length,a=d3.selectAll(".edge.active")[0].length,h=d3.selectAll(".edge.inactive")[0].length,e="
        • Number of relationships: "+f+"
        • Number of active relationships: "+a+"
        • Number of inactive relationships: "+h+"
        • ",alchemy.conf.edgeTypes){for(d=[],m=d3.selectAll(".edge")[0],i=0,k=m.length;k>i;i++)c=m[i],currentRelationshipTypes[[c].caption]=!0;for(n=alchemy.conf.edgeTypes,j=0,l=n.length;l>j;j++)g=n[j],g&&(b=g.replace("_"," "),f=d3.selectAll(".edge."+g)[0].length,d.push([""+b,f]))}return $("#rel-stats").html(e),alchemy.stats.insertSVG("edge",d),d},nodeStats:function(){var a,b,c,d,e,f,g,h,i,j,k;if(c=null,h=d3.selectAll(".node")[0].length,a=d3.selectAll(".node.active")[0].length,b=d3.selectAll(".node.inactive")[0].length,alchemy.conf.nodeTypes)for(c=[],e=Object.keys(alchemy.conf.nodeTypes),k=alchemy.conf.nodeTypes[e],i=0,j=k.length;j>i;i++)g=k[i],f=d3.selectAll("g.node."+g)[0].length,c.push([""+g,f]);return d="
        • Number of nodes: "+h+"
        • Number of active nodes: "+a+"
        • Number of inactive nodes: "+b+"
        • ",$("#node-stats").html(d),alchemy.stats.insertSVG("node",c),c},insertSVG:function(a,b){var c,d,e,f,g,h,i,j;return null===b?d3.select("#"+a+"-stats-graph").html("

          There are no "+a+"Types listed in your conf.

          "):(j=.25*alchemy.conf.graphWidth(),f=250,h=j/4,e=d3.scale.category20(),c=d3.svg.arc().outerRadius(h-10).innerRadius(h/2),g=d3.layout.pie().sort(null).value(function(a){return a[1]}),i=d3.select("#"+a+"-stats-graph").append("svg").append("g").style({width:j,height:f}).attr("transform","translate("+j/2+","+f/2+")"),d=i.selectAll(".arc").data(g(b)).enter().append("g").classed("arc",!0).on("mouseover",function(a,c){return d3.select("#"+b[c][0]+"-stat").classed("hidden",!1)}).on("mouseout",function(a,c){return d3.select("#"+b[c][0]+"-stat").classed("hidden",!0)}),d.append("path").attr("d",c).attr("stroke",function(a,b){return e(b)}).attr("stroke-width",2).attr("fill-opacity","0.3"),d.append("text").attr("transform",function(a){return"translate("+c.centroid(a)+")"}).attr("id",function(a,c){return""+b[c][0]+"-stat"}).attr("dy",".35em").classed("hidden",!0).text(function(a,c){return b[c][0]}))},update:function(){return alchemy.conf.nodeStats===!0&&alchemy.stats.nodeStats(),alchemy.conf.edgeStats===!0?alchemy.stats.edgeStats():void 0}}}.call(this),function(){alchemy.updateGraph=function(a){var b,c,d;if(null==a&&(a=!0),alchemy.edge=alchemy.vis.selectAll("g.edge").data(_.map(alchemy._edges,function(a){return a._d3}),function(a){return a.id}),alchemy.node=alchemy.vis.selectAll("g.node").data(_.map(alchemy._nodes,function(a){return a._d3}),function(a){return a.id}),a){for(alchemy.layout.positionRootNodes(),this.force.start();this.force.alpha()>.005;)alchemy.force.tick();b=new alchemy.drawing.DrawEdges,b.createEdge(alchemy.edge),c=new alchemy.drawing.DrawNodes,c.createNode(alchemy.node),d=!0,console.log(Date()+" completed initial computation")}return alchemy.vis.selectAll("g.node").attr("transform",function(a){return"translate("+a.x+", "+a.y+")"}),alchemy.node.exit().remove()}}.call(this),function(){alchemy.defaults={graphWidth:function(){return d3.select(this.divSelector).node().parentElement.clientWidth},graphHeight:function(){return"BODY"===d3.select(this.divSelector).node().parentElement.nodeName?window.innerHeight:d3.select(this.divSelector).node().parentElement.clientHeight},alpha:.5,collisionDetection:!0,nodeOverlap:25,fixNodes:!1,fixRootNodes:!1,forceLocked:!0,linkDistancefn:"default",nodePositions:null,showEditor:!1,captionToggle:!1,toggleRootNodes:!1,removeElement:!1,cluster:!1,clusterKey:"cluster",clusterColours:d3.shuffle(["#DD79FF","#FFFC00","#00FF30","#5168FF","#00C0FF","#FF004B","#00CDCD","#f83f00","#f800df","#ff8d8f","#ffcd00","#184fff","#ff7e00"]),clusterControl:!0,nodeStats:!1,edgeStats:!1,edgeFilters:!0,nodeFilters:!0,edgesToggle:!1,nodesToggle:!1,zoomControls:!1,nodeCaption:"caption",nodeStyle:{},nodeColour:null,nodeMouseOver:"caption",nodeRadius:10,nodeTypes:null,rootNodes:"root",rootNodeRadius:15,edgeCaption:"caption",edgeClick:"default",edgeStyle:function(){return null},edgeTypes:null,curvedEdges:!1,edgeWidth:function(){return 4},edgeOverlayWidth:20,directedEdges:!1,edgeArrowSize:5,search:!1,searchMethod:"contains",afterLoad:"afterLoad",divSelector:"#alchemy",dataSource:null,initialScale:1,initialTranslate:[0,0],scaleExtent:[.5,2.4],dataWarning:"default",warningMessage:"There be no data! What's going on?"}}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.drawing.DrawEdge=function(){function b(){this.setInteractions=a(this.setInteractions,this),this.styleText=a(this.styleText,this),this.classEdge=a(this.classEdge,this),this.styleLink=a(this.styleLink,this),this.createLink=a(this.createLink,this);var b;b=alchemy.conf,this.curved=b.curvedEdges,this.directed=b.directedEdges,this.utils=new alchemy.drawing.EdgeUtils}return b.prototype.createLink=function(a){var b,c,d;return b=alchemy.conf,c=alchemy.interactions,d=this.utils,this.curved?(a.append("path").attr("class","edge-line").attr("id",function(a){return"path-"+a.id}),a.filter(function(a){return null!=a.caption}).append("text"),a.append("path").attr("class","edge-handler").style("stroke-width",""+b.edgeOverlayWidth)):(a.append("line").attr("class","edge-line").attr("shape-rendering","optimizeSpeed").style("stroke",function(a){return d.edgeStyle(a)}).style("stroke-width",function(a){var b;return b=alchemy._edges[a.id].properties,alchemy.conf.edgeWidth(b)}),a.filter(function(a){return null!=a.caption}).append("text"),a.append("rect").attr("class","edge-handler"))},b.prototype.styleLink=function(a){var b,c;return b=alchemy.conf,c=this.utils,this.curved?(a.selectAll("path").attr("d",function(a){var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s;return d=c.edgeAngle(a),n=Math.abs(d)>90?-1:1,m=function(a){return 0!==a?0>a?-1:1:0}(d),q=c.startLine(a),i=c.endLine(a),o=q.x,p=q.y,r=i.x,s=i.y,g=r-o,h=s-p,j=Math.sqrt(g*g+h*h),k=(g*alchemy.conf.nodeRadius+2)/j,l=(h*alchemy.conf.nodeRadius+2)/j,e=-m*b.edgeArrowSize+k,f=n*b.edgeArrowSize+l,"M "+(o-k)+","+(p-l)+" A "+j+", "+j+" "+c.edgeAngle(a)+" 0, 1 "+(r-e)+", "+(s-f) +}),a.select("path.edge-line").style("stroke",function(a){return c.edgeStyle(a)})):(a.select(".edge-line").each(function(a){var b,d;return d=c.startLine(a),b=c.endLine(a),d3.select(this).attr({x1:d.x,y1:d.y,x2:b.x,y2:b.y})}),a.select(".edge-handler").attr("x",0).attr("y",-b.edgeOverlayWidth/2).attr("height",b.edgeOverlayWidth).attr("width",function(a){return c.edgeLength(a)}).attr("transform",function(a){return"translate("+a.source.x+", "+a.source.y+") rotate("+c.edgeAngle(a)+")"})),this.directed?a.select(".edge-line").attr("marker-end","url(#arrow)"):void 0},b.prototype.classEdge=function(a){return a.classed("active",!0)},b.prototype.styleText=function(a){var b;return b=this.utils,this.curved?a.select("text").attr("dx",function(a){return b.middlePath(a).x}).attr("dy",function(a){return b.middlePath(a).y+20}).attr("transform",function(a){return"rotate("+b.captionAngle(a)+" "+b.middlePath(a).x+" "+b.middlePath(a).y+")"}).text(function(a){return a.caption}):a.select("text").attr("dx",function(a){return b.middleLine(a).x}).attr("dy",function(a){return b.middleLine(a).y-5}).attr("transform",function(a){return"rotate("+b.captionAngle(a)+" "+b.middleLine(a).x+" "+b.middleLine(a).y+")"}).text(function(a){return a.caption})},b.prototype.setInteractions=function(a){var b,c;return b="editor"===alchemy.getState("interactions"),b?(c=new alchemy.editor.Interactions,a.select(".edge-handler").on("click",c.edgeClick)):a.select(".edge-handler").on("click",alchemy.interactions.edgeClick)},b}()}.call(this),function(){alchemy.drawing.DrawEdges=function(){function a(){this.utils=new alchemy.drawing.EdgeUtils,this.drawEdge=new alchemy.drawing.DrawEdge(this.utils)}return a.prototype.createEdge=function(a){return a.enter().append("g").attr("id",function(a){return"edge-"+a.id}).attr("class",function(a){var b;return b=alchemy._edges[a.id].properties.caption,"edge "+b}).attr("source-target",function(a){return""+a.source.id+"-"+a.target.id}),this.drawEdge.createLink(a),this.drawEdge.classEdge(a),this.drawEdge.styleLink(a),this.drawEdge.styleText(a),this.drawEdge.setInteractions(a),a.exit().remove()},a.prototype.updateEdge=function(a){return this.drawEdge.classEdge(a),this.drawEdge.styleLink(a),this.drawEdge.styleText(a),this.drawEdge.setInteractions(a)},a}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.drawing.DrawNode=function(){function b(){this.styleNode=a(this.styleNode,this),this.setInteractions=a(this.setInteractions,this),this.createNode=a(this.createNode,this),this.styleText=a(this.styleText,this);var b,c,d,e;c=alchemy.interactions,b=alchemy.conf,d=alchemy._nodes,c=alchemy.interactions,this.utils=new alchemy.drawing.NodeUtils,e=this.utils,this._styleText=function(a){return a.selectAll("text").attr("dy",function(a){return d[a.id].properties.root?b.rootNodeRadius/2:2*b.nodeRadius-5}).html(function(a){return e.nodeText(a)})},this._createNode=function(a){return a.append("circle").attr("id",function(a){return"circle-"+a.id}),a.append("svg:text").attr("id",function(a){return"text-"+a.id})},this._styleNode=function(a){return a.select("circle").attr("r",function(a){return a.r}).attr("shape-rendering","optimizeSpeed").attr("style",function(a){return e.nodeStyle(a)})},this._setInteractions=function(a){var c,d,e,f,g,h;return e="editor"===alchemy.getState("interactions"),c=alchemy.interactions,d=d3.behavior.drag().origin(Object).on("dragstart",null).on("drag",null).on("dragend",null),e?(f=new alchemy.editor.Interactions,a.on("mouseup",f.nodeMouseUp).on("mouseover",f.nodeMouseOver).on("mouseout",f.nodeMouseOut).on("dblclick",c.nodeDoubleClick).on("click",f.nodeClick)):(a.on("mouseup",null).on("mouseover",c.nodeMouseOver).on("mouseout",c.nodeMouseOut).on("dblclick",c.nodeDoubleClick).on("click",c.nodeClick),d=d3.behavior.drag().origin(Object).on("dragstart",c.nodeDragStarted).on("drag",c.nodeDragged).on("dragend",c.nodeDragended),b.fixNodes||(g=a.filter(function(a){return a.root!==!0}),g.call(d)),b.fixRootNodes?void 0:(h=a.filter(function(a){return a.root===!0}),h.call(d)))}}return b.prototype.styleText=function(a){return this._styleText(a)},b.prototype.createNode=function(a){return this._createNode(a)},b.prototype.setInteractions=function(a){return this._setInteractions(a)},b.prototype.styleNode=function(a){return this._styleNode(a)},b}()}.call(this),function(){alchemy.drawing.DrawNodes=function(){function a(){this.drawNode=new alchemy.drawing.DrawNode}return a.prototype.createNode=function(a){return a.enter().append("g").attr("class",function(a){var b;return b=alchemy._nodes[a.id].getProperties(),null!=a.nodeType?"node "+a.nodeType+" active":"node active"}).attr("id",function(a){return"node-"+a.id}).classed("root",function(a){return a.root}),this.drawNode.createNode(a),this.drawNode.styleNode(a),this.drawNode.styleText(a),this.drawNode.setInteractions(a),a.exit().remove()},a.prototype.updateNode=function(a){return this.drawNode.styleNode(a),this.drawNode.styleText(a),this.drawNode.setInteractions(a)},a}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.drawing.EdgeUtils=function(){function b(){this.captionAngle=a(this.captionAngle,this);var b,c,d,e,f,g,h;d=alchemy.conf,g=alchemy._nodes,e=alchemy._edges,alchemy.conf.cluster?(c=alchemy.layout._clustering,this.edgeStyle=function(a){var b,d,e,f;return b=alchemy.conf.clusterKey,g[a.source.id].properties.root||g[a.target.id].properties.root?(f=g[a.source.id].properties.root?g[a.target.id].properties[b]:g[a.source.id].properties[b],""+c.getClusterColour(f)):g[a.source.id].properties[b]===g[a.target.id].properties[b]?(f=g[a.source.id].properties[b],""+c.getClusterColour(f)):g[a.source.id].properties[b]!==g[a.target.id].properties[b]?(e=""+g[a.source.id].properties[b]+"-"+g[a.target.id].properties[b],d="cluster-gradient-"+e,"url(#"+d+")"):void 0}):this.edgeStyle=null==alchemy.conf.edgeStyle||alchemy.conf.cluster?function(){return""}:function(a){return""+alchemy.conf.edgeStyle(a)},h=function(a){return a*a},f=function(a){var b,c;return c=a.target.x-a.source.x,b=a.target.y-a.source.y,Math.sqrt(b*b+c*c)},this._edgeWalk=function(a,b){var c,e,g;return g=a.target.x-a.source.x,e=a.target.y-a.source.y,f=Math.sqrt(e*e+g*g),"middle"===b?(c=f/2,{x:a.source.x+g*c/f,y:a.source.y+e*c/f}):"linkStart"===b?(c=a.source.r+a.source["stroke-width"],{x:a.source.x+g*c/f,y:a.source.y+e*c/f}):"linkEnd"===b?(c=d.curvedEdges?f:f-(a.target.r+a.target["stroke-width"]),d.directedEdges&&(c-=d.edgeArrowSize),{x:a.source.x+g*c/f,y:a.source.y+e*c/f}):void 0},b=alchemy.conf.edgeCaption,"string"==typeof b?this.edgeCaption=function(a){return e[a.id].properties[b]}:"function"==typeof b&&(this.edgeCaption=function(a){return b(e[a.id])})}return b.prototype.middleLine=function(a){return this._edgeWalk(a,"middle")},b.prototype.startLine=function(a){return this._edgeWalk(a,"linkStart")},b.prototype.endLine=function(a){return this._edgeWalk(a,"linkEnd")},b.prototype.edgeLength=function(a){var b,c,d;return d=a.target.x-a.source.x,b=a.target.y-a.source.y,c=Math.sqrt(b*b+d*d)},b.prototype.edgeAngle=function(a){var b,c;return c=a.target.x-a.source.x,b=a.target.y-a.source.y,Math.atan2(b,c)/Math.PI*180},b.prototype.captionAngle=function(a){var b;return b=this.edgeAngle(a),-90>b||b>90?b+=180:b},b.prototype.hyp=function(a){return hyp(a)},b.prototype.middlePath=function(a){var b,c;return c=d3.select("#path-"+a.id).node(),b=c.getPointAtLength(c.getTotalLength()/2),{x:b.x,y:b.y}},b}()}.call(this),function(){alchemy.drawing.NodeUtils=function(){function a(){var a,b;b=alchemy._nodes,a=alchemy.conf,this.nodeColours=a.cluster?function(b){var c,d,e,f,g;return g=alchemy._nodes[b.id].properties,d=alchemy.layout._clustering.clusterMap,c=alchemy.conf.clusterKey,f=d[g[c]]%a.clusterColours.length,e=a.clusterColours[f],""+e}:function(){var b;return a.nodeColour?b=a.nodeColour:""}}return a.prototype.nodeStyle=function(a){var b,c;return b=this.nodeColours(a),c="editor"===alchemy.getState("interactions")?"#E82C0C":b,"fill: "+b+"; stroke: "+b+"; stroke-width: "+a["stroke-width"]+";"},a.prototype.nodeText=function(a){var b,c;return c=alchemy._nodes[a.id],alchemy.conf.nodeCaption&&"string"==typeof alchemy.conf.nodeCaption?null!=c.properties[alchemy.conf.nodeCaption]?c.properties[alchemy.conf.nodeCaption]:"":alchemy.conf.nodeCaption&&"function"==typeof alchemy.conf.nodeCaption?(b=alchemy.conf.nodeCaption(c),(void 0===b||"undefined"===String(b))&&(alchemy.log.caption="At least one caption returned undefined",alchemy.conf.caption=!1),b):void 0},a}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.editor.Editor=function(){function b(){this.nodeEditor=a(this.nodeEditor,this),this.startEditor=a(this.startEditor,this),this.utils=new alchemy.editor.Utils}return b.prototype.editorContainerHTML='
          \n

          Editor

          \n
          \n
          \n
            \n
          • Remove Selected
          • \n
          • Editor mode enabled, click to disable editor interactions
          • \n
          \n
          ',b.prototype.elementEditorHTML=function(a){return"

          "+a+' Editor

          \n
          \n
          \n \n \n
          \n \n
          \n
          \n \n
          '},b.prototype.startEditor=function(){var a,b,c,d,e;return a=alchemy.conf.divSelector,d=this.editorContainerHTML,b=d3.select(""+a+" #control-dash").append("div").attr("id","editor").html(d),b.select("#editor-header").on("click",function(){return d3.select("#element-options").classed("in")?d3.select("#editor-header>span").attr("class","fa fa-2x fa-caret-right"):d3.select("#editor-header>span").attr("class","fa fa-2x fa-caret-down")}),c=b.select("#element-options ul #editor-interactions").on("click",function(){return d3.select(this).attr("class",function(){return"editor"===alchemy.getState()?(alchemy.setState("interactions","default"),"inactive list-group-item"):(alchemy.setState("interactions","editor"),"active list-group-item")}).html(function(){return"editor"===alchemy.getState()?"Disable Editor Interactions":"Enable Editor Interactions"})}),b.select("#element-options ul #remove").on("click",function(){return alchemy.editor.remove()}),e=this.utils,c.on("click",function(){return d3.select("#editor-interactions").classed("active")?(e.disableEditor(),d3.select("#editor-interactions").classed({active:!1,inactive:!0}).html("Editor mode disabled, click to enable editor interactions")):(e.enableEditor(),d3.select("#editor-interactions").classed({active:!0,inactive:!1}).html("Editor mode enabled, click to disable editor interactions"))})},b.prototype.nodeEditor=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;c=alchemy.conf.divSelector,d=d3.select(""+c+" #control-dash-wrapper #control-dash #editor"),i=d.select("#element-options"),f=this.elementEditorHTML("Node"),e=i.append("div").attr("id","node-editor").html(f),e.attr("class",function(){return d3.select("#editor-interactions").classed("active")?"enabled":"hidden"}),b=d.select("#node-editor form #add-property"),b.select("#node-add-prop-key").attr("placeholder","New Property Name").attr("value",null),b.select("#node-add-prop-value").attr("placeholder","New Property Value").attr("value",null),d3.select("#add-property-form").on("submit",function(){var a,b;return event.preventDefault(),a=d3.select("#add-prop-key").property("value"),a=a.replace(/\s/g,"_"),b=d3.select("#add-prop-value").property("value"),l(a,b,!0),d3.selectAll("#add-property .edited-property").classed({"edited-property":!1}),this.reset()}),g=alchemy._nodes[a.id].getProperties(),d3.select("#node-"+a.id).classed({editing:!0}),k=d.select("#node-editor #properties-list");for(j in g)m=g[j],h=k.append("div").attr("id","node-"+j).attr("class","property form-inline form-group"),h.append("label").attr("for","node-"+j+"-input").attr("class","form-control property-name").text(""+j),h.append("input").attr("id","node-"+j+"-input").attr("class","form-control property-value").attr("value",""+m);return d3.select("#properties-list").on("submit",function(){var a,b,c,d,e,f,g;for(event.preventDefault(),b=d3.selectAll(".edited-property"),g=b[0],e=0,f=g.length;f>e;e++)j=g[e],c=d3.select(j),a=c.select("label").text(),d=c.select("input").attr("value"),l(a,d,!1);return d3.selectAll("#node-properties-list .edited-property").classed({"edited-property":!1}),this.reset()}),d3.selectAll("#add-prop-key, #add-prop-value, .property").on("keydown",function(){return 13===d3.event.keyCode&&event.preventDefault(),d3.select(this).classed({"edited-property":!0})}),l=function(b,c,d){var e,f;return f=a.id,""!==b&&""!==c?(alchemy._nodes[f].setProperty(""+b,""+c),e=new alchemy.drawing.DrawNodes,e.updateNode(d3.select("#node-"+f)),d===!0?(d3.select("#node-add-prop-key").attr("value","property added/updated to key: "+b),d3.select("#node-add-prop-value").attr("value","property at "+b+" updated to: "+c)):d3.select("#node-"+b+"-input").attr("value","property at "+b+" updated to: "+c)):d===!0?(d3.select("#node-add-prop-key").attr("value","null or invalid input"),d3.select("#node-add-prop-value").attr("value","null or invlid input")):d3.select("#node-"+b+"-input").attr("value","null or invalid input")}},b.prototype.editorClear=function(){return d3.selectAll(".node").classed({editing:!1}),d3.selectAll(".edge").classed({editing:!1}),d3.select("#node-editor").remove(),d3.select("#edge-editor").remove(),d3.select("#node-add-prop-submit").attr("placeholder",function(){return d3.selectAll(".selected").empty()?"select a node or edge to edit properties":"add a property to this element"})},b.prototype.edgeEditor=function(a){var b,c,d,e,f,g,h,i,j,k,l,m;c=alchemy.conf.divSelector,f=d3.select(""+c+" #control-dash-wrapper #control-dash #editor"),i=f.select("#element-options"),h=this.elementEditorHTML("Edge"),g=i.append("div").attr("id","edge-editor").html(h),g.attr("class",function(){return d3.select("#editor-interactions").classed("active")?"enabled":"hidden"}),b=f.select("#edge-editor form #add-property"),b.select("#add-prop-key").attr("placeholder","New Property Name").attr("value",null),b.select("#add-prop-value").attr("placeholder","New Property Value").attr("value",null),d=alchemy._edges[a.id].getProperties(),d3.select("#edge-"+a.id).classed({editing:!0}),k=f.select("#edge-editor #properties-list");for(j in d)m=d[j],e=k.append("div").attr("id","edge-"+j).attr("class","property form-inline form-group"),e.append("label").attr("for","edge-"+j+"-input").attr("class","form-control property-name").text(""+j),e.append("input").attr("id","edge-"+j+"-input").attr("class","form-control property-value").attr("value",""+m);return d3.selectAll("#add-prop-key, #add-prop-value, .property").on("keydown",function(){return 13===d3.event.keyCode&&event.preventDefault(),d3.select(this).classed({"edited-property":!0})}),d3.select("#add-property-form").on("submit",function(){var a,b;return event.preventDefault(),a=d3.select("#add-prop-key").property("value"),a=a.replace(/\s/g,"_"),b=d3.select("#add-prop-value").property("value"),l(a,b,!0),d3.selectAll("#add-property .edited-property").classed({"edited-property":!1}),this.reset()}),d3.select("#properties-list").on("submit",function(){var a,b,c,d,e,f,g;for(event.preventDefault(),b=d3.selectAll(".edited-property"),g=b[0],e=0,f=g.length;f>e;e++)j=g[e],c=d3.select(j),a=c.select("label").text(),d=c.select("input").property("value"),l(a,d,!1);return d3.selectAll("#properties-list .edited-property").classed({"edited-property":!1}),this.reset()}),l=function(b,c,d){var e,f,g;return f=a.id,""!==b&&""!==c?(alchemy._edges[f].setProperty(""+b,""+c),g=d3.select("#edge-"+f),e=new alchemy.drawing.DrawEdges,e.updateEdge(d3.select("#edge-"+f)),d===!0?(d3.select("#add-prop-key").attr("value","property added/updated to key: "+b),d3.select("#add-prop-value").attr("value","property at "+b+" updated to: "+c)):d3.select("#edge-"+b+"-input").attr("value","property at "+b+" updated to: "+c)):d===!0?(d3.select("#add-prop-key").attr("value","null or invalid input"),d3.select("#add-prop-value").attr("value","null or invlid input")):d3.select("#edge-"+b+"-input").attr("value","null or invalid input")}},b}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.editor.Interactions=function(){function b(){this.reset=a(this.reset,this),this.deleteSelected=a(this.deleteSelected,this),this.addNodeDragended=a(this.addNodeDragended,this),this.addNodeDragging=a(this.addNodeDragging,this),this.addNodeStart=a(this.addNodeStart,this),this.edgeClick=a(this.edgeClick,this),this.nodeClick=a(this.nodeClick,this),this.nodeMouseUp=a(this.nodeMouseUp,this),this.editor=new alchemy.editor.Editor}return b.prototype.nodeMouseOver=function(){var a;return d3.select(this).select("circle").empty()||(a=d3.select(this).select("circle").attr("r"),d3.select(this).select("circle").attr("r",3*a)),this},b.prototype.nodeMouseUp=function(a){return this.sourceNode!==a?(this.mouseUpNode=!0,this.targetNode=a,this.click=!1):this.click=!0,this},b.prototype.nodeMouseOut=function(){var a;return d3.select(this).select("circle").empty()||(a=d3.select(this).select("circle").attr("r"),d3.select(this).select("circle").attr("r",a/3)),this},b.prototype.nodeClick=function(a){var b;return d3.event.stopPropagation(),alchemy.vis.select("#node-"+a.id).empty()||(b=alchemy.vis.select("#node-"+a.id).classed("selected"),alchemy.vis.select("#node-"+a.id).classed("selected",!b)),this.editor.editorClear(),this.editor.nodeEditor(a)},b.prototype.edgeClick=function(a){return d3.event.stopPropagation(),this.editor.editorClear(),this.editor.edgeEditor(a)},b.prototype.addNodeStart=function(a){return d3.event.sourceEvent.stopPropagation(),this.sourceNode=a,d3.select("#dragline").classed({hidden:!1}),this},b.prototype.addNodeDragging=function(){var a,b;return a=d3.event.x,b=d3.event.y,d3.select("#dragline").attr("x1",this.sourceNode.x).attr("y1",this.sourceNode.y).attr("x2",a).attr("y2",b).attr("style","stroke: #FFF"),this},b.prototype.addNodeDragended=function(){var a,b,c;return this.click||(this.mouseUpNode||(a=d3.select("#dragline"),b=a.attr("x2"),c=a.attr("y2"),this.targetNode={id:""+_.uniqueId("addedNode_"),x:parseFloat(b),y:parseFloat(c),caption:"node added"}),this.newEdge={id:""+this.sourceNode.id+"-"+this.targetNode.id,source:this.sourceNode.id,target:this.targetNode.id,caption:"edited"},alchemy.editor.update(this.targetNode,this.newEdge)),this.reset(),this},b.prototype.deleteSelected=function(){switch(d3.event.keyCode){case 8:case 46:if("INPUT"!==d3.select(d3.event.target).node().tagName)return d3.event.preventDefault(),alchemy.editor.remove()}},b.prototype.reset=function(){return this.mouseUpNode=null,this.sourceNode=null,this.targetNode=null,this.newEdge=null,this.click=null,d3.select("#dragline").classed({hidden:!0}).attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",0),this},b}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.editor.Utils=function(){function b(){this.enableEditor=a(this.enableEditor,this),this.drawNodes=new alchemy.drawing.DrawNodes,this.drawEdges=new alchemy.drawing.DrawEdges}return b.prototype.enableEditor=function(){var a,b,c;return alchemy.setState("interactions","editor"),a=alchemy.vis.append("line").attr("id","dragline"),this.drawNodes.updateNode(alchemy.node),this.drawEdges.updateEdge(alchemy.edge),c=d3.selectAll(".selected"),b=new alchemy.editor.Editor,c.empty()||1!==c.length?c.classed({selected:!1}):c.classed("node")?(b.nodeEditor(c.datum()),d3.select("#node-editor").attr("class","enabled").style("opacity",1)):c.classed("edge")?(b.edgeEditor(c.datum()),d3.select("#edge-editor").attr("class","enabled").style("opacity",1)):void 0},b.prototype.disableEditor=function(){return alchemy.setState("interactions","default"),alchemy.vis.select("#dragline").remove(),d3.select("#node-editor").transition().duration(300).style("opacity",0),d3.select("#node-editor").transition().delay(300).attr("class","hidden"),this.drawNodes.updateNode(alchemy.node),d3.selectAll(".node").classed({selected:!1})},b.prototype.remove=function(){var a,b,c,d,e,f,g,h,i,j,k,l;for(e=d3.selectAll(".selected.node"),j=e[0],l=[],f=0,h=j.length;h>f;f++)if(b=j[f],c=d3.select(b).data()[0].id,d=alchemy._nodes[c],null!=d){for(k=d.adjacentEdges,g=0,i=k.length;i>g;g++)a=k[g],alchemy._edges=_.omit(alchemy._edges,""+a),alchemy.edge=alchemy.edge.data(_.map(alchemy._edges,function(a){return a._d3}),function(a){return a.id}),d3.select("#edge-"+a).remove();alchemy._nodes=_.omit(alchemy._nodes,""+c),alchemy.node=alchemy.node.data(_.map(alchemy._nodes,function(a){return a._d3}),function(a){return a.id}),d3.select(b).remove(),l.push("editor"===alchemy.getState("interactions")?alchemy.modifyElements.nodeEditorClear():void 0)}else l.push(void 0);return l},b.prototype.addNode=function(a){var b;return b=alchemy._nodes[a.id]=new alchemy.models.Node({id:""+a.id}),b.setProperty("caption",a.caption),b.setD3Property("x",a.x),b.setD3Property("y",a.y),alchemy.node=alchemy.node.data(_.map(alchemy._nodes,function(a){return a._d3}),function(a){return a.id})},b.prototype.addEdge=function(a){var b;return b=alchemy._edges[a.id]=new alchemy.models.Edge(a),alchemy.edge=alchemy.edge.data(_.map(alchemy._edges,function(a){return a._d3}),function(a){return a.id})},b.prototype.update=function(a,b){return this.mouseUpNode?(alchemy.editor.addEdge(b),this.drawEdges.createEdge(alchemy.edge)):(alchemy.editor.addNode(a),alchemy.editor.addEdge(b),this.drawEdges.createEdge(alchemy.edge),this.drawNodes.createNode(alchemy.node)),alchemy.layout.tick()},b}()}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.models.Edge=function(){function b(b){this.allNodesActive=a(this.allNodesActive,this),this.getProperties=a(this.getProperties,this),this.setD3Property=a(this.setD3Property,this),this.setProperty=a(this.setProperty,this),this.toPublic=a(this.toPublic,this);var c,d;d=alchemy.conf,this.id=null!=b.id?b.id:""+b.source+"-"+b.target,this.edgeStyle=_.merge(d.edgeStyle,this.edgeStyle),this.state={active:!0},this.properties=b,this._edgeAttributes=new alchemy.models.EdgeAttributes,c=this._edgeAttributes.edgeCaption(this.properties),c&&(this.properties.caption=c),this._d3={id:this.id,source:alchemy._nodes[this.properties.source]._d3,target:alchemy._nodes[this.properties.target]._d3,caption:c},alchemy._nodes[""+b.source].addEdge(this.id),alchemy._nodes[""+b.target].addEdge(this.id)}return b.prototype.toPublic=function(){var a;return a=_.keys(this.properties),_.pick(this,a)},b.prototype.setProperty=function(a,b){return this.properties[a]=b,"source"===a||"target"===a?this.setD3Property(a,alchemy._nodes[b]._d3):void 0},b.prototype.setD3Property=function(a,b){return this._d3[a]=b},b.prototype.getProperties=function(){return this.properties},b.prototype.allNodesActive=function(){var a,b;return a=d3.select("#node-"+this.properties.source),b=d3.select("#node-"+this.properties.target),!a.classed("inactive")&&!b.classed("inactive")},b}()}.call(this),function(){alchemy.models.EdgeAttributes=function(){function a(){var a,b;b=alchemy.conf,a=b.edgeCaption,"string"==typeof a?this.edgeCaption=function(b){return b[a]}:"function"==typeof a&&(this.edgeCaption=function(b){return a(b)})}return a}()}.call(this),function(){}.call(this),function(){var a=function(a,b){return function(){return a.apply(b,arguments)}};alchemy.models.Node=function(){function b(c){this.removeProperty=a(this.removeProperty,this),this.setD3Property=a(this.setD3Property,this),this.setProperty=a(this.setProperty,this),this.getProperties=a(this.getProperties,this);var d,e,f;d=alchemy.conf,e=new alchemy.models.NodeAttributes,f=e.nodeSize(c),this.id=c.id,this.properties=c,this.state={active:!0},this._d3={id:c.id,r:f,"stroke-width":e.strokeWidth(f),root:this.properties[d.rootNodes]},this.nodeStyle=_.merge(d.nodeStyle,this.nodeStyle),this.adjacentEdges=[],b.prototype.all.push(this.id),d.nodeTypes&&(this.nodeType=this.properties[Object.keys(alchemy.conf.nodeTypes)],this.nodeType&&(this._d3.nodeType=this.nodeType))}return b.prototype.addEdge=function(a){return this.adjacentEdges.push(a),this.adjacentEdges=_.uniq(this.adjacentEdges)},b.prototype.outDegree=function(){return this.adjacentEdges.length},b.prototype.neighbors=function(){var a;return a=new RegExp("[("+this.id+"\\-)(\\-"+this.id+")]","g"),_.map(this.adjacentEdges,function(b){return b.replace(a,"")})},b.prototype.getProperties=function(){return this.properties},b.prototype.setProperty=function(a,b){return this.properties[a]=b},b.prototype.setD3Property=function(a,b){return this._d3[a]=b},b.prototype.removeProperty=function(a){return null!=this.properties.property?_.omit(this.properties,a):void 0},b.prototype.all=[],b}()}.call(this),function(){alchemy.models.NodeAttributes=function(){function a(){var a;a=alchemy.conf.rootNodes,"function"==typeof alchemy.conf.nodeRadius?this.nodeSize=function(b){return null!=b[a]&&d[a]?alchemy.conf.rootNodeRadius(b):alchemy.conf.nodeRadius(b)}:"string"==typeof alchemy.conf.nodeRadius?this.nodeSize=function(b){var c;return c=alchemy.conf.nodeRadius,null!=b[a]?alchemy.conf.rootNodeRadius:null!=b[c]?b[c]:alchemy.defaults.rootNodeRadius}:"number"==typeof alchemy.conf.nodeRadius&&(this.nodeSize=function(b){return null!=b[a]?alchemy.conf.rootNodeRadius:alchemy.conf.nodeRadius})}return a.prototype.strokeWidth=function(a){return a/3},a}()}.call(this),function(){alchemy.utils.warnings={dataWarning:function(){var a;return alchemy.conf.dataWarning&&"function"==typeof alchemy.conf.dataWarning?alchemy.conf.dataWarning():void("default"===alchemy.conf.dataWarning&&(a='',$("body").append(a),$("#no-results").modal("show"),$("#loading-spinner").hide()))},divWarning:function(){return"create an element that matches the value for 'divSelector' in your conf.\nFor instance, if you are using the default 'divSelector' conf, simply provide\n
          ."}}}.call(this); \ No newline at end of file