Liferay.Loader.define("portal-workflow-kaleo-designer-web$dagre@0.8.2/lib/greedy-fas",["module","exports","require","./lodash","./graphlib","./data/list"],(function(e,n,o){window;{var r=o("./lodash"),t=o("./graphlib").Graph,u=o("./data/list");e.exports=function greedyFAS(e,n){if(e.nodeCount()<=1)return[];var o=function buildState(e,n){var o=new t,a=0,d=0;r.forEach(e.nodes(),(function(e){o.setNode(e,{v:e,in:0,out:0})})),r.forEach(e.edges(),(function(e){var r=o.edge(e.v,e.w)||0,t=n(e);o.setEdge(e.v,e.w,r+t),d=Math.max(d,o.node(e.v).out+=t),a=Math.max(a,o.node(e.w).in+=t)}));var i=r.range(d+a+3).map((function(){return new u})),f=a+1;return r.forEach(o.nodes(),(function(e){assignBucket(i,f,o.node(e))})),{graph:o,buckets:i,zeroIdx:f}}(e,n||a),d=function doGreedyFAS(e,n,o){for(var r,t=[],u=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)removeNode(e,n,o,r);for(;r=u.dequeue();)removeNode(e,n,o,r);if(e.nodeCount())for(var d=n.length-2;d>0;--d)if(r=n[d].dequeue()){t=t.concat(removeNode(e,n,o,r,!0));break}}return t}(o.graph,o.buckets,o.zeroIdx);return r.flatten(r.map(d,(function(n){return e.outEdges(n.v,n.w)})),!0)};var a=r.constant(1);function removeNode(e,n,o,t,u){var a=u?[]:void 0;return r.forEach(e.inEdges(t.v),(function(r){var t=e.edge(r),d=e.node(r.v);u&&a.push({v:r.v,w:r.w}),d.out-=t,assignBucket(n,o,d)})),r.forEach(e.outEdges(t.v),(function(r){var t=e.edge(r),u=r.w,a=e.node(u);a.in-=t,assignBucket(n,o,a)})),e.removeNode(t.v),a}function assignBucket(e,n,o){o.out?o.in?e[o.out-o.in+n].enqueue(o):e[e.length-1].enqueue(o):e[0].enqueue(o)}}}));
//# sourceMappingURL=greedy-fas.js.map