mirror of
https://github.com/mfocko/blog.git
synced 2024-11-14 01:59:42 +01:00
1 line
50 KiB
JavaScript
1 line
50 KiB
JavaScript
|
"use strict";(self.webpackChunkfi=self.webpackChunkfi||[]).push([[1644],{41644:(n,e,t)=>{t.d(e,{bK:()=>Me});var r=t(70870),o=t(66749),i=t(17452),u=t(62002),a=t(27961),c=t(43836),s=t(74379),f=t(45625);class d{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,e=n._prev;if(e!==n)return h(e),e}enqueue(n){var e=this._sentinel;n._prev&&n._next&&h(n),n._next=e._next,e._next._prev=n,e._next=n,n._prev=e}toString(){for(var n=[],e=this._sentinel,t=e._prev;t!==e;)n.push(JSON.stringify(t,v)),t=t._prev;return"["+n.join(", ")+"]"}}function h(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function v(n,e){if("_next"!==n&&"_prev"!==n)return e}var l=u.Z(1);function Z(n,e){if(n.nodeCount()<=1)return[];var t=function(n,e){var t=new f.k,o=0,i=0;r.Z(n.nodes(),(function(n){t.setNode(n,{v:n,in:0,out:0})})),r.Z(n.edges(),(function(n){var r=t.edge(n.v,n.w)||0,u=e(n),a=r+u;t.setEdge(n.v,n.w,a),i=Math.max(i,t.node(n.v).out+=u),o=Math.max(o,t.node(n.w).in+=u)}));var u=s.Z(i+o+3).map((function(){return new d})),a=o+1;return r.Z(t.nodes(),(function(n){p(u,a,t.node(n))})),{graph:t,buckets:u,zeroIdx:a}}(n,e||l),o=function(n,e,t){var r,o=[],i=e[e.length-1],u=e[0];for(;n.nodeCount();){for(;r=u.dequeue();)g(n,e,t,r);for(;r=i.dequeue();)g(n,e,t,r);if(n.nodeCount())for(var a=e.length-2;a>0;--a)if(r=e[a].dequeue()){o=o.concat(g(n,e,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return a.Z(c.Z(o,(function(e){return n.outEdges(e.v,e.w)})))}function g(n,e,t,o,i){var u=i?[]:void 0;return r.Z(n.inEdges(o.v),(function(r){var o=n.edge(r),a=n.node(r.v);i&&u.push({v:r.v,w:r.w}),a.out-=o,p(e,t,a)})),r.Z(n.outEdges(o.v),(function(r){var o=n.edge(r),i=r.w,u=n.node(i);u.in-=o,p(e,t,u)})),n.removeNode(o.v),u}function p(n,e,t){t.out?t.in?n[t.out-t.in+e].enqueue(t):n[n.length-1].enqueue(t):n[0].enqueue(t)}function b(n){var e="greedy"===n.graph().acyclicer?Z(n,function(n){return function(e){return n.edge(e).weight}}(n)):function(n){var e=[],t={},o={};function u(a){i.Z(o,a)||(o[a]=!0,t[a]=!0,r.Z(n.outEdges(a),(function(n){i.Z(t,n.w)?e.push(n):u(n.w)})),delete t[a])}return r.Z(n.nodes(),u),e}(n);r.Z(e,(function(e){var t=n.edge(e);n.removeEdge(e),t.forwardName=e.name,t.reversed=!0,n.setEdge(e.w,e.v,t,o.Z("rev"))}))}var w=t(59236),m=t(61666),y=t(3688),_=t(72714);const E=function(n,e,t){for(var r=-1,o=n.length;++r<o;){var i=n[r],u=e(i);if(null!=u&&(void 0===a?u==u&&!(0,_.Z)(u):t(u,a)))var a=u,c=i}return c};const j=function(n,e){return n>e};var k=t(69203);const x=function(n){return n&&n.length?E(n,k.Z,j):void 0};const N=function(n){var e=null==n?0:n.length;return e?n[e-1]:void 0};var I=t(74752),C=t(2693),O=t(74765);const L=function(n,e){var t={};return e=(0,O.Z)(e,3),(0,C.Z)(n,(function(n,r,o){(0,I.Z)(t,r,e(n,r,o))})),t};var M=t(49360);const A=function(n,e){return n<e};const R=function(n){return n&&n.length?E(n,k.Z,A):void 0};var S=t(66092);const P=function(){return S.Z.Date.now()};function T(n,e,t,r){var i;do{i=o.Z(r)}while(n.hasNode(i));return t.dummy=e,n.setNode(i,t),i}function F(n){var e=new f.k({multigraph:n.isMultigraph()}).setGraph(n.graph());return r.Z(n.nodes(),(function(t){n.children(t).length||e.setNode(t,n.node(t))})),r.Z(n.edges(),(function(t){e.setEdge(t,n.edge(t))})),e}function D(n,e){var t,r,o=n.x,i=n.y,u=e.x-o,a=e.y-i,c=n.width/2,s=n.height/2;if(!u&&!a)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(a)*c>Math.abs(u)*s?(a<0&&(s=-s),t=s*u/a,r=s):(u<0&&(c=-c),t=c,r=c*a/u),{x:o+t,y:i+r}}function B(n){var e=c.Z(s.Z(V(n)+1),(function(){return[]}));return r.Z(n.nodes(),(function(t){var r=n.node(t),o=r.rank;M.Z(o)||(e[o][r.order]=t)})),e}function G(n,e,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),T(n,"border",o,e)}function V(n){return x(c.Z(n.nodes(),(function(e){var t=n.node(e).rank;if(!M.Z(t))return t})))}function z(n,e){var t=P();try{return e()}finally{console.log(n+" time: "+(P()-t)+"ms")}}function q(n,e){return e()}function U(n,e,t,r,o,i){var u={width:0,height:0,rank:i,borderType:e},a=o[e][i-1],c=T(n,"border",u,t);
|