From 4255a0f9d22da41abe058438d5a2799f432309ce Mon Sep 17 00:00:00 2001 From: Chris Pettitt Date: Wed, 27 Dec 2017 07:17:17 -0700 Subject: [PATCH] Prep v0.5.0 release --- bower.json | 2 +- dist/dagre-d3.core.js | 41 ++-- dist/dagre-d3.core.min.js | 2 +- dist/dagre-d3.core.min.js.map | 2 +- dist/dagre-d3.js | 41 ++-- dist/dagre-d3.min.js | 10 +- dist/dagre-d3.min.js.map | 2 +- dist/demo/arrows.html | 13 +- dist/demo/clusters.html | 2 +- dist/demo/dom.html | 2 +- dist/demo/etl-status.html | 20 +- dist/demo/graph-story-board.html | 13 +- dist/demo/hover.html | 16 +- dist/demo/interactive-demo.html | 9 +- dist/demo/sentence-tokenization.html | 2 +- dist/demo/shapes.html | 13 +- dist/demo/style-attrs.html | 4 +- dist/demo/svg-labels.html | 2 +- dist/demo/tcp-state-diagram.html | 13 +- dist/demo/user-defined.html | 13 +- lib/version.js | 2 +- package-lock.json | 274 ++++++++++++++++++++++++++- package.json | 2 +- 23 files changed, 379 insertions(+), 121 deletions(-) diff --git a/bower.json b/bower.json index 4e956af5..467c622f 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "dagre-d3", - "version": "0.4.18", + "version": "0.5.0", "main": [ "dist/dagre-d3.core.js" ], diff --git a/dist/dagre-d3.core.js b/dist/dagre-d3.core.js index 9edfe461..d51b1e44 100644 --- a/dist/dagre-d3.core.js +++ b/dist/dagre-d3.core.js @@ -123,6 +123,8 @@ function createClusters(selection, g) { return node.id; }) .style("opacity", 0); + + svgClusters = selection.selectAll("g.cluster"); util.applyTransition(svgClusters, g) .style("opacity", 1); @@ -168,6 +170,9 @@ function createEdgeLabels(selection, g) { .append("g") .classed("edgeLabel", true) .style("opacity", 0); + + svgEdgeLabels = selection.selectAll("g.edgeLabel"); + svgEdgeLabels.each(function(e) { var edge = g.edge(e), label = addLabel(d3.select(this), g.edge(e), 0, 0).classed("label", true), @@ -202,6 +207,8 @@ function createEdgePaths(selection, g, arrows) { enter(svgPaths, g); exit(svgPaths, g); + svgPaths = selection.selectAll("g.edgePath"); + util.applyTransition(svgPaths, g) .style("opacity", 1); @@ -264,17 +271,11 @@ function calcPoints(g, e) { } function createLine(edge, points) { - var line = d3.svg.line() + var line = d3.line() .x(function(d) { return d.x; }) .y(function(d) { return d.y; }); - - if (_.has(edge, "lineInterpolate")) { - line.interpolate(edge.lineInterpolate); - } - - if (_.has(edge, "lineTension")) { - line.tension(Number(edge.lineTension)); - } + + line.curve(edge.lineCurve); return line(points); } @@ -340,14 +341,20 @@ function createNodes(selection, g, shapes) { .classed("update", true); svgNodes.selectAll("*").remove(); + svgNodes.enter() .append("g") .attr("class", "node") .style("opacity", 0); + + svgNodes = selection.selectAll("g.node"); + svgNodes.each(function(v) { var node = g.node(v), - thisGroup = d3.select(this), - labelGroup = thisGroup.append("g").attr("class", "label"), + thisGroup = d3.select(this); + util.applyClass(thisGroup, node["class"], + (thisGroup.classed("update") ? "update " : "") + "node"); + var labelGroup = thisGroup.append("g").attr("class", "label"), labelDom = addLabel(labelGroup, node), shape = shapes[node.shape], bbox = _.pick(labelDom.node().getBBox(), "width", "height"); @@ -356,8 +363,6 @@ function createNodes(selection, g, shapes) { if (node.id) { thisGroup.attr("id", node.id); } if (node.labelId) { labelGroup.attr("id", node.labelId); } - util.applyClass(thisGroup, node["class"], - (thisGroup.classed("update") ? "update " : "") + "node"); if (_.has(node, "width")) { bbox.width = node.width; } if (_.has(node, "height")) { bbox.height = node.height; } @@ -667,7 +672,7 @@ function addHtmlLabel(root, node) { // Fix for firefox div.style("white-space", "nowrap"); - var client = div[0][0].getBoundingClientRect(); + var client = div.node().getBoundingClientRect(); fo .attr("width", client.width) .attr("height", client.height); @@ -897,6 +902,8 @@ function render() { var fn = function(svg, g) { preProcessGraph(g); + svg.selectAll("*").remove(); + var outputGroup = createOrSelectGroup(svg, "output"), clustersGroup = createOrSelectGroup(outputGroup, "clusters"), edgePathsGroup = createOrSelectGroup(outputGroup, "edgePaths"), @@ -966,7 +973,7 @@ var NODE_DEFAULT_ATTRS = { var EDGE_DEFAULT_ATTRS = { arrowhead: "normal", - lineInterpolate: "linear" + lineCurve: d3.curveLinear }; function preProcessGraph(g) { @@ -1185,8 +1192,8 @@ function applyTransition(selection, g) { } },{"./lodash":21}],28:[function(require,module,exports){ -module.exports = "0.4.18"; +module.exports = "0.5.0"; },{}]},{},[1])(1) }); -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsImxpYi9hcnJvd3MuanMiLCJsaWIvY3JlYXRlLWNsdXN0ZXJzLmpzIiwibGliL2NyZWF0ZS1lZGdlLWxhYmVscy5qcyIsImxpYi9jcmVhdGUtZWRnZS1wYXRocy5qcyIsImxpYi9jcmVhdGUtbm9kZXMuanMiLCJsaWIvZDMuanMiLCJsaWIvZGFncmUuanMiLCJsaWIvZ3JhcGhsaWIuanMiLCJsaWIvaW50ZXJzZWN0L2luZGV4LmpzIiwibGliL2ludGVyc2VjdC9pbnRlcnNlY3QtY2lyY2xlLmpzIiwibGliL2ludGVyc2VjdC9pbnRlcnNlY3QtZWxsaXBzZS5qcyIsImxpYi9pbnRlcnNlY3QvaW50ZXJzZWN0LWxpbmUuanMiLCJsaWIvaW50ZXJzZWN0L2ludGVyc2VjdC1ub2RlLmpzIiwibGliL2ludGVyc2VjdC9pbnRlcnNlY3QtcG9seWdvbi5qcyIsImxpYi9pbnRlcnNlY3QvaW50ZXJzZWN0LXJlY3QuanMiLCJsaWIvbGFiZWwvYWRkLWh0bWwtbGFiZWwuanMiLCJsaWIvbGFiZWwvYWRkLWxhYmVsLmpzIiwibGliL2xhYmVsL2FkZC1zdmctbGFiZWwuanMiLCJsaWIvbGFiZWwvYWRkLXRleHQtbGFiZWwuanMiLCJsaWIvbG9kYXNoLmpzIiwibGli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xhc3NGbiwgb3RoZXJDbGFzc2VzKSB7XG4gIGlmIChjbGFzc0ZuKSB7XG4gICAgZG9tXG4gICAgICAuYXR0cihcImNsYXNzXCIsIGNsYXNzRm4pXG4gICAgICAuYXR0cihcImNsYXNzXCIsIG90aGVyQ2xhc3NlcyArIFwiIFwiICsgZG9tLmF0dHIoXCJjbGFzc1wiKSk7XG4gIH1cbn1cblxuZnVuY3Rpb24gYXBwbHlUcmFuc2l0aW9uKHNlbGVjdGlvbiwgZykge1xuICB2YXIgZ3JhcGggPSBnLmdyYXBoKCk7XG5cbiAgaWYgKF8uaXNQbGFpbk9iamVjdChncmFwaCkpIHtcbiAgICB2YXIgdHJhbnNpdGlvbiA9IGdyYXBoLnRyYW5zaXRpb247XG4gICAgaWYgKF8uaXNGdW5jdGlvbih0cmFuc2l0aW9uKSkge1xuICAgICAgcmV0dXJuIHRyYW5zaXRpb24oc2VsZWN0aW9uKTtcbiAgICB9XG4gIH1cblxuICByZXR1cm4gc2VsZWN0aW9uO1xufVxuIiwibW9kdWxlLmV4cG9ydHMgPSBcIjAuNS4wXCI7XG4iXX0= diff --git a/dist/dagre-d3.core.min.js b/dist/dagre-d3.core.min.js index 42e94123..0df63d98 100644 --- a/dist/dagre-d3.core.min.js +++ b/dist/dagre-d3.core.min.js @@ -20,5 +20,5 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -e.exports={graphlib:t("./lib/graphlib"),dagre:t("./lib/dagre"),intersect:t("./lib/intersect"),render:t("./lib/render"),util:t("./lib/util"),version:t("./lib/version")}},{"./lib/dagre":8,"./lib/graphlib":9,"./lib/intersect":10,"./lib/render":25,"./lib/util":27,"./lib/version":28}],2:[function(t,e,r){function n(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])}function a(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])}function i(t,e,r,n){var a=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),i=a.append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");l.applyStyle(i,r[n+"Style"]),r[n+"Class"]&&i.attr("class",r[n+"Class"])}var l=t("./util");e.exports={"default":n,normal:n,vee:a,undirected:i}},{"./util":27}],3:[function(t,e,r){function n(t,e){var r=e.nodes().filter(function(t){return a.isSubgraph(e,t)}),n=t.selectAll("g.cluster").data(r,function(t){return t});return n.selectAll("*").remove(),n.enter().append("g").attr("class","cluster").attr("id",function(t){var r=e.node(t);return r.id}).style("opacity",0),a.applyTransition(n,e).style("opacity",1),n.each(function(t){var r=e.node(t),n=d3.select(this);d3.select(this).append("rect");var a=n.append("g").attr("class","label");i(a,r,r.clusterLabelPos)}),n.selectAll("rect").each(function(t){var r=e.node(t),n=d3.select(this);a.applyStyle(n,r.style)}),a.applyTransition(n.exit(),e).style("opacity",0).remove(),n}var a=t("./util"),i=t("./label/add-label");e.exports=n},{"./label/add-label":18,"./util":27}],4:[function(t,e,r){"use strict";function n(t,e){var r=t.selectAll("g.edgeLabel").data(e.edges(),function(t){return l.edgeToId(t)}).classed("update",!0);return r.selectAll("*").remove(),r.enter().append("g").classed("edgeLabel",!0).style("opacity",0),r.each(function(t){var r=e.edge(t),n=i(s.select(this),e.edge(t),0,0).classed("label",!0),l=n.node().getBBox();r.labelId&&n.attr("id",r.labelId),a.has(r,"width")||(r.width=l.width),a.has(r,"height")||(r.height=l.height)}),l.applyTransition(r.exit(),e).style("opacity",0).remove(),r}var a=t("./lodash"),i=t("./label/add-label"),l=t("./util"),s=t("./d3");e.exports=n},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],5:[function(t,e,r){"use strict";function n(t,e,r){var n=t.selectAll("g.edgePath").data(e.edges(),function(t){return p.edgeToId(t)}).classed("update",!0);return o(n,e),d(n,e),p.applyTransition(n,e).style("opacity",1),n.each(function(t){var r=h.select(this),n=e.edge(t);n.elem=this,n.id&&r.attr("id",n.id),p.applyClass(r,n["class"],(r.classed("update")?"update ":"")+"edgePath")}),n.selectAll("path.path").each(function(t){var r=e.edge(t);r.arrowheadId=c.uniqueId("arrowhead");var n=h.select(this).attr("marker-end",function(){return"url("+a(location.href,r.arrowheadId)+")"}).style("fill","none");p.applyTransition(n,e).attr("d",function(t){return i(e,t)}),p.applyStyle(n,r.style)}),n.selectAll("defs *").remove(),n.selectAll("defs").each(function(t){var n=e.edge(t),a=r[n.arrowhead];a(h.select(this),n.arrowheadId,n,"arrowhead")}),n}function a(t,e){var r=t.split("#")[0];return r+"#"+e}function i(t,e){var r=t.edge(e),n=t.node(e.v),a=t.node(e.w),i=r.points.slice(1,r.points.length-1);return i.unshift(u(n,i[0])),i.push(u(a,i[i.length-1])),l(r,i)}function l(t,e){var r=h.svg.line().x(function(t){return t.x}).y(function(t){return t.y});return c.has(t,"lineInterpolate")&&r.interpolate(t.lineInterpolate),c.has(t,"lineTension")&&r.tension(Number(t.lineTension)),r(e)}function s(t){var e=t.getBBox(),r=t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width/2,e.height/2);return{x:r.e,y:r.f}}function o(t,e){var r=t.enter().append("g").attr("class","edgePath").style("opacity",0);r.append("path").attr("class","path").attr("d",function(t){var r=e.edge(t),n=e.node(t.v).elem,a=c.range(r.points.length).map(function(){return s(n)});return l(r,a)}),r.append("defs")}function d(t,e){var r=t.exit();p.applyTransition(r,e).style("opacity",0).remove(),p.applyTransition(r.select("path.path"),e).attr("d",function(t){var r=e.node(t.v);if(r){var n=c.range(this.getTotalLength()).map(function(){return r});return l({},n)}return h.select(this).attr("d")})}var c=t("./lodash"),u=t("./intersect/intersect-node"),p=t("./util"),h=t("./d3");e.exports=n},{"./d3":7,"./intersect/intersect-node":14,"./lodash":21,"./util":27}],6:[function(t,e,r){"use strict";function n(t,e,r){var n=e.nodes().filter(function(t){return!l.isSubgraph(e,t)}),o=t.selectAll("g.node").data(n,function(t){return t}).classed("update",!0);return o.selectAll("*").remove(),o.enter().append("g").attr("class","node").style("opacity",0),o.each(function(t){var n=e.node(t),o=s.select(this),d=o.append("g").attr("class","label"),c=i(d,n),u=r[n.shape],p=a.pick(c.node().getBBox(),"width","height");n.elem=this,n.id&&o.attr("id",n.id),n.labelId&&d.attr("id",n.labelId),l.applyClass(o,n["class"],(o.classed("update")?"update ":"")+"node"),a.has(n,"width")&&(p.width=n.width),a.has(n,"height")&&(p.height=n.height),p.width+=n.paddingLeft+n.paddingRight,p.height+=n.paddingTop+n.paddingBottom,d.attr("transform","translate("+(n.paddingLeft-n.paddingRight)/2+","+(n.paddingTop-n.paddingBottom)/2+")");var h=u(s.select(this),p,n);l.applyStyle(h,n.style);var f=h.node().getBBox();n.width=f.width,n.height=f.height}),l.applyTransition(o.exit(),e).style("opacity",0).remove(),o}var a=t("./lodash"),i=t("./label/add-label"),l=t("./util"),s=t("./d3");e.exports=n},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],7:[function(t,e,r){e.exports=window.d3},{}],8:[function(t,e,r){var n;if(t)try{n=t("dagre")}catch(a){}n||(n=window.dagre),e.exports=n},{dagre:void 0}],9:[function(t,e,r){var n;if(t)try{n=t("graphlib")}catch(a){}n||(n=window.graphlib),e.exports=n},{graphlib:void 0}],10:[function(t,e,r){e.exports={node:t("./intersect-node"),circle:t("./intersect-circle"),ellipse:t("./intersect-ellipse"),polygon:t("./intersect-polygon"),rect:t("./intersect-rect")}},{"./intersect-circle":11,"./intersect-ellipse":12,"./intersect-node":14,"./intersect-polygon":15,"./intersect-rect":16}],11:[function(t,e,r){function n(t,e,r){return a(t,e,e,r)}var a=t("./intersect-ellipse");e.exports=n},{"./intersect-ellipse":12}],12:[function(t,e,r){function n(t,e,r,n){var a=t.x,i=t.y,l=a-n.x,s=i-n.y,o=Math.sqrt(e*e*s*s+r*r*l*l),d=Math.abs(e*r*l/o);n.x0}e.exports=n},{}],14:[function(t,e,r){function n(t,e){return t.intersect(e)}e.exports=n},{}],15:[function(t,e,r){function n(t,e,r){var n=t.x,i=t.y,l=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;e.forEach(function(t){s=Math.min(s,t.x),o=Math.min(o,t.y)});for(var d=n-t.width/2-s,c=i-t.height/2-o,u=0;u1&&l.sort(function(t,e){var n=t.x-r.x,a=t.y-r.y,i=Math.sqrt(n*n+a*a),l=e.x-r.x,s=e.y-r.y,o=Math.sqrt(l*l+s*s);return iMath.abs(l)*d?(s<0&&(d=-d),r=0===s?0:d*l/s,n=d):(l<0&&(o=-o),r=o,n=0===l?0:o*s/l),{x:a+r,y:i+n}}e.exports=n},{}],17:[function(t,e,r){function n(t,e){var r=t.append("foreignObject").attr("width","100000"),n=r.append("xhtml:div");n.attr("xmlns","http://www.w3.org/1999/xhtml");var i=e.label;switch(typeof i){case"function":n.insert(i);break;case"object":n.insert(function(){return i});break;default:n.html(i)}a.applyStyle(n,e.labelStyle),n.style("display","inline-block"),n.style("white-space","nowrap");var l=n[0][0].getBoundingClientRect();return r.attr("width",l.width).attr("height",l.height),r}var a=t("../util");e.exports=n},{"../util":27}],18:[function(t,e,r){function n(t,e,r){var n=e.label,s=t.append("g");"svg"===e.labelType?l(s,e):"string"!=typeof n||"html"===e.labelType?i(s,e):a(s,e);var o,d=s.node().getBBox();switch(r){case"top":o=-e.height/2;break;case"bottom":o=e.height/2-d.height;break;default:o=-d.height/2}return s.attr("transform","translate("+-d.width/2+","+o+")"),s}var a=t("./add-text-label"),i=t("./add-html-label"),l=t("./add-svg-label");e.exports=n},{"./add-html-label":17,"./add-svg-label":19,"./add-text-label":20}],19:[function(t,e,r){function n(t,e){var r=t;return r.node().appendChild(e.label),a.applyStyle(r,e.labelStyle),r}var a=t("../util");e.exports=n},{"../util":27}],20:[function(t,e,r){function n(t,e){for(var r=t.append("text"),n=a(e.label).split("\n"),l=0;l0}e.exports=n},{}],14:[function(t,e,r){function n(t,e){return t.intersect(e)}e.exports=n},{}],15:[function(t,e,r){function n(t,e,r){var n=t.x,i=t.y,l=[],s=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY;e.forEach(function(t){s=Math.min(s,t.x),o=Math.min(o,t.y)});for(var d=n-t.width/2-s,c=i-t.height/2-o,u=0;u1&&l.sort(function(t,e){var n=t.x-r.x,a=t.y-r.y,i=Math.sqrt(n*n+a*a),l=e.x-r.x,s=e.y-r.y,o=Math.sqrt(l*l+s*s);return iMath.abs(l)*d?(s<0&&(d=-d),r=0===s?0:d*l/s,n=d):(l<0&&(o=-o),r=o,n=0===l?0:o*s/l),{x:a+r,y:i+n}}e.exports=n},{}],17:[function(t,e,r){function n(t,e){var r=t.append("foreignObject").attr("width","100000"),n=r.append("xhtml:div");n.attr("xmlns","http://www.w3.org/1999/xhtml");var i=e.label;switch(typeof i){case"function":n.insert(i);break;case"object":n.insert(function(){return i});break;default:n.html(i)}a.applyStyle(n,e.labelStyle),n.style("display","inline-block"),n.style("white-space","nowrap");var l=n.node().getBoundingClientRect();return r.attr("width",l.width).attr("height",l.height),r}var a=t("../util");e.exports=n},{"../util":27}],18:[function(t,e,r){function n(t,e,r){var n=e.label,s=t.append("g");"svg"===e.labelType?l(s,e):"string"!=typeof n||"html"===e.labelType?i(s,e):a(s,e);var o,d=s.node().getBBox();switch(r){case"top":o=-e.height/2;break;case"bottom":o=e.height/2-d.height;break;default:o=-d.height/2}return s.attr("transform","translate("+-d.width/2+","+o+")"),s}var a=t("./add-text-label"),i=t("./add-html-label"),l=t("./add-svg-label");e.exports=n},{"./add-html-label":17,"./add-svg-label":19,"./add-text-label":20}],19:[function(t,e,r){function n(t,e){var r=t;return r.node().appendChild(e.label),a.applyStyle(r,e.labelStyle),r}var a=t("../util");e.exports=n},{"../util":27}],20:[function(t,e,r){function n(t,e){for(var r=t.append("text"),n=a(e.label).split("\n"),l=0;l 0;\n}\n\n},{}],14:[function(require,module,exports){\nmodule.exports = intersectNode;\n\nfunction intersectNode(node, point) {\n return node.intersect(point);\n}\n\n},{}],15:[function(require,module,exports){\nvar intersectLine = require(\"./intersect-line\");\n\nmodule.exports = intersectPolygon;\n\n/*\n * Returns the point ({x, y}) at which the point argument intersects with the\n * node argument assuming that it has the shape specified by polygon.\n */\nfunction intersectPolygon(node, polyPoints, point) {\n var x1 = node.x;\n var y1 = node.y;\n\n var intersections = [];\n\n var minX = Number.POSITIVE_INFINITY,\n minY = Number.POSITIVE_INFINITY;\n polyPoints.forEach(function(entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n\n var left = x1 - node.width / 2 - minX;\n var top = y1 - node.height / 2 - minY;\n\n for (var i = 0; i < polyPoints.length; i++) {\n var p1 = polyPoints[i];\n var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n var intersect = intersectLine(node, point,\n {x: left + p1.x, y: top + p1.y}, {x: left + p2.x, y: top + p2.y});\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n console.log(\"NO INTERSECTION FOUND, RETURN NODE CENTER\", node);\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function(p, q) {\n var pdx = p.x - point.x,\n pdy = p.y - point.y,\n distp = Math.sqrt(pdx * pdx + pdy * pdy),\n\n qdx = q.x - point.x,\n qdy = q.y - point.y,\n distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return (distp < distq) ? -1 : (distp === distq ? 0 : 1);\n });\n }\n return intersections[0];\n}\n\n},{\"./intersect-line\":13}],16:[function(require,module,exports){\nmodule.exports = intersectRect;\n\nfunction intersectRect(node, point) {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : h * dx / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : w * dy / dx;\n }\n\n return {x: x + sx, y: y + sy};\n}\n\n},{}],17:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addHtmlLabel;\n\nfunction addHtmlLabel(root, node) {\n var fo = root\n .append(\"foreignObject\")\n .attr(\"width\", \"100000\");\n\n var div = fo\n .append(\"xhtml:div\");\n div.attr(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n\n var label = node.label;\n switch(typeof label) {\n case \"function\":\n div.insert(label);\n break;\n case \"object\":\n // Currently we assume this is a DOM object.\n div.insert(function() { return label; });\n break;\n default: div.html(label);\n }\n\n util.applyStyle(div, node.labelStyle);\n div.style(\"display\", \"inline-block\");\n // Fix for firefox\n div.style(\"white-space\", \"nowrap\");\n\n var client = div[0][0].getBoundingClientRect();\n fo\n .attr(\"width\", client.width)\n .attr(\"height\", client.height); \n\n return fo;\n}\n\n},{\"../util\":27}],18:[function(require,module,exports){\nvar addTextLabel = require(\"./add-text-label\"),\n addHtmlLabel = require(\"./add-html-label\"),\n addSVGLabel = require(\"./add-svg-label\");\n\nmodule.exports = addLabel;\n\nfunction addLabel(root, node, location) {\n var label = node.label;\n var labelSvg = root.append(\"g\");\n\n // Allow the label to be a string, a function that returns a DOM element, or\n // a DOM element itself.\n if (node.labelType === \"svg\") {\n addSVGLabel(labelSvg, node);\n } else if (typeof label !== \"string\" || node.labelType === \"html\") {\n addHtmlLabel(labelSvg, node);\n } else {\n addTextLabel(labelSvg, node);\n }\n\n var labelBBox = labelSvg.node().getBBox();\n var y;\n switch(location) {\n case \"top\":\n y = (-node.height / 2);\n break;\n case \"bottom\":\n y = (node.height / 2) - labelBBox.height;\n break;\n default:\n y = (-labelBBox.height / 2);\n }\n labelSvg.attr(\"transform\",\n \"translate(\" + (-labelBBox.width / 2) + \",\" + y + \")\");\n\n return labelSvg;\n}\n\n},{\"./add-html-label\":17,\"./add-svg-label\":19,\"./add-text-label\":20}],19:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addSVGLabel;\n\nfunction addSVGLabel(root, node) {\n var domNode = root;\n\n domNode.node().appendChild(node.label);\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\n},{\"../util\":27}],20:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addTextLabel;\n\n/*\n * Attaches a text label to the specified root. Handles escape sequences.\n */\nfunction addTextLabel(root, node) {\n var domNode = root.append(\"text\");\n\n var lines = processEscapeSequences(node.label).split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n domNode\n .append(\"tspan\")\n .attr(\"xml:space\", \"preserve\")\n .attr(\"dy\", \"1em\")\n .attr(\"x\", \"1\")\n .text(lines[i]);\n }\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\nfunction processEscapeSequences(text) {\n var newText = \"\",\n escaped = false,\n ch;\n for (var i = 0; i < text.length; ++i) {\n ch = text[i];\n if (escaped) {\n switch(ch) {\n case \"n\": newText += \"\\n\"; break;\n default: newText += ch;\n }\n escaped = false;\n } else if (ch === \"\\\\\") {\n escaped = true;\n } else {\n newText += ch;\n }\n }\n return newText;\n}\n\n},{\"../util\":27}],21:[function(require,module,exports){\n/* global window */\n\nvar lodash;\n\nif (require) {\n try {\n lodash = require(\"lodash\");\n } catch (e) {}\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n\n},{\"lodash\":undefined}],22:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionClusters;\n\nfunction positionClusters(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n\n util.applyTransition(created.selectAll(\"rect\"), g)\n .attr(\"width\", function(v) { return g.node(v).width; })\n .attr(\"height\", function(v) { return g.node(v).height; })\n .attr(\"x\", function(v) {\n var node = g.node(v);\n return -node.width / 2;\n })\n .attr(\"y\", function(v) {\n var node = g.node(v);\n return -node.height / 2;\n });\n\n}\n\n},{\"./d3\":7,\"./util\":27}],23:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\"),\n _ = require(\"./lodash\");\n\nmodule.exports = positionEdgeLabels;\n\nfunction positionEdgeLabels(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(e) {\n var edge = g.edge(e);\n return _.has(edge, \"x\") ? \"translate(\" + edge.x + \",\" + edge.y + \")\" : \"\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n\n},{\"./d3\":7,\"./lodash\":21,\"./util\":27}],24:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionNodes;\n\nfunction positionNodes(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n\n},{\"./d3\":7,\"./util\":27}],25:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n layout = require(\"./dagre\").layout;\n\nmodule.exports = render;\n\n// This design is based on http://bost.ocks.org/mike/chart/.\nfunction render() {\n var createNodes = require(\"./create-nodes\"),\n createClusters = require(\"./create-clusters\"),\n createEdgeLabels = require(\"./create-edge-labels\"),\n createEdgePaths = require(\"./create-edge-paths\"),\n positionNodes = require(\"./position-nodes\"),\n positionEdgeLabels = require(\"./position-edge-labels\"),\n positionClusters = require(\"./position-clusters\"),\n shapes = require(\"./shapes\"),\n arrows = require(\"./arrows\");\n\n var fn = function(svg, g) {\n preProcessGraph(g);\n\n var outputGroup = createOrSelectGroup(svg, \"output\"),\n clustersGroup = createOrSelectGroup(outputGroup, \"clusters\"),\n edgePathsGroup = createOrSelectGroup(outputGroup, \"edgePaths\"),\n edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, \"edgeLabels\"), g),\n nodes = createNodes(createOrSelectGroup(outputGroup, \"nodes\"), g, shapes);\n\n layout(g);\n\n positionNodes(nodes, g);\n positionEdgeLabels(edgeLabels, g);\n createEdgePaths(edgePathsGroup, g, arrows);\n\n var clusters = createClusters(clustersGroup, g);\n positionClusters(clusters, g);\n\n postProcessGraph(g);\n };\n\n fn.createNodes = function(value) {\n if (!arguments.length) return createNodes;\n createNodes = value;\n return fn;\n };\n\n fn.createClusters = function(value) {\n if (!arguments.length) return createClusters;\n createClusters = value;\n return fn;\n };\n\n fn.createEdgeLabels = function(value) {\n if (!arguments.length) return createEdgeLabels;\n createEdgeLabels = value;\n return fn;\n };\n\n fn.createEdgePaths = function(value) {\n if (!arguments.length) return createEdgePaths;\n createEdgePaths = value;\n return fn;\n };\n\n fn.shapes = function(value) {\n if (!arguments.length) return shapes;\n shapes = value;\n return fn;\n };\n\n fn.arrows = function(value) {\n if (!arguments.length) return arrows;\n arrows = value;\n return fn;\n };\n\n return fn;\n}\n\nvar NODE_DEFAULT_ATTRS = {\n paddingLeft: 10,\n paddingRight: 10,\n paddingTop: 10,\n paddingBottom: 10,\n rx: 0,\n ry: 0,\n shape: \"rect\"\n};\n\nvar EDGE_DEFAULT_ATTRS = {\n arrowhead: \"normal\",\n lineInterpolate: \"linear\"\n};\n\nfunction preProcessGraph(g) {\n g.nodes().forEach(function(v) {\n var node = g.node(v);\n if (!_.has(node, \"label\") && !g.children(v).length) { node.label = v; }\n\n if (_.has(node, \"paddingX\")) {\n _.defaults(node, {\n paddingLeft: node.paddingX,\n paddingRight: node.paddingX\n });\n }\n\n if (_.has(node, \"paddingY\")) {\n _.defaults(node, {\n paddingTop: node.paddingY,\n paddingBottom: node.paddingY\n });\n }\n\n if (_.has(node, \"padding\")) {\n _.defaults(node, {\n paddingLeft: node.padding,\n paddingRight: node.padding,\n paddingTop: node.padding,\n paddingBottom: node.padding\n });\n }\n\n _.defaults(node, NODE_DEFAULT_ATTRS);\n\n _.each([\"paddingLeft\", \"paddingRight\", \"paddingTop\", \"paddingBottom\"], function(k) {\n node[k] = Number(node[k]);\n });\n\n // Save dimensions for restore during post-processing\n if (_.has(node, \"width\")) { node._prevWidth = node.width; }\n if (_.has(node, \"height\")) { node._prevHeight = node.height; }\n });\n\n g.edges().forEach(function(e) {\n var edge = g.edge(e);\n if (!_.has(edge, \"label\")) { edge.label = \"\"; }\n _.defaults(edge, EDGE_DEFAULT_ATTRS);\n });\n}\n\nfunction postProcessGraph(g) {\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n\n // Restore original dimensions\n if (_.has(node, \"_prevWidth\")) {\n node.width = node._prevWidth;\n } else {\n delete node.width;\n }\n\n if (_.has(node, \"_prevHeight\")) {\n node.height = node._prevHeight;\n } else {\n delete node.height;\n }\n\n delete node._prevWidth;\n delete node._prevHeight;\n });\n}\n\nfunction createOrSelectGroup(root, name) {\n var selection = root.select(\"g.\" + name);\n if (selection.empty()) {\n selection = root.append(\"g\").attr(\"class\", name);\n }\n return selection;\n}\n\n},{\"./arrows\":2,\"./create-clusters\":3,\"./create-edge-labels\":4,\"./create-edge-paths\":5,\"./create-nodes\":6,\"./dagre\":8,\"./lodash\":21,\"./position-clusters\":22,\"./position-edge-labels\":23,\"./position-nodes\":24,\"./shapes\":26}],26:[function(require,module,exports){\n\"use strict\";\n\nvar intersectRect = require(\"./intersect/intersect-rect\"),\n intersectEllipse = require(\"./intersect/intersect-ellipse\"),\n intersectCircle = require(\"./intersect/intersect-circle\"),\n intersectPolygon = require(\"./intersect/intersect-polygon\");\n\nmodule.exports = {\n rect: rect,\n ellipse: ellipse,\n circle: circle,\n diamond: diamond\n};\n\nfunction rect(parent, bbox, node) {\n var shapeSvg = parent.insert(\"rect\", \":first-child\")\n .attr(\"rx\", node.rx)\n .attr(\"ry\", node.ry)\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"width\", bbox.width)\n .attr(\"height\", bbox.height);\n\n node.intersect = function(point) {\n return intersectRect(node, point);\n };\n\n return shapeSvg;\n}\n\nfunction ellipse(parent, bbox, node) {\n var rx = bbox.width / 2,\n ry = bbox.height / 2,\n shapeSvg = parent.insert(\"ellipse\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"rx\", rx)\n .attr(\"ry\", ry);\n\n node.intersect = function(point) {\n return intersectEllipse(node, rx, ry, point);\n };\n\n return shapeSvg;\n}\n\nfunction circle(parent, bbox, node) {\n var r = Math.max(bbox.width, bbox.height) / 2,\n shapeSvg = parent.insert(\"circle\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"r\", r);\n\n node.intersect = function(point) {\n return intersectCircle(node, r, point);\n };\n\n return shapeSvg;\n}\n\n// Circumscribe an ellipse for the bounding box with a diamond shape. I derived\n// the function to calculate the diamond shape from:\n// http://mathforum.org/kb/message.jspa?messageID=3750236\nfunction diamond(parent, bbox, node) {\n var w = (bbox.width * Math.SQRT2) / 2,\n h = (bbox.height * Math.SQRT2) / 2,\n points = [\n { x: 0, y: -h },\n { x: -w, y: 0 },\n { x: 0, y: h },\n { x: w, y: 0 }\n ],\n shapeSvg = parent.insert(\"polygon\", \":first-child\")\n .attr(\"points\", points.map(function(p) { return p.x + \",\" + p.y; }).join(\" \"));\n\n node.intersect = function(p) {\n return intersectPolygon(node, points, p);\n };\n\n return shapeSvg;\n}\n\n},{\"./intersect/intersect-circle\":11,\"./intersect/intersect-ellipse\":12,\"./intersect/intersect-polygon\":15,\"./intersect/intersect-rect\":16}],27:[function(require,module,exports){\nvar _ = require(\"./lodash\");\n\n// Public utility functions\nmodule.exports = {\n isSubgraph: isSubgraph,\n edgeToId: edgeToId,\n applyStyle: applyStyle,\n applyClass: applyClass,\n applyTransition: applyTransition\n};\n\n/*\n * Returns true if the specified node in the graph is a subgraph node. A\n * subgraph node is one that contains other nodes.\n */\nfunction isSubgraph(g, v) {\n return !!g.children(v).length;\n}\n\nfunction edgeToId(e) {\n return escapeId(e.v) + \":\" + escapeId(e.w) + \":\" + escapeId(e.name);\n}\n\nvar ID_DELIM = /:/g;\nfunction escapeId(str) {\n return str ? String(str).replace(ID_DELIM, \"\\\\:\") : \"\";\n}\n\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr(\"style\", styleFn);\n }\n}\n\nfunction applyClass(dom, classFn, otherClasses) {\n if (classFn) {\n dom\n .attr(\"class\", classFn)\n .attr(\"class\", otherClasses + \" \" + dom.attr(\"class\"));\n }\n}\n\nfunction applyTransition(selection, g) {\n var graph = g.graph();\n\n if (_.isPlainObject(graph)) {\n var transition = graph.transition;\n if (_.isFunction(transition)) {\n return transition(selection);\n }\n }\n\n return selection;\n}\n\n},{\"./lodash\":21}],28:[function(require,module,exports){\nmodule.exports = \"0.4.18\";\n\n},{}]},{},[1])(1)\n});\n\n","var util = require(\"./util\");\n\nmodule.exports = {\n \"default\": normal,\n \"normal\": normal,\n \"vee\": vee,\n \"undirected\": undirected\n};\n\nfunction normal(parent, id, edge, type) {\n var marker = parent.append(\"marker\")\n .attr(\"id\", id)\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 9)\n .attr(\"refY\", 5)\n .attr(\"markerUnits\", \"strokeWidth\")\n .attr(\"markerWidth\", 8)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\");\n\n var path = marker.append(\"path\")\n .attr(\"d\", \"M 0 0 L 10 5 L 0 10 z\")\n .style(\"stroke-width\", 1)\n .style(\"stroke-dasharray\", \"1,0\");\n util.applyStyle(path, edge[type + \"Style\"]);\n if (edge[type + \"Class\"]) {\n path.attr(\"class\", edge[type + \"Class\"]);\n }\n}\n\nfunction vee(parent, id, edge, type) {\n var marker = parent.append(\"marker\")\n .attr(\"id\", id)\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 9)\n .attr(\"refY\", 5)\n .attr(\"markerUnits\", \"strokeWidth\")\n .attr(\"markerWidth\", 8)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\");\n\n var path = marker.append(\"path\")\n .attr(\"d\", \"M 0 0 L 10 5 L 0 10 L 4 5 z\")\n .style(\"stroke-width\", 1)\n .style(\"stroke-dasharray\", \"1,0\");\n util.applyStyle(path, edge[type + \"Style\"]);\n if (edge[type + \"Class\"]) {\n path.attr(\"class\", edge[type + \"Class\"]);\n }\n}\n\nfunction undirected(parent, id, edge, type) {\n var marker = parent.append(\"marker\")\n .attr(\"id\", id)\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 9)\n .attr(\"refY\", 5)\n .attr(\"markerUnits\", \"strokeWidth\")\n .attr(\"markerWidth\", 8)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\");\n\n var path = marker.append(\"path\")\n .attr(\"d\", \"M 0 5 L 10 5\")\n .style(\"stroke-width\", 1)\n .style(\"stroke-dasharray\", \"1,0\");\n util.applyStyle(path, edge[type + \"Style\"]);\n if (edge[type + \"Class\"]) {\n path.attr(\"class\", edge[type + \"Class\"]);\n }\n}\n","var util = require(\"./util\"),\n addLabel = require(\"./label/add-label\");\n\nmodule.exports = createClusters;\n\nfunction createClusters(selection, g) {\n var clusters = g.nodes().filter(function(v) { return util.isSubgraph(g, v); }),\n svgClusters = selection.selectAll(\"g.cluster\")\n .data(clusters, function(v) { return v; });\n\n svgClusters.selectAll(\"*\").remove();\n svgClusters.enter()\n .append(\"g\")\n .attr(\"class\", \"cluster\")\n .attr(\"id\",function(v){\n var node = g.node(v);\n return node.id;\n })\n .style(\"opacity\", 0);\n\n util.applyTransition(svgClusters, g)\n .style(\"opacity\", 1);\n\n svgClusters.each(function(v) {\n var node = g.node(v),\n thisGroup = d3.select(this);\n d3.select(this).append(\"rect\");\n var labelGroup = thisGroup.append(\"g\").attr(\"class\", \"label\");\n addLabel(labelGroup, node, node.clusterLabelPos);\n });\n\n svgClusters.selectAll(\"rect\").each(function(c) {\n var node = g.node(c);\n var domCluster = d3.select(this);\n util.applyStyle(domCluster, node.style);\n });\n\n util.applyTransition(svgClusters.exit(), g)\n .style(\"opacity\", 0)\n .remove();\n\n return svgClusters;\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\"),\n addLabel = require(\"./label/add-label\"),\n util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = createEdgeLabels;\n\nfunction createEdgeLabels(selection, g) {\n var svgEdgeLabels = selection.selectAll(\"g.edgeLabel\")\n .data(g.edges(), function(e) { return util.edgeToId(e); })\n .classed(\"update\", true);\n\n svgEdgeLabels.selectAll(\"*\").remove();\n svgEdgeLabels.enter()\n .append(\"g\")\n .classed(\"edgeLabel\", true)\n .style(\"opacity\", 0);\n svgEdgeLabels.each(function(e) {\n var edge = g.edge(e),\n label = addLabel(d3.select(this), g.edge(e), 0, 0).classed(\"label\", true),\n bbox = label.node().getBBox();\n\n if (edge.labelId) { label.attr(\"id\", edge.labelId); }\n if (!_.has(edge, \"width\")) { edge.width = bbox.width; }\n if (!_.has(edge, \"height\")) { edge.height = bbox.height; }\n });\n\n util.applyTransition(svgEdgeLabels.exit(), g)\n .style(\"opacity\", 0)\n .remove();\n\n return svgEdgeLabels;\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\"),\n intersectNode = require(\"./intersect/intersect-node\"),\n util = require(\"./util\"),\n d3 = require(\"./d3\");\nmodule.exports = createEdgePaths;\n\nfunction createEdgePaths(selection, g, arrows) {\n var svgPaths = selection.selectAll(\"g.edgePath\")\n .data(g.edges(), function(e) { return util.edgeToId(e); })\n .classed(\"update\", true);\n\n enter(svgPaths, g);\n exit(svgPaths, g);\n\n util.applyTransition(svgPaths, g)\n .style(\"opacity\", 1);\n\n // Save DOM element in the path group, and set ID and class\n svgPaths.each(function(e) {\n var domEdge = d3.select(this);\n var edge = g.edge(e);\n edge.elem = this;\n\n if (edge.id) {\n domEdge.attr(\"id\", edge.id);\n }\n\n util.applyClass(domEdge, edge[\"class\"],\n (domEdge.classed(\"update\") ? \"update \" : \"\") + \"edgePath\");\n });\n\n svgPaths.selectAll(\"path.path\")\n .each(function(e) {\n var edge = g.edge(e);\n edge.arrowheadId = _.uniqueId(\"arrowhead\");\n\n var domEdge = d3.select(this)\n .attr(\"marker-end\", function() {\n return \"url(\" + makeFragmentRef(location.href, edge.arrowheadId) + \")\";\n })\n .style(\"fill\", \"none\");\n\n util.applyTransition(domEdge, g)\n .attr(\"d\", function(e) { return calcPoints(g, e); });\n\n util.applyStyle(domEdge, edge.style);\n });\n\n svgPaths.selectAll(\"defs *\").remove();\n svgPaths.selectAll(\"defs\")\n .each(function(e) {\n var edge = g.edge(e),\n arrowhead = arrows[edge.arrowhead];\n arrowhead(d3.select(this), edge.arrowheadId, edge, \"arrowhead\");\n });\n\n return svgPaths;\n}\n\nfunction makeFragmentRef(url, fragmentId) {\n var baseUrl = url.split(\"#\")[0];\n return baseUrl + \"#\" + fragmentId;\n}\n\nfunction calcPoints(g, e) {\n var edge = g.edge(e),\n tail = g.node(e.v),\n head = g.node(e.w),\n points = edge.points.slice(1, edge.points.length - 1);\n points.unshift(intersectNode(tail, points[0]));\n points.push(intersectNode(head, points[points.length - 1]));\n\n return createLine(edge, points);\n}\n\nfunction createLine(edge, points) {\n var line = d3.svg.line()\n .x(function(d) { return d.x; })\n .y(function(d) { return d.y; });\n\n if (_.has(edge, \"lineInterpolate\")) {\n line.interpolate(edge.lineInterpolate);\n }\n\n if (_.has(edge, \"lineTension\")) {\n line.tension(Number(edge.lineTension));\n }\n\n return line(points);\n}\n\nfunction getCoords(elem) {\n var bbox = elem.getBBox(),\n matrix = elem.ownerSVGElement.getScreenCTM()\n .inverse()\n .multiply(elem.getScreenCTM())\n .translate(bbox.width / 2, bbox.height / 2);\n return { x: matrix.e, y: matrix.f };\n}\n\nfunction enter(svgPaths, g) {\n var svgPathsEnter = svgPaths.enter()\n .append(\"g\")\n .attr(\"class\", \"edgePath\")\n .style(\"opacity\", 0);\n svgPathsEnter.append(\"path\")\n .attr(\"class\", \"path\")\n .attr(\"d\", function(e) {\n var edge = g.edge(e),\n sourceElem = g.node(e.v).elem,\n points = _.range(edge.points.length).map(function() { return getCoords(sourceElem); });\n return createLine(edge, points);\n });\n svgPathsEnter.append(\"defs\");\n}\n\nfunction exit(svgPaths, g) {\n var svgPathExit = svgPaths.exit();\n util.applyTransition(svgPathExit, g)\n .style(\"opacity\", 0)\n .remove();\n\n util.applyTransition(svgPathExit.select(\"path.path\"), g)\n .attr(\"d\", function(e) {\n var source = g.node(e.v);\n\n if (source) {\n var points = _.range(this.getTotalLength()).map(function() { return source; });\n return createLine({}, points);\n } else {\n return d3.select(this).attr(\"d\");\n }\n });\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\"),\n addLabel = require(\"./label/add-label\"),\n util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = createNodes;\n\nfunction createNodes(selection, g, shapes) {\n var simpleNodes = g.nodes().filter(function(v) { return !util.isSubgraph(g, v); });\n var svgNodes = selection.selectAll(\"g.node\")\n .data(simpleNodes, function(v) { return v; })\n .classed(\"update\", true);\n\n svgNodes.selectAll(\"*\").remove();\n svgNodes.enter()\n .append(\"g\")\n .attr(\"class\", \"node\")\n .style(\"opacity\", 0);\n svgNodes.each(function(v) {\n var node = g.node(v),\n thisGroup = d3.select(this),\n labelGroup = thisGroup.append(\"g\").attr(\"class\", \"label\"),\n labelDom = addLabel(labelGroup, node),\n shape = shapes[node.shape],\n bbox = _.pick(labelDom.node().getBBox(), \"width\", \"height\");\n\n node.elem = this;\n\n if (node.id) { thisGroup.attr(\"id\", node.id); }\n if (node.labelId) { labelGroup.attr(\"id\", node.labelId); }\n util.applyClass(thisGroup, node[\"class\"],\n (thisGroup.classed(\"update\") ? \"update \" : \"\") + \"node\");\n\n if (_.has(node, \"width\")) { bbox.width = node.width; }\n if (_.has(node, \"height\")) { bbox.height = node.height; }\n\n bbox.width += node.paddingLeft + node.paddingRight;\n bbox.height += node.paddingTop + node.paddingBottom;\n labelGroup.attr(\"transform\", \"translate(\" +\n ((node.paddingLeft - node.paddingRight) / 2) + \",\" +\n ((node.paddingTop - node.paddingBottom) / 2) + \")\");\n\n var shapeSvg = shape(d3.select(this), bbox, node);\n util.applyStyle(shapeSvg, node.style);\n\n var shapeBBox = shapeSvg.node().getBBox();\n node.width = shapeBBox.width;\n node.height = shapeBBox.height;\n });\n\n util.applyTransition(svgNodes.exit(), g)\n .style(\"opacity\", 0)\n .remove();\n\n return svgNodes;\n}\n","// Stub to get D3 either via NPM or from the global object\nmodule.exports = window.d3;\n","/* global window */\n\nvar dagre;\n\nif (require) {\n try {\n dagre = require(\"dagre\");\n } catch (e) {}\n}\n\nif (!dagre) {\n dagre = window.dagre;\n}\n\nmodule.exports = dagre;\n","/* global window */\n\nvar graphlib;\n\nif (require) {\n try {\n graphlib = require(\"graphlib\");\n } catch (e) {}\n}\n\nif (!graphlib) {\n graphlib = window.graphlib;\n}\n\nmodule.exports = graphlib;\n","module.exports = {\n node: require(\"./intersect-node\"),\n circle: require(\"./intersect-circle\"),\n ellipse: require(\"./intersect-ellipse\"),\n polygon: require(\"./intersect-polygon\"),\n rect: require(\"./intersect-rect\")\n};\n","var intersectEllipse = require(\"./intersect-ellipse\");\n\nmodule.exports = intersectCircle;\n\nfunction intersectCircle(node, rx, point) {\n return intersectEllipse(node, rx, rx, point);\n}\n","module.exports = intersectEllipse;\n\nfunction intersectEllipse(node, rx, ry, point) {\n // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html\n\n var cx = node.x;\n var cy = node.y;\n\n var px = cx - point.x;\n var py = cy - point.y;\n\n var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);\n\n var dx = Math.abs(rx * ry * px / det);\n if (point.x < cx) {\n dx = -dx;\n }\n var dy = Math.abs(rx * ry * py / det);\n if (point.y < cy) {\n dy = -dy;\n }\n\n return {x: cx + dx, y: cy + dy};\n}\n\n","module.exports = intersectLine;\n\n/*\n * Returns the point at which two lines, p and q, intersect or returns\n * undefined if they do not intersect.\n */\nfunction intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n\n var a1, a2, b1, b2, c1, c2;\n var r1, r2 , r3, r4;\n var denom, offset, num;\n var x, y;\n\n // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = (p2.x * p1.y) - (p1.x * p2.y);\n\n // Compute r3 and r4.\n r3 = ((a1 * q1.x) + (b1 * q1.y) + c1);\n r4 = ((a1 * q2.x) + (b1 * q2.y) + c1);\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {\n return /*DONT_INTERSECT*/;\n }\n\n // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = (q2.x * q1.y) - (q1.x * q2.y);\n\n // Compute r1 and r2\n r1 = (a2 * p1.x) + (b2 * p1.y) + c2;\n r2 = (a2 * p2.x) + (b2 * p2.y) + c2;\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {\n return /*DONT_INTERSECT*/;\n }\n\n // Line segments intersect: compute intersection point.\n denom = (a1 * b2) - (a2 * b1);\n if (denom === 0) {\n return /*COLLINEAR*/;\n }\n\n offset = Math.abs(denom / 2);\n\n // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n num = (b1 * c2) - (b2 * c1);\n x = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n num = (a2 * c1) - (a1 * c2);\n y = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n return { x: x, y: y };\n}\n\nfunction sameSign(r1, r2) {\n return r1 * r2 > 0;\n}\n","module.exports = intersectNode;\n\nfunction intersectNode(node, point) {\n return node.intersect(point);\n}\n","var intersectLine = require(\"./intersect-line\");\n\nmodule.exports = intersectPolygon;\n\n/*\n * Returns the point ({x, y}) at which the point argument intersects with the\n * node argument assuming that it has the shape specified by polygon.\n */\nfunction intersectPolygon(node, polyPoints, point) {\n var x1 = node.x;\n var y1 = node.y;\n\n var intersections = [];\n\n var minX = Number.POSITIVE_INFINITY,\n minY = Number.POSITIVE_INFINITY;\n polyPoints.forEach(function(entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n\n var left = x1 - node.width / 2 - minX;\n var top = y1 - node.height / 2 - minY;\n\n for (var i = 0; i < polyPoints.length; i++) {\n var p1 = polyPoints[i];\n var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n var intersect = intersectLine(node, point,\n {x: left + p1.x, y: top + p1.y}, {x: left + p2.x, y: top + p2.y});\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n console.log(\"NO INTERSECTION FOUND, RETURN NODE CENTER\", node);\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function(p, q) {\n var pdx = p.x - point.x,\n pdy = p.y - point.y,\n distp = Math.sqrt(pdx * pdx + pdy * pdy),\n\n qdx = q.x - point.x,\n qdy = q.y - point.y,\n distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return (distp < distq) ? -1 : (distp === distq ? 0 : 1);\n });\n }\n return intersections[0];\n}\n","module.exports = intersectRect;\n\nfunction intersectRect(node, point) {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : h * dx / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : w * dy / dx;\n }\n\n return {x: x + sx, y: y + sy};\n}\n","var util = require(\"../util\");\n\nmodule.exports = addHtmlLabel;\n\nfunction addHtmlLabel(root, node) {\n var fo = root\n .append(\"foreignObject\")\n .attr(\"width\", \"100000\");\n\n var div = fo\n .append(\"xhtml:div\");\n div.attr(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n\n var label = node.label;\n switch(typeof label) {\n case \"function\":\n div.insert(label);\n break;\n case \"object\":\n // Currently we assume this is a DOM object.\n div.insert(function() { return label; });\n break;\n default: div.html(label);\n }\n\n util.applyStyle(div, node.labelStyle);\n div.style(\"display\", \"inline-block\");\n // Fix for firefox\n div.style(\"white-space\", \"nowrap\");\n\n var client = div[0][0].getBoundingClientRect();\n fo\n .attr(\"width\", client.width)\n .attr(\"height\", client.height); \n\n return fo;\n}\n","var addTextLabel = require(\"./add-text-label\"),\n addHtmlLabel = require(\"./add-html-label\"),\n addSVGLabel = require(\"./add-svg-label\");\n\nmodule.exports = addLabel;\n\nfunction addLabel(root, node, location) {\n var label = node.label;\n var labelSvg = root.append(\"g\");\n\n // Allow the label to be a string, a function that returns a DOM element, or\n // a DOM element itself.\n if (node.labelType === \"svg\") {\n addSVGLabel(labelSvg, node);\n } else if (typeof label !== \"string\" || node.labelType === \"html\") {\n addHtmlLabel(labelSvg, node);\n } else {\n addTextLabel(labelSvg, node);\n }\n\n var labelBBox = labelSvg.node().getBBox();\n var y;\n switch(location) {\n case \"top\":\n y = (-node.height / 2);\n break;\n case \"bottom\":\n y = (node.height / 2) - labelBBox.height;\n break;\n default:\n y = (-labelBBox.height / 2);\n }\n labelSvg.attr(\"transform\",\n \"translate(\" + (-labelBBox.width / 2) + \",\" + y + \")\");\n\n return labelSvg;\n}\n","var util = require(\"../util\");\n\nmodule.exports = addSVGLabel;\n\nfunction addSVGLabel(root, node) {\n var domNode = root;\n\n domNode.node().appendChild(node.label);\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n","var util = require(\"../util\");\n\nmodule.exports = addTextLabel;\n\n/*\n * Attaches a text label to the specified root. Handles escape sequences.\n */\nfunction addTextLabel(root, node) {\n var domNode = root.append(\"text\");\n\n var lines = processEscapeSequences(node.label).split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n domNode\n .append(\"tspan\")\n .attr(\"xml:space\", \"preserve\")\n .attr(\"dy\", \"1em\")\n .attr(\"x\", \"1\")\n .text(lines[i]);\n }\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\nfunction processEscapeSequences(text) {\n var newText = \"\",\n escaped = false,\n ch;\n for (var i = 0; i < text.length; ++i) {\n ch = text[i];\n if (escaped) {\n switch(ch) {\n case \"n\": newText += \"\\n\"; break;\n default: newText += ch;\n }\n escaped = false;\n } else if (ch === \"\\\\\") {\n escaped = true;\n } else {\n newText += ch;\n }\n }\n return newText;\n}\n","/* global window */\n\nvar lodash;\n\nif (require) {\n try {\n lodash = require(\"lodash\");\n } catch (e) {}\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n","\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionClusters;\n\nfunction positionClusters(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n\n util.applyTransition(created.selectAll(\"rect\"), g)\n .attr(\"width\", function(v) { return g.node(v).width; })\n .attr(\"height\", function(v) { return g.node(v).height; })\n .attr(\"x\", function(v) {\n var node = g.node(v);\n return -node.width / 2;\n })\n .attr(\"y\", function(v) {\n var node = g.node(v);\n return -node.height / 2;\n });\n\n}\n","\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\"),\n _ = require(\"./lodash\");\n\nmodule.exports = positionEdgeLabels;\n\nfunction positionEdgeLabels(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(e) {\n var edge = g.edge(e);\n return _.has(edge, \"x\") ? \"translate(\" + edge.x + \",\" + edge.y + \")\" : \"\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n","\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionNodes;\n\nfunction positionNodes(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n","var _ = require(\"./lodash\"),\n layout = require(\"./dagre\").layout;\n\nmodule.exports = render;\n\n// This design is based on http://bost.ocks.org/mike/chart/.\nfunction render() {\n var createNodes = require(\"./create-nodes\"),\n createClusters = require(\"./create-clusters\"),\n createEdgeLabels = require(\"./create-edge-labels\"),\n createEdgePaths = require(\"./create-edge-paths\"),\n positionNodes = require(\"./position-nodes\"),\n positionEdgeLabels = require(\"./position-edge-labels\"),\n positionClusters = require(\"./position-clusters\"),\n shapes = require(\"./shapes\"),\n arrows = require(\"./arrows\");\n\n var fn = function(svg, g) {\n preProcessGraph(g);\n\n var outputGroup = createOrSelectGroup(svg, \"output\"),\n clustersGroup = createOrSelectGroup(outputGroup, \"clusters\"),\n edgePathsGroup = createOrSelectGroup(outputGroup, \"edgePaths\"),\n edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, \"edgeLabels\"), g),\n nodes = createNodes(createOrSelectGroup(outputGroup, \"nodes\"), g, shapes);\n\n layout(g);\n\n positionNodes(nodes, g);\n positionEdgeLabels(edgeLabels, g);\n createEdgePaths(edgePathsGroup, g, arrows);\n\n var clusters = createClusters(clustersGroup, g);\n positionClusters(clusters, g);\n\n postProcessGraph(g);\n };\n\n fn.createNodes = function(value) {\n if (!arguments.length) return createNodes;\n createNodes = value;\n return fn;\n };\n\n fn.createClusters = function(value) {\n if (!arguments.length) return createClusters;\n createClusters = value;\n return fn;\n };\n\n fn.createEdgeLabels = function(value) {\n if (!arguments.length) return createEdgeLabels;\n createEdgeLabels = value;\n return fn;\n };\n\n fn.createEdgePaths = function(value) {\n if (!arguments.length) return createEdgePaths;\n createEdgePaths = value;\n return fn;\n };\n\n fn.shapes = function(value) {\n if (!arguments.length) return shapes;\n shapes = value;\n return fn;\n };\n\n fn.arrows = function(value) {\n if (!arguments.length) return arrows;\n arrows = value;\n return fn;\n };\n\n return fn;\n}\n\nvar NODE_DEFAULT_ATTRS = {\n paddingLeft: 10,\n paddingRight: 10,\n paddingTop: 10,\n paddingBottom: 10,\n rx: 0,\n ry: 0,\n shape: \"rect\"\n};\n\nvar EDGE_DEFAULT_ATTRS = {\n arrowhead: \"normal\",\n lineInterpolate: \"linear\"\n};\n\nfunction preProcessGraph(g) {\n g.nodes().forEach(function(v) {\n var node = g.node(v);\n if (!_.has(node, \"label\") && !g.children(v).length) { node.label = v; }\n\n if (_.has(node, \"paddingX\")) {\n _.defaults(node, {\n paddingLeft: node.paddingX,\n paddingRight: node.paddingX\n });\n }\n\n if (_.has(node, \"paddingY\")) {\n _.defaults(node, {\n paddingTop: node.paddingY,\n paddingBottom: node.paddingY\n });\n }\n\n if (_.has(node, \"padding\")) {\n _.defaults(node, {\n paddingLeft: node.padding,\n paddingRight: node.padding,\n paddingTop: node.padding,\n paddingBottom: node.padding\n });\n }\n\n _.defaults(node, NODE_DEFAULT_ATTRS);\n\n _.each([\"paddingLeft\", \"paddingRight\", \"paddingTop\", \"paddingBottom\"], function(k) {\n node[k] = Number(node[k]);\n });\n\n // Save dimensions for restore during post-processing\n if (_.has(node, \"width\")) { node._prevWidth = node.width; }\n if (_.has(node, \"height\")) { node._prevHeight = node.height; }\n });\n\n g.edges().forEach(function(e) {\n var edge = g.edge(e);\n if (!_.has(edge, \"label\")) { edge.label = \"\"; }\n _.defaults(edge, EDGE_DEFAULT_ATTRS);\n });\n}\n\nfunction postProcessGraph(g) {\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n\n // Restore original dimensions\n if (_.has(node, \"_prevWidth\")) {\n node.width = node._prevWidth;\n } else {\n delete node.width;\n }\n\n if (_.has(node, \"_prevHeight\")) {\n node.height = node._prevHeight;\n } else {\n delete node.height;\n }\n\n delete node._prevWidth;\n delete node._prevHeight;\n });\n}\n\nfunction createOrSelectGroup(root, name) {\n var selection = root.select(\"g.\" + name);\n if (selection.empty()) {\n selection = root.append(\"g\").attr(\"class\", name);\n }\n return selection;\n}\n","\"use strict\";\n\nvar intersectRect = require(\"./intersect/intersect-rect\"),\n intersectEllipse = require(\"./intersect/intersect-ellipse\"),\n intersectCircle = require(\"./intersect/intersect-circle\"),\n intersectPolygon = require(\"./intersect/intersect-polygon\");\n\nmodule.exports = {\n rect: rect,\n ellipse: ellipse,\n circle: circle,\n diamond: diamond\n};\n\nfunction rect(parent, bbox, node) {\n var shapeSvg = parent.insert(\"rect\", \":first-child\")\n .attr(\"rx\", node.rx)\n .attr(\"ry\", node.ry)\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"width\", bbox.width)\n .attr(\"height\", bbox.height);\n\n node.intersect = function(point) {\n return intersectRect(node, point);\n };\n\n return shapeSvg;\n}\n\nfunction ellipse(parent, bbox, node) {\n var rx = bbox.width / 2,\n ry = bbox.height / 2,\n shapeSvg = parent.insert(\"ellipse\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"rx\", rx)\n .attr(\"ry\", ry);\n\n node.intersect = function(point) {\n return intersectEllipse(node, rx, ry, point);\n };\n\n return shapeSvg;\n}\n\nfunction circle(parent, bbox, node) {\n var r = Math.max(bbox.width, bbox.height) / 2,\n shapeSvg = parent.insert(\"circle\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"r\", r);\n\n node.intersect = function(point) {\n return intersectCircle(node, r, point);\n };\n\n return shapeSvg;\n}\n\n// Circumscribe an ellipse for the bounding box with a diamond shape. I derived\n// the function to calculate the diamond shape from:\n// http://mathforum.org/kb/message.jspa?messageID=3750236\nfunction diamond(parent, bbox, node) {\n var w = (bbox.width * Math.SQRT2) / 2,\n h = (bbox.height * Math.SQRT2) / 2,\n points = [\n { x: 0, y: -h },\n { x: -w, y: 0 },\n { x: 0, y: h },\n { x: w, y: 0 }\n ],\n shapeSvg = parent.insert(\"polygon\", \":first-child\")\n .attr(\"points\", points.map(function(p) { return p.x + \",\" + p.y; }).join(\" \"));\n\n node.intersect = function(p) {\n return intersectPolygon(node, points, p);\n };\n\n return shapeSvg;\n}\n","var _ = require(\"./lodash\");\n\n// Public utility functions\nmodule.exports = {\n isSubgraph: isSubgraph,\n edgeToId: edgeToId,\n applyStyle: applyStyle,\n applyClass: applyClass,\n applyTransition: applyTransition\n};\n\n/*\n * Returns true if the specified node in the graph is a subgraph node. A\n * subgraph node is one that contains other nodes.\n */\nfunction isSubgraph(g, v) {\n return !!g.children(v).length;\n}\n\nfunction edgeToId(e) {\n return escapeId(e.v) + \":\" + escapeId(e.w) + \":\" + escapeId(e.name);\n}\n\nvar ID_DELIM = /:/g;\nfunction escapeId(str) {\n return str ? String(str).replace(ID_DELIM, \"\\\\:\") : \"\";\n}\n\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr(\"style\", styleFn);\n }\n}\n\nfunction applyClass(dom, classFn, otherClasses) {\n if (classFn) {\n dom\n .attr(\"class\", classFn)\n .attr(\"class\", otherClasses + \" \" + dom.attr(\"class\"));\n }\n}\n\nfunction applyTransition(selection, g) {\n var graph = g.graph();\n\n if (_.isPlainObject(graph)) {\n var transition = graph.transition;\n if (_.isFunction(transition)) {\n return transition(selection);\n }\n }\n\n return selection;\n}\n","module.exports = \"0.4.18\";\n"]} \ No newline at end of file +{"version":3,"sources":["node_modules/browser-pack/_prelude.js","index.js","dagre-d3.core.js","lib/arrows.js","lib/create-clusters.js","lib/create-edge-labels.js","lib/create-edge-paths.js","lib/create-nodes.js","lib/d3.js","lib/dagre.js","lib/graphlib.js","lib/intersect/index.js","lib/intersect/intersect-circle.js","lib/intersect/intersect-ellipse.js","lib/intersect/intersect-line.js","lib/intersect/intersect-node.js","lib/intersect/intersect-polygon.js","lib/intersect/intersect-rect.js","lib/label/add-html-label.js","lib/label/add-label.js","lib/label/add-svg-label.js","lib/label/add-text-label.js","lib/lodash.js","lib/position-clusters.js","lib/position-edge-labels.js","lib/position-nodes.js","lib/render.js","lib/shapes.js","lib/util.js","lib/version.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","dagreD3","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length","1","graphlib","dagre","intersect","render","util","version","./lib/dagre","./lib/graphlib","./lib/intersect","./lib/render","./lib/util","./lib/version","2","normal","parent","id","edge","type","marker","append","attr","path","style","applyStyle","vee","undirected","default","./util","3","createClusters","selection","clusters","nodes","filter","v","isSubgraph","svgClusters","selectAll","data","remove","enter","node","applyTransition","each","thisGroup","d3","select","labelGroup","addLabel","clusterLabelPos","c","domCluster","exit","./label/add-label","4","createEdgeLabels","svgEdgeLabels","edges","edgeToId","classed","label","bbox","getBBox","labelId","_","has","width","height","./d3","./lodash","5","createEdgePaths","arrows","svgPaths","domEdge","elem","applyClass","arrowheadId","uniqueId","makeFragmentRef","location","href","calcPoints","arrowhead","url","fragmentId","baseUrl","split","tail","head","w","points","slice","unshift","intersectNode","push","createLine","line","x","d","y","curve","lineCurve","getCoords","matrix","ownerSVGElement","getScreenCTM","inverse","multiply","translate","svgPathsEnter","sourceElem","range","map","svgPathExit","source","getTotalLength","./intersect/intersect-node","6","createNodes","shapes","simpleNodes","svgNodes","labelDom","shape","pick","paddingLeft","paddingRight","paddingTop","paddingBottom","shapeSvg","shapeBBox","7","8","undefined","9","10","circle","ellipse","polygon","rect","./intersect-circle","./intersect-ellipse","./intersect-node","./intersect-polygon","./intersect-rect","11","intersectCircle","rx","point","intersectEllipse","12","ry","cx","cy","px","py","det","Math","sqrt","dx","abs","dy","13","intersectLine","p1","p2","q1","q2","a1","a2","b1","b2","c1","c2","r1","r2","r3","r4","denom","offset","num","sameSign","14","15","intersectPolygon","polyPoints","x1","y1","intersections","minX","Number","POSITIVE_INFINITY","minY","forEach","entry","min","left","top","sort","p","q","pdx","pdy","distp","qdx","qdy","distq","console","log","./intersect-line","16","intersectRect","sx","sy","h","17","addHtmlLabel","root","fo","div","insert","html","labelStyle","client","getBoundingClientRect","../util","18","labelSvg","labelType","addSVGLabel","addTextLabel","labelBBox","./add-html-label","./add-svg-label","./add-text-label","19","domNode","appendChild","20","lines","processEscapeSequences","text","ch","newText","escaped","21","lodash","22","positionClusters","created","23","positionEdgeLabels","24","positionNodes","25","fn","svg","preProcessGraph","outputGroup","createOrSelectGroup","clustersGroup","edgePathsGroup","edgeLabels","layout","postProcessGraph","value","arguments","children","defaults","paddingX","paddingY","padding","NODE_DEFAULT_ATTRS","k","_prevWidth","_prevHeight","EDGE_DEFAULT_ATTRS","name","empty","curveLinear","./arrows","./create-clusters","./create-edge-labels","./create-edge-paths","./create-nodes","./dagre","./position-clusters","./position-edge-labels","./position-nodes","./shapes","26","max","diamond","SQRT2","join","./intersect/intersect-circle","./intersect/intersect-ellipse","./intersect/intersect-polygon","./intersect/intersect-rect","27","escapeId","str","String","replace","ID_DELIM","dom","styleFn","classFn","otherClasses","graph","isPlainObject","transition","isFunction","28"],"mappings":"CAAA,SAAAA,GAAA,GAAA,gBAAAC,UAAA,mBAAAC,QAAAA,OAAAD,QAAAD,QAAA,IAAA,kBAAAG,SAAAA,OAAAC,IAAAD,UAAAH,OAAA,CAAA,GAAAK,EAAAA,GAAA,mBAAAC,QAAAA,OAAA,mBAAAC,QAAAA,OAAA,mBAAAC,MAAAA,KAAAC,KAAAJ,EAAAK,QAAAV,MAAA,WAAA,MAAA,SAAAW,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAhB,GAAA,GAAAqB,OAAA,uBAAAL,EAAA,IAAA,MAAAhB,GAA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G5O,WAAW,KAAKqP,IAAI,SAASlU,EAAQjB,EAAOD,G2BzqC/CC,EAAAD,QAAA,kB3B4qCW,IAAI","file":"dagre-d3.core.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0;\n}\n\n},{}],14:[function(require,module,exports){\nmodule.exports = intersectNode;\n\nfunction intersectNode(node, point) {\n return node.intersect(point);\n}\n\n},{}],15:[function(require,module,exports){\nvar intersectLine = require(\"./intersect-line\");\n\nmodule.exports = intersectPolygon;\n\n/*\n * Returns the point ({x, y}) at which the point argument intersects with the\n * node argument assuming that it has the shape specified by polygon.\n */\nfunction intersectPolygon(node, polyPoints, point) {\n var x1 = node.x;\n var y1 = node.y;\n\n var intersections = [];\n\n var minX = Number.POSITIVE_INFINITY,\n minY = Number.POSITIVE_INFINITY;\n polyPoints.forEach(function(entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n\n var left = x1 - node.width / 2 - minX;\n var top = y1 - node.height / 2 - minY;\n\n for (var i = 0; i < polyPoints.length; i++) {\n var p1 = polyPoints[i];\n var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n var intersect = intersectLine(node, point,\n {x: left + p1.x, y: top + p1.y}, {x: left + p2.x, y: top + p2.y});\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n console.log(\"NO INTERSECTION FOUND, RETURN NODE CENTER\", node);\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function(p, q) {\n var pdx = p.x - point.x,\n pdy = p.y - point.y,\n distp = Math.sqrt(pdx * pdx + pdy * pdy),\n\n qdx = q.x - point.x,\n qdy = q.y - point.y,\n distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return (distp < distq) ? -1 : (distp === distq ? 0 : 1);\n });\n }\n return intersections[0];\n}\n\n},{\"./intersect-line\":13}],16:[function(require,module,exports){\nmodule.exports = intersectRect;\n\nfunction intersectRect(node, point) {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : h * dx / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : w * dy / dx;\n }\n\n return {x: x + sx, y: y + sy};\n}\n\n},{}],17:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addHtmlLabel;\n\nfunction addHtmlLabel(root, node) {\n var fo = root\n .append(\"foreignObject\")\n .attr(\"width\", \"100000\");\n\n var div = fo\n .append(\"xhtml:div\");\n div.attr(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n\n var label = node.label;\n switch(typeof label) {\n case \"function\":\n div.insert(label);\n break;\n case \"object\":\n // Currently we assume this is a DOM object.\n div.insert(function() { return label; });\n break;\n default: div.html(label);\n }\n\n util.applyStyle(div, node.labelStyle);\n div.style(\"display\", \"inline-block\");\n // Fix for firefox\n div.style(\"white-space\", \"nowrap\");\n\n var client = div.node().getBoundingClientRect();\n fo\n .attr(\"width\", client.width)\n .attr(\"height\", client.height); \n\n return fo;\n}\n\n},{\"../util\":27}],18:[function(require,module,exports){\nvar addTextLabel = require(\"./add-text-label\"),\n addHtmlLabel = require(\"./add-html-label\"),\n addSVGLabel = require(\"./add-svg-label\");\n\nmodule.exports = addLabel;\n\nfunction addLabel(root, node, location) {\n var label = node.label;\n var labelSvg = root.append(\"g\");\n\n // Allow the label to be a string, a function that returns a DOM element, or\n // a DOM element itself.\n if (node.labelType === \"svg\") {\n addSVGLabel(labelSvg, node);\n } else if (typeof label !== \"string\" || node.labelType === \"html\") {\n addHtmlLabel(labelSvg, node);\n } else {\n addTextLabel(labelSvg, node);\n }\n\n var labelBBox = labelSvg.node().getBBox();\n var y;\n switch(location) {\n case \"top\":\n y = (-node.height / 2);\n break;\n case \"bottom\":\n y = (node.height / 2) - labelBBox.height;\n break;\n default:\n y = (-labelBBox.height / 2);\n }\n labelSvg.attr(\"transform\",\n \"translate(\" + (-labelBBox.width / 2) + \",\" + y + \")\");\n\n return labelSvg;\n}\n\n},{\"./add-html-label\":17,\"./add-svg-label\":19,\"./add-text-label\":20}],19:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addSVGLabel;\n\nfunction addSVGLabel(root, node) {\n var domNode = root;\n\n domNode.node().appendChild(node.label);\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\n},{\"../util\":27}],20:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addTextLabel;\n\n/*\n * Attaches a text label to the specified root. Handles escape sequences.\n */\nfunction addTextLabel(root, node) {\n var domNode = root.append(\"text\");\n\n var lines = processEscapeSequences(node.label).split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n domNode\n .append(\"tspan\")\n .attr(\"xml:space\", \"preserve\")\n .attr(\"dy\", \"1em\")\n .attr(\"x\", \"1\")\n .text(lines[i]);\n }\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\nfunction processEscapeSequences(text) {\n var newText = \"\",\n escaped = false,\n ch;\n for (var i = 0; i < text.length; ++i) {\n ch = text[i];\n if (escaped) {\n switch(ch) {\n case \"n\": newText += \"\\n\"; break;\n default: newText += ch;\n }\n escaped = false;\n } else if (ch === \"\\\\\") {\n escaped = true;\n } else {\n newText += ch;\n }\n }\n return newText;\n}\n\n},{\"../util\":27}],21:[function(require,module,exports){\n/* global window */\n\nvar lodash;\n\nif (require) {\n try {\n lodash = require(\"lodash\");\n } catch (e) {}\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n\n},{\"lodash\":undefined}],22:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionClusters;\n\nfunction positionClusters(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n\n util.applyTransition(created.selectAll(\"rect\"), g)\n .attr(\"width\", function(v) { return g.node(v).width; })\n .attr(\"height\", function(v) { return g.node(v).height; })\n .attr(\"x\", function(v) {\n var node = g.node(v);\n return -node.width / 2;\n })\n .attr(\"y\", function(v) {\n var node = g.node(v);\n return -node.height / 2;\n });\n\n}\n\n},{\"./d3\":7,\"./util\":27}],23:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\"),\n _ = require(\"./lodash\");\n\nmodule.exports = positionEdgeLabels;\n\nfunction positionEdgeLabels(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(e) {\n var edge = g.edge(e);\n return _.has(edge, \"x\") ? \"translate(\" + edge.x + \",\" + edge.y + \")\" : \"\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n\n},{\"./d3\":7,\"./lodash\":21,\"./util\":27}],24:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionNodes;\n\nfunction positionNodes(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n\n},{\"./d3\":7,\"./util\":27}],25:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n layout = require(\"./dagre\").layout;\n\nmodule.exports = render;\n\n// This design is based on http://bost.ocks.org/mike/chart/.\nfunction render() {\n var createNodes = require(\"./create-nodes\"),\n createClusters = require(\"./create-clusters\"),\n createEdgeLabels = require(\"./create-edge-labels\"),\n createEdgePaths = require(\"./create-edge-paths\"),\n positionNodes = require(\"./position-nodes\"),\n positionEdgeLabels = require(\"./position-edge-labels\"),\n positionClusters = require(\"./position-clusters\"),\n shapes = require(\"./shapes\"),\n arrows = require(\"./arrows\");\n\n var fn = function(svg, g) {\n preProcessGraph(g);\n\n svg.selectAll(\"*\").remove();\n\n var outputGroup = createOrSelectGroup(svg, \"output\"),\n clustersGroup = createOrSelectGroup(outputGroup, \"clusters\"),\n edgePathsGroup = createOrSelectGroup(outputGroup, \"edgePaths\"),\n edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, \"edgeLabels\"), g),\n nodes = createNodes(createOrSelectGroup(outputGroup, \"nodes\"), g, shapes);\n\n layout(g);\n\n positionNodes(nodes, g);\n positionEdgeLabels(edgeLabels, g);\n createEdgePaths(edgePathsGroup, g, arrows);\n\n var clusters = createClusters(clustersGroup, g);\n positionClusters(clusters, g);\n\n postProcessGraph(g);\n };\n\n fn.createNodes = function(value) {\n if (!arguments.length) return createNodes;\n createNodes = value;\n return fn;\n };\n\n fn.createClusters = function(value) {\n if (!arguments.length) return createClusters;\n createClusters = value;\n return fn;\n };\n\n fn.createEdgeLabels = function(value) {\n if (!arguments.length) return createEdgeLabels;\n createEdgeLabels = value;\n return fn;\n };\n\n fn.createEdgePaths = function(value) {\n if (!arguments.length) return createEdgePaths;\n createEdgePaths = value;\n return fn;\n };\n\n fn.shapes = function(value) {\n if (!arguments.length) return shapes;\n shapes = value;\n return fn;\n };\n\n fn.arrows = function(value) {\n if (!arguments.length) return arrows;\n arrows = value;\n return fn;\n };\n\n return fn;\n}\n\nvar NODE_DEFAULT_ATTRS = {\n paddingLeft: 10,\n paddingRight: 10,\n paddingTop: 10,\n paddingBottom: 10,\n rx: 0,\n ry: 0,\n shape: \"rect\"\n};\n\nvar EDGE_DEFAULT_ATTRS = {\n arrowhead: \"normal\",\n lineCurve: d3.curveLinear\n};\n\nfunction preProcessGraph(g) {\n g.nodes().forEach(function(v) {\n var node = g.node(v);\n if (!_.has(node, \"label\") && !g.children(v).length) { node.label = v; }\n\n if (_.has(node, \"paddingX\")) {\n _.defaults(node, {\n paddingLeft: node.paddingX,\n paddingRight: node.paddingX\n });\n }\n\n if (_.has(node, \"paddingY\")) {\n _.defaults(node, {\n paddingTop: node.paddingY,\n paddingBottom: node.paddingY\n });\n }\n\n if (_.has(node, \"padding\")) {\n _.defaults(node, {\n paddingLeft: node.padding,\n paddingRight: node.padding,\n paddingTop: node.padding,\n paddingBottom: node.padding\n });\n }\n\n _.defaults(node, NODE_DEFAULT_ATTRS);\n\n _.each([\"paddingLeft\", \"paddingRight\", \"paddingTop\", \"paddingBottom\"], function(k) {\n node[k] = Number(node[k]);\n });\n\n // Save dimensions for restore during post-processing\n if (_.has(node, \"width\")) { node._prevWidth = node.width; }\n if (_.has(node, \"height\")) { node._prevHeight = node.height; }\n });\n\n g.edges().forEach(function(e) {\n var edge = g.edge(e);\n if (!_.has(edge, \"label\")) { edge.label = \"\"; }\n _.defaults(edge, EDGE_DEFAULT_ATTRS);\n });\n}\n\nfunction postProcessGraph(g) {\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n\n // Restore original dimensions\n if (_.has(node, \"_prevWidth\")) {\n node.width = node._prevWidth;\n } else {\n delete node.width;\n }\n\n if (_.has(node, \"_prevHeight\")) {\n node.height = node._prevHeight;\n } else {\n delete node.height;\n }\n\n delete node._prevWidth;\n delete node._prevHeight;\n });\n}\n\nfunction createOrSelectGroup(root, name) {\n var selection = root.select(\"g.\" + name);\n if (selection.empty()) {\n selection = root.append(\"g\").attr(\"class\", name);\n }\n return selection;\n}\n\n},{\"./arrows\":2,\"./create-clusters\":3,\"./create-edge-labels\":4,\"./create-edge-paths\":5,\"./create-nodes\":6,\"./dagre\":8,\"./lodash\":21,\"./position-clusters\":22,\"./position-edge-labels\":23,\"./position-nodes\":24,\"./shapes\":26}],26:[function(require,module,exports){\n\"use strict\";\n\nvar intersectRect = require(\"./intersect/intersect-rect\"),\n intersectEllipse = require(\"./intersect/intersect-ellipse\"),\n intersectCircle = require(\"./intersect/intersect-circle\"),\n intersectPolygon = require(\"./intersect/intersect-polygon\");\n\nmodule.exports = {\n rect: rect,\n ellipse: ellipse,\n circle: circle,\n diamond: diamond\n};\n\nfunction rect(parent, bbox, node) {\n var shapeSvg = parent.insert(\"rect\", \":first-child\")\n .attr(\"rx\", node.rx)\n .attr(\"ry\", node.ry)\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"width\", bbox.width)\n .attr(\"height\", bbox.height);\n\n node.intersect = function(point) {\n return intersectRect(node, point);\n };\n\n return shapeSvg;\n}\n\nfunction ellipse(parent, bbox, node) {\n var rx = bbox.width / 2,\n ry = bbox.height / 2,\n shapeSvg = parent.insert(\"ellipse\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"rx\", rx)\n .attr(\"ry\", ry);\n\n node.intersect = function(point) {\n return intersectEllipse(node, rx, ry, point);\n };\n\n return shapeSvg;\n}\n\nfunction circle(parent, bbox, node) {\n var r = Math.max(bbox.width, bbox.height) / 2,\n shapeSvg = parent.insert(\"circle\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"r\", r);\n\n node.intersect = function(point) {\n return intersectCircle(node, r, point);\n };\n\n return shapeSvg;\n}\n\n// Circumscribe an ellipse for the bounding box with a diamond shape. I derived\n// the function to calculate the diamond shape from:\n// http://mathforum.org/kb/message.jspa?messageID=3750236\nfunction diamond(parent, bbox, node) {\n var w = (bbox.width * Math.SQRT2) / 2,\n h = (bbox.height * Math.SQRT2) / 2,\n points = [\n { x: 0, y: -h },\n { x: -w, y: 0 },\n { x: 0, y: h },\n { x: w, y: 0 }\n ],\n shapeSvg = parent.insert(\"polygon\", \":first-child\")\n .attr(\"points\", points.map(function(p) { return p.x + \",\" + p.y; }).join(\" \"));\n\n node.intersect = function(p) {\n return intersectPolygon(node, points, p);\n };\n\n return shapeSvg;\n}\n\n},{\"./intersect/intersect-circle\":11,\"./intersect/intersect-ellipse\":12,\"./intersect/intersect-polygon\":15,\"./intersect/intersect-rect\":16}],27:[function(require,module,exports){\nvar _ = require(\"./lodash\");\n\n// Public utility functions\nmodule.exports = {\n isSubgraph: isSubgraph,\n edgeToId: edgeToId,\n applyStyle: applyStyle,\n applyClass: applyClass,\n applyTransition: applyTransition\n};\n\n/*\n * Returns true if the specified node in the graph is a subgraph node. A\n * subgraph node is one that contains other nodes.\n */\nfunction isSubgraph(g, v) {\n return !!g.children(v).length;\n}\n\nfunction edgeToId(e) {\n return escapeId(e.v) + \":\" + escapeId(e.w) + \":\" + escapeId(e.name);\n}\n\nvar ID_DELIM = /:/g;\nfunction escapeId(str) {\n return str ? String(str).replace(ID_DELIM, \"\\\\:\") : \"\";\n}\n\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr(\"style\", styleFn);\n }\n}\n\nfunction applyClass(dom, classFn, otherClasses) {\n if (classFn) {\n dom\n .attr(\"class\", classFn)\n .attr(\"class\", otherClasses + \" \" + dom.attr(\"class\"));\n }\n}\n\nfunction applyTransition(selection, g) {\n var graph = g.graph();\n\n if (_.isPlainObject(graph)) {\n var transition = graph.transition;\n if (_.isFunction(transition)) {\n return transition(selection);\n }\n }\n\n return selection;\n}\n\n},{\"./lodash\":21}],28:[function(require,module,exports){\nmodule.exports = \"0.5.0\";\n\n},{}]},{},[1])(1)\n});\n\n","var util = require(\"./util\");\n\nmodule.exports = {\n \"default\": normal,\n \"normal\": normal,\n \"vee\": vee,\n \"undirected\": undirected\n};\n\nfunction normal(parent, id, edge, type) {\n var marker = parent.append(\"marker\")\n .attr(\"id\", id)\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 9)\n .attr(\"refY\", 5)\n .attr(\"markerUnits\", \"strokeWidth\")\n .attr(\"markerWidth\", 8)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\");\n\n var path = marker.append(\"path\")\n .attr(\"d\", \"M 0 0 L 10 5 L 0 10 z\")\n .style(\"stroke-width\", 1)\n .style(\"stroke-dasharray\", \"1,0\");\n util.applyStyle(path, edge[type + \"Style\"]);\n if (edge[type + \"Class\"]) {\n path.attr(\"class\", edge[type + \"Class\"]);\n }\n}\n\nfunction vee(parent, id, edge, type) {\n var marker = parent.append(\"marker\")\n .attr(\"id\", id)\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 9)\n .attr(\"refY\", 5)\n .attr(\"markerUnits\", \"strokeWidth\")\n .attr(\"markerWidth\", 8)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\");\n\n var path = marker.append(\"path\")\n .attr(\"d\", \"M 0 0 L 10 5 L 0 10 L 4 5 z\")\n .style(\"stroke-width\", 1)\n .style(\"stroke-dasharray\", \"1,0\");\n util.applyStyle(path, edge[type + \"Style\"]);\n if (edge[type + \"Class\"]) {\n path.attr(\"class\", edge[type + \"Class\"]);\n }\n}\n\nfunction undirected(parent, id, edge, type) {\n var marker = parent.append(\"marker\")\n .attr(\"id\", id)\n .attr(\"viewBox\", \"0 0 10 10\")\n .attr(\"refX\", 9)\n .attr(\"refY\", 5)\n .attr(\"markerUnits\", \"strokeWidth\")\n .attr(\"markerWidth\", 8)\n .attr(\"markerHeight\", 6)\n .attr(\"orient\", \"auto\");\n\n var path = marker.append(\"path\")\n .attr(\"d\", \"M 0 5 L 10 5\")\n .style(\"stroke-width\", 1)\n .style(\"stroke-dasharray\", \"1,0\");\n util.applyStyle(path, edge[type + \"Style\"]);\n if (edge[type + \"Class\"]) {\n path.attr(\"class\", edge[type + \"Class\"]);\n }\n}\n","var util = require(\"./util\"),\n addLabel = require(\"./label/add-label\");\n\nmodule.exports = createClusters;\n\nfunction createClusters(selection, g) {\n var clusters = g.nodes().filter(function(v) { return util.isSubgraph(g, v); }),\n svgClusters = selection.selectAll(\"g.cluster\")\n .data(clusters, function(v) { return v; });\n\n svgClusters.selectAll(\"*\").remove();\n svgClusters.enter()\n .append(\"g\")\n .attr(\"class\", \"cluster\")\n .attr(\"id\",function(v){\n var node = g.node(v);\n return node.id;\n })\n .style(\"opacity\", 0);\n \n svgClusters = selection.selectAll(\"g.cluster\");\n\n util.applyTransition(svgClusters, g)\n .style(\"opacity\", 1);\n\n svgClusters.each(function(v) {\n var node = g.node(v),\n thisGroup = d3.select(this);\n d3.select(this).append(\"rect\");\n var labelGroup = thisGroup.append(\"g\").attr(\"class\", \"label\");\n addLabel(labelGroup, node, node.clusterLabelPos);\n });\n\n svgClusters.selectAll(\"rect\").each(function(c) {\n var node = g.node(c);\n var domCluster = d3.select(this);\n util.applyStyle(domCluster, node.style);\n });\n\n util.applyTransition(svgClusters.exit(), g)\n .style(\"opacity\", 0)\n .remove();\n\n return svgClusters;\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\"),\n addLabel = require(\"./label/add-label\"),\n util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = createEdgeLabels;\n\nfunction createEdgeLabels(selection, g) {\n var svgEdgeLabels = selection.selectAll(\"g.edgeLabel\")\n .data(g.edges(), function(e) { return util.edgeToId(e); })\n .classed(\"update\", true);\n\n svgEdgeLabels.selectAll(\"*\").remove();\n svgEdgeLabels.enter()\n .append(\"g\")\n .classed(\"edgeLabel\", true)\n .style(\"opacity\", 0);\n\n svgEdgeLabels = selection.selectAll(\"g.edgeLabel\");\n \n svgEdgeLabels.each(function(e) {\n var edge = g.edge(e),\n label = addLabel(d3.select(this), g.edge(e), 0, 0).classed(\"label\", true),\n bbox = label.node().getBBox();\n\n if (edge.labelId) { label.attr(\"id\", edge.labelId); }\n if (!_.has(edge, \"width\")) { edge.width = bbox.width; }\n if (!_.has(edge, \"height\")) { edge.height = bbox.height; }\n });\n\n util.applyTransition(svgEdgeLabels.exit(), g)\n .style(\"opacity\", 0)\n .remove();\n\n return svgEdgeLabels;\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\"),\n intersectNode = require(\"./intersect/intersect-node\"),\n util = require(\"./util\"),\n d3 = require(\"./d3\");\nmodule.exports = createEdgePaths;\n\nfunction createEdgePaths(selection, g, arrows) {\n var svgPaths = selection.selectAll(\"g.edgePath\")\n .data(g.edges(), function(e) { return util.edgeToId(e); })\n .classed(\"update\", true);\n\n enter(svgPaths, g);\n exit(svgPaths, g);\n\n svgPaths = selection.selectAll(\"g.edgePath\");\n\n util.applyTransition(svgPaths, g)\n .style(\"opacity\", 1);\n\n // Save DOM element in the path group, and set ID and class\n svgPaths.each(function(e) {\n var domEdge = d3.select(this);\n var edge = g.edge(e);\n edge.elem = this;\n\n if (edge.id) {\n domEdge.attr(\"id\", edge.id);\n }\n\n util.applyClass(domEdge, edge[\"class\"],\n (domEdge.classed(\"update\") ? \"update \" : \"\") + \"edgePath\");\n });\n\n svgPaths.selectAll(\"path.path\")\n .each(function(e) {\n var edge = g.edge(e);\n edge.arrowheadId = _.uniqueId(\"arrowhead\");\n\n var domEdge = d3.select(this)\n .attr(\"marker-end\", function() {\n return \"url(\" + makeFragmentRef(location.href, edge.arrowheadId) + \")\";\n })\n .style(\"fill\", \"none\");\n\n util.applyTransition(domEdge, g)\n .attr(\"d\", function(e) { return calcPoints(g, e); });\n\n util.applyStyle(domEdge, edge.style);\n });\n\n svgPaths.selectAll(\"defs *\").remove();\n svgPaths.selectAll(\"defs\")\n .each(function(e) {\n var edge = g.edge(e),\n arrowhead = arrows[edge.arrowhead];\n arrowhead(d3.select(this), edge.arrowheadId, edge, \"arrowhead\");\n });\n\n return svgPaths;\n}\n\nfunction makeFragmentRef(url, fragmentId) {\n var baseUrl = url.split(\"#\")[0];\n return baseUrl + \"#\" + fragmentId;\n}\n\nfunction calcPoints(g, e) {\n var edge = g.edge(e),\n tail = g.node(e.v),\n head = g.node(e.w),\n points = edge.points.slice(1, edge.points.length - 1);\n points.unshift(intersectNode(tail, points[0]));\n points.push(intersectNode(head, points[points.length - 1]));\n\n return createLine(edge, points);\n}\n\nfunction createLine(edge, points) {\n var line = d3.line()\n .x(function(d) { return d.x; })\n .y(function(d) { return d.y; });\n \n line.curve(edge.lineCurve);\n\n return line(points);\n}\n\nfunction getCoords(elem) {\n var bbox = elem.getBBox(),\n matrix = elem.ownerSVGElement.getScreenCTM()\n .inverse()\n .multiply(elem.getScreenCTM())\n .translate(bbox.width / 2, bbox.height / 2);\n return { x: matrix.e, y: matrix.f };\n}\n\nfunction enter(svgPaths, g) {\n var svgPathsEnter = svgPaths.enter()\n .append(\"g\")\n .attr(\"class\", \"edgePath\")\n .style(\"opacity\", 0);\n svgPathsEnter.append(\"path\")\n .attr(\"class\", \"path\")\n .attr(\"d\", function(e) {\n var edge = g.edge(e),\n sourceElem = g.node(e.v).elem,\n points = _.range(edge.points.length).map(function() { return getCoords(sourceElem); });\n return createLine(edge, points);\n });\n svgPathsEnter.append(\"defs\");\n}\n\nfunction exit(svgPaths, g) {\n var svgPathExit = svgPaths.exit();\n util.applyTransition(svgPathExit, g)\n .style(\"opacity\", 0)\n .remove();\n\n util.applyTransition(svgPathExit.select(\"path.path\"), g)\n .attr(\"d\", function(e) {\n var source = g.node(e.v);\n\n if (source) {\n var points = _.range(this.getTotalLength()).map(function() { return source; });\n return createLine({}, points);\n } else {\n return d3.select(this).attr(\"d\");\n }\n });\n}\n","\"use strict\";\n\nvar _ = require(\"./lodash\"),\n addLabel = require(\"./label/add-label\"),\n util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = createNodes;\n\nfunction createNodes(selection, g, shapes) {\n var simpleNodes = g.nodes().filter(function(v) { return !util.isSubgraph(g, v); });\n var svgNodes = selection.selectAll(\"g.node\")\n .data(simpleNodes, function(v) { return v; })\n .classed(\"update\", true);\n\n svgNodes.selectAll(\"*\").remove();\n\n svgNodes.enter()\n .append(\"g\")\n .attr(\"class\", \"node\")\n .style(\"opacity\", 0);\n\n svgNodes = selection.selectAll(\"g.node\"); \n\n svgNodes.each(function(v) {\n var node = g.node(v),\n thisGroup = d3.select(this);\n util.applyClass(thisGroup, node[\"class\"],\n (thisGroup.classed(\"update\") ? \"update \" : \"\") + \"node\");\n var labelGroup = thisGroup.append(\"g\").attr(\"class\", \"label\"),\n labelDom = addLabel(labelGroup, node),\n shape = shapes[node.shape],\n bbox = _.pick(labelDom.node().getBBox(), \"width\", \"height\");\n\n node.elem = this;\n\n if (node.id) { thisGroup.attr(\"id\", node.id); }\n if (node.labelId) { labelGroup.attr(\"id\", node.labelId); }\n\n if (_.has(node, \"width\")) { bbox.width = node.width; }\n if (_.has(node, \"height\")) { bbox.height = node.height; }\n\n bbox.width += node.paddingLeft + node.paddingRight;\n bbox.height += node.paddingTop + node.paddingBottom;\n labelGroup.attr(\"transform\", \"translate(\" +\n ((node.paddingLeft - node.paddingRight) / 2) + \",\" +\n ((node.paddingTop - node.paddingBottom) / 2) + \")\");\n\n var shapeSvg = shape(d3.select(this), bbox, node);\n util.applyStyle(shapeSvg, node.style);\n\n var shapeBBox = shapeSvg.node().getBBox();\n node.width = shapeBBox.width;\n node.height = shapeBBox.height;\n });\n\n util.applyTransition(svgNodes.exit(), g)\n .style(\"opacity\", 0)\n .remove();\n\n return svgNodes;\n}\n","// Stub to get D3 either via NPM or from the global object\nmodule.exports = window.d3;\n","/* global window */\n\nvar dagre;\n\nif (require) {\n try {\n dagre = require(\"dagre\");\n } catch (e) {}\n}\n\nif (!dagre) {\n dagre = window.dagre;\n}\n\nmodule.exports = dagre;\n","/* global window */\n\nvar graphlib;\n\nif (require) {\n try {\n graphlib = require(\"graphlib\");\n } catch (e) {}\n}\n\nif (!graphlib) {\n graphlib = window.graphlib;\n}\n\nmodule.exports = graphlib;\n","module.exports = {\n node: require(\"./intersect-node\"),\n circle: require(\"./intersect-circle\"),\n ellipse: require(\"./intersect-ellipse\"),\n polygon: require(\"./intersect-polygon\"),\n rect: require(\"./intersect-rect\")\n};\n","var intersectEllipse = require(\"./intersect-ellipse\");\n\nmodule.exports = intersectCircle;\n\nfunction intersectCircle(node, rx, point) {\n return intersectEllipse(node, rx, rx, point);\n}\n","module.exports = intersectEllipse;\n\nfunction intersectEllipse(node, rx, ry, point) {\n // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html\n\n var cx = node.x;\n var cy = node.y;\n\n var px = cx - point.x;\n var py = cy - point.y;\n\n var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);\n\n var dx = Math.abs(rx * ry * px / det);\n if (point.x < cx) {\n dx = -dx;\n }\n var dy = Math.abs(rx * ry * py / det);\n if (point.y < cy) {\n dy = -dy;\n }\n\n return {x: cx + dx, y: cy + dy};\n}\n\n","module.exports = intersectLine;\n\n/*\n * Returns the point at which two lines, p and q, intersect or returns\n * undefined if they do not intersect.\n */\nfunction intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n\n var a1, a2, b1, b2, c1, c2;\n var r1, r2 , r3, r4;\n var denom, offset, num;\n var x, y;\n\n // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = (p2.x * p1.y) - (p1.x * p2.y);\n\n // Compute r3 and r4.\n r3 = ((a1 * q1.x) + (b1 * q1.y) + c1);\n r4 = ((a1 * q2.x) + (b1 * q2.y) + c1);\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if ((r3 !== 0) && (r4 !== 0) && sameSign(r3, r4)) {\n return /*DONT_INTERSECT*/;\n }\n\n // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = (q2.x * q1.y) - (q1.x * q2.y);\n\n // Compute r1 and r2\n r1 = (a2 * p1.x) + (b2 * p1.y) + c2;\n r2 = (a2 * p2.x) + (b2 * p2.y) + c2;\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if ((r1 !== 0) && (r2 !== 0) && (sameSign(r1, r2))) {\n return /*DONT_INTERSECT*/;\n }\n\n // Line segments intersect: compute intersection point.\n denom = (a1 * b2) - (a2 * b1);\n if (denom === 0) {\n return /*COLLINEAR*/;\n }\n\n offset = Math.abs(denom / 2);\n\n // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n num = (b1 * c2) - (b2 * c1);\n x = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n num = (a2 * c1) - (a1 * c2);\n y = (num < 0) ? ((num - offset) / denom) : ((num + offset) / denom);\n\n return { x: x, y: y };\n}\n\nfunction sameSign(r1, r2) {\n return r1 * r2 > 0;\n}\n","module.exports = intersectNode;\n\nfunction intersectNode(node, point) {\n return node.intersect(point);\n}\n","var intersectLine = require(\"./intersect-line\");\n\nmodule.exports = intersectPolygon;\n\n/*\n * Returns the point ({x, y}) at which the point argument intersects with the\n * node argument assuming that it has the shape specified by polygon.\n */\nfunction intersectPolygon(node, polyPoints, point) {\n var x1 = node.x;\n var y1 = node.y;\n\n var intersections = [];\n\n var minX = Number.POSITIVE_INFINITY,\n minY = Number.POSITIVE_INFINITY;\n polyPoints.forEach(function(entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n\n var left = x1 - node.width / 2 - minX;\n var top = y1 - node.height / 2 - minY;\n\n for (var i = 0; i < polyPoints.length; i++) {\n var p1 = polyPoints[i];\n var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n var intersect = intersectLine(node, point,\n {x: left + p1.x, y: top + p1.y}, {x: left + p2.x, y: top + p2.y});\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n console.log(\"NO INTERSECTION FOUND, RETURN NODE CENTER\", node);\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function(p, q) {\n var pdx = p.x - point.x,\n pdy = p.y - point.y,\n distp = Math.sqrt(pdx * pdx + pdy * pdy),\n\n qdx = q.x - point.x,\n qdy = q.y - point.y,\n distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return (distp < distq) ? -1 : (distp === distq ? 0 : 1);\n });\n }\n return intersections[0];\n}\n","module.exports = intersectRect;\n\nfunction intersectRect(node, point) {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : h * dx / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : w * dy / dx;\n }\n\n return {x: x + sx, y: y + sy};\n}\n","var util = require(\"../util\");\n\nmodule.exports = addHtmlLabel;\n\nfunction addHtmlLabel(root, node) {\n var fo = root\n .append(\"foreignObject\")\n .attr(\"width\", \"100000\");\n\n var div = fo\n .append(\"xhtml:div\");\n div.attr(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n\n var label = node.label;\n switch(typeof label) {\n case \"function\":\n div.insert(label);\n break;\n case \"object\":\n // Currently we assume this is a DOM object.\n div.insert(function() { return label; });\n break;\n default: div.html(label);\n }\n\n util.applyStyle(div, node.labelStyle);\n div.style(\"display\", \"inline-block\");\n // Fix for firefox\n div.style(\"white-space\", \"nowrap\");\n\n var client = div.node().getBoundingClientRect();\n fo\n .attr(\"width\", client.width)\n .attr(\"height\", client.height); \n\n return fo;\n}\n","var addTextLabel = require(\"./add-text-label\"),\n addHtmlLabel = require(\"./add-html-label\"),\n addSVGLabel = require(\"./add-svg-label\");\n\nmodule.exports = addLabel;\n\nfunction addLabel(root, node, location) {\n var label = node.label;\n var labelSvg = root.append(\"g\");\n\n // Allow the label to be a string, a function that returns a DOM element, or\n // a DOM element itself.\n if (node.labelType === \"svg\") {\n addSVGLabel(labelSvg, node);\n } else if (typeof label !== \"string\" || node.labelType === \"html\") {\n addHtmlLabel(labelSvg, node);\n } else {\n addTextLabel(labelSvg, node);\n }\n\n var labelBBox = labelSvg.node().getBBox();\n var y;\n switch(location) {\n case \"top\":\n y = (-node.height / 2);\n break;\n case \"bottom\":\n y = (node.height / 2) - labelBBox.height;\n break;\n default:\n y = (-labelBBox.height / 2);\n }\n labelSvg.attr(\"transform\",\n \"translate(\" + (-labelBBox.width / 2) + \",\" + y + \")\");\n\n return labelSvg;\n}\n","var util = require(\"../util\");\n\nmodule.exports = addSVGLabel;\n\nfunction addSVGLabel(root, node) {\n var domNode = root;\n\n domNode.node().appendChild(node.label);\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n","var util = require(\"../util\");\n\nmodule.exports = addTextLabel;\n\n/*\n * Attaches a text label to the specified root. Handles escape sequences.\n */\nfunction addTextLabel(root, node) {\n var domNode = root.append(\"text\");\n\n var lines = processEscapeSequences(node.label).split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n domNode\n .append(\"tspan\")\n .attr(\"xml:space\", \"preserve\")\n .attr(\"dy\", \"1em\")\n .attr(\"x\", \"1\")\n .text(lines[i]);\n }\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\nfunction processEscapeSequences(text) {\n var newText = \"\",\n escaped = false,\n ch;\n for (var i = 0; i < text.length; ++i) {\n ch = text[i];\n if (escaped) {\n switch(ch) {\n case \"n\": newText += \"\\n\"; break;\n default: newText += ch;\n }\n escaped = false;\n } else if (ch === \"\\\\\") {\n escaped = true;\n } else {\n newText += ch;\n }\n }\n return newText;\n}\n","/* global window */\n\nvar lodash;\n\nif (require) {\n try {\n lodash = require(\"lodash\");\n } catch (e) {}\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n","\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionClusters;\n\nfunction positionClusters(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n\n util.applyTransition(created.selectAll(\"rect\"), g)\n .attr(\"width\", function(v) { return g.node(v).width; })\n .attr(\"height\", function(v) { return g.node(v).height; })\n .attr(\"x\", function(v) {\n var node = g.node(v);\n return -node.width / 2;\n })\n .attr(\"y\", function(v) {\n var node = g.node(v);\n return -node.height / 2;\n });\n\n}\n","\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\"),\n _ = require(\"./lodash\");\n\nmodule.exports = positionEdgeLabels;\n\nfunction positionEdgeLabels(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(e) {\n var edge = g.edge(e);\n return _.has(edge, \"x\") ? \"translate(\" + edge.x + \",\" + edge.y + \")\" : \"\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n","\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionNodes;\n\nfunction positionNodes(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n","var _ = require(\"./lodash\"),\n layout = require(\"./dagre\").layout;\n\nmodule.exports = render;\n\n// This design is based on http://bost.ocks.org/mike/chart/.\nfunction render() {\n var createNodes = require(\"./create-nodes\"),\n createClusters = require(\"./create-clusters\"),\n createEdgeLabels = require(\"./create-edge-labels\"),\n createEdgePaths = require(\"./create-edge-paths\"),\n positionNodes = require(\"./position-nodes\"),\n positionEdgeLabels = require(\"./position-edge-labels\"),\n positionClusters = require(\"./position-clusters\"),\n shapes = require(\"./shapes\"),\n arrows = require(\"./arrows\");\n\n var fn = function(svg, g) {\n preProcessGraph(g);\n\n svg.selectAll(\"*\").remove();\n\n var outputGroup = createOrSelectGroup(svg, \"output\"),\n clustersGroup = createOrSelectGroup(outputGroup, \"clusters\"),\n edgePathsGroup = createOrSelectGroup(outputGroup, \"edgePaths\"),\n edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, \"edgeLabels\"), g),\n nodes = createNodes(createOrSelectGroup(outputGroup, \"nodes\"), g, shapes);\n\n layout(g);\n\n positionNodes(nodes, g);\n positionEdgeLabels(edgeLabels, g);\n createEdgePaths(edgePathsGroup, g, arrows);\n\n var clusters = createClusters(clustersGroup, g);\n positionClusters(clusters, g);\n\n postProcessGraph(g);\n };\n\n fn.createNodes = function(value) {\n if (!arguments.length) return createNodes;\n createNodes = value;\n return fn;\n };\n\n fn.createClusters = function(value) {\n if (!arguments.length) return createClusters;\n createClusters = value;\n return fn;\n };\n\n fn.createEdgeLabels = function(value) {\n if (!arguments.length) return createEdgeLabels;\n createEdgeLabels = value;\n return fn;\n };\n\n fn.createEdgePaths = function(value) {\n if (!arguments.length) return createEdgePaths;\n createEdgePaths = value;\n return fn;\n };\n\n fn.shapes = function(value) {\n if (!arguments.length) return shapes;\n shapes = value;\n return fn;\n };\n\n fn.arrows = function(value) {\n if (!arguments.length) return arrows;\n arrows = value;\n return fn;\n };\n\n return fn;\n}\n\nvar NODE_DEFAULT_ATTRS = {\n paddingLeft: 10,\n paddingRight: 10,\n paddingTop: 10,\n paddingBottom: 10,\n rx: 0,\n ry: 0,\n shape: \"rect\"\n};\n\nvar EDGE_DEFAULT_ATTRS = {\n arrowhead: \"normal\",\n lineCurve: d3.curveLinear\n};\n\nfunction preProcessGraph(g) {\n g.nodes().forEach(function(v) {\n var node = g.node(v);\n if (!_.has(node, \"label\") && !g.children(v).length) { node.label = v; }\n\n if (_.has(node, \"paddingX\")) {\n _.defaults(node, {\n paddingLeft: node.paddingX,\n paddingRight: node.paddingX\n });\n }\n\n if (_.has(node, \"paddingY\")) {\n _.defaults(node, {\n paddingTop: node.paddingY,\n paddingBottom: node.paddingY\n });\n }\n\n if (_.has(node, \"padding\")) {\n _.defaults(node, {\n paddingLeft: node.padding,\n paddingRight: node.padding,\n paddingTop: node.padding,\n paddingBottom: node.padding\n });\n }\n\n _.defaults(node, NODE_DEFAULT_ATTRS);\n\n _.each([\"paddingLeft\", \"paddingRight\", \"paddingTop\", \"paddingBottom\"], function(k) {\n node[k] = Number(node[k]);\n });\n\n // Save dimensions for restore during post-processing\n if (_.has(node, \"width\")) { node._prevWidth = node.width; }\n if (_.has(node, \"height\")) { node._prevHeight = node.height; }\n });\n\n g.edges().forEach(function(e) {\n var edge = g.edge(e);\n if (!_.has(edge, \"label\")) { edge.label = \"\"; }\n _.defaults(edge, EDGE_DEFAULT_ATTRS);\n });\n}\n\nfunction postProcessGraph(g) {\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n\n // Restore original dimensions\n if (_.has(node, \"_prevWidth\")) {\n node.width = node._prevWidth;\n } else {\n delete node.width;\n }\n\n if (_.has(node, \"_prevHeight\")) {\n node.height = node._prevHeight;\n } else {\n delete node.height;\n }\n\n delete node._prevWidth;\n delete node._prevHeight;\n });\n}\n\nfunction createOrSelectGroup(root, name) {\n var selection = root.select(\"g.\" + name);\n if (selection.empty()) {\n selection = root.append(\"g\").attr(\"class\", name);\n }\n return selection;\n}\n","\"use strict\";\n\nvar intersectRect = require(\"./intersect/intersect-rect\"),\n intersectEllipse = require(\"./intersect/intersect-ellipse\"),\n intersectCircle = require(\"./intersect/intersect-circle\"),\n intersectPolygon = require(\"./intersect/intersect-polygon\");\n\nmodule.exports = {\n rect: rect,\n ellipse: ellipse,\n circle: circle,\n diamond: diamond\n};\n\nfunction rect(parent, bbox, node) {\n var shapeSvg = parent.insert(\"rect\", \":first-child\")\n .attr(\"rx\", node.rx)\n .attr(\"ry\", node.ry)\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"width\", bbox.width)\n .attr(\"height\", bbox.height);\n\n node.intersect = function(point) {\n return intersectRect(node, point);\n };\n\n return shapeSvg;\n}\n\nfunction ellipse(parent, bbox, node) {\n var rx = bbox.width / 2,\n ry = bbox.height / 2,\n shapeSvg = parent.insert(\"ellipse\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"rx\", rx)\n .attr(\"ry\", ry);\n\n node.intersect = function(point) {\n return intersectEllipse(node, rx, ry, point);\n };\n\n return shapeSvg;\n}\n\nfunction circle(parent, bbox, node) {\n var r = Math.max(bbox.width, bbox.height) / 2,\n shapeSvg = parent.insert(\"circle\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"r\", r);\n\n node.intersect = function(point) {\n return intersectCircle(node, r, point);\n };\n\n return shapeSvg;\n}\n\n// Circumscribe an ellipse for the bounding box with a diamond shape. I derived\n// the function to calculate the diamond shape from:\n// http://mathforum.org/kb/message.jspa?messageID=3750236\nfunction diamond(parent, bbox, node) {\n var w = (bbox.width * Math.SQRT2) / 2,\n h = (bbox.height * Math.SQRT2) / 2,\n points = [\n { x: 0, y: -h },\n { x: -w, y: 0 },\n { x: 0, y: h },\n { x: w, y: 0 }\n ],\n shapeSvg = parent.insert(\"polygon\", \":first-child\")\n .attr(\"points\", points.map(function(p) { return p.x + \",\" + p.y; }).join(\" \"));\n\n node.intersect = function(p) {\n return intersectPolygon(node, points, p);\n };\n\n return shapeSvg;\n}\n","var _ = require(\"./lodash\");\n\n// Public utility functions\nmodule.exports = {\n isSubgraph: isSubgraph,\n edgeToId: edgeToId,\n applyStyle: applyStyle,\n applyClass: applyClass,\n applyTransition: applyTransition\n};\n\n/*\n * Returns true if the specified node in the graph is a subgraph node. A\n * subgraph node is one that contains other nodes.\n */\nfunction isSubgraph(g, v) {\n return !!g.children(v).length;\n}\n\nfunction edgeToId(e) {\n return escapeId(e.v) + \":\" + escapeId(e.w) + \":\" + escapeId(e.name);\n}\n\nvar ID_DELIM = /:/g;\nfunction escapeId(str) {\n return str ? String(str).replace(ID_DELIM, \"\\\\:\") : \"\";\n}\n\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr(\"style\", styleFn);\n }\n}\n\nfunction applyClass(dom, classFn, otherClasses) {\n if (classFn) {\n dom\n .attr(\"class\", classFn)\n .attr(\"class\", otherClasses + \" \" + dom.attr(\"class\"));\n }\n}\n\nfunction applyTransition(selection, g) {\n var graph = g.graph();\n\n if (_.isPlainObject(graph)) {\n var transition = graph.transition;\n if (_.isFunction(transition)) {\n return transition(selection);\n }\n }\n\n return selection;\n}\n","module.exports = \"0.5.0\";\n"]} \ No newline at end of file diff --git a/dist/dagre-d3.js b/dist/dagre-d3.js index 5dc39000..d3f6fa89 100644 --- a/dist/dagre-d3.js +++ b/dist/dagre-d3.js @@ -123,6 +123,8 @@ function createClusters(selection, g) { return node.id; }) .style("opacity", 0); + + svgClusters = selection.selectAll("g.cluster"); util.applyTransition(svgClusters, g) .style("opacity", 1); @@ -168,6 +170,9 @@ function createEdgeLabels(selection, g) { .append("g") .classed("edgeLabel", true) .style("opacity", 0); + + svgEdgeLabels = selection.selectAll("g.edgeLabel"); + svgEdgeLabels.each(function(e) { var edge = g.edge(e), label = addLabel(d3.select(this), g.edge(e), 0, 0).classed("label", true), @@ -202,6 +207,8 @@ function createEdgePaths(selection, g, arrows) { enter(svgPaths, g); exit(svgPaths, g); + svgPaths = selection.selectAll("g.edgePath"); + util.applyTransition(svgPaths, g) .style("opacity", 1); @@ -264,17 +271,11 @@ function calcPoints(g, e) { } function createLine(edge, points) { - var line = d3.svg.line() + var line = d3.line() .x(function(d) { return d.x; }) .y(function(d) { return d.y; }); - - if (_.has(edge, "lineInterpolate")) { - line.interpolate(edge.lineInterpolate); - } - - if (_.has(edge, "lineTension")) { - line.tension(Number(edge.lineTension)); - } + + line.curve(edge.lineCurve); return line(points); } @@ -340,14 +341,20 @@ function createNodes(selection, g, shapes) { .classed("update", true); svgNodes.selectAll("*").remove(); + svgNodes.enter() .append("g") .attr("class", "node") .style("opacity", 0); + + svgNodes = selection.selectAll("g.node"); + svgNodes.each(function(v) { var node = g.node(v), - thisGroup = d3.select(this), - labelGroup = thisGroup.append("g").attr("class", "label"), + thisGroup = d3.select(this); + util.applyClass(thisGroup, node["class"], + (thisGroup.classed("update") ? "update " : "") + "node"); + var labelGroup = thisGroup.append("g").attr("class", "label"), labelDom = addLabel(labelGroup, node), shape = shapes[node.shape], bbox = _.pick(labelDom.node().getBBox(), "width", "height"); @@ -356,8 +363,6 @@ function createNodes(selection, g, shapes) { if (node.id) { thisGroup.attr("id", node.id); } if (node.labelId) { labelGroup.attr("id", node.labelId); } - util.applyClass(thisGroup, node["class"], - (thisGroup.classed("update") ? "update " : "") + "node"); if (_.has(node, "width")) { bbox.width = node.width; } if (_.has(node, "height")) { bbox.height = node.height; } @@ -667,7 +672,7 @@ function addHtmlLabel(root, node) { // Fix for firefox div.style("white-space", "nowrap"); - var client = div[0][0].getBoundingClientRect(); + var client = div.node().getBoundingClientRect(); fo .attr("width", client.width) .attr("height", client.height); @@ -897,6 +902,8 @@ function render() { var fn = function(svg, g) { preProcessGraph(g); + svg.selectAll("*").remove(); + var outputGroup = createOrSelectGroup(svg, "output"), clustersGroup = createOrSelectGroup(outputGroup, "clusters"), edgePathsGroup = createOrSelectGroup(outputGroup, "edgePaths"), @@ -966,7 +973,7 @@ var NODE_DEFAULT_ATTRS = { var EDGE_DEFAULT_ATTRS = { arrowhead: "normal", - lineInterpolate: "linear" + lineCurve: d3.curveLinear }; function preProcessGraph(g) { @@ -1185,7 +1192,7 @@ function applyTransition(selection, g) { } },{"./lodash":21}],28:[function(require,module,exports){ -module.exports = "0.4.18"; +module.exports = "0.5.0"; },{}],29:[function(require,module,exports){ /* @@ -17633,4 +17640,4 @@ module.exports = '1.0.7'; },{}]},{},[1])(1) }); -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJpbmRleC5qcyIsImxpYi9hcnJvd3MuanMiLCJsaWIvY3JlYXRlLWNsdXN0ZXJzLmpzIiwibGliL2NyZWF0ZS1lZGdlLWxhYmVscy5qcyIsImxpYi9jcmVhdGUtZWRnZS1wYXRocy5qcyIsImxpYi9jcmVhdGUtbm9kZXMuanMiLCJsaWIvZDMuanMiLCJsaWIvZGFncmUuanMiLCJsaWIvZ3JhcGhsaWIuanMiLCJsaWIvaW50ZXJzZWN0L2luZGV4LmpzIiwibGliL2ludGVyc2VjdC9pbnRlcnNlY3QtY2lyY2xlLmpzIiwibGliL2ludGVyc2VjdC9pbnRlcnNlY3QtZWxsaXBzZS5qcyIsImxpYi9pbnRlcnNlY3QvaW50ZXJzZWN0LWxpbmUuanMiLCJsaWIvaW50ZXJzZWN0L2ludGVyc2VjdC1ub2RlLmpzIiwibGliL2ludG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AgICogVXNlZCB0byBkZXRlY3QgY29kZSB0byBiZSBldmFsdWF0ZWQuXG4gICAgICAgKlxuICAgICAgICogQG1lbWJlck9mIF8udGVtcGxhdGVTZXR0aW5nc1xuICAgICAgICogQHR5cGUgUmVnRXhwXG4gICAgICAgKi9cbiAgICAgICdldmFsdWF0ZSc6IHJlRXZhbHVhdGUsXG5cbiAgICAgIC8qKlxuICAgICAgICogVXNlZCB0byBkZXRlY3QgYGRhdGFgIHByb3BlcnR5IHZhbHVlcyB0byBpbmplY3QuXG4gICAgICAgKlxuICAgICAgICogQG1lbWJlck9mIF8udGVtcGxhdGVTZXR0aW5nc1xuICAgICAgICogQHR5cGUgUmVnRXhwXG4gICAgICAgKi9cbiAgICAgICdpbnRlcnBvbGF0ZSc6IHJlSW50ZXJwb2xhdGUsXG5cbiAgICAgIC8qKlxuICAgICAgICogVXNlZCB0byByZWZlcmVuY2UgdGhlIGRhdGEgb2JqZWN0IGluIHRoZSB0ZW1wbGF0ZSB0ZXh0LlxuICAgICAgICpcbiAgICAgICAqIEBtZW1iZXJPZiBfLnRlbXBsYXRlU2V0dGluZ3NcbiAgICAgICAqIEB0eXBlIHN0cmluZ1xuICAgICAgICovXG4gICAgICAndmFyaWFibGUnOiAnJyxcblxuICAgICAgLyoqXG4gICAgICAgKiBVc2VkIHRvIGltcG9ydCB2YXJpYWJsZXMgaW50byB0aGUgY29tcGlsZWQgdGVtcGxhdGUuXG4gICAgICAgKlxuICAgICAgICogQG1lbWJlck9mIF8udGVtcGxhdGVTZXR0aW5nc1xuICAgICAgICogQHR5cGUgT2JqZWN0XG4gICAgICAgKi9cbiAgICAgICdpbXBvcnRzJzoge1xuXG4gICAgICAgIC8qKlxuICAgICAgICAgKiBBIHJlZmVyZW5jZSB0byB0aGUgYGxvZGFzaGAgZnVuY3Rpb24uXG4gICAgICAgICAqXG4gICAgICAgICAqIEBtZW1iZXJPZiBfLnRlbXBsYXRlU2V0dGluZ3MuaW1wb3J0c1xuICAgICAgICAg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YVswXSldLmFwcGx5KHdyYXBwZXIsIGRhdGFbM10pO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB3cmFwcGVyID0gKGZ1bmMubGVuZ3RoID09IDEgJiYgaXNMYXppYWJsZShmdW5jKSkgPyB3cmFwcGVyW2Z1bmNOYW1lXSgpIDogd3JhcHBlci50aHJ1KGZ1bmMpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgdmFyIGFyZ3MgPSBhcmd1bWVudHMsXG4gICAgICAgICAgICAgIHZhbHVlID0gYXJnc1swXTtcblxuICAgICAgICAgIGlmICh3cmFwcGVyICYmIGFyZ3MubGVuZ3RoID09IDEgJiYgaXNBcnJheSh2YWx1ZSkgJiYgdmFsdWUubGVuZ3RoID49IExBUkdFX0FSUkFZX1NJWkUpIHtcbiAgICAgICAgICAgIHJldHVybiB3cmFwcGVyLnBsYW50KHZhbHVlKS52YWx1ZSgpO1xuICAgICAgICAgIH1cbiAgICAgICAgICB2YXIgaW5kZXggPSAwLFxuICAgICAgICAgICAgICByZXN1bHQgPSBsZW5ndGggPyBmdW5jc1tpbmRleF0uYXBwbHkodGhpcywgYXJncykgOiB2YWx1ZTtcblxuICAgICAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgICAgICByZXN1bHQgPSBmdW5jc1tpbmRleF0uY2FsbCh0aGlzLCByZXN1bHQpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9O1xuICAgICAgfTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBDcmVhdGVzIGEgZnVuY3Rpb24gZm9yIGBfLmZvckVhY2hgIG9yIGBfLmZvckVhY2hSaWdodGAuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7RnVuY3Rpb259IGFycmF5RnVuYyBUaGUgZnV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DdG9yID0gaXNMb29zZTtcbiAgICAgIHdoaWxlICgrK2luZGV4IDwgb2JqTGVuZ3RoKSB7XG4gICAgICAgIGtleSA9IG9ialByb3BzW2luZGV4XTtcbiAgICAgICAgdmFyIG9ialZhbHVlID0gb2JqZWN0W2tleV0sXG4gICAgICAgICAgICBvdGhWYWx1ZSA9IG90aGVyW2tleV0sXG4gICAgICAgICAgICByZXN1bHQgPSBjdXN0b21pemVyID8gY3VzdG9taXplcihpc0xvb3NlID8gb3RoVmFsdWUgOiBvYmpWYWx1ZSwgaXNMb29zZT8gb2JqVmFsdWUgOiBvdGhWYWx1ZSwga2V5KSA6IHVuZGVmaW5lZDtcblxuICAgICAgICAvLyBSZWN1cnNpdmVseSBjb21wYXJlIG9iamVjdHMgKHN1c2NlcHRpYmxlIHRvIGNhbGwgc3RhY2sgbGltaXRzKS5cbiAgICAgICAgaWYgKCEocmVzdWx0ID09PSB1bmRlZmluZWQgPyBlcXVhbEZ1bmMob2JqVmFsdWUsIG90aFZhbHVlLCBjdXN0b21pemVyLCBpc0xvb3NlLCBzdGFja0EsIHN0YWNrQikgOiByZXN1bHQpKSB7XG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIHNraXBDdG9yIHx8IChza2lwQ3RvciA9IGtleSA9PSAnY29uc3RydWN0b3InKTtcbiAgICAgIH1cbiAgICAgIGlmICghc2tpcEN0b3IpIHtcbiAgICAgICAgdmFyIG9iakN0b3IgPSBvYmplY3QuY29uc3RydWN0b3IsXG4gICAgICAgICAgICBvdGhDdG9yID0gb3RoZXIuY29uc3RydWN0b3I7XG5cbiAgICAgICAgLy8gTm9uIGBPYmplY3RgIG9iamVjdCBpbnN0YW5jZXMgd2l0aCBkaWZmZXJlbnQgY29uc3RydWN0b3JzIGFyZSBub3QgZXF1YWwuXG4gICAgICAgIGlmIChvYmpDdG9yICE9IG90aEN0b3IgJiZcbiAgICAgICAgICAgICgnY29uc3RydWN0b3InIGluIG9iamV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i9cbiAgICBmdW5jdGlvbiBpbml0Q2xvbmVBcnJheShhcnJheSkge1xuICAgICAgdmFyIGxlbmd0aCA9IGFycmF5Lmxlbmd0aCxcbiAgICAgICAgICByZXN1bHQgPSBuZXcgYXJyYXkuY29uc3RydWN0b3IobGVuZ3RoKTtcblxuICAgICAgLy8gQWRkIGFycmF5IHByb3BlcnRpZXMgYXNzaWduZWQgYnkgYFJlZ0V4cCNleGVjYC5cbiAgICAgIGlmIChsZW5ndGggJiYgdHlwZW9mIGFycmF5WzBdID09ICdzdHJpbmcnICYmIGhhc093blByb3BlcnR5LmNhbGwoYXJyYXksICdpbmRleCcpKSB7XG4gICAgICAgIHJlc3VsdC5pbmRleCA9IGFycmF5LmluZGV4O1xuICAgICAgICByZXN1bHQuaW5wdXQgPSBhcnJheS5pbnB1dDtcbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogSW5pdGlhbGl6ZXMgYW4gb2JqZWN0IGNsb25lLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gY2xvbmUuXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyB0aGUgaW5pdGlhbGl6ZWQgY2xvbmUuXG4gICAgICovXG4gICAgZnVuY3Rpb24gaW5pdENsb25lT2JqZWN0KG9iamVjdCkge1xuICAgICAgdmFyIEN0b3IgPSBvYmplY3QuY29uc3RydWN0b3I7XG4gICAgICBpZiAoISh0eXBlb2YgQ3RvciA9PSAnZnVuY3Rpb24nICYmIEN0b3IgaW5zdGFuY2VvZiBDdG9yKSkge1xuICAgICAgICBDdG9yID0gT2JqZWN0O1xuICAgICAgfVxuICAgICAgcmV0dXJuIG5ldyBDdG9yO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIEluaXRpYWxpemVzIGFuIG9iamVjdCBjbG9uZSBiYXNlZCBvbiBpd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gICAgc2VlbiA9IGNhY2hlc1swXTtcblxuICAgICAgb3V0ZXI6XG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICB2YWx1ZSA9IGFycmF5W2luZGV4XTtcbiAgICAgICAgaWYgKChzZWVuID8gY2FjaGVJbmRleE9mKHNlZW4sIHZhbHVlKSA6IGluZGV4T2YocmVzdWx0LCB2YWx1ZSwgMCkpIDwgMCkge1xuICAgICAgICAgIHZhciBvdGhJbmRleCA9IG90aExlbmd0aDtcbiAgICAgICAgICB3aGlsZSAoLS1vdGhJbmRleCkge1xuICAgICAgICAgICAgdmFyIGNhY2hlID0gY2FjaGVzW290aEluZGV4XTtcbiAgICAgICAgICAgIGlmICgoY2FjaGUgPyBjYWNoZUluZGV4T2YoY2FjaGUsIHZhbHVlKSA6IGluZGV4T2YoYXJyYXlzW290aEluZGV4XSwgdmFsdWUsIDApKSA8IDApIHtcbiAgICAgICAgICAgICAgY29udGludWUgb3V0ZXI7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChzZWVuKSB7XG4gICAgICAgICAgICBzZWVuLnB1c2godmFsdWUpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXN1bHQucHVzaCh2YWx1ZSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgfSk7XG5cbiAgICAvKipcbiAgICAgKiBHZXRzIHRoZSBsYXN0IGVsZW1lbnQgb2YgYGFycmF5YC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBjYXRlZ29yeSBBcnJheVxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBxdWVyeS5cbiAgICAgKiBAcmV0dXJucyB7Kn0gUmV0dXJucyB0aGUgbGFzdCBlbGVtZW50IG9mIGBhcnJheWAuXG4gICAgICogQGV4YW1wbGVcbiA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Xl9IHByb3BzIFRoZSBwcm9wZXJ0eSBuYW1lcy5cbiAgICAgKiBAcGFyYW0ge0FycmF5fSBbdmFsdWVzPVtdXSBUaGUgcHJvcGVydHkgdmFsdWVzLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgdGhlIG5ldyBvYmplY3QuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8uemlwT2JqZWN0KFtbJ2ZyZWQnLCAzMF0sIFsnYmFybmV5JywgNDBdXSk7XG4gICAgICogLy8gPT4geyAnZnJlZCc6IDMwLCAnYmFybmV5JzogNDAgfVxuICAgICAqXG4gICAgICogXy56aXBPYmplY3QoWydmcmVkJywgJ2Jhcm5leSddLCBbMzAsIDQwXSk7XG4gICAgICogLy8gPT4geyAnZnJlZCc6IDMwLCAnYmFybmV5JzogNDAgfVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHppcE9iamVjdChwcm9wcywgdmFsdWVzKSB7XG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICBsZW5ndGggPSBwcm9wcyA/IHByb3BzLmxlbmd0aCA6IDAsXG4gICAgICAgICAgcmVzdWx0ID0ge307XG5cbiAgICAgIGlmIChsZW5ndGggJiYgIXZhbHVlcyAmJiAhaXNBcnJheShwcm9wc1swXSkpIHtcbiAgICAgICAgdmFsdWVzID0gW107XG4gICAgICB9XG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICB2YXIga2V5ID0gcHJvcHNbaW5kZXhdO1xuICAgICAgICBpZiAodmFsdWVzKSB7XG4gICAgICAgICAgcmVzdWx0W2tleV0gPSB2YWx1ZXNbaW5kZXhdO1xuICAgICAgICB9IGVsc2UgaWYgKGtleSkge1xuICAgICAgICAgIHJlc3VsdFtrZXlbMF1dID0ga2V5WzFdO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqI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29tcGxldGUoaXNDYWxsZWQsIGlkKSB7XG4gICAgICAgIGlmIChpZCkge1xuICAgICAgICAgIGNsZWFyVGltZW91dChpZCk7XG4gICAgICAgIH1cbiAgICAgICAgbWF4VGltZW91dElkID0gdGltZW91dElkID0gdHJhaWxpbmdDYWxsID0gdW5kZWZpbmVkO1xuICAgICAgICBpZiAoaXNDYWxsZWQpIHtcbiAgICAgICAgICBsYXN0Q2FsbGVkID0gbm93KCk7XG4gICAgICAgICAgcmVzdWx0ID0gZnVuYy5hcHBseSh0aGlzQXJnLCBhcmdzKTtcbiAgICAgICAgICBpZiAoIXRpbWVvdXRJZCAmJiAhbWF4VGltZW91dElkKSB7XG4gICAgICAgICAgICBhcmdzID0gdGhpc0FyZyA9IHVuZGVmaW5lZDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgZnVuY3Rpb24gZGVsYXllZCgpIHtcbiAgICAgICAgdmFyIHJlbWFpbmluZyA9IHdhaXQgLSAobm93KCkgLSBzdGFtcCk7XG4gICAgICAgIGlmIChyZW1haW5pbmcgPD0gMCB8fCByZW1haW5pbmcgPiB3YWl0KSB7XG4gICAgICAgICAgY29tcGxldGUodHJhaWxpbmdDYWxsLCBtYXhUaW1lb3V0SWQpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHRpbWVvdXRJZCA9IHNldFRpbWVvdXQoZGVsYXllZCwgcmVtYWluaW5nKTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBtYXhEZWxheWVkKCkge1xuICAgICAgICBjb21wbGV0ZSh0cmFpbGluZywgdGltZW91dElkKTtcbiAgICAgIH1cblxuICAgICAgZnVuY3Rpb24gZGVib3VuY2VkKCkge1xuICAgICAgICBhcmdzID0gYXJndW1lbnRzO1xuICAgICAgICBzdGFtcCA9IG5vdygpO1xuICAgICAgICB0aGlzQXJnID0gdGhpcztcbiAgICAgICAgdHJhaWxpbmdDYWxsID0gdHJhaWxpbmcgJiYgKHRpbWVvdXRJZCB8fCAhbGVhZGluZyk7XG5cbiAgICAgICAgaWYgKG1heFdhaXQgPT09IGZhbHNlKSB7XG4gICAgICAgICAgdmFyIGxlYWRpbmdDYWxsID0gbGVhZGluZyAmJiAhdGltZW91dElkO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGlmICghbWF4VGltZW91dElkICYmICFsZWFkaW5nKSB7XG4gICAgICAgICAgICBsYXN0Q2FsbGVkID0gc3RhbXA7XG4gICAgICAgICAgfVxuICAgICAgICAgIHZhciByZW1haW5pbmcgPSBtYXhXYWl0IC0gKHN0YW1wIC0gbGFzdENhbGxlZCksXG4gICAgICAgICAgICAgIGlzQ2FsbGVkID0gcmVtYWluaW5nIDw9IDAgfHwgcmVtYWluaW5nID4gbWF4V2FpdDtcblxuICAgICAgICAgIGlmIChpc0NhbGxlZCkge1xuICAgICAgICAgICAgaWYgKG1heFRpbWVvdXRJZCkge1xuICAgICAgICAgICAgICBtYXhUaW1lb3V0SWQgPSBjbGVhclRpbWVvdXQobWF4VGltZW91dElkKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxhc3RDYWxsZWQgPSBzdGFtcDtcbiAgICAgICAgICAgIHJlc3VsdCA9IGZ1bmMuYXBwbHkodGhpc0FyZywgYXJncyk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgaWYgKCFtYXhUaW1lb3V0SWQpIHtcbiAgICAgICAgICAgIG1heFRpbWVvdXRJZCA9IHNldFRpbWVvdXQobWF4RGVsYXllZCwgcmVtYWluaW5nKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKGlzQ2FsbGVkICYmIHRpbWVvdXRJZCkge1xuICAgICAgICAgIHRpbWVvdXRJZCA9IGNsZWFyVGltZW91dCh0aW1lb3V0SWQpO1xuICAgICAgICB9XG4gICAgICAgIGVsc2UgaWYgKCF0aW1lb3V0SWQgJiYgd2FpdCAhPT0gbWF4V2FpdCkge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bGVhbn0gUmV0dXJucyBgdHJ1ZWAgaWYgYHBhdGhgIGlzIGEgZGlyZWN0IHByb3BlcnR5LCBlbHNlIGBmYWxzZWAuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIHZhciBvYmplY3QgPSB7ICdhJzogeyAnYic6IHsgJ2MnOiAzIH0gfSB9O1xuICAgICAqXG4gICAgICogXy5oYXMob2JqZWN0LCAnYScpO1xuICAgICAqIC8vID0+IHRydWVcbiAgICAgKlxuICAgICAqIF8uaGFzKG9iamVjdCwgJ2EuYi5jJyk7XG4gICAgICogLy8gPT4gdHJ1ZVxuICAgICAqXG4gICAgICogXy5oYXMob2JqZWN0LCBbJ2EnLCAnYicsICdjJ10pO1xuICAgICAqIC8vID0+IHRydWVcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBoYXMob2JqZWN0LCBwYXRoKSB7XG4gICAgICBpZiAob2JqZWN0ID09IG51bGwpIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuICAgICAgdmFyIHJlc3VsdCA9IGhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBwYXRoKTtcbiAgICAgIGlmICghcmVzdWx0ICYmICFpc0tleShwYXRoKSkge1xuICAgICAgICBwYXRoID0gdG9QYXRoKHBhdGgpO1xuICAgICAgICBvYmplY3QgPSBwYXRoLmxlbmd0aCA9PSAxID8gb2JqZWN0IDogYmFzZUdldChvYmplY3QsIGJhc2VTbGljZShwYXRoLCAwLCAtMSkpO1xuICAgICAgICBpZiAob2JqZWN0ID09IG51bGwpIHtcbiAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgIH1cbiAgICAgICAgcGF0aCA9IGxhc3QocGF0aCk7XG4gICAgICAgIHJlc3VsdCA9IGhhc093blByb3BlcnR5LmNhbGwob2JqZWN0LCBwYXRoKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiByZXN1bHQgfHwgKGlzTGVuZ3RoKG9iamVjdC5sZW5ndGgpICYm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IH1cbiAgICAgKlxuICAgICAqIC8vIHdpdGggYG11bHRpVmFsdWVgXG4gICAgICogXy5pbnZlcnQob2JqZWN0LCB0cnVlKTtcbiAgICAgKiAvLyA9PiB7ICcxJzogWydhJywgJ2MnXSwgJzInOiBbJ2InXSB9XG4gICAgICovXG4gICAgZnVuY3Rpb24gaW52ZXJ0KG9iamVjdCwgbXVsdGlWYWx1ZSwgZ3VhcmQpIHtcbiAgICAgIGlmIChndWFyZCAmJiBpc0l0ZXJhdGVlQ2FsbChvYmplY3QsIG11bHRpVmFsdWUsIGd1YXJkKSkge1xuICAgICAgICBtdWx0aVZhbHVlID0gdW5kZWZpbmVkO1xuICAgICAgfVxuICAgICAgdmFyIGluZGV4ID0gLTEsXG4gICAgICAgICAgcHJvcHMgPSBrZXlzKG9iamVjdCksXG4gICAgICAgICAgbGVuZ3RoID0gcHJvcHMubGVuZ3RoLFxuICAgICAgICAgIHJlc3VsdCA9IHt9O1xuXG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICB2YXIga2V5ID0gcHJvcHNbaW5kZXhdLFxuICAgICAgICAgICAgdmFsdWUgPSBvYmplY3Rba2V5XTtcblxuICAgICAgICBpZiAobXVsdGlWYWx1ZSkge1xuICAgICAgICAgIGlmIChoYXNPd25Qcm9wZXJ0eS5jYWxsKHJlc3VsdCwgdmFsdWUpKSB7XG4gICAgICAgICAgICByZXN1bHRbdmFsdWVdLnB1c2goa2V5KTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgcmVzdWx0W3ZhbHVlXSA9IFtrZXldO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBlbHNlIHtcbiAgICAgICAgICByZXN1bHRbdmFsdWVdID0ga2V5O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gcmVzdWx0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIENyZWF0ZXMgYW4gYXJyYXkgb2YgdGhlIG93biB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hcmFudGVlZClcbiAgICAgKi9cbiAgICBmdW5jdGlvbiBrZXlzSW4ob2JqZWN0KSB7XG4gICAgICBpZiAob2JqZWN0ID09IG51bGwpIHtcbiAgICAgICAgcmV0dXJuIFtdO1xuICAgICAgfVxuICAgICAgaWYgKCFpc09iamVjdChvYmplY3QpKSB7XG4gICAgICAgIG9iamVjdCA9IE9iamVjdChvYmplY3QpO1xuICAgICAgfVxuICAgICAgdmFyIGxlbmd0aCA9IG9iamVjdC5sZW5ndGg7XG4gICAgICBsZW5ndGggPSAobGVuZ3RoICYmIGlzTGVuZ3RoKGxlbmd0aCkgJiZcbiAgICAgICAgKGlzQXJyYXkob2JqZWN0KSB8fCBpc0FyZ3VtZW50cyhvYmplY3QpKSAmJiBsZW5ndGgpIHx8IDA7XG5cbiAgICAgIHZhciBDdG9yID0gb2JqZWN0LmNvbnN0cnVjdG9yLFxuICAgICAgICAgIGluZGV4ID0gLTEsXG4gICAgICAgICAgaXNQcm90byA9IHR5cGVvZiBDdG9yID09ICdmdW5jdGlvbicgJiYgQ3Rvci5wcm90b3R5cGUgPT09IG9iamVjdCxcbiAgICAgICAgICByZXN1bHQgPSBBcnJheShsZW5ndGgpLFxuICAgICAgICAgIHNraXBJbmRleGVzID0gbGVuZ3RoID4gMDtcblxuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgcmVzdWx0W2luZGV4XSA9IChpbmRleCArICcnKTtcbiAgICAgIH1cbiAgICAgIGZvciAodmFyIGtleSBpbiBvYmplY3QpIHtcbiAgICAgICAgaWYgKCEoc2tpcEluZGV4ZXMgJiYgaXNJbmRleChrZXksIGxlbmd0aCkpICYmXG4gICAgICAgICAgICAhKGtleSA9PSAnY29uc3RydWN0b3InICYmIChpc1Byb3RvIHx8ICFoYXNPd25Qcm9wZXJ0eS5jYWxsKG9iamVjdCwga2V5KSkpKSB7XG4gICAgICAgICAgcmVzdWx0LnB1c2goa2V5KTtcbiAgICAgICAgfVxuICA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lmIChub01heCAmJiB0eXBlb2YgbWluID09ICdib29sZWFuJykge1xuICAgICAgICAgIGZsb2F0aW5nID0gbWluO1xuICAgICAgICAgIG1pbiA9IDE7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAodHlwZW9mIG1heCA9PSAnYm9vbGVhbicpIHtcbiAgICAgICAgICBmbG9hdGluZyA9IG1heDtcbiAgICAgICAgICBub01heCA9IHRydWU7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIGlmIChub01pbiAmJiBub01heCkge1xuICAgICAgICBtYXggPSAxO1xuICAgICAgICBub01heCA9IGZhbHNlO1xuICAgICAgfVxuICAgICAgbWluID0gK21pbiB8fCAwO1xuICAgICAgaWYgKG5vTWF4KSB7XG4gICAgICAgIG1heCA9IG1pbjtcbiAgICAgICAgbWluID0gMDtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIG1heCA9ICttYXggfHwgMDtcbiAgICAgIH1cbiAgICAgIGlmIChmbG9hdGluZyB8fCBtaW4gJSAxIHx8IG1heCAlIDEpIHtcbiAgICAgICAgdmFyIHJhbmQgPSBuYXRpdmVSYW5kb20oKTtcbiAgICAgICAgcmV0dXJuIG5hdGl2ZU1pbihtaW4gKyAocmFuZCAqIChtYXggLSBtaW4gKyBwYXJzZUZsb2F0KCcxZS0nICsgKChyYW5kICsgJycpLmxlbmd0aCAtIDEpKSkpLCBtYXgpO1xuICAgICAgfVxuICAgICAgcmV0dXJuIGJhc2VSYW5kb20obWluLCBtYXgpO1xuICAgIH1cblxuICAgIC8qLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKi9cblxuICAgIC8qKlxuICAgICAqIENvbnZlcnRzIGBzdHJpbmdgIHRvIFtjYW1lbCBjYXNlXShodHRwczovL2VuLndpa2lwZWRpYS5vcmcvd2lraS9DYW1lbENhc2UpLlxuICAgICAqXG4gICAgIC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ICAgICAgc291cmNlID0gJ2Z1bmN0aW9uKCcgKyAodmFyaWFibGUgfHwgJ29iaicpICsgJykge1xcbicgK1xuICAgICAgICAodmFyaWFibGVcbiAgICAgICAgICA/ICcnXG4gICAgICAgICAgOiAnb2JqIHx8IChvYmogPSB7fSk7XFxuJ1xuICAgICAgICApICtcbiAgICAgICAgXCJ2YXIgX190LCBfX3AgPSAnJ1wiICtcbiAgICAgICAgKGlzRXNjYXBpbmdcbiAgICAgICAgICAgPyAnLCBfX2UgPSBfLmVzY2FwZSdcbiAgICAgICAgICAgOiAnJ1xuICAgICAgICApICtcbiAgICAgICAgKGlzRXZhbHVhdGluZ1xuICAgICAgICAgID8gJywgX19qID0gQXJyYXkucHJvdG90eXBlLmpvaW47XFxuJyArXG4gICAgICAgICAgICBcImZ1bmN0aW9uIHByaW50KCkgeyBfX3AgKz0gX19qLmNhbGwoYXJndW1lbnRzLCAnJykgfVxcblwiXG4gICAgICAgICAgOiAnO1xcbidcbiAgICAgICAgKSArXG4gICAgICAgIHNvdXJjZSArXG4gICAgICAgICdyZXR1cm4gX19wXFxufSc7XG5cbiAgICAgIHZhciByZXN1bHQgPSBhdHRlbXB0KGZ1bmN0aW9uKCkge1xuICAgICAgICByZXR1cm4gRnVuY3Rpb24oaW1wb3J0c0tleXMsIHNvdXJjZVVSTCArICdyZXR1cm4gJyArIHNvdXJjZSkuYXBwbHkodW5kZWZpbmVkLCBpbXBvcnRzVmFsdWVzKTtcbiAgICAgIH0pO1xuXG4gICAgICAvLyBQcm92aWRlIHRoZSBjb21waWxlZCBmdW5jdGlvbidzIHNvdXJjZSBieSBpdHMgYHRvU3RyaW5nYCBtZXRob2Qgb3JcbiAgICAgIC8vIHRoZSBgc291cmNlYCBwcm9wZXJ0eSBhcyBhIGNvbnZlbmllbmNlIGZvciBpbmxpbmluZyBjb21waWxlZCB0ZW1wbGF0ZXMuXG4gICAgICByZXN1bHQuc291cmNlID0gc291cmNlO1xuICAgICAgaWYgKGlzRXJyb3I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AgICAqIEBleGFtcGxlXG4gICAgICpcbiAgICAgKiBmdW5jdGlvbiB2b3dlbHMoc3RyaW5nKSB7XG4gICAgICogICByZXR1cm4gXy5maWx0ZXIoc3RyaW5nLCBmdW5jdGlvbih2KSB7XG4gICAgICogICAgIHJldHVybiAvW2FlaW91XS9pLnRlc3Qodik7XG4gICAgICogICB9KTtcbiAgICAgKiB9XG4gICAgICpcbiAgICAgKiBfLm1peGluKHsgJ3Zvd2Vscyc6IHZvd2VscyB9KTtcbiAgICAgKiBfLnZvd2VscygnZnJlZCcpO1xuICAgICAqIC8vID0+IFsnZSddXG4gICAgICpcbiAgICAgKiBfKCdmcmVkJykudm93ZWxzKCkudmFsdWUoKTtcbiAgICAgKiAvLyA9PiBbJ2UnXVxuICAgICAqXG4gICAgICogXy5taXhpbih7ICd2b3dlbHMnOiB2b3dlbHMgfSwgeyAnY2hhaW4nOiBmYWxzZSB9KTtcbiAgICAgKiBfKCdmcmVkJykudm93ZWxzKCk7XG4gICAgICogLy8gPT4gWydlJ11cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBtaXhpbihvYmplY3QsIHNvdXJjZSwgb3B0aW9ucykge1xuICAgICAgaWYgKG9wdGlvbnMgPT0gbnVsbCkge1xuICAgICAgICB2YXIgaXNPYmogPSBpc09iamVjdChzb3VyY2UpLFxuICAgICAgICAgICAgcHJvcHMgPSBpc09iaiA/IGtleXMoc291cmNlKSA6IHVuZGVmaW5lZCxcbiAgICAgICAgICAgIG1ldGhvZE5hbWVzID0gKHByb3BzICYmIHByb3BzLmxlbmd0aCkgPyBiYXNlRnVuY3Rpb25zKHNvdXJjZSwgcHJvcHMpIDogdW5kZWZpbmVkO1xuXG4gICAgICAgIGlmICghKG1ldGhvZE5hbWVzID8gbWV0aG9kTmFtZXMubGVuZ3RoIDogaXNPYmopKSB7XG4gICAgICAgICAgbWV0aG9kTmFtZXMgPSBmYWxzZTtcbiAgICAgICAgICBvcHRpb25zID0gc291cmNlO1xuICAgICAgICAgIHNvdXJjZSA9IG9iamVjdDtcbiAgICAgICAgICBvYmplY3QgPSB0aGlzO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICBpZiAoIW1ldGhvZE5hbWVzKSB7XG4gICAgICAgIG1ldGhvZE5hbWVzID0gYmFzZUZ1bmN0aW9ucyhzb3VyY2UsIGtleXMoc291cmNlKSk7XG4gICAgICB9XG4gICAgICB2YXIgY2hhaW4gPSB0cnVlLFxuICAgICAgICAgIGluZGV4ID0gLTEsXG4gICAgICAgICAgaXNGdW5jID0gaXNGdW5jdGlvbihvYmplY3QpLFxuICAgICAgICAgIGxlbmd0aCA9IG1ldGhvZE5hbWVzLmxlbmd0aDtcblxuICAgICAgaWYgKG9wdGlvbnMgPT09IGZhbHNlKSB7XG4gICAgICAgIGNoYWluID0gZmFsc2U7XG4gICAgICB9IGVsc2UgaWYgKGlzT2JqZWN0KG9wdGlvbnMpICYmICdjaGFpbicgaW4gb3B0aW9ucykge1xuICAgICAgICBjaGFpbiA9IG9wdGlvbnMuY2hhaW47XG4gICAgICB9XG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICB2YXIgbWV0aG9kTmFtZSA9IG1ldGhvZE5hbWVzW2luZGV4XSxcbiAgICAgICAgICAgIGZ1bmMgPSBzb3VyY2VbbWV0aG9kTmFtZV07XG5cbiAgICAgICAgb2JqZWN0W21ldGhvZE5hbWVdID0gZnVuYztcbiAgICAgICAgaWYgKGlzRnVuYykge1xuICAgICAgICAgIG9iamVjdC5wcm90b3R5cGVbbWV0aG9kTmFtZV0gPSAoZnVuY3Rpb24oZnVuYykge1xuICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICB2YXIgY2hhaW5BbGwgPSB0aGlzLl9fY2hhaW5fXztcbiAgICAgICAgICAgICAgaWYgKGNoYWluIHx8IGNoYWluQWxsKSB7XG4gICAgICAgICAgICAgICAgdmFyIHJlc3VsdCA9IG9iamVjdCh0aG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XknLCAnYWdlJzogMzYgfSxcbiAgICAgKiAgIHsgJ3VzZXInOiAnZnJlZCcsICAgJ2FnZSc6IDQwIH1cbiAgICAgKiBdO1xuICAgICAqXG4gICAgICogXy5taW4odXNlcnMsIGZ1bmN0aW9uKGNocikge1xuICAgICAqICAgcmV0dXJuIGNoci5hZ2U7XG4gICAgICogfSk7XG4gICAgICogLy8gPT4geyAndXNlcic6ICdiYXJuZXknLCAnYWdlJzogMzYgfVxuICAgICAqXG4gICAgICogLy8gdXNpbmcgdGhlIGBfLnByb3BlcnR5YCBjYWxsYmFjayBzaG9ydGhhbmRcbiAgICAgKiBfLm1pbih1c2VycywgJ2FnZScpO1xuICAgICAqIC8vID0+IHsgJ3VzZXInOiAnYmFybmV5JywgJ2FnZSc6IDM2IH1cbiAgICAgKi9cbiAgICB2YXIgbWluID0gY3JlYXRlRXh0cmVtdW0obHQsIFBPU0lUSVZFX0lORklOSVRZKTtcblxuICAgIC8qKlxuICAgICAqIENhbGN1bGF0ZXMgYG5gIHJvdW5kZWQgdG8gYHByZWNpc2lvbmAuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAY2F0ZWdvcnkgTWF0aFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBuIFRoZSBudW1iZXIgdG8gcm91bmQuXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IFtwcmVjaXNpb249MF0gVGhlIHByZWNpc2lvbiB0byByb3VuZCB0by5cbiAgICAgKiBAcmV0dXJucyB7bnVtYmVyfSBSZXR1cm5zIHRoZSByb3VuZGVkIG51bWJlci5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogXy5yb3VuZCg0LjAwNik7XG4gICAgICogLy8gPT4gNFxuICAgICAqXG4gICAgICogXy5yb3VuZCg0LjAwNiwgMik7XG4gICAgICogLy8gPT4gNC4wMVxuICAgICAqXG4gICAgICogXy5yb3VuZCg0MDYwLCAtMik7XG4gICA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W9uKHByZXYsIGN1cnIpIHtcbiAgICAgICAgY2cuc2V0RWRnZShwcmV2LnYsIGN1cnIudik7XG4gICAgICAgIHJldHVybiBjdXJyO1xuICAgICAgfSk7XG4gICAgICByZXR1cm4gbWluO1xuICAgIH1cbiAgICByZXR1cm4gZy5ub2RlKHYpLm9yZGVyO1xuICB9XG4gIGRmcyh1bmRlZmluZWQpO1xuICAqL1xufVxuIiwidmFyIF8gPSByZXF1aXJlKFwiLi4vbG9kYXNoXCIpO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGJhcnljZW50ZXI7XG5cbmZ1bmN0aW9uIGJhcnljZW50ZXIoZywgbW92YWJsZSkge1xuICByZXR1cm4gXy5tYXAobW92YWJsZSwgZnVuY3Rpb24odikge1xuICAgIHZhciBpblYgPSBnLmluRWRnZXModik7XG4gICAgaWYgKCFpblYubGVuZ3RoKSB7XG4gICAgICByZXR1cm4geyB2OiB2IH07XG4gICAgfSBlbHNlIHtcbiAgICAgIHZhciByZXN1bHQgPSBfLnJlZHVjZShpblYsIGZ1bmN0aW9uKGFjYywgZSkge1xuICAgICAgICB2YXIgZWRnZSA9IGcuZWRnZShlKSxcbiAgICAgICAgICAgIG5vZGVVID0gZy5ub2RlKGUudik7XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgc3VtOiBhY2Muc3VtICsgKGVkZ2Uud2VpZ2h0ICogbm9kZVUub3JkZXIpLFxuICAgICAgICAgIHdlaWdodDogYWNjLndlaWdodCArIGVkZ2Uud2VpZ2h0XG4gICAgICAgIH07XG4gICAgICB9LCB7IHN1bTogMCwgd2VpZ2h0OiAwIH0pO1xuXG4gICAgICByZXR1cm4ge1xuICAgICAgICB2OiB2LFxuICAgICAgICBiYXJ5Y2VudGVyOiByZXN1bHQuc3VtIC8gcmVzdWx0LndlaWdodCxcbiAgICAgICAgd2VpZ2h0OiByZXN1bHQud2VpZ2h0XG4gICAgICB9O1xuICAgIH1cbiAgfSk7XG59XG5cbiIsInZhciBfID0gcmV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lcihnKTtcblxuICBfLmVhY2goZy5ncmFwaCgpLmR1bW15Q2hhaW5zLCBmdW5jdGlvbih2KSB7XG4gICAgdmFyIG5vZGUgPSBnLm5vZGUodiksXG4gICAgICAgIGVkZ2VPYmogPSBub2RlLmVkZ2VPYmosXG4gICAgICAgIHBhdGhEYXRhID0gZmluZFBhdGgoZywgcG9zdG9yZGVyTnVtcywgZWRnZU9iai52LCBlZGdlT2JqLncpLFxuICAgICAgICBwYXRoID0gcGF0aERhdGEucGF0aCxcbiAgICAgICAgbGNhID0gcGF0aERhdGEubGNhLFxuICAgICAgICBwYXRoSWR4ID0gMCxcbiAgICAgICAgcGF0aFYgPSBwYXRoW3BhdGhJZHhdLFxuICAgICAgICBhc2NlbmRpbmcgPSB0cnVlO1xuXG4gICAgd2hpbGUgKHYgIT09IGVkZ2VPYmoudykge1xuICAgICAgbm9kZSA9IGcubm9kZSh2KTtcblxuICAgICAgaWYgKGFzY2VuZGluZykge1xuICAgICAgICB3aGlsZSAoKHBhdGhWID0gcGF0aFtwYXRoSWR4XSkgIT09IGxjYSAmJlxuICAgICAgICAgICAgICAgZy5ub2RlKHBhdGhWKS5tYXhSYW5rIDwgbm9kZS5yYW5rKSB7XG4gICAgICAgICAgcGF0aElkeCsrO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHBhdGhWID09PSBsY2EpIHtcbiAgICAgICAgICBhc2NlbmRpbmcgPSBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAoIWFzY2VuZGluZykge1xuICAgICAgICB3aGlsZSAocGF0aElkeCA8IHBhdGgubGVuZ3RoIC0gMSAmJlxuICAgICAgICAgICAgICAgZy5ub2RlKHBhdGhWID0gcGF0aFtwYXRoSWR4ICsgMV0pLm1pblJhbmsgPD0gbm9kZS5yYW5rKSB7XG4gICAgICAgICAgcGF0aElkeCsrO1xuICAgICAgICB9XG4gICAgICAgIHBhdGhWID0gcGF0aFtwYXRoSWR4XTtcbiAgICAgIH1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XG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBkZXN0aW5hdGlvbiBvYmplY3QuXG4gICAgICogQHBhcmFtIHtPYmplY3R9IHNvdXJjZSBUaGUgc291cmNlIG9iamVjdC5cbiAgICAgKiBAcGFyYW0ge0Z1bmN0aW9ufSBjdXN0b21pemVyIFRoZSBmdW5jdGlvbiB0byBjdXN0b21pemUgYXNzaWduZWQgdmFsdWVzLlxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJldHVybnMgYG9iamVjdGAuXG4gICAgICovXG4gICAgZnVuY3Rpb24gYXNzaWduV2l0aChvYmplY3QsIHNvdXJjZSwgY3VzdG9taXplcikge1xuICAgICAgdmFyIGluZGV4ID0gLTEsXG4gICAgICAgICAgcHJvcHMgPSBrZXlzKHNvdXJjZSksXG4gICAgICAgICAgbGVuZ3RoID0gcHJvcHMubGVuZ3RoO1xuXG4gICAgICB3aGlsZSAoKytpbmRleCA8IGxlbmd0aCkge1xuICAgICAgICB2YXIga2V5ID0gcHJvcHNbaW5kZXhdLFxuICAgICAgICAgICAgdmFsdWUgPSBvYmplY3Rba2V5XSxcbiAgICAgICAgICAgIHJlc3VsdCA9IGN1c3RvbWl6ZXIodmFsdWUsIHNvdXJjZVtrZXldLCBrZXksIG9iamVjdCwgc291cmNlKTtcblxuICAgICAgICBpZiAoKHJlc3VsdCA9PT0gcmVzdWx0ID8gKHJlc3VsdCAhPT0gdmFsdWUpIDogKHZhbHVlID09PSB2YWx1ZSkpIHx8XG4gICAgICAgICAgICAodmFsdWUgPT09IHVuZGVmaW5lZCAmJiAhKGtleSBpbiBvYmplY3QpKSkge1xuICAgICAgICAgIG9iamVjdFtrZXldID0gcmVzdWx0O1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gb2JqZWN0O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLmF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YXRhWzBdIGluIG9iamVjdClcbiAgICAgICAgICAgICkge1xuICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgZGF0YSA9IG1hdGNoRGF0YVtpbmRleF07XG4gICAgICAgIHZhciBrZXkgPSBkYXRhWzBdLFxuICAgICAgICAgICAgb2JqVmFsdWUgPSBvYmplY3Rba2V5XSxcbiAgICAgICAgICAgIHNyY1ZhbHVlID0gZGF0YVsxXTtcblxuICAgICAgICBpZiAobm9DdXN0b21pemVyICYmIGRhdGFbMl0pIHtcbiAgICAgICAgICBpZiAob2JqVmFsdWUgPT09IHVuZGVmaW5lZCAmJiAhKGtleSBpbiBvYmplY3QpKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHZhciByZXN1bHQgPSBjdXN0b21pemVyID8gY3VzdG9taXplcihvYmpWYWx1ZSwgc3JjVmFsdWUsIGtleSkgOiB1bmRlZmluZWQ7XG4gICAgICAgICAgaWYgKCEocmVzdWx0ID09PSB1bmRlZmluZWQgPyBiYXNlSXNFcXVhbChzcmNWYWx1ZSwgb2JqVmFsdWUsIGN1c3RvbWl6ZXIsIHRydWUpIDogcmVzdWx0KSkge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIHRydWU7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogVGhlIGJhc2UgaW1wbGVtZW50YXRpb24gb2YgYF8ubWFwYCB3aXRob3V0IHN1cHBvcnQgZm9yIGNhbGxiYWNrIHNob3J0aGFuZHNcbiAgICAgKiBhbmQgYHRoaXNgIGJpbmRpbmcuXG4gICAgICpcbiAgICAgKiBAcHJpdmF0ZVxuICAgICAqIEBwYXJhbSB7QXJyY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IGlzQXJyYXkocGF0aCksXG4gICAgICAgICAgaXNDb21tb24gPSBpc0tleShwYXRoKSAmJiBpc1N0cmljdENvbXBhcmFibGUoc3JjVmFsdWUpLFxuICAgICAgICAgIHBhdGhLZXkgPSAocGF0aCArICcnKTtcblxuICAgICAgcGF0aCA9IHRvUGF0aChwYXRoKTtcbiAgICAgIHJldHVybiBmdW5jdGlvbihvYmplY3QpIHtcbiAgICAgICAgaWYgKG9iamVjdCA9PSBudWxsKSB7XG4gICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG4gICAgICAgIHZhciBrZXkgPSBwYXRoS2V5O1xuICAgICAgICBvYmplY3QgPSB0b09iamVjdChvYmplY3QpO1xuICAgICAgICBpZiAoKGlzQXJyIHx8ICFpc0NvbW1vbikgJiYgIShrZXkgaW4gb2JqZWN0KSkge1xuICAgICAgICAgIG9iamVjdCA9IHBhdGgubGVuZ3RoID09IDEgPyBvYmplY3QgOiBiYXNlR2V0KG9iamVjdCwgYmFzZVNsaWNlKHBhdGgsIDAsIC0xKSk7XG4gICAgICAgICAgaWYgKG9iamVjdCA9PSBudWxsKSB7XG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgfVxuICAgICAgICAgIGtleSA9IGxhc3QocGF0aCk7XG4gICAgICAgICAgb2JqZWN0ID0gdG9PYmplY3Qob2JqZWN0KTtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gb2JqZWN0W2tleV0gPT09IHNyY1ZhbHVlXG4gICAgICAgICAgPyAoc3JjVmFsdWUgIT09IHVuZGVmaW5lZCB8fCAoa2V5IGluIG9iamVjdCkpXG4gICAgICAgICAgOiBiYXNlSXNFcXVhbChzcmNWYWx1ZSwgb2JqZWN0W2tleV0sIHVuZGVmaW5lZCwgdHJ1ZSk7XG4gICAgICB9O1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFRoZSBiYXNlIGltcGxlbWVudGF0aW9uIG9mIGBfLm1lcmdlYCB3aXRob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md0aCAtIDJdIDogdW5kZWZpbmVkLFxuICAgICAgICAgICAgZ3VhcmQgPSBsZW5ndGggPiAyID8gc291cmNlc1syXSA6IHVuZGVmaW5lZCxcbiAgICAgICAgICAgIHRoaXNBcmcgPSBsZW5ndGggPiAxID8gc291cmNlc1tsZW5ndGggLSAxXSA6IHVuZGVmaW5lZDtcblxuICAgICAgICBpZiAodHlwZW9mIGN1c3RvbWl6ZXIgPT0gJ2Z1bmN0aW9uJykge1xuICAgICAgICAgIGN1c3RvbWl6ZXIgPSBiaW5kQ2FsbGJhY2soY3VzdG9taXplciwgdGhpc0FyZywgNSk7XG4gICAgICAgICAgbGVuZ3RoIC09IDI7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY3VzdG9taXplciA9IHR5cGVvZiB0aGlzQXJnID09ICdmdW5jdGlvbicgPyB0aGlzQXJnIDogdW5kZWZpbmVkO1xuICAgICAgICAgIGxlbmd0aCAtPSAoY3VzdG9taXplciA/IDEgOiAwKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoZ3VhcmQgJiYgaXNJdGVyYXRlZUNhbGwoc291cmNlc1swXSwgc291cmNlc1sxXSwgZ3VhcmQpKSB7XG4gICAgICAgICAgY3VzdG9taXplciA9IGxlbmd0aCA8IDMgPyB1bmRlZmluZWQgOiBjdXN0b21pemVyO1xuICAgICAgICAgIGxlbmd0aCA9IDE7XG4gICAgICAgIH1cbiAgICAgICAgd2hpbGUgKCsraW5kZXggPCBsZW5ndGgpIHtcbiAgICAgICAgICB2YXIgc291cmNlID0gc291cmNlc1tpbmRleF07XG4gICAgICAgICAgaWYgKHNvdXJjZSkge1xuICAgICAgICAgICAgYXNzaWduZXIob2JqZWN0LCBzb3VyY2UsIGN1c3RvbWl6ZXIpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gb2JqZWN0O1xuICAgICAgfSk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ3JlYXRlcyBhIGBiY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09ICtvdGhlcjtcblxuICAgICAgICBjYXNlIGVycm9yVGFnOlxuICAgICAgICAgIHJldHVybiBvYmplY3QubmFtZSA9PSBvdGhlci5uYW1lICYmIG9iamVjdC5tZXNzYWdlID09IG90aGVyLm1lc3NhZ2U7XG5cbiAgICAgICAgY2FzZSBudW1iZXJUYWc6XG4gICAgICAgICAgLy8gVHJlYXQgYE5hTmAgdnMuIGBOYU5gIGFzIGVxdWFsLlxuICAgICAgICAgIHJldHVybiAob2JqZWN0ICE9ICtvYmplY3QpXG4gICAgICAgICAgICA/IG90aGVyICE9ICtvdGhlclxuICAgICAgICAgICAgOiBvYmplY3QgPT0gK290aGVyO1xuXG4gICAgICAgIGNhc2UgcmVnZXhwVGFnOlxuICAgICAgICBjYXNlIHN0cmluZ1RhZzpcbiAgICAgICAgICAvLyBDb2VyY2UgcmVnZXhlcyB0byBzdHJpbmdzIGFuZCB0cmVhdCBzdHJpbmdzIHByaW1pdGl2ZXMgYW5kIHN0cmluZ1xuICAgICAgICAgIC8vIG9iamVjdHMgYXMgZXF1YWwuIFNlZSBodHRwczovL2VzNS5naXRodWIuaW8vI3gxNS4xMC42LjQgZm9yIG1vcmUgZGV0YWlscy5cbiAgICAgICAgICByZXR1cm4gb2JqZWN0ID09IChvdGhlciArICcnKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBBIHNwZWNpYWxpemVkIHZlcnNpb24gb2YgYGJhc2VJc0VxdWFsRGVlcGAgZm9yIG9iamVjdHMgd2l0aCBzdXBwb3J0IGZvclxuICAgICAqIHBhcnRpYWwgZGVlcCBjb21wYXJpc29ucy5cbiAgICAgKlxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtPYmplY3R9IG9iamVjdCBUaGUgb2JqZWN0IHRvIGNvbXBhcmUuXG4gICAgICogQHBhcmFtIHtPYmplY3R9IG90aGVyIFRoZSBvdGhlciBvYmplY3QgdG8gY29tc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mV0dXJuIGtleTtcbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgY291bnQgPSAwO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBiYXNlU2V0RGF0YShrZXksIHZhbHVlKTtcbiAgICAgIH07XG4gICAgfSgpKTtcblxuICAgIC8qKlxuICAgICAqIEEgZmFsbGJhY2sgaW1wbGVtZW50YXRpb24gb2YgYE9iamVjdC5rZXlzYCB3aGljaCBjcmVhdGVzIGFuIGFycmF5IG9mIHRoZVxuICAgICAqIG93biBlbnVtZXJhYmxlIHByb3BlcnR5IG5hbWVzIG9mIGBvYmplY3RgLlxuICAgICAqXG4gICAgICogQHByaXZhdGVcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IFRoZSBvYmplY3QgdG8gcXVlcnkuXG4gICAgICogQHJldHVybnMge0FycmF5fSBSZXR1cm5zIHRoZSBhcnJheSBvZiBwcm9wZXJ0eSBuYW1lcy5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiBzaGltS2V5cyhvYmplY3QpIHtcbiAgICAgIHZhciBwcm9wcyA9IGtleXNJbihvYmplY3QpLFxuICAgICAgICAgIHByb3BzTGVuZ3RoID0gcHJvcHMubGVuZ3RoLFxuICAgICAgICAgIGxlbmd0aCA9IHByb3BzTGVuZ3RoICYmIG9iamVjdC5sZW5ndGg7XG5cbiAgICAgIHZhciBhbGxvd0luZGV4ZXMgPSAhIWxlbmd0aCAmJiBpc0xlbmd0aChsZW5ndGgpICYmXG4gICAgICAgIChpc0FycmF5KG9iamVjdCkgfHwgaXNBcmd1bWVudHMob2JqZWN0KSk7XG5cbiAgICAgIHZhciBpbmRleCA9IC0xLFxuICAgICAgICAgIHJlc3VsdCA9IFtdO1xuXG4gICAgICB3aGlsZSAoKytpbmRleCA8IHByb3BzTGVuZ3RoKSB7XG4gICAgICAgIHZhciBrZXkgPSBwcm9wc1tpbmRleF07XG4gICAgICAgIGlmICgoYWxsb3dJbmRleGVz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AgICAgICByZXR1cm4gLTE7XG4gICAgICB9XG4gICAgICBpZiAodHlwZW9mIGZyb21JbmRleCA9PSAnbnVtYmVyJykge1xuICAgICAgICBmcm9tSW5kZXggPSBmcm9tSW5kZXggPCAwID8gbmF0aXZlTWF4KGxlbmd0aCArIGZyb21JbmRleCwgMCkgOiBmcm9tSW5kZXg7XG4gICAgICB9IGVsc2UgaWYgKGZyb21JbmRleCkge1xuICAgICAgICB2YXIgaW5kZXggPSBiaW5hcnlJbmRleChhcnJheSwgdmFsdWUpO1xuICAgICAgICBpZiAoaW5kZXggPCBsZW5ndGggJiZcbiAgICAgICAgICAgICh2YWx1ZSA9PT0gdmFsdWUgPyAodmFsdWUgPT09IGFycmF5W2luZGV4XSkgOiAoYXJyYXlbaW5kZXhdICE9PSBhcnJheVtpbmRleF0pKSkge1xuICAgICAgICAgIHJldHVybiBpbmRleDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gLTE7XG4gICAgICB9XG4gICAgICByZXR1cm4gYmFzZUluZGV4T2YoYXJyYXksIHZhbHVlLCBmcm9tSW5kZXggfHwgMCk7XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogR2V0cyBhbGwgYnV0IHRoZSBsYXN0IGVsZW1lbnQgb2YgYGFycmF5YC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBjYXRlZ29yeSBBcnJheVxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBxdWVyeS5cbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgdGhlIHNsaWNlIG9mIGBhcnJheWAuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8uaW5pdGlhbChbMSwgMiwgM10pO1xuICAgICAqIC8vID0+IFsxLCAyXVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIGluaXRpYWwoYXJyYXkpIHtcbiAgICAgIHJldHVybiB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W5ndGggLSAxKSkgKyAxO1xuICAgICAgfSBlbHNlIGlmIChmcm9tSW5kZXgpIHtcbiAgICAgICAgaW5kZXggPSBiaW5hcnlJbmRleChhcnJheSwgdmFsdWUsIHRydWUpIC0gMTtcbiAgICAgICAgdmFyIG90aGVyID0gYXJyYXlbaW5kZXhdO1xuICAgICAgICBpZiAodmFsdWUgPT09IHZhbHVlID8gKHZhbHVlID09PSBvdGhlcikgOiAob3RoZXIgIT09IG90aGVyKSkge1xuICAgICAgICAgIHJldHVybiBpbmRleDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gLTE7XG4gICAgICB9XG4gICAgICBpZiAodmFsdWUgIT09IHZhbHVlKSB7XG4gICAgICAgIHJldHVybiBpbmRleE9mTmFOKGFycmF5LCBpbmRleCwgdHJ1ZSk7XG4gICAgICB9XG4gICAgICB3aGlsZSAoaW5kZXgtLSkge1xuICAgICAgICBpZiAoYXJyYXlbaW5kZXhdID09PSB2YWx1ZSkge1xuICAgICAgICAgIHJldHVybiBpbmRleDtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIC0xO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJlbW92ZXMgYWxsIHByb3ZpZGVkIHZhbHVlcyBmcm9tIGBhcnJheWAgdXNpbmdcbiAgICAgKiBbYFNhbWVWYWx1ZVplcm9gXShodHRwOi8vZWNtYS1pbnRlcm5hdGlvbmFsLm9yZy9lY21hLTI2Mi82LjAvI3NlYy1zYW1ldmFsdWV6ZXJvKVxuICAgICAqIGZvciBlcXVhbGl0eSBjb21wYXJpc29ucy5cbiAgICAgKlxuICAgICAqICoqTm90ZToqKiBVbmxpa2UgYF8ud2l0aG91dGAsIHRoaXMgbWV0aG9kIG11dGF0ZXMgYGFycmF5YC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBjYXRlZ29yeSBBcnJheVxuICAgICAqIEBwYXJhbSB7QXJyYXl9IGFycmF5IFRoZSBhcnJheSB0byBtb2RpZnkuXG4gICAgICogQHBhcmFtIHsuLi4qfSBbdmFsdWVzXSBUaGUgdmFsdWVzIHRvIHJlbW92ZS5cbiAgICAgKiBAcmV0dXJucyB7QXJyYXl9IFJldHVybnMgYGFycmF5YC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIGFycmF5ID0gWzEsIDIsIDMsIDEsIDIsIDNdO1xuICAgICAqXG4gICAgICogXy5wdWxsKGFycmF5LCAyLCAzKTtcbiAgICAgKiBjb25zb2xlLmxvZyhhcnJheSk7XG4gICAgICogLy8gPT4gWzEsIDFdXG4gICAgICovXG4gICAgZnVuY3Rpb24gcHVsbCgpIHtcbiAgICAgIHZhciBhcmdzID0gYXJndW1lbnRzLFxuICAgICAgICAgIGFycmF5ID0gYXJnc1swXTtcblxuICAgICAgaWYgKCEoYXJyYXkgJiYgYXJyYXkubGVuZ3RoKSkge1xuICAgICAgICByZXR1cm4gYXJyYXk7XG4gICAgICB9XG4gICAgICB2YXIgaW5kZXggPSAwLFxuICAgICAgICAgIGluZGV4T2YgPSBnZXRJbmRleE9mKCksXG4gICAgICAgICAgbGVuZ3RoID0gYXJncy5sZW5ndGg7XG5cbiAgICAgIHdoaWxlICgrK2luZGV4IDwgbGVuZ3RoKSB7XG4gICAgICAgIHZhciBmcm9tSW5kZXggPSAwLFxuICAgICAgICAgICAgdmFsdWUgPSBhcmdzW2luZGV4XTtcblxuICAgICAgICB3aGlsZSAoKGZyb21JbmRleCA9IGluZGV4T2YoYXJyYXksIHZhbHVlLCBmcm9tSW5kZXgpKSA+IC0xKSB7XG4gICAgICAgICAgc3BsaWNlLmNhbGwoYXJyYXksIGZyb21JbmRleCwgMSk7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBhcnJheTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZW1vdmVzIGVsZW1lbnRzIGZyb20gYGFycmF5YCBjb3Jy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dCk7XG4gICAgICAgIHRyYWlsaW5nID0gJ3RyYWlsaW5nJyBpbiBvcHRpb25zID8gISFvcHRpb25zLnRyYWlsaW5nIDogdHJhaWxpbmc7XG4gICAgICB9XG5cbiAgICAgIGZ1bmN0aW9uIGNhbmNlbCgpIHtcbiAgICAgICAgaWYgKHRpbWVvdXRJZCkge1xuICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lb3V0SWQpO1xuICAgICAgICB9XG4gICAgICAgIGlmIChtYXhUaW1lb3V0SWQpIHtcbiAgICAgICAgICBjbGVhclRpbWVvdXQobWF4VGltZW91dElkKTtcbiAgICAgICAgfVxuICAgICAgICBsYXN0Q2FsbGVkID0gMDtcbiAgICAgICAgbWF4VGltZW91dElkID0gdGltZW91dElkID0gdHJhaWxpbmdDYWxsID0gdW5kZWZpbmVkO1xuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBjb21wbGV0ZShpc0NhbGxlZCwgaWQpIHtcbiAgICAgICAgaWYgKGlkKSB7XG4gICAgICAgICAgY2xlYXJUaW1lb3V0KGlkKTtcbiAgICAgICAgfVxuICAgICAgICBtYXhUaW1lb3V0SWQgPSB0aW1lb3V0SWQgPSB0cmFpbGluZ0NhbGwgPSB1bmRlZmluZWQ7XG4gICAgICAgIGlmIChpc0NhbGxlZCkge1xuICAgICAgICAgIGxhc3RDYWxsZWQgPSBub3coKTtcbiAgICAgICAgICByZXN1bHQgPSBmdW5jLmFwcGx5KHRoaXNBcmcsIGFyZ3MpO1xuICAgICAgICAgIGlmICghdGltZW91dElkICYmICFtYXhUaW1lb3V0SWQpIHtcbiAgICAgICAgICAgIGFyZ3MgPSB0aGlzQXJnID0gdW5kZWZpbmVkO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBmdW5jdGlvbiBkZWxheWVkKCkge1xuICAgICAgICB2YXIgcmVtYWluaW5nID0gd2FpdCAtIChub3coKSAtIHN0YW1wKTtcbiAgICAgICAgaWYgKHJlbWFp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ZWFyVGltZW91dChtYXhUaW1lb3V0SWQpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGFzdENhbGxlZCA9IHN0YW1wO1xuICAgICAgICAgICAgcmVzdWx0ID0gZnVuYy5hcHBseSh0aGlzQXJnLCBhcmdzKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZWxzZSBpZiAoIW1heFRpbWVvdXRJZCkge1xuICAgICAgICAgICAgbWF4VGltZW91dElkID0gc2V0VGltZW91dChtYXhEZWxheWVkLCByZW1haW5pbmcpO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoaXNDYWxsZWQgJiYgdGltZW91dElkKSB7XG4gICAgICAgICAgdGltZW91dElkID0gY2xlYXJUaW1lb3V0KHRpbWVvdXRJZCk7XG4gICAgICAgIH1cbiAgICAgICAgZWxzZSBpZiAoIXRpbWVvdXRJZCAmJiB3YWl0ICE9PSBtYXhXYWl0KSB7XG4gICAgICAgICAgdGltZW91dElkID0gc2V0VGltZW91dChkZWxheWVkLCB3YWl0KTtcbiAgICAgICAgfVxuICAgICAgICBpZiAobGVhZGluZ0NhbGwpIHtcbiAgICAgICAgICBpc0NhbGxlZCA9IHRydWU7XG4gICAgICAgICAgcmVzdWx0ID0gZnVuYy5hcHBseSh0aGlzQXJnLCBhcmdzKTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoaXNDYWxsZWQgJiYgIXRpbWVvdXRJZCAmJiAhbWF4VGltZW91dElkKSB7XG4gICAgICAgICAgYXJncyA9IHRoaXNBcmcgPSB1bmRlZmluZWQ7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHJlc3VsdDtcbiAgICAgIH1cbiAgICAgIGRlYm91bmNlZC5jYW5jZWwgPSBjYW5jZWw7XG4gICAgICByZXR1cm4gZGVib3VuY2VkO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIERlZmVycyBpbnZva2luZyB0aGUgYGZ1bmNgIHVudGlsIHRoZSBjdXJyZW50IGNhbGw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b2JqZWN0IHRvIGF1Z21lbnQuXG4gICAgICogQHBhcmFtIHtBcnJheXxzdHJpbmd9IHBhdGggVGhlIHBhdGggb2YgdGhlIHByb3BlcnR5IHRvIHNldC5cbiAgICAgKiBAcGFyYW0geyp9IHZhbHVlIFRoZSB2YWx1ZSB0byBzZXQuXG4gICAgICogQHJldHVybnMge09iamVjdH0gUmV0dXJucyBgb2JqZWN0YC5cbiAgICAgKiBAZXhhbXBsZVxuICAgICAqXG4gICAgICogdmFyIG9iamVjdCA9IHsgJ2EnOiBbeyAnYic6IHsgJ2MnOiAzIH0gfV0gfTtcbiAgICAgKlxuICAgICAqIF8uc2V0KG9iamVjdCwgJ2FbMF0uYi5jJywgNCk7XG4gICAgICogY29uc29sZS5sb2cob2JqZWN0LmFbMF0uYi5jKTtcbiAgICAgKiAvLyA9PiA0XG4gICAgICpcbiAgICAgKiBfLnNldChvYmplY3QsICd4WzBdLnkueicsIDUpO1xuICAgICAqIGNvbnNvbGUubG9nKG9iamVjdC54WzBdLnkueik7XG4gICAgICogLy8gPT4gNVxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHNldChvYmplY3QsIHBhdGgsIHZhbHVlKSB7XG4gICAgICBpZiAob2JqZWN0ID09IG51bGwpIHtcbiAgICAgICAgcmV0dXJuIG9iamVjdDtcbiAgICAgIH1cbiAgICAgIHZhciBwYXRoS2V5ID0gKHBhdGggKyAnJyk7XG4gICAgICBwYXRoID0gKG9iamVjdFtwYXRoS2V5XSAhPSBudWxsIHx8IGlzS2V5KHBhdGgsIG9iamVjdCkpID8gW3BhdGhLZXldIDogdG9QYXRoKHBhdGgpO1xuXG4gICAgICB2YXIgaW5kZXggPSAtMSxcbiAgICAgICAgICBsZW5ndGggPSBwYXRoLmxlbmd0aCxcbiAgICAgICAgICBsYXN0SW5kZXggPSBsZW5ndGggLSAxLFxuICAgICAgICAgIG5lc3RlZCA9IG9iamVjdDtcblxuICAgICAgd2hpbGUgKG5lc3RlZCAhPSBudWxsICYmICs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AwIGFuZCA1XG4gICAgICpcbiAgICAgKiBfLnJhbmRvbSgxLjIsIDUuMik7XG4gICAgICogLy8gPT4gYSBmbG9hdGluZy1wb2ludCBudW1iZXIgYmV0d2VlbiAxLjIgYW5kIDUuMlxuICAgICAqL1xuICAgIGZ1bmN0aW9uIHJhbmRvbShtaW4sIG1heCwgZmxvYXRpbmcpIHtcbiAgICAgIGlmIChmbG9hdGluZyAmJiBpc0l0ZXJhdGVlQ2FsbChtaW4sIG1heCwgZmxvYXRpbmcpKSB7XG4gICAgICAgIG1heCA9IGZsb2F0aW5nID0gdW5kZWZpbmVkO1xuICAgICAgfVxuICAgICAgdmFyIG5vTWluID0gbWluID09IG51bGwsXG4gICAgICAgICAgbm9NYXggPSBtYXggPT0gbnVsbDtcblxuICAgICAgaWYgKGZsb2F0aW5nID09IG51bGwpIHtcbiAgICAgICAgaWYgKG5vTWF4ICYmIHR5cGVvZiBtaW4gPT0gJ2Jvb2xlYW4nKSB7XG4gICAgICAgICAgZmxvYXRpbmcgPSBtaW47XG4gICAgICAgICAgbWluID0gMTtcbiAgICAgICAgfVxuICAgICAgICBlbHNlIGlmICh0eXBlb2YgbWF4ID09ICdib29sZWFuJykge1xuICAgICAgICAgIGZsb2F0aW5nID0gbWF4O1xuICAgICAgICAgIG5vTWF4ID0gdHJ1ZTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgaWYgKG5vTWluICYmIG5vTWF4KSB7XG4gICAgICAgIG1heCA9IDE7XG4gICAgICAgIG5vTWF4ID0gZmFsc2U7XG4gICAgICB9XG4gICAgICBtaW4gPSArbWluIHx8IDA7XG4gICAgICBpZiAobm9NYXgpIHtcbiAgICAgICAgbWF4ID0gbWluO1xuICAgICAgICBtaW4gPSAwO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgbWF4ID0gK21heCB8fCAwO1xuICAgICAgfVxuICAgICAgaWYgKGZsb2F0aW5nIHx8IG1pbiAlIDEgfHwgbWF4ICUgMSkge1xuICAgICAgICB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V4YW1wbGVcbiAgICAgKlxuICAgICAqIF8udHJpbSgnICBhYmMgICcpO1xuICAgICAqIC8vID0+ICdhYmMnXG4gICAgICpcbiAgICAgKiBfLnRyaW0oJy1fLWFiYy1fLScsICdfLScpO1xuICAgICAqIC8vID0+ICdhYmMnXG4gICAgICpcbiAgICAgKiBfLm1hcChbJyAgZm9vICAnLCAnICBiYXIgICddLCBfLnRyaW0pO1xuICAgICAqIC8vID0+IFsnZm9vJywgJ2JhciddXG4gICAgICovXG4gICAgZnVuY3Rpb24gdHJpbShzdHJpbmcsIGNoYXJzLCBndWFyZCkge1xuICAgICAgdmFyIHZhbHVlID0gc3RyaW5nO1xuICAgICAgc3RyaW5nID0gYmFzZVRvU3RyaW5nKHN0cmluZyk7XG4gICAgICBpZiAoIXN0cmluZykge1xuICAgICAgICByZXR1cm4gc3RyaW5nO1xuICAgICAgfVxuICAgICAgaWYgKGd1YXJkID8gaXNJdGVyYXRlZUNhbGwodmFsdWUsIGNoYXJzLCBndWFyZCkgOiBjaGFycyA9PSBudWxsKSB7XG4gICAgICAgIHJldHVybiBzdHJpbmcuc2xpY2UodHJpbW1lZExlZnRJbmRleChzdHJpbmcpLCB0cmltbWVkUmlnaHRJbmRleChzdHJpbmcpICsgMSk7XG4gICAgICB9XG4gICAgICBjaGFycyA9IChjaGFycyArICcnKTtcbiAgICAgIHJldHVybiBzdHJpbmcuc2xpY2UoY2hhcnNMZWZ0SW5kZXgoc3RyaW5nLCBjaGFycyksIGNoYXJzUmlnaHRJbmRleChzdHJpbmcsIGNoYXJzKSArIDEpO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIFJlbW92ZXMgbGVhZGluZyB3aGl0ZXNwYWNlIG9yIHNwZWNpZmllZCBjaGFyYWN0ZXJzIGZyb20gYHN0cmluZ2AuXG4gICAgICpcbiAgICAgKiBAc3RhdGljXG4gICAgICogQG1lbWJlck9mIF9cbiAgICAgKiBAY2F0ZWdvcnkgU3RyaW5nXG4gICAgICogQHBhcm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vdXJjZVttZXRob2ROYW1lXTtcblxuICAgICAgICBvYmplY3RbbWV0aG9kTmFtZV0gPSBmdW5jO1xuICAgICAgICBpZiAoaXNGdW5jKSB7XG4gICAgICAgICAgb2JqZWN0LnByb3RvdHlwZVttZXRob2ROYW1lXSA9IChmdW5jdGlvbihmdW5jKSB7XG4gICAgICAgICAgICByZXR1cm4gZnVuY3Rpb24oKSB7XG4gICAgICAgICAgICAgIHZhciBjaGFpbkFsbCA9IHRoaXMuX19jaGFpbl9fO1xuICAgICAgICAgICAgICBpZiAoY2hhaW4gfHwgY2hhaW5BbGwpIHtcbiAgICAgICAgICAgICAgICB2YXIgcmVzdWx0ID0gb2JqZWN0KHRoaXMuX193cmFwcGVkX18pLFxuICAgICAgICAgICAgICAgICAgICBhY3Rpb25zID0gcmVzdWx0Ll9fYWN0aW9uc19fID0gYXJyYXlDb3B5KHRoaXMuX19hY3Rpb25zX18pO1xuXG4gICAgICAgICAgICAgICAgYWN0aW9ucy5wdXNoKHsgJ2Z1bmMnOiBmdW5jLCAnYXJncyc6IGFyZ3VtZW50cywgJ3RoaXNBcmcnOiBvYmplY3QgfSk7XG4gICAgICAgICAgICAgICAgcmVzdWx0Ll9fY2hhaW5fXyA9IGNoYWluQWxsO1xuICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQ7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmV0dXJuIGZ1bmMuYXBwbHkob2JqZWN0LCBhcnJheVB1c2goW3RoaXMudmFsdWUoKV0sIGFyZ3VtZW50cykpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgICB9KGZ1bmMpKTtcbiAgICAgICAgfVxuICAgICAgfVxuICAgICAgcmV0dXJuIG9iamVjdDtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBSZXZlcnRzIHRoZSBgX2AgdmFyaWFibGUgdG8gaXRzIHByZXZpb3VzIHZhbHVlIGFuZCByZXR1cm5zIGEgcmVmZXJlbmNlIHRvXG4gICAgICog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WAuXG4gICAgICogQHJldHVybnMgeyp9IFJldHVybnMgdGhlIG1pbmltdW0gdmFsdWUuXG4gICAgICogQGV4YW1wbGVcbiAgICAgKlxuICAgICAqIF8ubWluKFs0LCAyLCA4LCA2XSk7XG4gICAgICogLy8gPT4gMlxuICAgICAqXG4gICAgICogXy5taW4oW10pO1xuICAgICAqIC8vID0+IEluZmluaXR5XG4gICAgICpcbiAgICAgKiB2YXIgdXNlcnMgPSBbXG4gICAgICogICB7ICd1c2VyJzogJ2Jhcm5leScsICdhZ2UnOiAzNiB9LFxuICAgICAqICAgeyAndXNlcic6ICdmcmVkJywgICAnYWdlJzogNDAgfVxuICAgICAqIF07XG4gICAgICpcbiAgICAgKiBfLm1pbih1c2VycywgZnVuY3Rpb24oY2hyKSB7XG4gICAgICogICByZXR1cm4gY2hyLmFnZTtcbiAgICAgKiB9KTtcbiAgICAgKiAvLyA9PiB7ICd1c2VyJzogJ2Jhcm5leScsICdhZ2UnOiAzNiB9XG4gICAgICpcbiAgICAgKiAvLyB1c2luZyB0aGUgYF8ucHJvcGVydHlgIGNhbGxiYWNrIHNob3J0aGFuZFxuICAgICAqIF8ubWluKHVzZXJzLCAnYWdlJyk7XG4gICAgICogLy8gPT4geyAndXNlcic6ICdiYXJuZXknLCAnYWdlJzogMzYgfVxuICAgICAqL1xuICAgIHZhciBtaW4gPSBjcmVhdGVFeHRyZW11bShsdCwgUE9TSVRJVkVfSU5GSU5JVFkpO1xuXG4gICAgLyoqXG4gICAgICogQ2FsY3VsYXRlcyBgbmAgcm91bmRlZCB0byBgcHJlY2lzaW9uYC5cbiAgICAgKlxuICAgICAqIEBzdGF0aWNcbiAgICAgKiBAbWVtYmVyT2YgX1xuICAgICAqIEBjYXRlZ29yeSBNYXRoXG4gICAgICogQHBhcmFtIHtudW1iZXJ9IG4gVGhlIG51bWJlciB0byByb3VuZC5cbiAgICAgKiBAcGFyYW0ge251bWJlcn0gW3ByZWNpc2lvbj0wXSBUaGUgcHJlY2lzaW9u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cmcvZG9jcy9lcnJvcnMuaHRtbCNtaXNtYXRjaCBmb3JcbiAgICAvLyBtb3JlIGRldGFpbHMuXG4gICAgcm9vdC5fID0gXztcblxuICAgIC8vIERlZmluZSBhcyBhbiBhbm9ueW1vdXMgbW9kdWxlIHNvLCB0aHJvdWdoIHBhdGggbWFwcGluZywgaXQgY2FuIGJlXG4gICAgLy8gcmVmZXJlbmNlZCBhcyB0aGUgXCJ1bmRlcnNjb3JlXCIgbW9kdWxlLlxuICAgIGRlZmluZShmdW5jdGlvbigpIHtcbiAgICAgIHJldHVybiBfO1xuICAgIH0pO1xuICB9XG4gIC8vIENoZWNrIGZvciBgZXhwb3J0c2AgYWZ0ZXIgYGRlZmluZWAgaW4gY2FzZSBhIGJ1aWxkIG9wdGltaXplciBhZGRzIGFuIGBleHBvcnRzYCBvYmplY3QuXG4gIGVsc2UgaWYgKGZyZWVFeHBvcnRzICYmIGZyZWVNb2R1bGUpIHtcbiAgICAvLyBFeHBvcnQgZm9yIE5vZGUuanMgb3IgUmluZ29KUy5cbiAgICBpZiAobW9kdWxlRXhwb3J0cykge1xuICAgICAgKGZyZWVNb2R1bGUuZXhwb3J0cyA9IF8pLl8gPSBfO1xuICAgIH1cbiAgICAvLyBFeHBvcnQgZm9yIFJoaW5vIHdpdGggQ29tbW9uSlMgc3VwcG9ydC5cbiAgICBlbHNlIHtcbiAgICAgIGZyZWVFeHBvcnRzLl8gPSBfO1xuICAgIH1cbiAgfVxuICBlbHNlIHtcbiAgICAvLyBFeHBvcnQgZm9yIGEgYnJvd3NlciBvciBSaGluby5cbiAgICByb290Ll8gPSBfO1xuICB9XG59LmNhbGwodGhpcykpO1xuIl19 diff --git a/dist/dagre-d3.min.js b/dist/dagre-d3.min.js index 16b55f84..86426836 100644 --- a/dist/dagre-d3.min.js +++ b/dist/dagre-d3.min.js @@ -1,4 +1,4 @@ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.dagreD3=t()}}(function(){var t;return function n(t,e,r){function i(a,u){if(!e[a]){if(!t[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var f=e[a]={exports:{}};t[a][0].call(f.exports,function(n){var e=t[a][1][n];return i(e?e:n)},f,f.exports,n,t,e,r)}return e[a].exports}for(var o="function"==typeof require&&require,a=0;a0}n.exports=r},{}],14:[function(t,n,e){function r(t,n){return t.intersect(n)}n.exports=r},{}],15:[function(t,n,e){function r(t,n,e){var r=t.x,o=t.y,a=[],u=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;n.forEach(function(t){u=Math.min(u,t.x),c=Math.min(c,t.y)});for(var s=r-t.width/2-u,f=o-t.height/2-c,l=0;l1&&a.sort(function(t,n){var r=t.x-e.x,i=t.y-e.y,o=Math.sqrt(r*r+i*i),a=n.x-e.x,u=n.y-e.y,c=Math.sqrt(a*a+u*u);return oMath.abs(a)*s?(u<0&&(s=-s),e=0===u?0:s*a/u,r=s):(a<0&&(c=-c),e=c,r=0===a?0:c*u/a),{x:i+e,y:o+r}}n.exports=r},{}],17:[function(t,n,e){function r(t,n){var e=t.append("foreignObject").attr("width","100000"),r=e.append("xhtml:div");r.attr("xmlns","http://www.w3.org/1999/xhtml");var o=n.label;switch(typeof o){case"function":r.insert(o);break;case"object":r.insert(function(){return o});break;default:r.html(o)}i.applyStyle(r,n.labelStyle),r.style("display","inline-block"),r.style("white-space","nowrap");var a=r[0][0].getBoundingClientRect();return e.attr("width",a.width).attr("height",a.height),e}var i=t("../util");n.exports=r},{"../util":27}],18:[function(t,n,e){function r(t,n,e){var r=n.label,u=t.append("g");"svg"===n.labelType?a(u,n):"string"!=typeof r||"html"===n.labelType?o(u,n):i(u,n);var c,s=u.node().getBBox();switch(e){case"top":c=-n.height/2;break;case"bottom":c=n.height/2-s.height;break;default:c=-s.height/2}return u.attr("transform","translate("+-s.width/2+","+c+")"),u}var i=t("./add-text-label"),o=t("./add-html-label"),a=t("./add-svg-label");n.exports=r},{"./add-html-label":17,"./add-svg-label":19,"./add-text-label":20}],19:[function(t,n,e){function r(t,n){var e=t;return e.node().appendChild(n.label),i.applyStyle(e,n.labelStyle),e}var i=t("../util");n.exports=r},{"../util":27}],20:[function(t,n,e){function r(t,n){for(var e=t.append("text"),r=i(n.label).split("\n"),a=0;a0;--c)if(r=n[c].dequeue()){i=i.concat(o(t,n,e,r,!0));break}}return i}function o(t,n,e,r,i){var o=i?[]:void 0;return c.each(t.inEdges(r.v),function(r){var a=t.edge(r),c=t.node(r.v);i&&o.push({v:r.v,w:r.w}),c.out-=a,u(n,e,c)}),c.each(t.outEdges(r.v),function(r){var i=t.edge(r),o=r.w,a=t.node(o);a["in"]-=i,u(n,e,a)}),t.removeNode(r.v),o}function a(t,n){var e=new s,r=0,i=0;c.each(t.nodes(),function(t){e.setNode(t,{v:t,"in":0,out:0})}),c.each(t.edges(),function(t){var o=e.edge(t.v,t.w)||0,a=n(t),u=o+a;e.setEdge(t.v,t.w,u),i=Math.max(i,e.node(t.v).out+=a),r=Math.max(r,e.node(t.w)["in"]+=a)});var o=c.range(i+r+3).map(function(){return new f}),a=r+1;return c.each(e.nodes(),function(t){u(o,a,e.node(t))}),{graph:e,buckets:o,zeroIdx:a}}function u(t,n,e){e.out?e["in"]?t[e.out-e["in"]+n].enqueue(e):t[t.length-1].enqueue(e):t[0].enqueue(e)}var c=t("./lodash"),s=t("./graphlib").Graph,f=t("./data/list");n.exports=r;var l=c.constant(1)},{"./data/list":33,"./graphlib":35,"./lodash":38}],37:[function(t,n,e){"use strict";function r(t,n){var e=n&&n.debugTiming?O.time:O.notime;e("layout",function(){var n=e(" buildLayoutGraph",function(){return a(t)});e(" runLayout",function(){i(n,e)}),e(" updateInputGraph",function(){o(t,n)})})}function i(t,n){n(" makeSpaceForEdgeLabels",function(){u(t)}),n(" removeSelfEdges",function(){g(t)}),n(" acyclic",function(){x.run(t)}),n(" nestingGraph.run",function(){j.run(t)}),n(" rank",function(){E(O.asNonCompoundGraph(t))}),n(" injectEdgeLabelProxies",function(){c(t)}),n(" removeEmptyRanks",function(){C(t)}),n(" nestingGraph.cleanup",function(){j.cleanup(t)}),n(" normalizeRanks",function(){N(t)}),n(" assignRankMinMax",function(){s(t)}),n(" removeEdgeLabelProxies",function(){f(t)}),n(" normalize.run",function(){k.run(t)}),n(" parentDummyChains",function(){I(t)}),n(" addBorderSegments",function(){R(t)}),n(" order",function(){L(t)}),n(" insertSelfEdges",function(){y(t)}),n(" adjustCoordinateSystem",function(){T.adjust(t)}),n(" position",function(){A(t)}),n(" positionSelfEdges",function(){_(t)}),n(" removeBorderNodes",function(){v(t)}),n(" normalize.undo",function(){k.undo(t)}),n(" fixupEdgeLabelCoords",function(){d(t)}),n(" undoCoordinateSystem",function(){T.undo(t)}),n(" translateGraph",function(){l(t)}),n(" assignNodeIntersects",function(){h(t)}),n(" reversePoints",function(){p(t)}),n(" acyclic.undo",function(){x.undo(t)})}function o(t,n){b.each(t.nodes(),function(e){var r=t.node(e),i=n.node(e);r&&(r.x=i.x,r.y=i.y,n.children(e).length&&(r.width=i.width,r.height=i.height))}),b.each(t.edges(),function(e){var r=t.edge(e),i=n.edge(e);r.points=i.points,b.has(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=n.graph().width,t.graph().height=n.graph().height}function a(t){var n=new S({multigraph:!0,compound:!0}),e=w(t.graph());return n.setGraph(b.merge({},B,m(e,M),b.pick(e,U))),b.each(t.nodes(),function(e){var r=w(t.node(e));n.setNode(e,b.defaults(m(r,P),F)),n.setParent(e,t.parent(e))}),b.each(t.edges(),function(e){var r=w(t.edge(e));n.setEdge(e,b.merge({},W,m(r,D),b.pick(r,z)))}),n}function u(t){var n=t.graph();n.ranksep/=2,b.each(t.edges(),function(e){var r=t.edge(e);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function c(t){b.each(t.edges(),function(n){var e=t.edge(n);if(e.width&&e.height){var r=t.node(n.v),i=t.node(n.w),o={rank:(i.rank-r.rank)/2+r.rank,e:n};O.addDummyNode(t,"edge-proxy",o,"_ep")}})}function s(t){var n=0;b.each(t.nodes(),function(e){var r=t.node(e);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,n=b.max(n,r.maxRank))}),t.graph().maxRank=n}function f(t){b.each(t.nodes(),function(n){var e=t.node(n);"edge-proxy"===e.dummy&&(t.edge(e.e).labelRank=e.rank,t.removeNode(n))})}function l(t){function n(t){var n=t.x,a=t.y,u=t.width,c=t.height;e=Math.min(e,n-u/2),r=Math.max(r,n+u/2),i=Math.min(i,a-c/2),o=Math.max(o,a+c/2)}var e=Number.POSITIVE_INFINITY,r=0,i=Number.POSITIVE_INFINITY,o=0,a=t.graph(),u=a.marginx||0,c=a.marginy||0;b.each(t.nodes(),function(e){n(t.node(e))}),b.each(t.edges(),function(e){var r=t.edge(e);b.has(r,"x")&&n(r)}),e-=u,i-=c,b.each(t.nodes(),function(n){var r=t.node(n);r.x-=e,r.y-=i}),b.each(t.edges(),function(n){var r=t.edge(n);b.each(r.points,function(t){t.x-=e,t.y-=i}),b.has(r,"x")&&(r.x-=e),b.has(r,"y")&&(r.y-=i)}),a.width=r-e+u,a.height=o-i+c}function h(t){b.each(t.edges(),function(n){var e,r,i=t.edge(n),o=t.node(n.v),a=t.node(n.w);i.points?(e=i.points[0],r=i.points[i.points.length-1]):(i.points=[],e=a,r=o),i.points.unshift(O.intersectRect(o,e)),i.points.push(O.intersectRect(a,r))})}function d(t){b.each(t.edges(),function(n){var e=t.edge(n);if(b.has(e,"x"))switch("l"!==e.labelpos&&"r"!==e.labelpos||(e.width-=e.labeloffset),e.labelpos){case"l":e.x-=e.width/2+e.labeloffset;break;case"r":e.x+=e.width/2+e.labeloffset}})}function p(t){b.each(t.edges(),function(n){var e=t.edge(n);e.reversed&&e.points.reverse()})}function v(t){b.each(t.nodes(),function(n){if(t.children(n).length){var e=t.node(n),r=t.node(e.borderTop),i=t.node(e.borderBottom),o=t.node(b.last(e.borderLeft)),a=t.node(b.last(e.borderRight));e.width=Math.abs(a.x-o.x),e.height=Math.abs(i.y-r.y),e.x=o.x+e.width/2,e.y=r.y+e.height/2}}),b.each(t.nodes(),function(n){"border"===t.node(n).dummy&&t.removeNode(n)})}function g(t){b.each(t.edges(),function(n){if(n.v===n.w){var e=t.node(n.v);e.selfEdges||(e.selfEdges=[]),e.selfEdges.push({e:n,label:t.edge(n)}),t.removeEdge(n)}})}function y(t){var n=O.buildLayerMatrix(t);b.each(n,function(n){var e=0;b.each(n,function(n,r){var i=t.node(n);i.order=r+e,b.each(i.selfEdges,function(n){O.addDummyNode(t,"selfedge",{width:n.label.width,height:n.label.height,rank:i.rank,order:r+ ++e,e:n.e,label:n.label},"_se")}),delete i.selfEdges})})}function _(t){b.each(t.nodes(),function(n){var e=t.node(n);if("selfedge"===e.dummy){var r=t.node(e.e.v),i=r.x+r.width/2,o=r.y,a=e.x-i,u=r.height/2;t.setEdge(e.e,e.label),t.removeNode(n),e.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],e.label.x=e.x,e.label.y=e.y}})}function m(t,n){return b.mapValues(b.pick(t,n),Number)}function w(t){var n={};return b.each(t,function(t,e){n[e.toLowerCase()]=t}),n}var b=t("./lodash"),x=t("./acyclic"),k=t("./normalize"),E=t("./rank"),N=t("./util").normalizeRanks,I=t("./parent-dummy-chains"),C=t("./util").removeEmptyRanks,j=t("./nesting-graph"),R=t("./add-border-segments"),T=t("./coordinate-system"),L=t("./order"),A=t("./position"),O=t("./util"),S=t("./graphlib").Graph;n.exports=r;var M=["nodesep","edgesep","ranksep","marginx","marginy"],B={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},U=["acyclicer","ranker","rankdir","align"],P=["width","height"],F={width:0,height:0},D=["minlen","weight","width","height","labeloffset"],W={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"]},{"./acyclic":30,"./add-border-segments":31,"./coordinate-system":32,"./graphlib":35,"./lodash":38,"./nesting-graph":39,"./normalize":40,"./order":45,"./parent-dummy-chains":50,"./position":52,"./rank":54,"./util":57}],38:[function(t,n,e){var r;if("function"==typeof t)try{r=t("lodash")}catch(i){}r||(r=window._),n.exports=r},{lodash:79}],39:[function(t,n,e){function r(t){var n=s.addDummyNode(t,"root",{},"_root"),e=o(t),r=c.max(e)-1,u=2*r+1;t.graph().nestingRoot=n,c.each(t.edges(),function(n){t.edge(n).minlen*=u});var f=a(t)+1;c.each(t.children(),function(o){i(t,n,u,f,r,e,o)}),t.graph().nodeRankFactor=u}function i(t,n,e,r,o,a,u){var f=t.children(u);if(!f.length)return void(u!==n&&t.setEdge(n,u,{weight:0,minlen:e}));var l=s.addBorderNode(t,"_bt"),h=s.addBorderNode(t,"_bb"),d=t.node(u);t.setParent(l,u),d.borderTop=l,t.setParent(h,u),d.borderBottom=h,c.each(f,function(c){i(t,n,e,r,o,a,c);var s=t.node(c),f=s.borderTop?s.borderTop:c,d=s.borderBottom?s.borderBottom:c,p=s.borderTop?r:2*r,v=f!==d?1:o-a[u]+1;t.setEdge(l,f,{weight:p,minlen:v,nestingEdge:!0}),t.setEdge(d,h,{weight:p,minlen:v,nestingEdge:!0})}),t.parent(u)||t.setEdge(n,l,{weight:0,minlen:o+a[u]})}function o(t){function n(r,i){var o=t.children(r);o&&o.length&&c.each(o,function(t){n(t,i+1)}),e[r]=i}var e={};return c.each(t.children(),function(t){n(t,1)}),e}function a(t){return c.reduce(t.edges(),function(n,e){return n+t.edge(e).weight},0)}function u(t){var n=t.graph();t.removeNode(n.nestingRoot),delete n.nestingRoot,c.each(t.edges(),function(n){var e=t.edge(n);e.nestingEdge&&t.removeEdge(n)})}var c=t("./lodash"),s=t("./util");n.exports={run:r,cleanup:u}},{"./lodash":38,"./util":57}],40:[function(t,n,e){"use strict";function r(t){t.graph().dummyChains=[],a.each(t.edges(),function(n){i(t,n)})}function i(t,n){var e=n.v,r=t.node(e).rank,i=n.w,o=t.node(i).rank,a=n.name,c=t.edge(n),s=c.labelRank;if(o!==r+1){t.removeEdge(n);var f,l,h;for(h=0,++r;r0;)n%2&&(e+=c[n+1]),n=n-1>>1,c[n]+=t.weight;s+=t.weight*e})),s}var o=t("../lodash");n.exports=r},{"../lodash":38}],45:[function(t,n,e){"use strict";function r(t){var n=p.maxRank(t),e=i(t,u.range(1,n+1),"inEdges"),r=i(t,u.range(n-1,-1,-1),"outEdges"),f=c(t);a(t,f);for(var l,h=Number.POSITIVE_INFINITY,d=0,v=0;v<4;++d,++v){o(d%2?e:r,d%4>=2),f=p.buildLayerMatrix(t);var g=s(t,f);g=t.barycenter)&&o(t,n)}}function e(n){return function(e){e["in"].push(n),0===--e.indegree&&t.push(e)}}for(var r=[];t.length;){var i=t.pop();r.push(i),a.each(i["in"].reverse(),n(i)),a.each(i.out,e(i))}return a.chain(r).filter(function(t){return!t.merged}).map(function(t){return a.pick(t,["vs","i","barycenter","weight"])}).value()}function o(t,n){var e=0,r=0;t.weight&&(e+=t.barycenter*t.weight,r+=t.weight),n.weight&&(e+=n.barycenter*n.weight,r+=n.weight),t.vs=n.vs.concat(t.vs),t.barycenter=e/r,t.weight=r,t.i=Math.min(n.i,t.i),n.merged=!0}var a=t("../lodash");n.exports=r},{"../lodash":38}],48:[function(t,n,e){function r(t,n,e,f){var l=t.children(n),h=t.node(n),d=h?h.borderLeft:void 0,p=h?h.borderRight:void 0,v={};d&&(l=a.filter(l,function(t){return t!==d&&t!==p}));var g=u(t,l);a.each(g,function(n){if(t.children(n.v).length){var i=r(t,n.v,e,f);v[n.v]=i,a.has(i,"barycenter")&&o(n,i)}});var y=c(g,e);i(y,v);var _=s(y,f);if(d&&(_.vs=a.flatten([d,_.vs,p],!0),t.predecessors(d).length)){var m=t.node(t.predecessors(d)[0]),w=t.node(t.predecessors(p)[0]);a.has(_,"barycenter")||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+m.order+w.order)/(_.weight+2),_.weight+=2}return _}function i(t,n){a.each(t,function(t){t.vs=a.flatten(t.vs.map(function(t){return n[t]?n[t].vs:t}),!0)})}function o(t,n){a.isUndefined(t.barycenter)?(t.barycenter=n.barycenter,t.weight=n.weight):(t.barycenter=(t.barycenter*t.weight+n.barycenter*n.weight)/(t.weight+n.weight),t.weight+=n.weight)}var a=t("../lodash"),u=t("./barycenter"),c=t("./resolve-conflicts"),s=t("./sort");n.exports=r},{"../lodash":38,"./barycenter":42,"./resolve-conflicts":47,"./sort":49}],49:[function(t,n,e){function r(t,n){var e=u.partition(t,function(t){return a.has(t,"barycenter")}),r=e.lhs,c=a.sortBy(e.rhs,function(t){return-t.i}),s=[],f=0,l=0,h=0;r.sort(o(!!n)),h=i(s,c,h),a.each(r,function(t){h+=t.vs.length,s.push(t.vs),f+=t.barycenter*t.weight,l+=t.weight,h=i(s,c,h)});var d={vs:a.flatten(s,!0)};return l&&(d.barycenter=f/l,d.weight=l),d}function i(t,n,e){for(var r;n.length&&(r=a.last(n)).i<=e;)n.pop(),t.push(r.vs),e++;return e}function o(t){return function(n,e){return n.barycentere.barycenter?1:t?e.i-n.i:n.i-e.i}}var a=t("../lodash"),u=t("../util");n.exports=r},{"../lodash":38,"../util":57}],50:[function(t,n,e){function r(t){var n=o(t);a.each(t.graph().dummyChains,function(e){for(var r=t.node(e),o=r.edgeObj,a=i(t,n,o.v,o.w),u=a.path,c=a.lca,s=0,f=u[s],l=!0;e!==o.w;){if(r=t.node(e),l){for(;(f=u[s])!==c&&t.node(f).maxRankc||s>n[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)u.push(i);return{path:a.concat(u.reverse()),lca:o}}function o(t){function n(i){var o=r;a.each(t.children(i),n),e[i]={low:o,lim:r++}}var e={},r=0;return a.each(t.children(),n),e}var a=t("./lodash");n.exports=r},{"./lodash":38}],51:[function(t,n,e){"use strict";function r(t,n){function e(n,e){var i=0,u=0,c=n.length,s=y.last(e);return y.each(e,function(n,f){var l=o(t,n),h=l?t.node(l).order:c;(l||n===s)&&(y.each(e.slice(u,f+1),function(n){y.each(t.predecessors(n),function(e){var o=t.node(e),u=o.order;!(uu)&&a(i,n,c)})})}function r(n,r){var i,o=-1,a=0;return y.each(r,function(u,c){if("border"===t.node(u).dummy){var s=t.predecessors(u);s.length&&(i=t.node(s[0]).order,e(r,a,c,o,i),a=c,o=i)}e(r,a,r.length,i,n.length)}),r}var i={};return y.reduce(n,r),i}function o(t,n){if(t.node(n).dummy)return y.find(t.predecessors(n),function(n){return t.node(n).dummy})}function a(t,n,e){if(n>e){var r=n;n=e,e=r}var i=t[n];i||(t[n]=i={}),i[e]=!0}function u(t,n,e){if(n>e){var r=n;n=e,e=r}return y.has(t[n],e)}function c(t,n,e,r){var i={},o={},a={};return y.each(n,function(t){y.each(t,function(t,n){i[t]=t,o[t]=t,a[t]=n})}),y.each(n,function(t){var n=-1;y.each(t,function(t){var c=r(t);if(c.length){c=y.sortBy(c,function(t){return a[t]});for(var s=(c.length-1)/2,f=Math.floor(s),l=Math.ceil(s);f<=l;++f){var h=c[f];o[t]===t&&na.lim&&(u=a,c=!0);var s=v.filter(n.edges(),function(n){return c===p(t,t.node(n.v),u)&&c!==p(t,t.node(n.w),u)});return v.min(s,function(t){return y(n,t)})}function l(t,n,e,r){var o=e.v,a=e.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),u(t),i(t,n),h(t,n)}function h(t,n){var e=v.find(t.nodes(),function(t){return!n.node(t).parent}),r=m(t,e);r=r.slice(1),v.each(r,function(e){var r=t.node(e).parent,i=n.edge(e,r),o=!1;i||(i=n.edge(r,e),o=!0),n.node(e).rank=n.node(r).rank+(o?i.minlen:-i.minlen)})}function d(t,n,e){return t.hasEdge(n,e)}function p(t,n,e){return e.low<=n.lim&&n.lim<=e.lim}var v=t("../lodash"),g=t("./feasible-tree"),y=t("./util").slack,_=t("./util").longestPath,m=t("../graphlib").alg.preorder,w=t("../graphlib").alg.postorder,b=t("../util").simplify;n.exports=r,r.initLowLimValues=u,r.initCutValues=i,r.calcCutValue=a,r.leaveEdge=s,r.enterEdge=f,r.exchangeEdges=l},{"../graphlib":35,"../lodash":38,"../util":57,"./feasible-tree":53,"./util":56}],56:[function(t,n,e){"use strict";function r(t){function n(r){var i=t.node(r);if(o.has(e,r))return i.rank;e[r]=!0;var a=o.min(o.map(t.outEdges(r),function(e){return n(e.w)-t.edge(e).minlen}));return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a}var e={};o.each(t.sources(),n)}function i(t,n){return t.node(n.w).rank-t.node(n.v).rank-t.edge(n).minlen}var o=t("../lodash");n.exports={longestPath:r,slack:i}},{"../lodash":38}],57:[function(t,n,e){"use strict";function r(t,n,e,r){var i;do i=y.uniqueId(r);while(t.hasNode(i));return e.dummy=n,t.setNode(i,e),i}function i(t){var n=(new _).setGraph(t.graph());return y.each(t.nodes(),function(e){n.setNode(e,t.node(e))}),y.each(t.edges(),function(e){var r=n.edge(e.v,e.w)||{weight:0,minlen:1},i=t.edge(e);n.setEdge(e.v,e.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),n}function o(t){var n=new _({multigraph:t.isMultigraph()}).setGraph(t.graph());return y.each(t.nodes(),function(e){t.children(e).length||n.setNode(e,t.node(e))}),y.each(t.edges(),function(e){n.setEdge(e,t.edge(e))}),n}function a(t){var n=y.map(t.nodes(),function(n){var e={};return y.each(t.outEdges(n),function(n){e[n.w]=(e[n.w]||0)+t.edge(n).weight}),e});return y.zipObject(t.nodes(),n)}function u(t){var n=y.map(t.nodes(),function(n){var e={};return y.each(t.inEdges(n),function(n){e[n.v]=(e[n.v]||0)+t.edge(n).weight}),e});return y.zipObject(t.nodes(),n)}function c(t,n){var e=t.x,r=t.y,i=n.x-e,o=n.y-r,a=t.width/2,u=t.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var c,s;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),c=u*i/o,s=u):(i<0&&(a=-a),c=a,s=a*o/i),{x:e+c,y:r+s}}function s(t){var n=y.map(y.range(d(t)+1),function(){return[]});return y.each(t.nodes(),function(e){var r=t.node(e),i=r.rank;y.isUndefined(i)||(n[i][r.order]=e)}),n}function f(t){var n=y.min(y.map(t.nodes(),function(n){return t.node(n).rank}));y.each(t.nodes(),function(e){var r=t.node(e);y.has(r,"rank")&&(r.rank-=n)})}function l(t){var n=y.min(y.map(t.nodes(),function(n){return t.node(n).rank})),e=[];y.each(t.nodes(),function(r){var i=t.node(r).rank-n;e[i]||(e[i]=[]),e[i].push(r)});var r=0,i=t.graph().nodeRankFactor;y.each(e,function(n,e){y.isUndefined(n)&&e%i!==0?--r:r&&y.each(n,function(n){t.node(n).rank+=r})})}function h(t,n,e,i){var o={width:0,height:0};return arguments.length>=4&&(o.rank=e,o.order=i),r(t,"border",o,n)}function d(t){return y.max(y.map(t.nodes(),function(n){var e=t.node(n).rank;if(!y.isUndefined(e))return e}))}function p(t,n){var e={lhs:[],rhs:[]};return y.each(t,function(t){n(t)?e.lhs.push(t):e.rhs.push(t)}),e}function v(t,n){var e=y.now();try{return n()}finally{console.log(t+" time: "+(y.now()-e)+"ms")}}function g(t,n){return n()}var y=t("./lodash"),_=t("./graphlib").Graph;n.exports={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:s,normalizeRanks:f,removeEmptyRanks:l,addBorderNode:h,maxRank:d,partition:p,time:v,notime:g}},{"./graphlib":35,"./lodash":38}],58:[function(t,n,e){n.exports="0.7.4"},{}],59:[function(t,n,e){var r=t("./lib");n.exports={Graph:r.Graph,json:t("./lib/json"),alg:t("./lib/alg"),version:r.version}},{"./lib":75,"./lib/alg":66,"./lib/json":76}],60:[function(t,n,e){function r(t){function n(o){i.has(r,o)||(r[o]=!0,e.push(o),i.each(t.successors(o),n),i.each(t.predecessors(o),n))}var e,r={},o=[];return i.each(t.nodes(),function(t){e=[],n(t),e.length&&o.push(e)}),o}var i=t("../lodash");n.exports=r},{"../lodash":77}],61:[function(t,n,e){function r(t,n,e){o.isArray(n)||(n=[n]);var r=[],a={};return o.each(n,function(n){if(!t.hasNode(n))throw new Error("Graph does not have node: "+n);i(t,n,"post"===e,a,r)}),r}function i(t,n,e,r,a){o.has(r,n)||(r[n]=!0,e||a.push(n),o.each(t.neighbors(n),function(n){i(t,n,e,r,a)}),e&&a.push(n))}var o=t("../lodash");n.exports=r},{"../lodash":77}],62:[function(t,n,e){function r(t,n,e){return o.transform(t.nodes(),function(r,o){r[o]=i(t,o,n,e)},{})}var i=t("./dijkstra"),o=t("../lodash");n.exports=r},{"../lodash":77,"./dijkstra":63}],63:[function(t,n,e){function r(t,n,e,r){return i(t,String(n),e||u,r||function(n){return t.outEdges(n)})}function i(t,n,e,r){var i,o,u={},c=new a,s=function(t){var n=t.v!==i?t.v:t.w,r=u[n],a=e(t),s=o.distance+a;if(a<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+a);s0&&(i=c.removeMin(),o=u[i],o.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(s);return u}var o=t("../lodash"),a=t("../data/priority-queue");n.exports=r;var u=o.constant(1)},{"../data/priority-queue":73,"../lodash":77}],64:[function(t,n,e){function r(t){return i.filter(o(t),function(n){return n.length>1||1===n.length&&t.hasEdge(n[0],n[0])})}var i=t("../lodash"),o=t("./tarjan");n.exports=r},{"../lodash":77,"./tarjan":71}],65:[function(t,n,e){function r(t,n,e){return i(t,n||a,e||function(n){return t.outEdges(n)})}function i(t,n,e){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(n){t!==n&&(r[t][n]={distance:Number.POSITIVE_INFINITY})}),e(t).forEach(function(e){var i=e.v===t?e.w:e.v,o=n(e);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var n=r[t];i.forEach(function(e){var o=r[e];i.forEach(function(e){var r=o[t],i=n[e],a=o[e],u=r.distance+i.distance;u0;){if(r=s.removeMin(),i.has(c,r))u.setEdge(r,c[r]);else{if(f)throw new Error("Input graph is not connected: "+t);f=!0}t.nodeEdges(r).forEach(e)}return u}var i=t("../lodash"),o=t("../graph"),a=t("../data/priority-queue");n.exports=r},{"../data/priority-queue":73,"../graph":74,"../lodash":77}],71:[function(t,n,e){function r(t){function n(u){var c=o[u]={onStack:!0,lowlink:e,index:e++};if(r.push(u),t.successors(u).forEach(function(t){i.has(o,t)?o[t].onStack&&(c.lowlink=Math.min(c.lowlink,o[t].index)):(n(t),c.lowlink=Math.min(c.lowlink,o[t].lowlink))}),c.lowlink===c.index){var s,f=[];do s=r.pop(),o[s].onStack=!1,f.push(s);while(u!==s);a.push(f)}}var e=0,r=[],o={},a=[];return t.nodes().forEach(function(t){i.has(o,t)||n(t)}),a}var i=t("../lodash");n.exports=r},{"../lodash":77}],72:[function(t,n,e){function r(t){function n(u){if(o.has(r,u))throw new i;o.has(e,u)||(r[u]=!0,e[u]=!0,o.each(t.predecessors(u),n),delete r[u],a.push(u))}var e={},r={},a=[];if(o.each(t.sinks(),n),o.size(e)!==t.nodeCount())throw new i;return a}function i(){}var o=t("../lodash");n.exports=r,r.CycleException=i},{"../lodash":77}],73:[function(t,n,e){function r(){this._arr=[],this._keyIndices={}}var i=t("../lodash");n.exports=r,r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(t){return t.key})},r.prototype.has=function(t){return i.has(this._keyIndices,t)},r.prototype.priority=function(t){var n=this._keyIndices[t];if(void 0!==n)return this._arr[n].priority},r.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(t,n){var e=this._keyIndices;if(t=String(t),!i.has(e,t)){var r=this._arr,o=r.length;return e[t]=o,r.push({key:t,priority:n}),this._decrease(o),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},r.prototype.decrease=function(t,n){var e=this._keyIndices[t];if(n>this._arr[e].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[e].priority+" New: "+n);this._arr[e].priority=n,this._decrease(e)},r.prototype._heapify=function(t){var n=this._arr,e=2*t,r=e+1,i=t;e>1,!(e[n].priorityo){var a=i;i=o,o=a}return i+h+o+h+(s.isUndefined(r)?f:r)}function u(t,n,e,r){var i=""+n,o=""+e;if(!t&&i>o){var a=i;i=o,o=a}var u={v:i,w:o};return r&&(u.name=r),u}function c(t,n){return a(t,n.v,n.w,n.name)}var s=t("./lodash");n.exports=r;var f="\0",l="\0",h="";r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(t){return this._label=t,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(t){return s.isFunction(t)||(t=s.constant(t)),this._defaultNodeLabelFn=t,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return s.keys(this._nodes)},r.prototype.sources=function(){return s.filter(this.nodes(),function(t){return s.isEmpty(this._in[t])},this)},r.prototype.sinks=function(){return s.filter(this.nodes(),function(t){return s.isEmpty(this._out[t])},this)},r.prototype.setNodes=function(t,n){var e=arguments;return s.each(t,function(t){e.length>1?this.setNode(t,n):this.setNode(t)},this),this},r.prototype.setNode=function(t,n){return s.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=l,this._children[t]={},this._children[l][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},r.prototype.node=function(t){return this._nodes[t]},r.prototype.hasNode=function(t){return s.has(this._nodes,t)},r.prototype.removeNode=function(t){var n=this;if(s.has(this._nodes,t)){var e=function(t){n.removeEdge(n._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],s.each(this.children(t),function(t){this.setParent(t)},this),delete this._children[t]),s.each(s.keys(this._in[t]),e),delete this._in[t],delete this._preds[t],s.each(s.keys(this._out[t]),e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},r.prototype.setParent=function(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(s.isUndefined(n))n=l;else{n+="";for(var e=n;!s.isUndefined(e);e=this.parent(e))if(e===t)throw new Error("Setting "+n+" as parent of "+t+" would create create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this},r.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},r.prototype.parent=function(t){if(this._isCompound){var n=this._parent[t];if(n!==l)return n}},r.prototype.children=function(t){if(s.isUndefined(t)&&(t=l),this._isCompound){var n=this._children[t];if(n)return s.keys(n)}else{if(t===l)return this.nodes();if(this.hasNode(t))return[]}},r.prototype.predecessors=function(t){var n=this._preds[t];if(n)return s.keys(n)},r.prototype.successors=function(t){var n=this._sucs[t];if(n)return s.keys(n)},r.prototype.neighbors=function(t){var n=this.predecessors(t);if(n)return s.union(n,this.successors(t))},r.prototype.filterNodes=function(t){function n(t){var o=r.parent(t);return void 0===o||e.hasNode(o)?(i[t]=o,o):o in i?i[o]:n(o)}var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),s.each(this._nodes,function(n,r){t(r)&&e.setNode(r,n)},this),s.each(this._edgeObjs,function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,this.edge(t))},this);var r=this,i={};return this._isCompound&&s.each(e.nodes(),function(t){e.setParent(t,n(t))}),e},r.prototype.setDefaultEdgeLabel=function(t){return s.isFunction(t)||(t=s.constant(t)),this._defaultEdgeLabelFn=t,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return s.values(this._edgeObjs)},r.prototype.setPath=function(t,n){var e=this,r=arguments;return s.reduce(t,function(t,i){return r.length>1?e.setEdge(t,i,n):e.setEdge(t,i),i}),this},r.prototype.setEdge=function(){var t,n,e,r,o=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(t=c.v,n=c.w,e=c.name,2===arguments.length&&(r=arguments[1],o=!0)):(t=c,n=arguments[1],e=arguments[3],arguments.length>2&&(r=arguments[2],o=!0)),t=""+t,n=""+n,s.isUndefined(e)||(e=""+e);var f=a(this._isDirected,t,n,e);if(s.has(this._edgeLabels,f))return o&&(this._edgeLabels[f]=r),this;if(!s.isUndefined(e)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),this._edgeLabels[f]=o?r:this._defaultEdgeLabelFn(t,n,e);var l=u(this._isDirected,t,n,e);return t=l.v,n=l.w,Object.freeze(l),this._edgeObjs[f]=l,i(this._preds[n],t),i(this._sucs[t],n),this._in[n][f]=l,this._out[t][f]=l,this._edgeCount++,this},r.prototype.edge=function(t,n,e){var r=1===arguments.length?c(this._isDirected,arguments[0]):a(this._isDirected,t,n,e);return this._edgeLabels[r]},r.prototype.hasEdge=function(t,n,e){var r=1===arguments.length?c(this._isDirected,arguments[0]):a(this._isDirected,t,n,e);return s.has(this._edgeLabels,r)},r.prototype.removeEdge=function(t,n,e){var r=1===arguments.length?c(this._isDirected,arguments[0]):a(this._isDirected,t,n,e),i=this._edgeObjs[r];return i&&(t=i.v,n=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[n],t),o(this._sucs[t],n),delete this._in[n][r],delete this._out[t][r],this._edgeCount--),this},r.prototype.inEdges=function(t,n){var e=this._in[t];if(e){var r=s.values(e);return n?s.filter(r,function(t){return t.v===n}):r}},r.prototype.outEdges=function(t,n){var e=this._out[t];if(e){var r=s.values(e);return n?s.filter(r,function(t){return t.w===n}):r}},r.prototype.nodeEdges=function(t,n){var e=this.inEdges(t,n);if(e)return e.concat(this.outEdges(t,n))}},{"./lodash":77}],75:[function(t,n,e){n.exports={Graph:t("./graph"),version:t("./version")}},{"./graph":74,"./version":78}],76:[function(t,n,e){function r(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:o(t)};return u.isUndefined(t.graph())||(n.value=u.clone(t.graph())),n}function i(t){return u.map(t.nodes(),function(n){var e=t.node(n),r=t.parent(n),i={v:n};return u.isUndefined(e)||(i.value=e),u.isUndefined(r)||(i.parent=r),i})}function o(t){return u.map(t.edges(),function(n){var e=t.edge(n),r={v:n.v,w:n.w};return u.isUndefined(n.name)||(r.name=n.name),u.isUndefined(e)||(r.value=e),r})}function a(t){var n=new c(t.options).setGraph(t.value);return u.each(t.nodes,function(t){n.setNode(t.v,t.value),t.parent&&n.setParent(t.v,t.parent)}),u.each(t.edges,function(t){n.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),n}var u=t("./lodash"),c=t("./graph");n.exports={write:r,read:a}},{"./graph":74,"./lodash":77}],77:[function(t,n,e){arguments[4][38][0].apply(e,arguments)},{dup:38,lodash:79}],78:[function(t,n,e){n.exports="1.0.7"},{}],79:[function(n,e,r){(function(n){(function(){function i(t,n){if(t!==n){var e=null===t,r=t===I,i=t===t,o=null===n,a=n===I,u=n===n;if(t>n&&!o||!i||e&&!a&&u||r&&u)return 1;if(t-1;);return e}function f(t,n){for(var e=t.length;e--&&n.indexOf(t.charAt(e))>-1;);return e}function l(t,n){return i(t.criteria,n.criteria)||t.index-n.index}function h(t,n,e){for(var r=-1,o=t.criteria,a=n.criteria,u=o.length,c=e.length;++r=c)return s;var f=e[r];return s*("asc"===f||f===!0?1:-1)}}return t.index-n.index}function d(t){return Vt[t]}function p(t){return Yt[t]}function v(t,n,e){return n?t=Ht[t]:e&&(t=Kt[t]),"\\"+t}function g(t){return"\\"+Kt[t]}function y(t,n,e){for(var r=t.length,i=n+(e?0:-1);e?i--:++i=9&&t<=13||32==t||160==t||5760==t||6158==t||t>=8192&&(t<=8202||8232==t||8233==t||8239==t||8287==t||12288==t||65279==t)}function w(t,n){for(var e=-1,r=t.length,i=-1,o=[];++e=W?ve(n):null,s=n.length;c&&(o=Qt,u=!1,n=c);t:for(;++ii?0:i+e),r=r===I||r>i?i:+r||0,r<0&&(r+=i),i=e>r?0:r>>>0,e>>>=0;ei?0:i+n),e=e===I||e>i?i:+e||0,e<0&&(e+=i),i=n>e?0:e-n>>>0,n>>>=0;for(var o=Wo(i);++r=W,c=u?ve():null,s=[];c?(r=Qt,o=!1):(u=!1,c=n?[]:s);t:for(;++e>>1,a=t[o];(e?a<=n:a2?e[i-2]:I,a=i>2?e[2]:I,u=i>1?e[i-1]:I;for("function"==typeof o?(o=ae(o,u,5),i-=2):(o="function"==typeof u?u:I,i-=o?1:0),a&&Ze(e[0],e[1],a)&&(o=i<3?I:o,i=1);++r-1?e[a]:I}return Rn(e,r,t)}}function xe(t){return function(n,e,r){return n&&n.length?(e=We(e,r,3),o(n,e,t)):-1}}function ke(t){return function(n,e,r){return e=We(e,r,3),Rn(n,e,t,!0)}}function Ee(t){return function(){for(var n,e=arguments.length,i=t?e:-1,o=0,a=Wo(e);t?i--:++i=W)return n.plant(r).value();for(var i=0,o=e?a[i].apply(this,t):r;++i=n||!wa(n))return"";var i=n-r;return e=null==e?" ":e+"",yo(e,ga(i/e.length)).slice(0,i)}function Se(t,n,e,r){function i(){for(var n=-1,u=arguments.length,c=-1,s=r.length,f=Wo(s+u);++cc))return!1;for(;++u-1&&t%1==0&&t-1&&t%1==0&&t<=Aa}function rr(t){return t===t&&!Si(t)}function ir(t,n){var e=t[1],r=n[1],i=e|r,o=i-1;)da.call(n,o,1);return n}function Rr(t,n,e){var r=[];if(!t||!t.length)return r;var i=-1,o=[],a=t.length;for(n=We(n,e,3);++i-1:!!i&&qe(t,n,e)>-1}function ti(t,n,e){var r=Ru(t)?sn:Fn;return n=We(n,e,3),r(t,n)}function ni(t,n){return ti(t,So(n))}function ei(t,n,e){var r=Ru(t)?cn:jn;return n=We(n,e,3),r(t,function(t,e,r){return!n(t,e,r)})}function ri(t,n,e){if(e?Ze(t,n,e):null==n){t=fr(t);var r=t.length;return r>0?t[$n(0,r-1)]:I}var i=-1,o=$i(t),r=o.length,a=r-1;for(n=ka(n<0?0:+n||0,r);++i0&&(e=n.apply(this,arguments)),t<=1&&(n=I),e}}function di(t,n,e){function r(){d&&ua(d),s&&ua(s),v=0,s=d=p=I}function i(n,e){e&&ua(e),s=d=p=I,n&&(v=vu(),f=t.apply(h,c),d||s||(c=h=I))}function o(){var t=n-(vu()-l);t<=0||t>n?i(p,s):d=ha(o,t)}function a(){i(y,d)}function u(){if(c=arguments,l=vu(),h=this,p=y&&(d||!_),g===!1)var e=_&&!d;else{s||_||(v=l);var r=g-(l-v),i=r<=0||r>g;i?(s&&(s=ua(s)),v=l,f=t.apply(h,c)):s||(s=ha(a,r))}return i&&d?d=ua(d):d||n===g||(d=ha(o,n)),e&&(i=!0,f=t.apply(h,c)),!i||d||s||(c=h=I),f}var c,s,f,l,h,d,p,v=0,g=!1,y=!0;if("function"!=typeof t)throw new Ko(G);if(n=n<0?0:+n||0,e===!0){var _=!0;y=!1}else Si(e)&&(_=!!e.leading,g="maxWait"in e&&xa(+e.maxWait||0,n),y="trailing"in e?!!e.trailing:y);return u.cancel=r,u}function pi(t,n){if("function"!=typeof t||n&&"function"!=typeof n)throw new Ko(G);var e=function(){var r=arguments,i=n?n.apply(this,r):r[0],o=e.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return e.cache=o.set(i,a),a};return e.cache=new pi.Cache,e}function vi(t){if("function"!=typeof t)throw new Ko(G);return function(){return!t.apply(this,arguments)}}function gi(t){return hi(2,t)}function yi(t,n){if("function"!=typeof t)throw new Ko(G);return n=xa(n===I?t.length-1:+n||0,0),function(){for(var e=arguments,r=-1,i=xa(e.length-n,0),o=Wo(i);++rn}function Ei(t,n){return t>=n}function Ni(t){return _(t)&&Qe(t)&&na.call(t,"callee")&&!fa.call(t,"callee")}function Ii(t){return t===!0||t===!1||_(t)&&ra.call(t)==X}function Ci(t){return _(t)&&ra.call(t)==H}function ji(t){return!!t&&1===t.nodeType&&_(t)&&!Di(t)}function Ri(t){return null==t||(Qe(t)&&(Ru(t)||zi(t)||Ni(t)||_(t)&&Oi(t.splice))?!t.length:!Du(t).length)}function Ti(t,n,e,r){e="function"==typeof e?ae(e,r,3):I;var i=e?e(t,n):I;return i===I?Bn(t,n,e):!!i}function Li(t){return _(t)&&"string"==typeof t.message&&ra.call(t)==K}function Ai(t){return"number"==typeof t&&wa(t)}function Oi(t){return Si(t)&&ra.call(t)==Q}function Si(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function Mi(t,n,e,r){return e="function"==typeof e?ae(e,r,3):I,Pn(t,Ge(n),e)}function Bi(t){return Fi(t)&&t!=+t}function Ui(t){return null!=t&&(Oi(t)?oa.test(ta.call(t)):_(t)&&Mt.test(t))}function Pi(t){return null===t}function Fi(t){return"number"==typeof t||_(t)&&ra.call(t)==Z}function Di(t){var n;if(!_(t)||ra.call(t)!=tt||Ni(t)||!na.call(t,"constructor")&&(n=t.constructor,"function"==typeof n&&!(n instanceof n)))return!1;var e;return Ln(t,function(t,n){e=n}),e===I||na.call(t,e)}function Wi(t){return Si(t)&&ra.call(t)==nt}function zi(t){return"string"==typeof t||_(t)&&ra.call(t)==rt}function qi(t){return _(t)&&er(t.length)&&!!qt[ra.call(t)]}function Gi(t){return t===I}function Vi(t,n){return t0;++r=ka(n,e)&&t=0&&t.indexOf(n,e)==e}function ho(t){return t=c(t),t&&bt.test(t)?t.replace(mt,p):t}function po(t){return t=c(t),t&&Rt.test(t)?t.replace(jt,v):t||"(?:)"}function vo(t,n,e){t=c(t),n=+n;var r=t.length;if(r>=n||!wa(n))return t;var i=(n-r)/2,o=_a(i),a=ga(i);return e=Oe("",a,e),e.slice(0,o)+t+e}function go(t,n,e){return(e?Ze(t,n,e):null==n)?n=0:n&&(n=+n),t=wo(t),Na(t,n||(St.test(t)?16:10))}function yo(t,n){var e="";if(t=c(t),n=+n,n<1||!t||!wa(n))return e;do n%2&&(e+=t),n=_a(n/2),t+=t;while(n);return e}function _o(t,n,e){return t=c(t),e=null==e?0:ka(e<0?0:+e||0,t.length),t.lastIndexOf(n,e)==e}function mo(t,e,r){var i=n.templateSettings;r&&Ze(t,e,r)&&(e=r=I),t=c(t),e=yn(_n({},r||e),i,gn);var o,a,u=yn(_n({},e.imports),i.imports,gn),s=Du(u),f=ne(u,s),l=0,h=e.interpolate||Pt,d="__p += '",p=Xo((e.escape||Pt).source+"|"+h.source+"|"+(h===Et?At:Pt).source+"|"+(e.evaluate||Pt).source+"|$","g"),v="//# sourceURL="+("sourceURL"in e?e.sourceURL:"lodash.templateSources["+ ++zt+"]")+"\n";t.replace(p,function(n,e,r,i,u,c){return r||(r=i),d+=t.slice(l,c).replace(Ft,g),e&&(o=!0,d+="' +\n__e("+e+") +\n'"),u&&(a=!0,d+="';\n"+u+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+n.length,n}),d+="';\n";var y=e.variable;y||(d="with (obj) {\n"+d+"\n}\n"),d=(a?d.replace(vt,""):d).replace(gt,"$1").replace(yt,"$1;"),d="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var _=Qu(function(){return Go(s,v+"return "+d).apply(I,f)});if(_.source=d,Li(_))throw _;return _}function wo(t,n,e){var r=t;return(t=c(t))?(e?Ze(r,n,e):null==n)?t.slice(x(t),k(t)+1):(n+="",t.slice(s(t,n),f(t,n)+1)):t}function bo(t,n,e){var r=t;return t=c(t),t?(e?Ze(r,n,e):null==n)?t.slice(x(t)):t.slice(s(t,n+"")):t}function xo(t,n,e){var r=t;return t=c(t),t?(e?Ze(r,n,e):null==n)?t.slice(0,k(t)+1):t.slice(0,f(t,n+"")+1):t}function ko(t,n,e){e&&Ze(t,n,e)&&(n=I);var r=U,i=P;if(null!=n)if(Si(n)){var o="separator"in n?n.separator:o;r="length"in n?+n.length||0:r,i="omission"in n?c(n.omission):i}else r=+n||0;if(t=c(t),r>=t.length)return t;var a=r-i.length;if(a<1)return i;var u=t.slice(0,a);if(null==o)return u+i;if(Wi(o)){if(t.slice(a).search(o)){var s,f,l=t.slice(0,a);for(o.global||(o=Xo(o.source,(Ot.exec(o)||"")+"g")),o.lastIndex=0;s=o.exec(l);)f=s.index;u=u.slice(0,null==f?a:f)}}else if(t.indexOf(o,a)!=a){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+i}function Eo(t){return t=c(t),t&&wt.test(t)?t.replace(_t,E):t}function No(t,n,e){return e&&Ze(t,n,e)&&(n=I),t=c(t),t.match(n||Dt)||[]}function Io(t,n,e){return e&&Ze(t,n,e)&&(n=I),_(t)?Ro(t):bn(t,n)}function Co(t){return function(){return t}}function jo(t){return t}function Ro(t){return Dn(xn(t,!0))}function To(t,n){return Wn(t,xn(n,!0))}function Lo(t,n,e){if(null==e){var r=Si(n),i=r?Du(n):I,o=i&&i.length?Sn(n,i):I;(o?o.length:r)||(o=!1,e=n,n=t,t=this)}o||(o=Sn(n,Du(n)));var a=!0,u=-1,c=Oi(t),s=o.length;e===!1?a=!1:Si(e)&&"chain"in e&&(a=e.chain);for(;++u>>1,Aa=9007199254740991,Oa=va&&new va,Sa={};n.support={};n.templateSettings={escape:xt,evaluate:kt,interpolate:Et,variable:"",imports:{_:n}};var Ma=function(){function t(){}return function(n){if(Si(n)){t.prototype=n;var e=new t;t.prototype=I}return e||{}}}(),Ba=he(An),Ua=he(On,!0),Pa=de(),Fa=de(!0),Da=Oa?function(t,n){return Oa.set(t,n),t}:jo,Wa=Oa?function(t){return Oa.get(t)}:Oo,za=Gn("length"),qa=function(){var t=0,n=0;return function(e,r){var i=vu(),o=D-(i-n);if(n=i,o>0){if(++t>=F)return e}else t=0;return Da(e,r)}}(),Ga=yi(function(t,n){return _(t)&&Qe(t)?En(t,Tn(n,!1,!0)):[]}),Va=xe(),Ya=xe(!0),$a=yi(function(t){for(var n=t.length,e=n,r=Wo(l),i=qe(),o=i==a,u=[];e--;){var c=t[e]=Qe(c=t[e])?c:[];r[e]=o&&c.length>=120?ve(e&&c):null}var s=t[0],f=-1,l=s?s.length:0,h=r[0];t:for(;++f2?t[n-2]:I,r=n>1?t[n-1]:I;return n>2&&"function"==typeof e?n-=2:(e=n>1&&"function"==typeof r?(--n,r):I,r=I),t.length=n,Pr(t,e,r)}),nu=yi(function(t){return t=Tn(t),this.thru(function(n){return Zt(Ru(n)?n:[lr(n)],t)})}),eu=yi(function(t,n){return mn(t,Tn(n))}),ru=fe(function(t,n,e){na.call(t,e)?++t[e]:t[e]=1}),iu=be(Ba),ou=be(Ua,!0),au=Ne(nn,Ba),uu=Ne(en,Ua),cu=fe(function(t,n,e){na.call(t,e)?t[e].push(n):t[e]=[n]}),su=fe(function(t,n,e){t[e]=n}),fu=yi(function(t,n,e){var r=-1,i="function"==typeof n,o=tr(n),a=Qe(t)?Wo(t.length):[];return Ba(t,function(t){var u=i?n:o&&null!=t?t[n]:I;a[++r]=u?u.apply(t,e):Ke(t,n,e)}),a}),lu=fe(function(t,n,e){t[e?0:1].push(n)},function(){return[[],[]]}),hu=Le(ln,Ba),du=Le(hn,Ua),pu=yi(function(t,n){if(null==t)return[];var e=n[2];return e&&Ze(n[0],n[1],e)&&(n.length=1),Jn(t,Tn(n),[])}),vu=Ea||function(){return(new zo).getTime()},gu=yi(function(t,n,e){var r=j;if(e.length){var i=w(e,gu.placeholder);r|=O}return Ue(t,r,n,e,i)}),yu=yi(function(t,n){n=n.length?Tn(n):Ki(t);for(var e=-1,r=n.length;++e0||n<0)?new m(e):(t<0?e=e.takeRight(-t):t&&(e=e.drop(t)),n!==I&&(n=+n||0,e=n<0?e.dropRight(-n):e.take(n-t)),e)},m.prototype.takeRightWhile=function(t,n){return this.reverse().takeWhile(t,n).reverse()},m.prototype.toArray=function(){return this.take(ja)},An(m.prototype,function(t,e){var i=/^(?:filter|map|reject)|While$/.test(e),o=/^(?:first|last)$/.test(e),a=n[o?"take"+("last"==e?"Right":""):e];a&&(n.prototype[e]=function(){var n=o?[1]:arguments,e=this.__chain__,u=this.__wrapped__,c=!!this.__actions__.length,s=u instanceof m,f=n[0],l=s||Ru(u);l&&i&&"function"==typeof f&&1!=f.length&&(s=l=!1);var h=function(t){return o&&e?a(t,1)[0]:a.apply(I,fn([t],n))},d={func:qr,args:[h],thisArg:I},p=s&&!c;if(o&&!e)return p?(u=u.clone(),u.__actions__.push(d),t.call(u)):a.call(I,this.value())[0];if(!o&&l){u=p?u:new m(this);var v=t.apply(u,n);return v.__actions__.push(d),new r(v,e)}return this.thru(h)})}),nn(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(t){var e=(/^(?:replace|split)$/.test(t)?Zo:Qo)[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:join|pop|replace|shift)$/.test(t);n.prototype[t]=function(){var t=arguments;return i&&!this.__chain__?e.apply(this.value(),t):this[r](function(n){return e.apply(n,t)})}}),An(m.prototype,function(t,e){var r=n[e];if(r){var i=r.name,o=Sa[i]||(Sa[i]=[]);o.push({name:e,func:r})}}),Sa[Ae(I,R).name]=[{name:"wrapper",func:I}],m.prototype.clone=J,m.prototype.reverse=et,m.prototype.value=it,n.prototype.chain=Gr,n.prototype.commit=Vr,n.prototype.concat=nu,n.prototype.plant=Yr,n.prototype.reverse=$r,n.prototype.toString=Xr,n.prototype.run=n.prototype.toJSON=n.prototype.valueOf=n.prototype.value=Hr,n.prototype.collect=n.prototype.map,n.prototype.head=n.prototype.first,n.prototype.select=n.prototype.filter,n.prototype.tail=n.prototype.rest,n}var I,C="3.10.1",j=1,R=2,T=4,L=8,A=16,O=32,S=64,M=128,B=256,U=30,P="...",F=150,D=16,W=200,z=1,q=2,G="Expected a function",V="__lodash_placeholder__",Y="[object Arguments]",$="[object Array]",X="[object Boolean]",H="[object Date]",K="[object Error]",Q="[object Function]",J="[object Map]",Z="[object Number]",tt="[object Object]",nt="[object RegExp]",et="[object Set]",rt="[object String]",it="[object WeakMap]",ot="[object ArrayBuffer]",at="[object Float32Array]",ut="[object Float64Array]",ct="[object Int8Array]",st="[object Int16Array]",ft="[object Int32Array]",lt="[object Uint8Array]",ht="[object Uint8ClampedArray]",dt="[object Uint16Array]",pt="[object Uint32Array]",vt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_t=/&(?:amp|lt|gt|quot|#39|#96);/g,mt=/[&<>"'`]/g,wt=RegExp(_t.source),bt=RegExp(mt.source),xt=/<%-([\s\S]+?)%>/g,kt=/<%([\s\S]+?)%>/g,Et=/<%=([\s\S]+?)%>/g,Nt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,It=/^\w*$/,Ct=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,jt=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,Rt=RegExp(jt.source),Tt=/[\u0300-\u036f\ufe20-\ufe23]/g,Lt=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ot=/\w*$/,St=/^0[xX]/,Mt=/^\[object .+?Constructor\]$/,Bt=/^\d+$/,Ut=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Pt=/($^)/,Ft=/['\n\r\u2028\u2029\\]/g,Dt=function(){var t="[A-Z\\xc0-\\xd6\\xd8-\\xde]",n="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(t+"+(?="+t+n+")|"+t+"?"+n+"|"+t+"+|[0-9]+","g")}(),Wt=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],zt=-1,qt={};qt[at]=qt[ut]=qt[ct]=qt[st]=qt[ft]=qt[lt]=qt[ht]=qt[dt]=qt[pt]=!0,qt[Y]=qt[$]=qt[ot]=qt[X]=qt[H]=qt[K]=qt[Q]=qt[J]=qt[Z]=qt[tt]=qt[nt]=qt[et]=qt[rt]=qt[it]=!1;var Gt={};Gt[Y]=Gt[$]=Gt[ot]=Gt[X]=Gt[H]=Gt[at]=Gt[ut]=Gt[ct]=Gt[st]=Gt[ft]=Gt[Z]=Gt[tt]=Gt[nt]=Gt[rt]=Gt[lt]=Gt[ht]=Gt[dt]=Gt[pt]=!0,Gt[K]=Gt[Q]=Gt[J]=Gt[et]=Gt[it]=!1;var Vt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Yt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$t={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Xt={"function":!0,object:!0},Ht={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Kt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qt=Xt[typeof r]&&r&&!r.nodeType&&r,Jt=Xt[typeof e]&&e&&!e.nodeType&&e,Zt=Qt&&Jt&&"object"==typeof n&&n&&n.Object&&n,tn=Xt[typeof self]&&self&&self.Object&&self,nn=Xt[typeof window]&&window&&window.Object&&window,en=Jt&&Jt.exports===Qt&&Qt,rn=Zt||nn!==(this&&this.window)&&nn||tn||this,on=N();"function"==typeof t&&"object"==typeof t.amd&&t.amd?(rn._=on,t(function(){return on})):Qt&&Jt?en?(Jt.exports=on)._=on:Qt._=on:rn._=on}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); +e.exports={graphlib:t("./lib/graphlib"),dagre:t("./lib/dagre"),intersect:t("./lib/intersect"),render:t("./lib/render"),util:t("./lib/util"),version:t("./lib/version")}},{"./lib/dagre":8,"./lib/graphlib":9,"./lib/intersect":10,"./lib/render":25,"./lib/util":27,"./lib/version":28}],2:[function(t,e,n){function r(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),o=i.append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");a.applyStyle(o,n[r+"Style"]),n[r+"Class"]&&o.attr("class",n[r+"Class"])}function i(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),o=i.append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");a.applyStyle(o,n[r+"Style"]),n[r+"Class"]&&o.attr("class",n[r+"Class"])}function o(t,e,n,r){var i=t.append("marker").attr("id",e).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),o=i.append("path").attr("d","M 0 5 L 10 5").style("stroke-width",1).style("stroke-dasharray","1,0");a.applyStyle(o,n[r+"Style"]),n[r+"Class"]&&o.attr("class",n[r+"Class"])}var a=t("./util");e.exports={"default":r,normal:r,vee:i,undirected:o}},{"./util":27}],3:[function(t,e,n){function r(t,e){var n=e.nodes().filter(function(t){return i.isSubgraph(e,t)}),r=t.selectAll("g.cluster").data(n,function(t){return t});return r.selectAll("*").remove(),r.enter().append("g").attr("class","cluster").attr("id",function(t){var n=e.node(t);return n.id}).style("opacity",0),r=t.selectAll("g.cluster"),i.applyTransition(r,e).style("opacity",1),r.each(function(t){var n=e.node(t),r=d3.select(this);d3.select(this).append("rect");var i=r.append("g").attr("class","label");o(i,n,n.clusterLabelPos)}),r.selectAll("rect").each(function(t){var n=e.node(t),r=d3.select(this);i.applyStyle(r,n.style)}),i.applyTransition(r.exit(),e).style("opacity",0).remove(),r}var i=t("./util"),o=t("./label/add-label");e.exports=r},{"./label/add-label":18,"./util":27}],4:[function(t,e,n){"use strict";function r(t,e){var n=t.selectAll("g.edgeLabel").data(e.edges(),function(t){return a.edgeToId(t)}).classed("update",!0);return n.selectAll("*").remove(),n.enter().append("g").classed("edgeLabel",!0).style("opacity",0),n=t.selectAll("g.edgeLabel"),n.each(function(t){var n=e.edge(t),r=o(u.select(this),e.edge(t),0,0).classed("label",!0),a=r.node().getBBox();n.labelId&&r.attr("id",n.labelId),i.has(n,"width")||(n.width=a.width),i.has(n,"height")||(n.height=a.height)}),a.applyTransition(n.exit(),e).style("opacity",0).remove(),n}var i=t("./lodash"),o=t("./label/add-label"),a=t("./util"),u=t("./d3");e.exports=r},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],5:[function(t,e,n){"use strict";function r(t,e,n){var r=t.selectAll("g.edgePath").data(e.edges(),function(t){return h.edgeToId(t)}).classed("update",!0);return c(r,e),s(r,e),r=t.selectAll("g.edgePath"),h.applyTransition(r,e).style("opacity",1),r.each(function(t){var n=d.select(this),r=e.edge(t);r.elem=this,r.id&&n.attr("id",r.id),h.applyClass(n,r["class"],(n.classed("update")?"update ":"")+"edgePath")}),r.selectAll("path.path").each(function(t){var n=e.edge(t);n.arrowheadId=f.uniqueId("arrowhead");var r=d.select(this).attr("marker-end",function(){return"url("+i(location.href,n.arrowheadId)+")"}).style("fill","none");h.applyTransition(r,e).attr("d",function(t){return o(e,t)}),h.applyStyle(r,n.style)}),r.selectAll("defs *").remove(),r.selectAll("defs").each(function(t){var r=e.edge(t),i=n[r.arrowhead];i(d.select(this),r.arrowheadId,r,"arrowhead")}),r}function i(t,e){var n=t.split("#")[0];return n+"#"+e}function o(t,e){var n=t.edge(e),r=t.node(e.v),i=t.node(e.w),o=n.points.slice(1,n.points.length-1);return o.unshift(l(r,o[0])),o.push(l(i,o[o.length-1])),a(n,o)}function a(t,e){var n=d.line().x(function(t){return t.x}).y(function(t){return t.y});return n.curve(t.lineCurve),n(e)}function u(t){var e=t.getBBox(),n=t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width/2,e.height/2);return{x:n.e,y:n.f}}function c(t,e){var n=t.enter().append("g").attr("class","edgePath").style("opacity",0);n.append("path").attr("class","path").attr("d",function(t){var n=e.edge(t),r=e.node(t.v).elem,i=f.range(n.points.length).map(function(){return u(r)});return a(n,i)}),n.append("defs")}function s(t,e){var n=t.exit();h.applyTransition(n,e).style("opacity",0).remove(),h.applyTransition(n.select("path.path"),e).attr("d",function(t){var n=e.node(t.v);if(n){var r=f.range(this.getTotalLength()).map(function(){return n});return a({},r)}return d.select(this).attr("d")})}var f=t("./lodash"),l=t("./intersect/intersect-node"),h=t("./util"),d=t("./d3");e.exports=r},{"./d3":7,"./intersect/intersect-node":14,"./lodash":21,"./util":27}],6:[function(t,e,n){"use strict";function r(t,e,n){var r=e.nodes().filter(function(t){return!a.isSubgraph(e,t)}),c=t.selectAll("g.node").data(r,function(t){return t}).classed("update",!0);return c.selectAll("*").remove(),c.enter().append("g").attr("class","node").style("opacity",0),c=t.selectAll("g.node"),c.each(function(t){var r=e.node(t),c=u.select(this);a.applyClass(c,r["class"],(c.classed("update")?"update ":"")+"node");var s=c.append("g").attr("class","label"),f=o(s,r),l=n[r.shape],h=i.pick(f.node().getBBox(),"width","height");r.elem=this,r.id&&c.attr("id",r.id),r.labelId&&s.attr("id",r.labelId),i.has(r,"width")&&(h.width=r.width),i.has(r,"height")&&(h.height=r.height),h.width+=r.paddingLeft+r.paddingRight,h.height+=r.paddingTop+r.paddingBottom,s.attr("transform","translate("+(r.paddingLeft-r.paddingRight)/2+","+(r.paddingTop-r.paddingBottom)/2+")");var d=l(u.select(this),h,r);a.applyStyle(d,r.style);var p=d.node().getBBox();r.width=p.width,r.height=p.height}),a.applyTransition(c.exit(),e).style("opacity",0).remove(),c}var i=t("./lodash"),o=t("./label/add-label"),a=t("./util"),u=t("./d3");e.exports=r},{"./d3":7,"./label/add-label":18,"./lodash":21,"./util":27}],7:[function(t,e,n){e.exports=window.d3},{}],8:[function(t,e,n){var r;if(t)try{r=t("dagre")}catch(i){}r||(r=window.dagre),e.exports=r},{dagre:29}],9:[function(t,e,n){var r;if(t)try{r=t("graphlib")}catch(i){}r||(r=window.graphlib),e.exports=r},{graphlib:59}],10:[function(t,e,n){e.exports={node:t("./intersect-node"),circle:t("./intersect-circle"),ellipse:t("./intersect-ellipse"),polygon:t("./intersect-polygon"),rect:t("./intersect-rect")}},{"./intersect-circle":11,"./intersect-ellipse":12,"./intersect-node":14,"./intersect-polygon":15,"./intersect-rect":16}],11:[function(t,e,n){function r(t,e,n){return i(t,e,e,n)}var i=t("./intersect-ellipse");e.exports=r},{"./intersect-ellipse":12}],12:[function(t,e,n){function r(t,e,n,r){var i=t.x,o=t.y,a=i-r.x,u=o-r.y,c=Math.sqrt(e*e*u*u+n*n*a*a),s=Math.abs(e*n*a/c);r.x0}e.exports=r},{}],14:[function(t,e,n){function r(t,e){return t.intersect(e)}e.exports=r},{}],15:[function(t,e,n){function r(t,e,n){var r=t.x,o=t.y,a=[],u=Number.POSITIVE_INFINITY,c=Number.POSITIVE_INFINITY;e.forEach(function(t){u=Math.min(u,t.x),c=Math.min(c,t.y)});for(var s=r-t.width/2-u,f=o-t.height/2-c,l=0;l1&&a.sort(function(t,e){var r=t.x-n.x,i=t.y-n.y,o=Math.sqrt(r*r+i*i),a=e.x-n.x,u=e.y-n.y,c=Math.sqrt(a*a+u*u);return oMath.abs(a)*s?(u<0&&(s=-s),n=0===u?0:s*a/u,r=s):(a<0&&(c=-c),n=c,r=0===a?0:c*u/a),{x:i+n,y:o+r}}e.exports=r},{}],17:[function(t,e,n){function r(t,e){var n=t.append("foreignObject").attr("width","100000"),r=n.append("xhtml:div");r.attr("xmlns","http://www.w3.org/1999/xhtml");var o=e.label;switch(typeof o){case"function":r.insert(o);break;case"object":r.insert(function(){return o});break;default:r.html(o)}i.applyStyle(r,e.labelStyle),r.style("display","inline-block"),r.style("white-space","nowrap");var a=r.node().getBoundingClientRect();return n.attr("width",a.width).attr("height",a.height),n}var i=t("../util");e.exports=r},{"../util":27}],18:[function(t,e,n){function r(t,e,n){var r=e.label,u=t.append("g");"svg"===e.labelType?a(u,e):"string"!=typeof r||"html"===e.labelType?o(u,e):i(u,e);var c,s=u.node().getBBox();switch(n){case"top":c=-e.height/2;break;case"bottom":c=e.height/2-s.height;break;default:c=-s.height/2}return u.attr("transform","translate("+-s.width/2+","+c+")"),u}var i=t("./add-text-label"),o=t("./add-html-label"),a=t("./add-svg-label");e.exports=r},{"./add-html-label":17,"./add-svg-label":19,"./add-text-label":20}],19:[function(t,e,n){function r(t,e){var n=t;return n.node().appendChild(e.label),i.applyStyle(n,e.labelStyle),n}var i=t("../util");e.exports=r},{"../util":27}],20:[function(t,e,n){function r(t,e){for(var n=t.append("text"),r=i(e.label).split("\n"),a=0;a0;--c)if(r=e[c].dequeue()){i=i.concat(o(t,e,n,r,!0));break}}return i}function o(t,e,n,r,i){var o=i?[]:void 0;return c.each(t.inEdges(r.v),function(r){var a=t.edge(r),c=t.node(r.v);i&&o.push({v:r.v,w:r.w}),c.out-=a,u(e,n,c)}),c.each(t.outEdges(r.v),function(r){var i=t.edge(r),o=r.w,a=t.node(o);a["in"]-=i,u(e,n,a)}),t.removeNode(r.v),o}function a(t,e){var n=new s,r=0,i=0;c.each(t.nodes(),function(t){n.setNode(t,{v:t,"in":0,out:0})}),c.each(t.edges(),function(t){var o=n.edge(t.v,t.w)||0,a=e(t),u=o+a;n.setEdge(t.v,t.w,u),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w)["in"]+=a)});var o=c.range(i+r+3).map(function(){return new f}),a=r+1;return c.each(n.nodes(),function(t){u(o,a,n.node(t))}),{graph:n,buckets:o,zeroIdx:a}}function u(t,e,n){n.out?n["in"]?t[n.out-n["in"]+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}var c=t("./lodash"),s=t("./graphlib").Graph,f=t("./data/list");e.exports=r;var l=c.constant(1)},{"./data/list":33,"./graphlib":35,"./lodash":38}],37:[function(t,e,n){"use strict";function r(t,e){var n=e&&e.debugTiming?O.time:O.notime;n("layout",function(){var e=n(" buildLayoutGraph",function(){return a(t)});n(" runLayout",function(){i(e,n)}),n(" updateInputGraph",function(){o(t,e)})})}function i(t,e){e(" makeSpaceForEdgeLabels",function(){u(t)}),e(" removeSelfEdges",function(){g(t)}),e(" acyclic",function(){x.run(t)}),e(" nestingGraph.run",function(){j.run(t)}),e(" rank",function(){E(O.asNonCompoundGraph(t))}),e(" injectEdgeLabelProxies",function(){c(t)}),e(" removeEmptyRanks",function(){C(t)}),e(" nestingGraph.cleanup",function(){j.cleanup(t)}),e(" normalizeRanks",function(){N(t)}),e(" assignRankMinMax",function(){s(t)}),e(" removeEdgeLabelProxies",function(){f(t)}),e(" normalize.run",function(){k.run(t)}),e(" parentDummyChains",function(){I(t)}),e(" addBorderSegments",function(){R(t)}),e(" order",function(){L(t)}),e(" insertSelfEdges",function(){y(t)}),e(" adjustCoordinateSystem",function(){T.adjust(t)}),e(" position",function(){A(t)}),e(" positionSelfEdges",function(){_(t)}),e(" removeBorderNodes",function(){v(t)}),e(" normalize.undo",function(){k.undo(t)}),e(" fixupEdgeLabelCoords",function(){d(t)}),e(" undoCoordinateSystem",function(){T.undo(t)}),e(" translateGraph",function(){l(t)}),e(" assignNodeIntersects",function(){h(t)}),e(" reversePoints",function(){p(t)}),e(" acyclic.undo",function(){x.undo(t)})}function o(t,e){b.each(t.nodes(),function(n){var r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,e.children(n).length&&(r.width=i.width,r.height=i.height))}),b.each(t.edges(),function(n){var r=t.edge(n),i=e.edge(n);r.points=i.points,b.has(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function a(t){var e=new S({multigraph:!0,compound:!0}),n=w(t.graph());return e.setGraph(b.merge({},B,m(n,M),b.pick(n,P))),b.each(t.nodes(),function(n){var r=w(t.node(n));e.setNode(n,b.defaults(m(r,U),F)),e.setParent(n,t.parent(n))}),b.each(t.edges(),function(n){var r=w(t.edge(n));e.setEdge(n,b.merge({},W,m(r,D),b.pick(r,z)))}),e}function u(t){var e=t.graph();e.ranksep/=2,b.each(t.edges(),function(n){var r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function c(t){b.each(t.edges(),function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i=t.node(e.w),o={rank:(i.rank-r.rank)/2+r.rank,e:e};O.addDummyNode(t,"edge-proxy",o,"_ep")}})}function s(t){var e=0;b.each(t.nodes(),function(n){var r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=b.max(e,r.maxRank))}),t.graph().maxRank=e}function f(t){b.each(t.nodes(),function(e){var n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}function l(t){function e(t){var e=t.x,a=t.y,u=t.width,c=t.height;n=Math.min(n,e-u/2),r=Math.max(r,e+u/2),i=Math.min(i,a-c/2),o=Math.max(o,a+c/2)}var n=Number.POSITIVE_INFINITY,r=0,i=Number.POSITIVE_INFINITY,o=0,a=t.graph(),u=a.marginx||0,c=a.marginy||0;b.each(t.nodes(),function(n){e(t.node(n))}),b.each(t.edges(),function(n){var r=t.edge(n);b.has(r,"x")&&e(r)}),n-=u,i-=c,b.each(t.nodes(),function(e){var r=t.node(e);r.x-=n,r.y-=i}),b.each(t.edges(),function(e){var r=t.edge(e);b.each(r.points,function(t){t.x-=n,t.y-=i}),b.has(r,"x")&&(r.x-=n),b.has(r,"y")&&(r.y-=i)}),a.width=r-n+u,a.height=o-i+c}function h(t){b.each(t.edges(),function(e){var n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(O.intersectRect(o,n)),i.points.push(O.intersectRect(a,r))})}function d(t){b.each(t.edges(),function(e){var n=t.edge(e);if(b.has(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}function p(t){b.each(t.edges(),function(e){var n=t.edge(e);n.reversed&&n.points.reverse()})}function v(t){b.each(t.nodes(),function(e){if(t.children(e).length){var n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(b.last(n.borderLeft)),a=t.node(b.last(n.borderRight));n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),b.each(t.nodes(),function(e){"border"===t.node(e).dummy&&t.removeNode(e)})}function g(t){b.each(t.edges(),function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}function y(t){var e=O.buildLayerMatrix(t);b.each(e,function(e){var n=0;b.each(e,function(e,r){var i=t.node(e);i.order=r+n,b.each(i.selfEdges,function(e){O.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}function _(t){b.each(t.nodes(),function(e){var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,u=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-u},{x:i+5*a/6,y:o-u},{x:i+a,y:o},{x:i+5*a/6,y:o+u},{x:i+2*a/3,y:o+u}],n.label.x=n.x,n.label.y=n.y}})}function m(t,e){return b.mapValues(b.pick(t,e),Number)}function w(t){var e={};return b.each(t,function(t,n){e[n.toLowerCase()]=t}),e}var b=t("./lodash"),x=t("./acyclic"),k=t("./normalize"),E=t("./rank"),N=t("./util").normalizeRanks,I=t("./parent-dummy-chains"),C=t("./util").removeEmptyRanks,j=t("./nesting-graph"),R=t("./add-border-segments"),T=t("./coordinate-system"),L=t("./order"),A=t("./position"),O=t("./util"),S=t("./graphlib").Graph;e.exports=r;var M=["nodesep","edgesep","ranksep","marginx","marginy"],B={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},P=["acyclicer","ranker","rankdir","align"],U=["width","height"],F={width:0,height:0},D=["minlen","weight","width","height","labeloffset"],W={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},z=["labelpos"]},{"./acyclic":30,"./add-border-segments":31,"./coordinate-system":32,"./graphlib":35,"./lodash":38,"./nesting-graph":39,"./normalize":40,"./order":45,"./parent-dummy-chains":50,"./position":52,"./rank":54,"./util":57}],38:[function(t,e,n){var r;if("function"==typeof t)try{r=t("lodash")}catch(i){}r||(r=window._),e.exports=r},{lodash:79}],39:[function(t,e,n){function r(t){var e=s.addDummyNode(t,"root",{},"_root"),n=o(t),r=c.max(n)-1,u=2*r+1;t.graph().nestingRoot=e,c.each(t.edges(),function(e){t.edge(e).minlen*=u});var f=a(t)+1;c.each(t.children(),function(o){i(t,e,u,f,r,n,o)}),t.graph().nodeRankFactor=u}function i(t,e,n,r,o,a,u){var f=t.children(u);if(!f.length)return void(u!==e&&t.setEdge(e,u,{weight:0,minlen:n}));var l=s.addBorderNode(t,"_bt"),h=s.addBorderNode(t,"_bb"),d=t.node(u);t.setParent(l,u),d.borderTop=l,t.setParent(h,u),d.borderBottom=h,c.each(f,function(c){i(t,e,n,r,o,a,c);var s=t.node(c),f=s.borderTop?s.borderTop:c,d=s.borderBottom?s.borderBottom:c,p=s.borderTop?r:2*r,v=f!==d?1:o-a[u]+1;t.setEdge(l,f,{weight:p,minlen:v,nestingEdge:!0}),t.setEdge(d,h,{weight:p,minlen:v,nestingEdge:!0})}),t.parent(u)||t.setEdge(e,l,{weight:0,minlen:o+a[u]})}function o(t){function e(r,i){var o=t.children(r);o&&o.length&&c.each(o,function(t){e(t,i+1)}),n[r]=i}var n={};return c.each(t.children(),function(t){e(t,1)}),n}function a(t){return c.reduce(t.edges(),function(e,n){return e+t.edge(n).weight},0)}function u(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,c.each(t.edges(),function(e){var n=t.edge(e);n.nestingEdge&&t.removeEdge(e)})}var c=t("./lodash"),s=t("./util");e.exports={run:r,cleanup:u}},{"./lodash":38,"./util":57}],40:[function(t,e,n){"use strict";function r(t){t.graph().dummyChains=[],a.each(t.edges(),function(e){i(t,e)})}function i(t,e){var n=e.v,r=t.node(n).rank,i=e.w,o=t.node(i).rank,a=e.name,c=t.edge(e),s=c.labelRank;if(o!==r+1){t.removeEdge(e);var f,l,h;for(h=0,++r;r0;)e%2&&(n+=c[e+1]),e=e-1>>1,c[e]+=t.weight;s+=t.weight*n})),s}var o=t("../lodash");e.exports=r},{"../lodash":38}],45:[function(t,e,n){"use strict";function r(t){var e=p.maxRank(t),n=i(t,u.range(1,e+1),"inEdges"),r=i(t,u.range(e-1,-1,-1),"outEdges"),f=c(t);a(t,f);for(var l,h=Number.POSITIVE_INFINITY,d=0,v=0;v<4;++d,++v){o(d%2?n:r,d%4>=2),f=p.buildLayerMatrix(t);var g=s(t,f);g=t.barycenter)&&o(t,e)}}function n(e){return function(n){n["in"].push(e),0===--n.indegree&&t.push(n)}}for(var r=[];t.length;){var i=t.pop();r.push(i),a.each(i["in"].reverse(),e(i)),a.each(i.out,n(i))}return a.chain(r).filter(function(t){return!t.merged}).map(function(t){return a.pick(t,["vs","i","barycenter","weight"])}).value()}function o(t,e){var n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}var a=t("../lodash");e.exports=r},{"../lodash":38}],48:[function(t,e,n){function r(t,e,n,f){var l=t.children(e),h=t.node(e),d=h?h.borderLeft:void 0,p=h?h.borderRight:void 0,v={};d&&(l=a.filter(l,function(t){return t!==d&&t!==p}));var g=u(t,l);a.each(g,function(e){if(t.children(e.v).length){var i=r(t,e.v,n,f);v[e.v]=i,a.has(i,"barycenter")&&o(e,i)}});var y=c(g,n);i(y,v);var _=s(y,f);if(d&&(_.vs=a.flatten([d,_.vs,p],!0),t.predecessors(d).length)){var m=t.node(t.predecessors(d)[0]),w=t.node(t.predecessors(p)[0]);a.has(_,"barycenter")||(_.barycenter=0,_.weight=0),_.barycenter=(_.barycenter*_.weight+m.order+w.order)/(_.weight+2),_.weight+=2}return _}function i(t,e){a.each(t,function(t){t.vs=a.flatten(t.vs.map(function(t){return e[t]?e[t].vs:t}),!0)})}function o(t,e){a.isUndefined(t.barycenter)?(t.barycenter=e.barycenter,t.weight=e.weight):(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight)}var a=t("../lodash"),u=t("./barycenter"),c=t("./resolve-conflicts"),s=t("./sort");e.exports=r},{"../lodash":38,"./barycenter":42,"./resolve-conflicts":47,"./sort":49}],49:[function(t,e,n){function r(t,e){var n=u.partition(t,function(t){return a.has(t,"barycenter")}),r=n.lhs,c=a.sortBy(n.rhs,function(t){return-t.i}),s=[],f=0,l=0,h=0;r.sort(o(!!e)),h=i(s,c,h),a.each(r,function(t){h+=t.vs.length,s.push(t.vs),f+=t.barycenter*t.weight,l+=t.weight,h=i(s,c,h)});var d={vs:a.flatten(s,!0)};return l&&(d.barycenter=f/l,d.weight=l),d}function i(t,e,n){for(var r;e.length&&(r=a.last(e)).i<=n;)e.pop(),t.push(r.vs),n++;return n}function o(t){return function(e,n){return e.barycentern.barycenter?1:t?n.i-e.i:e.i-n.i}}var a=t("../lodash"),u=t("../util");e.exports=r},{"../lodash":38,"../util":57}],50:[function(t,e,n){function r(t){var e=o(t);a.each(t.graph().dummyChains,function(n){for(var r=t.node(n),o=r.edgeObj,a=i(t,e,o.v,o.w),u=a.path,c=a.lca,s=0,f=u[s],l=!0;n!==o.w;){if(r=t.node(n),l){for(;(f=u[s])!==c&&t.node(f).maxRankc||s>e[i].lim));for(o=i,i=r;(i=t.parent(i))!==o;)u.push(i);return{path:a.concat(u.reverse()),lca:o}}function o(t){function e(i){var o=r;a.each(t.children(i),e),n[i]={low:o,lim:r++}}var n={},r=0;return a.each(t.children(),e),n}var a=t("./lodash");e.exports=r},{"./lodash":38}],51:[function(t,e,n){"use strict";function r(t,e){function n(e,n){var i=0,u=0,c=e.length,s=y.last(n);return y.each(n,function(e,f){var l=o(t,e),h=l?t.node(l).order:c;(l||e===s)&&(y.each(n.slice(u,f+1),function(e){y.each(t.predecessors(e),function(n){var o=t.node(n),u=o.order;!(uu)&&a(i,e,c)})})}function r(e,r){var i,o=-1,a=0;return y.each(r,function(u,c){if("border"===t.node(u).dummy){var s=t.predecessors(u);s.length&&(i=t.node(s[0]).order,n(r,a,c,o,i),a=c,o=i)}n(r,a,r.length,i,e.length)}),r}var i={};return y.reduce(e,r),i}function o(t,e){if(t.node(e).dummy)return y.find(t.predecessors(e),function(e){return t.node(e).dummy})}function a(t,e,n){if(e>n){var r=e;e=n,n=r}var i=t[e];i||(t[e]=i={}),i[n]=!0}function u(t,e,n){if(e>n){var r=e;e=n,n=r}return y.has(t[e],n)}function c(t,e,n,r){var i={},o={},a={};return y.each(e,function(t){y.each(t,function(t,e){i[t]=t,o[t]=t,a[t]=e})}),y.each(e,function(t){var e=-1;y.each(t,function(t){var c=r(t);if(c.length){c=y.sortBy(c,function(t){return a[t]});for(var s=(c.length-1)/2,f=Math.floor(s),l=Math.ceil(s);f<=l;++f){var h=c[f];o[t]===t&&ea.lim&&(u=a,c=!0);var s=v.filter(e.edges(),function(e){return c===p(t,t.node(e.v),u)&&c!==p(t,t.node(e.w),u)});return v.min(s,function(t){return y(e,t)})}function l(t,e,n,r){var o=n.v,a=n.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),u(t),i(t,e),h(t,e)}function h(t,e){var n=v.find(t.nodes(),function(t){return!e.node(t).parent}),r=m(t,n);r=r.slice(1),v.each(r,function(n){var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})}function d(t,e,n){return t.hasEdge(e,n)}function p(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}var v=t("../lodash"),g=t("./feasible-tree"),y=t("./util").slack,_=t("./util").longestPath,m=t("../graphlib").alg.preorder,w=t("../graphlib").alg.postorder,b=t("../util").simplify;e.exports=r,r.initLowLimValues=u,r.initCutValues=i,r.calcCutValue=a,r.leaveEdge=s,r.enterEdge=f,r.exchangeEdges=l},{"../graphlib":35,"../lodash":38,"../util":57,"./feasible-tree":53,"./util":56}],56:[function(t,e,n){"use strict";function r(t){function e(r){var i=t.node(r);if(o.has(n,r))return i.rank;n[r]=!0;var a=o.min(o.map(t.outEdges(r),function(n){return e(n.w)-t.edge(n).minlen}));return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a}var n={};o.each(t.sources(),e)}function i(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var o=t("../lodash");e.exports={longestPath:r,slack:i}},{"../lodash":38}],57:[function(t,e,n){"use strict";function r(t,e,n,r){var i;do i=y.uniqueId(r);while(t.hasNode(i));return n.dummy=e,t.setNode(i,n),i}function i(t){var e=(new _).setGraph(t.graph());return y.each(t.nodes(),function(n){e.setNode(n,t.node(n))}),y.each(t.edges(),function(n){var r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e}function o(t){var e=new _({multigraph:t.isMultigraph()}).setGraph(t.graph());return y.each(t.nodes(),function(n){t.children(n).length||e.setNode(n,t.node(n))}),y.each(t.edges(),function(n){e.setEdge(n,t.edge(n))}),e}function a(t){var e=y.map(t.nodes(),function(e){var n={};return y.each(t.outEdges(e),function(e){n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return y.zipObject(t.nodes(),e)}function u(t){var e=y.map(t.nodes(),function(e){var n={};return y.each(t.inEdges(e),function(e){n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return y.zipObject(t.nodes(),e)}function c(t,e){var n=t.x,r=t.y,i=e.x-n,o=e.y-r,a=t.width/2,u=t.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var c,s;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),c=u*i/o,s=u):(i<0&&(a=-a),c=a,s=a*o/i),{x:n+c,y:r+s}}function s(t){var e=y.map(y.range(d(t)+1),function(){return[]});return y.each(t.nodes(),function(n){var r=t.node(n),i=r.rank;y.isUndefined(i)||(e[i][r.order]=n)}),e}function f(t){var e=y.min(y.map(t.nodes(),function(e){return t.node(e).rank}));y.each(t.nodes(),function(n){var r=t.node(n);y.has(r,"rank")&&(r.rank-=e)})}function l(t){var e=y.min(y.map(t.nodes(),function(e){return t.node(e).rank})),n=[];y.each(t.nodes(),function(r){var i=t.node(r).rank-e;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=t.graph().nodeRankFactor;y.each(n,function(e,n){y.isUndefined(e)&&n%i!==0?--r:r&&y.each(e,function(e){t.node(e).rank+=r})})}function h(t,e,n,i){var o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=i),r(t,"border",o,e)}function d(t){return y.max(y.map(t.nodes(),function(e){var n=t.node(e).rank;if(!y.isUndefined(n))return n}))}function p(t,e){var n={lhs:[],rhs:[]};return y.each(t,function(t){e(t)?n.lhs.push(t):n.rhs.push(t)}),n}function v(t,e){var n=y.now();try{return e()}finally{console.log(t+" time: "+(y.now()-n)+"ms")}}function g(t,e){return e()}var y=t("./lodash"),_=t("./graphlib").Graph;e.exports={addDummyNode:r,simplify:i,asNonCompoundGraph:o,successorWeights:a,predecessorWeights:u,intersectRect:c,buildLayerMatrix:s,normalizeRanks:f,removeEmptyRanks:l,addBorderNode:h,maxRank:d,partition:p,time:v,notime:g}},{"./graphlib":35,"./lodash":38}],58:[function(t,e,n){e.exports="0.7.4"},{}],59:[function(t,e,n){var r=t("./lib");e.exports={Graph:r.Graph,json:t("./lib/json"),alg:t("./lib/alg"),version:r.version}},{"./lib":75,"./lib/alg":66,"./lib/json":76}],60:[function(t,e,n){function r(t){function e(o){i.has(r,o)||(r[o]=!0,n.push(o),i.each(t.successors(o),e),i.each(t.predecessors(o),e))}var n,r={},o=[];return i.each(t.nodes(),function(t){n=[],e(t),n.length&&o.push(n)}),o}var i=t("../lodash");e.exports=r},{"../lodash":77}],61:[function(t,e,n){function r(t,e,n){o.isArray(e)||(e=[e]);var r=[],a={};return o.each(e,function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);i(t,e,"post"===n,a,r)}),r}function i(t,e,n,r,a){o.has(r,e)||(r[e]=!0,n||a.push(e),o.each(t.neighbors(e),function(e){i(t,e,n,r,a)}),n&&a.push(e))}var o=t("../lodash");e.exports=r},{"../lodash":77}],62:[function(t,e,n){function r(t,e,n){return o.transform(t.nodes(),function(r,o){r[o]=i(t,o,e,n)},{})}var i=t("./dijkstra"),o=t("../lodash");e.exports=r},{"../lodash":77,"./dijkstra":63}],63:[function(t,e,n){function r(t,e,n,r){return i(t,String(e),n||u,r||function(e){return t.outEdges(e)})}function i(t,e,n,r){var i,o,u={},c=new a,s=function(t){var e=t.v!==i?t.v:t.w,r=u[e],a=n(t),s=o.distance+a;if(a<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+a);s0&&(i=c.removeMin(),o=u[i],o.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(s);return u}var o=t("../lodash"),a=t("../data/priority-queue");e.exports=r;var u=o.constant(1)},{"../data/priority-queue":73,"../lodash":77}],64:[function(t,e,n){function r(t){return i.filter(o(t),function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}var i=t("../lodash"),o=t("./tarjan");e.exports=r},{"../lodash":77,"./tarjan":71}],65:[function(t,e,n){function r(t,e,n){return i(t,e||a,n||function(e){return t.outEdges(e)})}function i(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],a=o[n],u=r.distance+i.distance;u0;){if(r=s.removeMin(),i.has(c,r))u.setEdge(r,c[r]);else{if(f)throw new Error("Input graph is not connected: "+t);f=!0}t.nodeEdges(r).forEach(n)}return u}var i=t("../lodash"),o=t("../graph"),a=t("../data/priority-queue");e.exports=r},{"../data/priority-queue":73,"../graph":74,"../lodash":77}],71:[function(t,e,n){function r(t){function e(u){var c=o[u]={onStack:!0,lowlink:n,index:n++};if(r.push(u),t.successors(u).forEach(function(t){i.has(o,t)?o[t].onStack&&(c.lowlink=Math.min(c.lowlink,o[t].index)):(e(t),c.lowlink=Math.min(c.lowlink,o[t].lowlink))}),c.lowlink===c.index){var s,f=[];do s=r.pop(),o[s].onStack=!1,f.push(s);while(u!==s);a.push(f)}}var n=0,r=[],o={},a=[];return t.nodes().forEach(function(t){i.has(o,t)||e(t)}),a}var i=t("../lodash");e.exports=r},{"../lodash":77}],72:[function(t,e,n){function r(t){function e(u){if(o.has(r,u))throw new i;o.has(n,u)||(r[u]=!0,n[u]=!0,o.each(t.predecessors(u),e),delete r[u],a.push(u))}var n={},r={},a=[];if(o.each(t.sinks(),e),o.size(n)!==t.nodeCount())throw new i;return a}function i(){}var o=t("../lodash");e.exports=r,r.CycleException=i},{"../lodash":77}],73:[function(t,e,n){function r(){this._arr=[],this._keyIndices={}}var i=t("../lodash");e.exports=r,r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(t){return t.key})},r.prototype.has=function(t){return i.has(this._keyIndices,t)},r.prototype.priority=function(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority},r.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(t,e){var n=this._keyIndices;if(t=String(t),!i.has(n,t)){var r=this._arr,o=r.length;return n[t]=o,r.push({key:t,priority:e}),this._decrease(o),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key},r.prototype.decrease=function(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)},r.prototype._heapify=function(t){var e=this._arr,n=2*t,r=n+1,i=t;n>1,!(n[e].priorityo){var a=i;i=o,o=a}return i+h+o+h+(s.isUndefined(r)?f:r)}function u(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var u={v:i,w:o};return r&&(u.name=r),u}function c(t,e){return a(t,e.v,e.w,e.name)}var s=t("./lodash");e.exports=r;var f="\0",l="\0",h="";r.prototype._nodeCount=0,r.prototype._edgeCount=0,r.prototype.isDirected=function(){return this._isDirected},r.prototype.isMultigraph=function(){return this._isMultigraph},r.prototype.isCompound=function(){return this._isCompound},r.prototype.setGraph=function(t){return this._label=t,this},r.prototype.graph=function(){return this._label},r.prototype.setDefaultNodeLabel=function(t){return s.isFunction(t)||(t=s.constant(t)),this._defaultNodeLabelFn=t,this},r.prototype.nodeCount=function(){return this._nodeCount},r.prototype.nodes=function(){return s.keys(this._nodes)},r.prototype.sources=function(){return s.filter(this.nodes(),function(t){return s.isEmpty(this._in[t])},this)},r.prototype.sinks=function(){return s.filter(this.nodes(),function(t){return s.isEmpty(this._out[t])},this)},r.prototype.setNodes=function(t,e){var n=arguments;return s.each(t,function(t){n.length>1?this.setNode(t,e):this.setNode(t)},this),this},r.prototype.setNode=function(t,e){return s.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=l,this._children[t]={},this._children[l][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},r.prototype.node=function(t){return this._nodes[t]},r.prototype.hasNode=function(t){return s.has(this._nodes,t)},r.prototype.removeNode=function(t){var e=this;if(s.has(this._nodes,t)){var n=function(t){e.removeEdge(e._edgeObjs[t])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],s.each(this.children(t),function(t){this.setParent(t)},this),delete this._children[t]),s.each(s.keys(this._in[t]),n),delete this._in[t],delete this._preds[t],s.each(s.keys(this._out[t]),n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},r.prototype.setParent=function(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(s.isUndefined(e))e=l;else{e+="";for(var n=e;!s.isUndefined(n);n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this},r.prototype._removeFromParentsChildList=function(t){delete this._children[this._parent[t]][t]},r.prototype.parent=function(t){if(this._isCompound){var e=this._parent[t];if(e!==l)return e}},r.prototype.children=function(t){if(s.isUndefined(t)&&(t=l),this._isCompound){var e=this._children[t];if(e)return s.keys(e)}else{if(t===l)return this.nodes();if(this.hasNode(t))return[]}},r.prototype.predecessors=function(t){var e=this._preds[t];if(e)return s.keys(e)},r.prototype.successors=function(t){var e=this._sucs[t];if(e)return s.keys(e)},r.prototype.neighbors=function(t){var e=this.predecessors(t);if(e)return s.union(e,this.successors(t))},r.prototype.filterNodes=function(t){function e(t){var o=r.parent(t);return void 0===o||n.hasNode(o)?(i[t]=o,o):o in i?i[o]:e(o)}var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph()),s.each(this._nodes,function(e,r){t(r)&&n.setNode(r,e)},this),s.each(this._edgeObjs,function(t){n.hasNode(t.v)&&n.hasNode(t.w)&&n.setEdge(t,this.edge(t))},this);var r=this,i={};return this._isCompound&&s.each(n.nodes(),function(t){n.setParent(t,e(t))}),n},r.prototype.setDefaultEdgeLabel=function(t){return s.isFunction(t)||(t=s.constant(t)),this._defaultEdgeLabelFn=t,this},r.prototype.edgeCount=function(){return this._edgeCount},r.prototype.edges=function(){return s.values(this._edgeObjs)},r.prototype.setPath=function(t,e){var n=this,r=arguments;return s.reduce(t,function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i}),this},r.prototype.setEdge=function(){var t,e,n,r,o=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(t=c.v,e=c.w,n=c.name,2===arguments.length&&(r=arguments[1],o=!0)):(t=c,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],o=!0)),t=""+t,e=""+e,s.isUndefined(n)||(n=""+n);var f=a(this._isDirected,t,e,n);if(s.has(this._edgeLabels,f))return o&&(this._edgeLabels[f]=r),this;if(!s.isUndefined(n)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[f]=o?r:this._defaultEdgeLabelFn(t,e,n);var l=u(this._isDirected,t,e,n);return t=l.v,e=l.w,Object.freeze(l),this._edgeObjs[f]=l,i(this._preds[e],t),i(this._sucs[t],e),this._in[e][f]=l,this._out[t][f]=l,this._edgeCount++,this},r.prototype.edge=function(t,e,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):a(this._isDirected,t,e,n);return this._edgeLabels[r]},r.prototype.hasEdge=function(t,e,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):a(this._isDirected,t,e,n);return s.has(this._edgeLabels,r)},r.prototype.removeEdge=function(t,e,n){var r=1===arguments.length?c(this._isDirected,arguments[0]):a(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[e],t),o(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this},r.prototype.inEdges=function(t,e){var n=this._in[t];if(n){var r=s.values(n);return e?s.filter(r,function(t){return t.v===e}):r}},r.prototype.outEdges=function(t,e){var n=this._out[t];if(n){var r=s.values(n);return e?s.filter(r,function(t){return t.w===e}):r}},r.prototype.nodeEdges=function(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},{"./lodash":77}],75:[function(t,e,n){e.exports={Graph:t("./graph"),version:t("./version")}},{"./graph":74,"./version":78}],76:[function(t,e,n){function r(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:i(t),edges:o(t)};return u.isUndefined(t.graph())||(e.value=u.clone(t.graph())),e}function i(t){return u.map(t.nodes(),function(e){var n=t.node(e),r=t.parent(e),i={v:e};return u.isUndefined(n)||(i.value=n),u.isUndefined(r)||(i.parent=r),i})}function o(t){return u.map(t.edges(),function(e){var n=t.edge(e),r={v:e.v,w:e.w};return u.isUndefined(e.name)||(r.name=e.name),u.isUndefined(n)||(r.value=n),r})}function a(t){var e=new c(t.options).setGraph(t.value);return u.each(t.nodes,function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),u.each(t.edges,function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}var u=t("./lodash"),c=t("./graph");e.exports={write:r,read:a}},{"./graph":74,"./lodash":77}],77:[function(t,e,n){arguments[4][38][0].apply(n,arguments)},{dup:38,lodash:79}],78:[function(t,e,n){e.exports="1.0.7"},{}],79:[function(e,n,r){(function(e){(function(){function i(t,e){if(t!==e){var n=null===t,r=t===I,i=t===t,o=null===e,a=e===I,u=e===e;if(t>e&&!o||!i||n&&!a&&u||r&&u)return 1;if(t-1;);return n}function f(t,e){for(var n=t.length;n--&&e.indexOf(t.charAt(n))>-1;);return n}function l(t,e){return i(t.criteria,e.criteria)||t.index-e.index}function h(t,e,n){for(var r=-1,o=t.criteria,a=e.criteria,u=o.length,c=n.length;++r=c)return s;var f=n[r];return s*("asc"===f||f===!0?1:-1)}}return t.index-e.index}function d(t){return Vt[t]}function p(t){return Yt[t]}function v(t,e,n){return e?t=Ht[t]:n&&(t=Kt[t]),"\\"+t}function g(t){return"\\"+Kt[t]}function y(t,e,n){for(var r=t.length,i=e+(n?0:-1);n?i--:++i=9&&t<=13||32==t||160==t||5760==t||6158==t||t>=8192&&(t<=8202||8232==t||8233==t||8239==t||8287==t||12288==t||65279==t)}function w(t,e){for(var n=-1,r=t.length,i=-1,o=[];++n=W?vn(e):null,s=e.length;c&&(o=Qt,u=!1,e=c);t:for(;++ii?0:i+n),r=r===I||r>i?i:+r||0,r<0&&(r+=i),i=n>r?0:r>>>0,n>>>=0;ni?0:i+e),n=n===I||n>i?i:+n||0,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Wo(i);++r=W,c=u?vn():null,s=[];c?(r=Qt,o=!1):(u=!1,c=e?[]:s);t:for(;++n>>1,a=t[o];(n?a<=e:a2?n[i-2]:I,a=i>2?n[2]:I,u=i>1?n[i-1]:I;for("function"==typeof o?(o=an(o,u,5),i-=2):(o="function"==typeof u?u:I,i-=o?1:0),a&&Zn(n[0],n[1],a)&&(o=i<3?I:o,i=1);++r-1?n[a]:I}return je(n,r,t)}}function xn(t){return function(e,n,r){return e&&e.length?(n=Wn(n,r,3),o(e,n,t)):-1}}function kn(t){return function(e,n,r){return n=Wn(n,r,3),je(e,n,t,!0)}}function En(t){return function(){for(var e,n=arguments.length,i=t?n:-1,o=0,a=Wo(n);t?i--:++i=W)return e.plant(r).value();for(var i=0,o=n?a[i].apply(this,t):r;++i=e||!wa(e))return"";var i=e-r;return n=null==n?" ":n+"",yo(n,ga(i/n.length)).slice(0,i)}function Sn(t,e,n,r){function i(){for(var e=-1,u=arguments.length,c=-1,s=r.length,f=Wo(s+u);++cc))return!1;for(;++u-1&&t%1==0&&t-1&&t%1==0&&t<=Aa}function rr(t){return t===t&&!Si(t)}function ir(t,e){var n=t[1],r=e[1],i=n|r,o=i-1;)da.call(e,o,1);return e}function Rr(t,e,n){var r=[];if(!t||!t.length)return r;var i=-1,o=[],a=t.length;for(e=Wn(e,n,3);++i-1:!!i&&qn(t,e,n)>-1}function ti(t,e,n){var r=Ru(t)?ce:Ue;return e=Wn(e,n,3),r(t,e)}function ei(t,e){return ti(t,So(e))}function ni(t,e,n){var r=Ru(t)?ue:Ce;return e=Wn(e,n,3),r(t,function(t,n,r){return!e(t,n,r)})}function ri(t,e,n){if(n?Zn(t,e,n):null==e){t=fr(t);var r=t.length;return r>0?t[Ye(0,r-1)]:I}var i=-1,o=$i(t),r=o.length,a=r-1;for(e=ka(e<0?0:+e||0,r);++i0&&(n=e.apply(this,arguments)),t<=1&&(e=I),n}}function di(t,e,n){function r(){d&&ua(d),s&&ua(s),v=0,s=d=p=I}function i(e,n){n&&ua(n),s=d=p=I,e&&(v=vu(),f=t.apply(h,c),d||s||(c=h=I))}function o(){var t=e-(vu()-l);t<=0||t>e?i(p,s):d=ha(o,t)}function a(){i(y,d)}function u(){if(c=arguments,l=vu(),h=this,p=y&&(d||!_),g===!1)var n=_&&!d;else{s||_||(v=l);var r=g-(l-v),i=r<=0||r>g;i?(s&&(s=ua(s)),v=l,f=t.apply(h,c)):s||(s=ha(a,r))}return i&&d?d=ua(d):d||e===g||(d=ha(o,e)),n&&(i=!0,f=t.apply(h,c)),!i||d||s||(c=h=I),f}var c,s,f,l,h,d,p,v=0,g=!1,y=!0;if("function"!=typeof t)throw new Ko(G);if(e=e<0?0:+e||0,n===!0){var _=!0;y=!1}else Si(n)&&(_=!!n.leading,g="maxWait"in n&&xa(+n.maxWait||0,e),y="trailing"in n?!!n.trailing:y);return u.cancel=r,u}function pi(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new Ko(G);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new pi.Cache,n}function vi(t){if("function"!=typeof t)throw new Ko(G);return function(){return!t.apply(this,arguments)}}function gi(t){return hi(2,t)}function yi(t,e){if("function"!=typeof t)throw new Ko(G);return e=xa(e===I?t.length-1:+e||0,0),function(){for(var n=arguments,r=-1,i=xa(n.length-e,0),o=Wo(i);++re}function Ei(t,e){return t>=e}function Ni(t){return _(t)&&Qn(t)&&ea.call(t,"callee")&&!fa.call(t,"callee")}function Ii(t){return t===!0||t===!1||_(t)&&ra.call(t)==X}function Ci(t){return _(t)&&ra.call(t)==H}function ji(t){return!!t&&1===t.nodeType&&_(t)&&!Di(t)}function Ri(t){return null==t||(Qn(t)&&(Ru(t)||zi(t)||Ni(t)||_(t)&&Oi(t.splice))?!t.length:!Du(t).length)}function Ti(t,e,n,r){n="function"==typeof n?an(n,r,3):I;var i=n?n(t,e):I;return i===I?Me(t,e,n):!!i}function Li(t){return _(t)&&"string"==typeof t.message&&ra.call(t)==K}function Ai(t){return"number"==typeof t&&wa(t)}function Oi(t){return Si(t)&&ra.call(t)==Q}function Si(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Mi(t,e,n,r){return n="function"==typeof n?an(n,r,3):I,Pe(t,Gn(e),n)}function Bi(t){return Fi(t)&&t!=+t}function Pi(t){return null!=t&&(Oi(t)?oa.test(ta.call(t)):_(t)&&Mt.test(t))}function Ui(t){return null===t}function Fi(t){return"number"==typeof t||_(t)&&ra.call(t)==Z}function Di(t){var e;if(!_(t)||ra.call(t)!=tt||Ni(t)||!ea.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var n;return Te(t,function(t,e){n=e}),n===I||ea.call(t,n)}function Wi(t){return Si(t)&&ra.call(t)==et}function zi(t){return"string"==typeof t||_(t)&&ra.call(t)==rt}function qi(t){return _(t)&&nr(t.length)&&!!qt[ra.call(t)]}function Gi(t){return t===I}function Vi(t,e){return t0;++r=ka(e,n)&&t=0&&t.indexOf(e,n)==n}function ho(t){return t=c(t),t&&bt.test(t)?t.replace(mt,p):t}function po(t){return t=c(t),t&&Rt.test(t)?t.replace(jt,v):t||"(?:)"}function vo(t,e,n){t=c(t),e=+e;var r=t.length;if(r>=e||!wa(e))return t;var i=(e-r)/2,o=_a(i),a=ga(i);return n=On("",a,n),n.slice(0,o)+t+n}function go(t,e,n){return(n?Zn(t,e,n):null==e)?e=0:e&&(e=+e),t=wo(t),Na(t,e||(St.test(t)?16:10))}function yo(t,e){var n="";if(t=c(t),e=+e,e<1||!t||!wa(e))return n;do e%2&&(n+=t),e=_a(e/2),t+=t;while(e);return n}function _o(t,e,n){return t=c(t),n=null==n?0:ka(n<0?0:+n||0,t.length),t.lastIndexOf(e,n)==n}function mo(t,n,r){var i=e.templateSettings;r&&Zn(t,n,r)&&(n=r=I),t=c(t),n=ge(ye({},r||n),i,ve);var o,a,u=ge(ye({},n.imports),i.imports,ve),s=Du(u),f=tn(u,s),l=0,h=n.interpolate||Ut,d="__p += '",p=Xo((n.escape||Ut).source+"|"+h.source+"|"+(h===Et?At:Ut).source+"|"+(n.evaluate||Ut).source+"|$","g"),v="//# sourceURL="+("sourceURL"in n?n.sourceURL:"lodash.templateSources["+ ++zt+"]")+"\n";t.replace(p,function(e,n,r,i,u,c){return r||(r=i),d+=t.slice(l,c).replace(Ft,g),n&&(o=!0,d+="' +\n__e("+n+") +\n'"),u&&(a=!0,d+="';\n"+u+";\n__p += '"),r&&(d+="' +\n((__t = ("+r+")) == null ? '' : __t) +\n'"),l=c+e.length,e}),d+="';\n";var y=n.variable;y||(d="with (obj) {\n"+d+"\n}\n"),d=(a?d.replace(vt,""):d).replace(gt,"$1").replace(yt,"$1;"),d="function("+(y||"obj")+") {\n"+(y?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(o?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var _=Qu(function(){return Go(s,v+"return "+d).apply(I,f)});if(_.source=d,Li(_))throw _;return _}function wo(t,e,n){var r=t;return(t=c(t))?(n?Zn(r,e,n):null==e)?t.slice(x(t),k(t)+1):(e+="",t.slice(s(t,e),f(t,e)+1)):t}function bo(t,e,n){var r=t;return t=c(t),t?(n?Zn(r,e,n):null==e)?t.slice(x(t)):t.slice(s(t,e+"")):t}function xo(t,e,n){var r=t;return t=c(t),t?(n?Zn(r,e,n):null==e)?t.slice(0,k(t)+1):t.slice(0,f(t,e+"")+1):t}function ko(t,e,n){n&&Zn(t,e,n)&&(e=I);var r=P,i=U;if(null!=e)if(Si(e)){var o="separator"in e?e.separator:o;r="length"in e?+e.length||0:r,i="omission"in e?c(e.omission):i}else r=+e||0;if(t=c(t),r>=t.length)return t;var a=r-i.length;if(a<1)return i;var u=t.slice(0,a);if(null==o)return u+i;if(Wi(o)){if(t.slice(a).search(o)){var s,f,l=t.slice(0,a);for(o.global||(o=Xo(o.source,(Ot.exec(o)||"")+"g")),o.lastIndex=0;s=o.exec(l);)f=s.index;u=u.slice(0,null==f?a:f)}}else if(t.indexOf(o,a)!=a){var h=u.lastIndexOf(o);h>-1&&(u=u.slice(0,h))}return u+i}function Eo(t){return t=c(t),t&&wt.test(t)?t.replace(_t,E):t}function No(t,e,n){return n&&Zn(t,e,n)&&(e=I),t=c(t),t.match(e||Dt)||[]}function Io(t,e,n){return n&&Zn(t,e,n)&&(e=I),_(t)?Ro(t):we(t,e)}function Co(t){return function(){return t}}function jo(t){return t}function Ro(t){return Fe(be(t,!0))}function To(t,e){return De(t,be(e,!0))}function Lo(t,e,n){if(null==n){var r=Si(e),i=r?Du(e):I,o=i&&i.length?Oe(e,i):I;(o?o.length:r)||(o=!1,n=e,e=t,t=this)}o||(o=Oe(e,Du(e)));var a=!0,u=-1,c=Oi(t),s=o.length;n===!1?a=!1:Si(n)&&"chain"in n&&(a=n.chain);for(;++u>>1,Aa=9007199254740991,Oa=va&&new va,Sa={};e.support={};e.templateSettings={escape:xt,evaluate:kt,interpolate:Et,variable:"",imports:{_:e}};var Ma=function(){function t(){}return function(e){if(Si(e)){t.prototype=e;var n=new t;t.prototype=I}return n||{}}}(),Ba=hn(Le),Pa=hn(Ae,!0),Ua=dn(),Fa=dn(!0),Da=Oa?function(t,e){return Oa.set(t,e),t}:jo,Wa=Oa?function(t){return Oa.get(t)}:Oo,za=qe("length"),qa=function(){var t=0,e=0;return function(n,r){var i=vu(),o=D-(i-e);if(e=i,o>0){if(++t>=F)return n}else t=0;return Da(n,r)}}(),Ga=yi(function(t,e){return _(t)&&Qn(t)?ke(t,Re(e,!1,!0)):[]}),Va=xn(),Ya=xn(!0),$a=yi(function(t){for(var e=t.length,n=e,r=Wo(l),i=qn(),o=i==a,u=[];n--;){var c=t[n]=Qn(c=t[n])?c:[];r[n]=o&&c.length>=120?vn(n&&c):null}var s=t[0],f=-1,l=s?s.length:0,h=r[0];t:for(;++f2?t[e-2]:I,r=e>1?t[e-1]:I;return e>2&&"function"==typeof n?e-=2:(n=e>1&&"function"==typeof r?(--e,r):I,r=I),t.length=e,Ur(t,n,r)}),eu=yi(function(t){return t=Re(t),this.thru(function(e){return Zt(Ru(e)?e:[lr(e)],t)})}),nu=yi(function(t,e){return _e(t,Re(e))}),ru=fn(function(t,e,n){ea.call(t,n)?++t[n]:t[n]=1}),iu=bn(Ba),ou=bn(Pa,!0),au=Nn(ee,Ba),uu=Nn(ne,Pa),cu=fn(function(t,e,n){ea.call(t,n)?t[n].push(e):t[n]=[e]}),su=fn(function(t,e,n){t[n]=e}),fu=yi(function(t,e,n){var r=-1,i="function"==typeof e,o=tr(e),a=Qn(t)?Wo(t.length):[];return Ba(t,function(t){var u=i?e:o&&null!=t?t[e]:I;a[++r]=u?u.apply(t,n):Kn(t,e,n)}),a}),lu=fn(function(t,e,n){t[n?0:1].push(e)},function(){return[[],[]]}),hu=Ln(fe,Ba),du=Ln(le,Pa),pu=yi(function(t,e){if(null==t)return[];var n=e[2];return n&&Zn(e[0],e[1],n)&&(e.length=1),Qe(t,Re(e),[])}),vu=Ea||function(){return(new zo).getTime()},gu=yi(function(t,e,n){var r=j;if(n.length){var i=w(n,gu.placeholder);r|=O}return Pn(t,r,e,n,i)}),yu=yi(function(t,e){e=e.length?Re(e):Ki(t);for(var n=-1,r=e.length;++n0||e<0)?new m(n):(t<0?n=n.takeRight(-t):t&&(n=n.drop(t)),e!==I&&(e=+e||0,n=e<0?n.dropRight(-e):n.take(e-t)),n)},m.prototype.takeRightWhile=function(t,e){return this.reverse().takeWhile(t,e).reverse()},m.prototype.toArray=function(){return this.take(ja)},Le(m.prototype,function(t,n){var i=/^(?:filter|map|reject)|While$/.test(n),o=/^(?:first|last)$/.test(n),a=e[o?"take"+("last"==n?"Right":""):n];a&&(e.prototype[n]=function(){var e=o?[1]:arguments,n=this.__chain__,u=this.__wrapped__,c=!!this.__actions__.length,s=u instanceof m,f=e[0],l=s||Ru(u);l&&i&&"function"==typeof f&&1!=f.length&&(s=l=!1);var h=function(t){return o&&n?a(t,1)[0]:a.apply(I,se([t],e))},d={func:qr,args:[h],thisArg:I},p=s&&!c;if(o&&!n)return p?(u=u.clone(),u.__actions__.push(d),t.call(u)):a.call(I,this.value())[0];if(!o&&l){u=p?u:new m(this);var v=t.apply(u,e);return v.__actions__.push(d),new r(v,n)}return this.thru(h)})}),ee(["join","pop","push","replace","shift","sort","splice","split","unshift"],function(t){var n=(/^(?:replace|split)$/.test(t)?Zo:Qo)[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",i=/^(?:join|pop|replace|shift)$/.test(t);e.prototype[t]=function(){var t=arguments;return i&&!this.__chain__?n.apply(this.value(),t):this[r](function(e){return n.apply(e,t)})}}),Le(m.prototype,function(t,n){var r=e[n];if(r){var i=r.name,o=Sa[i]||(Sa[i]=[]);o.push({name:n,func:r})}}),Sa[An(I,R).name]=[{name:"wrapper",func:I}],m.prototype.clone=J,m.prototype.reverse=nt,m.prototype.value=it,e.prototype.chain=Gr,e.prototype.commit=Vr,e.prototype.concat=eu,e.prototype.plant=Yr,e.prototype.reverse=$r,e.prototype.toString=Xr,e.prototype.run=e.prototype.toJSON=e.prototype.valueOf=e.prototype.value=Hr,e.prototype.collect=e.prototype.map,e.prototype.head=e.prototype.first,e.prototype.select=e.prototype.filter,e.prototype.tail=e.prototype.rest,e}var I,C="3.10.1",j=1,R=2,T=4,L=8,A=16,O=32,S=64,M=128,B=256,P=30,U="...",F=150,D=16,W=200,z=1,q=2,G="Expected a function",V="__lodash_placeholder__",Y="[object Arguments]",$="[object Array]",X="[object Boolean]",H="[object Date]",K="[object Error]",Q="[object Function]",J="[object Map]",Z="[object Number]",tt="[object Object]",et="[object RegExp]",nt="[object Set]",rt="[object String]",it="[object WeakMap]",ot="[object ArrayBuffer]",at="[object Float32Array]",ut="[object Float64Array]",ct="[object Int8Array]",st="[object Int16Array]",ft="[object Int32Array]",lt="[object Uint8Array]",ht="[object Uint8ClampedArray]",dt="[object Uint16Array]",pt="[object Uint32Array]",vt=/\b__p \+= '';/g,gt=/\b(__p \+=) '' \+/g,yt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,_t=/&(?:amp|lt|gt|quot|#39|#96);/g,mt=/[&<>"'`]/g,wt=RegExp(_t.source),bt=RegExp(mt.source),xt=/<%-([\s\S]+?)%>/g,kt=/<%([\s\S]+?)%>/g,Et=/<%=([\s\S]+?)%>/g,Nt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,It=/^\w*$/,Ct=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,jt=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,Rt=RegExp(jt.source),Tt=/[\u0300-\u036f\ufe20-\ufe23]/g,Lt=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Ot=/\w*$/,St=/^0[xX]/,Mt=/^\[object .+?Constructor\]$/,Bt=/^\d+$/,Pt=/[\xc0-\xd6\xd8-\xde\xdf-\xf6\xf8-\xff]/g,Ut=/($^)/,Ft=/['\n\r\u2028\u2029\\]/g,Dt=function(){var t="[A-Z\\xc0-\\xd6\\xd8-\\xde]",e="[a-z\\xdf-\\xf6\\xf8-\\xff]+";return RegExp(t+"+(?="+t+e+")|"+t+"?"+e+"|"+t+"+|[0-9]+","g")}(),Wt=["Array","ArrayBuffer","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Math","Number","Object","RegExp","Set","String","_","clearTimeout","isFinite","parseFloat","parseInt","setTimeout","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap"],zt=-1,qt={};qt[at]=qt[ut]=qt[ct]=qt[st]=qt[ft]=qt[lt]=qt[ht]=qt[dt]=qt[pt]=!0,qt[Y]=qt[$]=qt[ot]=qt[X]=qt[H]=qt[K]=qt[Q]=qt[J]=qt[Z]=qt[tt]=qt[et]=qt[nt]=qt[rt]=qt[it]=!1;var Gt={};Gt[Y]=Gt[$]=Gt[ot]=Gt[X]=Gt[H]=Gt[at]=Gt[ut]=Gt[ct]=Gt[st]=Gt[ft]=Gt[Z]=Gt[tt]=Gt[et]=Gt[rt]=Gt[lt]=Gt[ht]=Gt[dt]=Gt[pt]=!0,Gt[K]=Gt[Q]=Gt[J]=Gt[nt]=Gt[it]=!1;var Vt={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss"},Yt={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$t={"&":"&","<":"<",">":">",""":'"',"'":"'","`":"`"},Xt={"function":!0,object:!0},Ht={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},Kt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qt=Xt[typeof r]&&r&&!r.nodeType&&r,Jt=Xt[typeof n]&&n&&!n.nodeType&&n,Zt=Qt&&Jt&&"object"==typeof e&&e&&e.Object&&e,te=Xt[typeof self]&&self&&self.Object&&self,ee=Xt[typeof window]&&window&&window.Object&&window,ne=Jt&&Jt.exports===Qt&&Qt,re=Zt||ee!==(this&&this.window)&&ee||te||this,ie=N();"function"==typeof t&&"object"==typeof t.amd&&t.amd?(re._=ie,t(function(){return ie})):Qt&&Jt?ne?(Jt.exports=ie)._=ie:Qt._=ie:re._=ie}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[1])(1)}); //# sourceMappingURL=dagre-d3.min.js.map diff --git a/dist/dagre-d3.min.js.map b/dist/dagre-d3.min.js.map index c04af740..01165986 100644 --- a/dist/dagre-d3.min.js.map +++ b/dist/dagre-d3.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["node_modules/browser-pack/_prelude.js","index.js","dagre-d3.js","lib/arrows.js","lib/create-clusters.js","lib/create-edge-labels.js","lib/create-edge-paths.js","lib/create-nodes.js","lib/d3.js","lib/dagre.js","lib/graphlib.js","lib/intersect/index.js","lib/intersect/intersect-circle.js","lib/intersect/intersect-ellipse.js","lib/intersect/intersect-line.js","lib/intersect/intersect-node.js","lib/intersect/intersect-polygon.js","lib/intersect/intersect-rect.js","lib/label/add-html-label.js","lib/label/add-label.js","lib/label/add-svg-label.js","lib/label/add-text-label.js","lib/lodash.js","lib/position-clusters.js","lib/position-edge-labels.js","lib/position-nodes.js","lib/render.js","lib/shapes.js","lib/util.js","lib/version.js","node_modules/dagre/index.js","node_modules/dagre/lib/acyclic.js","node_modules/dagre/lib/add-border-segments.js","node_modules/dagre/lib/coordinate-system.js","node_modules/dagre/lib/data/list.js","node_modules/dagre/lib/debug.js","node_modules/dagre/lib/graphlib.js","node_modules/dagre/lib/greedy-fas.js","node_modules/dagre/lib/layout.js","node_modules/dagre/lib/lodash.js","node_modules/dagre/lib/nesting-graph.js","node_modules/dagre/lib/normalize.js","node_modules/dagre/lib/order/add-subgraph-constraints.js","node_modules/dagre/lib/order/barycenter.js","node_modules/dagre/lib/order/build-layer-graph.js","node_modules/dagre/lib/order/cross-count.js","node_modules/dagre/lib/order/index.js","node_modules/dagre/lib/order/init-order.js","node_modules/dagre/lib/order/resolve-conflicts.js","node_modules/dagre/lib/order/sort-subgraph.js","node_modules/dagre/lib/order/sort.js","node_modules/dagre/lib/parent-dummy-chains.js","node_modules/dagre/lib/position/bk.js","node_modules/dagre/lib/position/index.js","node_modules/dagre/lib/rank/feasible-tree.js","node_modules/dagre/lib/rank/index.js","node_modules/dagre/lib/rank/network-simplex.js","node_modules/dagre/lib/rank/util.js","node_modules/dagre/lib/util.js","node_modules/dagre/lib/version.js","node_modules/graphlib/index.js","node_modules/graphlib/lib/alg/components.js","node_modules/graphlib/lib/alg/dfs.js","node_modules/graphlib/lib/alg/dijkstra-all.js","node_modules/graphlib/lib/alg/dijkstra.js","node_modules/graphlib/lib/alg/find-cycles.js","node_modules/graphlib/lib/alg/floyd-warshall.js","node_modules/graphlib/lib/alg/index.js","node_modules/graphlib/lib/alg/is-acyclic.js","node_modules/graphlib/lib/alg/postorder.js","node_modules/graphlib/lib/alg/preorder.js","node_modules/graphlib/lib/alg/prim.js","node_modules/graphlib/lib/alg/tarjan.js","node_modules/graphlib/lib/alg/topsort.js","node_modules/graphlib/lib/data/priority-queue.js","node_modules/graphlib/lib/graph.js","node_modules/graphlib/lib/index.js","node_modules/graphlib/lib/json.js","node_modules/graphlib/lib/version.js","node_modules/lodash/index.js"],"names":["f","exports","module","define","amd","g","window","global","self","this","dagreD3","e","t","n","r","s","o","u","a","require","i","Error","code","l","call","length","1","graphlib","dagre","intersect","render","util","version","./lib/dagre","./lib/graphlib","./lib/intersect","./lib/render","./lib/util","./lib/version","2","normal","parent","id","edge","type","marker","append","attr","path","style","applyStyle","vee","undirected","default","./util","3","createClusters","selection","clusters","nodes","filter","v","isSubgraph","svgClusters","selectAll","data","remove","enter","node","applyTransition","each","thisGroup","d3","select","labelGroup","addLabel","clusterLabelPos","c","domCluster","exit","./label/add-label","4","createEdgeLabels","svgEdgeLabels","edges","edgeToId","classed","label","bbox","getBBox","labelId","_","has","width","height","./d3","./lodash","5","createEdgePaths","arrows","svgPaths","domEdge","elem","applyClass","arrowheadId","uniqueId","makeFragmentRef","location","href","calcPoints","arrowhead","url","fragmentId","baseUrl","split","tail","head","w","points","slice","unshift","intersectNode","push","createLine","line","svg","x","d","y","interpolate","lineInterpolate","tension","Number","lineTension","getCoords","matrix","ownerSVGElement","getScreenCTM","inverse","multiply","translate","svgPathsEnter","sourceElem","range","map","svgPathExit","source","getTotalLength","./intersect/intersect-node","6","createNodes","shapes","simpleNodes","svgNodes","labelDom","shape","pick","paddingLeft","paddingRight","paddingTop","paddingBottom","shapeSvg","shapeBBox","7","8","9","10","circle","ellipse","polygon","rect","./intersect-circle","./intersect-ellipse","./intersect-node","./intersect-polygon","./intersect-rect","11","intersectCircle","rx","point","intersectEllipse","12","ry","cx","cy","px","py","det","Math","sqrt","dx","abs","dy","13","intersectLine","p1","p2","q1","q2","a1","a2","b1","b2","c1","c2","r1","r2","r3","r4","denom","offset","num","sameSign","14","15","intersectPolygon","polyPoints","x1","y1","intersections","minX","POSITIVE_INFINITY","minY","forEach","entry","min","left","top","sort","p","q","pdx","pdy","distp","qdx","qdy","distq","console","log","./intersect-line","16","intersectRect","sx","sy","h","17","addHtmlLabel","root","fo","div","insert","html","labelStyle","client","getBoundingClientRect","../util","18","labelSvg","labelType","addSVGLabel","addTextLabel","labelBBox","./add-html-label","./add-svg-label","./add-text-label","19","domNode","appendChild","20","lines","processEscapeSequences","text","ch","newText","escaped","21","lodash","22","positionClusters","created","23","positionEdgeLabels","24","positionNodes","25","fn","preProcessGraph","outputGroup","createOrSelectGroup","clustersGroup","edgePathsGroup","edgeLabels","layout","postProcessGraph","value","arguments","children","defaults","paddingX","paddingY","padding","NODE_DEFAULT_ATTRS","k","_prevWidth","_prevHeight","EDGE_DEFAULT_ATTRS","name","empty","./arrows","./create-clusters","./create-edge-labels","./create-edge-paths","./create-nodes","./dagre","./position-clusters","./position-edge-labels","./position-nodes","./shapes","26","max","diamond","SQRT2","join","./intersect/intersect-circle","./intersect/intersect-ellipse","./intersect/intersect-polygon","./intersect/intersect-rect","27","escapeId","str","String","replace","ID_DELIM","dom","styleFn","classFn","otherClasses","graph","isPlainObject","transition","isFunction","28","29","debug","time","notime","./lib/debug","./lib/layout","30","run","weightFn","weight","fas","acyclicer","greedyFAS","dfsFAS","removeEdge","forwardName","reversed","setEdge","dfs","visited","stack","outEdges","undo","./greedy-fas","31","addBorderSegments","borderLeft","borderRight","rank","minRank","maxRank","addBorderNode","prop","prefix","sg","sgNode","borderType","prev","curr","addDummyNode","setParent","32","adjust","rankDir","rankdir","toLowerCase","swapWidthHeight","reverseY","swapXY","swapWidthHeightOne","attrs","reverseYOne","swapXYOne","33","List","sentinel","_next","_prev","_sentinel","unlink","filterOutLinks","prototype","dequeue","enqueue","toString","strs","JSON","stringify","34","debugOrdering","layerMatrix","buildLayerMatrix","Graph","compound","multigraph","setGraph","setNode","layer","layerV","reduce","./graphlib","35","36","nodeCount","state","buildState","DEFAULT_WEIGHT_FN","results","doGreedyFAS","buckets","zeroIdx","flatten","sources","sinks","removeNode","concat","collectPredecessors","undefined","inEdges","uEntry","out","assignBucket","wEntry","fasGraph","maxIn","maxOut","in","prevWeight","edgeWeight","constant","./data/list","37","opts","debugTiming","layoutGraph","buildLayoutGraph","runLayout","updateInputGraph","makeSpaceForEdgeLabels","removeSelfEdges","acyclic","nestingGraph","asNonCompoundGraph","injectEdgeLabelProxies","removeEmptyRanks","cleanup","normalizeRanks","assignRankMinMax","removeEdgeLabelProxies","normalize","parentDummyChains","order","insertSelfEdges","coordinateSystem","position","positionSelfEdges","removeBorderNodes","fixupEdgeLabelCoords","translateGraph","assignNodeIntersects","reversePointsForReversedEdges","inputGraph","inputLabel","layoutLabel","canonicalize","merge","graphDefaults","selectNumberAttrs","graphNumAttrs","graphAttrs","nodeNumAttrs","nodeDefaults","edgeDefaults","edgeNumAttrs","edgeAttrs","ranksep","minlen","labelpos","labeloffset","borderTop","borderBottom","dummy","labelRank","getExtremes","maxX","maxY","graphLabel","marginX","marginx","marginY","marginy","nodeV","nodeW","reverse","b","last","selfEdges","layers","orderShift","selfEdge","selfNode","obj","mapValues","newAttrs","edgesep","nodesep","./acyclic","./add-border-segments","./coordinate-system","./nesting-graph","./normalize","./order","./parent-dummy-chains","./position","./rank","38","39","depths","treeDepths","nodeSep","nestingRoot","sumWeights","child","nodeRankFactor","bottom","childNode","childTop","childBottom","thisWeight","nestingEdge","depth","acc","40","dummyChains","normalizeEdge","vRank","wRank","edgeLabel","edgeObj","origLabel","successors","41","addSubgraphConstraints","cg","vs","rootPrev","prevChild","../lodash","42","barycenter","movable","inV","result","nodeU","sum","43","buildLayerGraph","relationship","createRootNode","setDefaultNodeLabel","isUndefined","hasNode","../graphlib","44","crossCount","layering","cc","twoLayerCrossCount","northLayer","southLayer","southPos","zipObject","southEntries","chain","pos","sortBy","firstIndex","treeSize","tree","Array","index","weightSum","45","downLayerGraphs","buildLayerGraphs","upLayerGraphs","initOrder","assignOrder","best","bestCC","lastBest","sweepLayerGraphs","cloneDeep","ranks","layerGraphs","biasRight","lg","sorted","sortSubgraph","./add-subgraph-constraints","./build-layer-graph","./cross-count","./init-order","./sort-subgraph","46","orderedVs","47","resolveConflicts","entries","mappedEntries","tmp","indegree","entryV","entryW","sourceSet","doResolveConflicts","handleIn","vEntry","merged","mergeEntries","handleOut","pop","target","48","bl","br","subgraphs","barycenters","subgraphResult","mergeBarycenters","expandSubgraphs","predecessors","blPred","brPred","other","./barycenter","./resolve-conflicts","./sort","49","parts","partition","sortable","lhs","unsortable","rhs","vsIndex","compareWithBias","consumeUnsortable","bias","50","postorderNums","postorder","pathData","findPath","lca","pathIdx","pathV","ascending","vPath","wPath","low","lim","51","findType1Conflicts","visitLayer","prevLayer","k0","scanPos","prevLayerLength","lastNode","findOtherInnerSegmentNode","k1","scanNode","uLabel","uPos","addConflict","conflicts","findType2Conflicts","scan","south","southEnd","prevNorthBorder","nextNorthBorder","uNode","north","nextNorthPos","prevNorthPos","southLookahead","find","conflictsV","hasConflict","verticalAlignment","neighborFn","align","prevIdx","ws","mp","floor","il","ceil","horizontalCompaction","reverseSep","pass1","xs","blockG","pass2","buildBlockGraph","blockGraph","sepFn","sep","vRoot","uRoot","prevMax","findSmallestWidthAlignment","xss","alignCoordinates","alignTo","alignToMin","alignToMax","vert","horiz","delta","alignment","balance","ul","ignore","pluck","positionX","adjustedLayering","values","inner","bind","smallestWidth","edgeSep","vLabel","wLabel","52","positionY","rankSep","prevY","maxHeight","./bk","53","feasibleTree","directed","start","size","tightTree","findMinSlackEdge","slack","shiftRanks","nodeEdges","edgeV","54","ranker","networkSimplexRanker","tightTreeRanker","longestPathRanker","longestPath","networkSimplex","rankUtil","./feasible-tree","./network-simplex","55","simplify","initRank","initLowLimValues","initCutValues","leaveEdge","enterEdge","exchangeEdges","assignCutValue","childLab","cutvalue","calcCutValue","childIsTail","graphEdge","cutValue","isOutEdge","pointsToHead","otherWeight","isTreeEdge","otherCutValue","dfsAssignLowLim","nextLim","neighbors","hasEdge","tailLabel","flip","candidates","isDescendant","updateRanks","preorder","flipped","rootLabel","alg","56","57","simplified","simpleLabel","isMultigraph","successorWeights","weightMap","sucs","predecessorWeights","preds","collection","now","58","59","lib","json","./lib","./lib/alg","./lib/json","60","components","cmpt","cmpts","61","isArray","doDfs","62","dijkstraAll","weightFunc","edgeFunc","transform","dijkstra","./dijkstra","63","edgeFn","runDijkstra","DEFAULT_WEIGHT_FUNC","pq","PriorityQueue","updateNeighbors","distance","predecessor","decrease","add","removeMin","../data/priority-queue","64","findCycles","tarjan","./tarjan","65","floydWarshall","runFloydWarshall","rowK","rowI","j","ik","kj","ij","altDistance","66","isAcyclic","prim","topsort","./components","./dijkstra-all","./find-cycles","./floyd-warshall","./is-acyclic","./postorder","./preorder","./prim","./topsort","67","CycleException","68","./dfs","69","70","pri","priority","parents","init","../graph","71","onStack","lowlink","72","visit","73","_arr","_keyIndices","keys","key","keyIndices","arr","_decrease","_swap","_heapify","largest","origArrI","origArrJ","74","_isDirected","_isMultigraph","_isCompound","_label","_defaultNodeLabelFn","_defaultEdgeLabelFn","_nodes","_parent","_children","GRAPH_NODE","_in","_preds","_out","_sucs","_edgeObjs","_edgeLabels","incrementOrInitEntry","decrementOrRemoveEntry","edgeArgsToId","isDirected","v_","w_","EDGE_KEY_DELIM","DEFAULT_EDGE_NAME","edgeArgsToObj","edgeObjToId","_nodeCount","_edgeCount","isCompound","newDefault","isEmpty","setNodes","args","_removeFromParentsChildList","ancestor","predsV","sucsV","union","filterNodes","findParent","copy","constructor","setDefaultEdgeLabel","edgeCount","setPath","valueSpecified","arg0","Object","freeze","outV","75","./graph","./version","76","write","options","writeNodes","writeEdges","clone","nodeValue","edgeValue","read","77","apply","dup","78","79","baseCompareAscending","valIsNull","valIsUndef","valIsReflexive","othIsNull","othIsUndef","othIsReflexive","baseFindIndex","array","predicate","fromRight","baseIndexOf","fromIndex","indexOfNaN","baseIsFunction","baseToString","charsLeftIndex","string","chars","indexOf","charAt","charsRightIndex","compareAscending","object","criteria","compareMultiple","orders","objCriteria","othCriteria","ordersLength","deburrLetter","letter","deburredLetters","escapeHtmlChar","chr","htmlEscapes","escapeRegExpChar","leadingChar","whitespaceChar","regexpEscapes","stringEscapes","escapeStringChar","isObjectLike","isSpace","charCode","replaceHolders","placeholder","resIndex","PLACEHOLDER","sortedUniq","iteratee","seen","computed","trimmedLeftIndex","charCodeAt","trimmedRightIndex","unescapeHtmlChar","htmlUnescapes","runInContext","context","LazyWrapper","LodashWrapper","hasOwnProperty","wrapperClone","baseLodash","chainAll","actions","__wrapped__","__actions__","__chain__","__dir__","__filtered__","__iteratees__","__takeCount__","__views__","lazyClone","arrayCopy","lazyReverse","lazyValue","dir","isArr","isRight","arrLength","view","getView","end","iteratees","iterLength","takeCount","nativeMin","LARGE_ARRAY_SIZE","baseWrapperValue","outer","iterIndex","LAZY_MAP_FLAG","LAZY_FILTER_FLAG","MapCache","__data__","mapDelete","mapGet","mapHas","mapSet","SetCache","hash","nativeCreate","set","Set","cacheIndexOf","cache","isObject","cachePush","arrayConcat","othIndex","othLength","arrayEach","arrayEachRight","arrayEvery","arrayExtremum","comparator","exValue","current","arrayFilter","arrayMap","arrayPush","arrayReduce","accumulator","initFromArray","arrayReduceRight","arraySome","arraySum","assignDefaults","objectValue","sourceValue","assignOwnDefaults","assignWith","customizer","props","baseAssign","baseCopy","baseAt","isNil","isArrayLike","propsLength","isIndex","baseCallback","func","thisArg","argCount","bindCallback","identity","baseMatches","property","baseMatchesProperty","baseClone","isDeep","stackA","stackB","initCloneArray","tag","objToString","isFunc","funcTag","objectTag","argsTag","cloneableTags","initCloneByTag","initCloneObject","baseForOwn","subValue","baseDelay","wait","TypeError","FUNC_ERROR_TEXT","setTimeout","baseDifference","getIndexOf","isCommon","createCache","valuesLength","valuesIndex","baseEvery","baseEach","baseExtremum","baseFill","baseFilter","baseFind","eachFunc","retKey","baseFlatten","isStrict","isArguments","baseForIn","baseFor","keysIn","baseForOwnRight","baseForRight","baseFunctions","baseGet","pathKey","toObject","baseIsEqual","isLoose","baseIsEqualDeep","equalFunc","objIsArr","othIsArr","objTag","arrayTag","othTag","isTypedArray","objIsObj","othIsObj","isSameTag","equalByTag","objIsWrapped","othIsWrapped","equalArrays","equalObjects","baseIsMatch","matchData","noCustomizer","objValue","srcValue","baseMap","getMatchData","isKey","isStrictComparable","toPath","baseSlice","baseMerge","isSrcArr","baseMergeDeep","mergeFunc","toPlainObject","baseProperty","basePropertyDeep","basePullAt","indexes","previous","splice","baseRandom","nativeFloor","nativeRandom","baseReduce","initFromCollection","baseSome","baseSortBy","comparer","baseSortByOrder","callback","getCallback","baseSum","baseUniq","isLarge","seenIndex","baseValues","baseWhile","isDrop","action","binaryIndex","retHighest","high","HALF_MAX_ARRAY_LENGTH","mid","binaryIndexBy","valIsNaN","isDef","isReflexive","setLow","MAX_ARRAY_INDEX","bufferClone","buffer","ArrayBuffer","byteLength","Uint8Array","composeArgs","partials","holders","holdersLength","argsIndex","argsLength","nativeMax","leftIndex","leftLength","composeArgsRight","holdersIndex","rightIndex","rightLength","createAggregator","setter","initializer","createAssigner","assigner","restParam","guard","isIterateeCall","createBaseEach","getLength","isLength","iterable","createBaseFor","keysFunc","createBindWrapper","wrapper","Ctor","createCtorWrapper","createCompounder","words","deburr","thisBinding","baseCreate","createCurry","flag","curryFunc","arity","createWrapper","createDefaults","createExtremum","toIterable","createFind","createFindIndex","createFindKey","objectFunc","createFlow","funcs","thru","getFuncName","funcName","getData","isLaziable","ARY_FLAG","CURRY_FLAG","PARTIAL_FLAG","REARG_FLAG","plant","createForEach","arrayFunc","createForIn","createForOwn","createObjectMapper","isMapKeys","mapped","createPadDir","createPadding","createPartial","partialFunc","createReduce","createHybridWrapper","bitmask","partialsRight","holdersRight","argPos","ary","isCurry","isCurryRight","argsHolders","newArgPos","newArity","newsHolders","newHoldersRight","newPartials","newPartialsRight","PARTIAL_RIGHT_FLAG","isCurryBound","BIND_FLAG","BIND_KEY_FLAG","newData","setData","isBind","isBindKey","reorder","isAry","CURRY_BOUND_FLAG","CURRY_RIGHT_FLAG","strLength","nativeIsFinite","padLength","repeat","nativeCeil","createPartialWrapper","createRound","methodName","number","precision","pow","createSortedIndex","mergeData","baseSetData","arrValue","othValue","boolTag","dateTag","errorTag","message","numberTag","regexpTag","stringTag","objProps","objLength","othProps","skipCtor","objCtor","othCtor","realNames","otherFunc","pairs","getNative","isNative","transforms","input","arrayBufferTag","float32Tag","float64Tag","int8Tag","int16Tag","int32Tag","uint8Tag","uint8ClampedTag","uint16Tag","uint32Tag","byteOffset","reFlags","exec","lastIndex","invokePath","reIsUint","test","MAX_SAFE_INTEGER","reIsPlainProp","reIsDeepProp","srcBitmask","newBitmask","isCombo","mergeDefaults","pickByArray","pickByCallback","oldArray","shimKeys","allowIndexes","rePropName","match","quote","reEscapeChar","chunk","compact","drop","dropRight","dropRightWhile","dropWhile","fill","first","flattenDeep","initial","lastIndexOf","pull","rest","take","takeRight","takeRightWhile","takeWhile","uniq","isSorted","unzip","group","unzipWith","xor","tap","interceptor","wrapperChain","wrapperCommit","wrapperPlant","wrapperReverse","wrapped","wrapperToString","wrapperValue","every","findWhere","includes","isString","reject","sample","toArray","rand","shuffle","some","sortByOrder","where","after","temp","before","debounce","cancel","timeoutId","clearTimeout","maxTimeoutId","lastCalled","trailingCall","complete","isCalled","delayed","remaining","stamp","maxDelayed","trailing","debounced","leading","maxWait","leadingCall","memoize","resolver","memoized","get","Cache","negate","once","otherArgs","spread","throttle","wrap","gt","gte","propertyIsEnumerable","isBoolean","isDate","isElement","nodeType","isEqual","isError","isFinite","isMatch","isNaN","isNumber","reIsNative","fnToString","reIsHostCtor","isNull","isRegExp","typedArrayTags","lt","lte","create","properties","functions","defaultValue","invert","multiValue","isProto","skipIndexes","nested","valuesIn","inRange","random","floating","noMin","noMax","parseFloat","capitalize","toUpperCase","reLatin1","reComboMark","endsWith","escape","reHasUnescapedHtml","reUnescapedHtml","escapeRegExp","reHasRegExpChars","reRegExpChars","pad","parseInt","radix","trim","nativeParseInt","reHasHexPrefix","startsWith","template","otherOptions","settings","templateSettings","isEscaping","isEvaluating","imports","importsKeys","importsValues","reNoMatch","reDelimiters","RegExp","reInterpolate","reEsTemplate","evaluate","sourceURL","templateCounter","escapeValue","interpolateValue","esTemplateValue","evaluateValue","reUnescapedString","variable","reEmptyStringLeading","reEmptyStringMiddle","reEmptyStringTrailing","attempt","Function","trimLeft","trimRight","trunc","DEFAULT_TRUNC_LENGTH","omission","DEFAULT_TRUNC_OMISSION","separator","search","newEnd","substring","unescape","reHasEscapedHtml","reEscapedHtml","pattern","reWords","matches","matchesProperty","mixin","isObj","methodNames","noConflict","oldDash","noop","propertyOf","step","times","MAX_ARRAY_LENGTH","idCounter","augend","addend","contextProps","Date","arrayProto","objectProto","stringProto","WeakMap","nativeIsArray","nativeKeys","nativeNow","NEGATIVE_INFINITY","metaMap","support","reEscape","reEvaluate","baseEachRight","count","HOT_SPAN","HOT_COUNT","difference","findIndex","findLastIndex","intersection","arrays","caches","pullAt","sortedIndex","sortedLastIndex","without","zip","zipWith","wrapperConcat","at","countBy","findLast","forEachRight","groupBy","indexBy","invoke","isProp","reduceRight","sortByAll","getTime","bindAll","bindKey","curry","curryRight","defer","delay","flow","flowRight","modArgs","partial","partialRight","rearg","assign","defaultsDeep","findKey","findLastKey","forIn","forInRight","forOwn","forOwnRight","mapKeys","omit","camelCase","word","kebabCase","padLeft","padRight","snakeCase","startCase","method","methodOf","round","backflow","collect","compose","eachRight","extend","methods","unique","all","any","contains","eq","detect","foldl","foldr","include","inject","VERSION","filtered","isFilter","takeName","dropName","operationName","createCallback","checkIteratee","retUnwrapped","lodashFunc","isHybrid","isLazy","useLazy","onlyLazy","chainName","names","commit","toJSON","valueOf","mapTag","setTag","weakMapTag","upper","lower","À","Á","Â","Ã","Ä","Å","à","á","â","ã","ä","å","Ç","ç","Ð","ð","È","É","Ê","Ë","è","é","ê","ë","Ì","Í","Î","Ï","ì","í","î","ï","Ñ","ñ","Ò","Ó","Ô","Õ","Ö","Ø","ò","ó","ô","õ","ö","ø","Ù","Ú","Û","Ü","ù","ú","û","ü","Ý","ý","ÿ","Æ","æ","Þ","þ","ß","&","<",">","\"","'","`","&","<",">",""","'","`","objectTypes","function","0","A","B","C","D","E","F","\\","\n","\r","
","
","freeExports","freeModule","freeGlobal","freeSelf","freeWindow","moduleExports"],"mappings":"CAAA,SAAAA,GAAA,GAAA,gBAAAC,UAAA,mBAAAC,QAAAA,OAAAD,QAAAD,QAAA,IAAA,kBAAAG,SAAAA,OAAAC,IAAAD,UAAAH,OAAA,CAAA,GAAAK,EAAAA,GAAA,mBAAAC,QAAAA,OAAA,mBAAAC,QAAAA,OAAA,mBAAAC,MAAAA,KAAAC,KAAAJ,EAAAK,QAAAV,MAAA,WAAA,GAAAG,EAAA,OAAA,SAAAQ,GAAAC,EAAAC,EAAAC,GAAA,QAAAC,GAAAC,EAAAC,GAAA,IAAAJ,EAAAG,GAAA,CAAA,IAAAJ,EAAAI,GAAA,CAAA,GAAAE,GAAA,kBAAAC,UAAAA,OAAA,KAAAF,GAAAC,EAAA,MAAAA,GAAAF,GAAA,EAAA,IAAAI,EAAA,MAAAA,GAAAJ,GAAA,EAAA,IAAAhB,GAAA,GAAAqB,OAAA,uBAAAL,EAAA,IAAA,MAAAhB,GAAAsB,KAAA,mBAAAtB,EAAA,GAAAuB,GAAAV,EAAAG,IAAAf,WAAAW,GAAAI,GAAA,GAAAQ,KAAAD,EAAAtB,QAAA,SAAAU,GAAA,GAAAE,GAAAD,EAAAI,GAAA,GAAAL,EAAA,OAAAI,GAAAF,EAAAA,EAAAF,IAAAY,EAAAA,EAAAtB,QAAAU,EAAAC,EAAAC,EAAAC,GAAA,MAAAD,GAAAG,GAAAf,QAAA,IAAA,GAAAmB,GAAA,kBAAAD,UAAAA,QAAAH,EAAA,EAAAA,EAAAF,EAAAW,OAAAT,IAAAD,EAAAD,EAAAE,GAAA,OAAAD,KAAAW,GAAA,SAAAP,EAAAjB,EAAAD;;;;;;;;;;;;;;;;;;;;;;ACsBAC,EAAAD,SACA0B,SAAAR,EAAA,kBACAS,MAAAT,EAAA,eACAU,UAAAV,EAAA,mBACAW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+C,EAGA8xD,GAAAF,IAAAC,IAAA,gBAAAxxD,IAAAA,GAAAA,EAAAi8B,QAAAj8B,EAGA0xD,GAAAjB,SAAAxwD,QAAAA,MAAAA,KAAAg8B,QAAAh8B,KAGA0xD,GAAAlB,SAAA1wD,UAAAA,QAAAA,OAAAk8B,QAAAl8B,OAGA6xD,GAAAJ,IAAAA,GAAA9xD,UAAA6xD,IAAAA,GAQAviD,GAAAyiD,IAAAE,MAAAzxD,MAAAA,KAAAH,SAAA4xD,IAAAD,IAAAxxD,KA8wXAkF,GAAA27B,GAGA,mBAAAnhC,IAAA,gBAAAA,GAAAC,KAAAD,EAAAC,KAKAmP,GAAA5J,EAAAA,GAIAxF,EAAA,WACA,MAAAwF,OAIAmsD,IAAAC,GAEAI,IACAJ,GAAA9xD,QAAA0F,IAAAA,EAAAA,GAIAmsD,GAAAnsD,EAAAA,GAKA4J,GAAA5J,EAAAA,KAEAnE,KAAAf,Q7EiqKGe,KAAKf,KAAuB,mBAAXF,QAAyBA,OAAyB,mBAATC,MAAuBA,KAAyB,mBAAXF,QAAyBA,qBAEhH,IAAI","file":"dagre-d3.min.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 0;\n}\n\n},{}],14:[function(require,module,exports){\nmodule.exports = intersectNode;\n\nfunction intersectNode(node, point) {\n return node.intersect(point);\n}\n\n},{}],15:[function(require,module,exports){\nvar intersectLine = require(\"./intersect-line\");\n\nmodule.exports = intersectPolygon;\n\n/*\n * Returns the point ({x, y}) at which the point argument intersects with the\n * node argument assuming that it has the shape specified by polygon.\n */\nfunction intersectPolygon(node, polyPoints, point) {\n var x1 = node.x;\n var y1 = node.y;\n\n var intersections = [];\n\n var minX = Number.POSITIVE_INFINITY,\n minY = Number.POSITIVE_INFINITY;\n polyPoints.forEach(function(entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n\n var left = x1 - node.width / 2 - minX;\n var top = y1 - node.height / 2 - minY;\n\n for (var i = 0; i < polyPoints.length; i++) {\n var p1 = polyPoints[i];\n var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n var intersect = intersectLine(node, point,\n {x: left + p1.x, y: top + p1.y}, {x: left + p2.x, y: top + p2.y});\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n console.log(\"NO INTERSECTION FOUND, RETURN NODE CENTER\", node);\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function(p, q) {\n var pdx = p.x - point.x,\n pdy = p.y - point.y,\n distp = Math.sqrt(pdx * pdx + pdy * pdy),\n\n qdx = q.x - point.x,\n qdy = q.y - point.y,\n distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return (distp < distq) ? -1 : (distp === distq ? 0 : 1);\n });\n }\n return intersections[0];\n}\n\n},{\"./intersect-line\":13}],16:[function(require,module,exports){\nmodule.exports = intersectRect;\n\nfunction intersectRect(node, point) {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : h * dx / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : w * dy / dx;\n }\n\n return {x: x + sx, y: y + sy};\n}\n\n},{}],17:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addHtmlLabel;\n\nfunction addHtmlLabel(root, node) {\n var fo = root\n .append(\"foreignObject\")\n .attr(\"width\", \"100000\");\n\n var div = fo\n .append(\"xhtml:div\");\n div.attr(\"xmlns\", \"http://www.w3.org/1999/xhtml\");\n\n var label = node.label;\n switch(typeof label) {\n case \"function\":\n div.insert(label);\n break;\n case \"object\":\n // Currently we assume this is a DOM object.\n div.insert(function() { return label; });\n break;\n default: div.html(label);\n }\n\n util.applyStyle(div, node.labelStyle);\n div.style(\"display\", \"inline-block\");\n // Fix for firefox\n div.style(\"white-space\", \"nowrap\");\n\n var client = div[0][0].getBoundingClientRect();\n fo\n .attr(\"width\", client.width)\n .attr(\"height\", client.height); \n\n return fo;\n}\n\n},{\"../util\":27}],18:[function(require,module,exports){\nvar addTextLabel = require(\"./add-text-label\"),\n addHtmlLabel = require(\"./add-html-label\"),\n addSVGLabel = require(\"./add-svg-label\");\n\nmodule.exports = addLabel;\n\nfunction addLabel(root, node, location) {\n var label = node.label;\n var labelSvg = root.append(\"g\");\n\n // Allow the label to be a string, a function that returns a DOM element, or\n // a DOM element itself.\n if (node.labelType === \"svg\") {\n addSVGLabel(labelSvg, node);\n } else if (typeof label !== \"string\" || node.labelType === \"html\") {\n addHtmlLabel(labelSvg, node);\n } else {\n addTextLabel(labelSvg, node);\n }\n\n var labelBBox = labelSvg.node().getBBox();\n var y;\n switch(location) {\n case \"top\":\n y = (-node.height / 2);\n break;\n case \"bottom\":\n y = (node.height / 2) - labelBBox.height;\n break;\n default:\n y = (-labelBBox.height / 2);\n }\n labelSvg.attr(\"transform\",\n \"translate(\" + (-labelBBox.width / 2) + \",\" + y + \")\");\n\n return labelSvg;\n}\n\n},{\"./add-html-label\":17,\"./add-svg-label\":19,\"./add-text-label\":20}],19:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addSVGLabel;\n\nfunction addSVGLabel(root, node) {\n var domNode = root;\n\n domNode.node().appendChild(node.label);\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\n},{\"../util\":27}],20:[function(require,module,exports){\nvar util = require(\"../util\");\n\nmodule.exports = addTextLabel;\n\n/*\n * Attaches a text label to the specified root. Handles escape sequences.\n */\nfunction addTextLabel(root, node) {\n var domNode = root.append(\"text\");\n\n var lines = processEscapeSequences(node.label).split(\"\\n\");\n for (var i = 0; i < lines.length; i++) {\n domNode\n .append(\"tspan\")\n .attr(\"xml:space\", \"preserve\")\n .attr(\"dy\", \"1em\")\n .attr(\"x\", \"1\")\n .text(lines[i]);\n }\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\nfunction processEscapeSequences(text) {\n var newText = \"\",\n escaped = false,\n ch;\n for (var i = 0; i < text.length; ++i) {\n ch = text[i];\n if (escaped) {\n switch(ch) {\n case \"n\": newText += \"\\n\"; break;\n default: newText += ch;\n }\n escaped = false;\n } else if (ch === \"\\\\\") {\n escaped = true;\n } else {\n newText += ch;\n }\n }\n return newText;\n}\n\n},{\"../util\":27}],21:[function(require,module,exports){\n/* global window */\n\nvar lodash;\n\nif (require) {\n try {\n lodash = require(\"lodash\");\n } catch (e) {}\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n\n},{\"lodash\":79}],22:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionClusters;\n\nfunction positionClusters(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n\n util.applyTransition(created.selectAll(\"rect\"), g)\n .attr(\"width\", function(v) { return g.node(v).width; })\n .attr(\"height\", function(v) { return g.node(v).height; })\n .attr(\"x\", function(v) {\n var node = g.node(v);\n return -node.width / 2;\n })\n .attr(\"y\", function(v) {\n var node = g.node(v);\n return -node.height / 2;\n });\n\n}\n\n},{\"./d3\":7,\"./util\":27}],23:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\"),\n _ = require(\"./lodash\");\n\nmodule.exports = positionEdgeLabels;\n\nfunction positionEdgeLabels(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(e) {\n var edge = g.edge(e);\n return _.has(edge, \"x\") ? \"translate(\" + edge.x + \",\" + edge.y + \")\" : \"\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n\n},{\"./d3\":7,\"./lodash\":21,\"./util\":27}],24:[function(require,module,exports){\n\"use strict\";\n\nvar util = require(\"./util\"),\n d3 = require(\"./d3\");\n\nmodule.exports = positionNodes;\n\nfunction positionNodes(selection, g) {\n var created = selection.filter(function() { return !d3.select(this).classed(\"update\"); });\n\n function translate(v) {\n var node = g.node(v);\n return \"translate(\" + node.x + \",\" + node.y + \")\";\n }\n\n created.attr(\"transform\", translate);\n\n util.applyTransition(selection, g)\n .style(\"opacity\", 1)\n .attr(\"transform\", translate);\n}\n\n},{\"./d3\":7,\"./util\":27}],25:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n layout = require(\"./dagre\").layout;\n\nmodule.exports = render;\n\n// This design is based on http://bost.ocks.org/mike/chart/.\nfunction render() {\n var createNodes = require(\"./create-nodes\"),\n createClusters = require(\"./create-clusters\"),\n createEdgeLabels = require(\"./create-edge-labels\"),\n createEdgePaths = require(\"./create-edge-paths\"),\n positionNodes = require(\"./position-nodes\"),\n positionEdgeLabels = require(\"./position-edge-labels\"),\n positionClusters = require(\"./position-clusters\"),\n shapes = require(\"./shapes\"),\n arrows = require(\"./arrows\");\n\n var fn = function(svg, g) {\n preProcessGraph(g);\n\n var outputGroup = createOrSelectGroup(svg, \"output\"),\n clustersGroup = createOrSelectGroup(outputGroup, \"clusters\"),\n edgePathsGroup = createOrSelectGroup(outputGroup, \"edgePaths\"),\n edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, \"edgeLabels\"), g),\n nodes = createNodes(createOrSelectGroup(outputGroup, \"nodes\"), g, shapes);\n\n layout(g);\n\n positionNodes(nodes, g);\n positionEdgeLabels(edgeLabels, g);\n createEdgePaths(edgePathsGroup, g, arrows);\n\n var clusters = createClusters(clustersGroup, g);\n positionClusters(clusters, g);\n\n postProcessGraph(g);\n };\n\n fn.createNodes = function(value) {\n if (!arguments.length) return createNodes;\n createNodes = value;\n return fn;\n };\n\n fn.createClusters = function(value) {\n if (!arguments.length) return createClusters;\n createClusters = value;\n return fn;\n };\n\n fn.createEdgeLabels = function(value) {\n if (!arguments.length) return createEdgeLabels;\n createEdgeLabels = value;\n return fn;\n };\n\n fn.createEdgePaths = function(value) {\n if (!arguments.length) return createEdgePaths;\n createEdgePaths = value;\n return fn;\n };\n\n fn.shapes = function(value) {\n if (!arguments.length) return shapes;\n shapes = value;\n return fn;\n };\n\n fn.arrows = function(value) {\n if (!arguments.length) return arrows;\n arrows = value;\n return fn;\n };\n\n return fn;\n}\n\nvar NODE_DEFAULT_ATTRS = {\n paddingLeft: 10,\n paddingRight: 10,\n paddingTop: 10,\n paddingBottom: 10,\n rx: 0,\n ry: 0,\n shape: \"rect\"\n};\n\nvar EDGE_DEFAULT_ATTRS = {\n arrowhead: \"normal\",\n lineInterpolate: \"linear\"\n};\n\nfunction preProcessGraph(g) {\n g.nodes().forEach(function(v) {\n var node = g.node(v);\n if (!_.has(node, \"label\") && !g.children(v).length) { node.label = v; }\n\n if (_.has(node, \"paddingX\")) {\n _.defaults(node, {\n paddingLeft: node.paddingX,\n paddingRight: node.paddingX\n });\n }\n\n if (_.has(node, \"paddingY\")) {\n _.defaults(node, {\n paddingTop: node.paddingY,\n paddingBottom: node.paddingY\n });\n }\n\n if (_.has(node, \"padding\")) {\n _.defaults(node, {\n paddingLeft: node.padding,\n paddingRight: node.padding,\n paddingTop: node.padding,\n paddingBottom: node.padding\n });\n }\n\n _.defaults(node, NODE_DEFAULT_ATTRS);\n\n _.each([\"paddingLeft\", \"paddingRight\", \"paddingTop\", \"paddingBottom\"], function(k) {\n node[k] = Number(node[k]);\n });\n\n // Save dimensions for restore during post-processing\n if (_.has(node, \"width\")) { node._prevWidth = node.width; }\n if (_.has(node, \"height\")) { node._prevHeight = node.height; }\n });\n\n g.edges().forEach(function(e) {\n var edge = g.edge(e);\n if (!_.has(edge, \"label\")) { edge.label = \"\"; }\n _.defaults(edge, EDGE_DEFAULT_ATTRS);\n });\n}\n\nfunction postProcessGraph(g) {\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n\n // Restore original dimensions\n if (_.has(node, \"_prevWidth\")) {\n node.width = node._prevWidth;\n } else {\n delete node.width;\n }\n\n if (_.has(node, \"_prevHeight\")) {\n node.height = node._prevHeight;\n } else {\n delete node.height;\n }\n\n delete node._prevWidth;\n delete node._prevHeight;\n });\n}\n\nfunction createOrSelectGroup(root, name) {\n var selection = root.select(\"g.\" + name);\n if (selection.empty()) {\n selection = root.append(\"g\").attr(\"class\", name);\n }\n return selection;\n}\n\n},{\"./arrows\":2,\"./create-clusters\":3,\"./create-edge-labels\":4,\"./create-edge-paths\":5,\"./create-nodes\":6,\"./dagre\":8,\"./lodash\":21,\"./position-clusters\":22,\"./position-edge-labels\":23,\"./position-nodes\":24,\"./shapes\":26}],26:[function(require,module,exports){\n\"use strict\";\n\nvar intersectRect = require(\"./intersect/intersect-rect\"),\n intersectEllipse = require(\"./intersect/intersect-ellipse\"),\n intersectCircle = require(\"./intersect/intersect-circle\"),\n intersectPolygon = require(\"./intersect/intersect-polygon\");\n\nmodule.exports = {\n rect: rect,\n ellipse: ellipse,\n circle: circle,\n diamond: diamond\n};\n\nfunction rect(parent, bbox, node) {\n var shapeSvg = parent.insert(\"rect\", \":first-child\")\n .attr(\"rx\", node.rx)\n .attr(\"ry\", node.ry)\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"width\", bbox.width)\n .attr(\"height\", bbox.height);\n\n node.intersect = function(point) {\n return intersectRect(node, point);\n };\n\n return shapeSvg;\n}\n\nfunction ellipse(parent, bbox, node) {\n var rx = bbox.width / 2,\n ry = bbox.height / 2,\n shapeSvg = parent.insert(\"ellipse\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"rx\", rx)\n .attr(\"ry\", ry);\n\n node.intersect = function(point) {\n return intersectEllipse(node, rx, ry, point);\n };\n\n return shapeSvg;\n}\n\nfunction circle(parent, bbox, node) {\n var r = Math.max(bbox.width, bbox.height) / 2,\n shapeSvg = parent.insert(\"circle\", \":first-child\")\n .attr(\"x\", -bbox.width / 2)\n .attr(\"y\", -bbox.height / 2)\n .attr(\"r\", r);\n\n node.intersect = function(point) {\n return intersectCircle(node, r, point);\n };\n\n return shapeSvg;\n}\n\n// Circumscribe an ellipse for the bounding box with a diamond shape. I derived\n// the function to calculate the diamond shape from:\n// http://mathforum.org/kb/message.jspa?messageID=3750236\nfunction diamond(parent, bbox, node) {\n var w = (bbox.width * Math.SQRT2) / 2,\n h = (bbox.height * Math.SQRT2) / 2,\n points = [\n { x: 0, y: -h },\n { x: -w, y: 0 },\n { x: 0, y: h },\n { x: w, y: 0 }\n ],\n shapeSvg = parent.insert(\"polygon\", \":first-child\")\n .attr(\"points\", points.map(function(p) { return p.x + \",\" + p.y; }).join(\" \"));\n\n node.intersect = function(p) {\n return intersectPolygon(node, points, p);\n };\n\n return shapeSvg;\n}\n\n},{\"./intersect/intersect-circle\":11,\"./intersect/intersect-ellipse\":12,\"./intersect/intersect-polygon\":15,\"./intersect/intersect-rect\":16}],27:[function(require,module,exports){\nvar _ = require(\"./lodash\");\n\n// Public utility functions\nmodule.exports = {\n isSubgraph: isSubgraph,\n edgeToId: edgeToId,\n applyStyle: applyStyle,\n applyClass: applyClass,\n applyTransition: applyTransition\n};\n\n/*\n * Returns true if the specified node in the graph is a subgraph node. A\n * subgraph node is one that contains other nodes.\n */\nfunction isSubgraph(g, v) {\n return !!g.children(v).length;\n}\n\nfunction edgeToId(e) {\n return escapeId(e.v) + \":\" + escapeId(e.w) + \":\" + escapeId(e.name);\n}\n\nvar ID_DELIM = /:/g;\nfunction escapeId(str) {\n return str ? String(str).replace(ID_DELIM, \"\\\\:\") : \"\";\n}\n\nfunction applyStyle(dom, styleFn) {\n if (styleFn) {\n dom.attr(\"style\", styleFn);\n }\n}\n\nfunction applyClass(dom, classFn, otherClasses) {\n if (classFn) {\n dom\n .attr(\"class\", classFn)\n .attr(\"class\", otherClasses + \" \" + dom.attr(\"class\"));\n }\n}\n\nfunction applyTransition(selection, g) {\n var graph = g.graph();\n\n if (_.isPlainObject(graph)) {\n var transition = graph.transition;\n if (_.isFunction(transition)) {\n return transition(selection);\n }\n }\n\n return selection;\n}\n\n},{\"./lodash\":21}],28:[function(require,module,exports){\nmodule.exports = \"0.4.18\";\n\n},{}],29:[function(require,module,exports){\n/*\nCopyright (c) 2012-2014 Chris Pettitt\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n*/\n\nmodule.exports = {\n graphlib: require(\"./lib/graphlib\"),\n\n layout: require(\"./lib/layout\"),\n debug: require(\"./lib/debug\"),\n util: {\n time: require(\"./lib/util\").time,\n notime: require(\"./lib/util\").notime\n },\n version: require(\"./lib/version\")\n};\n\n},{\"./lib/debug\":34,\"./lib/graphlib\":35,\"./lib/layout\":37,\"./lib/util\":57,\"./lib/version\":58}],30:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"./lodash\"),\n greedyFAS = require(\"./greedy-fas\");\n\nmodule.exports = {\n run: run,\n undo: undo\n};\n\nfunction run(g) {\n var fas = (g.graph().acyclicer === \"greedy\"\n ? greedyFAS(g, weightFn(g))\n : dfsFAS(g));\n _.each(fas, function(e) {\n var label = g.edge(e);\n g.removeEdge(e);\n label.forwardName = e.name;\n label.reversed = true;\n g.setEdge(e.w, e.v, label, _.uniqueId(\"rev\"));\n });\n\n function weightFn(g) {\n return function(e) {\n return g.edge(e).weight;\n };\n }\n}\n\nfunction dfsFAS(g) {\n var fas = [],\n stack = {},\n visited = {};\n\n function dfs(v) {\n if (_.has(visited, v)) {\n return;\n }\n visited[v] = true;\n stack[v] = true;\n _.each(g.outEdges(v), function(e) {\n if (_.has(stack, e.w)) {\n fas.push(e);\n } else {\n dfs(e.w);\n }\n });\n delete stack[v];\n }\n\n _.each(g.nodes(), dfs);\n return fas;\n}\n\nfunction undo(g) {\n _.each(g.edges(), function(e) {\n var label = g.edge(e);\n if (label.reversed) {\n g.removeEdge(e);\n\n var forwardName = label.forwardName;\n delete label.reversed;\n delete label.forwardName;\n g.setEdge(e.w, e.v, label, forwardName);\n }\n });\n}\n\n},{\"./greedy-fas\":36,\"./lodash\":38}],31:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n util = require(\"./util\");\n\nmodule.exports = addBorderSegments;\n\nfunction addBorderSegments(g) {\n function dfs(v) {\n var children = g.children(v),\n node = g.node(v);\n if (children.length) {\n _.each(children, dfs);\n }\n\n if (_.has(node, \"minRank\")) {\n node.borderLeft = [];\n node.borderRight = [];\n for (var rank = node.minRank, maxRank = node.maxRank + 1;\n rank < maxRank;\n ++rank) {\n addBorderNode(g, \"borderLeft\", \"_bl\", v, node, rank);\n addBorderNode(g, \"borderRight\", \"_br\", v, node, rank);\n }\n }\n }\n\n _.each(g.children(), dfs);\n}\n\nfunction addBorderNode(g, prop, prefix, sg, sgNode, rank) {\n var label = { width: 0, height: 0, rank: rank, borderType: prop },\n prev = sgNode[prop][rank - 1],\n curr = util.addDummyNode(g, \"border\", label, prefix);\n sgNode[prop][rank] = curr;\n g.setParent(curr, sg);\n if (prev) {\n g.setEdge(prev, curr, { weight: 1 });\n }\n}\n\n},{\"./lodash\":38,\"./util\":57}],32:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"./lodash\");\n\nmodule.exports = {\n adjust: adjust,\n undo: undo\n};\n\nfunction adjust(g) {\n var rankDir = g.graph().rankdir.toLowerCase();\n if (rankDir === \"lr\" || rankDir === \"rl\") {\n swapWidthHeight(g);\n }\n}\n\nfunction undo(g) {\n var rankDir = g.graph().rankdir.toLowerCase();\n if (rankDir === \"bt\" || rankDir === \"rl\") {\n reverseY(g);\n }\n\n if (rankDir === \"lr\" || rankDir === \"rl\") {\n swapXY(g);\n swapWidthHeight(g);\n }\n}\n\nfunction swapWidthHeight(g) {\n _.each(g.nodes(), function(v) { swapWidthHeightOne(g.node(v)); });\n _.each(g.edges(), function(e) { swapWidthHeightOne(g.edge(e)); });\n}\n\nfunction swapWidthHeightOne(attrs) {\n var w = attrs.width;\n attrs.width = attrs.height;\n attrs.height = w;\n}\n\nfunction reverseY(g) {\n _.each(g.nodes(), function(v) { reverseYOne(g.node(v)); });\n\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n _.each(edge.points, reverseYOne);\n if (_.has(edge, \"y\")) {\n reverseYOne(edge);\n }\n });\n}\n\nfunction reverseYOne(attrs) {\n attrs.y = -attrs.y;\n}\n\nfunction swapXY(g) {\n _.each(g.nodes(), function(v) { swapXYOne(g.node(v)); });\n\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n _.each(edge.points, swapXYOne);\n if (_.has(edge, \"x\")) {\n swapXYOne(edge);\n }\n });\n}\n\nfunction swapXYOne(attrs) {\n var x = attrs.x;\n attrs.x = attrs.y;\n attrs.y = x;\n}\n\n},{\"./lodash\":38}],33:[function(require,module,exports){\n/*\n * Simple doubly linked list implementation derived from Cormen, et al.,\n * \"Introduction to Algorithms\".\n */\n\nmodule.exports = List;\n\nfunction List() {\n var sentinel = {};\n sentinel._next = sentinel._prev = sentinel;\n this._sentinel = sentinel;\n}\n\nList.prototype.dequeue = function() {\n var sentinel = this._sentinel,\n entry = sentinel._prev;\n if (entry !== sentinel) {\n unlink(entry);\n return entry;\n }\n};\n\nList.prototype.enqueue = function(entry) {\n var sentinel = this._sentinel;\n if (entry._prev && entry._next) {\n unlink(entry);\n }\n entry._next = sentinel._next;\n sentinel._next._prev = entry;\n sentinel._next = entry;\n entry._prev = sentinel;\n};\n\nList.prototype.toString = function() {\n var strs = [],\n sentinel = this._sentinel,\n curr = sentinel._prev;\n while (curr !== sentinel) {\n strs.push(JSON.stringify(curr, filterOutLinks));\n curr = curr._prev;\n }\n return \"[\" + strs.join(\", \") + \"]\";\n};\n\nfunction unlink(entry) {\n entry._prev._next = entry._next;\n entry._next._prev = entry._prev;\n delete entry._next;\n delete entry._prev;\n}\n\nfunction filterOutLinks(k, v) {\n if (k !== \"_next\" && k !== \"_prev\") {\n return v;\n }\n}\n\n},{}],34:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n util = require(\"./util\"),\n Graph = require(\"./graphlib\").Graph;\n\nmodule.exports = {\n debugOrdering: debugOrdering\n};\n\n/* istanbul ignore next */\nfunction debugOrdering(g) {\n var layerMatrix = util.buildLayerMatrix(g);\n\n var h = new Graph({ compound: true, multigraph: true }).setGraph({});\n\n _.each(g.nodes(), function(v) {\n h.setNode(v, { label: v });\n h.setParent(v, \"layer\" + g.node(v).rank);\n });\n\n _.each(g.edges(), function(e) {\n h.setEdge(e.v, e.w, {}, e.name);\n });\n\n _.each(layerMatrix, function(layer, i) {\n var layerV = \"layer\" + i;\n h.setNode(layerV, { rank: \"same\" });\n _.reduce(layer, function(u, v) {\n h.setEdge(u, v, { style: \"invis\" });\n return v;\n });\n });\n\n return h;\n}\n\n},{\"./graphlib\":35,\"./lodash\":38,\"./util\":57}],35:[function(require,module,exports){\n/* global window */\n\nvar graphlib;\n\nif (typeof require === \"function\") {\n try {\n graphlib = require(\"graphlib\");\n } catch (e) {}\n}\n\nif (!graphlib) {\n graphlib = window.graphlib;\n}\n\nmodule.exports = graphlib;\n\n},{\"graphlib\":59}],36:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n Graph = require(\"./graphlib\").Graph,\n List = require(\"./data/list\");\n\n/*\n * A greedy heuristic for finding a feedback arc set for a graph. A feedback\n * arc set is a set of edges that can be removed to make a graph acyclic.\n * The algorithm comes from: P. Eades, X. Lin, and W. F. Smyth, \"A fast and\n * effective heuristic for the feedback arc set problem.\" This implementation\n * adjusts that from the paper to allow for weighted edges.\n */\nmodule.exports = greedyFAS;\n\nvar DEFAULT_WEIGHT_FN = _.constant(1);\n\nfunction greedyFAS(g, weightFn) {\n if (g.nodeCount() <= 1) {\n return [];\n }\n var state = buildState(g, weightFn || DEFAULT_WEIGHT_FN);\n var results = doGreedyFAS(state.graph, state.buckets, state.zeroIdx);\n\n // Expand multi-edges\n return _.flatten(_.map(results, function(e) {\n return g.outEdges(e.v, e.w);\n }), true);\n}\n\nfunction doGreedyFAS(g, buckets, zeroIdx) {\n var results = [],\n sources = buckets[buckets.length - 1],\n sinks = buckets[0];\n\n var entry;\n while (g.nodeCount()) {\n while ((entry = sinks.dequeue())) { removeNode(g, buckets, zeroIdx, entry); }\n while ((entry = sources.dequeue())) { removeNode(g, buckets, zeroIdx, entry); }\n if (g.nodeCount()) {\n for (var i = buckets.length - 2; i > 0; --i) {\n entry = buckets[i].dequeue();\n if (entry) {\n results = results.concat(removeNode(g, buckets, zeroIdx, entry, true));\n break;\n }\n }\n }\n }\n\n return results;\n}\n\nfunction removeNode(g, buckets, zeroIdx, entry, collectPredecessors) {\n var results = collectPredecessors ? [] : undefined;\n\n _.each(g.inEdges(entry.v), function(edge) {\n var weight = g.edge(edge),\n uEntry = g.node(edge.v);\n\n if (collectPredecessors) {\n results.push({ v: edge.v, w: edge.w });\n }\n\n uEntry.out -= weight;\n assignBucket(buckets, zeroIdx, uEntry);\n });\n\n _.each(g.outEdges(entry.v), function(edge) {\n var weight = g.edge(edge),\n w = edge.w,\n wEntry = g.node(w);\n wEntry[\"in\"] -= weight;\n assignBucket(buckets, zeroIdx, wEntry);\n });\n\n g.removeNode(entry.v);\n\n return results;\n}\n\nfunction buildState(g, weightFn) {\n var fasGraph = new Graph(),\n maxIn = 0,\n maxOut = 0;\n\n _.each(g.nodes(), function(v) {\n fasGraph.setNode(v, { v: v, \"in\": 0, out: 0 });\n });\n\n // Aggregate weights on nodes, but also sum the weights across multi-edges\n // into a single edge for the fasGraph.\n _.each(g.edges(), function(e) {\n var prevWeight = fasGraph.edge(e.v, e.w) || 0,\n weight = weightFn(e),\n edgeWeight = prevWeight + weight;\n fasGraph.setEdge(e.v, e.w, edgeWeight);\n maxOut = Math.max(maxOut, fasGraph.node(e.v).out += weight);\n maxIn = Math.max(maxIn, fasGraph.node(e.w)[\"in\"] += weight);\n });\n\n var buckets = _.range(maxOut + maxIn + 3).map(function() { return new List(); });\n var zeroIdx = maxIn + 1;\n\n _.each(fasGraph.nodes(), function(v) {\n assignBucket(buckets, zeroIdx, fasGraph.node(v));\n });\n\n return { graph: fasGraph, buckets: buckets, zeroIdx: zeroIdx };\n}\n\nfunction assignBucket(buckets, zeroIdx, entry) {\n if (!entry.out) {\n buckets[0].enqueue(entry);\n } else if (!entry[\"in\"]) {\n buckets[buckets.length - 1].enqueue(entry);\n } else {\n buckets[entry.out - entry[\"in\"] + zeroIdx].enqueue(entry);\n }\n}\n\n},{\"./data/list\":33,\"./graphlib\":35,\"./lodash\":38}],37:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"./lodash\"),\n acyclic = require(\"./acyclic\"),\n normalize = require(\"./normalize\"),\n rank = require(\"./rank\"),\n normalizeRanks = require(\"./util\").normalizeRanks,\n parentDummyChains = require(\"./parent-dummy-chains\"),\n removeEmptyRanks = require(\"./util\").removeEmptyRanks,\n nestingGraph = require(\"./nesting-graph\"),\n addBorderSegments = require(\"./add-border-segments\"),\n coordinateSystem = require(\"./coordinate-system\"),\n order = require(\"./order\"),\n position = require(\"./position\"),\n util = require(\"./util\"),\n Graph = require(\"./graphlib\").Graph;\n\nmodule.exports = layout;\n\nfunction layout(g, opts) {\n var time = opts && opts.debugTiming ? util.time : util.notime;\n time(\"layout\", function() {\n var layoutGraph = time(\" buildLayoutGraph\",\n function() { return buildLayoutGraph(g); });\n time(\" runLayout\", function() { runLayout(layoutGraph, time); });\n time(\" updateInputGraph\", function() { updateInputGraph(g, layoutGraph); });\n });\n}\n\nfunction runLayout(g, time) {\n time(\" makeSpaceForEdgeLabels\", function() { makeSpaceForEdgeLabels(g); });\n time(\" removeSelfEdges\", function() { removeSelfEdges(g); });\n time(\" acyclic\", function() { acyclic.run(g); });\n time(\" nestingGraph.run\", function() { nestingGraph.run(g); });\n time(\" rank\", function() { rank(util.asNonCompoundGraph(g)); });\n time(\" injectEdgeLabelProxies\", function() { injectEdgeLabelProxies(g); });\n time(\" removeEmptyRanks\", function() { removeEmptyRanks(g); });\n time(\" nestingGraph.cleanup\", function() { nestingGraph.cleanup(g); });\n time(\" normalizeRanks\", function() { normalizeRanks(g); });\n time(\" assignRankMinMax\", function() { assignRankMinMax(g); });\n time(\" removeEdgeLabelProxies\", function() { removeEdgeLabelProxies(g); });\n time(\" normalize.run\", function() { normalize.run(g); });\n time(\" parentDummyChains\", function() { parentDummyChains(g); });\n time(\" addBorderSegments\", function() { addBorderSegments(g); });\n time(\" order\", function() { order(g); });\n time(\" insertSelfEdges\", function() { insertSelfEdges(g); });\n time(\" adjustCoordinateSystem\", function() { coordinateSystem.adjust(g); });\n time(\" position\", function() { position(g); });\n time(\" positionSelfEdges\", function() { positionSelfEdges(g); });\n time(\" removeBorderNodes\", function() { removeBorderNodes(g); });\n time(\" normalize.undo\", function() { normalize.undo(g); });\n time(\" fixupEdgeLabelCoords\", function() { fixupEdgeLabelCoords(g); });\n time(\" undoCoordinateSystem\", function() { coordinateSystem.undo(g); });\n time(\" translateGraph\", function() { translateGraph(g); });\n time(\" assignNodeIntersects\", function() { assignNodeIntersects(g); });\n time(\" reversePoints\", function() { reversePointsForReversedEdges(g); });\n time(\" acyclic.undo\", function() { acyclic.undo(g); });\n}\n\n/*\n * Copies final layout information from the layout graph back to the input\n * graph. This process only copies whitelisted attributes from the layout graph\n * to the input graph, so it serves as a good place to determine what\n * attributes can influence layout.\n */\nfunction updateInputGraph(inputGraph, layoutGraph) {\n _.each(inputGraph.nodes(), function(v) {\n var inputLabel = inputGraph.node(v),\n layoutLabel = layoutGraph.node(v);\n\n if (inputLabel) {\n inputLabel.x = layoutLabel.x;\n inputLabel.y = layoutLabel.y;\n\n if (layoutGraph.children(v).length) {\n inputLabel.width = layoutLabel.width;\n inputLabel.height = layoutLabel.height;\n }\n }\n });\n\n _.each(inputGraph.edges(), function(e) {\n var inputLabel = inputGraph.edge(e),\n layoutLabel = layoutGraph.edge(e);\n\n inputLabel.points = layoutLabel.points;\n if (_.has(layoutLabel, \"x\")) {\n inputLabel.x = layoutLabel.x;\n inputLabel.y = layoutLabel.y;\n }\n });\n\n inputGraph.graph().width = layoutGraph.graph().width;\n inputGraph.graph().height = layoutGraph.graph().height;\n}\n\nvar graphNumAttrs = [\"nodesep\", \"edgesep\", \"ranksep\", \"marginx\", \"marginy\"],\n graphDefaults = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: \"tb\" },\n graphAttrs = [\"acyclicer\", \"ranker\", \"rankdir\", \"align\"],\n nodeNumAttrs = [\"width\", \"height\"],\n nodeDefaults = { width: 0, height: 0 },\n edgeNumAttrs = [\"minlen\", \"weight\", \"width\", \"height\", \"labeloffset\"],\n edgeDefaults = {\n minlen: 1, weight: 1, width: 0, height: 0,\n labeloffset: 10, labelpos: \"r\"\n },\n edgeAttrs = [\"labelpos\"];\n\n/*\n * Constructs a new graph from the input graph, which can be used for layout.\n * This process copies only whitelisted attributes from the input graph to the\n * layout graph. Thus this function serves as a good place to determine what\n * attributes can influence layout.\n */\nfunction buildLayoutGraph(inputGraph) {\n var g = new Graph({ multigraph: true, compound: true }),\n graph = canonicalize(inputGraph.graph());\n\n g.setGraph(_.merge({},\n graphDefaults,\n selectNumberAttrs(graph, graphNumAttrs),\n _.pick(graph, graphAttrs)));\n\n _.each(inputGraph.nodes(), function(v) {\n var node = canonicalize(inputGraph.node(v));\n g.setNode(v, _.defaults(selectNumberAttrs(node, nodeNumAttrs), nodeDefaults));\n g.setParent(v, inputGraph.parent(v));\n });\n\n _.each(inputGraph.edges(), function(e) {\n var edge = canonicalize(inputGraph.edge(e));\n g.setEdge(e, _.merge({},\n edgeDefaults,\n selectNumberAttrs(edge, edgeNumAttrs),\n _.pick(edge, edgeAttrs)));\n });\n\n return g;\n}\n\n/*\n * This idea comes from the Gansner paper: to account for edge labels in our\n * layout we split each rank in half by doubling minlen and halving ranksep.\n * Then we can place labels at these mid-points between nodes.\n *\n * We also add some minimal padding to the width to push the label for the edge\n * away from the edge itself a bit.\n */\nfunction makeSpaceForEdgeLabels(g) {\n var graph = g.graph();\n graph.ranksep /= 2;\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n edge.minlen *= 2;\n if (edge.labelpos.toLowerCase() !== \"c\") {\n if (graph.rankdir === \"TB\" || graph.rankdir === \"BT\") {\n edge.width += edge.labeloffset;\n } else {\n edge.height += edge.labeloffset;\n }\n }\n });\n}\n\n/*\n * Creates temporary dummy nodes that capture the rank in which each edge's\n * label is going to, if it has one of non-zero width and height. We do this\n * so that we can safely remove empty ranks while preserving balance for the\n * label's position.\n */\nfunction injectEdgeLabelProxies(g) {\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n if (edge.width && edge.height) {\n var v = g.node(e.v),\n w = g.node(e.w),\n label = { rank: (w.rank - v.rank) / 2 + v.rank, e: e };\n util.addDummyNode(g, \"edge-proxy\", label, \"_ep\");\n }\n });\n}\n\nfunction assignRankMinMax(g) {\n var maxRank = 0;\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n if (node.borderTop) {\n node.minRank = g.node(node.borderTop).rank;\n node.maxRank = g.node(node.borderBottom).rank;\n maxRank = _.max(maxRank, node.maxRank);\n }\n });\n g.graph().maxRank = maxRank;\n}\n\nfunction removeEdgeLabelProxies(g) {\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n if (node.dummy === \"edge-proxy\") {\n g.edge(node.e).labelRank = node.rank;\n g.removeNode(v);\n }\n });\n}\n\nfunction translateGraph(g) {\n var minX = Number.POSITIVE_INFINITY,\n maxX = 0,\n minY = Number.POSITIVE_INFINITY,\n maxY = 0,\n graphLabel = g.graph(),\n marginX = graphLabel.marginx || 0,\n marginY = graphLabel.marginy || 0;\n\n function getExtremes(attrs) {\n var x = attrs.x,\n y = attrs.y,\n w = attrs.width,\n h = attrs.height;\n minX = Math.min(minX, x - w / 2);\n maxX = Math.max(maxX, x + w / 2);\n minY = Math.min(minY, y - h / 2);\n maxY = Math.max(maxY, y + h / 2);\n }\n\n _.each(g.nodes(), function(v) { getExtremes(g.node(v)); });\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n if (_.has(edge, \"x\")) {\n getExtremes(edge);\n }\n });\n\n minX -= marginX;\n minY -= marginY;\n\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n node.x -= minX;\n node.y -= minY;\n });\n\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n _.each(edge.points, function(p) {\n p.x -= minX;\n p.y -= minY;\n });\n if (_.has(edge, \"x\")) { edge.x -= minX; }\n if (_.has(edge, \"y\")) { edge.y -= minY; }\n });\n\n graphLabel.width = maxX - minX + marginX;\n graphLabel.height = maxY - minY + marginY;\n}\n\nfunction assignNodeIntersects(g) {\n _.each(g.edges(), function(e) {\n var edge = g.edge(e),\n nodeV = g.node(e.v),\n nodeW = g.node(e.w),\n p1, p2;\n if (!edge.points) {\n edge.points = [];\n p1 = nodeW;\n p2 = nodeV;\n } else {\n p1 = edge.points[0];\n p2 = edge.points[edge.points.length - 1];\n }\n edge.points.unshift(util.intersectRect(nodeV, p1));\n edge.points.push(util.intersectRect(nodeW, p2));\n });\n}\n\nfunction fixupEdgeLabelCoords(g) {\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n if (_.has(edge, \"x\")) {\n if (edge.labelpos === \"l\" || edge.labelpos === \"r\") {\n edge.width -= edge.labeloffset;\n }\n switch (edge.labelpos) {\n case \"l\": edge.x -= edge.width / 2 + edge.labeloffset; break;\n case \"r\": edge.x += edge.width / 2 + edge.labeloffset; break;\n }\n }\n });\n}\n\nfunction reversePointsForReversedEdges(g) {\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n if (edge.reversed) {\n edge.points.reverse();\n }\n });\n}\n\nfunction removeBorderNodes(g) {\n _.each(g.nodes(), function(v) {\n if (g.children(v).length) {\n var node = g.node(v),\n t = g.node(node.borderTop),\n b = g.node(node.borderBottom),\n l = g.node(_.last(node.borderLeft)),\n r = g.node(_.last(node.borderRight));\n\n node.width = Math.abs(r.x - l.x);\n node.height = Math.abs(b.y - t.y);\n node.x = l.x + node.width / 2;\n node.y = t.y + node.height / 2;\n }\n });\n\n _.each(g.nodes(), function(v) {\n if (g.node(v).dummy === \"border\") {\n g.removeNode(v);\n }\n });\n}\n\nfunction removeSelfEdges(g) {\n _.each(g.edges(), function(e) {\n if (e.v === e.w) {\n var node = g.node(e.v);\n if (!node.selfEdges) {\n node.selfEdges = [];\n }\n node.selfEdges.push({ e: e, label: g.edge(e) });\n g.removeEdge(e);\n }\n });\n}\n\nfunction insertSelfEdges(g) {\n var layers = util.buildLayerMatrix(g);\n _.each(layers, function(layer) {\n var orderShift = 0;\n _.each(layer, function(v, i) {\n var node = g.node(v);\n node.order = i + orderShift;\n _.each(node.selfEdges, function(selfEdge) {\n util.addDummyNode(g, \"selfedge\", {\n width: selfEdge.label.width,\n height: selfEdge.label.height,\n rank: node.rank,\n order: i + (++orderShift),\n e: selfEdge.e,\n label: selfEdge.label\n }, \"_se\");\n });\n delete node.selfEdges;\n });\n });\n}\n\nfunction positionSelfEdges(g) {\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n if (node.dummy === \"selfedge\") {\n var selfNode = g.node(node.e.v),\n x = selfNode.x + selfNode.width / 2,\n y = selfNode.y,\n dx = node.x - x,\n dy = selfNode.height / 2;\n g.setEdge(node.e, node.label);\n g.removeNode(v);\n node.label.points = [\n { x: x + 2 * dx / 3, y: y - dy },\n { x: x + 5 * dx / 6, y: y - dy },\n { x: x + dx , y: y },\n { x: x + 5 * dx / 6, y: y + dy },\n { x: x + 2 * dx / 3, y: y + dy },\n ];\n node.label.x = node.x;\n node.label.y = node.y;\n }\n });\n}\n\nfunction selectNumberAttrs(obj, attrs) {\n return _.mapValues(_.pick(obj, attrs), Number);\n}\n\nfunction canonicalize(attrs) {\n var newAttrs = {};\n _.each(attrs, function(v, k) {\n newAttrs[k.toLowerCase()] = v;\n });\n return newAttrs;\n}\n\n},{\"./acyclic\":30,\"./add-border-segments\":31,\"./coordinate-system\":32,\"./graphlib\":35,\"./lodash\":38,\"./nesting-graph\":39,\"./normalize\":40,\"./order\":45,\"./parent-dummy-chains\":50,\"./position\":52,\"./rank\":54,\"./util\":57}],38:[function(require,module,exports){\n/* global window */\n\nvar lodash;\n\nif (typeof require === \"function\") {\n try {\n lodash = require(\"lodash\");\n } catch (e) {}\n}\n\nif (!lodash) {\n lodash = window._;\n}\n\nmodule.exports = lodash;\n\n},{\"lodash\":79}],39:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n util = require(\"./util\");\n\nmodule.exports = {\n run: run,\n cleanup: cleanup\n};\n\n/*\n * A nesting graph creates dummy nodes for the tops and bottoms of subgraphs,\n * adds appropriate edges to ensure that all cluster nodes are placed between\n * these boundries, and ensures that the graph is connected.\n *\n * In addition we ensure, through the use of the minlen property, that nodes\n * and subgraph border nodes to not end up on the same rank.\n *\n * Preconditions:\n *\n * 1. Input graph is a DAG\n * 2. Nodes in the input graph has a minlen attribute\n *\n * Postconditions:\n *\n * 1. Input graph is connected.\n * 2. Dummy nodes are added for the tops and bottoms of subgraphs.\n * 3. The minlen attribute for nodes is adjusted to ensure nodes do not\n * get placed on the same rank as subgraph border nodes.\n *\n * The nesting graph idea comes from Sander, \"Layout of Compound Directed\n * Graphs.\"\n */\nfunction run(g) {\n var root = util.addDummyNode(g, \"root\", {}, \"_root\"),\n depths = treeDepths(g),\n height = _.max(depths) - 1,\n nodeSep = 2 * height + 1;\n\n g.graph().nestingRoot = root;\n\n // Multiply minlen by nodeSep to align nodes on non-border ranks.\n _.each(g.edges(), function(e) { g.edge(e).minlen *= nodeSep; });\n\n // Calculate a weight that is sufficient to keep subgraphs vertically compact\n var weight = sumWeights(g) + 1;\n\n // Create border nodes and link them up\n _.each(g.children(), function(child) {\n dfs(g, root, nodeSep, weight, height, depths, child);\n });\n\n // Save the multiplier for node layers for later removal of empty border\n // layers.\n g.graph().nodeRankFactor = nodeSep;\n}\n\nfunction dfs(g, root, nodeSep, weight, height, depths, v) {\n var children = g.children(v);\n if (!children.length) {\n if (v !== root) {\n g.setEdge(root, v, { weight: 0, minlen: nodeSep });\n }\n return;\n }\n\n var top = util.addBorderNode(g, \"_bt\"),\n bottom = util.addBorderNode(g, \"_bb\"),\n label = g.node(v);\n\n g.setParent(top, v);\n label.borderTop = top;\n g.setParent(bottom, v);\n label.borderBottom = bottom;\n\n _.each(children, function(child) {\n dfs(g, root, nodeSep, weight, height, depths, child);\n\n var childNode = g.node(child),\n childTop = childNode.borderTop ? childNode.borderTop : child,\n childBottom = childNode.borderBottom ? childNode.borderBottom : child,\n thisWeight = childNode.borderTop ? weight : 2 * weight,\n minlen = childTop !== childBottom ? 1 : height - depths[v] + 1;\n\n g.setEdge(top, childTop, {\n weight: thisWeight,\n minlen: minlen,\n nestingEdge: true\n });\n\n g.setEdge(childBottom, bottom, {\n weight: thisWeight,\n minlen: minlen,\n nestingEdge: true\n });\n });\n\n if (!g.parent(v)) {\n g.setEdge(root, top, { weight: 0, minlen: height + depths[v] });\n }\n}\n\nfunction treeDepths(g) {\n var depths = {};\n function dfs(v, depth) {\n var children = g.children(v);\n if (children && children.length) {\n _.each(children, function(child) {\n dfs(child, depth + 1);\n });\n }\n depths[v] = depth;\n }\n _.each(g.children(), function(v) { dfs(v, 1); });\n return depths;\n}\n\nfunction sumWeights(g) {\n return _.reduce(g.edges(), function(acc, e) {\n return acc + g.edge(e).weight;\n }, 0);\n}\n\nfunction cleanup(g) {\n var graphLabel = g.graph();\n g.removeNode(graphLabel.nestingRoot);\n delete graphLabel.nestingRoot;\n _.each(g.edges(), function(e) {\n var edge = g.edge(e);\n if (edge.nestingEdge) {\n g.removeEdge(e);\n }\n });\n}\n\n},{\"./lodash\":38,\"./util\":57}],40:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"./lodash\"),\n util = require(\"./util\");\n\nmodule.exports = {\n run: run,\n undo: undo\n};\n\n/*\n * Breaks any long edges in the graph into short segments that span 1 layer\n * each. This operation is undoable with the denormalize function.\n *\n * Pre-conditions:\n *\n * 1. The input graph is a DAG.\n * 2. Each node in the graph has a \"rank\" property.\n *\n * Post-condition:\n *\n * 1. All edges in the graph have a length of 1.\n * 2. Dummy nodes are added where edges have been split into segments.\n * 3. The graph is augmented with a \"dummyChains\" attribute which contains\n * the first dummy in each chain of dummy nodes produced.\n */\nfunction run(g) {\n g.graph().dummyChains = [];\n _.each(g.edges(), function(edge) { normalizeEdge(g, edge); });\n}\n\nfunction normalizeEdge(g, e) {\n var v = e.v,\n vRank = g.node(v).rank,\n w = e.w,\n wRank = g.node(w).rank,\n name = e.name,\n edgeLabel = g.edge(e),\n labelRank = edgeLabel.labelRank;\n\n if (wRank === vRank + 1) return;\n\n g.removeEdge(e);\n\n var dummy, attrs, i;\n for (i = 0, ++vRank; vRank < wRank; ++i, ++vRank) {\n edgeLabel.points = [];\n attrs = {\n width: 0, height: 0,\n edgeLabel: edgeLabel, edgeObj: e,\n rank: vRank\n };\n dummy = util.addDummyNode(g, \"edge\", attrs, \"_d\");\n if (vRank === labelRank) {\n attrs.width = edgeLabel.width;\n attrs.height = edgeLabel.height;\n attrs.dummy = \"edge-label\";\n attrs.labelpos = edgeLabel.labelpos;\n }\n g.setEdge(v, dummy, { weight: edgeLabel.weight }, name);\n if (i === 0) {\n g.graph().dummyChains.push(dummy);\n }\n v = dummy;\n }\n\n g.setEdge(v, w, { weight: edgeLabel.weight }, name);\n}\n\nfunction undo(g) {\n _.each(g.graph().dummyChains, function(v) {\n var node = g.node(v),\n origLabel = node.edgeLabel,\n w;\n g.setEdge(node.edgeObj, origLabel);\n while (node.dummy) {\n w = g.successors(v)[0];\n g.removeNode(v);\n origLabel.points.push({ x: node.x, y: node.y });\n if (node.dummy === \"edge-label\") {\n origLabel.x = node.x;\n origLabel.y = node.y;\n origLabel.width = node.width;\n origLabel.height = node.height;\n }\n v = w;\n node = g.node(v);\n }\n });\n}\n\n},{\"./lodash\":38,\"./util\":57}],41:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = addSubgraphConstraints;\n\nfunction addSubgraphConstraints(g, cg, vs) {\n var prev = {},\n rootPrev;\n\n _.each(vs, function(v) {\n var child = g.parent(v),\n parent,\n prevChild;\n while (child) {\n parent = g.parent(child);\n if (parent) {\n prevChild = prev[parent];\n prev[parent] = child;\n } else {\n prevChild = rootPrev;\n rootPrev = child;\n }\n if (prevChild && prevChild !== child) {\n cg.setEdge(prevChild, child);\n return;\n }\n child = parent;\n }\n });\n\n /*\n function dfs(v) {\n var children = v ? g.children(v) : g.children();\n if (children.length) {\n var min = Number.POSITIVE_INFINITY,\n subgraphs = [];\n _.each(children, function(child) {\n var childMin = dfs(child);\n if (g.children(child).length) {\n subgraphs.push({ v: child, order: childMin });\n }\n min = Math.min(min, childMin);\n });\n _.reduce(_.sortBy(subgraphs, \"order\"), function(prev, curr) {\n cg.setEdge(prev.v, curr.v);\n return curr;\n });\n return min;\n }\n return g.node(v).order;\n }\n dfs(undefined);\n */\n}\n\n},{\"../lodash\":38}],42:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = barycenter;\n\nfunction barycenter(g, movable) {\n return _.map(movable, function(v) {\n var inV = g.inEdges(v);\n if (!inV.length) {\n return { v: v };\n } else {\n var result = _.reduce(inV, function(acc, e) {\n var edge = g.edge(e),\n nodeU = g.node(e.v);\n return {\n sum: acc.sum + (edge.weight * nodeU.order),\n weight: acc.weight + edge.weight\n };\n }, { sum: 0, weight: 0 });\n\n return {\n v: v,\n barycenter: result.sum / result.weight,\n weight: result.weight\n };\n }\n });\n}\n\n\n},{\"../lodash\":38}],43:[function(require,module,exports){\nvar _ = require(\"../lodash\"),\n Graph = require(\"../graphlib\").Graph;\n\nmodule.exports = buildLayerGraph;\n\n/*\n * Constructs a graph that can be used to sort a layer of nodes. The graph will\n * contain all base and subgraph nodes from the request layer in their original\n * hierarchy and any edges that are incident on these nodes and are of the type\n * requested by the \"relationship\" parameter.\n *\n * Nodes from the requested rank that do not have parents are assigned a root\n * node in the output graph, which is set in the root graph attribute. This\n * makes it easy to walk the hierarchy of movable nodes during ordering.\n *\n * Pre-conditions:\n *\n * 1. Input graph is a DAG\n * 2. Base nodes in the input graph have a rank attribute\n * 3. Subgraph nodes in the input graph has minRank and maxRank attributes\n * 4. Edges have an assigned weight\n *\n * Post-conditions:\n *\n * 1. Output graph has all nodes in the movable rank with preserved\n * hierarchy.\n * 2. Root nodes in the movable layer are made children of the node\n * indicated by the root attribute of the graph.\n * 3. Non-movable nodes incident on movable nodes, selected by the\n * relationship parameter, are included in the graph (without hierarchy).\n * 4. Edges incident on movable nodes, selected by the relationship\n * parameter, are added to the output graph.\n * 5. The weights for copied edges are aggregated as need, since the output\n * graph is not a multi-graph.\n */\nfunction buildLayerGraph(g, rank, relationship) {\n var root = createRootNode(g),\n result = new Graph({ compound: true }).setGraph({ root: root })\n .setDefaultNodeLabel(function(v) { return g.node(v); });\n\n _.each(g.nodes(), function(v) {\n var node = g.node(v),\n parent = g.parent(v);\n\n if (node.rank === rank || node.minRank <= rank && rank <= node.maxRank) {\n result.setNode(v);\n result.setParent(v, parent || root);\n\n // This assumes we have only short edges!\n _.each(g[relationship](v), function(e) {\n var u = e.v === v ? e.w : e.v,\n edge = result.edge(u, v),\n weight = !_.isUndefined(edge) ? edge.weight : 0;\n result.setEdge(u, v, { weight: g.edge(e).weight + weight });\n });\n\n if (_.has(node, \"minRank\")) {\n result.setNode(v, {\n borderLeft: node.borderLeft[rank],\n borderRight: node.borderRight[rank]\n });\n }\n }\n });\n\n return result;\n}\n\nfunction createRootNode(g) {\n var v;\n while (g.hasNode((v = _.uniqueId(\"_root\"))));\n return v;\n}\n\n},{\"../graphlib\":35,\"../lodash\":38}],44:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = crossCount;\n\n/*\n * A function that takes a layering (an array of layers, each with an array of\n * ordererd nodes) and a graph and returns a weighted crossing count.\n *\n * Pre-conditions:\n *\n * 1. Input graph must be simple (not a multigraph), directed, and include\n * only simple edges.\n * 2. Edges in the input graph must have assigned weights.\n *\n * Post-conditions:\n *\n * 1. The graph and layering matrix are left unchanged.\n *\n * This algorithm is derived from Barth, et al., \"Bilayer Cross Counting.\"\n */\nfunction crossCount(g, layering) {\n var cc = 0;\n for (var i = 1; i < layering.length; ++i) {\n cc += twoLayerCrossCount(g, layering[i-1], layering[i]);\n }\n return cc;\n}\n\nfunction twoLayerCrossCount(g, northLayer, southLayer) {\n // Sort all of the edges between the north and south layers by their position\n // in the north layer and then the south. Map these edges to the position of\n // their head in the south layer.\n var southPos = _.zipObject(southLayer,\n _.map(southLayer, function (v, i) { return i; }));\n var southEntries = _.flatten(_.map(northLayer, function(v) {\n return _.chain(g.outEdges(v))\n .map(function(e) {\n return { pos: southPos[e.w], weight: g.edge(e).weight };\n })\n .sortBy(\"pos\")\n .value();\n }), true);\n\n // Build the accumulator tree\n var firstIndex = 1;\n while (firstIndex < southLayer.length) firstIndex <<= 1;\n var treeSize = 2 * firstIndex - 1;\n firstIndex -= 1;\n var tree = _.map(new Array(treeSize), function() { return 0; });\n\n // Calculate the weighted crossings\n var cc = 0;\n _.each(southEntries.forEach(function(entry) {\n var index = entry.pos + firstIndex;\n tree[index] += entry.weight;\n var weightSum = 0;\n while (index > 0) {\n if (index % 2) {\n weightSum += tree[index + 1];\n }\n index = (index - 1) >> 1;\n tree[index] += entry.weight;\n }\n cc += entry.weight * weightSum;\n }));\n\n return cc;\n}\n\n},{\"../lodash\":38}],45:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\"),\n initOrder = require(\"./init-order\"),\n crossCount = require(\"./cross-count\"),\n sortSubgraph = require(\"./sort-subgraph\"),\n buildLayerGraph = require(\"./build-layer-graph\"),\n addSubgraphConstraints = require(\"./add-subgraph-constraints\"),\n Graph = require(\"../graphlib\").Graph,\n util = require(\"../util\");\n\nmodule.exports = order;\n\n/*\n * Applies heuristics to minimize edge crossings in the graph and sets the best\n * order solution as an order attribute on each node.\n *\n * Pre-conditions:\n *\n * 1. Graph must be DAG\n * 2. Graph nodes must be objects with a \"rank\" attribute\n * 3. Graph edges must have the \"weight\" attribute\n *\n * Post-conditions:\n *\n * 1. Graph nodes will have an \"order\" attribute based on the results of the\n * algorithm.\n */\nfunction order(g) {\n var maxRank = util.maxRank(g),\n downLayerGraphs = buildLayerGraphs(g, _.range(1, maxRank + 1), \"inEdges\"),\n upLayerGraphs = buildLayerGraphs(g, _.range(maxRank - 1, -1, -1), \"outEdges\");\n\n var layering = initOrder(g);\n assignOrder(g, layering);\n\n var bestCC = Number.POSITIVE_INFINITY,\n best;\n\n for (var i = 0, lastBest = 0; lastBest < 4; ++i, ++lastBest) {\n sweepLayerGraphs(i % 2 ? downLayerGraphs : upLayerGraphs, i % 4 >= 2);\n\n layering = util.buildLayerMatrix(g);\n var cc = crossCount(g, layering);\n if (cc < bestCC) {\n lastBest = 0;\n best = _.cloneDeep(layering);\n bestCC = cc;\n }\n }\n\n assignOrder(g, best);\n}\n\nfunction buildLayerGraphs(g, ranks, relationship) {\n return _.map(ranks, function(rank) {\n return buildLayerGraph(g, rank, relationship);\n });\n}\n\nfunction sweepLayerGraphs(layerGraphs, biasRight) {\n var cg = new Graph();\n _.each(layerGraphs, function(lg) {\n var root = lg.graph().root;\n var sorted = sortSubgraph(lg, root, cg, biasRight);\n _.each(sorted.vs, function(v, i) {\n lg.node(v).order = i;\n });\n addSubgraphConstraints(lg, cg, sorted.vs);\n });\n}\n\nfunction assignOrder(g, layering) {\n _.each(layering, function(layer) {\n _.each(layer, function(v, i) {\n g.node(v).order = i;\n });\n });\n}\n\n},{\"../graphlib\":35,\"../lodash\":38,\"../util\":57,\"./add-subgraph-constraints\":41,\"./build-layer-graph\":43,\"./cross-count\":44,\"./init-order\":46,\"./sort-subgraph\":48}],46:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = initOrder;\n\n/*\n * Assigns an initial order value for each node by performing a DFS search\n * starting from nodes in the first rank. Nodes are assigned an order in their\n * rank as they are first visited.\n *\n * This approach comes from Gansner, et al., \"A Technique for Drawing Directed\n * Graphs.\"\n *\n * Returns a layering matrix with an array per layer and each layer sorted by\n * the order of its nodes.\n */\nfunction initOrder(g) {\n var visited = {},\n simpleNodes = _.filter(g.nodes(), function(v) {\n return !g.children(v).length;\n }),\n maxRank = _.max(_.map(simpleNodes, function(v) { return g.node(v).rank; })),\n layers = _.map(_.range(maxRank + 1), function() { return []; });\n\n function dfs(v) {\n if (_.has(visited, v)) return;\n visited[v] = true;\n var node = g.node(v);\n layers[node.rank].push(v);\n _.each(g.successors(v), dfs);\n }\n\n var orderedVs = _.sortBy(simpleNodes, function(v) { return g.node(v).rank; });\n _.each(orderedVs, dfs);\n\n return layers;\n}\n\n},{\"../lodash\":38}],47:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = resolveConflicts;\n\n/*\n * Given a list of entries of the form {v, barycenter, weight} and a\n * constraint graph this function will resolve any conflicts between the\n * constraint graph and the barycenters for the entries. If the barycenters for\n * an entry would violate a constraint in the constraint graph then we coalesce\n * the nodes in the conflict into a new node that respects the contraint and\n * aggregates barycenter and weight information.\n *\n * This implementation is based on the description in Forster, \"A Fast and\n * Simple Hueristic for Constrained Two-Level Crossing Reduction,\" thought it\n * differs in some specific details.\n *\n * Pre-conditions:\n *\n * 1. Each entry has the form {v, barycenter, weight}, or if the node has\n * no barycenter, then {v}.\n *\n * Returns:\n *\n * A new list of entries of the form {vs, i, barycenter, weight}. The list\n * `vs` may either be a singleton or it may be an aggregation of nodes\n * ordered such that they do not violate constraints from the constraint\n * graph. The property `i` is the lowest original index of any of the\n * elements in `vs`.\n */\nfunction resolveConflicts(entries, cg) {\n var mappedEntries = {};\n _.each(entries, function(entry, i) {\n var tmp = mappedEntries[entry.v] = {\n indegree: 0,\n \"in\": [],\n out: [],\n vs: [entry.v],\n i: i\n };\n if (!_.isUndefined(entry.barycenter)) {\n tmp.barycenter = entry.barycenter;\n tmp.weight = entry.weight;\n }\n });\n\n _.each(cg.edges(), function(e) {\n var entryV = mappedEntries[e.v],\n entryW = mappedEntries[e.w];\n if (!_.isUndefined(entryV) && !_.isUndefined(entryW)) {\n entryW.indegree++;\n entryV.out.push(mappedEntries[e.w]);\n }\n });\n\n var sourceSet = _.filter(mappedEntries, function(entry) {\n return !entry.indegree;\n });\n\n return doResolveConflicts(sourceSet);\n}\n\nfunction doResolveConflicts(sourceSet) {\n var entries = [];\n\n function handleIn(vEntry) {\n return function(uEntry) {\n if (uEntry.merged) {\n return;\n }\n if (_.isUndefined(uEntry.barycenter) ||\n _.isUndefined(vEntry.barycenter) ||\n uEntry.barycenter >= vEntry.barycenter) {\n mergeEntries(vEntry, uEntry);\n }\n };\n }\n\n function handleOut(vEntry) {\n return function(wEntry) {\n wEntry[\"in\"].push(vEntry);\n if (--wEntry.indegree === 0) {\n sourceSet.push(wEntry);\n }\n };\n }\n\n while (sourceSet.length) {\n var entry = sourceSet.pop();\n entries.push(entry);\n _.each(entry[\"in\"].reverse(), handleIn(entry));\n _.each(entry.out, handleOut(entry));\n }\n\n return _.chain(entries)\n .filter(function(entry) { return !entry.merged; })\n .map(function(entry) {\n return _.pick(entry, [\"vs\", \"i\", \"barycenter\", \"weight\"]);\n })\n .value();\n}\n\nfunction mergeEntries(target, source) {\n var sum = 0,\n weight = 0;\n\n if (target.weight) {\n sum += target.barycenter * target.weight;\n weight += target.weight;\n }\n\n if (source.weight) {\n sum += source.barycenter * source.weight;\n weight += source.weight;\n }\n\n target.vs = source.vs.concat(target.vs);\n target.barycenter = sum / weight;\n target.weight = weight;\n target.i = Math.min(source.i, target.i);\n source.merged = true;\n}\n\n},{\"../lodash\":38}],48:[function(require,module,exports){\nvar _ = require(\"../lodash\"),\n barycenter = require(\"./barycenter\"),\n resolveConflicts = require(\"./resolve-conflicts\"),\n sort = require(\"./sort\");\n\nmodule.exports = sortSubgraph;\n\nfunction sortSubgraph(g, v, cg, biasRight) {\n var movable = g.children(v),\n node = g.node(v),\n bl = node ? node.borderLeft : undefined,\n br = node ? node.borderRight: undefined,\n subgraphs = {};\n\n if (bl) {\n movable = _.filter(movable, function(w) {\n return w !== bl && w !== br;\n });\n }\n\n var barycenters = barycenter(g, movable);\n _.each(barycenters, function(entry) {\n if (g.children(entry.v).length) {\n var subgraphResult = sortSubgraph(g, entry.v, cg, biasRight);\n subgraphs[entry.v] = subgraphResult;\n if (_.has(subgraphResult, \"barycenter\")) {\n mergeBarycenters(entry, subgraphResult);\n }\n }\n });\n\n var entries = resolveConflicts(barycenters, cg);\n expandSubgraphs(entries, subgraphs);\n\n var result = sort(entries, biasRight);\n\n if (bl) {\n result.vs = _.flatten([bl, result.vs, br], true);\n if (g.predecessors(bl).length) {\n var blPred = g.node(g.predecessors(bl)[0]),\n brPred = g.node(g.predecessors(br)[0]);\n if (!_.has(result, \"barycenter\")) {\n result.barycenter = 0;\n result.weight = 0;\n }\n result.barycenter = (result.barycenter * result.weight +\n blPred.order + brPred.order) / (result.weight + 2);\n result.weight += 2;\n }\n }\n\n return result;\n}\n\nfunction expandSubgraphs(entries, subgraphs) {\n _.each(entries, function(entry) {\n entry.vs = _.flatten(entry.vs.map(function(v) {\n if (subgraphs[v]) {\n return subgraphs[v].vs;\n }\n return v;\n }), true);\n });\n}\n\nfunction mergeBarycenters(target, other) {\n if (!_.isUndefined(target.barycenter)) {\n target.barycenter = (target.barycenter * target.weight +\n other.barycenter * other.weight) /\n (target.weight + other.weight);\n target.weight += other.weight;\n } else {\n target.barycenter = other.barycenter;\n target.weight = other.weight;\n }\n}\n\n},{\"../lodash\":38,\"./barycenter\":42,\"./resolve-conflicts\":47,\"./sort\":49}],49:[function(require,module,exports){\nvar _ = require(\"../lodash\"),\n util = require(\"../util\");\n\nmodule.exports = sort;\n\nfunction sort(entries, biasRight) {\n var parts = util.partition(entries, function(entry) {\n return _.has(entry, \"barycenter\");\n });\n var sortable = parts.lhs,\n unsortable = _.sortBy(parts.rhs, function(entry) { return -entry.i; }),\n vs = [],\n sum = 0,\n weight = 0,\n vsIndex = 0;\n\n sortable.sort(compareWithBias(!!biasRight));\n\n vsIndex = consumeUnsortable(vs, unsortable, vsIndex);\n\n _.each(sortable, function (entry) {\n vsIndex += entry.vs.length;\n vs.push(entry.vs);\n sum += entry.barycenter * entry.weight;\n weight += entry.weight;\n vsIndex = consumeUnsortable(vs, unsortable, vsIndex);\n });\n\n var result = { vs: _.flatten(vs, true) };\n if (weight) {\n result.barycenter = sum / weight;\n result.weight = weight;\n }\n return result;\n}\n\nfunction consumeUnsortable(vs, unsortable, index) {\n var last;\n while (unsortable.length && (last = _.last(unsortable)).i <= index) {\n unsortable.pop();\n vs.push(last.vs);\n index++;\n }\n return index;\n}\n\nfunction compareWithBias(bias) {\n return function(entryV, entryW) {\n if (entryV.barycenter < entryW.barycenter) {\n return -1;\n } else if (entryV.barycenter > entryW.barycenter) {\n return 1;\n }\n\n return !bias ? entryV.i - entryW.i : entryW.i - entryV.i;\n };\n}\n\n},{\"../lodash\":38,\"../util\":57}],50:[function(require,module,exports){\nvar _ = require(\"./lodash\");\n\nmodule.exports = parentDummyChains;\n\nfunction parentDummyChains(g) {\n var postorderNums = postorder(g);\n\n _.each(g.graph().dummyChains, function(v) {\n var node = g.node(v),\n edgeObj = node.edgeObj,\n pathData = findPath(g, postorderNums, edgeObj.v, edgeObj.w),\n path = pathData.path,\n lca = pathData.lca,\n pathIdx = 0,\n pathV = path[pathIdx],\n ascending = true;\n\n while (v !== edgeObj.w) {\n node = g.node(v);\n\n if (ascending) {\n while ((pathV = path[pathIdx]) !== lca &&\n g.node(pathV).maxRank < node.rank) {\n pathIdx++;\n }\n\n if (pathV === lca) {\n ascending = false;\n }\n }\n\n if (!ascending) {\n while (pathIdx < path.length - 1 &&\n g.node(pathV = path[pathIdx + 1]).minRank <= node.rank) {\n pathIdx++;\n }\n pathV = path[pathIdx];\n }\n\n g.setParent(v, pathV);\n v = g.successors(v)[0];\n }\n });\n}\n\n// Find a path from v to w through the lowest common ancestor (LCA). Return the\n// full path and the LCA.\nfunction findPath(g, postorderNums, v, w) {\n var vPath = [],\n wPath = [],\n low = Math.min(postorderNums[v].low, postorderNums[w].low),\n lim = Math.max(postorderNums[v].lim, postorderNums[w].lim),\n parent,\n lca;\n\n // Traverse up from v to find the LCA\n parent = v;\n do {\n parent = g.parent(parent);\n vPath.push(parent);\n } while (parent &&\n (postorderNums[parent].low > low || lim > postorderNums[parent].lim));\n lca = parent;\n\n // Traverse from w to LCA\n parent = w;\n while ((parent = g.parent(parent)) !== lca) {\n wPath.push(parent);\n }\n\n return { path: vPath.concat(wPath.reverse()), lca: lca };\n}\n\nfunction postorder(g) {\n var result = {},\n lim = 0;\n\n function dfs(v) {\n var low = lim;\n _.each(g.children(v), dfs);\n result[v] = { low: low, lim: lim++ };\n }\n _.each(g.children(), dfs);\n\n return result;\n}\n\n},{\"./lodash\":38}],51:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\"),\n Graph = require(\"../graphlib\").Graph,\n util = require(\"../util\");\n\n/*\n * This module provides coordinate assignment based on Brandes and Köpf, \"Fast\n * and Simple Horizontal Coordinate Assignment.\"\n */\n\nmodule.exports = {\n positionX: positionX,\n findType1Conflicts: findType1Conflicts,\n findType2Conflicts: findType2Conflicts,\n addConflict: addConflict,\n hasConflict: hasConflict,\n verticalAlignment: verticalAlignment,\n horizontalCompaction: horizontalCompaction,\n alignCoordinates: alignCoordinates,\n findSmallestWidthAlignment: findSmallestWidthAlignment,\n balance: balance\n};\n\n/*\n * Marks all edges in the graph with a type-1 conflict with the \"type1Conflict\"\n * property. A type-1 conflict is one where a non-inner segment crosses an\n * inner segment. An inner segment is an edge with both incident nodes marked\n * with the \"dummy\" property.\n *\n * This algorithm scans layer by layer, starting with the second, for type-1\n * conflicts between the current layer and the previous layer. For each layer\n * it scans the nodes from left to right until it reaches one that is incident\n * on an inner segment. It then scans predecessors to determine if they have\n * edges that cross that inner segment. At the end a final scan is done for all\n * nodes on the current rank to see if they cross the last visited inner\n * segment.\n *\n * This algorithm (safely) assumes that a dummy node will only be incident on a\n * single node in the layers being scanned.\n */\nfunction findType1Conflicts(g, layering) {\n var conflicts = {};\n\n function visitLayer(prevLayer, layer) {\n var\n // last visited node in the previous layer that is incident on an inner\n // segment.\n k0 = 0,\n // Tracks the last node in this layer scanned for crossings with a type-1\n // segment.\n scanPos = 0,\n prevLayerLength = prevLayer.length,\n lastNode = _.last(layer);\n\n _.each(layer, function(v, i) {\n var w = findOtherInnerSegmentNode(g, v),\n k1 = w ? g.node(w).order : prevLayerLength;\n\n if (w || v === lastNode) {\n _.each(layer.slice(scanPos, i +1), function(scanNode) {\n _.each(g.predecessors(scanNode), function(u) {\n var uLabel = g.node(u),\n uPos = uLabel.order;\n if ((uPos < k0 || k1 < uPos) &&\n !(uLabel.dummy && g.node(scanNode).dummy)) {\n addConflict(conflicts, u, scanNode);\n }\n });\n });\n scanPos = i + 1;\n k0 = k1;\n }\n });\n\n return layer;\n }\n\n _.reduce(layering, visitLayer);\n return conflicts;\n}\n\nfunction findType2Conflicts(g, layering) {\n var conflicts = {};\n\n function scan(south, southPos, southEnd, prevNorthBorder, nextNorthBorder) {\n var v;\n _.each(_.range(southPos, southEnd), function(i) {\n v = south[i];\n if (g.node(v).dummy) {\n _.each(g.predecessors(v), function(u) {\n var uNode = g.node(u);\n if (uNode.dummy &&\n (uNode.order < prevNorthBorder || uNode.order > nextNorthBorder)) {\n addConflict(conflicts, u, v);\n }\n });\n }\n });\n }\n\n\n function visitLayer(north, south) {\n var prevNorthPos = -1,\n nextNorthPos,\n southPos = 0;\n\n _.each(south, function(v, southLookahead) {\n if (g.node(v).dummy === \"border\") {\n var predecessors = g.predecessors(v);\n if (predecessors.length) {\n nextNorthPos = g.node(predecessors[0]).order;\n scan(south, southPos, southLookahead, prevNorthPos, nextNorthPos);\n southPos = southLookahead;\n prevNorthPos = nextNorthPos;\n }\n }\n scan(south, southPos, south.length, nextNorthPos, north.length);\n });\n\n return south;\n }\n\n _.reduce(layering, visitLayer);\n return conflicts;\n}\n\nfunction findOtherInnerSegmentNode(g, v) {\n if (g.node(v).dummy) {\n return _.find(g.predecessors(v), function(u) {\n return g.node(u).dummy;\n });\n }\n}\n\nfunction addConflict(conflicts, v, w) {\n if (v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n\n var conflictsV = conflicts[v];\n if (!conflictsV) {\n conflicts[v] = conflictsV = {};\n }\n conflictsV[w] = true;\n}\n\nfunction hasConflict(conflicts, v, w) {\n if (v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n return _.has(conflicts[v], w);\n}\n\n/*\n * Try to align nodes into vertical \"blocks\" where possible. This algorithm\n * attempts to align a node with one of its median neighbors. If the edge\n * connecting a neighbor is a type-1 conflict then we ignore that possibility.\n * If a previous node has already formed a block with a node after the node\n * we're trying to form a block with, we also ignore that possibility - our\n * blocks would be split in that scenario.\n */\nfunction verticalAlignment(g, layering, conflicts, neighborFn) {\n var root = {},\n align = {},\n pos = {};\n\n // We cache the position here based on the layering because the graph and\n // layering may be out of sync. The layering matrix is manipulated to\n // generate different extreme alignments.\n _.each(layering, function(layer) {\n _.each(layer, function(v, order) {\n root[v] = v;\n align[v] = v;\n pos[v] = order;\n });\n });\n\n _.each(layering, function(layer) {\n var prevIdx = -1;\n _.each(layer, function(v) {\n var ws = neighborFn(v);\n if (ws.length) {\n ws = _.sortBy(ws, function(w) { return pos[w]; });\n var mp = (ws.length - 1) / 2;\n for (var i = Math.floor(mp), il = Math.ceil(mp); i <= il; ++i) {\n var w = ws[i];\n if (align[v] === v &&\n prevIdx < pos[w] &&\n !hasConflict(conflicts, v, w)) {\n align[w] = v;\n align[v] = root[v] = root[w];\n prevIdx = pos[w];\n }\n }\n }\n });\n });\n\n return { root: root, align: align };\n}\n\nfunction horizontalCompaction(g, layering, root, align, reverseSep) {\n // This portion of the algorithm differs from BK due to a number of problems.\n // Instead of their algorithm we construct a new block graph and do two\n // sweeps. The first sweep places blocks with the smallest possible\n // coordinates. The second sweep removes unused space by moving blocks to the\n // greatest coordinates without violating separation.\n var xs = {},\n blockG = buildBlockGraph(g, layering, root, reverseSep);\n\n // First pass, assign smallest coordinates via DFS\n var visited = {};\n function pass1(v) {\n if (!_.has(visited, v)) {\n visited[v] = true;\n xs[v] = _.reduce(blockG.inEdges(v), function(max, e) {\n pass1(e.v);\n return Math.max(max, xs[e.v] + blockG.edge(e));\n }, 0);\n }\n }\n _.each(blockG.nodes(), pass1);\n\n var borderType = reverseSep ? \"borderLeft\" : \"borderRight\";\n function pass2(v) {\n if (visited[v] !== 2) {\n visited[v]++;\n var node = g.node(v);\n var min = _.reduce(blockG.outEdges(v), function(min, e) {\n pass2(e.w);\n return Math.min(min, xs[e.w] - blockG.edge(e));\n }, Number.POSITIVE_INFINITY);\n if (min !== Number.POSITIVE_INFINITY && node.borderType !== borderType) {\n xs[v] = Math.max(xs[v], min);\n }\n }\n }\n _.each(blockG.nodes(), pass2);\n\n // Assign x coordinates to all nodes\n _.each(align, function(v) {\n xs[v] = xs[root[v]];\n });\n\n return xs;\n}\n\n\nfunction buildBlockGraph(g, layering, root, reverseSep) {\n var blockGraph = new Graph(),\n graphLabel = g.graph(),\n sepFn = sep(graphLabel.nodesep, graphLabel.edgesep, reverseSep);\n\n _.each(layering, function(layer) {\n var u;\n _.each(layer, function(v) {\n var vRoot = root[v];\n blockGraph.setNode(vRoot);\n if (u) {\n var uRoot = root[u],\n prevMax = blockGraph.edge(uRoot, vRoot);\n blockGraph.setEdge(uRoot, vRoot, Math.max(sepFn(g, v, u), prevMax || 0));\n }\n u = v;\n });\n });\n\n return blockGraph;\n}\n\n/*\n * Returns the alignment that has the smallest width of the given alignments.\n */\nfunction findSmallestWidthAlignment(g, xss) {\n return _.min(xss, function(xs) {\n var min = _.min(xs, function(x, v) { return x - width(g, v) / 2; }),\n max = _.max(xs, function(x, v) { return x + width(g, v) / 2; });\n return max - min;\n });\n}\n\n/*\n * Align the coordinates of each of the layout alignments such that\n * left-biased alignments have their minimum coordinate at the same point as\n * the minimum coordinate of the smallest width alignment and right-biased\n * alignments have their maximum coordinate at the same point as the maximum\n * coordinate of the smallest width alignment.\n */\nfunction alignCoordinates(xss, alignTo) {\n var alignToMin = _.min(alignTo),\n alignToMax = _.max(alignTo);\n\n _.each([\"u\", \"d\"], function(vert) {\n _.each([\"l\", \"r\"], function(horiz) {\n var alignment = vert + horiz,\n xs = xss[alignment],\n delta;\n if (xs === alignTo) return;\n\n delta = horiz === \"l\" ? alignToMin - _.min(xs) : alignToMax - _.max(xs);\n\n if (delta) {\n xss[alignment] = _.mapValues(xs, function(x) { return x + delta; });\n }\n });\n });\n}\n\nfunction balance(xss, align) {\n return _.mapValues(xss.ul, function(ignore, v) {\n if (align) {\n return xss[align.toLowerCase()][v];\n } else {\n var xs = _.sortBy(_.pluck(xss, v));\n return (xs[1] + xs[2]) / 2;\n }\n });\n}\n\nfunction positionX(g) {\n var layering = util.buildLayerMatrix(g),\n conflicts = _.merge(findType1Conflicts(g, layering),\n findType2Conflicts(g, layering));\n\n var xss = {},\n adjustedLayering;\n _.each([\"u\", \"d\"], function(vert) {\n adjustedLayering = vert === \"u\" ? layering : _.values(layering).reverse();\n _.each([\"l\", \"r\"], function(horiz) {\n if (horiz === \"r\") {\n adjustedLayering = _.map(adjustedLayering, function(inner) {\n return _.values(inner).reverse();\n });\n }\n\n var neighborFn = _.bind(vert === \"u\" ? g.predecessors : g.successors, g);\n var align = verticalAlignment(g, adjustedLayering, conflicts, neighborFn);\n var xs = horizontalCompaction(g, adjustedLayering,\n align.root, align.align,\n horiz === \"r\");\n if (horiz === \"r\") {\n xs = _.mapValues(xs, function(x) { return -x; });\n }\n xss[vert + horiz] = xs;\n });\n });\n\n var smallestWidth = findSmallestWidthAlignment(g, xss);\n alignCoordinates(xss, smallestWidth);\n return balance(xss, g.graph().align);\n}\n\nfunction sep(nodeSep, edgeSep, reverseSep) {\n return function(g, v, w) {\n var vLabel = g.node(v),\n wLabel = g.node(w),\n sum = 0,\n delta;\n\n sum += vLabel.width / 2;\n if (_.has(vLabel, \"labelpos\")) {\n switch (vLabel.labelpos.toLowerCase()) {\n case \"l\": delta = -vLabel.width / 2; break;\n case \"r\": delta = vLabel.width / 2; break;\n }\n }\n if (delta) {\n sum += reverseSep ? delta : -delta;\n }\n delta = 0;\n\n sum += (vLabel.dummy ? edgeSep : nodeSep) / 2;\n sum += (wLabel.dummy ? edgeSep : nodeSep) / 2;\n\n sum += wLabel.width / 2;\n if (_.has(wLabel, \"labelpos\")) {\n switch (wLabel.labelpos.toLowerCase()) {\n case \"l\": delta = wLabel.width / 2; break;\n case \"r\": delta = -wLabel.width / 2; break;\n }\n }\n if (delta) {\n sum += reverseSep ? delta : -delta;\n }\n delta = 0;\n\n return sum;\n };\n}\n\nfunction width(g, v) {\n return g.node(v).width;\n}\n\n},{\"../graphlib\":35,\"../lodash\":38,\"../util\":57}],52:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\"),\n util = require(\"../util\"),\n positionX = require(\"./bk\").positionX;\n\nmodule.exports = position;\n\nfunction position(g) {\n g = util.asNonCompoundGraph(g);\n\n positionY(g);\n _.each(positionX(g), function(x, v) {\n g.node(v).x = x;\n });\n}\n\nfunction positionY(g) {\n var layering = util.buildLayerMatrix(g),\n rankSep = g.graph().ranksep,\n prevY = 0;\n _.each(layering, function(layer) {\n var maxHeight = _.max(_.map(layer, function(v) { return g.node(v).height; }));\n _.each(layer, function(v) {\n g.node(v).y = prevY + maxHeight / 2;\n });\n prevY += maxHeight + rankSep;\n });\n}\n\n\n},{\"../lodash\":38,\"../util\":57,\"./bk\":51}],53:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\"),\n Graph = require(\"../graphlib\").Graph,\n slack = require(\"./util\").slack;\n\nmodule.exports = feasibleTree;\n\n/*\n * Constructs a spanning tree with tight edges and adjusted the input node's\n * ranks to achieve this. A tight edge is one that is has a length that matches\n * its \"minlen\" attribute.\n *\n * The basic structure for this function is derived from Gansner, et al., \"A\n * Technique for Drawing Directed Graphs.\"\n *\n * Pre-conditions:\n *\n * 1. Graph must be a DAG.\n * 2. Graph must be connected.\n * 3. Graph must have at least one node.\n * 5. Graph nodes must have been previously assigned a \"rank\" property that\n * respects the \"minlen\" property of incident edges.\n * 6. Graph edges must have a \"minlen\" property.\n *\n * Post-conditions:\n *\n * - Graph nodes will have their rank adjusted to ensure that all edges are\n * tight.\n *\n * Returns a tree (undirected graph) that is constructed using only \"tight\"\n * edges.\n */\nfunction feasibleTree(g) {\n var t = new Graph({ directed: false });\n\n // Choose arbitrary node from which to start our tree\n var start = g.nodes()[0],\n size = g.nodeCount();\n t.setNode(start, {});\n\n var edge, delta;\n while (tightTree(t, g) < size) {\n edge = findMinSlackEdge(t, g);\n delta = t.hasNode(edge.v) ? slack(g, edge) : -slack(g, edge);\n shiftRanks(t, g, delta);\n }\n\n return t;\n}\n\n/*\n * Finds a maximal tree of tight edges and returns the number of nodes in the\n * tree.\n */\nfunction tightTree(t, g) {\n function dfs(v) {\n _.each(g.nodeEdges(v), function(e) {\n var edgeV = e.v,\n w = (v === edgeV) ? e.w : edgeV;\n if (!t.hasNode(w) && !slack(g, e)) {\n t.setNode(w, {});\n t.setEdge(v, w, {});\n dfs(w);\n }\n });\n }\n\n _.each(t.nodes(), dfs);\n return t.nodeCount();\n}\n\n/*\n * Finds the edge with the smallest slack that is incident on tree and returns\n * it.\n */\nfunction findMinSlackEdge(t, g) {\n return _.min(g.edges(), function(e) {\n if (t.hasNode(e.v) !== t.hasNode(e.w)) {\n return slack(g, e);\n }\n });\n}\n\nfunction shiftRanks(t, g, delta) {\n _.each(t.nodes(), function(v) {\n g.node(v).rank += delta;\n });\n}\n\n},{\"../graphlib\":35,\"../lodash\":38,\"./util\":56}],54:[function(require,module,exports){\n\"use strict\";\n\nvar rankUtil = require(\"./util\"),\n longestPath = rankUtil.longestPath,\n feasibleTree = require(\"./feasible-tree\"),\n networkSimplex = require(\"./network-simplex\");\n\nmodule.exports = rank;\n\n/*\n * Assigns a rank to each node in the input graph that respects the \"minlen\"\n * constraint specified on edges between nodes.\n *\n * This basic structure is derived from Gansner, et al., \"A Technique for\n * Drawing Directed Graphs.\"\n *\n * Pre-conditions:\n *\n * 1. Graph must be a connected DAG\n * 2. Graph nodes must be objects\n * 3. Graph edges must have \"weight\" and \"minlen\" attributes\n *\n * Post-conditions:\n *\n * 1. Graph nodes will have a \"rank\" attribute based on the results of the\n * algorithm. Ranks can start at any index (including negative), we'll\n * fix them up later.\n */\nfunction rank(g) {\n switch(g.graph().ranker) {\n case \"network-simplex\": networkSimplexRanker(g); break;\n case \"tight-tree\": tightTreeRanker(g); break;\n case \"longest-path\": longestPathRanker(g); break;\n default: networkSimplexRanker(g);\n }\n}\n\n// A fast and simple ranker, but results are far from optimal.\nvar longestPathRanker = longestPath;\n\nfunction tightTreeRanker(g) {\n longestPath(g);\n feasibleTree(g);\n}\n\nfunction networkSimplexRanker(g) {\n networkSimplex(g);\n}\n\n},{\"./feasible-tree\":53,\"./network-simplex\":55,\"./util\":56}],55:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\"),\n feasibleTree = require(\"./feasible-tree\"),\n slack = require(\"./util\").slack,\n initRank = require(\"./util\").longestPath,\n preorder = require(\"../graphlib\").alg.preorder,\n postorder = require(\"../graphlib\").alg.postorder,\n simplify = require(\"../util\").simplify;\n\nmodule.exports = networkSimplex;\n\n// Expose some internals for testing purposes\nnetworkSimplex.initLowLimValues = initLowLimValues;\nnetworkSimplex.initCutValues = initCutValues;\nnetworkSimplex.calcCutValue = calcCutValue;\nnetworkSimplex.leaveEdge = leaveEdge;\nnetworkSimplex.enterEdge = enterEdge;\nnetworkSimplex.exchangeEdges = exchangeEdges;\n\n/*\n * The network simplex algorithm assigns ranks to each node in the input graph\n * and iteratively improves the ranking to reduce the length of edges.\n *\n * Preconditions:\n *\n * 1. The input graph must be a DAG.\n * 2. All nodes in the graph must have an object value.\n * 3. All edges in the graph must have \"minlen\" and \"weight\" attributes.\n *\n * Postconditions:\n *\n * 1. All nodes in the graph will have an assigned \"rank\" attribute that has\n * been optimized by the network simplex algorithm. Ranks start at 0.\n *\n *\n * A rough sketch of the algorithm is as follows:\n *\n * 1. Assign initial ranks to each node. We use the longest path algorithm,\n * which assigns ranks to the lowest position possible. In general this\n * leads to very wide bottom ranks and unnecessarily long edges.\n * 2. Construct a feasible tight tree. A tight tree is one such that all\n * edges in the tree have no slack (difference between length of edge\n * and minlen for the edge). This by itself greatly improves the assigned\n * rankings by shorting edges.\n * 3. Iteratively find edges that have negative cut values. Generally a\n * negative cut value indicates that the edge could be removed and a new\n * tree edge could be added to produce a more compact graph.\n *\n * Much of the algorithms here are derived from Gansner, et al., \"A Technique\n * for Drawing Directed Graphs.\" The structure of the file roughly follows the\n * structure of the overall algorithm.\n */\nfunction networkSimplex(g) {\n g = simplify(g);\n initRank(g);\n var t = feasibleTree(g);\n initLowLimValues(t);\n initCutValues(t, g);\n\n var e, f;\n while ((e = leaveEdge(t))) {\n f = enterEdge(t, g, e);\n exchangeEdges(t, g, e, f);\n }\n}\n\n/*\n * Initializes cut values for all edges in the tree.\n */\nfunction initCutValues(t, g) {\n var vs = postorder(t, t.nodes());\n vs = vs.slice(0, vs.length - 1);\n _.each(vs, function(v) {\n assignCutValue(t, g, v);\n });\n}\n\nfunction assignCutValue(t, g, child) {\n var childLab = t.node(child),\n parent = childLab.parent;\n t.edge(child, parent).cutvalue = calcCutValue(t, g, child);\n}\n\n/*\n * Given the tight tree, its graph, and a child in the graph calculate and\n * return the cut value for the edge between the child and its parent.\n */\nfunction calcCutValue(t, g, child) {\n var childLab = t.node(child),\n parent = childLab.parent,\n // True if the child is on the tail end of the edge in the directed graph\n childIsTail = true,\n // The graph's view of the tree edge we're inspecting\n graphEdge = g.edge(child, parent),\n // The accumulated cut value for the edge between this node and its parent\n cutValue = 0;\n\n if (!graphEdge) {\n childIsTail = false;\n graphEdge = g.edge(parent, child);\n }\n\n cutValue = graphEdge.weight;\n\n _.each(g.nodeEdges(child), function(e) {\n var isOutEdge = e.v === child,\n other = isOutEdge ? e.w : e.v;\n\n if (other !== parent) {\n var pointsToHead = isOutEdge === childIsTail,\n otherWeight = g.edge(e).weight;\n\n cutValue += pointsToHead ? otherWeight : -otherWeight;\n if (isTreeEdge(t, child, other)) {\n var otherCutValue = t.edge(child, other).cutvalue;\n cutValue += pointsToHead ? -otherCutValue : otherCutValue;\n }\n }\n });\n\n return cutValue;\n}\n\nfunction initLowLimValues(tree, root) {\n if (arguments.length < 2) {\n root = tree.nodes()[0];\n }\n dfsAssignLowLim(tree, {}, 1, root);\n}\n\nfunction dfsAssignLowLim(tree, visited, nextLim, v, parent) {\n var low = nextLim,\n label = tree.node(v);\n\n visited[v] = true;\n _.each(tree.neighbors(v), function(w) {\n if (!_.has(visited, w)) {\n nextLim = dfsAssignLowLim(tree, visited, nextLim, w, v);\n }\n });\n\n label.low = low;\n label.lim = nextLim++;\n if (parent) {\n label.parent = parent;\n } else {\n // TODO should be able to remove this when we incrementally update low lim\n delete label.parent;\n }\n\n return nextLim;\n}\n\nfunction leaveEdge(tree) {\n return _.find(tree.edges(), function(e) {\n return tree.edge(e).cutvalue < 0;\n });\n}\n\nfunction enterEdge(t, g, edge) {\n var v = edge.v,\n w = edge.w;\n\n // For the rest of this function we assume that v is the tail and w is the\n // head, so if we don't have this edge in the graph we should flip it to\n // match the correct orientation.\n if (!g.hasEdge(v, w)) {\n v = edge.w;\n w = edge.v;\n }\n\n var vLabel = t.node(v),\n wLabel = t.node(w),\n tailLabel = vLabel,\n flip = false;\n\n // If the root is in the tail of the edge then we need to flip the logic that\n // checks for the head and tail nodes in the candidates function below.\n if (vLabel.lim > wLabel.lim) {\n tailLabel = wLabel;\n flip = true;\n }\n\n var candidates = _.filter(g.edges(), function(edge) {\n return flip === isDescendant(t, t.node(edge.v), tailLabel) &&\n flip !== isDescendant(t, t.node(edge.w), tailLabel);\n });\n\n return _.min(candidates, function(edge) { return slack(g, edge); });\n}\n\nfunction exchangeEdges(t, g, e, f) {\n var v = e.v,\n w = e.w;\n t.removeEdge(v, w);\n t.setEdge(f.v, f.w, {});\n initLowLimValues(t);\n initCutValues(t, g);\n updateRanks(t, g);\n}\n\nfunction updateRanks(t, g) {\n var root = _.find(t.nodes(), function(v) { return !g.node(v).parent; }),\n vs = preorder(t, root);\n vs = vs.slice(1);\n _.each(vs, function(v) {\n var parent = t.node(v).parent,\n edge = g.edge(v, parent),\n flipped = false;\n\n if (!edge) {\n edge = g.edge(parent, v);\n flipped = true;\n }\n\n g.node(v).rank = g.node(parent).rank + (flipped ? edge.minlen : -edge.minlen);\n });\n}\n\n/*\n * Returns true if the edge is in the tree.\n */\nfunction isTreeEdge(tree, u, v) {\n return tree.hasEdge(u, v);\n}\n\n/*\n * Returns true if the specified node is descendant of the root node per the\n * assigned low and lim attributes in the tree.\n */\nfunction isDescendant(tree, vLabel, rootLabel) {\n return rootLabel.low <= vLabel.lim && vLabel.lim <= rootLabel.lim;\n}\n\n},{\"../graphlib\":35,\"../lodash\":38,\"../util\":57,\"./feasible-tree\":53,\"./util\":56}],56:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"../lodash\");\n\nmodule.exports = {\n longestPath: longestPath,\n slack: slack\n};\n\n/*\n * Initializes ranks for the input graph using the longest path algorithm. This\n * algorithm scales well and is fast in practice, it yields rather poor\n * solutions. Nodes are pushed to the lowest layer possible, leaving the bottom\n * ranks wide and leaving edges longer than necessary. However, due to its\n * speed, this algorithm is good for getting an initial ranking that can be fed\n * into other algorithms.\n *\n * This algorithm does not normalize layers because it will be used by other\n * algorithms in most cases. If using this algorithm directly, be sure to\n * run normalize at the end.\n *\n * Pre-conditions:\n *\n * 1. Input graph is a DAG.\n * 2. Input graph node labels can be assigned properties.\n *\n * Post-conditions:\n *\n * 1. Each node will be assign an (unnormalized) \"rank\" property.\n */\nfunction longestPath(g) {\n var visited = {};\n\n function dfs(v) {\n var label = g.node(v);\n if (_.has(visited, v)) {\n return label.rank;\n }\n visited[v] = true;\n\n var rank = _.min(_.map(g.outEdges(v), function(e) {\n return dfs(e.w) - g.edge(e).minlen;\n }));\n\n if (rank === Number.POSITIVE_INFINITY) {\n rank = 0;\n }\n\n return (label.rank = rank);\n }\n\n _.each(g.sources(), dfs);\n}\n\n/*\n * Returns the amount of slack for the given edge. The slack is defined as the\n * difference between the length of the edge and its minimum length.\n */\nfunction slack(g, e) {\n return g.node(e.w).rank - g.node(e.v).rank - g.edge(e).minlen;\n}\n\n},{\"../lodash\":38}],57:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"./lodash\"),\n Graph = require(\"./graphlib\").Graph;\n\nmodule.exports = {\n addDummyNode: addDummyNode,\n simplify: simplify,\n asNonCompoundGraph: asNonCompoundGraph,\n successorWeights: successorWeights,\n predecessorWeights: predecessorWeights,\n intersectRect: intersectRect,\n buildLayerMatrix: buildLayerMatrix,\n normalizeRanks: normalizeRanks,\n removeEmptyRanks: removeEmptyRanks,\n addBorderNode: addBorderNode,\n maxRank: maxRank,\n partition: partition,\n time: time,\n notime: notime\n};\n\n/*\n * Adds a dummy node to the graph and return v.\n */\nfunction addDummyNode(g, type, attrs, name) {\n var v;\n do {\n v = _.uniqueId(name);\n } while (g.hasNode(v));\n\n attrs.dummy = type;\n g.setNode(v, attrs);\n return v;\n}\n\n/*\n * Returns a new graph with only simple edges. Handles aggregation of data\n * associated with multi-edges.\n */\nfunction simplify(g) {\n var simplified = new Graph().setGraph(g.graph());\n _.each(g.nodes(), function(v) { simplified.setNode(v, g.node(v)); });\n _.each(g.edges(), function(e) {\n var simpleLabel = simplified.edge(e.v, e.w) || { weight: 0, minlen: 1 },\n label = g.edge(e);\n simplified.setEdge(e.v, e.w, {\n weight: simpleLabel.weight + label.weight,\n minlen: Math.max(simpleLabel.minlen, label.minlen)\n });\n });\n return simplified;\n}\n\nfunction asNonCompoundGraph(g) {\n var simplified = new Graph({ multigraph: g.isMultigraph() }).setGraph(g.graph());\n _.each(g.nodes(), function(v) {\n if (!g.children(v).length) {\n simplified.setNode(v, g.node(v));\n }\n });\n _.each(g.edges(), function(e) {\n simplified.setEdge(e, g.edge(e));\n });\n return simplified;\n}\n\nfunction successorWeights(g) {\n var weightMap = _.map(g.nodes(), function(v) {\n var sucs = {};\n _.each(g.outEdges(v), function(e) {\n sucs[e.w] = (sucs[e.w] || 0) + g.edge(e).weight;\n });\n return sucs;\n });\n return _.zipObject(g.nodes(), weightMap);\n}\n\nfunction predecessorWeights(g) {\n var weightMap = _.map(g.nodes(), function(v) {\n var preds = {};\n _.each(g.inEdges(v), function(e) {\n preds[e.v] = (preds[e.v] || 0) + g.edge(e).weight;\n });\n return preds;\n });\n return _.zipObject(g.nodes(), weightMap);\n}\n\n/*\n * Finds where a line starting at point ({x, y}) would intersect a rectangle\n * ({x, y, width, height}) if it were pointing at the rectangle's center.\n */\nfunction intersectRect(rect, point) {\n var x = rect.x;\n var y = rect.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = rect.width / 2;\n var h = rect.height / 2;\n\n if (!dx && !dy) {\n throw new Error(\"Not possible to find intersection inside of the rectangle\");\n }\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = h * dx / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = w * dy / dx;\n }\n\n return { x: x + sx, y: y + sy };\n}\n\n/*\n * Given a DAG with each node assigned \"rank\" and \"order\" properties, this\n * function will produce a matrix with the ids of each node.\n */\nfunction buildLayerMatrix(g) {\n var layering = _.map(_.range(maxRank(g) + 1), function() { return []; });\n _.each(g.nodes(), function(v) {\n var node = g.node(v),\n rank = node.rank;\n if (!_.isUndefined(rank)) {\n layering[rank][node.order] = v;\n }\n });\n return layering;\n}\n\n/*\n * Adjusts the ranks for all nodes in the graph such that all nodes v have\n * rank(v) >= 0 and at least one node w has rank(w) = 0.\n */\nfunction normalizeRanks(g) {\n var min = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));\n _.each(g.nodes(), function(v) {\n var node = g.node(v);\n if (_.has(node, \"rank\")) {\n node.rank -= min;\n }\n });\n}\n\nfunction removeEmptyRanks(g) {\n // Ranks may not start at 0, so we need to offset them\n var offset = _.min(_.map(g.nodes(), function(v) { return g.node(v).rank; }));\n\n var layers = [];\n _.each(g.nodes(), function(v) {\n var rank = g.node(v).rank - offset;\n if (!layers[rank]) {\n layers[rank] = [];\n }\n layers[rank].push(v);\n });\n\n var delta = 0,\n nodeRankFactor = g.graph().nodeRankFactor;\n _.each(layers, function(vs, i) {\n if (_.isUndefined(vs) && i % nodeRankFactor !== 0) {\n --delta;\n } else if (delta) {\n _.each(vs, function(v) { g.node(v).rank += delta; });\n }\n });\n}\n\nfunction addBorderNode(g, prefix, rank, order) {\n var node = {\n width: 0,\n height: 0\n };\n if (arguments.length >= 4) {\n node.rank = rank;\n node.order = order;\n }\n return addDummyNode(g, \"border\", node, prefix);\n}\n\nfunction maxRank(g) {\n return _.max(_.map(g.nodes(), function(v) {\n var rank = g.node(v).rank;\n if (!_.isUndefined(rank)) {\n return rank;\n }\n }));\n}\n\n/*\n * Partition a collection into two groups: `lhs` and `rhs`. If the supplied\n * function returns true for an entry it goes into `lhs`. Otherwise it goes\n * into `rhs.\n */\nfunction partition(collection, fn) {\n var result = { lhs: [], rhs: [] };\n _.each(collection, function(value) {\n if (fn(value)) {\n result.lhs.push(value);\n } else {\n result.rhs.push(value);\n }\n });\n return result;\n}\n\n/*\n * Returns a new function that wraps `fn` with a timer. The wrapper logs the\n * time it takes to execute the function.\n */\nfunction time(name, fn) {\n var start = _.now();\n try {\n return fn();\n } finally {\n console.log(name + \" time: \" + (_.now() - start) + \"ms\");\n }\n}\n\nfunction notime(name, fn) {\n return fn();\n}\n\n},{\"./graphlib\":35,\"./lodash\":38}],58:[function(require,module,exports){\nmodule.exports = \"0.7.4\";\n\n},{}],59:[function(require,module,exports){\n/**\n * Copyright (c) 2014, Chris Pettitt\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * 1. Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n *\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * 3. Neither the name of the copyright holder nor the names of its contributors\n * may be used to endorse or promote products derived from this software without\n * specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar lib = require(\"./lib\");\n\nmodule.exports = {\n Graph: lib.Graph,\n json: require(\"./lib/json\"),\n alg: require(\"./lib/alg\"),\n version: lib.version\n};\n\n},{\"./lib\":75,\"./lib/alg\":66,\"./lib/json\":76}],60:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = components;\n\nfunction components(g) {\n var visited = {},\n cmpts = [],\n cmpt;\n\n function dfs(v) {\n if (_.has(visited, v)) return;\n visited[v] = true;\n cmpt.push(v);\n _.each(g.successors(v), dfs);\n _.each(g.predecessors(v), dfs);\n }\n\n _.each(g.nodes(), function(v) {\n cmpt = [];\n dfs(v);\n if (cmpt.length) {\n cmpts.push(cmpt);\n }\n });\n\n return cmpts;\n}\n\n},{\"../lodash\":77}],61:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = dfs;\n\n/*\n * A helper that preforms a pre- or post-order traversal on the input graph\n * and returns the nodes in the order they were visited. This algorithm treats\n * the input as undirected.\n *\n * Order must be one of \"pre\" or \"post\".\n */\nfunction dfs(g, vs, order) {\n if (!_.isArray(vs)) {\n vs = [vs];\n }\n\n var acc = [],\n visited = {};\n _.each(vs, function(v) {\n if (!g.hasNode(v)) {\n throw new Error(\"Graph does not have node: \" + v);\n }\n\n doDfs(g, v, order === \"post\", visited, acc);\n });\n return acc;\n}\n\nfunction doDfs(g, v, postorder, visited, acc) {\n if (!_.has(visited, v)) {\n visited[v] = true;\n\n if (!postorder) { acc.push(v); }\n _.each(g.neighbors(v), function(w) {\n doDfs(g, w, postorder, visited, acc);\n });\n if (postorder) { acc.push(v); }\n }\n}\n\n},{\"../lodash\":77}],62:[function(require,module,exports){\nvar dijkstra = require(\"./dijkstra\"),\n _ = require(\"../lodash\");\n\nmodule.exports = dijkstraAll;\n\nfunction dijkstraAll(g, weightFunc, edgeFunc) {\n return _.transform(g.nodes(), function(acc, v) {\n acc[v] = dijkstra(g, v, weightFunc, edgeFunc);\n }, {});\n}\n\n},{\"../lodash\":77,\"./dijkstra\":63}],63:[function(require,module,exports){\nvar _ = require(\"../lodash\"),\n PriorityQueue = require(\"../data/priority-queue\");\n\nmodule.exports = dijkstra;\n\nvar DEFAULT_WEIGHT_FUNC = _.constant(1);\n\nfunction dijkstra(g, source, weightFn, edgeFn) {\n return runDijkstra(g, String(source),\n weightFn || DEFAULT_WEIGHT_FUNC,\n edgeFn || function(v) { return g.outEdges(v); });\n}\n\nfunction runDijkstra(g, source, weightFn, edgeFn) {\n var results = {},\n pq = new PriorityQueue(),\n v, vEntry;\n\n var updateNeighbors = function(edge) {\n var w = edge.v !== v ? edge.v : edge.w,\n wEntry = results[w],\n weight = weightFn(edge),\n distance = vEntry.distance + weight;\n\n if (weight < 0) {\n throw new Error(\"dijkstra does not allow negative edge weights. \" +\n \"Bad edge: \" + edge + \" Weight: \" + weight);\n }\n\n if (distance < wEntry.distance) {\n wEntry.distance = distance;\n wEntry.predecessor = v;\n pq.decrease(w, distance);\n }\n };\n\n g.nodes().forEach(function(v) {\n var distance = v === source ? 0 : Number.POSITIVE_INFINITY;\n results[v] = { distance: distance };\n pq.add(v, distance);\n });\n\n while (pq.size() > 0) {\n v = pq.removeMin();\n vEntry = results[v];\n if (vEntry.distance === Number.POSITIVE_INFINITY) {\n break;\n }\n\n edgeFn(v).forEach(updateNeighbors);\n }\n\n return results;\n}\n\n},{\"../data/priority-queue\":73,\"../lodash\":77}],64:[function(require,module,exports){\nvar _ = require(\"../lodash\"),\n tarjan = require(\"./tarjan\");\n\nmodule.exports = findCycles;\n\nfunction findCycles(g) {\n return _.filter(tarjan(g), function(cmpt) {\n return cmpt.length > 1 || (cmpt.length === 1 && g.hasEdge(cmpt[0], cmpt[0]));\n });\n}\n\n},{\"../lodash\":77,\"./tarjan\":71}],65:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = floydWarshall;\n\nvar DEFAULT_WEIGHT_FUNC = _.constant(1);\n\nfunction floydWarshall(g, weightFn, edgeFn) {\n return runFloydWarshall(g,\n weightFn || DEFAULT_WEIGHT_FUNC,\n edgeFn || function(v) { return g.outEdges(v); });\n}\n\nfunction runFloydWarshall(g, weightFn, edgeFn) {\n var results = {},\n nodes = g.nodes();\n\n nodes.forEach(function(v) {\n results[v] = {};\n results[v][v] = { distance: 0 };\n nodes.forEach(function(w) {\n if (v !== w) {\n results[v][w] = { distance: Number.POSITIVE_INFINITY };\n }\n });\n edgeFn(v).forEach(function(edge) {\n var w = edge.v === v ? edge.w : edge.v,\n d = weightFn(edge);\n results[v][w] = { distance: d, predecessor: v };\n });\n });\n\n nodes.forEach(function(k) {\n var rowK = results[k];\n nodes.forEach(function(i) {\n var rowI = results[i];\n nodes.forEach(function(j) {\n var ik = rowI[k];\n var kj = rowK[j];\n var ij = rowI[j];\n var altDistance = ik.distance + kj.distance;\n if (altDistance < ij.distance) {\n ij.distance = altDistance;\n ij.predecessor = kj.predecessor;\n }\n });\n });\n });\n\n return results;\n}\n\n},{\"../lodash\":77}],66:[function(require,module,exports){\nmodule.exports = {\n components: require(\"./components\"),\n dijkstra: require(\"./dijkstra\"),\n dijkstraAll: require(\"./dijkstra-all\"),\n findCycles: require(\"./find-cycles\"),\n floydWarshall: require(\"./floyd-warshall\"),\n isAcyclic: require(\"./is-acyclic\"),\n postorder: require(\"./postorder\"),\n preorder: require(\"./preorder\"),\n prim: require(\"./prim\"),\n tarjan: require(\"./tarjan\"),\n topsort: require(\"./topsort\")\n};\n\n},{\"./components\":60,\"./dijkstra\":63,\"./dijkstra-all\":62,\"./find-cycles\":64,\"./floyd-warshall\":65,\"./is-acyclic\":67,\"./postorder\":68,\"./preorder\":69,\"./prim\":70,\"./tarjan\":71,\"./topsort\":72}],67:[function(require,module,exports){\nvar topsort = require(\"./topsort\");\n\nmodule.exports = isAcyclic;\n\nfunction isAcyclic(g) {\n try {\n topsort(g);\n } catch (e) {\n if (e instanceof topsort.CycleException) {\n return false;\n }\n throw e;\n }\n return true;\n}\n\n},{\"./topsort\":72}],68:[function(require,module,exports){\nvar dfs = require(\"./dfs\");\n\nmodule.exports = postorder;\n\nfunction postorder(g, vs) {\n return dfs(g, vs, \"post\");\n}\n\n},{\"./dfs\":61}],69:[function(require,module,exports){\nvar dfs = require(\"./dfs\");\n\nmodule.exports = preorder;\n\nfunction preorder(g, vs) {\n return dfs(g, vs, \"pre\");\n}\n\n},{\"./dfs\":61}],70:[function(require,module,exports){\nvar _ = require(\"../lodash\"),\n Graph = require(\"../graph\"),\n PriorityQueue = require(\"../data/priority-queue\");\n\nmodule.exports = prim;\n\nfunction prim(g, weightFunc) {\n var result = new Graph(),\n parents = {},\n pq = new PriorityQueue(),\n v;\n\n function updateNeighbors(edge) {\n var w = edge.v === v ? edge.w : edge.v,\n pri = pq.priority(w);\n if (pri !== undefined) {\n var edgeWeight = weightFunc(edge);\n if (edgeWeight < pri) {\n parents[w] = v;\n pq.decrease(w, edgeWeight);\n }\n }\n }\n\n if (g.nodeCount() === 0) {\n return result;\n }\n\n _.each(g.nodes(), function(v) {\n pq.add(v, Number.POSITIVE_INFINITY);\n result.setNode(v);\n });\n\n // Start from an arbitrary node\n pq.decrease(g.nodes()[0], 0);\n\n var init = false;\n while (pq.size() > 0) {\n v = pq.removeMin();\n if (_.has(parents, v)) {\n result.setEdge(v, parents[v]);\n } else if (init) {\n throw new Error(\"Input graph is not connected: \" + g);\n } else {\n init = true;\n }\n\n g.nodeEdges(v).forEach(updateNeighbors);\n }\n\n return result;\n}\n\n},{\"../data/priority-queue\":73,\"../graph\":74,\"../lodash\":77}],71:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = tarjan;\n\nfunction tarjan(g) {\n var index = 0,\n stack = [],\n visited = {}, // node id -> { onStack, lowlink, index }\n results = [];\n\n function dfs(v) {\n var entry = visited[v] = {\n onStack: true,\n lowlink: index,\n index: index++\n };\n stack.push(v);\n\n g.successors(v).forEach(function(w) {\n if (!_.has(visited, w)) {\n dfs(w);\n entry.lowlink = Math.min(entry.lowlink, visited[w].lowlink);\n } else if (visited[w].onStack) {\n entry.lowlink = Math.min(entry.lowlink, visited[w].index);\n }\n });\n\n if (entry.lowlink === entry.index) {\n var cmpt = [],\n w;\n do {\n w = stack.pop();\n visited[w].onStack = false;\n cmpt.push(w);\n } while (v !== w);\n results.push(cmpt);\n }\n }\n\n g.nodes().forEach(function(v) {\n if (!_.has(visited, v)) {\n dfs(v);\n }\n });\n\n return results;\n}\n\n},{\"../lodash\":77}],72:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = topsort;\ntopsort.CycleException = CycleException;\n\nfunction topsort(g) {\n var visited = {},\n stack = {},\n results = [];\n\n function visit(node) {\n if (_.has(stack, node)) {\n throw new CycleException();\n }\n\n if (!_.has(visited, node)) {\n stack[node] = true;\n visited[node] = true;\n _.each(g.predecessors(node), visit);\n delete stack[node];\n results.push(node);\n }\n }\n\n _.each(g.sinks(), visit);\n\n if (_.size(visited) !== g.nodeCount()) {\n throw new CycleException();\n }\n\n return results;\n}\n\nfunction CycleException() {}\n\n},{\"../lodash\":77}],73:[function(require,module,exports){\nvar _ = require(\"../lodash\");\n\nmodule.exports = PriorityQueue;\n\n/**\n * A min-priority queue data structure. This algorithm is derived from Cormen,\n * et al., \"Introduction to Algorithms\". The basic idea of a min-priority\n * queue is that you can efficiently (in O(1) time) get the smallest key in\n * the queue. Adding and removing elements takes O(log n) time. A key can\n * have its priority decreased in O(log n) time.\n */\nfunction PriorityQueue() {\n this._arr = [];\n this._keyIndices = {};\n}\n\n/**\n * Returns the number of elements in the queue. Takes `O(1)` time.\n */\nPriorityQueue.prototype.size = function() {\n return this._arr.length;\n};\n\n/**\n * Returns the keys that are in the queue. Takes `O(n)` time.\n */\nPriorityQueue.prototype.keys = function() {\n return this._arr.map(function(x) { return x.key; });\n};\n\n/**\n * Returns `true` if **key** is in the queue and `false` if not.\n */\nPriorityQueue.prototype.has = function(key) {\n return _.has(this._keyIndices, key);\n};\n\n/**\n * Returns the priority for **key**. If **key** is not present in the queue\n * then this function returns `undefined`. Takes `O(1)` time.\n *\n * @param {Object} key\n */\nPriorityQueue.prototype.priority = function(key) {\n var index = this._keyIndices[key];\n if (index !== undefined) {\n return this._arr[index].priority;\n }\n};\n\n/**\n * Returns the key for the minimum element in this queue. If the queue is\n * empty this function throws an Error. Takes `O(1)` time.\n */\nPriorityQueue.prototype.min = function() {\n if (this.size() === 0) {\n throw new Error(\"Queue underflow\");\n }\n return this._arr[0].key;\n};\n\n/**\n * Inserts a new key into the priority queue. If the key already exists in\n * the queue this function returns `false`; otherwise it will return `true`.\n * Takes `O(n)` time.\n *\n * @param {Object} key the key to add\n * @param {Number} priority the initial priority for the key\n */\nPriorityQueue.prototype.add = function(key, priority) {\n var keyIndices = this._keyIndices;\n key = String(key);\n if (!_.has(keyIndices, key)) {\n var arr = this._arr;\n var index = arr.length;\n keyIndices[key] = index;\n arr.push({key: key, priority: priority});\n this._decrease(index);\n return true;\n }\n return false;\n};\n\n/**\n * Removes and returns the smallest key in the queue. Takes `O(log n)` time.\n */\nPriorityQueue.prototype.removeMin = function() {\n this._swap(0, this._arr.length - 1);\n var min = this._arr.pop();\n delete this._keyIndices[min.key];\n this._heapify(0);\n return min.key;\n};\n\n/**\n * Decreases the priority for **key** to **priority**. If the new priority is\n * greater than the previous priority, this function will throw an Error.\n *\n * @param {Object} key the key for which to raise priority\n * @param {Number} priority the new priority for the key\n */\nPriorityQueue.prototype.decrease = function(key, priority) {\n var index = this._keyIndices[key];\n if (priority > this._arr[index].priority) {\n throw new Error(\"New priority is greater than current priority. \" +\n \"Key: \" + key + \" Old: \" + this._arr[index].priority + \" New: \" + priority);\n }\n this._arr[index].priority = priority;\n this._decrease(index);\n};\n\nPriorityQueue.prototype._heapify = function(i) {\n var arr = this._arr;\n var l = 2 * i,\n r = l + 1,\n largest = i;\n if (l < arr.length) {\n largest = arr[l].priority < arr[largest].priority ? l : largest;\n if (r < arr.length) {\n largest = arr[r].priority < arr[largest].priority ? r : largest;\n }\n if (largest !== i) {\n this._swap(i, largest);\n this._heapify(largest);\n }\n }\n};\n\nPriorityQueue.prototype._decrease = function(index) {\n var arr = this._arr;\n var priority = arr[index].priority;\n var parent;\n while (index !== 0) {\n parent = index >> 1;\n if (arr[parent].priority < priority) {\n break;\n }\n this._swap(index, parent);\n index = parent;\n }\n};\n\nPriorityQueue.prototype._swap = function(i, j) {\n var arr = this._arr;\n var keyIndices = this._keyIndices;\n var origArrI = arr[i];\n var origArrJ = arr[j];\n arr[i] = origArrJ;\n arr[j] = origArrI;\n keyIndices[origArrJ.key] = i;\n keyIndices[origArrI.key] = j;\n};\n\n},{\"../lodash\":77}],74:[function(require,module,exports){\n\"use strict\";\n\nvar _ = require(\"./lodash\");\n\nmodule.exports = Graph;\n\nvar DEFAULT_EDGE_NAME = \"\\x00\",\n GRAPH_NODE = \"\\x00\",\n EDGE_KEY_DELIM = \"\\x01\";\n\n// Implementation notes:\n//\n// * Node id query functions should return string ids for the nodes\n// * Edge id query functions should return an \"edgeObj\", edge object, that is\n// composed of enough information to uniquely identify an edge: {v, w, name}.\n// * Internally we use an \"edgeId\", a stringified form of the edgeObj, to\n// reference edges. This is because we need a performant way to look these\n// edges up and, object properties, which have string keys, are the closest\n// we're going to get to a performant hashtable in JavaScript.\n\nfunction Graph(opts) {\n this._isDirected = _.has(opts, \"directed\") ? opts.directed : true;\n this._isMultigraph = _.has(opts, \"multigraph\") ? opts.multigraph : false;\n this._isCompound = _.has(opts, \"compound\") ? opts.compound : false;\n\n // Label for the graph itself\n this._label = undefined;\n\n // Defaults to be set when creating a new node\n this._defaultNodeLabelFn = _.constant(undefined);\n\n // Defaults to be set when creating a new edge\n this._defaultEdgeLabelFn = _.constant(undefined);\n\n // v -> label\n this._nodes = {};\n\n if (this._isCompound) {\n // v -> parent\n this._parent = {};\n\n // v -> children\n this._children = {};\n this._children[GRAPH_NODE] = {};\n }\n\n // v -> edgeObj\n this._in = {};\n\n // u -> v -> Number\n this._preds = {};\n\n // v -> edgeObj\n this._out = {};\n\n // v -> w -> Number\n this._sucs = {};\n\n // e -> edgeObj\n this._edgeObjs = {};\n\n // e -> label\n this._edgeLabels = {};\n}\n\n/* Number of nodes in the graph. Should only be changed by the implementation. */\nGraph.prototype._nodeCount = 0;\n\n/* Number of edges in the graph. Should only be changed by the implementation. */\nGraph.prototype._edgeCount = 0;\n\n\n/* === Graph functions ========= */\n\nGraph.prototype.isDirected = function() {\n return this._isDirected;\n};\n\nGraph.prototype.isMultigraph = function() {\n return this._isMultigraph;\n};\n\nGraph.prototype.isCompound = function() {\n return this._isCompound;\n};\n\nGraph.prototype.setGraph = function(label) {\n this._label = label;\n return this;\n};\n\nGraph.prototype.graph = function() {\n return this._label;\n};\n\n\n/* === Node functions ========== */\n\nGraph.prototype.setDefaultNodeLabel = function(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultNodeLabelFn = newDefault;\n return this;\n};\n\nGraph.prototype.nodeCount = function() {\n return this._nodeCount;\n};\n\nGraph.prototype.nodes = function() {\n return _.keys(this._nodes);\n};\n\nGraph.prototype.sources = function() {\n return _.filter(this.nodes(), function(v) {\n return _.isEmpty(this._in[v]);\n }, this);\n};\n\nGraph.prototype.sinks = function() {\n return _.filter(this.nodes(), function(v) {\n return _.isEmpty(this._out[v]);\n }, this);\n};\n\nGraph.prototype.setNodes = function(vs, value) {\n var args = arguments;\n _.each(vs, function(v) {\n if (args.length > 1) {\n this.setNode(v, value);\n } else {\n this.setNode(v);\n }\n }, this);\n return this;\n};\n\nGraph.prototype.setNode = function(v, value) {\n if (_.has(this._nodes, v)) {\n if (arguments.length > 1) {\n this._nodes[v] = value;\n }\n return this;\n }\n\n this._nodes[v] = arguments.length > 1 ? value : this._defaultNodeLabelFn(v);\n if (this._isCompound) {\n this._parent[v] = GRAPH_NODE;\n this._children[v] = {};\n this._children[GRAPH_NODE][v] = true;\n }\n this._in[v] = {};\n this._preds[v] = {};\n this._out[v] = {};\n this._sucs[v] = {};\n ++this._nodeCount;\n return this;\n};\n\nGraph.prototype.node = function(v) {\n return this._nodes[v];\n};\n\nGraph.prototype.hasNode = function(v) {\n return _.has(this._nodes, v);\n};\n\nGraph.prototype.removeNode = function(v) {\n var self = this;\n if (_.has(this._nodes, v)) {\n var removeEdge = function(e) { self.removeEdge(self._edgeObjs[e]); };\n delete this._nodes[v];\n if (this._isCompound) {\n this._removeFromParentsChildList(v);\n delete this._parent[v];\n _.each(this.children(v), function(child) {\n this.setParent(child);\n }, this);\n delete this._children[v];\n }\n _.each(_.keys(this._in[v]), removeEdge);\n delete this._in[v];\n delete this._preds[v];\n _.each(_.keys(this._out[v]), removeEdge);\n delete this._out[v];\n delete this._sucs[v];\n --this._nodeCount;\n }\n return this;\n};\n\nGraph.prototype.setParent = function(v, parent) {\n if (!this._isCompound) {\n throw new Error(\"Cannot set parent in a non-compound graph\");\n }\n\n if (_.isUndefined(parent)) {\n parent = GRAPH_NODE;\n } else {\n // Coerce parent to string\n parent += \"\";\n for (var ancestor = parent;\n !_.isUndefined(ancestor);\n ancestor = this.parent(ancestor)) {\n if (ancestor === v) {\n throw new Error(\"Setting \" + parent+ \" as parent of \" + v +\n \" would create create a cycle\");\n }\n }\n\n this.setNode(parent);\n }\n\n this.setNode(v);\n this._removeFromParentsChildList(v);\n this._parent[v] = parent;\n this._children[parent][v] = true;\n return this;\n};\n\nGraph.prototype._removeFromParentsChildList = function(v) {\n delete this._children[this._parent[v]][v];\n};\n\nGraph.prototype.parent = function(v) {\n if (this._isCompound) {\n var parent = this._parent[v];\n if (parent !== GRAPH_NODE) {\n return parent;\n }\n }\n};\n\nGraph.prototype.children = function(v) {\n if (_.isUndefined(v)) {\n v = GRAPH_NODE;\n }\n\n if (this._isCompound) {\n var children = this._children[v];\n if (children) {\n return _.keys(children);\n }\n } else if (v === GRAPH_NODE) {\n return this.nodes();\n } else if (this.hasNode(v)) {\n return [];\n }\n};\n\nGraph.prototype.predecessors = function(v) {\n var predsV = this._preds[v];\n if (predsV) {\n return _.keys(predsV);\n }\n};\n\nGraph.prototype.successors = function(v) {\n var sucsV = this._sucs[v];\n if (sucsV) {\n return _.keys(sucsV);\n }\n};\n\nGraph.prototype.neighbors = function(v) {\n var preds = this.predecessors(v);\n if (preds) {\n return _.union(preds, this.successors(v));\n }\n};\n\nGraph.prototype.filterNodes = function(filter) {\n var copy = new this.constructor({\n directed: this._isDirected,\n multigraph: this._isMultigraph,\n compound: this._isCompound\n });\n\n copy.setGraph(this.graph());\n\n _.each(this._nodes, function(value, v) {\n if (filter(v)) {\n copy.setNode(v, value);\n }\n }, this);\n\n _.each(this._edgeObjs, function(e) {\n if (copy.hasNode(e.v) && copy.hasNode(e.w)) {\n copy.setEdge(e, this.edge(e));\n }\n }, this);\n\n var self = this;\n var parents = {};\n function findParent(v) {\n var parent = self.parent(v);\n if (parent === undefined || copy.hasNode(parent)) {\n parents[v] = parent;\n return parent;\n } else if (parent in parents) {\n return parents[parent];\n } else {\n return findParent(parent);\n }\n }\n\n if (this._isCompound) {\n _.each(copy.nodes(), function(v) {\n copy.setParent(v, findParent(v));\n });\n }\n\n return copy;\n};\n\n/* === Edge functions ========== */\n\nGraph.prototype.setDefaultEdgeLabel = function(newDefault) {\n if (!_.isFunction(newDefault)) {\n newDefault = _.constant(newDefault);\n }\n this._defaultEdgeLabelFn = newDefault;\n return this;\n};\n\nGraph.prototype.edgeCount = function() {\n return this._edgeCount;\n};\n\nGraph.prototype.edges = function() {\n return _.values(this._edgeObjs);\n};\n\nGraph.prototype.setPath = function(vs, value) {\n var self = this,\n args = arguments;\n _.reduce(vs, function(v, w) {\n if (args.length > 1) {\n self.setEdge(v, w, value);\n } else {\n self.setEdge(v, w);\n }\n return w;\n });\n return this;\n};\n\n/*\n * setEdge(v, w, [value, [name]])\n * setEdge({ v, w, [name] }, [value])\n */\nGraph.prototype.setEdge = function() {\n var v, w, name, value,\n valueSpecified = false,\n arg0 = arguments[0];\n\n if (typeof arg0 === \"object\" && arg0 !== null && \"v\" in arg0) {\n v = arg0.v;\n w = arg0.w;\n name = arg0.name;\n if (arguments.length === 2) {\n value = arguments[1];\n valueSpecified = true;\n }\n } else {\n v = arg0;\n w = arguments[1];\n name = arguments[3];\n if (arguments.length > 2) {\n value = arguments[2];\n valueSpecified = true;\n }\n }\n\n v = \"\" + v;\n w = \"\" + w;\n if (!_.isUndefined(name)) {\n name = \"\" + name;\n }\n\n var e = edgeArgsToId(this._isDirected, v, w, name);\n if (_.has(this._edgeLabels, e)) {\n if (valueSpecified) {\n this._edgeLabels[e] = value;\n }\n return this;\n }\n\n if (!_.isUndefined(name) && !this._isMultigraph) {\n throw new Error(\"Cannot set a named edge when isMultigraph = false\");\n }\n\n // It didn't exist, so we need to create it.\n // First ensure the nodes exist.\n this.setNode(v);\n this.setNode(w);\n\n this._edgeLabels[e] = valueSpecified ? value : this._defaultEdgeLabelFn(v, w, name);\n\n var edgeObj = edgeArgsToObj(this._isDirected, v, w, name);\n // Ensure we add undirected edges in a consistent way.\n v = edgeObj.v;\n w = edgeObj.w;\n\n Object.freeze(edgeObj);\n this._edgeObjs[e] = edgeObj;\n incrementOrInitEntry(this._preds[w], v);\n incrementOrInitEntry(this._sucs[v], w);\n this._in[w][e] = edgeObj;\n this._out[v][e] = edgeObj;\n this._edgeCount++;\n return this;\n};\n\nGraph.prototype.edge = function(v, w, name) {\n var e = (arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name));\n return this._edgeLabels[e];\n};\n\nGraph.prototype.hasEdge = function(v, w, name) {\n var e = (arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name));\n return _.has(this._edgeLabels, e);\n};\n\nGraph.prototype.removeEdge = function(v, w, name) {\n var e = (arguments.length === 1\n ? edgeObjToId(this._isDirected, arguments[0])\n : edgeArgsToId(this._isDirected, v, w, name)),\n edge = this._edgeObjs[e];\n if (edge) {\n v = edge.v;\n w = edge.w;\n delete this._edgeLabels[e];\n delete this._edgeObjs[e];\n decrementOrRemoveEntry(this._preds[w], v);\n decrementOrRemoveEntry(this._sucs[v], w);\n delete this._in[w][e];\n delete this._out[v][e];\n this._edgeCount--;\n }\n return this;\n};\n\nGraph.prototype.inEdges = function(v, u) {\n var inV = this._in[v];\n if (inV) {\n var edges = _.values(inV);\n if (!u) {\n return edges;\n }\n return _.filter(edges, function(edge) { return edge.v === u; });\n }\n};\n\nGraph.prototype.outEdges = function(v, w) {\n var outV = this._out[v];\n if (outV) {\n var edges = _.values(outV);\n if (!w) {\n return edges;\n }\n return _.filter(edges, function(edge) { return edge.w === w; });\n }\n};\n\nGraph.prototype.nodeEdges = function(v, w) {\n var inEdges = this.inEdges(v, w);\n if (inEdges) {\n return inEdges.concat(this.outEdges(v, w));\n }\n};\n\nfunction incrementOrInitEntry(map, k) {\n if (map[k]) {\n map[k]++;\n } else {\n map[k] = 1;\n }\n}\n\nfunction decrementOrRemoveEntry(map, k) {\n if (!--map[k]) { delete map[k]; }\n}\n\nfunction edgeArgsToId(isDirected, v_, w_, name) {\n var v = \"\" + v_;\n var w = \"\" + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n return v + EDGE_KEY_DELIM + w + EDGE_KEY_DELIM +\n (_.isUndefined(name) ? DEFAULT_EDGE_NAME : name);\n}\n\nfunction edgeArgsToObj(isDirected, v_, w_, name) {\n var v = \"\" + v_;\n var w = \"\" + w_;\n if (!isDirected && v > w) {\n var tmp = v;\n v = w;\n w = tmp;\n }\n var edgeObj = { v: v, w: w };\n if (name) {\n edgeObj.name = name;\n }\n return edgeObj;\n}\n\nfunction edgeObjToId(isDirected, edgeObj) {\n return edgeArgsToId(isDirected, edgeObj.v, edgeObj.w, edgeObj.name);\n}\n\n},{\"./lodash\":77}],75:[function(require,module,exports){\n// Includes only the \"core\" of graphlib\nmodule.exports = {\n Graph: require(\"./graph\"),\n version: require(\"./version\")\n};\n\n},{\"./graph\":74,\"./version\":78}],76:[function(require,module,exports){\nvar _ = require(\"./lodash\"),\n Graph = require(\"./graph\");\n\nmodule.exports = {\n write: write,\n read: read\n};\n\nfunction write(g) {\n var json = {\n options: {\n directed: g.isDirected(),\n multigraph: g.isMultigraph(),\n compound: g.isCompound()\n },\n nodes: writeNodes(g),\n edges: writeEdges(g)\n };\n if (!_.isUndefined(g.graph())) {\n json.value = _.clone(g.graph());\n }\n return json;\n}\n\nfunction writeNodes(g) {\n return _.map(g.nodes(), function(v) {\n var nodeValue = g.node(v),\n parent = g.parent(v),\n node = { v: v };\n if (!_.isUndefined(nodeValue)) {\n node.value = nodeValue;\n }\n if (!_.isUndefined(parent)) {\n node.parent = parent;\n }\n return node;\n });\n}\n\nfunction writeEdges(g) {\n return _.map(g.edges(), function(e) {\n var edgeValue = g.edge(e),\n edge = { v: e.v, w: e.w };\n if (!_.isUndefined(e.name)) {\n edge.name = e.name;\n }\n if (!_.isUndefined(edgeValue)) {\n edge.value = edgeValue;\n }\n return edge;\n });\n}\n\nfunction read(json) {\n var g = new Graph(json.options).setGraph(json.value);\n _.each(json.nodes, function(entry) {\n g.setNode(entry.v, entry.value);\n if (entry.parent) {\n g.setParent(entry.v, entry.parent);\n }\n });\n _.each(json.edges, function(entry) {\n g.setEdge({ v: entry.v, w: entry.w, name: entry.name }, entry.value);\n });\n return g;\n}\n\n},{\"./graph\":74,\"./lodash\":77}],77:[function(require,module,exports){\narguments[4][38][0].apply(exports,arguments)\n},{\"dup\":38,\"lodash\":79}],78:[function(require,module,exports){\nmodule.exports = '1.0.7';\n\n},{}],79:[function(require,module,exports){\n(function (global){\n/**\n * @license\n * lodash 3.10.1 (Custom Build) \n * Build: `lodash modern -d -o ./index.js`\n * Copyright 2012-2015 The Dojo Foundation \n * Based on Underscore.js 1.8.3 \n * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n * Available under MIT license \n */\n;(function() {\n\n /** Used as a safe reference for `undefined` in pre-ES5 environments. */\n var undefined;\n\n /** Used as the semantic version number. */\n var VERSION = '3.10.1';\n\n /** Used to compose bitmasks for wrapper metadata. */\n var BIND_FLAG = 1,\n BIND_KEY_FLAG = 2,\n CURRY_BOUND_FLAG = 4,\n CURRY_FLAG = 8,\n CURRY_RIGHT_FLAG = 16,\n PARTIAL_FLAG = 32,\n PARTIAL_RIGHT_FLAG = 64,\n ARY_FLAG = 128,\n REARG_FLAG = 256;\n\n /** Used as default options for `_.trunc`. */\n var DEFAULT_TRUNC_LENGTH = 30,\n DEFAULT_TRUNC_OMISSION = '...';\n\n /** Used to detect when a function becomes hot. */\n var HOT_COUNT = 150,\n HOT_SPAN = 16;\n\n /** Used as the size to enable large array optimizations. */\n var LARGE_ARRAY_SIZE = 200;\n\n /** Used to indicate the type of lazy iteratees. */\n var LAZY_FILTER_FLAG = 1,\n LAZY_MAP_FLAG = 2;\n\n /** Used as the `TypeError` message for \"Functions\" methods. */\n var FUNC_ERROR_TEXT = 'Expected a function';\n\n /** Used as the internal argument placeholder. */\n var PLACEHOLDER = '__lodash_placeholder__';\n\n /** `Object#toString` result references. */\n var argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\n var arrayBufferTag = '[object ArrayBuffer]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n /** Used to match empty string literals in compiled template source. */\n var reEmptyStringLeading = /\\b__p \\+= '';/g,\n reEmptyStringMiddle = /\\b(__p \\+=) '' \\+/g,\n reEmptyStringTrailing = /(__e\\(.*?\\)|\\b__t\\)) \\+\\n'';/g;\n\n /** Used to match HTML entities and HTML characters. */\n var reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g,\n reUnescapedHtml = /[&<>\"'`]/g,\n reHasEscapedHtml = RegExp(reEscapedHtml.source),\n reHasUnescapedHtml = RegExp(reUnescapedHtml.source);\n\n /** Used to match template delimiters. */\n var reEscape = /<%-([\\s\\S]+?)%>/g,\n reEvaluate = /<%([\\s\\S]+?)%>/g,\n reInterpolate = /<%=([\\s\\S]+?)%>/g;\n\n /** Used to match property names within property paths. */\n var reIsDeepProp = /\\.|\\[(?:[^[\\]]*|([\"'])(?:(?!\\1)[^\\n\\\\]|\\\\.)*?\\1)\\]/,\n reIsPlainProp = /^\\w*$/,\n rePropName = /[^.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|([\"'])((?:(?!\\2)[^\\n\\\\]|\\\\.)*?)\\2)\\]/g;\n\n /**\n * Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)\n * and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).\n */\n var reRegExpChars = /^[:!,]|[\\\\^$.*+?()[\\]{}|\\/]|(^[0-9a-fA-Fnrtuvx])|([\\n\\r\\u2028\\u2029])/g,\n reHasRegExpChars = RegExp(reRegExpChars.source);\n\n /** Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). */\n var reComboMark = /[\\u0300-\\u036f\\ufe20-\\ufe23]/g;\n\n /** Used to match backslashes in property paths. */\n var reEscapeChar = /\\\\(\\\\)?/g;\n\n /** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */\n var reEsTemplate = /\\$\\{([^\\\\}]*(?:\\\\.[^\\\\}]*)*)\\}/g;\n\n /** Used to match `RegExp` flags from their coerced string values. */\n var reFlags = /\\w*$/;\n\n /** Used to detect hexadecimal string values. */\n var reHasHexPrefix = /^0[xX]/;\n\n /** Used to detect host constructors (Safari > 5). */\n var reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n /** Used to detect unsigned integer values. */\n var reIsUint = /^\\d+$/;\n\n /** Used to match latin-1 supplementary letters (excluding mathematical operators). */\n var reLatin1 = /[\\xc0-\\xd6\\xd8-\\xde\\xdf-\\xf6\\xf8-\\xff]/g;\n\n /** Used to ensure capturing order of template delimiters. */\n var reNoMatch = /($^)/;\n\n /** Used to match unescaped characters in compiled string literals. */\n var reUnescapedString = /['\\n\\r\\u2028\\u2029\\\\]/g;\n\n /** Used to match words to create compound words. */\n var reWords = (function() {\n var upper = '[A-Z\\\\xc0-\\\\xd6\\\\xd8-\\\\xde]',\n lower = '[a-z\\\\xdf-\\\\xf6\\\\xf8-\\\\xff]+';\n\n return RegExp(upper + '+(?=' + upper + lower + ')|' + upper + '?' + lower + '|' + upper + '+|[0-9]+', 'g');\n }());\n\n /** Used to assign default `context` object properties. */\n var contextProps = [\n 'Array', 'ArrayBuffer', 'Date', 'Error', 'Float32Array', 'Float64Array',\n 'Function', 'Int8Array', 'Int16Array', 'Int32Array', 'Math', 'Number',\n 'Object', 'RegExp', 'Set', 'String', '_', 'clearTimeout', 'isFinite',\n 'parseFloat', 'parseInt', 'setTimeout', 'TypeError', 'Uint8Array',\n 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array', 'WeakMap'\n ];\n\n /** Used to make template sourceURLs easier to identify. */\n var templateCounter = -1;\n\n /** Used to identify `toStringTag` values of typed arrays. */\n var typedArrayTags = {};\n typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\n typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\n typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\n typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\n typedArrayTags[uint32Tag] = true;\n typedArrayTags[argsTag] = typedArrayTags[arrayTag] =\n typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\n typedArrayTags[dateTag] = typedArrayTags[errorTag] =\n typedArrayTags[funcTag] = typedArrayTags[mapTag] =\n typedArrayTags[numberTag] = typedArrayTags[objectTag] =\n typedArrayTags[regexpTag] = typedArrayTags[setTag] =\n typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;\n\n /** Used to identify `toStringTag` values supported by `_.clone`. */\n var cloneableTags = {};\n cloneableTags[argsTag] = cloneableTags[arrayTag] =\n cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =\n cloneableTags[dateTag] = cloneableTags[float32Tag] =\n cloneableTags[float64Tag] = cloneableTags[int8Tag] =\n cloneableTags[int16Tag] = cloneableTags[int32Tag] =\n cloneableTags[numberTag] = cloneableTags[objectTag] =\n cloneableTags[regexpTag] = cloneableTags[stringTag] =\n cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\n cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\n cloneableTags[errorTag] = cloneableTags[funcTag] =\n cloneableTags[mapTag] = cloneableTags[setTag] =\n cloneableTags[weakMapTag] = false;\n\n /** Used to map latin-1 supplementary letters to basic latin letters. */\n var deburredLetters = {\n '\\xc0': 'A', '\\xc1': 'A', '\\xc2': 'A', '\\xc3': 'A', '\\xc4': 'A', '\\xc5': 'A',\n '\\xe0': 'a', '\\xe1': 'a', '\\xe2': 'a', '\\xe3': 'a', '\\xe4': 'a', '\\xe5': 'a',\n '\\xc7': 'C', '\\xe7': 'c',\n '\\xd0': 'D', '\\xf0': 'd',\n '\\xc8': 'E', '\\xc9': 'E', '\\xca': 'E', '\\xcb': 'E',\n '\\xe8': 'e', '\\xe9': 'e', '\\xea': 'e', '\\xeb': 'e',\n '\\xcC': 'I', '\\xcd': 'I', '\\xce': 'I', '\\xcf': 'I',\n '\\xeC': 'i', '\\xed': 'i', '\\xee': 'i', '\\xef': 'i',\n '\\xd1': 'N', '\\xf1': 'n',\n '\\xd2': 'O', '\\xd3': 'O', '\\xd4': 'O', '\\xd5': 'O', '\\xd6': 'O', '\\xd8': 'O',\n '\\xf2': 'o', '\\xf3': 'o', '\\xf4': 'o', '\\xf5': 'o', '\\xf6': 'o', '\\xf8': 'o',\n '\\xd9': 'U', '\\xda': 'U', '\\xdb': 'U', '\\xdc': 'U',\n '\\xf9': 'u', '\\xfa': 'u', '\\xfb': 'u', '\\xfc': 'u',\n '\\xdd': 'Y', '\\xfd': 'y', '\\xff': 'y',\n '\\xc6': 'Ae', '\\xe6': 'ae',\n '\\xde': 'Th', '\\xfe': 'th',\n '\\xdf': 'ss'\n };\n\n /** Used to map characters to HTML entities. */\n var htmlEscapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n };\n\n /** Used to map HTML entities to characters. */\n var htmlUnescapes = {\n '&': '&',\n '<': '<',\n '>': '>',\n '"': '\"',\n ''': \"'\",\n '`': '`'\n };\n\n /** Used to determine if values are of the language type `Object`. */\n var objectTypes = {\n 'function': true,\n 'object': true\n };\n\n /** Used to escape characters for inclusion in compiled regexes. */\n var regexpEscapes = {\n '0': 'x30', '1': 'x31', '2': 'x32', '3': 'x33', '4': 'x34',\n '5': 'x35', '6': 'x36', '7': 'x37', '8': 'x38', '9': 'x39',\n 'A': 'x41', 'B': 'x42', 'C': 'x43', 'D': 'x44', 'E': 'x45', 'F': 'x46',\n 'a': 'x61', 'b': 'x62', 'c': 'x63', 'd': 'x64', 'e': 'x65', 'f': 'x66',\n 'n': 'x6e', 'r': 'x72', 't': 'x74', 'u': 'x75', 'v': 'x76', 'x': 'x78'\n };\n\n /** Used to escape characters for inclusion in compiled string literals. */\n var stringEscapes = {\n '\\\\': '\\\\',\n \"'\": \"'\",\n '\\n': 'n',\n '\\r': 'r',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n /** Detect free variable `exports`. */\n var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;\n\n /** Detect free variable `module`. */\n var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;\n\n /** Detect free variable `global` from Node.js. */\n var freeGlobal = freeExports && freeModule && typeof global == 'object' && global && global.Object && global;\n\n /** Detect free variable `self`. */\n var freeSelf = objectTypes[typeof self] && self && self.Object && self;\n\n /** Detect free variable `window`. */\n var freeWindow = objectTypes[typeof window] && window && window.Object && window;\n\n /** Detect the popular CommonJS extension `module.exports`. */\n var moduleExports = freeModule && freeModule.exports === freeExports && freeExports;\n\n /**\n * Used as a reference to the global object.\n *\n * The `this` value is used if it's the global object to avoid Greasemonkey's\n * restricted `window` object, otherwise the `window` object is used.\n */\n var root = freeGlobal || ((freeWindow !== (this && this.window)) && freeWindow) || freeSelf || this;\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * The base implementation of `compareAscending` which compares values and\n * sorts them in ascending order without guaranteeing a stable sort.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {number} Returns the sort order indicator for `value`.\n */\n function baseCompareAscending(value, other) {\n if (value !== other) {\n var valIsNull = value === null,\n valIsUndef = value === undefined,\n valIsReflexive = value === value;\n\n var othIsNull = other === null,\n othIsUndef = other === undefined,\n othIsReflexive = other === other;\n\n if ((value > other && !othIsNull) || !valIsReflexive ||\n (valIsNull && !othIsUndef && othIsReflexive) ||\n (valIsUndef && othIsReflexive)) {\n return 1;\n }\n if ((value < other && !valIsNull) || !othIsReflexive ||\n (othIsNull && !valIsUndef && valIsReflexive) ||\n (othIsUndef && valIsReflexive)) {\n return -1;\n }\n }\n return 0;\n }\n\n /**\n * The base implementation of `_.findIndex` and `_.findLastIndex` without\n * support for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseFindIndex(array, predicate, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n if (predicate(array[index], index, array)) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.indexOf` without support for binary searches.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {number} fromIndex The index to search from.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\n function baseIndexOf(array, value, fromIndex) {\n if (value !== value) {\n return indexOfNaN(array, fromIndex);\n }\n var index = fromIndex - 1,\n length = array.length;\n\n while (++index < length) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * The base implementation of `_.isFunction` without support for environments\n * with incorrect `typeof` results.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n */\n function baseIsFunction(value) {\n // Avoid a Chakra JIT bug in compatibility modes of IE 11.\n // See https://github.com/jashkenas/underscore/issues/1621 for more details.\n return typeof value == 'function' || false;\n }\n\n /**\n * Converts `value` to a string if it's not one. An empty string is returned\n * for `null` or `undefined` values.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {string} Returns the string.\n */\n function baseToString(value) {\n return value == null ? '' : (value + '');\n }\n\n /**\n * Used by `_.trim` and `_.trimLeft` to get the index of the first character\n * of `string` that is not found in `chars`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @param {string} chars The characters to find.\n * @returns {number} Returns the index of the first character not found in `chars`.\n */\n function charsLeftIndex(string, chars) {\n var index = -1,\n length = string.length;\n\n while (++index < length && chars.indexOf(string.charAt(index)) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimRight` to get the index of the last character\n * of `string` that is not found in `chars`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @param {string} chars The characters to find.\n * @returns {number} Returns the index of the last character not found in `chars`.\n */\n function charsRightIndex(string, chars) {\n var index = string.length;\n\n while (index-- && chars.indexOf(string.charAt(index)) > -1) {}\n return index;\n }\n\n /**\n * Used by `_.sortBy` to compare transformed elements of a collection and stable\n * sort them in ascending order.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareAscending(object, other) {\n return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index);\n }\n\n /**\n * Used by `_.sortByOrder` to compare multiple properties of a value to another\n * and stable sort them.\n *\n * If `orders` is unspecified, all valuess are sorted in ascending order. Otherwise,\n * a value is sorted in ascending order if its corresponding order is \"asc\", and\n * descending if \"desc\".\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {boolean[]} orders The order to sort by for each property.\n * @returns {number} Returns the sort order indicator for `object`.\n */\n function compareMultiple(object, other, orders) {\n var index = -1,\n objCriteria = object.criteria,\n othCriteria = other.criteria,\n length = objCriteria.length,\n ordersLength = orders.length;\n\n while (++index < length) {\n var result = baseCompareAscending(objCriteria[index], othCriteria[index]);\n if (result) {\n if (index >= ordersLength) {\n return result;\n }\n var order = orders[index];\n return result * ((order === 'asc' || order === true) ? 1 : -1);\n }\n }\n // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications\n // that causes it, under certain circumstances, to provide the same value for\n // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247\n // for more details.\n //\n // This also ensures a stable sort in V8 and other engines.\n // See https://code.google.com/p/v8/issues/detail?id=90 for more details.\n return object.index - other.index;\n }\n\n /**\n * Used by `_.deburr` to convert latin-1 supplementary letters to basic latin letters.\n *\n * @private\n * @param {string} letter The matched letter to deburr.\n * @returns {string} Returns the deburred letter.\n */\n function deburrLetter(letter) {\n return deburredLetters[letter];\n }\n\n /**\n * Used by `_.escape` to convert characters to HTML entities.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeHtmlChar(chr) {\n return htmlEscapes[chr];\n }\n\n /**\n * Used by `_.escapeRegExp` to escape characters for inclusion in compiled regexes.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @param {string} leadingChar The capture group for a leading character.\n * @param {string} whitespaceChar The capture group for a whitespace character.\n * @returns {string} Returns the escaped character.\n */\n function escapeRegExpChar(chr, leadingChar, whitespaceChar) {\n if (leadingChar) {\n chr = regexpEscapes[chr];\n } else if (whitespaceChar) {\n chr = stringEscapes[chr];\n }\n return '\\\\' + chr;\n }\n\n /**\n * Used by `_.template` to escape characters for inclusion in compiled string literals.\n *\n * @private\n * @param {string} chr The matched character to escape.\n * @returns {string} Returns the escaped character.\n */\n function escapeStringChar(chr) {\n return '\\\\' + stringEscapes[chr];\n }\n\n /**\n * Gets the index at which the first occurrence of `NaN` is found in `array`.\n *\n * @private\n * @param {Array} array The array to search.\n * @param {number} fromIndex The index to search from.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {number} Returns the index of the matched `NaN`, else `-1`.\n */\n function indexOfNaN(array, fromIndex, fromRight) {\n var length = array.length,\n index = fromIndex + (fromRight ? 0 : -1);\n\n while ((fromRight ? index-- : ++index < length)) {\n var other = array[index];\n if (other !== other) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * Checks if `value` is object-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n */\n function isObjectLike(value) {\n return !!value && typeof value == 'object';\n }\n\n /**\n * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a\n * character code is whitespace.\n *\n * @private\n * @param {number} charCode The character code to inspect.\n * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`.\n */\n function isSpace(charCode) {\n return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 ||\n (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279)));\n }\n\n /**\n * Replaces all `placeholder` elements in `array` with an internal placeholder\n * and returns an array of their indexes.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {*} placeholder The placeholder to replace.\n * @returns {Array} Returns the new array of placeholder indexes.\n */\n function replaceHolders(array, placeholder) {\n var index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n if (array[index] === placeholder) {\n array[index] = PLACEHOLDER;\n result[++resIndex] = index;\n }\n }\n return result;\n }\n\n /**\n * An implementation of `_.uniq` optimized for sorted arrays without support\n * for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The function invoked per iteration.\n * @returns {Array} Returns the new duplicate-value-free array.\n */\n function sortedUniq(array, iteratee) {\n var seen,\n index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value, index, array) : value;\n\n if (!index || seen !== computed) {\n seen = computed;\n result[++resIndex] = value;\n }\n }\n return result;\n }\n\n /**\n * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the first non-whitespace character.\n */\n function trimmedLeftIndex(string) {\n var index = -1,\n length = string.length;\n\n while (++index < length && isSpace(string.charCodeAt(index))) {}\n return index;\n }\n\n /**\n * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace\n * character of `string`.\n *\n * @private\n * @param {string} string The string to inspect.\n * @returns {number} Returns the index of the last non-whitespace character.\n */\n function trimmedRightIndex(string) {\n var index = string.length;\n\n while (index-- && isSpace(string.charCodeAt(index))) {}\n return index;\n }\n\n /**\n * Used by `_.unescape` to convert HTML entities to characters.\n *\n * @private\n * @param {string} chr The matched character to unescape.\n * @returns {string} Returns the unescaped character.\n */\n function unescapeHtmlChar(chr) {\n return htmlUnescapes[chr];\n }\n\n /*--------------------------------------------------------------------------*/\n\n /**\n * Create a new pristine `lodash` function using the given `context` object.\n *\n * @static\n * @memberOf _\n * @category Utility\n * @param {Object} [context=root] The context object.\n * @returns {Function} Returns a new `lodash` function.\n * @example\n *\n * _.mixin({ 'foo': _.constant('foo') });\n *\n * var lodash = _.runInContext();\n * lodash.mixin({ 'bar': lodash.constant('bar') });\n *\n * _.isFunction(_.foo);\n * // => true\n * _.isFunction(_.bar);\n * // => false\n *\n * lodash.isFunction(lodash.foo);\n * // => false\n * lodash.isFunction(lodash.bar);\n * // => true\n *\n * // using `context` to mock `Date#getTime` use in `_.now`\n * var mock = _.runInContext({\n * 'Date': function() {\n * return { 'getTime': getTimeMock };\n * }\n * });\n *\n * // or creating a suped-up `defer` in Node.js\n * var defer = _.runInContext({ 'setTimeout': setImmediate }).defer;\n */\n function runInContext(context) {\n // Avoid issues with some ES3 environments that attempt to use values, named\n // after built-in constructors like `Object`, for the creation of literals.\n // ES5 clears this up by stating that literals must use built-in constructors.\n // See https://es5.github.io/#x11.1.5 for more details.\n context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root;\n\n /** Native constructor references. */\n var Array = context.Array,\n Date = context.Date,\n Error = context.Error,\n Function = context.Function,\n Math = context.Math,\n Number = context.Number,\n Object = context.Object,\n RegExp = context.RegExp,\n String = context.String,\n TypeError = context.TypeError;\n\n /** Used for native method references. */\n var arrayProto = Array.prototype,\n objectProto = Object.prototype,\n stringProto = String.prototype;\n\n /** Used to resolve the decompiled source of functions. */\n var fnToString = Function.prototype.toString;\n\n /** Used to check objects for own properties. */\n var hasOwnProperty = objectProto.hasOwnProperty;\n\n /** Used to generate unique IDs. */\n var idCounter = 0;\n\n /**\n * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)\n * of values.\n */\n var objToString = objectProto.toString;\n\n /** Used to restore the original `_` reference in `_.noConflict`. */\n var oldDash = root._;\n\n /** Used to detect if a method is native. */\n var reIsNative = RegExp('^' +\n fnToString.call(hasOwnProperty).replace(/[\\\\^$.*+?()[\\]{}|]/g, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n );\n\n /** Native method references. */\n var ArrayBuffer = context.ArrayBuffer,\n clearTimeout = context.clearTimeout,\n parseFloat = context.parseFloat,\n pow = Math.pow,\n propertyIsEnumerable = objectProto.propertyIsEnumerable,\n Set = getNative(context, 'Set'),\n setTimeout = context.setTimeout,\n splice = arrayProto.splice,\n Uint8Array = context.Uint8Array,\n WeakMap = getNative(context, 'WeakMap');\n\n /* Native method references for those with the same name as other `lodash` methods. */\n var nativeCeil = Math.ceil,\n nativeCreate = getNative(Object, 'create'),\n nativeFloor = Math.floor,\n nativeIsArray = getNative(Array, 'isArray'),\n nativeIsFinite = context.isFinite,\n nativeKeys = getNative(Object, 'keys'),\n nativeMax = Math.max,\n nativeMin = Math.min,\n nativeNow = getNative(Date, 'now'),\n nativeParseInt = context.parseInt,\n nativeRandom = Math.random;\n\n /** Used as references for `-Infinity` and `Infinity`. */\n var NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY,\n POSITIVE_INFINITY = Number.POSITIVE_INFINITY;\n\n /** Used as references for the maximum length and index of an array. */\n var MAX_ARRAY_LENGTH = 4294967295,\n MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1,\n HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;\n\n /**\n * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer)\n * of an array-like value.\n */\n var MAX_SAFE_INTEGER = 9007199254740991;\n\n /** Used to store function metadata. */\n var metaMap = WeakMap && new WeakMap;\n\n /** Used to lookup unminified function names. */\n var realNames = {};\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object which wraps `value` to enable implicit chaining.\n * Methods that operate on and return arrays, collections, and functions can\n * be chained together. Methods that retrieve a single value or may return a\n * primitive value will automatically end the chain returning the unwrapped\n * value. Explicit chaining may be enabled using `_.chain`. The execution of\n * chained methods is lazy, that is, execution is deferred until `_#value`\n * is implicitly or explicitly called.\n *\n * Lazy evaluation allows several methods to support shortcut fusion. Shortcut\n * fusion is an optimization strategy which merge iteratee calls; this can help\n * to avoid the creation of intermediate data structures and greatly reduce the\n * number of iteratee executions.\n *\n * Chaining is supported in custom builds as long as the `_#value` method is\n * directly or indirectly included in the build.\n *\n * In addition to lodash methods, wrappers have `Array` and `String` methods.\n *\n * The wrapper `Array` methods are:\n * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`,\n * `splice`, and `unshift`\n *\n * The wrapper `String` methods are:\n * `replace` and `split`\n *\n * The wrapper methods that support shortcut fusion are:\n * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`,\n * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`,\n * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`,\n * and `where`\n *\n * The chainable wrapper methods are:\n * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`,\n * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`,\n * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defaultsDeep`,\n * `defer`, `delay`, `difference`, `drop`, `dropRight`, `dropRightWhile`,\n * `dropWhile`, `fill`, `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`,\n * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`,\n * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`,\n * `invoke`, `keys`, `keysIn`, `map`, `mapKeys`, `mapValues`, `matches`,\n * `matchesProperty`, `memoize`, `merge`, `method`, `methodOf`, `mixin`,\n * `modArgs`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`,\n * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`,\n * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `restParam`,\n * `reverse`, `set`, `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`,\n * `sortByOrder`, `splice`, `spread`, `take`, `takeRight`, `takeRightWhile`,\n * `takeWhile`, `tap`, `throttle`, `thru`, `times`, `toArray`, `toPlainObject`,\n * `transform`, `union`, `uniq`, `unshift`, `unzip`, `unzipWith`, `values`,\n * `valuesIn`, `where`, `without`, `wrap`, `xor`, `zip`, `zipObject`, `zipWith`\n *\n * The wrapper methods that are **not** chainable by default are:\n * `add`, `attempt`, `camelCase`, `capitalize`, `ceil`, `clone`, `cloneDeep`,\n * `deburr`, `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`,\n * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`,\n * `floor`, `get`, `gt`, `gte`, `has`, `identity`, `includes`, `indexOf`,\n * `inRange`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`,\n * `isEmpty`, `isEqual`, `isError`, `isFinite` `isFunction`, `isMatch`,\n * `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`,\n * `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, `join`, `kebabCase`,\n * `last`, `lastIndexOf`, `lt`, `lte`, `max`, `min`, `noConflict`, `noop`,\n * `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, `reduce`,\n * `reduceRight`, `repeat`, `result`, `round`, `runInContext`, `shift`, `size`,\n * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`,\n * `startsWith`, `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`,\n * `unescape`, `uniqueId`, `value`, and `words`\n *\n * The wrapper method `sample` will return a wrapped value when `n` is provided,\n * otherwise an unwrapped value is returned.\n *\n * @name _\n * @constructor\n * @category Chain\n * @param {*} value The value to wrap in a `lodash` instance.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var wrapped = _([1, 2, 3]);\n *\n * // returns an unwrapped value\n * wrapped.reduce(function(total, n) {\n * return total + n;\n * });\n * // => 6\n *\n * // returns a wrapped value\n * var squares = wrapped.map(function(n) {\n * return n * n;\n * });\n *\n * _.isArray(squares);\n * // => false\n *\n * _.isArray(squares.value());\n * // => true\n */\n function lodash(value) {\n if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {\n if (value instanceof LodashWrapper) {\n return value;\n }\n if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) {\n return wrapperClone(value);\n }\n }\n return new LodashWrapper(value);\n }\n\n /**\n * The function whose prototype all chaining wrappers inherit from.\n *\n * @private\n */\n function baseLodash() {\n // No operation performed.\n }\n\n /**\n * The base constructor for creating `lodash` wrapper objects.\n *\n * @private\n * @param {*} value The value to wrap.\n * @param {boolean} [chainAll] Enable chaining for all wrapper methods.\n * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value.\n */\n function LodashWrapper(value, chainAll, actions) {\n this.__wrapped__ = value;\n this.__actions__ = actions || [];\n this.__chain__ = !!chainAll;\n }\n\n /**\n * An object environment feature flags.\n *\n * @static\n * @memberOf _\n * @type Object\n */\n var support = lodash.support = {};\n\n /**\n * By default, the template delimiters used by lodash are like those in\n * embedded Ruby (ERB). Change the following template settings to use\n * alternative delimiters.\n *\n * @static\n * @memberOf _\n * @type Object\n */\n lodash.templateSettings = {\n\n /**\n * Used to detect `data` property values to be HTML-escaped.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'escape': reEscape,\n\n /**\n * Used to detect code to be evaluated.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'evaluate': reEvaluate,\n\n /**\n * Used to detect `data` property values to inject.\n *\n * @memberOf _.templateSettings\n * @type RegExp\n */\n 'interpolate': reInterpolate,\n\n /**\n * Used to reference the data object in the template text.\n *\n * @memberOf _.templateSettings\n * @type string\n */\n 'variable': '',\n\n /**\n * Used to import variables into the compiled template.\n *\n * @memberOf _.templateSettings\n * @type Object\n */\n 'imports': {\n\n /**\n * A reference to the `lodash` function.\n *\n * @memberOf _.templateSettings.imports\n * @type Function\n */\n '_': lodash\n }\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation.\n *\n * @private\n * @param {*} value The value to wrap.\n */\n function LazyWrapper(value) {\n this.__wrapped__ = value;\n this.__actions__ = [];\n this.__dir__ = 1;\n this.__filtered__ = false;\n this.__iteratees__ = [];\n this.__takeCount__ = POSITIVE_INFINITY;\n this.__views__ = [];\n }\n\n /**\n * Creates a clone of the lazy wrapper object.\n *\n * @private\n * @name clone\n * @memberOf LazyWrapper\n * @returns {Object} Returns the cloned `LazyWrapper` object.\n */\n function lazyClone() {\n var result = new LazyWrapper(this.__wrapped__);\n result.__actions__ = arrayCopy(this.__actions__);\n result.__dir__ = this.__dir__;\n result.__filtered__ = this.__filtered__;\n result.__iteratees__ = arrayCopy(this.__iteratees__);\n result.__takeCount__ = this.__takeCount__;\n result.__views__ = arrayCopy(this.__views__);\n return result;\n }\n\n /**\n * Reverses the direction of lazy iteration.\n *\n * @private\n * @name reverse\n * @memberOf LazyWrapper\n * @returns {Object} Returns the new reversed `LazyWrapper` object.\n */\n function lazyReverse() {\n if (this.__filtered__) {\n var result = new LazyWrapper(this);\n result.__dir__ = -1;\n result.__filtered__ = true;\n } else {\n result = this.clone();\n result.__dir__ *= -1;\n }\n return result;\n }\n\n /**\n * Extracts the unwrapped value from its lazy wrapper.\n *\n * @private\n * @name value\n * @memberOf LazyWrapper\n * @returns {*} Returns the unwrapped value.\n */\n function lazyValue() {\n var array = this.__wrapped__.value(),\n dir = this.__dir__,\n isArr = isArray(array),\n isRight = dir < 0,\n arrLength = isArr ? array.length : 0,\n view = getView(0, arrLength, this.__views__),\n start = view.start,\n end = view.end,\n length = end - start,\n index = isRight ? end : (start - 1),\n iteratees = this.__iteratees__,\n iterLength = iteratees.length,\n resIndex = 0,\n takeCount = nativeMin(length, this.__takeCount__);\n\n if (!isArr || arrLength < LARGE_ARRAY_SIZE || (arrLength == length && takeCount == length)) {\n return baseWrapperValue((isRight && isArr) ? array.reverse() : array, this.__actions__);\n }\n var result = [];\n\n outer:\n while (length-- && resIndex < takeCount) {\n index += dir;\n\n var iterIndex = -1,\n value = array[index];\n\n while (++iterIndex < iterLength) {\n var data = iteratees[iterIndex],\n iteratee = data.iteratee,\n type = data.type,\n computed = iteratee(value);\n\n if (type == LAZY_MAP_FLAG) {\n value = computed;\n } else if (!computed) {\n if (type == LAZY_FILTER_FLAG) {\n continue outer;\n } else {\n break outer;\n }\n }\n }\n result[resIndex++] = value;\n }\n return result;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a cache object to store key/value pairs.\n *\n * @private\n * @static\n * @name Cache\n * @memberOf _.memoize\n */\n function MapCache() {\n this.__data__ = {};\n }\n\n /**\n * Removes `key` and its value from the cache.\n *\n * @private\n * @name delete\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`.\n */\n function mapDelete(key) {\n return this.has(key) && delete this.__data__[key];\n }\n\n /**\n * Gets the cached value for `key`.\n *\n * @private\n * @name get\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the cached value.\n */\n function mapGet(key) {\n return key == '__proto__' ? undefined : this.__data__[key];\n }\n\n /**\n * Checks if a cached value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\n function mapHas(key) {\n return key != '__proto__' && hasOwnProperty.call(this.__data__, key);\n }\n\n /**\n * Sets `value` to `key` of the cache.\n *\n * @private\n * @name set\n * @memberOf _.memoize.Cache\n * @param {string} key The key of the value to cache.\n * @param {*} value The value to cache.\n * @returns {Object} Returns the cache object.\n */\n function mapSet(key, value) {\n if (key != '__proto__') {\n this.__data__[key] = value;\n }\n return this;\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n *\n * Creates a cache object to store unique values.\n *\n * @private\n * @param {Array} [values] The values to cache.\n */\n function SetCache(values) {\n var length = values ? values.length : 0;\n\n this.data = { 'hash': nativeCreate(null), 'set': new Set };\n while (length--) {\n this.push(values[length]);\n }\n }\n\n /**\n * Checks if `value` is in `cache` mimicking the return signature of\n * `_.indexOf` by returning `0` if the value is found, else `-1`.\n *\n * @private\n * @param {Object} cache The cache to search.\n * @param {*} value The value to search for.\n * @returns {number} Returns `0` if `value` is found, else `-1`.\n */\n function cacheIndexOf(cache, value) {\n var data = cache.data,\n result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value];\n\n return result ? 0 : -1;\n }\n\n /**\n * Adds `value` to the cache.\n *\n * @private\n * @name push\n * @memberOf SetCache\n * @param {*} value The value to cache.\n */\n function cachePush(value) {\n var data = this.data;\n if (typeof value == 'string' || isObject(value)) {\n data.set.add(value);\n } else {\n data.hash[value] = true;\n }\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a new array joining `array` with `other`.\n *\n * @private\n * @param {Array} array The array to join.\n * @param {Array} other The other array to join.\n * @returns {Array} Returns the new concatenated array.\n */\n function arrayConcat(array, other) {\n var index = -1,\n length = array.length,\n othIndex = -1,\n othLength = other.length,\n result = Array(length + othLength);\n\n while (++index < length) {\n result[index] = array[index];\n }\n while (++othIndex < othLength) {\n result[index++] = other[othIndex];\n }\n return result;\n }\n\n /**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\n function arrayCopy(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEach` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEach(array, iteratee) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.forEachRight` for arrays without support for\n * callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\n function arrayEachRight(array, iteratee) {\n var length = array.length;\n\n while (length--) {\n if (iteratee(array[length], length, array) === false) {\n break;\n }\n }\n return array;\n }\n\n /**\n * A specialized version of `_.every` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n */\n function arrayEvery(array, predicate) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (!predicate(array[index], index, array)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `baseExtremum` for arrays which invokes `iteratee`\n * with one argument: (value).\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} comparator The function used to compare values.\n * @param {*} exValue The initial extremum value.\n * @returns {*} Returns the extremum value.\n */\n function arrayExtremum(array, iteratee, comparator, exValue) {\n var index = -1,\n length = array.length,\n computed = exValue,\n result = computed;\n\n while (++index < length) {\n var value = array[index],\n current = +iteratee(value);\n\n if (comparator(current, computed)) {\n computed = current;\n result = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.filter` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function arrayFilter(array, predicate) {\n var index = -1,\n length = array.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[++resIndex] = value;\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.map` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function arrayMap(array, iteratee) {\n var index = -1,\n length = array.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = iteratee(array[index], index, array);\n }\n return result;\n }\n\n /**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\n function arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n }\n\n /**\n * A specialized version of `_.reduce` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initFromArray] Specify using the first element of `array`\n * as the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduce(array, iteratee, accumulator, initFromArray) {\n var index = -1,\n length = array.length;\n\n if (initFromArray && length) {\n accumulator = array[++index];\n }\n while (++index < length) {\n accumulator = iteratee(accumulator, array[index], index, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.reduceRight` for arrays without support for\n * callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {boolean} [initFromArray] Specify using the last element of `array`\n * as the initial value.\n * @returns {*} Returns the accumulated value.\n */\n function arrayReduceRight(array, iteratee, accumulator, initFromArray) {\n var length = array.length;\n if (initFromArray && length) {\n accumulator = array[--length];\n }\n while (length--) {\n accumulator = iteratee(accumulator, array[length], length, array);\n }\n return accumulator;\n }\n\n /**\n * A specialized version of `_.some` for arrays without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function arraySome(array, predicate) {\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n if (predicate(array[index], index, array)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * A specialized version of `_.sum` for arrays without support for callback\n * shorthands and `this` binding..\n *\n * @private\n * @param {Array} array The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function arraySum(array, iteratee) {\n var length = array.length,\n result = 0;\n\n while (length--) {\n result += +iteratee(array[length]) || 0;\n }\n return result;\n }\n\n /**\n * Used by `_.defaults` to customize its `_.assign` use.\n *\n * @private\n * @param {*} objectValue The destination object property value.\n * @param {*} sourceValue The source object property value.\n * @returns {*} Returns the value to assign to the destination object.\n */\n function assignDefaults(objectValue, sourceValue) {\n return objectValue === undefined ? sourceValue : objectValue;\n }\n\n /**\n * Used by `_.template` to customize its `_.assign` use.\n *\n * **Note:** This function is like `assignDefaults` except that it ignores\n * inherited property values when checking if a property is `undefined`.\n *\n * @private\n * @param {*} objectValue The destination object property value.\n * @param {*} sourceValue The source object property value.\n * @param {string} key The key associated with the object and source values.\n * @param {Object} object The destination object.\n * @returns {*} Returns the value to assign to the destination object.\n */\n function assignOwnDefaults(objectValue, sourceValue, key, object) {\n return (objectValue === undefined || !hasOwnProperty.call(object, key))\n ? sourceValue\n : objectValue;\n }\n\n /**\n * A specialized version of `_.assign` for customizing assigned values without\n * support for argument juggling, multiple sources, and `this` binding `customizer`\n * functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Object} Returns `object`.\n */\n function assignWith(object, source, customizer) {\n var index = -1,\n props = keys(source),\n length = props.length;\n\n while (++index < length) {\n var key = props[index],\n value = object[key],\n result = customizer(value, source[key], key, object, source);\n\n if ((result === result ? (result !== value) : (value === value)) ||\n (value === undefined && !(key in object))) {\n object[key] = result;\n }\n }\n return object;\n }\n\n /**\n * The base implementation of `_.assign` without support for argument juggling,\n * multiple sources, and `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\n function baseAssign(object, source) {\n return source == null\n ? object\n : baseCopy(source, keys(source), object);\n }\n\n /**\n * The base implementation of `_.at` without support for string collections\n * and individual key arguments.\n *\n * @private\n * @param {Array|Object} collection The collection to iterate over.\n * @param {number[]|string[]} props The property names or indexes of elements to pick.\n * @returns {Array} Returns the new array of picked elements.\n */\n function baseAt(collection, props) {\n var index = -1,\n isNil = collection == null,\n isArr = !isNil && isArrayLike(collection),\n length = isArr ? collection.length : 0,\n propsLength = props.length,\n result = Array(propsLength);\n\n while(++index < propsLength) {\n var key = props[index];\n if (isArr) {\n result[index] = isIndex(key, length) ? collection[key] : undefined;\n } else {\n result[index] = isNil ? undefined : collection[key];\n }\n }\n return result;\n }\n\n /**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property names to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @returns {Object} Returns `object`.\n */\n function baseCopy(source, props, object) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n object[key] = source[key];\n }\n return object;\n }\n\n /**\n * The base implementation of `_.callback` which supports specifying the\n * number of arguments to provide to `func`.\n *\n * @private\n * @param {*} [func=_.identity] The value to convert to a callback.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\n function baseCallback(func, thisArg, argCount) {\n var type = typeof func;\n if (type == 'function') {\n return thisArg === undefined\n ? func\n : bindCallback(func, thisArg, argCount);\n }\n if (func == null) {\n return identity;\n }\n if (type == 'object') {\n return baseMatches(func);\n }\n return thisArg === undefined\n ? property(func)\n : baseMatchesProperty(func, thisArg);\n }\n\n /**\n * The base implementation of `_.clone` without support for argument juggling\n * and `this` binding `customizer` functions.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The object `value` belongs to.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates clones with source counterparts.\n * @returns {*} Returns the cloned value.\n */\n function baseClone(value, isDeep, customizer, key, object, stackA, stackB) {\n var result;\n if (customizer) {\n result = object ? customizer(value, key, object) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return arrayCopy(value, result);\n }\n } else {\n var tag = objToString.call(value),\n isFunc = tag == funcTag;\n\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = initCloneObject(isFunc ? {} : value);\n if (!isDeep) {\n return baseAssign(result, value);\n }\n } else {\n return cloneableTags[tag]\n ? initCloneByTag(value, tag, isDeep)\n : (object ? value : {});\n }\n }\n // Check for circular references and return its corresponding clone.\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == value) {\n return stackB[length];\n }\n }\n // Add the source value to the stack of traversed objects and associate it with its clone.\n stackA.push(value);\n stackB.push(result);\n\n // Recursively populate clone (susceptible to call stack limits).\n (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {\n result[key] = baseClone(subValue, isDeep, customizer, key, value, stackA, stackB);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} prototype The object to inherit from.\n * @returns {Object} Returns the new object.\n */\n var baseCreate = (function() {\n function object() {}\n return function(prototype) {\n if (isObject(prototype)) {\n object.prototype = prototype;\n var result = new object;\n object.prototype = undefined;\n }\n return result || {};\n };\n }());\n\n /**\n * The base implementation of `_.delay` and `_.defer` which accepts an index\n * of where to slice the arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {Object} args The arguments provide to `func`.\n * @returns {number} Returns the timer id.\n */\n function baseDelay(func, wait, args) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return setTimeout(function() { func.apply(undefined, args); }, wait);\n }\n\n /**\n * The base implementation of `_.difference` which accepts a single array\n * of values to exclude.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Array} values The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n */\n function baseDifference(array, values) {\n var length = array ? array.length : 0,\n result = [];\n\n if (!length) {\n return result;\n }\n var index = -1,\n indexOf = getIndexOf(),\n isCommon = indexOf == baseIndexOf,\n cache = (isCommon && values.length >= LARGE_ARRAY_SIZE) ? createCache(values) : null,\n valuesLength = values.length;\n\n if (cache) {\n indexOf = cacheIndexOf;\n isCommon = false;\n values = cache;\n }\n outer:\n while (++index < length) {\n var value = array[index];\n\n if (isCommon && value === value) {\n var valuesIndex = valuesLength;\n while (valuesIndex--) {\n if (values[valuesIndex] === value) {\n continue outer;\n }\n }\n result.push(value);\n }\n else if (indexOf(values, value, 0) < 0) {\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.forEach` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object|string} Returns `collection`.\n */\n var baseEach = createBaseEach(baseForOwn);\n\n /**\n * The base implementation of `_.forEachRight` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array|Object|string} Returns `collection`.\n */\n var baseEachRight = createBaseEach(baseForOwnRight, true);\n\n /**\n * The base implementation of `_.every` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`\n */\n function baseEvery(collection, predicate) {\n var result = true;\n baseEach(collection, function(value, index, collection) {\n result = !!predicate(value, index, collection);\n return result;\n });\n return result;\n }\n\n /**\n * Gets the extremum value of `collection` invoking `iteratee` for each value\n * in `collection` to generate the criterion by which the value is ranked.\n * The `iteratee` is invoked with three arguments: (value, index|key, collection).\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} comparator The function used to compare values.\n * @param {*} exValue The initial extremum value.\n * @returns {*} Returns the extremum value.\n */\n function baseExtremum(collection, iteratee, comparator, exValue) {\n var computed = exValue,\n result = computed;\n\n baseEach(collection, function(value, index, collection) {\n var current = +iteratee(value, index, collection);\n if (comparator(current, computed) || (current === exValue && current === result)) {\n computed = current;\n result = value;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.fill` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n */\n function baseFill(array, value, start, end) {\n var length = array.length;\n\n start = start == null ? 0 : (+start || 0);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : (+end || 0);\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : (end >>> 0);\n start >>>= 0;\n\n while (start < length) {\n array[start++] = value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.filter` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\n function baseFilter(collection, predicate) {\n var result = [];\n baseEach(collection, function(value, index, collection) {\n if (predicate(value, index, collection)) {\n result.push(value);\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.find`, `_.findLast`, `_.findKey`, and `_.findLastKey`,\n * without support for callback shorthands and `this` binding, which iterates\n * over `collection` using the provided `eachFunc`.\n *\n * @private\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function} predicate The function invoked per iteration.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @param {boolean} [retKey] Specify returning the key of the found element\n * instead of the element itself.\n * @returns {*} Returns the found element or its key, else `undefined`.\n */\n function baseFind(collection, predicate, eachFunc, retKey) {\n var result;\n eachFunc(collection, function(value, key, collection) {\n if (predicate(value, key, collection)) {\n result = retKey ? key : value;\n return false;\n }\n });\n return result;\n }\n\n /**\n * The base implementation of `_.flatten` with added support for restricting\n * flattening and specifying the start index.\n *\n * @private\n * @param {Array} array The array to flatten.\n * @param {boolean} [isDeep] Specify a deep flatten.\n * @param {boolean} [isStrict] Restrict flattening to arrays-like objects.\n * @param {Array} [result=[]] The initial result value.\n * @returns {Array} Returns the new flattened array.\n */\n function baseFlatten(array, isDeep, isStrict, result) {\n result || (result = []);\n\n var index = -1,\n length = array.length;\n\n while (++index < length) {\n var value = array[index];\n if (isObjectLike(value) && isArrayLike(value) &&\n (isStrict || isArray(value) || isArguments(value))) {\n if (isDeep) {\n // Recursively flatten arrays (susceptible to call stack limits).\n baseFlatten(value, isDeep, isStrict, result);\n } else {\n arrayPush(result, value);\n }\n } else if (!isStrict) {\n result[result.length] = value;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `baseForIn` and `baseForOwn` which iterates\n * over `object` properties returned by `keysFunc` invoking `iteratee` for\n * each property. Iteratee functions may exit iteration early by explicitly\n * returning `false`.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseFor = createBaseFor();\n\n /**\n * This function is like `baseFor` except that it iterates over properties\n * in the opposite order.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @returns {Object} Returns `object`.\n */\n var baseForRight = createBaseFor(true);\n\n /**\n * The base implementation of `_.forIn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForIn(object, iteratee) {\n return baseFor(object, iteratee, keysIn);\n }\n\n /**\n * The base implementation of `_.forOwn` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwn(object, iteratee) {\n return baseFor(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.forOwnRight` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Object} Returns `object`.\n */\n function baseForOwnRight(object, iteratee) {\n return baseForRight(object, iteratee, keys);\n }\n\n /**\n * The base implementation of `_.functions` which creates an array of\n * `object` function property names filtered from those provided.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} props The property names to filter.\n * @returns {Array} Returns the new array of filtered property names.\n */\n function baseFunctions(object, props) {\n var index = -1,\n length = props.length,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var key = props[index];\n if (isFunction(object[key])) {\n result[++resIndex] = key;\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `get` without support for string paths\n * and default values.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} path The path of the property to get.\n * @param {string} [pathKey] The key representation of path.\n * @returns {*} Returns the resolved value.\n */\n function baseGet(object, path, pathKey) {\n if (object == null) {\n return;\n }\n if (pathKey !== undefined && pathKey in toObject(object)) {\n path = [pathKey];\n }\n var index = 0,\n length = path.length;\n\n while (object != null && index < length) {\n object = object[path[index++]];\n }\n return (index && index == length) ? object : undefined;\n }\n\n /**\n * The base implementation of `_.isEqual` without support for `this` binding\n * `customizer` functions.\n *\n * @private\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n */\n function baseIsEqual(value, other, customizer, isLoose, stackA, stackB) {\n if (value === other) {\n return true;\n }\n if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {\n return value !== value && other !== other;\n }\n return baseIsEqualDeep(value, other, baseIsEqual, customizer, isLoose, stackA, stackB);\n }\n\n /**\n * A specialized version of `baseIsEqual` for arrays and objects which performs\n * deep comparisons and tracks traversed objects enabling objects with circular\n * references to be compared.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA=[]] Tracks traversed `value` objects.\n * @param {Array} [stackB=[]] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseIsEqualDeep(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objIsArr = isArray(object),\n othIsArr = isArray(other),\n objTag = arrayTag,\n othTag = arrayTag;\n\n if (!objIsArr) {\n objTag = objToString.call(object);\n if (objTag == argsTag) {\n objTag = objectTag;\n } else if (objTag != objectTag) {\n objIsArr = isTypedArray(object);\n }\n }\n if (!othIsArr) {\n othTag = objToString.call(other);\n if (othTag == argsTag) {\n othTag = objectTag;\n } else if (othTag != objectTag) {\n othIsArr = isTypedArray(other);\n }\n }\n var objIsObj = objTag == objectTag,\n othIsObj = othTag == objectTag,\n isSameTag = objTag == othTag;\n\n if (isSameTag && !(objIsArr || objIsObj)) {\n return equalByTag(object, other, objTag);\n }\n if (!isLoose) {\n var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),\n othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');\n\n if (objIsWrapped || othIsWrapped) {\n return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, customizer, isLoose, stackA, stackB);\n }\n }\n if (!isSameTag) {\n return false;\n }\n // Assume cyclic values are equal.\n // For more information on detecting circular references see https://es5.github.io/#JO.\n stackA || (stackA = []);\n stackB || (stackB = []);\n\n var length = stackA.length;\n while (length--) {\n if (stackA[length] == object) {\n return stackB[length] == other;\n }\n }\n // Add `object` and `other` to the stack of traversed objects.\n stackA.push(object);\n stackB.push(other);\n\n var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, customizer, isLoose, stackA, stackB);\n\n stackA.pop();\n stackB.pop();\n\n return result;\n }\n\n /**\n * The base implementation of `_.isMatch` without support for callback\n * shorthands and `this` binding.\n *\n * @private\n * @param {Object} object The object to inspect.\n * @param {Array} matchData The propery names, values, and compare flags to match.\n * @param {Function} [customizer] The function to customize comparing objects.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n */\n function baseIsMatch(object, matchData, customizer) {\n var index = matchData.length,\n length = index,\n noCustomizer = !customizer;\n\n if (object == null) {\n return !length;\n }\n object = toObject(object);\n while (index--) {\n var data = matchData[index];\n if ((noCustomizer && data[2])\n ? data[1] !== object[data[0]]\n : !(data[0] in object)\n ) {\n return false;\n }\n }\n while (++index < length) {\n data = matchData[index];\n var key = data[0],\n objValue = object[key],\n srcValue = data[1];\n\n if (noCustomizer && data[2]) {\n if (objValue === undefined && !(key in object)) {\n return false;\n }\n } else {\n var result = customizer ? customizer(objValue, srcValue, key) : undefined;\n if (!(result === undefined ? baseIsEqual(srcValue, objValue, customizer, true) : result)) {\n return false;\n }\n }\n }\n return true;\n }\n\n /**\n * The base implementation of `_.map` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the new mapped array.\n */\n function baseMap(collection, iteratee) {\n var index = -1,\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value, key, collection) {\n result[++index] = iteratee(value, key, collection);\n });\n return result;\n }\n\n /**\n * The base implementation of `_.matches` which does not clone `source`.\n *\n * @private\n * @param {Object} source The object of property values to match.\n * @returns {Function} Returns the new function.\n */\n function baseMatches(source) {\n var matchData = getMatchData(source);\n if (matchData.length == 1 && matchData[0][2]) {\n var key = matchData[0][0],\n value = matchData[0][1];\n\n return function(object) {\n if (object == null) {\n return false;\n }\n return object[key] === value && (value !== undefined || (key in toObject(object)));\n };\n }\n return function(object) {\n return baseIsMatch(object, matchData);\n };\n }\n\n /**\n * The base implementation of `_.matchesProperty` which does not clone `srcValue`.\n *\n * @private\n * @param {string} path The path of the property to get.\n * @param {*} srcValue The value to compare.\n * @returns {Function} Returns the new function.\n */\n function baseMatchesProperty(path, srcValue) {\n var isArr = isArray(path),\n isCommon = isKey(path) && isStrictComparable(srcValue),\n pathKey = (path + '');\n\n path = toPath(path);\n return function(object) {\n if (object == null) {\n return false;\n }\n var key = pathKey;\n object = toObject(object);\n if ((isArr || !isCommon) && !(key in object)) {\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n if (object == null) {\n return false;\n }\n key = last(path);\n object = toObject(object);\n }\n return object[key] === srcValue\n ? (srcValue !== undefined || (key in object))\n : baseIsEqual(srcValue, object[key], undefined, true);\n };\n }\n\n /**\n * The base implementation of `_.merge` without support for argument juggling,\n * multiple sources, and `this` binding `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {Object} Returns `object`.\n */\n function baseMerge(object, source, customizer, stackA, stackB) {\n if (!isObject(object)) {\n return object;\n }\n var isSrcArr = isArrayLike(source) && (isArray(source) || isTypedArray(source)),\n props = isSrcArr ? undefined : keys(source);\n\n arrayEach(props || source, function(srcValue, key) {\n if (props) {\n key = srcValue;\n srcValue = source[key];\n }\n if (isObjectLike(srcValue)) {\n stackA || (stackA = []);\n stackB || (stackB = []);\n baseMergeDeep(object, source, key, baseMerge, customizer, stackA, stackB);\n }\n else {\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n }\n if ((result !== undefined || (isSrcArr && !(key in object))) &&\n (isCommon || (result === result ? (result !== value) : (value === value)))) {\n object[key] = result;\n }\n }\n });\n return object;\n }\n\n /**\n * A specialized version of `baseMerge` for arrays and objects which performs\n * deep merges and tracks traversed objects enabling objects with circular\n * references to be merged.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @param {string} key The key of the value to merge.\n * @param {Function} mergeFunc The function to merge values.\n * @param {Function} [customizer] The function to customize merged values.\n * @param {Array} [stackA=[]] Tracks traversed source objects.\n * @param {Array} [stackB=[]] Associates values with source counterparts.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function baseMergeDeep(object, source, key, mergeFunc, customizer, stackA, stackB) {\n var length = stackA.length,\n srcValue = source[key];\n\n while (length--) {\n if (stackA[length] == srcValue) {\n object[key] = stackB[length];\n return;\n }\n }\n var value = object[key],\n result = customizer ? customizer(value, srcValue, key, object, source) : undefined,\n isCommon = result === undefined;\n\n if (isCommon) {\n result = srcValue;\n if (isArrayLike(srcValue) && (isArray(srcValue) || isTypedArray(srcValue))) {\n result = isArray(value)\n ? value\n : (isArrayLike(value) ? arrayCopy(value) : []);\n }\n else if (isPlainObject(srcValue) || isArguments(srcValue)) {\n result = isArguments(value)\n ? toPlainObject(value)\n : (isPlainObject(value) ? value : {});\n }\n else {\n isCommon = false;\n }\n }\n // Add the source value to the stack of traversed objects and associate\n // it with its merged value.\n stackA.push(srcValue);\n stackB.push(result);\n\n if (isCommon) {\n // Recursively merge objects and arrays (susceptible to call stack limits).\n object[key] = mergeFunc(result, srcValue, customizer, stackA, stackB);\n } else if (result === result ? (result !== value) : (value === value)) {\n object[key] = result;\n }\n }\n\n /**\n * The base implementation of `_.property` without support for deep paths.\n *\n * @private\n * @param {string} key The key of the property to get.\n * @returns {Function} Returns the new function.\n */\n function baseProperty(key) {\n return function(object) {\n return object == null ? undefined : object[key];\n };\n }\n\n /**\n * A specialized version of `baseProperty` which supports deep paths.\n *\n * @private\n * @param {Array|string} path The path of the property to get.\n * @returns {Function} Returns the new function.\n */\n function basePropertyDeep(path) {\n var pathKey = (path + '');\n path = toPath(path);\n return function(object) {\n return baseGet(object, path, pathKey);\n };\n }\n\n /**\n * The base implementation of `_.pullAt` without support for individual\n * index arguments and capturing the removed elements.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {number[]} indexes The indexes of elements to remove.\n * @returns {Array} Returns `array`.\n */\n function basePullAt(array, indexes) {\n var length = array ? indexes.length : 0;\n while (length--) {\n var index = indexes[length];\n if (index != previous && isIndex(index)) {\n var previous = index;\n splice.call(array, index, 1);\n }\n }\n return array;\n }\n\n /**\n * The base implementation of `_.random` without support for argument juggling\n * and returning floating-point numbers.\n *\n * @private\n * @param {number} min The minimum possible value.\n * @param {number} max The maximum possible value.\n * @returns {number} Returns the random number.\n */\n function baseRandom(min, max) {\n return min + nativeFloor(nativeRandom() * (max - min + 1));\n }\n\n /**\n * The base implementation of `_.reduce` and `_.reduceRight` without support\n * for callback shorthands and `this` binding, which iterates over `collection`\n * using the provided `eachFunc`.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {*} accumulator The initial value.\n * @param {boolean} initFromCollection Specify using the first or last element\n * of `collection` as the initial value.\n * @param {Function} eachFunc The function to iterate over `collection`.\n * @returns {*} Returns the accumulated value.\n */\n function baseReduce(collection, iteratee, accumulator, initFromCollection, eachFunc) {\n eachFunc(collection, function(value, index, collection) {\n accumulator = initFromCollection\n ? (initFromCollection = false, value)\n : iteratee(accumulator, value, index, collection);\n });\n return accumulator;\n }\n\n /**\n * The base implementation of `setData` without support for hot loop detection.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var baseSetData = !metaMap ? identity : function(func, data) {\n metaMap.set(func, data);\n return func;\n };\n\n /**\n * The base implementation of `_.slice` without an iteratee call guard.\n *\n * @private\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseSlice(array, start, end) {\n var index = -1,\n length = array.length;\n\n start = start == null ? 0 : (+start || 0);\n if (start < 0) {\n start = -start > length ? 0 : (length + start);\n }\n end = (end === undefined || end > length) ? length : (+end || 0);\n if (end < 0) {\n end += length;\n }\n length = start > end ? 0 : ((end - start) >>> 0);\n start >>>= 0;\n\n var result = Array(length);\n while (++index < length) {\n result[index] = array[index + start];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.some` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n */\n function baseSome(collection, predicate) {\n var result;\n\n baseEach(collection, function(value, index, collection) {\n result = predicate(value, index, collection);\n return !result;\n });\n return !!result;\n }\n\n /**\n * The base implementation of `_.sortBy` which uses `comparer` to define\n * the sort order of `array` and replaces criteria objects with their\n * corresponding values.\n *\n * @private\n * @param {Array} array The array to sort.\n * @param {Function} comparer The function to define sort order.\n * @returns {Array} Returns `array`.\n */\n function baseSortBy(array, comparer) {\n var length = array.length;\n\n array.sort(comparer);\n while (length--) {\n array[length] = array[length].value;\n }\n return array;\n }\n\n /**\n * The base implementation of `_.sortByOrder` without param guards.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {boolean[]} orders The sort orders of `iteratees`.\n * @returns {Array} Returns the new sorted array.\n */\n function baseSortByOrder(collection, iteratees, orders) {\n var callback = getCallback(),\n index = -1;\n\n iteratees = arrayMap(iteratees, function(iteratee) { return callback(iteratee); });\n\n var result = baseMap(collection, function(value) {\n var criteria = arrayMap(iteratees, function(iteratee) { return iteratee(value); });\n return { 'criteria': criteria, 'index': ++index, 'value': value };\n });\n\n return baseSortBy(result, function(object, other) {\n return compareMultiple(object, other, orders);\n });\n }\n\n /**\n * The base implementation of `_.sum` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {number} Returns the sum.\n */\n function baseSum(collection, iteratee) {\n var result = 0;\n baseEach(collection, function(value, index, collection) {\n result += +iteratee(value, index, collection) || 0;\n });\n return result;\n }\n\n /**\n * The base implementation of `_.uniq` without support for callback shorthands\n * and `this` binding.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {Function} [iteratee] The function invoked per iteration.\n * @returns {Array} Returns the new duplicate-value-free array.\n */\n function baseUniq(array, iteratee) {\n var index = -1,\n indexOf = getIndexOf(),\n length = array.length,\n isCommon = indexOf == baseIndexOf,\n isLarge = isCommon && length >= LARGE_ARRAY_SIZE,\n seen = isLarge ? createCache() : null,\n result = [];\n\n if (seen) {\n indexOf = cacheIndexOf;\n isCommon = false;\n } else {\n isLarge = false;\n seen = iteratee ? [] : result;\n }\n outer:\n while (++index < length) {\n var value = array[index],\n computed = iteratee ? iteratee(value, index, array) : value;\n\n if (isCommon && value === value) {\n var seenIndex = seen.length;\n while (seenIndex--) {\n if (seen[seenIndex] === computed) {\n continue outer;\n }\n }\n if (iteratee) {\n seen.push(computed);\n }\n result.push(value);\n }\n else if (indexOf(seen, computed, 0) < 0) {\n if (iteratee || isLarge) {\n seen.push(computed);\n }\n result.push(value);\n }\n }\n return result;\n }\n\n /**\n * The base implementation of `_.values` and `_.valuesIn` which creates an\n * array of `object` property values corresponding to the property names\n * of `props`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array} props The property names to get values for.\n * @returns {Object} Returns the array of property values.\n */\n function baseValues(object, props) {\n var index = -1,\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n result[index] = object[props[index]];\n }\n return result;\n }\n\n /**\n * The base implementation of `_.dropRightWhile`, `_.dropWhile`, `_.takeRightWhile`,\n * and `_.takeWhile` without support for callback shorthands and `this` binding.\n *\n * @private\n * @param {Array} array The array to query.\n * @param {Function} predicate The function invoked per iteration.\n * @param {boolean} [isDrop] Specify dropping elements instead of taking them.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Array} Returns the slice of `array`.\n */\n function baseWhile(array, predicate, isDrop, fromRight) {\n var length = array.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {}\n return isDrop\n ? baseSlice(array, (fromRight ? 0 : index), (fromRight ? index + 1 : length))\n : baseSlice(array, (fromRight ? index + 1 : 0), (fromRight ? length : index));\n }\n\n /**\n * The base implementation of `wrapperValue` which returns the result of\n * performing a sequence of actions on the unwrapped `value`, where each\n * successive action is supplied the return value of the previous.\n *\n * @private\n * @param {*} value The unwrapped value.\n * @param {Array} actions Actions to peform to resolve the unwrapped value.\n * @returns {*} Returns the resolved value.\n */\n function baseWrapperValue(value, actions) {\n var result = value;\n if (result instanceof LazyWrapper) {\n result = result.value();\n }\n var index = -1,\n length = actions.length;\n\n while (++index < length) {\n var action = actions[index];\n result = action.func.apply(action.thisArg, arrayPush([result], action.args));\n }\n return result;\n }\n\n /**\n * Performs a binary search of `array` to determine the index at which `value`\n * should be inserted into `array` in order to maintain its sort order.\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function binaryIndex(array, value, retHighest) {\n var low = 0,\n high = array ? array.length : low;\n\n if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {\n while (low < high) {\n var mid = (low + high) >>> 1,\n computed = array[mid];\n\n if ((retHighest ? (computed <= value) : (computed < value)) && computed !== null) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return high;\n }\n return binaryIndexBy(array, value, identity, retHighest);\n }\n\n /**\n * This function is like `binaryIndex` except that it invokes `iteratee` for\n * `value` and each element of `array` to compute their sort ranking. The\n * iteratee is invoked with one argument; (value).\n *\n * @private\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function} iteratee The function invoked per iteration.\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n */\n function binaryIndexBy(array, value, iteratee, retHighest) {\n value = iteratee(value);\n\n var low = 0,\n high = array ? array.length : 0,\n valIsNaN = value !== value,\n valIsNull = value === null,\n valIsUndef = value === undefined;\n\n while (low < high) {\n var mid = nativeFloor((low + high) / 2),\n computed = iteratee(array[mid]),\n isDef = computed !== undefined,\n isReflexive = computed === computed;\n\n if (valIsNaN) {\n var setLow = isReflexive || retHighest;\n } else if (valIsNull) {\n setLow = isReflexive && isDef && (retHighest || computed != null);\n } else if (valIsUndef) {\n setLow = isReflexive && (retHighest || isDef);\n } else if (computed == null) {\n setLow = false;\n } else {\n setLow = retHighest ? (computed <= value) : (computed < value);\n }\n if (setLow) {\n low = mid + 1;\n } else {\n high = mid;\n }\n }\n return nativeMin(high, MAX_ARRAY_INDEX);\n }\n\n /**\n * A specialized version of `baseCallback` which only supports `this` binding\n * and specifying the number of arguments to provide to `func`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {number} [argCount] The number of arguments to provide to `func`.\n * @returns {Function} Returns the callback.\n */\n function bindCallback(func, thisArg, argCount) {\n if (typeof func != 'function') {\n return identity;\n }\n if (thisArg === undefined) {\n return func;\n }\n switch (argCount) {\n case 1: return function(value) {\n return func.call(thisArg, value);\n };\n case 3: return function(value, index, collection) {\n return func.call(thisArg, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(thisArg, accumulator, value, index, collection);\n };\n case 5: return function(value, other, key, object, source) {\n return func.call(thisArg, value, other, key, object, source);\n };\n }\n return function() {\n return func.apply(thisArg, arguments);\n };\n }\n\n /**\n * Creates a clone of the given array buffer.\n *\n * @private\n * @param {ArrayBuffer} buffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\n function bufferClone(buffer) {\n var result = new ArrayBuffer(buffer.byteLength),\n view = new Uint8Array(result);\n\n view.set(new Uint8Array(buffer));\n return result;\n }\n\n /**\n * Creates an array that is the composition of partially applied arguments,\n * placeholders, and provided arguments into a single array of arguments.\n *\n * @private\n * @param {Array|Object} args The provided arguments.\n * @param {Array} partials The arguments to prepend to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgs(args, partials, holders) {\n var holdersLength = holders.length,\n argsIndex = -1,\n argsLength = nativeMax(args.length - holdersLength, 0),\n leftIndex = -1,\n leftLength = partials.length,\n result = Array(leftLength + argsLength);\n\n while (++leftIndex < leftLength) {\n result[leftIndex] = partials[leftIndex];\n }\n while (++argsIndex < holdersLength) {\n result[holders[argsIndex]] = args[argsIndex];\n }\n while (argsLength--) {\n result[leftIndex++] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * This function is like `composeArgs` except that the arguments composition\n * is tailored for `_.partialRight`.\n *\n * @private\n * @param {Array|Object} args The provided arguments.\n * @param {Array} partials The arguments to append to those provided.\n * @param {Array} holders The `partials` placeholder indexes.\n * @returns {Array} Returns the new array of composed arguments.\n */\n function composeArgsRight(args, partials, holders) {\n var holdersIndex = -1,\n holdersLength = holders.length,\n argsIndex = -1,\n argsLength = nativeMax(args.length - holdersLength, 0),\n rightIndex = -1,\n rightLength = partials.length,\n result = Array(argsLength + rightLength);\n\n while (++argsIndex < argsLength) {\n result[argsIndex] = args[argsIndex];\n }\n var offset = argsIndex;\n while (++rightIndex < rightLength) {\n result[offset + rightIndex] = partials[rightIndex];\n }\n while (++holdersIndex < holdersLength) {\n result[offset + holders[holdersIndex]] = args[argsIndex++];\n }\n return result;\n }\n\n /**\n * Creates a `_.countBy`, `_.groupBy`, `_.indexBy`, or `_.partition` function.\n *\n * @private\n * @param {Function} setter The function to set keys and values of the accumulator object.\n * @param {Function} [initializer] The function to initialize the accumulator object.\n * @returns {Function} Returns the new aggregator function.\n */\n function createAggregator(setter, initializer) {\n return function(collection, iteratee, thisArg) {\n var result = initializer ? initializer() : {};\n iteratee = getCallback(iteratee, thisArg, 3);\n\n if (isArray(collection)) {\n var index = -1,\n length = collection.length;\n\n while (++index < length) {\n var value = collection[index];\n setter(result, value, iteratee(value, index, collection), collection);\n }\n } else {\n baseEach(collection, function(value, key, collection) {\n setter(result, value, iteratee(value, key, collection), collection);\n });\n }\n return result;\n };\n }\n\n /**\n * Creates a `_.assign`, `_.defaults`, or `_.merge` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\n function createAssigner(assigner) {\n return restParam(function(object, sources) {\n var index = -1,\n length = object == null ? 0 : sources.length,\n customizer = length > 2 ? sources[length - 2] : undefined,\n guard = length > 2 ? sources[2] : undefined,\n thisArg = length > 1 ? sources[length - 1] : undefined;\n\n if (typeof customizer == 'function') {\n customizer = bindCallback(customizer, thisArg, 5);\n length -= 2;\n } else {\n customizer = typeof thisArg == 'function' ? thisArg : undefined;\n length -= (customizer ? 1 : 0);\n }\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, customizer);\n }\n }\n return object;\n });\n }\n\n /**\n * Creates a `baseEach` or `baseEachRight` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseEach(eachFunc, fromRight) {\n return function(collection, iteratee) {\n var length = collection ? getLength(collection) : 0;\n if (!isLength(length)) {\n return eachFunc(collection, iteratee);\n }\n var index = fromRight ? length : -1,\n iterable = toObject(collection);\n\n while ((fromRight ? index-- : ++index < length)) {\n if (iteratee(iterable[index], index, iterable) === false) {\n break;\n }\n }\n return collection;\n };\n }\n\n /**\n * Creates a base function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new base function.\n */\n function createBaseFor(fromRight) {\n return function(object, iteratee, keysFunc) {\n var iterable = toObject(object),\n props = keysFunc(object),\n length = props.length,\n index = fromRight ? length : -1;\n\n while ((fromRight ? index-- : ++index < length)) {\n var key = props[index];\n if (iteratee(iterable[key], key, iterable) === false) {\n break;\n }\n }\n return object;\n };\n }\n\n /**\n * Creates a function that wraps `func` and invokes it with the `this`\n * binding of `thisArg`.\n *\n * @private\n * @param {Function} func The function to bind.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @returns {Function} Returns the new bound function.\n */\n function createBindWrapper(func, thisArg) {\n var Ctor = createCtorWrapper(func);\n\n function wrapper() {\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(thisArg, arguments);\n }\n return wrapper;\n }\n\n /**\n * Creates a `Set` cache object to optimize linear searches of large arrays.\n *\n * @private\n * @param {Array} [values] The values to cache.\n * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`.\n */\n function createCache(values) {\n return (nativeCreate && Set) ? new SetCache(values) : null;\n }\n\n /**\n * Creates a function that produces compound words out of the words in a\n * given string.\n *\n * @private\n * @param {Function} callback The function to combine each word.\n * @returns {Function} Returns the new compounder function.\n */\n function createCompounder(callback) {\n return function(string) {\n var index = -1,\n array = words(deburr(string)),\n length = array.length,\n result = '';\n\n while (++index < length) {\n result = callback(result, array[index], index);\n }\n return result;\n };\n }\n\n /**\n * Creates a function that produces an instance of `Ctor` regardless of\n * whether it was invoked as part of a `new` expression or by `call` or `apply`.\n *\n * @private\n * @param {Function} Ctor The constructor to wrap.\n * @returns {Function} Returns the new wrapped function.\n */\n function createCtorWrapper(Ctor) {\n return function() {\n // Use a `switch` statement to work with class constructors.\n // See http://ecma-international.org/ecma-262/6.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist\n // for more details.\n var args = arguments;\n switch (args.length) {\n case 0: return new Ctor;\n case 1: return new Ctor(args[0]);\n case 2: return new Ctor(args[0], args[1]);\n case 3: return new Ctor(args[0], args[1], args[2]);\n case 4: return new Ctor(args[0], args[1], args[2], args[3]);\n case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);\n case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);\n case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);\n }\n var thisBinding = baseCreate(Ctor.prototype),\n result = Ctor.apply(thisBinding, args);\n\n // Mimic the constructor's `return` behavior.\n // See https://es5.github.io/#x13.2.2 for more details.\n return isObject(result) ? result : thisBinding;\n };\n }\n\n /**\n * Creates a `_.curry` or `_.curryRight` function.\n *\n * @private\n * @param {boolean} flag The curry bit flag.\n * @returns {Function} Returns the new curry function.\n */\n function createCurry(flag) {\n function curryFunc(func, arity, guard) {\n if (guard && isIterateeCall(func, arity, guard)) {\n arity = undefined;\n }\n var result = createWrapper(func, flag, undefined, undefined, undefined, undefined, undefined, arity);\n result.placeholder = curryFunc.placeholder;\n return result;\n }\n return curryFunc;\n }\n\n /**\n * Creates a `_.defaults` or `_.defaultsDeep` function.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @param {Function} customizer The function to customize assigned values.\n * @returns {Function} Returns the new defaults function.\n */\n function createDefaults(assigner, customizer) {\n return restParam(function(args) {\n var object = args[0];\n if (object == null) {\n return object;\n }\n args.push(customizer);\n return assigner.apply(undefined, args);\n });\n }\n\n /**\n * Creates a `_.max` or `_.min` function.\n *\n * @private\n * @param {Function} comparator The function used to compare values.\n * @param {*} exValue The initial extremum value.\n * @returns {Function} Returns the new extremum function.\n */\n function createExtremum(comparator, exValue) {\n return function(collection, iteratee, thisArg) {\n if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {\n iteratee = undefined;\n }\n iteratee = getCallback(iteratee, thisArg, 3);\n if (iteratee.length == 1) {\n collection = isArray(collection) ? collection : toIterable(collection);\n var result = arrayExtremum(collection, iteratee, comparator, exValue);\n if (!(collection.length && result === exValue)) {\n return result;\n }\n }\n return baseExtremum(collection, iteratee, comparator, exValue);\n };\n }\n\n /**\n * Creates a `_.find` or `_.findLast` function.\n *\n * @private\n * @param {Function} eachFunc The function to iterate over a collection.\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new find function.\n */\n function createFind(eachFunc, fromRight) {\n return function(collection, predicate, thisArg) {\n predicate = getCallback(predicate, thisArg, 3);\n if (isArray(collection)) {\n var index = baseFindIndex(collection, predicate, fromRight);\n return index > -1 ? collection[index] : undefined;\n }\n return baseFind(collection, predicate, eachFunc);\n };\n }\n\n /**\n * Creates a `_.findIndex` or `_.findLastIndex` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new find function.\n */\n function createFindIndex(fromRight) {\n return function(array, predicate, thisArg) {\n if (!(array && array.length)) {\n return -1;\n }\n predicate = getCallback(predicate, thisArg, 3);\n return baseFindIndex(array, predicate, fromRight);\n };\n }\n\n /**\n * Creates a `_.findKey` or `_.findLastKey` function.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new find function.\n */\n function createFindKey(objectFunc) {\n return function(object, predicate, thisArg) {\n predicate = getCallback(predicate, thisArg, 3);\n return baseFind(object, predicate, objectFunc, true);\n };\n }\n\n /**\n * Creates a `_.flow` or `_.flowRight` function.\n *\n * @private\n * @param {boolean} [fromRight] Specify iterating from right to left.\n * @returns {Function} Returns the new flow function.\n */\n function createFlow(fromRight) {\n return function() {\n var wrapper,\n length = arguments.length,\n index = fromRight ? length : -1,\n leftIndex = 0,\n funcs = Array(length);\n\n while ((fromRight ? index-- : ++index < length)) {\n var func = funcs[leftIndex++] = arguments[index];\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (!wrapper && LodashWrapper.prototype.thru && getFuncName(func) == 'wrapper') {\n wrapper = new LodashWrapper([], true);\n }\n }\n index = wrapper ? -1 : length;\n while (++index < length) {\n func = funcs[index];\n\n var funcName = getFuncName(func),\n data = funcName == 'wrapper' ? getData(func) : undefined;\n\n if (data && isLaziable(data[0]) && data[1] == (ARY_FLAG | CURRY_FLAG | PARTIAL_FLAG | REARG_FLAG) && !data[4].length && data[9] == 1) {\n wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);\n } else {\n wrapper = (func.length == 1 && isLaziable(func)) ? wrapper[funcName]() : wrapper.thru(func);\n }\n }\n return function() {\n var args = arguments,\n value = args[0];\n\n if (wrapper && args.length == 1 && isArray(value) && value.length >= LARGE_ARRAY_SIZE) {\n return wrapper.plant(value).value();\n }\n var index = 0,\n result = length ? funcs[index].apply(this, args) : value;\n\n while (++index < length) {\n result = funcs[index].call(this, result);\n }\n return result;\n };\n };\n }\n\n /**\n * Creates a function for `_.forEach` or `_.forEachRight`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over an array.\n * @param {Function} eachFunc The function to iterate over a collection.\n * @returns {Function} Returns the new each function.\n */\n function createForEach(arrayFunc, eachFunc) {\n return function(collection, iteratee, thisArg) {\n return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))\n ? arrayFunc(collection, iteratee)\n : eachFunc(collection, bindCallback(iteratee, thisArg, 3));\n };\n }\n\n /**\n * Creates a function for `_.forIn` or `_.forInRight`.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new each function.\n */\n function createForIn(objectFunc) {\n return function(object, iteratee, thisArg) {\n if (typeof iteratee != 'function' || thisArg !== undefined) {\n iteratee = bindCallback(iteratee, thisArg, 3);\n }\n return objectFunc(object, iteratee, keysIn);\n };\n }\n\n /**\n * Creates a function for `_.forOwn` or `_.forOwnRight`.\n *\n * @private\n * @param {Function} objectFunc The function to iterate over an object.\n * @returns {Function} Returns the new each function.\n */\n function createForOwn(objectFunc) {\n return function(object, iteratee, thisArg) {\n if (typeof iteratee != 'function' || thisArg !== undefined) {\n iteratee = bindCallback(iteratee, thisArg, 3);\n }\n return objectFunc(object, iteratee);\n };\n }\n\n /**\n * Creates a function for `_.mapKeys` or `_.mapValues`.\n *\n * @private\n * @param {boolean} [isMapKeys] Specify mapping keys instead of values.\n * @returns {Function} Returns the new map function.\n */\n function createObjectMapper(isMapKeys) {\n return function(object, iteratee, thisArg) {\n var result = {};\n iteratee = getCallback(iteratee, thisArg, 3);\n\n baseForOwn(object, function(value, key, object) {\n var mapped = iteratee(value, key, object);\n key = isMapKeys ? mapped : key;\n value = isMapKeys ? value : mapped;\n result[key] = value;\n });\n return result;\n };\n }\n\n /**\n * Creates a function for `_.padLeft` or `_.padRight`.\n *\n * @private\n * @param {boolean} [fromRight] Specify padding from the right.\n * @returns {Function} Returns the new pad function.\n */\n function createPadDir(fromRight) {\n return function(string, length, chars) {\n string = baseToString(string);\n return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);\n };\n }\n\n /**\n * Creates a `_.partial` or `_.partialRight` function.\n *\n * @private\n * @param {boolean} flag The partial bit flag.\n * @returns {Function} Returns the new partial function.\n */\n function createPartial(flag) {\n var partialFunc = restParam(function(func, partials) {\n var holders = replaceHolders(partials, partialFunc.placeholder);\n return createWrapper(func, flag, undefined, partials, holders);\n });\n return partialFunc;\n }\n\n /**\n * Creates a function for `_.reduce` or `_.reduceRight`.\n *\n * @private\n * @param {Function} arrayFunc The function to iterate over an array.\n * @param {Function} eachFunc The function to iterate over a collection.\n * @returns {Function} Returns the new each function.\n */\n function createReduce(arrayFunc, eachFunc) {\n return function(collection, iteratee, accumulator, thisArg) {\n var initFromArray = arguments.length < 3;\n return (typeof iteratee == 'function' && thisArg === undefined && isArray(collection))\n ? arrayFunc(collection, iteratee, accumulator, initFromArray)\n : baseReduce(collection, getCallback(iteratee, thisArg, 4), accumulator, initFromArray, eachFunc);\n };\n }\n\n /**\n * Creates a function that wraps `func` and invokes it with optional `this`\n * binding of, partial application, and currying.\n *\n * @private\n * @param {Function|string} func The function or method name to reference.\n * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to prepend to those provided to the new function.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [partialsRight] The arguments to append to those provided to the new function.\n * @param {Array} [holdersRight] The `partialsRight` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createHybridWrapper(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {\n var isAry = bitmask & ARY_FLAG,\n isBind = bitmask & BIND_FLAG,\n isBindKey = bitmask & BIND_KEY_FLAG,\n isCurry = bitmask & CURRY_FLAG,\n isCurryBound = bitmask & CURRY_BOUND_FLAG,\n isCurryRight = bitmask & CURRY_RIGHT_FLAG,\n Ctor = isBindKey ? undefined : createCtorWrapper(func);\n\n function wrapper() {\n // Avoid `arguments` object use disqualifying optimizations by\n // converting it to an array before providing it to other functions.\n var length = arguments.length,\n index = length,\n args = Array(length);\n\n while (index--) {\n args[index] = arguments[index];\n }\n if (partials) {\n args = composeArgs(args, partials, holders);\n }\n if (partialsRight) {\n args = composeArgsRight(args, partialsRight, holdersRight);\n }\n if (isCurry || isCurryRight) {\n var placeholder = wrapper.placeholder,\n argsHolders = replaceHolders(args, placeholder);\n\n length -= argsHolders.length;\n if (length < arity) {\n var newArgPos = argPos ? arrayCopy(argPos) : undefined,\n newArity = nativeMax(arity - length, 0),\n newsHolders = isCurry ? argsHolders : undefined,\n newHoldersRight = isCurry ? undefined : argsHolders,\n newPartials = isCurry ? args : undefined,\n newPartialsRight = isCurry ? undefined : args;\n\n bitmask |= (isCurry ? PARTIAL_FLAG : PARTIAL_RIGHT_FLAG);\n bitmask &= ~(isCurry ? PARTIAL_RIGHT_FLAG : PARTIAL_FLAG);\n\n if (!isCurryBound) {\n bitmask &= ~(BIND_FLAG | BIND_KEY_FLAG);\n }\n var newData = [func, bitmask, thisArg, newPartials, newsHolders, newPartialsRight, newHoldersRight, newArgPos, ary, newArity],\n result = createHybridWrapper.apply(undefined, newData);\n\n if (isLaziable(func)) {\n setData(result, newData);\n }\n result.placeholder = placeholder;\n return result;\n }\n }\n var thisBinding = isBind ? thisArg : this,\n fn = isBindKey ? thisBinding[func] : func;\n\n if (argPos) {\n args = reorder(args, argPos);\n }\n if (isAry && ary < args.length) {\n args.length = ary;\n }\n if (this && this !== root && this instanceof wrapper) {\n fn = Ctor || createCtorWrapper(func);\n }\n return fn.apply(thisBinding, args);\n }\n return wrapper;\n }\n\n /**\n * Creates the padding required for `string` based on the given `length`.\n * The `chars` string is truncated if the number of characters exceeds `length`.\n *\n * @private\n * @param {string} string The string to create padding for.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the pad for `string`.\n */\n function createPadding(string, length, chars) {\n var strLength = string.length;\n length = +length;\n\n if (strLength >= length || !nativeIsFinite(length)) {\n return '';\n }\n var padLength = length - strLength;\n chars = chars == null ? ' ' : (chars + '');\n return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);\n }\n\n /**\n * Creates a function that wraps `func` and invokes it with the optional `this`\n * binding of `thisArg` and the `partials` prepended to those provided to\n * the wrapper.\n *\n * @private\n * @param {Function} func The function to partially apply arguments to.\n * @param {number} bitmask The bitmask of flags. See `createWrapper` for more details.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} partials The arguments to prepend to those provided to the new function.\n * @returns {Function} Returns the new bound function.\n */\n function createPartialWrapper(func, bitmask, thisArg, partials) {\n var isBind = bitmask & BIND_FLAG,\n Ctor = createCtorWrapper(func);\n\n function wrapper() {\n // Avoid `arguments` object use disqualifying optimizations by\n // converting it to an array before providing it `func`.\n var argsIndex = -1,\n argsLength = arguments.length,\n leftIndex = -1,\n leftLength = partials.length,\n args = Array(leftLength + argsLength);\n\n while (++leftIndex < leftLength) {\n args[leftIndex] = partials[leftIndex];\n }\n while (argsLength--) {\n args[leftIndex++] = arguments[++argsIndex];\n }\n var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func;\n return fn.apply(isBind ? thisArg : this, args);\n }\n return wrapper;\n }\n\n /**\n * Creates a `_.ceil`, `_.floor`, or `_.round` function.\n *\n * @private\n * @param {string} methodName The name of the `Math` method to use when rounding.\n * @returns {Function} Returns the new round function.\n */\n function createRound(methodName) {\n var func = Math[methodName];\n return function(number, precision) {\n precision = precision === undefined ? 0 : (+precision || 0);\n if (precision) {\n precision = pow(10, precision);\n return func(number * precision) / precision;\n }\n return func(number);\n };\n }\n\n /**\n * Creates a `_.sortedIndex` or `_.sortedLastIndex` function.\n *\n * @private\n * @param {boolean} [retHighest] Specify returning the highest qualified index.\n * @returns {Function} Returns the new index function.\n */\n function createSortedIndex(retHighest) {\n return function(array, value, iteratee, thisArg) {\n var callback = getCallback(iteratee);\n return (iteratee == null && callback === baseCallback)\n ? binaryIndex(array, value, retHighest)\n : binaryIndexBy(array, value, callback(iteratee, thisArg, 1), retHighest);\n };\n }\n\n /**\n * Creates a function that either curries or invokes `func` with optional\n * `this` binding and partially applied arguments.\n *\n * @private\n * @param {Function|string} func The function or method name to reference.\n * @param {number} bitmask The bitmask of flags.\n * The bitmask may be composed of the following flags:\n * 1 - `_.bind`\n * 2 - `_.bindKey`\n * 4 - `_.curry` or `_.curryRight` of a bound function\n * 8 - `_.curry`\n * 16 - `_.curryRight`\n * 32 - `_.partial`\n * 64 - `_.partialRight`\n * 128 - `_.rearg`\n * 256 - `_.ary`\n * @param {*} [thisArg] The `this` binding of `func`.\n * @param {Array} [partials] The arguments to be partially applied.\n * @param {Array} [holders] The `partials` placeholder indexes.\n * @param {Array} [argPos] The argument positions of the new function.\n * @param {number} [ary] The arity cap of `func`.\n * @param {number} [arity] The arity of `func`.\n * @returns {Function} Returns the new wrapped function.\n */\n function createWrapper(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {\n var isBindKey = bitmask & BIND_KEY_FLAG;\n if (!isBindKey && typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = partials ? partials.length : 0;\n if (!length) {\n bitmask &= ~(PARTIAL_FLAG | PARTIAL_RIGHT_FLAG);\n partials = holders = undefined;\n }\n length -= (holders ? holders.length : 0);\n if (bitmask & PARTIAL_RIGHT_FLAG) {\n var partialsRight = partials,\n holdersRight = holders;\n\n partials = holders = undefined;\n }\n var data = isBindKey ? undefined : getData(func),\n newData = [func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity];\n\n if (data) {\n mergeData(newData, data);\n bitmask = newData[1];\n arity = newData[9];\n }\n newData[9] = arity == null\n ? (isBindKey ? 0 : func.length)\n : (nativeMax(arity - length, 0) || 0);\n\n if (bitmask == BIND_FLAG) {\n var result = createBindWrapper(newData[0], newData[2]);\n } else if ((bitmask == PARTIAL_FLAG || bitmask == (BIND_FLAG | PARTIAL_FLAG)) && !newData[4].length) {\n result = createPartialWrapper.apply(undefined, newData);\n } else {\n result = createHybridWrapper.apply(undefined, newData);\n }\n var setter = data ? baseSetData : setData;\n return setter(result, newData);\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for arrays with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Array} array The array to compare.\n * @param {Array} other The other array to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing arrays.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.\n */\n function equalArrays(array, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var index = -1,\n arrLength = array.length,\n othLength = other.length;\n\n if (arrLength != othLength && !(isLoose && othLength > arrLength)) {\n return false;\n }\n // Ignore non-index properties.\n while (++index < arrLength) {\n var arrValue = array[index],\n othValue = other[index],\n result = customizer ? customizer(isLoose ? othValue : arrValue, isLoose ? arrValue : othValue, index) : undefined;\n\n if (result !== undefined) {\n if (result) {\n continue;\n }\n return false;\n }\n // Recursively compare arrays (susceptible to call stack limits).\n if (isLoose) {\n if (!arraySome(other, function(othValue) {\n return arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB);\n })) {\n return false;\n }\n } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, customizer, isLoose, stackA, stackB))) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for comparing objects of\n * the same `toStringTag`.\n *\n * **Note:** This function only supports comparing values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {string} tag The `toStringTag` of the objects to compare.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalByTag(object, other, tag) {\n switch (tag) {\n case boolTag:\n case dateTag:\n // Coerce dates and booleans to numbers, dates to milliseconds and booleans\n // to `1` or `0` treating invalid dates coerced to `NaN` as not equal.\n return +object == +other;\n\n case errorTag:\n return object.name == other.name && object.message == other.message;\n\n case numberTag:\n // Treat `NaN` vs. `NaN` as equal.\n return (object != +object)\n ? other != +other\n : object == +other;\n\n case regexpTag:\n case stringTag:\n // Coerce regexes to strings and treat strings primitives and string\n // objects as equal. See https://es5.github.io/#x15.10.6.4 for more details.\n return object == (other + '');\n }\n return false;\n }\n\n /**\n * A specialized version of `baseIsEqualDeep` for objects with support for\n * partial deep comparisons.\n *\n * @private\n * @param {Object} object The object to compare.\n * @param {Object} other The other object to compare.\n * @param {Function} equalFunc The function to determine equivalents of values.\n * @param {Function} [customizer] The function to customize comparing values.\n * @param {boolean} [isLoose] Specify performing partial comparisons.\n * @param {Array} [stackA] Tracks traversed `value` objects.\n * @param {Array} [stackB] Tracks traversed `other` objects.\n * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.\n */\n function equalObjects(object, other, equalFunc, customizer, isLoose, stackA, stackB) {\n var objProps = keys(object),\n objLength = objProps.length,\n othProps = keys(other),\n othLength = othProps.length;\n\n if (objLength != othLength && !isLoose) {\n return false;\n }\n var index = objLength;\n while (index--) {\n var key = objProps[index];\n if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) {\n return false;\n }\n }\n var skipCtor = isLoose;\n while (++index < objLength) {\n key = objProps[index];\n var objValue = object[key],\n othValue = other[key],\n result = customizer ? customizer(isLoose ? othValue : objValue, isLoose? objValue : othValue, key) : undefined;\n\n // Recursively compare objects (susceptible to call stack limits).\n if (!(result === undefined ? equalFunc(objValue, othValue, customizer, isLoose, stackA, stackB) : result)) {\n return false;\n }\n skipCtor || (skipCtor = key == 'constructor');\n }\n if (!skipCtor) {\n var objCtor = object.constructor,\n othCtor = other.constructor;\n\n // Non `Object` object instances with different constructors are not equal.\n if (objCtor != othCtor &&\n ('constructor' in object && 'constructor' in other) &&\n !(typeof objCtor == 'function' && objCtor instanceof objCtor &&\n typeof othCtor == 'function' && othCtor instanceof othCtor)) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Gets the appropriate \"callback\" function. If the `_.callback` method is\n * customized this function returns the custom method, otherwise it returns\n * the `baseCallback` function. If arguments are provided the chosen function\n * is invoked with them and its result is returned.\n *\n * @private\n * @returns {Function} Returns the chosen function or its result.\n */\n function getCallback(func, thisArg, argCount) {\n var result = lodash.callback || callback;\n result = result === callback ? baseCallback : result;\n return argCount ? result(func, thisArg, argCount) : result;\n }\n\n /**\n * Gets metadata for `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {*} Returns the metadata for `func`.\n */\n var getData = !metaMap ? noop : function(func) {\n return metaMap.get(func);\n };\n\n /**\n * Gets the name of `func`.\n *\n * @private\n * @param {Function} func The function to query.\n * @returns {string} Returns the function name.\n */\n function getFuncName(func) {\n var result = func.name,\n array = realNames[result],\n length = array ? array.length : 0;\n\n while (length--) {\n var data = array[length],\n otherFunc = data.func;\n if (otherFunc == null || otherFunc == func) {\n return data.name;\n }\n }\n return result;\n }\n\n /**\n * Gets the appropriate \"indexOf\" function. If the `_.indexOf` method is\n * customized this function returns the custom method, otherwise it returns\n * the `baseIndexOf` function. If arguments are provided the chosen function\n * is invoked with them and its result is returned.\n *\n * @private\n * @returns {Function|number} Returns the chosen function or its result.\n */\n function getIndexOf(collection, target, fromIndex) {\n var result = lodash.indexOf || indexOf;\n result = result === indexOf ? baseIndexOf : result;\n return collection ? result(collection, target, fromIndex) : result;\n }\n\n /**\n * Gets the \"length\" property value of `object`.\n *\n * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)\n * that affects Safari on at least iOS 8.1-8.3 ARM64.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {*} Returns the \"length\" value.\n */\n var getLength = baseProperty('length');\n\n /**\n * Gets the propery names, values, and compare flags of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the match data of `object`.\n */\n function getMatchData(object) {\n var result = pairs(object),\n length = result.length;\n\n while (length--) {\n result[length][2] = isStrictComparable(result[length][1]);\n }\n return result;\n }\n\n /**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\n function getNative(object, key) {\n var value = object == null ? undefined : object[key];\n return isNative(value) ? value : undefined;\n }\n\n /**\n * Gets the view, applying any `transforms` to the `start` and `end` positions.\n *\n * @private\n * @param {number} start The start of the view.\n * @param {number} end The end of the view.\n * @param {Array} transforms The transformations to apply to the view.\n * @returns {Object} Returns an object containing the `start` and `end`\n * positions of the view.\n */\n function getView(start, end, transforms) {\n var index = -1,\n length = transforms.length;\n\n while (++index < length) {\n var data = transforms[index],\n size = data.size;\n\n switch (data.type) {\n case 'drop': start += size; break;\n case 'dropRight': end -= size; break;\n case 'take': end = nativeMin(end, start + size); break;\n case 'takeRight': start = nativeMax(start, end - size); break;\n }\n }\n return { 'start': start, 'end': end };\n }\n\n /**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\n function initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add array properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n }\n\n /**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneObject(object) {\n var Ctor = object.constructor;\n if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) {\n Ctor = Object;\n }\n return new Ctor;\n }\n\n /**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\n function initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return bufferClone(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n var buffer = object.buffer;\n return new Ctor(isDeep ? bufferClone(buffer) : buffer, object.byteOffset, object.length);\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n var result = new Ctor(object.source, reFlags.exec(object));\n result.lastIndex = object.lastIndex;\n }\n return result;\n }\n\n /**\n * Invokes the method at `path` on `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the method to invoke.\n * @param {Array} args The arguments to invoke the method with.\n * @returns {*} Returns the result of the invoked method.\n */\n function invokePath(object, path, args) {\n if (object != null && !isKey(path, object)) {\n path = toPath(path);\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n path = last(path);\n }\n var func = object == null ? object : object[path];\n return func == null ? undefined : func.apply(object, args);\n }\n\n /**\n * Checks if `value` is array-like.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n */\n function isArrayLike(value) {\n return value != null && isLength(getLength(value));\n }\n\n /**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\n function isIndex(value, length) {\n value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;\n length = length == null ? MAX_SAFE_INTEGER : length;\n return value > -1 && value % 1 == 0 && value < length;\n }\n\n /**\n * Checks if the provided arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.\n */\n function isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)) {\n var other = object[index];\n return value === value ? (value === other) : (other !== other);\n }\n return false;\n }\n\n /**\n * Checks if `value` is a property name and not a property path.\n *\n * @private\n * @param {*} value The value to check.\n * @param {Object} [object] The object to query keys on.\n * @returns {boolean} Returns `true` if `value` is a property name, else `false`.\n */\n function isKey(value, object) {\n var type = typeof value;\n if ((type == 'string' && reIsPlainProp.test(value)) || type == 'number') {\n return true;\n }\n if (isArray(value)) {\n return false;\n }\n var result = !reIsDeepProp.test(value);\n return result || (object != null && value in toObject(object));\n }\n\n /**\n * Checks if `func` has a lazy counterpart.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`.\n */\n function isLaziable(func) {\n var funcName = getFuncName(func);\n if (!(funcName in LazyWrapper.prototype)) {\n return false;\n }\n var other = lodash[funcName];\n if (func === other) {\n return true;\n }\n var data = getData(other);\n return !!data && func === data[0];\n }\n\n /**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n */\n function isLength(value) {\n return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n }\n\n /**\n * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` if suitable for strict\n * equality comparisons, else `false`.\n */\n function isStrictComparable(value) {\n return value === value && !isObject(value);\n }\n\n /**\n * Merges the function metadata of `source` into `data`.\n *\n * Merging metadata reduces the number of wrappers required to invoke a function.\n * This is possible because methods like `_.bind`, `_.curry`, and `_.partial`\n * may be applied regardless of execution order. Methods like `_.ary` and `_.rearg`\n * augment function arguments, making the order in which they are executed important,\n * preventing the merging of metadata. However, we make an exception for a safe\n * common case where curried functions have `_.ary` and or `_.rearg` applied.\n *\n * @private\n * @param {Array} data The destination metadata.\n * @param {Array} source The source metadata.\n * @returns {Array} Returns `data`.\n */\n function mergeData(data, source) {\n var bitmask = data[1],\n srcBitmask = source[1],\n newBitmask = bitmask | srcBitmask,\n isCommon = newBitmask < ARY_FLAG;\n\n var isCombo =\n (srcBitmask == ARY_FLAG && bitmask == CURRY_FLAG) ||\n (srcBitmask == ARY_FLAG && bitmask == REARG_FLAG && data[7].length <= source[8]) ||\n (srcBitmask == (ARY_FLAG | REARG_FLAG) && bitmask == CURRY_FLAG);\n\n // Exit early if metadata can't be merged.\n if (!(isCommon || isCombo)) {\n return data;\n }\n // Use source `thisArg` if available.\n if (srcBitmask & BIND_FLAG) {\n data[2] = source[2];\n // Set when currying a bound function.\n newBitmask |= (bitmask & BIND_FLAG) ? 0 : CURRY_BOUND_FLAG;\n }\n // Compose partial arguments.\n var value = source[3];\n if (value) {\n var partials = data[3];\n data[3] = partials ? composeArgs(partials, value, source[4]) : arrayCopy(value);\n data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : arrayCopy(source[4]);\n }\n // Compose partial right arguments.\n value = source[5];\n if (value) {\n partials = data[5];\n data[5] = partials ? composeArgsRight(partials, value, source[6]) : arrayCopy(value);\n data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : arrayCopy(source[6]);\n }\n // Use source `argPos` if available.\n value = source[7];\n if (value) {\n data[7] = arrayCopy(value);\n }\n // Use source `ary` if it's smaller.\n if (srcBitmask & ARY_FLAG) {\n data[8] = data[8] == null ? source[8] : nativeMin(data[8], source[8]);\n }\n // Use source `arity` if one is not provided.\n if (data[9] == null) {\n data[9] = source[9];\n }\n // Use source `func` and merge bitmasks.\n data[0] = source[0];\n data[1] = newBitmask;\n\n return data;\n }\n\n /**\n * Used by `_.defaultsDeep` to customize its `_.merge` use.\n *\n * @private\n * @param {*} objectValue The destination object property value.\n * @param {*} sourceValue The source object property value.\n * @returns {*} Returns the value to assign to the destination object.\n */\n function mergeDefaults(objectValue, sourceValue) {\n return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults);\n }\n\n /**\n * A specialized version of `_.pick` which picks `object` properties specified\n * by `props`.\n *\n * @private\n * @param {Object} object The source object.\n * @param {string[]} props The property names to pick.\n * @returns {Object} Returns the new object.\n */\n function pickByArray(object, props) {\n object = toObject(object);\n\n var index = -1,\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index];\n if (key in object) {\n result[key] = object[key];\n }\n }\n return result;\n }\n\n /**\n * A specialized version of `_.pick` which picks `object` properties `predicate`\n * returns truthy for.\n *\n * @private\n * @param {Object} object The source object.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Object} Returns the new object.\n */\n function pickByCallback(object, predicate) {\n var result = {};\n baseForIn(object, function(value, key, object) {\n if (predicate(value, key, object)) {\n result[key] = value;\n }\n });\n return result;\n }\n\n /**\n * Reorder `array` according to the specified indexes where the element at\n * the first index is assigned as the first element, the element at\n * the second index is assigned as the second element, and so on.\n *\n * @private\n * @param {Array} array The array to reorder.\n * @param {Array} indexes The arranged array indexes.\n * @returns {Array} Returns `array`.\n */\n function reorder(array, indexes) {\n var arrLength = array.length,\n length = nativeMin(indexes.length, arrLength),\n oldArray = arrayCopy(array);\n\n while (length--) {\n var index = indexes[length];\n array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;\n }\n return array;\n }\n\n /**\n * Sets metadata for `func`.\n *\n * **Note:** If this function becomes hot, i.e. is invoked a lot in a short\n * period of time, it will trip its breaker and transition to an identity function\n * to avoid garbage collection pauses in V8. See [V8 issue 2070](https://code.google.com/p/v8/issues/detail?id=2070)\n * for more details.\n *\n * @private\n * @param {Function} func The function to associate metadata with.\n * @param {*} data The metadata.\n * @returns {Function} Returns `func`.\n */\n var setData = (function() {\n var count = 0,\n lastCalled = 0;\n\n return function(key, value) {\n var stamp = now(),\n remaining = HOT_SPAN - (stamp - lastCalled);\n\n lastCalled = stamp;\n if (remaining > 0) {\n if (++count >= HOT_COUNT) {\n return key;\n }\n } else {\n count = 0;\n }\n return baseSetData(key, value);\n };\n }());\n\n /**\n * A fallback implementation of `Object.keys` which creates an array of the\n * own enumerable property names of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\n function shimKeys(object) {\n var props = keysIn(object),\n propsLength = props.length,\n length = propsLength && object.length;\n\n var allowIndexes = !!length && isLength(length) &&\n (isArray(object) || isArguments(object));\n\n var index = -1,\n result = [];\n\n while (++index < propsLength) {\n var key = props[index];\n if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * Converts `value` to an array-like object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array|Object} Returns the array-like object.\n */\n function toIterable(value) {\n if (value == null) {\n return [];\n }\n if (!isArrayLike(value)) {\n return values(value);\n }\n return isObject(value) ? value : Object(value);\n }\n\n /**\n * Converts `value` to an object if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Object} Returns the object.\n */\n function toObject(value) {\n return isObject(value) ? value : Object(value);\n }\n\n /**\n * Converts `value` to property path array if it's not one.\n *\n * @private\n * @param {*} value The value to process.\n * @returns {Array} Returns the property path array.\n */\n function toPath(value) {\n if (isArray(value)) {\n return value;\n }\n var result = [];\n baseToString(value).replace(rePropName, function(match, number, quote, string) {\n result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));\n });\n return result;\n }\n\n /**\n * Creates a clone of `wrapper`.\n *\n * @private\n * @param {Object} wrapper The wrapper to clone.\n * @returns {Object} Returns the cloned wrapper.\n */\n function wrapperClone(wrapper) {\n return wrapper instanceof LazyWrapper\n ? wrapper.clone()\n : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements split into groups the length of `size`.\n * If `collection` can't be split evenly, the final chunk will be the remaining\n * elements.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to process.\n * @param {number} [size=1] The length of each chunk.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the new array containing chunks.\n * @example\n *\n * _.chunk(['a', 'b', 'c', 'd'], 2);\n * // => [['a', 'b'], ['c', 'd']]\n *\n * _.chunk(['a', 'b', 'c', 'd'], 3);\n * // => [['a', 'b', 'c'], ['d']]\n */\n function chunk(array, size, guard) {\n if (guard ? isIterateeCall(array, size, guard) : size == null) {\n size = 1;\n } else {\n size = nativeMax(nativeFloor(size) || 1, 1);\n }\n var index = 0,\n length = array ? array.length : 0,\n resIndex = -1,\n result = Array(nativeCeil(length / size));\n\n while (index < length) {\n result[++resIndex] = baseSlice(array, index, (index += size));\n }\n return result;\n }\n\n /**\n * Creates an array with all falsey values removed. The values `false`, `null`,\n * `0`, `\"\"`, `undefined`, and `NaN` are falsey.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to compact.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.compact([0, 1, false, 2, '', 3]);\n * // => [1, 2, 3]\n */\n function compact(array) {\n var index = -1,\n length = array ? array.length : 0,\n resIndex = -1,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (value) {\n result[++resIndex] = value;\n }\n }\n return result;\n }\n\n /**\n * Creates an array of unique `array` values not included in the other\n * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {...Array} [values] The arrays of values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.difference([1, 2, 3], [4, 2]);\n * // => [1, 3]\n */\n var difference = restParam(function(array, values) {\n return (isObjectLike(array) && isArrayLike(array))\n ? baseDifference(array, baseFlatten(values, false, true))\n : [];\n });\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the beginning.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.drop([1, 2, 3]);\n * // => [2, 3]\n *\n * _.drop([1, 2, 3], 2);\n * // => [3]\n *\n * _.drop([1, 2, 3], 5);\n * // => []\n *\n * _.drop([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function drop(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n return baseSlice(array, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements dropped from the end.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to drop.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRight([1, 2, 3]);\n * // => [1, 2]\n *\n * _.dropRight([1, 2, 3], 2);\n * // => [1]\n *\n * _.dropRight([1, 2, 3], 5);\n * // => []\n *\n * _.dropRight([1, 2, 3], 0);\n * // => [1, 2, 3]\n */\n function dropRight(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n n = length - (+n || 0);\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the end.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * bound to `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that match the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropRightWhile([1, 2, 3], function(n) {\n * return n > 1;\n * });\n * // => [1]\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');\n * // => ['barney', 'fred']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.dropRightWhile(users, 'active', false), 'user');\n * // => ['barney']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.dropRightWhile(users, 'active'), 'user');\n * // => ['barney', 'fred', 'pebbles']\n */\n function dropRightWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3), true, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` excluding elements dropped from the beginning.\n * Elements are dropped until `predicate` returns falsey. The predicate is\n * bound to `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.dropWhile([1, 2, 3], function(n) {\n * return n < 3;\n * });\n * // => [3]\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user');\n * // => ['fred', 'pebbles']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.dropWhile(users, 'active', false), 'user');\n * // => ['pebbles']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.dropWhile(users, 'active'), 'user');\n * // => ['barney', 'fred', 'pebbles']\n */\n function dropWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3), true)\n : [];\n }\n\n /**\n * Fills elements of `array` with `value` from `start` up to, but not\n * including, `end`.\n *\n * **Note:** This method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to fill.\n * @param {*} value The value to fill `array` with.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _.fill(array, 'a');\n * console.log(array);\n * // => ['a', 'a', 'a']\n *\n * _.fill(Array(3), 2);\n * // => [2, 2, 2]\n *\n * _.fill([4, 6, 8], '*', 1, 2);\n * // => [4, '*', 8]\n */\n function fill(array, value, start, end) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (start && typeof start != 'number' && isIterateeCall(array, value, start)) {\n start = 0;\n end = length;\n }\n return baseFill(array, value, start, end);\n }\n\n /**\n * This method is like `_.find` except that it returns the index of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * _.findIndex(users, function(chr) {\n * return chr.user == 'barney';\n * });\n * // => 0\n *\n * // using the `_.matches` callback shorthand\n * _.findIndex(users, { 'user': 'fred', 'active': false });\n * // => 1\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findIndex(users, 'active', false);\n * // => 0\n *\n * // using the `_.property` callback shorthand\n * _.findIndex(users, 'active');\n * // => 2\n */\n var findIndex = createFindIndex();\n\n /**\n * This method is like `_.findIndex` except that it iterates over elements\n * of `collection` from right to left.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {number} Returns the index of the found element, else `-1`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * _.findLastIndex(users, function(chr) {\n * return chr.user == 'pebbles';\n * });\n * // => 2\n *\n * // using the `_.matches` callback shorthand\n * _.findLastIndex(users, { 'user': 'barney', 'active': true });\n * // => 0\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findLastIndex(users, 'active', false);\n * // => 2\n *\n * // using the `_.property` callback shorthand\n * _.findLastIndex(users, 'active');\n * // => 0\n */\n var findLastIndex = createFindIndex(true);\n\n /**\n * Gets the first element of `array`.\n *\n * @static\n * @memberOf _\n * @alias head\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the first element of `array`.\n * @example\n *\n * _.first([1, 2, 3]);\n * // => 1\n *\n * _.first([]);\n * // => undefined\n */\n function first(array) {\n return array ? array[0] : undefined;\n }\n\n /**\n * Flattens a nested array. If `isDeep` is `true` the array is recursively\n * flattened, otherwise it is only flattened a single level.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to flatten.\n * @param {boolean} [isDeep] Specify a deep flatten.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flatten([1, [2, 3, [4]]]);\n * // => [1, 2, 3, [4]]\n *\n * // using `isDeep`\n * _.flatten([1, [2, 3, [4]]], true);\n * // => [1, 2, 3, 4]\n */\n function flatten(array, isDeep, guard) {\n var length = array ? array.length : 0;\n if (guard && isIterateeCall(array, isDeep, guard)) {\n isDeep = false;\n }\n return length ? baseFlatten(array, isDeep) : [];\n }\n\n /**\n * Recursively flattens a nested array.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to recursively flatten.\n * @returns {Array} Returns the new flattened array.\n * @example\n *\n * _.flattenDeep([1, [2, 3, [4]]]);\n * // => [1, 2, 3, 4]\n */\n function flattenDeep(array) {\n var length = array ? array.length : 0;\n return length ? baseFlatten(array, true) : [];\n }\n\n /**\n * Gets the index at which the first occurrence of `value` is found in `array`\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it is used as the offset\n * from the end of `array`. If `array` is sorted providing `true` for `fromIndex`\n * performs a faster binary search.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {boolean|number} [fromIndex=0] The index to search from or `true`\n * to perform a binary search on a sorted array.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.indexOf([1, 2, 1, 2], 2);\n * // => 1\n *\n * // using `fromIndex`\n * _.indexOf([1, 2, 1, 2], 2, 2);\n * // => 3\n *\n * // performing a binary search\n * _.indexOf([1, 1, 2, 2], 2, true);\n * // => 2\n */\n function indexOf(array, value, fromIndex) {\n var length = array ? array.length : 0;\n if (!length) {\n return -1;\n }\n if (typeof fromIndex == 'number') {\n fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex;\n } else if (fromIndex) {\n var index = binaryIndex(array, value);\n if (index < length &&\n (value === value ? (value === array[index]) : (array[index] !== array[index]))) {\n return index;\n }\n return -1;\n }\n return baseIndexOf(array, value, fromIndex || 0);\n }\n\n /**\n * Gets all but the last element of `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.initial([1, 2, 3]);\n * // => [1, 2]\n */\n function initial(array) {\n return dropRight(array, 1);\n }\n\n /**\n * Creates an array of unique values that are included in all of the provided\n * arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of shared values.\n * @example\n * _.intersection([1, 2], [4, 2], [2, 1]);\n * // => [2]\n */\n var intersection = restParam(function(arrays) {\n var othLength = arrays.length,\n othIndex = othLength,\n caches = Array(length),\n indexOf = getIndexOf(),\n isCommon = indexOf == baseIndexOf,\n result = [];\n\n while (othIndex--) {\n var value = arrays[othIndex] = isArrayLike(value = arrays[othIndex]) ? value : [];\n caches[othIndex] = (isCommon && value.length >= 120) ? createCache(othIndex && value) : null;\n }\n var array = arrays[0],\n index = -1,\n length = array ? array.length : 0,\n seen = caches[0];\n\n outer:\n while (++index < length) {\n value = array[index];\n if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) {\n var othIndex = othLength;\n while (--othIndex) {\n var cache = caches[othIndex];\n if ((cache ? cacheIndexOf(cache, value) : indexOf(arrays[othIndex], value, 0)) < 0) {\n continue outer;\n }\n }\n if (seen) {\n seen.push(value);\n }\n result.push(value);\n }\n }\n return result;\n });\n\n /**\n * Gets the last element of `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @returns {*} Returns the last element of `array`.\n * @example\n *\n * _.last([1, 2, 3]);\n * // => 3\n */\n function last(array) {\n var length = array ? array.length : 0;\n return length ? array[length - 1] : undefined;\n }\n\n /**\n * This method is like `_.indexOf` except that it iterates over elements of\n * `array` from right to left.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to search.\n * @param {*} value The value to search for.\n * @param {boolean|number} [fromIndex=array.length-1] The index to search from\n * or `true` to perform a binary search on a sorted array.\n * @returns {number} Returns the index of the matched value, else `-1`.\n * @example\n *\n * _.lastIndexOf([1, 2, 1, 2], 2);\n * // => 3\n *\n * // using `fromIndex`\n * _.lastIndexOf([1, 2, 1, 2], 2, 2);\n * // => 1\n *\n * // performing a binary search\n * _.lastIndexOf([1, 1, 2, 2], 2, true);\n * // => 3\n */\n function lastIndexOf(array, value, fromIndex) {\n var length = array ? array.length : 0;\n if (!length) {\n return -1;\n }\n var index = length;\n if (typeof fromIndex == 'number') {\n index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1;\n } else if (fromIndex) {\n index = binaryIndex(array, value, true) - 1;\n var other = array[index];\n if (value === value ? (value === other) : (other !== other)) {\n return index;\n }\n return -1;\n }\n if (value !== value) {\n return indexOfNaN(array, index, true);\n }\n while (index--) {\n if (array[index] === value) {\n return index;\n }\n }\n return -1;\n }\n\n /**\n * Removes all provided values from `array` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * **Note:** Unlike `_.without`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...*} [values] The values to remove.\n * @returns {Array} Returns `array`.\n * @example\n *\n * var array = [1, 2, 3, 1, 2, 3];\n *\n * _.pull(array, 2, 3);\n * console.log(array);\n * // => [1, 1]\n */\n function pull() {\n var args = arguments,\n array = args[0];\n\n if (!(array && array.length)) {\n return array;\n }\n var index = 0,\n indexOf = getIndexOf(),\n length = args.length;\n\n while (++index < length) {\n var fromIndex = 0,\n value = args[index];\n\n while ((fromIndex = indexOf(array, value, fromIndex)) > -1) {\n splice.call(array, fromIndex, 1);\n }\n }\n return array;\n }\n\n /**\n * Removes elements from `array` corresponding to the given indexes and returns\n * an array of the removed elements. Indexes may be specified as an array of\n * indexes or as individual arguments.\n *\n * **Note:** Unlike `_.at`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to modify.\n * @param {...(number|number[])} [indexes] The indexes of elements to remove,\n * specified as individual indexes or arrays of indexes.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [5, 10, 15, 20];\n * var evens = _.pullAt(array, 1, 3);\n *\n * console.log(array);\n * // => [5, 15]\n *\n * console.log(evens);\n * // => [10, 20]\n */\n var pullAt = restParam(function(array, indexes) {\n indexes = baseFlatten(indexes);\n\n var result = baseAt(array, indexes);\n basePullAt(array, indexes.sort(baseCompareAscending));\n return result;\n });\n\n /**\n * Removes all elements from `array` that `predicate` returns truthy for\n * and returns an array of the removed elements. The predicate is bound to\n * `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * **Note:** Unlike `_.filter`, this method mutates `array`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to modify.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new array of removed elements.\n * @example\n *\n * var array = [1, 2, 3, 4];\n * var evens = _.remove(array, function(n) {\n * return n % 2 == 0;\n * });\n *\n * console.log(array);\n * // => [1, 3]\n *\n * console.log(evens);\n * // => [2, 4]\n */\n function remove(array, predicate, thisArg) {\n var result = [];\n if (!(array && array.length)) {\n return result;\n }\n var index = -1,\n indexes = [],\n length = array.length;\n\n predicate = getCallback(predicate, thisArg, 3);\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result.push(value);\n indexes.push(index);\n }\n }\n basePullAt(array, indexes);\n return result;\n }\n\n /**\n * Gets all but the first element of `array`.\n *\n * @static\n * @memberOf _\n * @alias tail\n * @category Array\n * @param {Array} array The array to query.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.rest([1, 2, 3]);\n * // => [2, 3]\n */\n function rest(array) {\n return drop(array, 1);\n }\n\n /**\n * Creates a slice of `array` from `start` up to, but not including, `end`.\n *\n * **Note:** This method is used instead of `Array#slice` to support node\n * lists in IE < 9 and to ensure dense arrays are returned.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to slice.\n * @param {number} [start=0] The start position.\n * @param {number} [end=array.length] The end position.\n * @returns {Array} Returns the slice of `array`.\n */\n function slice(array, start, end) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (end && typeof end != 'number' && isIterateeCall(array, start, end)) {\n start = 0;\n end = length;\n }\n return baseSlice(array, start, end);\n }\n\n /**\n * Uses a binary search to determine the lowest index at which `value` should\n * be inserted into `array` in order to maintain its sort order. If an iteratee\n * function is provided it is invoked for `value` and each element of `array`\n * to compute their sort ranking. The iteratee is bound to `thisArg` and\n * invoked with one argument; (value).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedIndex([30, 50], 40);\n * // => 1\n *\n * _.sortedIndex([4, 4, 5, 5], 5);\n * // => 2\n *\n * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } };\n *\n * // using an iteratee function\n * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) {\n * return this.data[word];\n * }, dict);\n * // => 1\n *\n * // using the `_.property` callback shorthand\n * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');\n * // => 1\n */\n var sortedIndex = createSortedIndex();\n\n /**\n * This method is like `_.sortedIndex` except that it returns the highest\n * index at which `value` should be inserted into `array` in order to\n * maintain its sort order.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The sorted array to inspect.\n * @param {*} value The value to evaluate.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {number} Returns the index at which `value` should be inserted\n * into `array`.\n * @example\n *\n * _.sortedLastIndex([4, 4, 5, 5], 5);\n * // => 4\n */\n var sortedLastIndex = createSortedIndex(true);\n\n /**\n * Creates a slice of `array` with `n` elements taken from the beginning.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.take([1, 2, 3]);\n * // => [1]\n *\n * _.take([1, 2, 3], 2);\n * // => [1, 2]\n *\n * _.take([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.take([1, 2, 3], 0);\n * // => []\n */\n function take(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n return baseSlice(array, 0, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with `n` elements taken from the end.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {number} [n=1] The number of elements to take.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRight([1, 2, 3]);\n * // => [3]\n *\n * _.takeRight([1, 2, 3], 2);\n * // => [2, 3]\n *\n * _.takeRight([1, 2, 3], 5);\n * // => [1, 2, 3]\n *\n * _.takeRight([1, 2, 3], 0);\n * // => []\n */\n function takeRight(array, n, guard) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (guard ? isIterateeCall(array, n, guard) : n == null) {\n n = 1;\n }\n n = length - (+n || 0);\n return baseSlice(array, n < 0 ? 0 : n);\n }\n\n /**\n * Creates a slice of `array` with elements taken from the end. Elements are\n * taken until `predicate` returns falsey. The predicate is bound to `thisArg`\n * and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeRightWhile([1, 2, 3], function(n) {\n * return n > 1;\n * });\n * // => [2, 3]\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false },\n * { 'user': 'pebbles', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user');\n * // => ['pebbles']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.takeRightWhile(users, 'active', false), 'user');\n * // => ['fred', 'pebbles']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.takeRightWhile(users, 'active'), 'user');\n * // => []\n */\n function takeRightWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3), false, true)\n : [];\n }\n\n /**\n * Creates a slice of `array` with elements taken from the beginning. Elements\n * are taken until `predicate` returns falsey. The predicate is bound to\n * `thisArg` and invoked with three arguments: (value, index, array).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to query.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the slice of `array`.\n * @example\n *\n * _.takeWhile([1, 2, 3], function(n) {\n * return n < 3;\n * });\n * // => [1, 2]\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false},\n * { 'user': 'pebbles', 'active': true }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.takeWhile(users, 'active', false), 'user');\n * // => ['barney', 'fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.takeWhile(users, 'active'), 'user');\n * // => []\n */\n function takeWhile(array, predicate, thisArg) {\n return (array && array.length)\n ? baseWhile(array, getCallback(predicate, thisArg, 3))\n : [];\n }\n\n /**\n * Creates an array of unique values, in order, from all of the provided arrays\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of combined values.\n * @example\n *\n * _.union([1, 2], [4, 2], [2, 1]);\n * // => [1, 2, 4]\n */\n var union = restParam(function(arrays) {\n return baseUniq(baseFlatten(arrays, false, true));\n });\n\n /**\n * Creates a duplicate-free version of an array, using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons, in which only the first occurence of each element\n * is kept. Providing `true` for `isSorted` performs a faster search algorithm\n * for sorted arrays. If an iteratee function is provided it is invoked for\n * each element in the array to generate the criterion by which uniqueness\n * is computed. The `iteratee` is bound to `thisArg` and invoked with three\n * arguments: (value, index, array).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias unique\n * @category Array\n * @param {Array} array The array to inspect.\n * @param {boolean} [isSorted] Specify the array is sorted.\n * @param {Function|Object|string} [iteratee] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new duplicate-value-free array.\n * @example\n *\n * _.uniq([2, 1, 2]);\n * // => [2, 1]\n *\n * // using `isSorted`\n * _.uniq([1, 1, 2], true);\n * // => [1, 2]\n *\n * // using an iteratee function\n * _.uniq([1, 2.5, 1.5, 2], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => [1, 2.5]\n *\n * // using the `_.property` callback shorthand\n * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');\n * // => [{ 'x': 1 }, { 'x': 2 }]\n */\n function uniq(array, isSorted, iteratee, thisArg) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n if (isSorted != null && typeof isSorted != 'boolean') {\n thisArg = iteratee;\n iteratee = isIterateeCall(array, isSorted, thisArg) ? undefined : isSorted;\n isSorted = false;\n }\n var callback = getCallback();\n if (!(iteratee == null && callback === baseCallback)) {\n iteratee = callback(iteratee, thisArg, 3);\n }\n return (isSorted && getIndexOf() == baseIndexOf)\n ? sortedUniq(array, iteratee)\n : baseUniq(array, iteratee);\n }\n\n /**\n * This method is like `_.zip` except that it accepts an array of grouped\n * elements and creates an array regrouping the elements to their pre-zip\n * configuration.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]);\n * // => [['fred', 30, true], ['barney', 40, false]]\n *\n * _.unzip(zipped);\n * // => [['fred', 'barney'], [30, 40], [true, false]]\n */\n function unzip(array) {\n if (!(array && array.length)) {\n return [];\n }\n var index = -1,\n length = 0;\n\n array = arrayFilter(array, function(group) {\n if (isArrayLike(group)) {\n length = nativeMax(group.length, length);\n return true;\n }\n });\n var result = Array(length);\n while (++index < length) {\n result[index] = arrayMap(array, baseProperty(index));\n }\n return result;\n }\n\n /**\n * This method is like `_.unzip` except that it accepts an iteratee to specify\n * how regrouped values should be combined. The `iteratee` is bound to `thisArg`\n * and invoked with four arguments: (accumulator, value, index, group).\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array of grouped elements to process.\n * @param {Function} [iteratee] The function to combine regrouped values.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new array of regrouped elements.\n * @example\n *\n * var zipped = _.zip([1, 2], [10, 20], [100, 200]);\n * // => [[1, 10, 100], [2, 20, 200]]\n *\n * _.unzipWith(zipped, _.add);\n * // => [3, 30, 300]\n */\n function unzipWith(array, iteratee, thisArg) {\n var length = array ? array.length : 0;\n if (!length) {\n return [];\n }\n var result = unzip(array);\n if (iteratee == null) {\n return result;\n }\n iteratee = bindCallback(iteratee, thisArg, 4);\n return arrayMap(result, function(group) {\n return arrayReduce(group, iteratee, undefined, true);\n });\n }\n\n /**\n * Creates an array excluding all provided values using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {Array} array The array to filter.\n * @param {...*} [values] The values to exclude.\n * @returns {Array} Returns the new array of filtered values.\n * @example\n *\n * _.without([1, 2, 1, 3], 1, 2);\n * // => [3]\n */\n var without = restParam(function(array, values) {\n return isArrayLike(array)\n ? baseDifference(array, values)\n : [];\n });\n\n /**\n * Creates an array of unique values that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference)\n * of the provided arrays.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to inspect.\n * @returns {Array} Returns the new array of values.\n * @example\n *\n * _.xor([1, 2], [4, 2]);\n * // => [1, 4]\n */\n function xor() {\n var index = -1,\n length = arguments.length;\n\n while (++index < length) {\n var array = arguments[index];\n if (isArrayLike(array)) {\n var result = result\n ? arrayPush(baseDifference(result, array), baseDifference(array, result))\n : array;\n }\n }\n return result ? baseUniq(result) : [];\n }\n\n /**\n * Creates an array of grouped elements, the first of which contains the first\n * elements of the given arrays, the second of which contains the second elements\n * of the given arrays, and so on.\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zip(['fred', 'barney'], [30, 40], [true, false]);\n * // => [['fred', 30, true], ['barney', 40, false]]\n */\n var zip = restParam(unzip);\n\n /**\n * The inverse of `_.pairs`; this method returns an object composed from arrays\n * of property names and values. Provide either a single two dimensional array,\n * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names\n * and one of corresponding values.\n *\n * @static\n * @memberOf _\n * @alias object\n * @category Array\n * @param {Array} props The property names.\n * @param {Array} [values=[]] The property values.\n * @returns {Object} Returns the new object.\n * @example\n *\n * _.zipObject([['fred', 30], ['barney', 40]]);\n * // => { 'fred': 30, 'barney': 40 }\n *\n * _.zipObject(['fred', 'barney'], [30, 40]);\n * // => { 'fred': 30, 'barney': 40 }\n */\n function zipObject(props, values) {\n var index = -1,\n length = props ? props.length : 0,\n result = {};\n\n if (length && !values && !isArray(props[0])) {\n values = [];\n }\n while (++index < length) {\n var key = props[index];\n if (values) {\n result[key] = values[index];\n } else if (key) {\n result[key[0]] = key[1];\n }\n }\n return result;\n }\n\n /**\n * This method is like `_.zip` except that it accepts an iteratee to specify\n * how grouped values should be combined. The `iteratee` is bound to `thisArg`\n * and invoked with four arguments: (accumulator, value, index, group).\n *\n * @static\n * @memberOf _\n * @category Array\n * @param {...Array} [arrays] The arrays to process.\n * @param {Function} [iteratee] The function to combine grouped values.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new array of grouped elements.\n * @example\n *\n * _.zipWith([1, 2], [10, 20], [100, 200], _.add);\n * // => [111, 222]\n */\n var zipWith = restParam(function(arrays) {\n var length = arrays.length,\n iteratee = length > 2 ? arrays[length - 2] : undefined,\n thisArg = length > 1 ? arrays[length - 1] : undefined;\n\n if (length > 2 && typeof iteratee == 'function') {\n length -= 2;\n } else {\n iteratee = (length > 1 && typeof thisArg == 'function') ? (--length, thisArg) : undefined;\n thisArg = undefined;\n }\n arrays.length = length;\n return unzipWith(arrays, iteratee, thisArg);\n });\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a `lodash` object that wraps `value` with explicit method\n * chaining enabled.\n *\n * @static\n * @memberOf _\n * @category Chain\n * @param {*} value The value to wrap.\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 },\n * { 'user': 'pebbles', 'age': 1 }\n * ];\n *\n * var youngest = _.chain(users)\n * .sortBy('age')\n * .map(function(chr) {\n * return chr.user + ' is ' + chr.age;\n * })\n * .first()\n * .value();\n * // => 'pebbles is 1'\n */\n function chain(value) {\n var result = lodash(value);\n result.__chain__ = true;\n return result;\n }\n\n /**\n * This method invokes `interceptor` and returns `value`. The interceptor is\n * bound to `thisArg` and invoked with one argument; (value). The purpose of\n * this method is to \"tap into\" a method chain in order to perform operations\n * on intermediate results within the chain.\n *\n * @static\n * @memberOf _\n * @category Chain\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @param {*} [thisArg] The `this` binding of `interceptor`.\n * @returns {*} Returns `value`.\n * @example\n *\n * _([1, 2, 3])\n * .tap(function(array) {\n * array.pop();\n * })\n * .reverse()\n * .value();\n * // => [2, 1]\n */\n function tap(value, interceptor, thisArg) {\n interceptor.call(thisArg, value);\n return value;\n }\n\n /**\n * This method is like `_.tap` except that it returns the result of `interceptor`.\n *\n * @static\n * @memberOf _\n * @category Chain\n * @param {*} value The value to provide to `interceptor`.\n * @param {Function} interceptor The function to invoke.\n * @param {*} [thisArg] The `this` binding of `interceptor`.\n * @returns {*} Returns the result of `interceptor`.\n * @example\n *\n * _(' abc ')\n * .chain()\n * .trim()\n * .thru(function(value) {\n * return [value];\n * })\n * .value();\n * // => ['abc']\n */\n function thru(value, interceptor, thisArg) {\n return interceptor.call(thisArg, value);\n }\n\n /**\n * Enables explicit method chaining on the wrapper object.\n *\n * @name chain\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * // without explicit chaining\n * _(users).first();\n * // => { 'user': 'barney', 'age': 36 }\n *\n * // with explicit chaining\n * _(users).chain()\n * .first()\n * .pick('user')\n * .value();\n * // => { 'user': 'barney' }\n */\n function wrapperChain() {\n return chain(this);\n }\n\n /**\n * Executes the chained sequence and returns the wrapped result.\n *\n * @name commit\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).push(3);\n *\n * console.log(array);\n * // => [1, 2]\n *\n * wrapped = wrapped.commit();\n * console.log(array);\n * // => [1, 2, 3]\n *\n * wrapped.last();\n * // => 3\n *\n * console.log(array);\n * // => [1, 2, 3]\n */\n function wrapperCommit() {\n return new LodashWrapper(this.value(), this.__chain__);\n }\n\n /**\n * Creates a new array joining a wrapped array with any additional arrays\n * and/or values.\n *\n * @name concat\n * @memberOf _\n * @category Chain\n * @param {...*} [values] The values to concatenate.\n * @returns {Array} Returns the new concatenated array.\n * @example\n *\n * var array = [1];\n * var wrapped = _(array).concat(2, [3], [[4]]);\n *\n * console.log(wrapped.value());\n * // => [1, 2, 3, [4]]\n *\n * console.log(array);\n * // => [1]\n */\n var wrapperConcat = restParam(function(values) {\n values = baseFlatten(values);\n return this.thru(function(array) {\n return arrayConcat(isArray(array) ? array : [toObject(array)], values);\n });\n });\n\n /**\n * Creates a clone of the chained sequence planting `value` as the wrapped value.\n *\n * @name plant\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2];\n * var wrapped = _(array).map(function(value) {\n * return Math.pow(value, 2);\n * });\n *\n * var other = [3, 4];\n * var otherWrapped = wrapped.plant(other);\n *\n * otherWrapped.value();\n * // => [9, 16]\n *\n * wrapped.value();\n * // => [1, 4]\n */\n function wrapperPlant(value) {\n var result,\n parent = this;\n\n while (parent instanceof baseLodash) {\n var clone = wrapperClone(parent);\n if (result) {\n previous.__wrapped__ = clone;\n } else {\n result = clone;\n }\n var previous = clone;\n parent = parent.__wrapped__;\n }\n previous.__wrapped__ = value;\n return result;\n }\n\n /**\n * Reverses the wrapped array so the first element becomes the last, the\n * second element becomes the second to last, and so on.\n *\n * **Note:** This method mutates the wrapped array.\n *\n * @name reverse\n * @memberOf _\n * @category Chain\n * @returns {Object} Returns the new reversed `lodash` wrapper instance.\n * @example\n *\n * var array = [1, 2, 3];\n *\n * _(array).reverse().value()\n * // => [3, 2, 1]\n *\n * console.log(array);\n * // => [3, 2, 1]\n */\n function wrapperReverse() {\n var value = this.__wrapped__;\n\n var interceptor = function(value) {\n return (wrapped && wrapped.__dir__ < 0) ? value : value.reverse();\n };\n if (value instanceof LazyWrapper) {\n var wrapped = value;\n if (this.__actions__.length) {\n wrapped = new LazyWrapper(this);\n }\n wrapped = wrapped.reverse();\n wrapped.__actions__.push({ 'func': thru, 'args': [interceptor], 'thisArg': undefined });\n return new LodashWrapper(wrapped, this.__chain__);\n }\n return this.thru(interceptor);\n }\n\n /**\n * Produces the result of coercing the unwrapped value to a string.\n *\n * @name toString\n * @memberOf _\n * @category Chain\n * @returns {string} Returns the coerced string value.\n * @example\n *\n * _([1, 2, 3]).toString();\n * // => '1,2,3'\n */\n function wrapperToString() {\n return (this.value() + '');\n }\n\n /**\n * Executes the chained sequence to extract the unwrapped value.\n *\n * @name value\n * @memberOf _\n * @alias run, toJSON, valueOf\n * @category Chain\n * @returns {*} Returns the resolved unwrapped value.\n * @example\n *\n * _([1, 2, 3]).value();\n * // => [1, 2, 3]\n */\n function wrapperValue() {\n return baseWrapperValue(this.__wrapped__, this.__actions__);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates an array of elements corresponding to the given keys, or indexes,\n * of `collection`. Keys may be specified as individual arguments or as arrays\n * of keys.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {...(number|number[]|string|string[])} [props] The property names\n * or indexes of elements to pick, specified individually or in arrays.\n * @returns {Array} Returns the new array of picked elements.\n * @example\n *\n * _.at(['a', 'b', 'c'], [0, 2]);\n * // => ['a', 'c']\n *\n * _.at(['barney', 'fred', 'pebbles'], 0, 2);\n * // => ['barney', 'pebbles']\n */\n var at = restParam(function(collection, props) {\n return baseAt(collection, baseFlatten(props));\n });\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through `iteratee`. The corresponding value\n * of each key is the number of times the key was returned by `iteratee`.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.countBy([4.3, 6.1, 6.4], function(n) {\n * return Math.floor(n);\n * });\n * // => { '4': 1, '6': 2 }\n *\n * _.countBy([4.3, 6.1, 6.4], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => { '4': 1, '6': 2 }\n *\n * _.countBy(['one', 'two', 'three'], 'length');\n * // => { '3': 2, '5': 1 }\n */\n var countBy = createAggregator(function(result, value, key) {\n hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1);\n });\n\n /**\n * Checks if `predicate` returns truthy for **all** elements of `collection`.\n * The predicate is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias all\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {boolean} Returns `true` if all elements pass the predicate check,\n * else `false`.\n * @example\n *\n * _.every([true, 1, null, 'yes'], Boolean);\n * // => false\n *\n * var users = [\n * { 'user': 'barney', 'active': false },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.every(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.every(users, 'active', false);\n * // => true\n *\n * // using the `_.property` callback shorthand\n * _.every(users, 'active');\n * // => false\n */\n function every(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayEvery : baseEvery;\n if (thisArg && isIterateeCall(collection, predicate, thisArg)) {\n predicate = undefined;\n }\n if (typeof predicate != 'function' || thisArg !== undefined) {\n predicate = getCallback(predicate, thisArg, 3);\n }\n return func(collection, predicate);\n }\n\n /**\n * Iterates over elements of `collection`, returning an array of all elements\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias select\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * _.filter([4, 5, 6], function(n) {\n * return n % 2 == 0;\n * });\n * // => [4, 6]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.filter(users, 'active', false), 'user');\n * // => ['fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.filter(users, 'active'), 'user');\n * // => ['barney']\n */\n function filter(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n predicate = getCallback(predicate, thisArg, 3);\n return func(collection, predicate);\n }\n\n /**\n * Iterates over elements of `collection`, returning the first element\n * `predicate` returns truthy for. The predicate is bound to `thisArg` and\n * invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias detect\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false },\n * { 'user': 'pebbles', 'age': 1, 'active': true }\n * ];\n *\n * _.result(_.find(users, function(chr) {\n * return chr.age < 40;\n * }), 'user');\n * // => 'barney'\n *\n * // using the `_.matches` callback shorthand\n * _.result(_.find(users, { 'age': 1, 'active': true }), 'user');\n * // => 'pebbles'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.result(_.find(users, 'active', false), 'user');\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.result(_.find(users, 'active'), 'user');\n * // => 'barney'\n */\n var find = createFind(baseEach);\n\n /**\n * This method is like `_.find` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * _.findLast([1, 2, 3, 4], function(n) {\n * return n % 2 == 1;\n * });\n * // => 3\n */\n var findLast = createFind(baseEachRight, true);\n\n /**\n * Performs a deep comparison between each element in `collection` and the\n * source object, returning the first element that has equivalent property\n * values.\n *\n * **Note:** This method supports comparing arrays, booleans, `Date` objects,\n * numbers, `Object` objects, regexes, and strings. Objects are compared by\n * their own, not inherited, enumerable properties. For comparing a single\n * own or inherited property value see `_.matchesProperty`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Object} source The object of property values to match.\n * @returns {*} Returns the matched element, else `undefined`.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': true },\n * { 'user': 'fred', 'age': 40, 'active': false }\n * ];\n *\n * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user');\n * // => 'barney'\n *\n * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user');\n * // => 'fred'\n */\n function findWhere(collection, source) {\n return find(collection, baseMatches(source));\n }\n\n /**\n * Iterates over elements of `collection` invoking `iteratee` for each element.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection). Iteratee functions may exit iteration early\n * by explicitly returning `false`.\n *\n * **Note:** As with other \"Collections\" methods, objects with a \"length\" property\n * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn`\n * may be used for object iteration.\n *\n * @static\n * @memberOf _\n * @alias each\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2]).forEach(function(n) {\n * console.log(n);\n * }).value();\n * // => logs each value from left to right and returns the array\n *\n * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) {\n * console.log(n, key);\n * });\n * // => logs each value-key pair and returns the object (iteration order is not guaranteed)\n */\n var forEach = createForEach(arrayEach, baseEach);\n\n /**\n * This method is like `_.forEach` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @alias eachRight\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array|Object|string} Returns `collection`.\n * @example\n *\n * _([1, 2]).forEachRight(function(n) {\n * console.log(n);\n * }).value();\n * // => logs each value from right to left and returns the array\n */\n var forEachRight = createForEach(arrayEachRight, baseEachRight);\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through `iteratee`. The corresponding value\n * of each key is an array of the elements responsible for generating the key.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * _.groupBy([4.2, 6.1, 6.4], function(n) {\n * return Math.floor(n);\n * });\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * _.groupBy([4.2, 6.1, 6.4], function(n) {\n * return this.floor(n);\n * }, Math);\n * // => { '4': [4.2], '6': [6.1, 6.4] }\n *\n * // using the `_.property` callback shorthand\n * _.groupBy(['one', 'two', 'three'], 'length');\n * // => { '3': ['one', 'two'], '5': ['three'] }\n */\n var groupBy = createAggregator(function(result, value, key) {\n if (hasOwnProperty.call(result, key)) {\n result[key].push(value);\n } else {\n result[key] = [value];\n }\n });\n\n /**\n * Checks if `value` is in `collection` using\n * [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero)\n * for equality comparisons. If `fromIndex` is negative, it is used as the offset\n * from the end of `collection`.\n *\n * @static\n * @memberOf _\n * @alias contains, include\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {*} target The value to search for.\n * @param {number} [fromIndex=0] The index to search from.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.\n * @returns {boolean} Returns `true` if a matching element is found, else `false`.\n * @example\n *\n * _.includes([1, 2, 3], 1);\n * // => true\n *\n * _.includes([1, 2, 3], 1, 2);\n * // => false\n *\n * _.includes({ 'user': 'fred', 'age': 40 }, 'fred');\n * // => true\n *\n * _.includes('pebbles', 'eb');\n * // => true\n */\n function includes(collection, target, fromIndex, guard) {\n var length = collection ? getLength(collection) : 0;\n if (!isLength(length)) {\n collection = values(collection);\n length = collection.length;\n }\n if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) {\n fromIndex = 0;\n } else {\n fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0);\n }\n return (typeof collection == 'string' || !isArray(collection) && isString(collection))\n ? (fromIndex <= length && collection.indexOf(target, fromIndex) > -1)\n : (!!length && getIndexOf(collection, target, fromIndex) > -1);\n }\n\n /**\n * Creates an object composed of keys generated from the results of running\n * each element of `collection` through `iteratee`. The corresponding value\n * of each key is the last element responsible for generating the key. The\n * iteratee function is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the composed aggregate object.\n * @example\n *\n * var keyData = [\n * { 'dir': 'left', 'code': 97 },\n * { 'dir': 'right', 'code': 100 }\n * ];\n *\n * _.indexBy(keyData, 'dir');\n * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }\n *\n * _.indexBy(keyData, function(object) {\n * return String.fromCharCode(object.code);\n * });\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n *\n * _.indexBy(keyData, function(object) {\n * return this.fromCharCode(object.code);\n * }, String);\n * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } }\n */\n var indexBy = createAggregator(function(result, value, key) {\n result[key] = value;\n });\n\n /**\n * Invokes the method at `path` of each element in `collection`, returning\n * an array of the results of each invoked method. Any additional arguments\n * are provided to each invoked method. If `methodName` is a function it is\n * invoked for, and `this` bound to, each element in `collection`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Array|Function|string} path The path of the method to invoke or\n * the function invoked per iteration.\n * @param {...*} [args] The arguments to invoke the method with.\n * @returns {Array} Returns the array of results.\n * @example\n *\n * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');\n * // => [[1, 5, 7], [1, 2, 3]]\n *\n * _.invoke([123, 456], String.prototype.split, '');\n * // => [['1', '2', '3'], ['4', '5', '6']]\n */\n var invoke = restParam(function(collection, path, args) {\n var index = -1,\n isFunc = typeof path == 'function',\n isProp = isKey(path),\n result = isArrayLike(collection) ? Array(collection.length) : [];\n\n baseEach(collection, function(value) {\n var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);\n result[++index] = func ? func.apply(value, args) : invokePath(value, path, args);\n });\n return result;\n });\n\n /**\n * Creates an array of values by running each element in `collection` through\n * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three\n * arguments: (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.\n *\n * The guarded methods are:\n * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`,\n * `drop`, `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`,\n * `parseInt`, `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`,\n * `trimLeft`, `trimRight`, `trunc`, `random`, `range`, `sample`, `some`,\n * `sum`, `uniq`, and `words`\n *\n * @static\n * @memberOf _\n * @alias collect\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new mapped array.\n * @example\n *\n * function timesThree(n) {\n * return n * 3;\n * }\n *\n * _.map([1, 2], timesThree);\n * // => [3, 6]\n *\n * _.map({ 'a': 1, 'b': 2 }, timesThree);\n * // => [3, 6] (iteration order is not guaranteed)\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * // using the `_.property` callback shorthand\n * _.map(users, 'user');\n * // => ['barney', 'fred']\n */\n function map(collection, iteratee, thisArg) {\n var func = isArray(collection) ? arrayMap : baseMap;\n iteratee = getCallback(iteratee, thisArg, 3);\n return func(collection, iteratee);\n }\n\n /**\n * Creates an array of elements split into two groups, the first of which\n * contains elements `predicate` returns truthy for, while the second of which\n * contains elements `predicate` returns falsey for. The predicate is bound\n * to `thisArg` and invoked with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the array of grouped elements.\n * @example\n *\n * _.partition([1, 2, 3], function(n) {\n * return n % 2;\n * });\n * // => [[1, 3], [2]]\n *\n * _.partition([1.2, 2.3, 3.4], function(n) {\n * return this.floor(n) % 2;\n * }, Math);\n * // => [[1.2, 3.4], [2.3]]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true },\n * { 'user': 'pebbles', 'age': 1, 'active': false }\n * ];\n *\n * var mapper = function(array) {\n * return _.pluck(array, 'user');\n * };\n *\n * // using the `_.matches` callback shorthand\n * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper);\n * // => [['pebbles'], ['barney', 'fred']]\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.map(_.partition(users, 'active', false), mapper);\n * // => [['barney', 'pebbles'], ['fred']]\n *\n * // using the `_.property` callback shorthand\n * _.map(_.partition(users, 'active'), mapper);\n * // => [['fred'], ['barney', 'pebbles']]\n */\n var partition = createAggregator(function(result, value, key) {\n result[key ? 0 : 1].push(value);\n }, function() { return [[], []]; });\n\n /**\n * Gets the property value of `path` from all elements in `collection`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Array|string} path The path of the property to pluck.\n * @returns {Array} Returns the property values.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 40 }\n * ];\n *\n * _.pluck(users, 'user');\n * // => ['barney', 'fred']\n *\n * var userIndex = _.indexBy(users, 'user');\n * _.pluck(userIndex, 'age');\n * // => [36, 40] (iteration order is not guaranteed)\n */\n function pluck(collection, path) {\n return map(collection, property(path));\n }\n\n /**\n * Reduces `collection` to a value which is the accumulated result of running\n * each element in `collection` through `iteratee`, where each successive\n * invocation is supplied the return value of the previous. If `accumulator`\n * is not provided the first element of `collection` is used as the initial\n * value. The `iteratee` is bound to `thisArg` and invoked with four arguments:\n * (accumulator, value, index|key, collection).\n *\n * Many lodash methods are guarded to work as iteratees for methods like\n * `_.reduce`, `_.reduceRight`, and `_.transform`.\n *\n * The guarded methods are:\n * `assign`, `defaults`, `defaultsDeep`, `includes`, `merge`, `sortByAll`,\n * and `sortByOrder`\n *\n * @static\n * @memberOf _\n * @alias foldl, inject\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.reduce([1, 2], function(total, n) {\n * return total + n;\n * });\n * // => 3\n *\n * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) {\n * result[key] = n * 3;\n * return result;\n * }, {});\n * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed)\n */\n var reduce = createReduce(arrayReduce, baseEach);\n\n /**\n * This method is like `_.reduce` except that it iterates over elements of\n * `collection` from right to left.\n *\n * @static\n * @memberOf _\n * @alias foldr\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The initial value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * var array = [[0, 1], [2, 3], [4, 5]];\n *\n * _.reduceRight(array, function(flattened, other) {\n * return flattened.concat(other);\n * }, []);\n * // => [4, 5, 2, 3, 0, 1]\n */\n var reduceRight = createReduce(arrayReduceRight, baseEachRight);\n\n /**\n * The opposite of `_.filter`; this method returns the elements of `collection`\n * that `predicate` does **not** return truthy for.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * _.reject([1, 2, 3, 4], function(n) {\n * return n % 2 == 0;\n * });\n * // => [1, 3]\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false },\n * { 'user': 'fred', 'age': 40, 'active': true }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user');\n * // => ['barney']\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.pluck(_.reject(users, 'active', false), 'user');\n * // => ['fred']\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.reject(users, 'active'), 'user');\n * // => ['barney']\n */\n function reject(collection, predicate, thisArg) {\n var func = isArray(collection) ? arrayFilter : baseFilter;\n predicate = getCallback(predicate, thisArg, 3);\n return func(collection, function(value, index, collection) {\n return !predicate(value, index, collection);\n });\n }\n\n /**\n * Gets a random element or `n` random elements from a collection.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to sample.\n * @param {number} [n] The number of elements to sample.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {*} Returns the random sample(s).\n * @example\n *\n * _.sample([1, 2, 3, 4]);\n * // => 2\n *\n * _.sample([1, 2, 3, 4], 2);\n * // => [3, 1]\n */\n function sample(collection, n, guard) {\n if (guard ? isIterateeCall(collection, n, guard) : n == null) {\n collection = toIterable(collection);\n var length = collection.length;\n return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;\n }\n var index = -1,\n result = toArray(collection),\n length = result.length,\n lastIndex = length - 1;\n\n n = nativeMin(n < 0 ? 0 : (+n || 0), length);\n while (++index < n) {\n var rand = baseRandom(index, lastIndex),\n value = result[rand];\n\n result[rand] = result[index];\n result[index] = value;\n }\n result.length = n;\n return result;\n }\n\n /**\n * Creates an array of shuffled values, using a version of the\n * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to shuffle.\n * @returns {Array} Returns the new shuffled array.\n * @example\n *\n * _.shuffle([1, 2, 3, 4]);\n * // => [4, 1, 3, 2]\n */\n function shuffle(collection) {\n return sample(collection, POSITIVE_INFINITY);\n }\n\n /**\n * Gets the size of `collection` by returning its length for array-like\n * values or the number of own enumerable properties for objects.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to inspect.\n * @returns {number} Returns the size of `collection`.\n * @example\n *\n * _.size([1, 2, 3]);\n * // => 3\n *\n * _.size({ 'a': 1, 'b': 2 });\n * // => 2\n *\n * _.size('pebbles');\n * // => 7\n */\n function size(collection) {\n var length = collection ? getLength(collection) : 0;\n return isLength(length) ? length : keys(collection).length;\n }\n\n /**\n * Checks if `predicate` returns truthy for **any** element of `collection`.\n * The function returns as soon as it finds a passing value and does not iterate\n * over the entire collection. The predicate is bound to `thisArg` and invoked\n * with three arguments: (value, index|key, collection).\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @alias any\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {boolean} Returns `true` if any element passes the predicate check,\n * else `false`.\n * @example\n *\n * _.some([null, 0, 'yes', false], Boolean);\n * // => true\n *\n * var users = [\n * { 'user': 'barney', 'active': true },\n * { 'user': 'fred', 'active': false }\n * ];\n *\n * // using the `_.matches` callback shorthand\n * _.some(users, { 'user': 'barney', 'active': false });\n * // => false\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.some(users, 'active', false);\n * // => true\n *\n * // using the `_.property` callback shorthand\n * _.some(users, 'active');\n * // => true\n */\n function some(collection, predicate, thisArg) {\n var func = isArray(collection) ? arraySome : baseSome;\n if (thisArg && isIterateeCall(collection, predicate, thisArg)) {\n predicate = undefined;\n }\n if (typeof predicate != 'function' || thisArg !== undefined) {\n predicate = getCallback(predicate, thisArg, 3);\n }\n return func(collection, predicate);\n }\n\n /**\n * Creates an array of elements, sorted in ascending order by the results of\n * running each element in a collection through `iteratee`. This method performs\n * a stable sort, that is, it preserves the original sort order of equal elements.\n * The `iteratee` is bound to `thisArg` and invoked with three arguments:\n * (value, index|key, collection).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * _.sortBy([1, 2, 3], function(n) {\n * return Math.sin(n);\n * });\n * // => [3, 1, 2]\n *\n * _.sortBy([1, 2, 3], function(n) {\n * return this.sin(n);\n * }, Math);\n * // => [3, 1, 2]\n *\n * var users = [\n * { 'user': 'fred' },\n * { 'user': 'pebbles' },\n * { 'user': 'barney' }\n * ];\n *\n * // using the `_.property` callback shorthand\n * _.pluck(_.sortBy(users, 'user'), 'user');\n * // => ['barney', 'fred', 'pebbles']\n */\n function sortBy(collection, iteratee, thisArg) {\n if (collection == null) {\n return [];\n }\n if (thisArg && isIterateeCall(collection, iteratee, thisArg)) {\n iteratee = undefined;\n }\n var index = -1;\n iteratee = getCallback(iteratee, thisArg, 3);\n\n var result = baseMap(collection, function(value, key, collection) {\n return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value };\n });\n return baseSortBy(result, compareAscending);\n }\n\n /**\n * This method is like `_.sortBy` except that it can sort by multiple iteratees\n * or property names.\n *\n * If a property name is provided for an iteratee the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If an object is provided for an iteratee the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees\n * The iteratees to sort by, specified as individual values or arrays of values.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 36 },\n * { 'user': 'fred', 'age': 42 },\n * { 'user': 'barney', 'age': 34 }\n * ];\n *\n * _.map(_.sortByAll(users, ['user', 'age']), _.values);\n * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]]\n *\n * _.map(_.sortByAll(users, 'user', function(chr) {\n * return Math.floor(chr.age / 10);\n * }), _.values);\n * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n */\n var sortByAll = restParam(function(collection, iteratees) {\n if (collection == null) {\n return [];\n }\n var guard = iteratees[2];\n if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) {\n iteratees.length = 1;\n }\n return baseSortByOrder(collection, baseFlatten(iteratees), []);\n });\n\n /**\n * This method is like `_.sortByAll` except that it allows specifying the\n * sort orders of the iteratees to sort by. If `orders` is unspecified, all\n * values are sorted in ascending order. Otherwise, a value is sorted in\n * ascending order if its corresponding order is \"asc\", and descending if \"desc\".\n *\n * If a property name is provided for an iteratee the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If an object is provided for an iteratee the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to iterate over.\n * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.\n * @param {boolean[]} [orders] The sort orders of `iteratees`.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`.\n * @returns {Array} Returns the new sorted array.\n * @example\n *\n * var users = [\n * { 'user': 'fred', 'age': 48 },\n * { 'user': 'barney', 'age': 34 },\n * { 'user': 'fred', 'age': 42 },\n * { 'user': 'barney', 'age': 36 }\n * ];\n *\n * // sort by `user` in ascending order and by `age` in descending order\n * _.map(_.sortByOrder(users, ['user', 'age'], ['asc', 'desc']), _.values);\n * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]]\n */\n function sortByOrder(collection, iteratees, orders, guard) {\n if (collection == null) {\n return [];\n }\n if (guard && isIterateeCall(iteratees, orders, guard)) {\n orders = undefined;\n }\n if (!isArray(iteratees)) {\n iteratees = iteratees == null ? [] : [iteratees];\n }\n if (!isArray(orders)) {\n orders = orders == null ? [] : [orders];\n }\n return baseSortByOrder(collection, iteratees, orders);\n }\n\n /**\n * Performs a deep comparison between each element in `collection` and the\n * source object, returning an array of all elements that have equivalent\n * property values.\n *\n * **Note:** This method supports comparing arrays, booleans, `Date` objects,\n * numbers, `Object` objects, regexes, and strings. Objects are compared by\n * their own, not inherited, enumerable properties. For comparing a single\n * own or inherited property value see `_.matchesProperty`.\n *\n * @static\n * @memberOf _\n * @category Collection\n * @param {Array|Object|string} collection The collection to search.\n * @param {Object} source The object of property values to match.\n * @returns {Array} Returns the new filtered array.\n * @example\n *\n * var users = [\n * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] },\n * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] }\n * ];\n *\n * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user');\n * // => ['barney']\n *\n * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user');\n * // => ['fred']\n */\n function where(collection, source) {\n return filter(collection, baseMatches(source));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Gets the number of milliseconds that have elapsed since the Unix epoch\n * (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @category Date\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => logs the number of milliseconds it took for the deferred function to be invoked\n */\n var now = nativeNow || function() {\n return new Date().getTime();\n };\n\n /*------------------------------------------------------------------------*/\n\n /**\n * The opposite of `_.before`; this method creates a function that invokes\n * `func` once it is called `n` or more times.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {number} n The number of calls before `func` is invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var saves = ['profile', 'settings'];\n *\n * var done = _.after(saves.length, function() {\n * console.log('done saving!');\n * });\n *\n * _.forEach(saves, function(type) {\n * asyncSave({ 'type': type, 'complete': done });\n * });\n * // => logs 'done saving!' after the two async saves have completed\n */\n function after(n, func) {\n if (typeof func != 'function') {\n if (typeof n == 'function') {\n var temp = n;\n n = func;\n func = temp;\n } else {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n }\n n = nativeIsFinite(n = +n) ? n : 0;\n return function() {\n if (--n < 1) {\n return func.apply(this, arguments);\n }\n };\n }\n\n /**\n * Creates a function that accepts up to `n` arguments ignoring any\n * additional arguments.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to cap arguments for.\n * @param {number} [n=func.length] The arity cap.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Function} Returns the new function.\n * @example\n *\n * _.map(['6', '8', '10'], _.ary(parseInt, 1));\n * // => [6, 8, 10]\n */\n function ary(func, n, guard) {\n if (guard && isIterateeCall(func, n, guard)) {\n n = undefined;\n }\n n = (func && n == null) ? func.length : nativeMax(+n || 0, 0);\n return createWrapper(func, ARY_FLAG, undefined, undefined, undefined, undefined, n);\n }\n\n /**\n * Creates a function that invokes `func`, with the `this` binding and arguments\n * of the created function, while it is called less than `n` times. Subsequent\n * calls to the created function return the result of the last `func` invocation.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {number} n The number of calls at which `func` is no longer invoked.\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * jQuery('#add').on('click', _.before(5, addContactToList));\n * // => allows adding up to 4 contacts to the list\n */\n function before(n, func) {\n var result;\n if (typeof func != 'function') {\n if (typeof n == 'function') {\n var temp = n;\n n = func;\n func = temp;\n } else {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n }\n return function() {\n if (--n > 0) {\n result = func.apply(this, arguments);\n }\n if (n <= 1) {\n func = undefined;\n }\n return result;\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of `thisArg`\n * and prepends any additional `_.bind` arguments to those provided to the\n * bound function.\n *\n * The `_.bind.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for partially applied arguments.\n *\n * **Note:** Unlike native `Function#bind` this method does not set the \"length\"\n * property of bound functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to bind.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var greet = function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * };\n *\n * var object = { 'user': 'fred' };\n *\n * var bound = _.bind(greet, object, 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * // using placeholders\n * var bound = _.bind(greet, object, _, '!');\n * bound('hi');\n * // => 'hi fred!'\n */\n var bind = restParam(function(func, thisArg, partials) {\n var bitmask = BIND_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, bind.placeholder);\n bitmask |= PARTIAL_FLAG;\n }\n return createWrapper(func, bitmask, thisArg, partials, holders);\n });\n\n /**\n * Binds methods of an object to the object itself, overwriting the existing\n * method. Method names may be specified as individual arguments or as arrays\n * of method names. If no method names are provided all enumerable function\n * properties, own and inherited, of `object` are bound.\n *\n * **Note:** This method does not set the \"length\" property of bound functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Object} object The object to bind and assign the bound methods to.\n * @param {...(string|string[])} [methodNames] The object method names to bind,\n * specified as individual method names or arrays of method names.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var view = {\n * 'label': 'docs',\n * 'onClick': function() {\n * console.log('clicked ' + this.label);\n * }\n * };\n *\n * _.bindAll(view);\n * jQuery('#docs').on('click', view.onClick);\n * // => logs 'clicked docs' when the element is clicked\n */\n var bindAll = restParam(function(object, methodNames) {\n methodNames = methodNames.length ? baseFlatten(methodNames) : functions(object);\n\n var index = -1,\n length = methodNames.length;\n\n while (++index < length) {\n var key = methodNames[index];\n object[key] = createWrapper(object[key], BIND_FLAG, object);\n }\n return object;\n });\n\n /**\n * Creates a function that invokes the method at `object[key]` and prepends\n * any additional `_.bindKey` arguments to those provided to the bound function.\n *\n * This method differs from `_.bind` by allowing bound functions to reference\n * methods that may be redefined or don't yet exist.\n * See [Peter Michaux's article](http://peter.michaux.ca/articles/lazy-function-definition-pattern)\n * for more details.\n *\n * The `_.bindKey.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Object} object The object the method belongs to.\n * @param {string} key The key of the method.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new bound function.\n * @example\n *\n * var object = {\n * 'user': 'fred',\n * 'greet': function(greeting, punctuation) {\n * return greeting + ' ' + this.user + punctuation;\n * }\n * };\n *\n * var bound = _.bindKey(object, 'greet', 'hi');\n * bound('!');\n * // => 'hi fred!'\n *\n * object.greet = function(greeting, punctuation) {\n * return greeting + 'ya ' + this.user + punctuation;\n * };\n *\n * bound('!');\n * // => 'hiya fred!'\n *\n * // using placeholders\n * var bound = _.bindKey(object, 'greet', _, '!');\n * bound('hi');\n * // => 'hiya fred!'\n */\n var bindKey = restParam(function(object, key, partials) {\n var bitmask = BIND_FLAG | BIND_KEY_FLAG;\n if (partials.length) {\n var holders = replaceHolders(partials, bindKey.placeholder);\n bitmask |= PARTIAL_FLAG;\n }\n return createWrapper(key, bitmask, object, partials, holders);\n });\n\n /**\n * Creates a function that accepts one or more arguments of `func` that when\n * called either invokes `func` returning its result, if all `func` arguments\n * have been provided, or returns a function that accepts one or more of the\n * remaining `func` arguments, and so on. The arity of `func` may be specified\n * if `func.length` is not sufficient.\n *\n * The `_.curry.placeholder` value, which defaults to `_` in monolithic builds,\n * may be used as a placeholder for provided arguments.\n *\n * **Note:** This method does not set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curry(abc);\n *\n * curried(1)(2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2)(3);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // using placeholders\n * curried(1)(_, 3)(2);\n * // => [1, 2, 3]\n */\n var curry = createCurry(CURRY_FLAG);\n\n /**\n * This method is like `_.curry` except that arguments are applied to `func`\n * in the manner of `_.partialRight` instead of `_.partial`.\n *\n * The `_.curryRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for provided arguments.\n *\n * **Note:** This method does not set the \"length\" property of curried functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to curry.\n * @param {number} [arity=func.length] The arity of `func`.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Function} Returns the new curried function.\n * @example\n *\n * var abc = function(a, b, c) {\n * return [a, b, c];\n * };\n *\n * var curried = _.curryRight(abc);\n *\n * curried(3)(2)(1);\n * // => [1, 2, 3]\n *\n * curried(2, 3)(1);\n * // => [1, 2, 3]\n *\n * curried(1, 2, 3);\n * // => [1, 2, 3]\n *\n * // using placeholders\n * curried(3)(1, _)(2);\n * // => [1, 2, 3]\n */\n var curryRight = createCurry(CURRY_RIGHT_FLAG);\n\n /**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed invocations. Provide an options object to indicate that `func`\n * should be invoked on the leading and/or trailing edge of the `wait` timeout.\n * Subsequent calls to the debounced function return the result of the last\n * `func` invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the debounced function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=false] Specify invoking on the leading\n * edge of the timeout.\n * @param {number} [options.maxWait] The maximum time `func` is allowed to be\n * delayed before it is invoked.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // avoid costly calculations while the window size is in flux\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // invoke `sendMail` when the click event is fired, debouncing subsequent calls\n * jQuery('#postbox').on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // ensure `batchLog` is invoked once after 1 second of debounced calls\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', _.debounce(batchLog, 250, {\n * 'maxWait': 1000\n * }));\n *\n * // cancel a debounced call\n * var todoChanges = _.debounce(batchLog, 1000);\n * Object.observe(models.todo, todoChanges);\n *\n * Object.observe(models, function(changes) {\n * if (_.find(changes, { 'user': 'todo', 'type': 'delete'})) {\n * todoChanges.cancel();\n * }\n * }, ['delete']);\n *\n * // ...at some point `models.todo` is changed\n * models.todo.completed = true;\n *\n * // ...before 1 second has passed `models.todo` is deleted\n * // which cancels the debounced `todoChanges` call\n * delete models.todo;\n */\n function debounce(func, wait, options) {\n var args,\n maxTimeoutId,\n result,\n stamp,\n thisArg,\n timeoutId,\n trailingCall,\n lastCalled = 0,\n maxWait = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = wait < 0 ? 0 : (+wait || 0);\n if (options === true) {\n var leading = true;\n trailing = false;\n } else if (isObject(options)) {\n leading = !!options.leading;\n maxWait = 'maxWait' in options && nativeMax(+options.maxWait || 0, wait);\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n if (maxTimeoutId) {\n clearTimeout(maxTimeoutId);\n }\n lastCalled = 0;\n maxTimeoutId = timeoutId = trailingCall = undefined;\n }\n\n function complete(isCalled, id) {\n if (id) {\n clearTimeout(id);\n }\n maxTimeoutId = timeoutId = trailingCall = undefined;\n if (isCalled) {\n lastCalled = now();\n result = func.apply(thisArg, args);\n if (!timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n }\n }\n\n function delayed() {\n var remaining = wait - (now() - stamp);\n if (remaining <= 0 || remaining > wait) {\n complete(trailingCall, maxTimeoutId);\n } else {\n timeoutId = setTimeout(delayed, remaining);\n }\n }\n\n function maxDelayed() {\n complete(trailing, timeoutId);\n }\n\n function debounced() {\n args = arguments;\n stamp = now();\n thisArg = this;\n trailingCall = trailing && (timeoutId || !leading);\n\n if (maxWait === false) {\n var leadingCall = leading && !timeoutId;\n } else {\n if (!maxTimeoutId && !leading) {\n lastCalled = stamp;\n }\n var remaining = maxWait - (stamp - lastCalled),\n isCalled = remaining <= 0 || remaining > maxWait;\n\n if (isCalled) {\n if (maxTimeoutId) {\n maxTimeoutId = clearTimeout(maxTimeoutId);\n }\n lastCalled = stamp;\n result = func.apply(thisArg, args);\n }\n else if (!maxTimeoutId) {\n maxTimeoutId = setTimeout(maxDelayed, remaining);\n }\n }\n if (isCalled && timeoutId) {\n timeoutId = clearTimeout(timeoutId);\n }\n else if (!timeoutId && wait !== maxWait) {\n timeoutId = setTimeout(delayed, wait);\n }\n if (leadingCall) {\n isCalled = true;\n result = func.apply(thisArg, args);\n }\n if (isCalled && !timeoutId && !maxTimeoutId) {\n args = thisArg = undefined;\n }\n return result;\n }\n debounced.cancel = cancel;\n return debounced;\n }\n\n /**\n * Defers invoking the `func` until the current call stack has cleared. Any\n * additional arguments are provided to `func` when it is invoked.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to defer.\n * @param {...*} [args] The arguments to invoke the function with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.defer(function(text) {\n * console.log(text);\n * }, 'deferred');\n * // logs 'deferred' after one or more milliseconds\n */\n var defer = restParam(function(func, args) {\n return baseDelay(func, 1, args);\n });\n\n /**\n * Invokes `func` after `wait` milliseconds. Any additional arguments are\n * provided to `func` when it is invoked.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to delay.\n * @param {number} wait The number of milliseconds to delay invocation.\n * @param {...*} [args] The arguments to invoke the function with.\n * @returns {number} Returns the timer id.\n * @example\n *\n * _.delay(function(text) {\n * console.log(text);\n * }, 1000, 'later');\n * // => logs 'later' after one second\n */\n var delay = restParam(function(func, wait, args) {\n return baseDelay(func, wait, args);\n });\n\n /**\n * Creates a function that returns the result of invoking the provided\n * functions with the `this` binding of the created function, where each\n * successive invocation is supplied the return value of the previous.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {...Function} [funcs] Functions to invoke.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flow(_.add, square);\n * addSquare(1, 2);\n * // => 9\n */\n var flow = createFlow();\n\n /**\n * This method is like `_.flow` except that it creates a function that\n * invokes the provided functions from right to left.\n *\n * @static\n * @memberOf _\n * @alias backflow, compose\n * @category Function\n * @param {...Function} [funcs] Functions to invoke.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var addSquare = _.flowRight(square, _.add);\n * addSquare(1, 2);\n * // => 9\n */\n var flowRight = createFlow(true);\n\n /**\n * Creates a function that memoizes the result of `func`. If `resolver` is\n * provided it determines the cache key for storing the result based on the\n * arguments provided to the memoized function. By default, the first argument\n * provided to the memoized function is coerced to a string and used as the\n * cache key. The `func` is invoked with the `this` binding of the memoized\n * function.\n *\n * **Note:** The cache is exposed as the `cache` property on the memoized\n * function. Its creation may be customized by replacing the `_.memoize.Cache`\n * constructor with one whose instances implement the [`Map`](http://ecma-international.org/ecma-262/6.0/#sec-properties-of-the-map-prototype-object)\n * method interface of `get`, `has`, and `set`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to have its output memoized.\n * @param {Function} [resolver] The function to resolve the cache key.\n * @returns {Function} Returns the new memoizing function.\n * @example\n *\n * var upperCase = _.memoize(function(string) {\n * return string.toUpperCase();\n * });\n *\n * upperCase('fred');\n * // => 'FRED'\n *\n * // modifying the result cache\n * upperCase.cache.set('fred', 'BARNEY');\n * upperCase('fred');\n * // => 'BARNEY'\n *\n * // replacing `_.memoize.Cache`\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'barney' };\n * var identity = _.memoize(_.identity);\n *\n * identity(object);\n * // => { 'user': 'fred' }\n * identity(other);\n * // => { 'user': 'fred' }\n *\n * _.memoize.Cache = WeakMap;\n * var identity = _.memoize(_.identity);\n *\n * identity(object);\n * // => { 'user': 'fred' }\n * identity(other);\n * // => { 'user': 'barney' }\n */\n function memoize(func, resolver) {\n if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var memoized = function() {\n var args = arguments,\n key = resolver ? resolver.apply(this, args) : args[0],\n cache = memoized.cache;\n\n if (cache.has(key)) {\n return cache.get(key);\n }\n var result = func.apply(this, args);\n memoized.cache = cache.set(key, result);\n return result;\n };\n memoized.cache = new memoize.Cache;\n return memoized;\n }\n\n /**\n * Creates a function that runs each argument through a corresponding\n * transform function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to wrap.\n * @param {...(Function|Function[])} [transforms] The functions to transform\n * arguments, specified as individual functions or arrays of functions.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function doubled(n) {\n * return n * 2;\n * }\n *\n * function square(n) {\n * return n * n;\n * }\n *\n * var modded = _.modArgs(function(x, y) {\n * return [x, y];\n * }, square, doubled);\n *\n * modded(1, 2);\n * // => [1, 4]\n *\n * modded(5, 10);\n * // => [25, 20]\n */\n var modArgs = restParam(function(func, transforms) {\n transforms = baseFlatten(transforms);\n if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n var length = transforms.length;\n return restParam(function(args) {\n var index = nativeMin(args.length, length);\n while (index--) {\n args[index] = transforms[index](args[index]);\n }\n return func.apply(this, args);\n });\n });\n\n /**\n * Creates a function that negates the result of the predicate `func`. The\n * `func` predicate is invoked with the `this` binding and arguments of the\n * created function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} predicate The predicate to negate.\n * @returns {Function} Returns the new function.\n * @example\n *\n * function isEven(n) {\n * return n % 2 == 0;\n * }\n *\n * _.filter([1, 2, 3, 4, 5, 6], _.negate(isEven));\n * // => [1, 3, 5]\n */\n function negate(predicate) {\n if (typeof predicate != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function() {\n return !predicate.apply(this, arguments);\n };\n }\n\n /**\n * Creates a function that is restricted to invoking `func` once. Repeat calls\n * to the function return the value of the first call. The `func` is invoked\n * with the `this` binding and arguments of the created function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to restrict.\n * @returns {Function} Returns the new restricted function.\n * @example\n *\n * var initialize = _.once(createApplication);\n * initialize();\n * initialize();\n * // `initialize` invokes `createApplication` once\n */\n function once(func) {\n return before(2, func);\n }\n\n /**\n * Creates a function that invokes `func` with `partial` arguments prepended\n * to those provided to the new function. This method is like `_.bind` except\n * it does **not** alter the `this` binding.\n *\n * The `_.partial.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method does not set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * var greet = function(greeting, name) {\n * return greeting + ' ' + name;\n * };\n *\n * var sayHelloTo = _.partial(greet, 'hello');\n * sayHelloTo('fred');\n * // => 'hello fred'\n *\n * // using placeholders\n * var greetFred = _.partial(greet, _, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n */\n var partial = createPartial(PARTIAL_FLAG);\n\n /**\n * This method is like `_.partial` except that partially applied arguments\n * are appended to those provided to the new function.\n *\n * The `_.partialRight.placeholder` value, which defaults to `_` in monolithic\n * builds, may be used as a placeholder for partially applied arguments.\n *\n * **Note:** This method does not set the \"length\" property of partially\n * applied functions.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to partially apply arguments to.\n * @param {...*} [partials] The arguments to be partially applied.\n * @returns {Function} Returns the new partially applied function.\n * @example\n *\n * var greet = function(greeting, name) {\n * return greeting + ' ' + name;\n * };\n *\n * var greetFred = _.partialRight(greet, 'fred');\n * greetFred('hi');\n * // => 'hi fred'\n *\n * // using placeholders\n * var sayHelloTo = _.partialRight(greet, 'hello', _);\n * sayHelloTo('fred');\n * // => 'hello fred'\n */\n var partialRight = createPartial(PARTIAL_RIGHT_FLAG);\n\n /**\n * Creates a function that invokes `func` with arguments arranged according\n * to the specified indexes where the argument value at the first index is\n * provided as the first argument, the argument value at the second index is\n * provided as the second argument, and so on.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to rearrange arguments for.\n * @param {...(number|number[])} indexes The arranged argument indexes,\n * specified as individual indexes or arrays of indexes.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var rearged = _.rearg(function(a, b, c) {\n * return [a, b, c];\n * }, 2, 0, 1);\n *\n * rearged('b', 'c', 'a')\n * // => ['a', 'b', 'c']\n *\n * var map = _.rearg(_.map, [1, 0]);\n * map(function(n) {\n * return n * 3;\n * }, [1, 2, 3]);\n * // => [3, 6, 9]\n */\n var rearg = restParam(function(func, indexes) {\n return createWrapper(func, REARG_FLAG, undefined, undefined, undefined, baseFlatten(indexes));\n });\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the\n * created function and arguments from `start` and beyond provided as an array.\n *\n * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.restParam(function(what, names) {\n * return what + ' ' + _.initial(names).join(', ') +\n * (_.size(names) > 1 ? ', & ' : '') + _.last(names);\n * });\n *\n * say('hello', 'fred', 'barney', 'pebbles');\n * // => 'hello fred, barney, & pebbles'\n */\n function restParam(func, start) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n rest = Array(length);\n\n while (++index < length) {\n rest[index] = args[start + index];\n }\n switch (start) {\n case 0: return func.call(this, rest);\n case 1: return func.call(this, args[0], rest);\n case 2: return func.call(this, args[0], args[1], rest);\n }\n var otherArgs = Array(start + 1);\n index = -1;\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = rest;\n return func.apply(this, otherArgs);\n };\n }\n\n /**\n * Creates a function that invokes `func` with the `this` binding of the created\n * function and an array of arguments much like [`Function#apply`](https://es5.github.io/#x15.3.4.3).\n *\n * **Note:** This method is based on the [spread operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator).\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to spread arguments over.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var say = _.spread(function(who, what) {\n * return who + ' says ' + what;\n * });\n *\n * say(['fred', 'hello']);\n * // => 'fred says hello'\n *\n * // with a Promise\n * var numbers = Promise.all([\n * Promise.resolve(40),\n * Promise.resolve(36)\n * ]);\n *\n * numbers.then(_.spread(function(x, y) {\n * return x + y;\n * }));\n * // => a Promise of 76\n */\n function spread(func) {\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n return function(array) {\n return func.apply(this, array);\n };\n }\n\n /**\n * Creates a throttled function that only invokes `func` at most once per\n * every `wait` milliseconds. The throttled function comes with a `cancel`\n * method to cancel delayed invocations. Provide an options object to indicate\n * that `func` should be invoked on the leading and/or trailing edge of the\n * `wait` timeout. Subsequent calls to the throttled function return the\n * result of the last `func` call.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked\n * on the trailing edge of the timeout only if the the throttled function is\n * invoked more than once during the `wait` timeout.\n *\n * See [David Corbacho's article](http://drupalmotion.com/article/debounce-and-throttle-visual-explanation)\n * for details over the differences between `_.throttle` and `_.debounce`.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {Function} func The function to throttle.\n * @param {number} [wait=0] The number of milliseconds to throttle invocations to.\n * @param {Object} [options] The options object.\n * @param {boolean} [options.leading=true] Specify invoking on the leading\n * edge of the timeout.\n * @param {boolean} [options.trailing=true] Specify invoking on the trailing\n * edge of the timeout.\n * @returns {Function} Returns the new throttled function.\n * @example\n *\n * // avoid excessively updating the position while scrolling\n * jQuery(window).on('scroll', _.throttle(updatePosition, 100));\n *\n * // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes\n * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {\n * 'trailing': false\n * }));\n *\n * // cancel a trailing throttled call\n * jQuery(window).on('popstate', throttled.cancel);\n */\n function throttle(func, wait, options) {\n var leading = true,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n if (options === false) {\n leading = false;\n } else if (isObject(options)) {\n leading = 'leading' in options ? !!options.leading : leading;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n return debounce(func, wait, { 'leading': leading, 'maxWait': +wait, 'trailing': trailing });\n }\n\n /**\n * Creates a function that provides `value` to the wrapper function as its\n * first argument. Any additional arguments provided to the function are\n * appended to those provided to the wrapper function. The wrapper is invoked\n * with the `this` binding of the created function.\n *\n * @static\n * @memberOf _\n * @category Function\n * @param {*} value The value to wrap.\n * @param {Function} wrapper The wrapper function.\n * @returns {Function} Returns the new function.\n * @example\n *\n * var p = _.wrap(_.escape, function(func, text) {\n * return '

' + func(text) + '

';\n * });\n *\n * p('fred, barney, & pebbles');\n * // => '

fred, barney, & pebbles

'\n */\n function wrap(value, wrapper) {\n wrapper = wrapper == null ? identity : wrapper;\n return createWrapper(wrapper, PARTIAL_FLAG, undefined, [value], []);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Creates a clone of `value`. If `isDeep` is `true` nested objects are cloned,\n * otherwise they are assigned by reference. If `customizer` is provided it is\n * invoked to produce the cloned values. If `customizer` returns `undefined`\n * cloning is handled by the method instead. The `customizer` is bound to\n * `thisArg` and invoked with two argument; (value [, index|key, object]).\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).\n * The enumerable properties of `arguments` objects and objects created by\n * constructors other than `Object` are cloned to plain `Object` objects. An\n * empty object is returned for uncloneable values such as functions, DOM nodes,\n * Maps, Sets, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {*} Returns the cloned value.\n * @example\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * var shallow = _.clone(users);\n * shallow[0] === users[0];\n * // => true\n *\n * var deep = _.clone(users, true);\n * deep[0] === users[0];\n * // => false\n *\n * // using a customizer callback\n * var el = _.clone(document.body, function(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(false);\n * }\n * });\n *\n * el === document.body\n * // => false\n * el.nodeName\n * // => BODY\n * el.childNodes.length;\n * // => 0\n */\n function clone(value, isDeep, customizer, thisArg) {\n if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) {\n isDeep = false;\n }\n else if (typeof isDeep == 'function') {\n thisArg = customizer;\n customizer = isDeep;\n isDeep = false;\n }\n return typeof customizer == 'function'\n ? baseClone(value, isDeep, bindCallback(customizer, thisArg, 1))\n : baseClone(value, isDeep);\n }\n\n /**\n * Creates a deep clone of `value`. If `customizer` is provided it is invoked\n * to produce the cloned values. If `customizer` returns `undefined` cloning\n * is handled by the method instead. The `customizer` is bound to `thisArg`\n * and invoked with two argument; (value [, index|key, object]).\n *\n * **Note:** This method is loosely based on the\n * [structured clone algorithm](http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm).\n * The enumerable properties of `arguments` objects and objects created by\n * constructors other than `Object` are cloned to plain `Object` objects. An\n * empty object is returned for uncloneable values such as functions, DOM nodes,\n * Maps, Sets, and WeakMaps.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to deep clone.\n * @param {Function} [customizer] The function to customize cloning values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {*} Returns the deep cloned value.\n * @example\n *\n * var users = [\n * { 'user': 'barney' },\n * { 'user': 'fred' }\n * ];\n *\n * var deep = _.cloneDeep(users);\n * deep[0] === users[0];\n * // => false\n *\n * // using a customizer callback\n * var el = _.cloneDeep(document.body, function(value) {\n * if (_.isElement(value)) {\n * return value.cloneNode(true);\n * }\n * });\n *\n * el === document.body\n * // => false\n * el.nodeName\n * // => BODY\n * el.childNodes.length;\n * // => 20\n */\n function cloneDeep(value, customizer, thisArg) {\n return typeof customizer == 'function'\n ? baseClone(value, true, bindCallback(customizer, thisArg, 1))\n : baseClone(value, true);\n }\n\n /**\n * Checks if `value` is greater than `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`.\n * @example\n *\n * _.gt(3, 1);\n * // => true\n *\n * _.gt(3, 3);\n * // => false\n *\n * _.gt(1, 3);\n * // => false\n */\n function gt(value, other) {\n return value > other;\n }\n\n /**\n * Checks if `value` is greater than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`.\n * @example\n *\n * _.gte(3, 1);\n * // => true\n *\n * _.gte(3, 3);\n * // => true\n *\n * _.gte(1, 3);\n * // => false\n */\n function gte(value, other) {\n return value >= other;\n }\n\n /**\n * Checks if `value` is classified as an `arguments` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\n function isArguments(value) {\n return isObjectLike(value) && isArrayLike(value) &&\n hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee');\n }\n\n /**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(function() { return arguments; }());\n * // => false\n */\n var isArray = nativeIsArray || function(value) {\n return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag;\n };\n\n /**\n * Checks if `value` is classified as a boolean primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isBoolean(false);\n * // => true\n *\n * _.isBoolean(null);\n * // => false\n */\n function isBoolean(value) {\n return value === true || value === false || (isObjectLike(value) && objToString.call(value) == boolTag);\n }\n\n /**\n * Checks if `value` is classified as a `Date` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isDate(new Date);\n * // => true\n *\n * _.isDate('Mon April 23 2012');\n * // => false\n */\n function isDate(value) {\n return isObjectLike(value) && objToString.call(value) == dateTag;\n }\n\n /**\n * Checks if `value` is a DOM element.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`.\n * @example\n *\n * _.isElement(document.body);\n * // => true\n *\n * _.isElement('');\n * // => false\n */\n function isElement(value) {\n return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value);\n }\n\n /**\n * Checks if `value` is empty. A value is considered empty unless it is an\n * `arguments` object, array, string, or jQuery-like collection with a length\n * greater than `0` or an object with own enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {Array|Object|string} value The value to inspect.\n * @returns {boolean} Returns `true` if `value` is empty, else `false`.\n * @example\n *\n * _.isEmpty(null);\n * // => true\n *\n * _.isEmpty(true);\n * // => true\n *\n * _.isEmpty(1);\n * // => true\n *\n * _.isEmpty([1, 2, 3]);\n * // => false\n *\n * _.isEmpty({ 'a': 1 });\n * // => false\n */\n function isEmpty(value) {\n if (value == null) {\n return true;\n }\n if (isArrayLike(value) && (isArray(value) || isString(value) || isArguments(value) ||\n (isObjectLike(value) && isFunction(value.splice)))) {\n return !value.length;\n }\n return !keys(value).length;\n }\n\n /**\n * Performs a deep comparison between two values to determine if they are\n * equivalent. If `customizer` is provided it is invoked to compare values.\n * If `customizer` returns `undefined` comparisons are handled by the method\n * instead. The `customizer` is bound to `thisArg` and invoked with three\n * arguments: (value, other [, index|key]).\n *\n * **Note:** This method supports comparing arrays, booleans, `Date` objects,\n * numbers, `Object` objects, regexes, and strings. Objects are compared by\n * their own, not inherited, enumerable properties. Functions and DOM nodes\n * are **not** supported. Provide a customizer function to extend support\n * for comparing other values.\n *\n * @static\n * @memberOf _\n * @alias eq\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @param {Function} [customizer] The function to customize value comparisons.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'user': 'fred' };\n * var other = { 'user': 'fred' };\n *\n * object == other;\n * // => false\n *\n * _.isEqual(object, other);\n * // => true\n *\n * // using a customizer callback\n * var array = ['hello', 'goodbye'];\n * var other = ['hi', 'goodbye'];\n *\n * _.isEqual(array, other, function(value, other) {\n * if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) {\n * return true;\n * }\n * });\n * // => true\n */\n function isEqual(value, other, customizer, thisArg) {\n customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;\n var result = customizer ? customizer(value, other) : undefined;\n return result === undefined ? baseIsEqual(value, other, customizer) : !!result;\n }\n\n /**\n * Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`,\n * `SyntaxError`, `TypeError`, or `URIError` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an error object, else `false`.\n * @example\n *\n * _.isError(new Error);\n * // => true\n *\n * _.isError(Error);\n * // => false\n */\n function isError(value) {\n return isObjectLike(value) && typeof value.message == 'string' && objToString.call(value) == errorTag;\n }\n\n /**\n * Checks if `value` is a finite primitive number.\n *\n * **Note:** This method is based on [`Number.isFinite`](http://ecma-international.org/ecma-262/6.0/#sec-number.isfinite).\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.\n * @example\n *\n * _.isFinite(10);\n * // => true\n *\n * _.isFinite('10');\n * // => false\n *\n * _.isFinite(true);\n * // => false\n *\n * _.isFinite(Object(10));\n * // => false\n *\n * _.isFinite(Infinity);\n * // => false\n */\n function isFinite(value) {\n return typeof value == 'number' && nativeIsFinite(value);\n }\n\n /**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\n function isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in older versions of Chrome and Safari which return 'function' for regexes\n // and Safari 8 equivalents which return 'object' for typed array constructors.\n return isObject(value) && objToString.call(value) == funcTag;\n }\n\n /**\n * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.\n * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(1);\n * // => false\n */\n function isObject(value) {\n // Avoid a V8 JIT bug in Chrome 19-20.\n // See https://code.google.com/p/v8/issues/detail?id=2291 for more details.\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n }\n\n /**\n * Performs a deep comparison between `object` and `source` to determine if\n * `object` contains equivalent property values. If `customizer` is provided\n * it is invoked to compare values. If `customizer` returns `undefined`\n * comparisons are handled by the method instead. The `customizer` is bound\n * to `thisArg` and invoked with three arguments: (value, other, index|key).\n *\n * **Note:** This method supports comparing properties of arrays, booleans,\n * `Date` objects, numbers, `Object` objects, regexes, and strings. Functions\n * and DOM nodes are **not** supported. Provide a customizer function to extend\n * support for comparing other values.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {Object} object The object to inspect.\n * @param {Object} source The object of property values to match.\n * @param {Function} [customizer] The function to customize value comparisons.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {boolean} Returns `true` if `object` is a match, else `false`.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.isMatch(object, { 'age': 40 });\n * // => true\n *\n * _.isMatch(object, { 'age': 36 });\n * // => false\n *\n * // using a customizer callback\n * var object = { 'greeting': 'hello' };\n * var source = { 'greeting': 'hi' };\n *\n * _.isMatch(object, source, function(value, other) {\n * return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined;\n * });\n * // => true\n */\n function isMatch(object, source, customizer, thisArg) {\n customizer = typeof customizer == 'function' ? bindCallback(customizer, thisArg, 3) : undefined;\n return baseIsMatch(object, getMatchData(source), customizer);\n }\n\n /**\n * Checks if `value` is `NaN`.\n *\n * **Note:** This method is not the same as [`isNaN`](https://es5.github.io/#x15.1.2.4)\n * which returns `true` for `undefined` and other non-numeric values.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.\n * @example\n *\n * _.isNaN(NaN);\n * // => true\n *\n * _.isNaN(new Number(NaN));\n * // => true\n *\n * isNaN(undefined);\n * // => true\n *\n * _.isNaN(undefined);\n * // => false\n */\n function isNaN(value) {\n // An `NaN` primitive is the only value that is not equal to itself.\n // Perform the `toStringTag` check first to avoid errors with some host objects in IE.\n return isNumber(value) && value != +value;\n }\n\n /**\n * Checks if `value` is a native function.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function, else `false`.\n * @example\n *\n * _.isNative(Array.prototype.push);\n * // => true\n *\n * _.isNative(_);\n * // => false\n */\n function isNative(value) {\n if (value == null) {\n return false;\n }\n if (isFunction(value)) {\n return reIsNative.test(fnToString.call(value));\n }\n return isObjectLike(value) && reIsHostCtor.test(value);\n }\n\n /**\n * Checks if `value` is `null`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `null`, else `false`.\n * @example\n *\n * _.isNull(null);\n * // => true\n *\n * _.isNull(void 0);\n * // => false\n */\n function isNull(value) {\n return value === null;\n }\n\n /**\n * Checks if `value` is classified as a `Number` primitive or object.\n *\n * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified\n * as numbers, use the `_.isFinite` method.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isNumber(8.4);\n * // => true\n *\n * _.isNumber(NaN);\n * // => true\n *\n * _.isNumber('8.4');\n * // => false\n */\n function isNumber(value) {\n return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag);\n }\n\n /**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * **Note:** This method assumes objects created by the `Object` constructor\n * have no inherited enumerable properties.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\n function isPlainObject(value) {\n var Ctor;\n\n // Exit early for non `Object` objects.\n if (!(isObjectLike(value) && objToString.call(value) == objectTag && !isArguments(value)) ||\n (!hasOwnProperty.call(value, 'constructor') && (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) {\n return false;\n }\n // IE < 9 iterates inherited properties before own properties. If the first\n // iterated property is an object's own property then there are no inherited\n // enumerable properties.\n var result;\n // In most environments an object's own properties are iterated before\n // its inherited properties. If the last iterated property is an object's\n // own property then there are no inherited enumerable properties.\n baseForIn(value, function(subValue, key) {\n result = key;\n });\n return result === undefined || hasOwnProperty.call(value, result);\n }\n\n /**\n * Checks if `value` is classified as a `RegExp` object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isRegExp(/abc/);\n * // => true\n *\n * _.isRegExp('/abc/');\n * // => false\n */\n function isRegExp(value) {\n return isObject(value) && objToString.call(value) == regexpTag;\n }\n\n /**\n * Checks if `value` is classified as a `String` primitive or object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isString('abc');\n * // => true\n *\n * _.isString(1);\n * // => false\n */\n function isString(value) {\n return typeof value == 'string' || (isObjectLike(value) && objToString.call(value) == stringTag);\n }\n\n /**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\n function isTypedArray(value) {\n return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)];\n }\n\n /**\n * Checks if `value` is `undefined`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`.\n * @example\n *\n * _.isUndefined(void 0);\n * // => true\n *\n * _.isUndefined(null);\n * // => false\n */\n function isUndefined(value) {\n return value === undefined;\n }\n\n /**\n * Checks if `value` is less than `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`.\n * @example\n *\n * _.lt(1, 3);\n * // => true\n *\n * _.lt(3, 3);\n * // => false\n *\n * _.lt(3, 1);\n * // => false\n */\n function lt(value, other) {\n return value < other;\n }\n\n /**\n * Checks if `value` is less than or equal to `other`.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`.\n * @example\n *\n * _.lte(1, 3);\n * // => true\n *\n * _.lte(3, 3);\n * // => true\n *\n * _.lte(3, 1);\n * // => false\n */\n function lte(value, other) {\n return value <= other;\n }\n\n /**\n * Converts `value` to an array.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Array} Returns the converted array.\n * @example\n *\n * (function() {\n * return _.toArray(arguments).slice(1);\n * }(1, 2, 3));\n * // => [2, 3]\n */\n function toArray(value) {\n var length = value ? getLength(value) : 0;\n if (!isLength(length)) {\n return values(value);\n }\n if (!length) {\n return [];\n }\n return arrayCopy(value);\n }\n\n /**\n * Converts `value` to a plain object flattening inherited enumerable\n * properties of `value` to own properties of the plain object.\n *\n * @static\n * @memberOf _\n * @category Lang\n * @param {*} value The value to convert.\n * @returns {Object} Returns the converted plain object.\n * @example\n *\n * function Foo() {\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.assign({ 'a': 1 }, new Foo);\n * // => { 'a': 1, 'b': 2 }\n *\n * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));\n * // => { 'a': 1, 'b': 2, 'c': 3 }\n */\n function toPlainObject(value) {\n return baseCopy(value, keysIn(value));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Recursively merges own enumerable properties of the source object(s), that\n * don't resolve to `undefined` into the destination object. Subsequent sources\n * overwrite property assignments of previous sources. If `customizer` is\n * provided it is invoked to produce the merged values of the destination and\n * source properties. If `customizer` returns `undefined` merging is handled\n * by the method instead. The `customizer` is bound to `thisArg` and invoked\n * with five arguments: (objectValue, sourceValue, key, object, source).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var users = {\n * 'data': [{ 'user': 'barney' }, { 'user': 'fred' }]\n * };\n *\n * var ages = {\n * 'data': [{ 'age': 36 }, { 'age': 40 }]\n * };\n *\n * _.merge(users, ages);\n * // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }\n *\n * // using a customizer callback\n * var object = {\n * 'fruits': ['apple'],\n * 'vegetables': ['beet']\n * };\n *\n * var other = {\n * 'fruits': ['banana'],\n * 'vegetables': ['carrot']\n * };\n *\n * _.merge(object, other, function(a, b) {\n * if (_.isArray(a)) {\n * return a.concat(b);\n * }\n * });\n * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }\n */\n var merge = createAssigner(baseMerge);\n\n /**\n * Assigns own enumerable properties of source object(s) to the destination\n * object. Subsequent sources overwrite property assignments of previous sources.\n * If `customizer` is provided it is invoked to produce the assigned values.\n * The `customizer` is bound to `thisArg` and invoked with five arguments:\n * (objectValue, sourceValue, key, object, source).\n *\n * **Note:** This method mutates `object` and is based on\n * [`Object.assign`](http://ecma-international.org/ecma-262/6.0/#sec-object.assign).\n *\n * @static\n * @memberOf _\n * @alias extend\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @param {*} [thisArg] The `this` binding of `customizer`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });\n * // => { 'user': 'fred', 'age': 40 }\n *\n * // using a customizer callback\n * var defaults = _.partialRight(_.assign, function(value, other) {\n * return _.isUndefined(value) ? other : value;\n * });\n *\n * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n * // => { 'user': 'barney', 'age': 36 }\n */\n var assign = createAssigner(function(object, source, customizer) {\n return customizer\n ? assignWith(object, source, customizer)\n : baseAssign(object, source);\n });\n\n /**\n * Creates an object that inherits from the given `prototype` object. If a\n * `properties` object is provided its own enumerable properties are assigned\n * to the created object.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} prototype The object to inherit from.\n * @param {Object} [properties] The properties to assign to the object.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * function Shape() {\n * this.x = 0;\n * this.y = 0;\n * }\n *\n * function Circle() {\n * Shape.call(this);\n * }\n *\n * Circle.prototype = _.create(Shape.prototype, {\n * 'constructor': Circle\n * });\n *\n * var circle = new Circle;\n * circle instanceof Circle;\n * // => true\n *\n * circle instanceof Shape;\n * // => true\n */\n function create(prototype, properties, guard) {\n var result = baseCreate(prototype);\n if (guard && isIterateeCall(prototype, properties, guard)) {\n properties = undefined;\n }\n return properties ? baseAssign(result, properties) : result;\n }\n\n /**\n * Assigns own enumerable properties of source object(s) to the destination\n * object for all destination properties that resolve to `undefined`. Once a\n * property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });\n * // => { 'user': 'barney', 'age': 36 }\n */\n var defaults = createDefaults(assign, assignDefaults);\n\n /**\n * This method is like `_.defaults` except that it recursively assigns\n * default properties.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @example\n *\n * _.defaultsDeep({ 'user': { 'name': 'barney' } }, { 'user': { 'name': 'fred', 'age': 36 } });\n * // => { 'user': { 'name': 'barney', 'age': 36 } }\n *\n */\n var defaultsDeep = createDefaults(merge, mergeDefaults);\n\n /**\n * This method is like `_.find` except that it returns the key of the first\n * element `predicate` returns truthy for instead of the element itself.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {string|undefined} Returns the key of the matched element, else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findKey(users, function(chr) {\n * return chr.age < 40;\n * });\n * // => 'barney' (iteration order is not guaranteed)\n *\n * // using the `_.matches` callback shorthand\n * _.findKey(users, { 'age': 1, 'active': true });\n * // => 'pebbles'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findKey(users, 'active', false);\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.findKey(users, 'active');\n * // => 'barney'\n */\n var findKey = createFindKey(baseForOwn);\n\n /**\n * This method is like `_.findKey` except that it iterates over elements of\n * a collection in the opposite order.\n *\n * If a property name is provided for `predicate` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `predicate` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to search.\n * @param {Function|Object|string} [predicate=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {string|undefined} Returns the key of the matched element, else `undefined`.\n * @example\n *\n * var users = {\n * 'barney': { 'age': 36, 'active': true },\n * 'fred': { 'age': 40, 'active': false },\n * 'pebbles': { 'age': 1, 'active': true }\n * };\n *\n * _.findLastKey(users, function(chr) {\n * return chr.age < 40;\n * });\n * // => returns `pebbles` assuming `_.findKey` returns `barney`\n *\n * // using the `_.matches` callback shorthand\n * _.findLastKey(users, { 'age': 36, 'active': true });\n * // => 'barney'\n *\n * // using the `_.matchesProperty` callback shorthand\n * _.findLastKey(users, 'active', false);\n * // => 'fred'\n *\n * // using the `_.property` callback shorthand\n * _.findLastKey(users, 'active');\n * // => 'pebbles'\n */\n var findLastKey = createFindKey(baseForOwnRight);\n\n /**\n * Iterates over own and inherited enumerable properties of an object invoking\n * `iteratee` for each property. The `iteratee` is bound to `thisArg` and invoked\n * with three arguments: (value, key, object). Iteratee functions may exit\n * iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forIn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'a', 'b', and 'c' (iteration order is not guaranteed)\n */\n var forIn = createForIn(baseFor);\n\n /**\n * This method is like `_.forIn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forInRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'c', 'b', and 'a' assuming `_.forIn ` logs 'a', 'b', and 'c'\n */\n var forInRight = createForIn(baseForRight);\n\n /**\n * Iterates over own enumerable properties of an object invoking `iteratee`\n * for each property. The `iteratee` is bound to `thisArg` and invoked with\n * three arguments: (value, key, object). Iteratee functions may exit iteration\n * early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwn(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'a' and 'b' (iteration order is not guaranteed)\n */\n var forOwn = createForOwn(baseForOwn);\n\n /**\n * This method is like `_.forOwn` except that it iterates over properties of\n * `object` in the opposite order.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns `object`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.forOwnRight(new Foo, function(value, key) {\n * console.log(key);\n * });\n * // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b'\n */\n var forOwnRight = createForOwn(baseForOwnRight);\n\n /**\n * Creates an array of function property names from all enumerable properties,\n * own and inherited, of `object`.\n *\n * @static\n * @memberOf _\n * @alias methods\n * @category Object\n * @param {Object} object The object to inspect.\n * @returns {Array} Returns the new array of property names.\n * @example\n *\n * _.functions(_);\n * // => ['after', 'ary', 'assign', ...]\n */\n function functions(object) {\n return baseFunctions(object, keysIn(object));\n }\n\n /**\n * Gets the property value at `path` of `object`. If the resolved value is\n * `undefined` the `defaultValue` is used in its place.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to get.\n * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.get(object, 'a[0].b.c');\n * // => 3\n *\n * _.get(object, ['a', '0', 'b', 'c']);\n * // => 3\n *\n * _.get(object, 'a.b.c', 'default');\n * // => 'default'\n */\n function get(object, path, defaultValue) {\n var result = object == null ? undefined : baseGet(object, toPath(path), path + '');\n return result === undefined ? defaultValue : result;\n }\n\n /**\n * Checks if `path` is a direct property.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path to check.\n * @returns {boolean} Returns `true` if `path` is a direct property, else `false`.\n * @example\n *\n * var object = { 'a': { 'b': { 'c': 3 } } };\n *\n * _.has(object, 'a');\n * // => true\n *\n * _.has(object, 'a.b.c');\n * // => true\n *\n * _.has(object, ['a', 'b', 'c']);\n * // => true\n */\n function has(object, path) {\n if (object == null) {\n return false;\n }\n var result = hasOwnProperty.call(object, path);\n if (!result && !isKey(path)) {\n path = toPath(path);\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n if (object == null) {\n return false;\n }\n path = last(path);\n result = hasOwnProperty.call(object, path);\n }\n return result || (isLength(object.length) && isIndex(path, object.length) &&\n (isArray(object) || isArguments(object)));\n }\n\n /**\n * Creates an object composed of the inverted keys and values of `object`.\n * If `object` contains duplicate values, subsequent values overwrite property\n * assignments of previous values unless `multiValue` is `true`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to invert.\n * @param {boolean} [multiValue] Allow multiple values per key.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {Object} Returns the new inverted object.\n * @example\n *\n * var object = { 'a': 1, 'b': 2, 'c': 1 };\n *\n * _.invert(object);\n * // => { '1': 'c', '2': 'b' }\n *\n * // with `multiValue`\n * _.invert(object, true);\n * // => { '1': ['a', 'c'], '2': ['b'] }\n */\n function invert(object, multiValue, guard) {\n if (guard && isIterateeCall(object, multiValue, guard)) {\n multiValue = undefined;\n }\n var index = -1,\n props = keys(object),\n length = props.length,\n result = {};\n\n while (++index < length) {\n var key = props[index],\n value = object[key];\n\n if (multiValue) {\n if (hasOwnProperty.call(result, value)) {\n result[value].push(key);\n } else {\n result[value] = [key];\n }\n }\n else {\n result[value] = key;\n }\n }\n return result;\n }\n\n /**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/6.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\n var keys = !nativeKeys ? shimKeys : function(object) {\n var Ctor = object == null ? undefined : object.constructor;\n if ((typeof Ctor == 'function' && Ctor.prototype === object) ||\n (typeof object != 'function' && isArrayLike(object))) {\n return shimKeys(object);\n }\n return isObject(object) ? nativeKeys(object) : [];\n };\n\n /**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\n function keysIn(object) {\n if (object == null) {\n return [];\n }\n if (!isObject(object)) {\n object = Object(object);\n }\n var length = object.length;\n length = (length && isLength(length) &&\n (isArray(object) || isArguments(object)) && length) || 0;\n\n var Ctor = object.constructor,\n index = -1,\n isProto = typeof Ctor == 'function' && Ctor.prototype === object,\n result = Array(length),\n skipIndexes = length > 0;\n\n while (++index < length) {\n result[index] = (index + '');\n }\n for (var key in object) {\n if (!(skipIndexes && isIndex(key, length)) &&\n !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n }\n\n /**\n * The opposite of `_.mapValues`; this method creates an object with the\n * same values as `object` and keys generated by running each own enumerable\n * property of `object` through `iteratee`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the new mapped object.\n * @example\n *\n * _.mapKeys({ 'a': 1, 'b': 2 }, function(value, key) {\n * return key + value;\n * });\n * // => { 'a1': 1, 'b2': 2 }\n */\n var mapKeys = createObjectMapper(true);\n\n /**\n * Creates an object with the same keys as `object` and values generated by\n * running each own enumerable property of `object` through `iteratee`. The\n * iteratee function is bound to `thisArg` and invoked with three arguments:\n * (value, key, object).\n *\n * If a property name is provided for `iteratee` the created `_.property`\n * style callback returns the property value of the given element.\n *\n * If a value is also provided for `thisArg` the created `_.matchesProperty`\n * style callback returns `true` for elements that have a matching property\n * value, else `false`.\n *\n * If an object is provided for `iteratee` the created `_.matches` style\n * callback returns `true` for elements that have the properties of the given\n * object, else `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to iterate over.\n * @param {Function|Object|string} [iteratee=_.identity] The function invoked\n * per iteration.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {Object} Returns the new mapped object.\n * @example\n *\n * _.mapValues({ 'a': 1, 'b': 2 }, function(n) {\n * return n * 3;\n * });\n * // => { 'a': 3, 'b': 6 }\n *\n * var users = {\n * 'fred': { 'user': 'fred', 'age': 40 },\n * 'pebbles': { 'user': 'pebbles', 'age': 1 }\n * };\n *\n * // using the `_.property` callback shorthand\n * _.mapValues(users, 'age');\n * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed)\n */\n var mapValues = createObjectMapper();\n\n /**\n * The opposite of `_.pick`; this method creates an object composed of the\n * own and inherited enumerable properties of `object` that are not omitted.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {Function|...(string|string[])} [predicate] The function invoked per\n * iteration or property names to omit, specified as individual property\n * names or arrays of property names.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.omit(object, 'age');\n * // => { 'user': 'fred' }\n *\n * _.omit(object, _.isNumber);\n * // => { 'user': 'fred' }\n */\n var omit = restParam(function(object, props) {\n if (object == null) {\n return {};\n }\n if (typeof props[0] != 'function') {\n var props = arrayMap(baseFlatten(props), String);\n return pickByArray(object, baseDifference(keysIn(object), props));\n }\n var predicate = bindCallback(props[0], props[1], 3);\n return pickByCallback(object, function(value, key, object) {\n return !predicate(value, key, object);\n });\n });\n\n /**\n * Creates a two dimensional array of the key-value pairs for `object`,\n * e.g. `[[key1, value1], [key2, value2]]`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the new array of key-value pairs.\n * @example\n *\n * _.pairs({ 'barney': 36, 'fred': 40 });\n * // => [['barney', 36], ['fred', 40]] (iteration order is not guaranteed)\n */\n function pairs(object) {\n object = toObject(object);\n\n var index = -1,\n props = keys(object),\n length = props.length,\n result = Array(length);\n\n while (++index < length) {\n var key = props[index];\n result[index] = [key, object[key]];\n }\n return result;\n }\n\n /**\n * Creates an object composed of the picked `object` properties. Property\n * names may be specified as individual arguments or as arrays of property\n * names. If `predicate` is provided it is invoked for each property of `object`\n * picking the properties `predicate` returns truthy for. The predicate is\n * bound to `thisArg` and invoked with three arguments: (value, key, object).\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The source object.\n * @param {Function|...(string|string[])} [predicate] The function invoked per\n * iteration or property names to pick, specified as individual property\n * names or arrays of property names.\n * @param {*} [thisArg] The `this` binding of `predicate`.\n * @returns {Object} Returns the new object.\n * @example\n *\n * var object = { 'user': 'fred', 'age': 40 };\n *\n * _.pick(object, 'user');\n * // => { 'user': 'fred' }\n *\n * _.pick(object, _.isString);\n * // => { 'user': 'fred' }\n */\n var pick = restParam(function(object, props) {\n if (object == null) {\n return {};\n }\n return typeof props[0] == 'function'\n ? pickByCallback(object, bindCallback(props[0], props[1], 3))\n : pickByArray(object, baseFlatten(props));\n });\n\n /**\n * This method is like `_.get` except that if the resolved value is a function\n * it is invoked with the `this` binding of its parent object and its result\n * is returned.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @param {Array|string} path The path of the property to resolve.\n * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.\n * @returns {*} Returns the resolved value.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c1': 3, 'c2': _.constant(4) } }] };\n *\n * _.result(object, 'a[0].b.c1');\n * // => 3\n *\n * _.result(object, 'a[0].b.c2');\n * // => 4\n *\n * _.result(object, 'a.b.c', 'default');\n * // => 'default'\n *\n * _.result(object, 'a.b.c', _.constant('default'));\n * // => 'default'\n */\n function result(object, path, defaultValue) {\n var result = object == null ? undefined : object[path];\n if (result === undefined) {\n if (object != null && !isKey(path, object)) {\n path = toPath(path);\n object = path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));\n result = object == null ? undefined : object[last(path)];\n }\n result = result === undefined ? defaultValue : result;\n }\n return isFunction(result) ? result.call(object) : result;\n }\n\n /**\n * Sets the property value of `path` on `object`. If a portion of `path`\n * does not exist it is created.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to augment.\n * @param {Array|string} path The path of the property to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns `object`.\n * @example\n *\n * var object = { 'a': [{ 'b': { 'c': 3 } }] };\n *\n * _.set(object, 'a[0].b.c', 4);\n * console.log(object.a[0].b.c);\n * // => 4\n *\n * _.set(object, 'x[0].y.z', 5);\n * console.log(object.x[0].y.z);\n * // => 5\n */\n function set(object, path, value) {\n if (object == null) {\n return object;\n }\n var pathKey = (path + '');\n path = (object[pathKey] != null || isKey(path, object)) ? [pathKey] : toPath(path);\n\n var index = -1,\n length = path.length,\n lastIndex = length - 1,\n nested = object;\n\n while (nested != null && ++index < length) {\n var key = path[index];\n if (isObject(nested)) {\n if (index == lastIndex) {\n nested[key] = value;\n } else if (nested[key] == null) {\n nested[key] = isIndex(path[index + 1]) ? [] : {};\n }\n }\n nested = nested[key];\n }\n return object;\n }\n\n /**\n * An alternative to `_.reduce`; this method transforms `object` to a new\n * `accumulator` object which is the result of running each of its own enumerable\n * properties through `iteratee`, with each invocation potentially mutating\n * the `accumulator` object. The `iteratee` is bound to `thisArg` and invoked\n * with four arguments: (accumulator, value, key, object). Iteratee functions\n * may exit iteration early by explicitly returning `false`.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Array|Object} object The object to iterate over.\n * @param {Function} [iteratee=_.identity] The function invoked per iteration.\n * @param {*} [accumulator] The custom accumulator value.\n * @param {*} [thisArg] The `this` binding of `iteratee`.\n * @returns {*} Returns the accumulated value.\n * @example\n *\n * _.transform([2, 3, 4], function(result, n) {\n * result.push(n *= n);\n * return n % 2 == 0;\n * });\n * // => [4, 9]\n *\n * _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) {\n * result[key] = n * 3;\n * });\n * // => { 'a': 3, 'b': 6 }\n */\n function transform(object, iteratee, accumulator, thisArg) {\n var isArr = isArray(object) || isTypedArray(object);\n iteratee = getCallback(iteratee, thisArg, 4);\n\n if (accumulator == null) {\n if (isArr || isObject(object)) {\n var Ctor = object.constructor;\n if (isArr) {\n accumulator = isArray(object) ? new Ctor : [];\n } else {\n accumulator = baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);\n }\n } else {\n accumulator = {};\n }\n }\n (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) {\n return iteratee(accumulator, value, index, object);\n });\n return accumulator;\n }\n\n /**\n * Creates an array of the own enumerable property values of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.values(new Foo);\n * // => [1, 2] (iteration order is not guaranteed)\n *\n * _.values('hi');\n * // => ['h', 'i']\n */\n function values(object) {\n return baseValues(object, keys(object));\n }\n\n /**\n * Creates an array of the own and inherited enumerable property values\n * of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property values.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.valuesIn(new Foo);\n * // => [1, 2, 3] (iteration order is not guaranteed)\n */\n function valuesIn(object) {\n return baseValues(object, keysIn(object));\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Checks if `n` is between `start` and up to but not including, `end`. If\n * `end` is not specified it is set to `start` with `start` then set to `0`.\n *\n * @static\n * @memberOf _\n * @category Number\n * @param {number} n The number to check.\n * @param {number} [start=0] The start of the range.\n * @param {number} end The end of the range.\n * @returns {boolean} Returns `true` if `n` is in the range, else `false`.\n * @example\n *\n * _.inRange(3, 2, 4);\n * // => true\n *\n * _.inRange(4, 8);\n * // => true\n *\n * _.inRange(4, 2);\n * // => false\n *\n * _.inRange(2, 2);\n * // => false\n *\n * _.inRange(1.2, 2);\n * // => true\n *\n * _.inRange(5.2, 4);\n * // => false\n */\n function inRange(value, start, end) {\n start = +start || 0;\n if (end === undefined) {\n end = start;\n start = 0;\n } else {\n end = +end || 0;\n }\n return value >= nativeMin(start, end) && value < nativeMax(start, end);\n }\n\n /**\n * Produces a random number between `min` and `max` (inclusive). If only one\n * argument is provided a number between `0` and the given number is returned.\n * If `floating` is `true`, or either `min` or `max` are floats, a floating-point\n * number is returned instead of an integer.\n *\n * @static\n * @memberOf _\n * @category Number\n * @param {number} [min=0] The minimum possible value.\n * @param {number} [max=1] The maximum possible value.\n * @param {boolean} [floating] Specify returning a floating-point number.\n * @returns {number} Returns the random number.\n * @example\n *\n * _.random(0, 5);\n * // => an integer between 0 and 5\n *\n * _.random(5);\n * // => also an integer between 0 and 5\n *\n * _.random(5, true);\n * // => a floating-point number between 0 and 5\n *\n * _.random(1.2, 5.2);\n * // => a floating-point number between 1.2 and 5.2\n */\n function random(min, max, floating) {\n if (floating && isIterateeCall(min, max, floating)) {\n max = floating = undefined;\n }\n var noMin = min == null,\n noMax = max == null;\n\n if (floating == null) {\n if (noMax && typeof min == 'boolean') {\n floating = min;\n min = 1;\n }\n else if (typeof max == 'boolean') {\n floating = max;\n noMax = true;\n }\n }\n if (noMin && noMax) {\n max = 1;\n noMax = false;\n }\n min = +min || 0;\n if (noMax) {\n max = min;\n min = 0;\n } else {\n max = +max || 0;\n }\n if (floating || min % 1 || max % 1) {\n var rand = nativeRandom();\n return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max);\n }\n return baseRandom(min, max);\n }\n\n /*------------------------------------------------------------------------*/\n\n /**\n * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the camel cased string.\n * @example\n *\n * _.camelCase('Foo Bar');\n * // => 'fooBar'\n *\n * _.camelCase('--foo-bar');\n * // => 'fooBar'\n *\n * _.camelCase('__foo_bar__');\n * // => 'fooBar'\n */\n var camelCase = createCompounder(function(result, word, index) {\n word = word.toLowerCase();\n return result + (index ? (word.charAt(0).toUpperCase() + word.slice(1)) : word);\n });\n\n /**\n * Capitalizes the first character of `string`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to capitalize.\n * @returns {string} Returns the capitalized string.\n * @example\n *\n * _.capitalize('fred');\n * // => 'Fred'\n */\n function capitalize(string) {\n string = baseToString(string);\n return string && (string.charAt(0).toUpperCase() + string.slice(1));\n }\n\n /**\n * Deburrs `string` by converting [latin-1 supplementary letters](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)\n * to basic latin letters and removing [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to deburr.\n * @returns {string} Returns the deburred string.\n * @example\n *\n * _.deburr('déjà vu');\n * // => 'deja vu'\n */\n function deburr(string) {\n string = baseToString(string);\n return string && string.replace(reLatin1, deburrLetter).replace(reComboMark, '');\n }\n\n /**\n * Checks if `string` ends with the given target string.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to search.\n * @param {string} [target] The string to search for.\n * @param {number} [position=string.length] The position to search from.\n * @returns {boolean} Returns `true` if `string` ends with `target`, else `false`.\n * @example\n *\n * _.endsWith('abc', 'c');\n * // => true\n *\n * _.endsWith('abc', 'b');\n * // => false\n *\n * _.endsWith('abc', 'b', 2);\n * // => true\n */\n function endsWith(string, target, position) {\n string = baseToString(string);\n target = (target + '');\n\n var length = string.length;\n position = position === undefined\n ? length\n : nativeMin(position < 0 ? 0 : (+position || 0), length);\n\n position -= target.length;\n return position >= 0 && string.indexOf(target, position) == position;\n }\n\n /**\n * Converts the characters \"&\", \"<\", \">\", '\"', \"'\", and \"\\`\", in `string` to\n * their corresponding HTML entities.\n *\n * **Note:** No other characters are escaped. To escape additional characters\n * use a third-party library like [_he_](https://mths.be/he).\n *\n * Though the \">\" character is escaped for symmetry, characters like\n * \">\" and \"/\" don't need escaping in HTML and have no special meaning\n * unless they're part of a tag or unquoted attribute value.\n * See [Mathias Bynens's article](https://mathiasbynens.be/notes/ambiguous-ampersands)\n * (under \"semi-related fun fact\") for more details.\n *\n * Backticks are escaped because in Internet Explorer < 9, they can break out\n * of attribute values or HTML comments. See [#59](https://html5sec.org/#59),\n * [#102](https://html5sec.org/#102), [#108](https://html5sec.org/#108), and\n * [#133](https://html5sec.org/#133) of the [HTML5 Security Cheatsheet](https://html5sec.org/)\n * for more details.\n *\n * When working with HTML you should always [quote attribute values](http://wonko.com/post/html-escaping)\n * to reduce XSS vectors.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escape('fred, barney, & pebbles');\n * // => 'fred, barney, & pebbles'\n */\n function escape(string) {\n // Reset `lastIndex` because in IE < 9 `String#replace` does not.\n string = baseToString(string);\n return (string && reHasUnescapedHtml.test(string))\n ? string.replace(reUnescapedHtml, escapeHtmlChar)\n : string;\n }\n\n /**\n * Escapes the `RegExp` special characters \"\\\", \"/\", \"^\", \"$\", \".\", \"|\", \"?\",\n * \"*\", \"+\", \"(\", \")\", \"[\", \"]\", \"{\" and \"}\" in `string`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to escape.\n * @returns {string} Returns the escaped string.\n * @example\n *\n * _.escapeRegExp('[lodash](https://lodash.com/)');\n * // => '\\[lodash\\]\\(https:\\/\\/lodash\\.com\\/\\)'\n */\n function escapeRegExp(string) {\n string = baseToString(string);\n return (string && reHasRegExpChars.test(string))\n ? string.replace(reRegExpChars, escapeRegExpChar)\n : (string || '(?:)');\n }\n\n /**\n * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the kebab cased string.\n * @example\n *\n * _.kebabCase('Foo Bar');\n * // => 'foo-bar'\n *\n * _.kebabCase('fooBar');\n * // => 'foo-bar'\n *\n * _.kebabCase('__foo_bar__');\n * // => 'foo-bar'\n */\n var kebabCase = createCompounder(function(result, word, index) {\n return result + (index ? '-' : '') + word.toLowerCase();\n });\n\n /**\n * Pads `string` on the left and right sides if it's shorter than `length`.\n * Padding characters are truncated if they can't be evenly divided by `length`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.pad('abc', 8);\n * // => ' abc '\n *\n * _.pad('abc', 8, '_-');\n * // => '_-abc_-_'\n *\n * _.pad('abc', 3);\n * // => 'abc'\n */\n function pad(string, length, chars) {\n string = baseToString(string);\n length = +length;\n\n var strLength = string.length;\n if (strLength >= length || !nativeIsFinite(length)) {\n return string;\n }\n var mid = (length - strLength) / 2,\n leftLength = nativeFloor(mid),\n rightLength = nativeCeil(mid);\n\n chars = createPadding('', rightLength, chars);\n return chars.slice(0, leftLength) + string + chars;\n }\n\n /**\n * Pads `string` on the left side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padLeft('abc', 6);\n * // => ' abc'\n *\n * _.padLeft('abc', 6, '_-');\n * // => '_-_abc'\n *\n * _.padLeft('abc', 3);\n * // => 'abc'\n */\n var padLeft = createPadDir();\n\n /**\n * Pads `string` on the right side if it's shorter than `length`. Padding\n * characters are truncated if they exceed `length`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to pad.\n * @param {number} [length=0] The padding length.\n * @param {string} [chars=' '] The string used as padding.\n * @returns {string} Returns the padded string.\n * @example\n *\n * _.padRight('abc', 6);\n * // => 'abc '\n *\n * _.padRight('abc', 6, '_-');\n * // => 'abc_-_'\n *\n * _.padRight('abc', 3);\n * // => 'abc'\n */\n var padRight = createPadDir(true);\n\n /**\n * Converts `string` to an integer of the specified radix. If `radix` is\n * `undefined` or `0`, a `radix` of `10` is used unless `value` is a hexadecimal,\n * in which case a `radix` of `16` is used.\n *\n * **Note:** This method aligns with the [ES5 implementation](https://es5.github.io/#E)\n * of `parseInt`.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} string The string to convert.\n * @param {number} [radix] The radix to interpret `value` by.\n * @param- {Object} [guard] Enables use as a callback for functions like `_.map`.\n * @returns {number} Returns the converted integer.\n * @example\n *\n * _.parseInt('08');\n * // => 8\n *\n * _.map(['6', '08', '10'], _.parseInt);\n * // => [6, 8, 10]\n */\n function parseInt(string, radix, guard) {\n // Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.\n // Chrome fails to trim leading whitespace characters.\n // See https://code.google.com/p/v8/issues/detail?id=3109 for more details.\n if (guard ? isIterateeCall(string, radix, guard) : radix == null) {\n radix = 0;\n } else if (radix) {\n radix = +radix;\n }\n string = trim(string);\n return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));\n }\n\n /**\n * Repeats the given string `n` times.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to repeat.\n * @param {number} [n=0] The number of times to repeat the string.\n * @returns {string} Returns the repeated string.\n * @example\n *\n * _.repeat('*', 3);\n * // => '***'\n *\n * _.repeat('abc', 2);\n * // => 'abcabc'\n *\n * _.repeat('abc', 0);\n * // => ''\n */\n function repeat(string, n) {\n var result = '';\n string = baseToString(string);\n n = +n;\n if (n < 1 || !string || !nativeIsFinite(n)) {\n return result;\n }\n // Leverage the exponentiation by squaring algorithm for a faster repeat.\n // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.\n do {\n if (n % 2) {\n result += string;\n }\n n = nativeFloor(n / 2);\n string += string;\n } while (n);\n\n return result;\n }\n\n /**\n * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the snake cased string.\n * @example\n *\n * _.snakeCase('Foo Bar');\n * // => 'foo_bar'\n *\n * _.snakeCase('fooBar');\n * // => 'foo_bar'\n *\n * _.snakeCase('--foo-bar');\n * // => 'foo_bar'\n */\n var snakeCase = createCompounder(function(result, word, index) {\n return result + (index ? '_' : '') + word.toLowerCase();\n });\n\n /**\n * Converts `string` to [start case](https://en.wikipedia.org/wiki/Letter_case#Stylistic_or_specialised_usage).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to convert.\n * @returns {string} Returns the start cased string.\n * @example\n *\n * _.startCase('--foo-bar');\n * // => 'Foo Bar'\n *\n * _.startCase('fooBar');\n * // => 'Foo Bar'\n *\n * _.startCase('__foo_bar__');\n * // => 'Foo Bar'\n */\n var startCase = createCompounder(function(result, word, index) {\n return result + (index ? ' ' : '') + (word.charAt(0).toUpperCase() + word.slice(1));\n });\n\n /**\n * Checks if `string` starts with the given target string.\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The string to search.\n * @param {string} [target] The string to search for.\n * @param {number} [position=0] The position to search from.\n * @returns {boolean} Returns `true` if `string` starts with `target`, else `false`.\n * @example\n *\n * _.startsWith('abc', 'a');\n * // => true\n *\n * _.startsWith('abc', 'b');\n * // => false\n *\n * _.startsWith('abc', 'b', 1);\n * // => true\n */\n function startsWith(string, target, position) {\n string = baseToString(string);\n position = position == null\n ? 0\n : nativeMin(position < 0 ? 0 : (+position || 0), string.length);\n\n return string.lastIndexOf(target, position) == position;\n }\n\n /**\n * Creates a compiled template function that can interpolate data properties\n * in \"interpolate\" delimiters, HTML-escape interpolated data properties in\n * \"escape\" delimiters, and execute JavaScript in \"evaluate\" delimiters. Data\n * properties may be accessed as free variables in the template. If a setting\n * object is provided it takes precedence over `_.templateSettings` values.\n *\n * **Note:** In the development build `_.template` utilizes\n * [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl)\n * for easier debugging.\n *\n * For more information on precompiling templates see\n * [lodash's custom builds documentation](https://lodash.com/custom-builds).\n *\n * For more information on Chrome extension sandboxes see\n * [Chrome's extensions documentation](https://developer.chrome.com/extensions/sandboxingEval).\n *\n * @static\n * @memberOf _\n * @category String\n * @param {string} [string=''] The template string.\n * @param {Object} [options] The options object.\n * @param {RegExp} [options.escape] The HTML \"escape\" delimiter.\n * @param {RegExp} [options.evaluate] The \"evaluate\" delimiter.\n * @param {Object} [options.imports] An object to import into the template as free variables.\n * @param {RegExp} [options.interpolate] The \"interpolate\" delimiter.\n * @param {string} [options.sourceURL] The sourceURL of the template's compiled source.\n * @param {string} [options.variable] The data object variable name.\n * @param- {Object} [otherOptions] Enables the legacy `options` param signature.\n * @returns {Function} Returns the compiled template function.\n * @example\n *\n * // using the \"interpolate\" delimiter to create a compiled template\n * var compiled = _.template('hello <%= user %>!');\n * compiled({ 'user': 'fred' });\n * // => 'hello fred!'\n *\n * // using the HTML \"escape\" delimiter to escape data property values\n * var compiled = _.template('<%- value %>');\n * compiled({ 'value': ' +