"use strict";Liferay.Loader.define("portal-workflow-kaleo-designer-web$dagre@0.8.2/lib/order/resolve-conflicts",["module","exports","require","../lodash"],(function(e,n,r){window;var i=r("../lodash");e.exports=function resolveConflicts(e,n){var r={};return i.forEach(e,(function(e,n){var t=r[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};i.isUndefined(e.barycenter)||(t.barycenter=e.barycenter,t.weight=e.weight)})),i.forEach(n.edges(),(function(e){var n=r[e.v],t=r[e.w];i.isUndefined(n)||i.isUndefined(t)||(t.indegree++,n.out.push(r[e.w]))})),function doResolveConflicts(e){var n=[];function handleIn(e){return function(n){n.merged||(i.isUndefined(n.barycenter)||i.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function mergeEntries(e,n){var r=0,i=0;e.weight&&(r+=e.barycenter*e.weight,i+=e.weight),n.weight&&(r+=n.barycenter*n.weight,i+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/i,e.weight=i,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function handleOut(n){return function(r){r.in.push(n),0==--r.indegree&&e.push(r)}}for(;e.length;){var r=e.pop();n.push(r),i.forEach(r.in.reverse(),handleIn(r)),i.forEach(r.out,handleOut(r))}return i.chain(n).filter((function(e){return!e.merged})).map((function(e){return i.pick(e,["vs","i","barycenter","weight"])})).value()}(i.filter(r,(function(e){return!e.indegree})))}}));
//# sourceMappingURL=resolve-conflicts.js.map