md/assets/layout-DsxVFL1k.js

2 lines
26 KiB
JavaScript
Raw Normal View History

import{G as k}from"./graph-CR7sjfcu.js";import{a_ as Pn,aR as Sn,aU as z,bj as Fn,aZ as ln,aY as en,aX as A,aW as vn,bk as On,bl as Vn,aQ as W,aB as An,aC as Bn,bm as Yn,bn as Gn,bo as T,aE as Dn,aA as g,bp as P,bq as jn,br as $}from"./index-De_d3zze.js";import{d as pn,e as mn,a as s,h as m,f as I,v as y,r as F}from"./_baseUniq-DzsZ9B1i.js";import{b as wn,a as qn,c as Wn,t as B,m as w,d as _,f as U,l as S,e as $n}from"./min-Di3lGWD9.js";function Xn(n,e){return n==null?n:Pn(n,pn(e),Sn)}function zn(n,e){return n&&mn(n,pn(e))}function Un(n,e){return n>e}function O(n,e){var r={};return e=z(e),mn(n,function(i,t,a){Fn(r,t,e(i,t,a))}),r}function x(n){return n&&n.length?wn(n,ln,Un):void 0}function H(n,e){return n&&n.length?wn(n,z(e),qn):void 0}function Hn(n,e){var r=n.length;for(n.sort(e);r--;)n[r]=n[r].value;return n}function Zn(n,e){if(n!==e){var r=n!==void 0,i=n===null,t=n===n,a=en(n),o=e!==void 0,u=e===null,d=e===e,f=en(e);if(!u&&!f&&!a&&n>e||a&&o&&d&&!u&&!f||i&&o&&d||!r&&d||!t)return 1;if(!i&&!a&&!f&&n<e||f&&r&&t&&!i&&!a||u&&r&&t||!o&&t||!d)return-1}return 0}function Jn(n,e,r){for(var i=-1,t=n.criteria,a=e.criteria,o=t.length,u=r.length;++i<o;){var d=Zn(t[i],a[i]);if(d){if(i>=u)return d;var f=r[i];return d*(f=="desc"?-1:1)}}return n.index-e.index}function Qn(n,e,r){e.length?e=A(e,function(a){return vn(a)?function(o){return On(o,a.length===1?a[0]:a)}:a}):e=[ln];var i=-1;e=A(e,Vn(z));var t=Wn(n,function(a,o,u){var d=A(e,function(f){return f(a)});return{criteria:d,index:++i,value:a}});return Hn(t,function(a,o){return Jn(a,o,r)})}var Kn=Math.ceil,ne=Math.max;function ee(n,e,r,i){for(var t=-1,a=ne(Kn((e-n)/(r||1)),0),o=Array(a);a--;)o[++t]=n,n+=r;return o}function re(n){return function(e,r,i){return i&&typeof i!="number"&&W(e,r,i)&&(r=i=void 0),e=B(e),r===void 0?(r=e,e=0):r=B(r),i=i===void 0?e<r?1:-1:B(i),ee(e,r,i)}}var N=re(),M=An(function(n,e){if(n==null)return[];var r=e.length;return r>1&&W(n,e[0],e[1])?e=[]:r>2&&W(e[0],e[1],e[2])&&(e=[e[0]]),Qn(n,Bn(e),[])}),ie=0;function Z(n){var e=++ie;return Yn(n)+e}function te(n,e,r){for(var i=-1,t=n.length,a=e.length,o={};++i<t;){var u=i<a?e[i]:void 0;r(o,n[i],u)}return o}function ae(n,e){return te(n||[],e||[],Gn)}class oe{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return rn(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&rn(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,i=r._prev;i!==r;)e.push(JSON.stringify(i,ue)),i=i._prev;return"["+e.join(", ")+"]"}}function rn(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function ue(n,e){if(n!=="_next"&&n!=="_prev")return e}var de=Dn(1);function fe(n,e){if(n.nodeCount()<=1)return[];var r=ce(n,e||de),i=se(r.graph,r.buckets,r.zeroIdx);return T(w(i,function(t){return n.outEdges(t.v,t.w)}))}function se(n,e,r){for(var i=[],t=e[e.length-1],a=e[0],o;n.nodeCount();){for(;o=a.dequeue();)Y(n,e,r,o);for(;o=t.dequeue();)Y(n,e,r,o);if(n.nodeCount()){for(var u=e.length-2;u>0;--u)if(o=e[u].dequeue(),o){i=i.concat(Y(n,e,r,o,!0));break}}}return i}function Y(n,e,r,i,t){var a=t?[]:void 0;return s(n.inEdges(i.v),function(o){var u=n.edge(o),d=n.node(o.v);t&&a.push({v:o.v,w:o.w}),d.out-=u,X(e,r,d)}),s(n.outEdges(i.v),function(o){var u=n.edge(o),d=o.w,f=n.node(d);f.in-=u,X(e,r,f)}),n.removeNode(i.v),a}function ce(n,e){var r=new k,i=0,t=0;s(n.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),s(n.edges(),function(u){var d=r.edge(u.v,u.w)||0,f=e(u),c=d+f;r.setEdge(u.v,u.w,c),t=Math.max(t,r.node(u.v).out+=f),i=Math.max(i,r.node(u.w).in+=f)});var a=N(t+i+3).map(function(){return new oe}),o=i+1;return s(r.nodes(),function(u){X(a,o,r.node(u))}),{graph:r,buckets:a,zeroIdx:o}}function X(n,e,r){r.out?r.in?n[r.out-r.in+e].enqueue(r):n[n.length-1].enqueue(r):n[0].enqueue(r)}function he(n){var e=n.graph().acyclicer==="greedy"?fe(n,r(n)):le(n);s(e,function(i){var t=n.edge(i);n.removeEdge(i),t.forwardName=i.name,t.reversed=!0,n.setEdge(i.w,i.v,t,Z("rev"))});function r(i){return function(t){return i.edge(t).weight}}}function le(n){va