mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 00:05:42 +08:00
2 lines
30 KiB
JavaScript
2 lines
30 KiB
JavaScript
import{A as F,a as y,f as kn,B as Pn,e as Q,C as nn,D as Nn,E as Qn,F as ne,l as ee,H as re,q as te,I as ie,w as A,J as ae,K as cn,L as oe,M as Ln,t as ue,z as R,k as de,N as fe,O as _n,P as Cn,Q as se,R as en,T as In,V as ce,W as Rn,y as D,n as le,X as he,Y as ve,G as g,Z as c,_ as pe,i as m,$ as T,a0 as O,a1 as G}from"./graph.BvS0Xx32.js";import{g as we,b as be,k as V,a as Tn,c as me,d as ge,e as ye,f as xe,i as Ee,h as Mn,j as Oe,m as w}from"./map.DsahiwlY.js";var ke=/\s/;function Pe(n){for(var e=n.length;e--&&ke.test(n.charAt(e)););return e}var Ne=/^\s+/;function Le(n){return n&&n.slice(0,Pe(n)+1).replace(Ne,"")}var ln=NaN,_e=/^[-+]0x[0-9a-f]+$/i,Ce=/^0b[01]+$/i,Ie=/^0o[0-7]+$/i,Re=parseInt;function Te(n){if(typeof n=="number")return n;if(F(n))return ln;if(y(n)){var e=typeof n.valueOf=="function"?n.valueOf():n;n=y(e)?e+"":e}if(typeof n!="string")return n===0?n:+n;n=Le(n);var r=Ce.test(n);return r||Ie.test(n)?Re(n.slice(2),r?2:8):_e.test(n)?ln:+n}var hn=1/0,Me=17976931348623157e292;function S(n){if(!n)return n===0?n:0;if(n=Te(n),n===hn||n===-hn){var e=n<0?-1:1;return e*Me}return n===n?n:0}function Se(n){var e=S(n),r=e%1;return e===e?r?e-r:e:0}function _(n,e,r){if(!y(r))return!1;var t=typeof e;return(t=="number"?kn(r)&&Pn(e,r.length):t=="string"&&e in r)?Q(r[e],n):!1}function Fe(n){return nn(function(e,r){var t=-1,i=r.length,o=i>1?r[i-1]:void 0,a=i>2?r[2]:void 0;for(o=n.length>3&&typeof o=="function"?(i--,o):void 0,a&&_(r[0],r[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++t<i;){var u=r[t];u&&n(e,u,t,o)}return e})}function P(n){var e=n==null?0:n.length;return e?Nn(n):[]}function Ae(n){return Qn(ne(n,void 0,P),n+"")}var Be="[object Object]",je=Function.prototype,Ge=Object.prototype,Sn=je.toString,Ve=Ge.hasOwnProperty,Ye=Sn.call(Object);function $e(n){if(!ee(n)||re(n)!=Be)return!1;var e=we(n);if(e===null)return!0;var r=Ve.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Sn.call(r)==Ye}var De=1,qe=4;function We(n){return be(n,De|qe)}var Fn=Object.prototype,Xe=Fn.hasOwnProperty,He=nn(function(n,e){n=Object(n);var r=-1,t=e.length,i=t>2?e[2]:void 0;for(i&&_(e[0],e[1],i)&&(t=1);++r<t;)for(var o=e[r],a=V(o),u=-1,d=a.length;++u<d;){var f=a[u],s=n[f];(s===void 0||Q(s,Fn[f])&&!Xe.call(n,f))&&(n[f]=o[f])}return n});function U(n,e,r){(r!==void 0&&!Q(n[e],r)||r===void 0&&!(e in n))&&Tn(n,e,r)}function J(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}function ze(n){return me(n,V(n))}function Ue(n,e,r,t,i,o,a){var u=J(n,r),d=J(e,r),f=a.get(d);if(f){U(n,r,f);return}var s=o?o(u,d,r+"",n,e,a):void 0,l=s===void 0;if(l){var h=A(d),v=!h&&te(d),p=!h&&!v&&ie(d);s=d,h||v||p?A(u)?s=u:ae(u)?s=ge(u):v?(l=!1,s=ye(d,!0)):p?(l=!1,s=xe(d,!0)):s=[]:$e(d)||cn(d)?(s=u,cn(u)?s=ze(u):(!y(u)||oe(u))&&(s=Ee(d))):l=!1}l&&(a.set(d,s),i(s,d,t,o,a),a.delete(d)),U(n,r,s)}function An(n,e,r,t,i){n!==e&&Ln(e,function(o,a){if(i||(i=new ue),y(o))Ue(n,e,a,r,An,t,i);else{var u=t?t(J(n,a),o,a+"",n,e,i):void 0;u===void 0&&(u=o),U(n,a,u)}},V)}function B(n){var e=n==null?0:n.length;return e?n[e-1]:void 0}function Je(n){return function(e,r,t){var i=Object(e);if(!kn(e)){var o=R(r);e=de(e),r=function(u){return o(i[u],u,i)}}var a=n(e,r,t);return a>-1?i[o?e[a]:a]:void 0}}var Ke=Math.max;function Ze(n,e,r){var t=n==null?0:n.length;if(!t)return-1;var i=r==null?0:Se(r);return i<0&&(i=Ke(t+i,0)),fe(n,R(e),i)}var rn=Je(Ze);function Qe(n,e){return n==null?n:Ln(n,_n(e),V)}function nr(n,e){return n&&Cn(n,_n(e))}function er(n,e){return n>e}var rr=Object.prototype,tr=rr.hasOwnProperty;function ir(n,e){return n!=null&&tr.call(n,e)}function Bn(n,e){return n!=null&&se(n,e,ir)}function jn(n,e){return n<e}function Y(n,e){var r={};return e=R(e),Cn(n,function(t,i,o){Tn(r,i,e(t,i,o))}),r}function tn(n,e,r){for(var t=-1,i=n.length;++t<i;){var o=n[t],a=e(o);if(a!=null&&(u===void 0?a===a&&!F(a):r(a,u)))var u=a,d=o}return d}function x(n){return n&&n.length?tn(n,en,er):void 0}var K=Fe(function(n,e,r){An(n,e,r)});function C(n){return n&&n.length?tn(n,en,jn):void 0}function an(n,e){return n&&n.length?tn(n,R(e),jn):void 0}function ar(n,e,r,t){if(!y(n))return n;e=In(e,n);for(var i=-1,o=e.length,a=o-1,u=n;u!=null&&++i<o;){var d=ce(e[i]),f=r;if(d==="__proto__"||d==="constructor"||d==="prototype")return n;if(i!=a){var s=u[d];f=void 0,f===void 0&&(f=y(s)?s:Pn(e[i+1])?[]:{})}Mn(u,d,f),u=u[d]}return n}function or(n,e,r){for(var t=-1,i=e.length,o={};++t<i;){var a=e[t],u=Rn(n,a);r(u,a)&&ar(o,In(a,n),u)}return o}function ur(n,e){var r=n.length;for(n.sort(e);r--;)n[r]=n[r].value;return n}function dr(n,e){if(n!==e){var r=n!==void 0,t=n===null,i=n===n,o=F(n),a=e!==void 0,u=e===null,d=e===e,f=F(e);if(!u&&!f&&!o&&n>e||o&&a&&d&&!u&&!f||t&&a&&d||!r&&d||!i)return 1;if(!t&&!o&&!f&&n<e||f&&r&&i&&!t&&!o||u&&r&&i||!a&&i||!d)return-1}return 0}function fr(n,e,r){for(var t=-1,i=n.criteria,o=e.criteria,a=i.length,u=r.length;++t<a;){var d=dr(i[t],o[t]);if(d){if(t>=u)return d;var f=r[t];return d*(f=="desc"?-1:1)}}return n.index-e.index}function sr(n,e,r){e.length?e=D(e,function(o){return A(o)?function(a){return Rn(a,o.length===1?o[0]:o)}:o}):e=[en];var t=-1;e=D(e,le(R));var i=Oe(n,function(o,a,u){var d=D(e,function(f){return f(o)});return{criteria:d,index:++t,value:o}});return ur(i,function(o,a){return fr(o,a,r)})}function cr(n,e){return or(n,e,function(r,t){return he(n,t)})}var j=Ae(function(n,e){return n==null?{}:cr(n,e)}),lr=Math.ceil,hr=Math.max;function vr(n,e,r,t){for(var i=-1,o=hr(lr((e-n)/(r||1)),0),a=Array(o);o--;)a[++i]=n,n+=r;return a}function pr(n){return function(e,r,t){return t&&typeof t!="number"&&_(e,r,t)&&(r=t=void 0),e=S(e),r===void 0?(r=e,e=0):r=S(r),t=t===void 0?e<r?1:-1:S(t),vr(e,r,t)}}var k=pr(),M=nn(function(n,e){if(n==null)return[];var r=e.length;return r>1&&_(n,e[0],e[1])?e=[]:r>2&&_(e[0],e[1],e[2])&&(e=[e[0]]),sr(n,Nn(e),[])}),wr=0;function on(n){var e=++wr;return ve(n)+e}function br(n,e,r){for(var t=-1,i=n.length,o=e.length,a={};++t<i;){var u=t<o?e[t]:void 0;r(a,n[t],u)}return a}function mr(n,e){return br(n||[],e||[],Mn)}class gr{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,r=e._prev;if(r!==e)return vn(r),r}enqueue(e){var r=this._sentinel;e._prev&&e._next&&vn(e),e._next=r._next,r._next._prev=e,r._next=e,e._prev=r}toString(){for(var e=[],r=this._sentinel,t=r._prev;t!==r;)e.push(JSON.stringify(t,yr)),t=t._prev;return"["+e.join(", ")+"]"}}function vn(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function yr(n,e){if(n!=="_next"&&n!=="_prev")return e}var xr=pe(1);function Er(n,e){if(n.nodeCount()<=1)return[];var r=kr(n,e||xr),t=Or(r.graph,r.buckets,r.zeroIdx);return P(w(t,function(i){return n.outEdges(i.v,i.w)}))}function Or(n,e,r){for(var t=[],i=e[e.length-1],o=e[0],a;n.nodeCount();){for(;a=o.dequeue();)q(n,e,r,a);for(;a=i.dequeue();)q(n,e,r,a);if(n.nodeCount()){for(var u=e.length-2;u>0;--u)if(a=e[u].dequeue(),a){t=t.concat(q(n,e,r,a,!0));break}}}return t}function q(n,e,r,t,i){var o=i?[]:void 0;return c(n.inEdges(t.v),function(a){var u=n.edge(a),d=n.node(a.v);i&&o.push({v:a.v,w:a.w}),d.out-=u,Z(e,r,d)}),c(n.outEdges(t.v),function(a){var u=n.edge(a),d=a.w,f=n.node(d);f.in-=u,Z(e,r,f)}),n.removeNode(t.v),o}function kr(n,e){var r=new g,t=0,i=0;c(n.nodes(),function(u){r.setNode(u,{v:u,in:0,out:0})}),c(n.edges(),function(u){var d=r.edge(u.v,u.w)||0,f=e(u),s=d+f;r.setEdge(u.v,u.w,s),i=Math.max(i,r.node(u.v).out+=f),t=Math.max(t,r.node(u.w).in+=f)});var o=k(i+t+3).map(function(){return new gr}),a=t+1;return c(r.nodes(),function(u){Z(o,a,r.node(u))}),{graph:r,buckets:o,zeroIdx:a}}function Z(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 Pr(n){var e=n.graph().acyclicer==="greedy"?Er(n,r(n)):Nr(n);c(e,function(t){var i=n.edge(t);n.removeEdge(t),i.forwardName=t.name,i.reversed=!0,n.setEdge(t.w,t.v,i,on("rev"))});function r(t){return function(i){return t.edge(i).weight}}}function Nr(n){var e=[],r={},t={};function i(o){Object.prototype.hasOwnProperty.call(t,o)||(t[o]=!0,r[o]=!0,c(n.outEdges(o),function(a){Object.prototype.hasOwnProperty.call(r,a.w)?e.push(a):i(a.w)}),delete r[o])}return c(n.nodes(),i),e}function Lr(n){c(n.edges(),function(e){var r=n.edge(e);if(r.reversed){n.removeEdge(e);var t=r.forwardName;delete r.reversed,delete r.forwardName,n.setEdge(e.w,e.v,r,t)}})}function N(n,e,r,t){var i;do i=on(t);while(n.hasNode(i));return r.dummy=e,n.setNode(i,r),i}function _r(n){var e=new g().setGraph(n.graph());return c(n.nodes(),function(r){e.setNode(r,n.node(r))}),c(n.edges(),function(r){var t=e.edge(r.v,r.w)||{weight:0,minlen:1},i=n.edge(r);e.setEdge(r.v,r.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),e}function Gn(n){var e=new g({multigraph:n.isMultigraph()}).setGraph(n.graph());return c(n.nodes(),function(r){n.children(r).length||e.setNode(r,n.node(r))}),c(n.edges(),function(r){e.setEdge(r,n.edge(r))}),e}function pn(n,e){var r=n.x,t=n.y,i=e.x-r,o=e.y-t,a=n.width/2,u=n.height/2;if(!i&&!o)throw new Error("Not possible to find intersection inside of the rectangle");var d,f;return Math.abs(o)*a>Math.abs(i)*u?(o<0&&(u=-u),d=u*i/o,f=u):(i<0&&(a=-a),d=a,f=a*o/i),{x:r+d,y:t+f}}function $(n){var e=w(k(Vn(n)+1),function(){return[]});return c(n.nodes(),function(r){var t=n.node(r),i=t.rank;m(i)||(e[i][t.order]=r)}),e}function Cr(n){var e=C(w(n.nodes(),function(r){return n.node(r).rank}));c(n.nodes(),function(r){var t=n.node(r);Bn(t,"rank")&&(t.rank-=e)})}function Ir(n){var e=C(w(n.nodes(),function(o){return n.node(o).rank})),r=[];c(n.nodes(),function(o){var a=n.node(o).rank-e;r[a]||(r[a]=[]),r[a].push(o)});var t=0,i=n.graph().nodeRankFactor;c(r,function(o,a){m(o)&&a%i!==0?--t:t&&c(o,function(u){n.node(u).rank+=t})})}function wn(n,e,r,t){var i={width:0,height:0};return arguments.length>=4&&(i.rank=r,i.order=t),N(n,"border",i,e)}function Vn(n){return x(w(n.nodes(),function(e){var r=n.node(e).rank;if(!m(r))return r}))}function Rr(n,e){var r={lhs:[],rhs:[]};return c(n,function(t){e(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Tr(n,e){return e()}function Mr(n){function e(r){var t=n.children(r),i=n.node(r);if(t.length&&c(t,e),Object.prototype.hasOwnProperty.call(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(var o=i.minRank,a=i.maxRank+1;o<a;++o)bn(n,"borderLeft","_bl",r,i,o),bn(n,"borderRight","_br",r,i,o)}}c(n.children(),e)}function bn(n,e,r,t,i,o){var a={width:0,height:0,rank:o,borderType:e},u=i[e][o-1],d=N(n,"border",a,r);i[e][o]=d,n.setParent(d,t),u&&n.setEdge(u,d,{weight:1})}function Sr(n){var e=n.graph().rankdir.toLowerCase();(e==="lr"||e==="rl")&&Yn(n)}function Fr(n){var e=n.graph().rankdir.toLowerCase();(e==="bt"||e==="rl")&&Ar(n),(e==="lr"||e==="rl")&&(Br(n),Yn(n))}function Yn(n){c(n.nodes(),function(e){mn(n.node(e))}),c(n.edges(),function(e){mn(n.edge(e))})}function mn(n){var e=n.width;n.width=n.height,n.height=e}function Ar(n){c(n.nodes(),function(e){W(n.node(e))}),c(n.edges(),function(e){var r=n.edge(e);c(r.points,W),Object.prototype.hasOwnProperty.call(r,"y")&&W(r)})}function W(n){n.y=-n.y}function Br(n){c(n.nodes(),function(e){X(n.node(e))}),c(n.edges(),function(e){var r=n.edge(e);c(r.points,X),Object.prototype.hasOwnProperty.call(r,"x")&&X(r)})}function X(n){var e=n.x;n.x=n.y,n.y=e}function jr(n){n.graph().dummyChains=[],c(n.edges(),function(e){Gr(n,e)})}function Gr(n,e){var r=e.v,t=n.node(r).rank,i=e.w,o=n.node(i).rank,a=e.name,u=n.edge(e),d=u.labelRank;if(o!==t+1){n.removeEdge(e);var f=void 0,s,l;for(l=0,++t;t<o;++l,++t)u.points=[],f={width:0,height:0,edgeLabel:u,edgeObj:e,rank:t},s=N(n,"edge",f,"_d"),t===d&&(f.width=u.width,f.height=u.height,f.dummy="edge-label",f.labelpos=u.labelpos),n.setEdge(r,s,{weight:u.weight},a),l===0&&n.graph().dummyChains.push(s),r=s;n.setEdge(r,i,{weight:u.weight},a)}}function Vr(n){c(n.graph().dummyChains,function(e){var r=n.node(e),t=r.edgeLabel,i;for(n.setEdge(r.edgeObj,t);r.dummy;)i=n.successors(e)[0],n.removeNode(e),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),e=i,r=n.node(e)})}function un(n){var e={};function r(t){var i=n.node(t);if(Object.prototype.hasOwnProperty.call(e,t))return i.rank;e[t]=!0;var o=C(w(n.outEdges(t),function(a){return r(a.w)-n.edge(a).minlen}));return(o===Number.POSITIVE_INFINITY||o===void 0||o===null)&&(o=0),i.rank=o}c(n.sources(),r)}function I(n,e){return n.node(e.w).rank-n.node(e.v).rank-n.edge(e).minlen}function $n(n){var e=new g({directed:!1}),r=n.nodes()[0],t=n.nodeCount();e.setNode(r,{});for(var i,o;Yr(e,n)<t;)i=$r(e,n),o=e.hasNode(i.v)?I(n,i):-I(n,i),Dr(e,n,o);return e}function Yr(n,e){function r(t){c(e.nodeEdges(t),function(i){var o=i.v,a=t===o?i.w:o;!n.hasNode(a)&&!I(e,i)&&(n.setNode(a,{}),n.setEdge(t,a,{}),r(a))})}return c(n.nodes(),r),n.nodeCount()}function $r(n,e){return an(e.edges(),function(r){if(n.hasNode(r.v)!==n.hasNode(r.w))return I(e,r)})}function Dr(n,e,r){c(n.nodes(),function(t){e.node(t).rank+=r})}function qr(){}qr.prototype=new Error;function Dn(n,e,r){A(e)||(e=[e]);var t=(n.isDirected()?n.successors:n.neighbors).bind(n),i=[],o={};return c(e,function(a){if(!n.hasNode(a))throw new Error("Graph does not have node: "+a);qn(n,a,r==="post",o,t,i)}),i}function qn(n,e,r,t,i,o){Object.prototype.hasOwnProperty.call(t,e)||(t[e]=!0,r||o.push(e),c(i(e),function(a){qn(n,a,r,t,i,o)}),r&&o.push(e))}function Wr(n,e){return Dn(n,e,"post")}function Xr(n,e){return Dn(n,e,"pre")}E.initLowLimValues=fn;E.initCutValues=dn;E.calcCutValue=Wn;E.leaveEdge=Hn;E.enterEdge=zn;E.exchangeEdges=Un;function E(n){n=_r(n),un(n);var e=$n(n);fn(e),dn(e,n);for(var r,t;r=Hn(e);)t=zn(e,n,r),Un(e,n,r,t)}function dn(n,e){var r=Wr(n,n.nodes());r=r.slice(0,r.length-1),c(r,function(t){Hr(n,e,t)})}function Hr(n,e,r){var t=n.node(r),i=t.parent;n.edge(r,i).cutvalue=Wn(n,e,r)}function Wn(n,e,r){var t=n.node(r),i=t.parent,o=!0,a=e.edge(r,i),u=0;return a||(o=!1,a=e.edge(i,r)),u=a.weight,c(e.nodeEdges(r),function(d){var f=d.v===r,s=f?d.w:d.v;if(s!==i){var l=f===o,h=e.edge(d).weight;if(u+=l?h:-h,Ur(n,r,s)){var v=n.edge(r,s).cutvalue;u+=l?-v:v}}}),u}function fn(n,e){arguments.length<2&&(e=n.nodes()[0]),Xn(n,{},1,e)}function Xn(n,e,r,t,i){var o=r,a=n.node(t);return e[t]=!0,c(n.neighbors(t),function(u){Object.prototype.hasOwnProperty.call(e,u)||(r=Xn(n,e,r,u,t))}),a.low=o,a.lim=r++,i?a.parent=i:delete a.parent,r}function Hn(n){return rn(n.edges(),function(e){return n.edge(e).cutvalue<0})}function zn(n,e,r){var t=r.v,i=r.w;e.hasEdge(t,i)||(t=r.w,i=r.v);var o=n.node(t),a=n.node(i),u=o,d=!1;o.lim>a.lim&&(u=a,d=!0);var f=T(e.edges(),function(s){return d===gn(n,n.node(s.v),u)&&d!==gn(n,n.node(s.w),u)});return an(f,function(s){return I(e,s)})}function Un(n,e,r,t){var i=r.v,o=r.w;n.removeEdge(i,o),n.setEdge(t.v,t.w,{}),fn(n),dn(n,e),zr(n,e)}function zr(n,e){var r=rn(n.nodes(),function(i){return!e.node(i).parent}),t=Xr(n,r);t=t.slice(1),c(t,function(i){var o=n.node(i).parent,a=e.edge(i,o),u=!1;a||(a=e.edge(o,i),u=!0),e.node(i).rank=e.node(o).rank+(u?a.minlen:-a.minlen)})}function Ur(n,e,r){return n.hasEdge(e,r)}function gn(n,e,r){return r.low<=e.lim&&e.lim<=r.lim}function Jr(n){switch(n.graph().ranker){case"network-simplex":yn(n);break;case"tight-tree":Zr(n);break;case"longest-path":Kr(n);break;default:yn(n)}}var Kr=un;function Zr(n){un(n),$n(n)}function yn(n){E(n)}function Qr(n){var e=N(n,"root",{},"_root"),r=nt(n),t=x(O(r))-1,i=2*t+1;n.graph().nestingRoot=e,c(n.edges(),function(a){n.edge(a).minlen*=i});var o=et(n)+1;c(n.children(),function(a){Jn(n,e,i,o,t,r,a)}),n.graph().nodeRankFactor=i}function Jn(n,e,r,t,i,o,a){var u=n.children(a);if(!u.length){a!==e&&n.setEdge(e,a,{weight:0,minlen:r});return}var d=wn(n,"_bt"),f=wn(n,"_bb"),s=n.node(a);n.setParent(d,a),s.borderTop=d,n.setParent(f,a),s.borderBottom=f,c(u,function(l){Jn(n,e,r,t,i,o,l);var h=n.node(l),v=h.borderTop?h.borderTop:l,p=h.borderBottom?h.borderBottom:l,b=h.borderTop?t:2*t,L=v!==p?1:i-o[a]+1;n.setEdge(d,v,{weight:b,minlen:L,nestingEdge:!0}),n.setEdge(p,f,{weight:b,minlen:L,nestingEdge:!0})}),n.parent(a)||n.setEdge(e,d,{weight:0,minlen:i+o[a]})}function nt(n){var e={};function r(t,i){var o=n.children(t);o&&o.length&&c(o,function(a){r(a,i+1)}),e[t]=i}return c(n.children(),function(t){r(t,1)}),e}function et(n){return G(n.edges(),function(e,r){return e+n.edge(r).weight},0)}function rt(n){var e=n.graph();n.removeNode(e.nestingRoot),delete e.nestingRoot,c(n.edges(),function(r){var t=n.edge(r);t.nestingEdge&&n.removeEdge(r)})}function tt(n,e,r){var t={},i;c(r,function(o){for(var a=n.parent(o),u,d;a;){if(u=n.parent(a),u?(d=t[u],t[u]=a):(d=i,i=a),d&&d!==a){e.setEdge(d,a);return}a=u}})}function it(n,e,r){var t=at(n),i=new g({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(o){return n.node(o)});return c(n.nodes(),function(o){var a=n.node(o),u=n.parent(o);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(i.setNode(o),i.setParent(o,u||t),c(n[r](o),function(d){var f=d.v===o?d.w:d.v,s=i.edge(f,o),l=m(s)?0:s.weight;i.setEdge(f,o,{weight:n.edge(d).weight+l})}),Object.prototype.hasOwnProperty.call(a,"minRank")&&i.setNode(o,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),i}function at(n){for(var e;n.hasNode(e=on("_root")););return e}function ot(n,e){for(var r=0,t=1;t<e.length;++t)r+=ut(n,e[t-1],e[t]);return r}function ut(n,e,r){for(var t=mr(r,w(r,function(f,s){return s})),i=P(w(e,function(f){return M(w(n.outEdges(f),function(s){return{pos:t[s.w],weight:n.edge(s).weight}}),"pos")})),o=1;o<r.length;)o<<=1;var a=2*o-1;o-=1;var u=w(new Array(a),function(){return 0}),d=0;return c(i.forEach(function(f){var s=f.pos+o;u[s]+=f.weight;for(var l=0;s>0;)s%2&&(l+=u[s+1]),s=s-1>>1,u[s]+=f.weight;d+=f.weight*l})),d}function dt(n){var e={},r=T(n.nodes(),function(u){return!n.children(u).length}),t=x(w(r,function(u){return n.node(u).rank})),i=w(k(t+1),function(){return[]});function o(u){if(!Bn(e,u)){e[u]=!0;var d=n.node(u);i[d.rank].push(u),c(n.successors(u),o)}}var a=M(r,function(u){return n.node(u).rank});return c(a,o),i}function ft(n,e){return w(e,function(r){var t=n.inEdges(r);if(t.length){var i=G(t,function(o,a){var u=n.edge(a),d=n.node(a.v);return{sum:o.sum+u.weight*d.order,weight:o.weight+u.weight}},{sum:0,weight:0});return{v:r,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:r}})}function st(n,e){var r={};c(n,function(i,o){var a=r[i.v]={indegree:0,in:[],out:[],vs:[i.v],i:o};m(i.barycenter)||(a.barycenter=i.barycenter,a.weight=i.weight)}),c(e.edges(),function(i){var o=r[i.v],a=r[i.w];!m(o)&&!m(a)&&(a.indegree++,o.out.push(r[i.w]))});var t=T(r,function(i){return!i.indegree});return ct(t)}function ct(n){var e=[];function r(o){return function(a){a.merged||(m(a.barycenter)||m(o.barycenter)||a.barycenter>=o.barycenter)&<(o,a)}}function t(o){return function(a){a.in.push(o),--a.indegree===0&&n.push(a)}}for(;n.length;){var i=n.pop();e.push(i),c(i.in.reverse(),r(i)),c(i.out,t(i))}return w(T(e,function(o){return!o.merged}),function(o){return j(o,["vs","i","barycenter","weight"])})}function lt(n,e){var r=0,t=0;n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.vs=e.vs.concat(n.vs),n.barycenter=r/t,n.weight=t,n.i=Math.min(e.i,n.i),e.merged=!0}function ht(n,e){var r=Rr(n,function(s){return Object.prototype.hasOwnProperty.call(s,"barycenter")}),t=r.lhs,i=M(r.rhs,function(s){return-s.i}),o=[],a=0,u=0,d=0;t.sort(vt(!!e)),d=xn(o,i,d),c(t,function(s){d+=s.vs.length,o.push(s.vs),a+=s.barycenter*s.weight,u+=s.weight,d=xn(o,i,d)});var f={vs:P(o)};return u&&(f.barycenter=a/u,f.weight=u),f}function xn(n,e,r){for(var t;e.length&&(t=B(e)).i<=r;)e.pop(),n.push(t.vs),r++;return r}function vt(n){return function(e,r){return e.barycenter<r.barycenter?-1:e.barycenter>r.barycenter?1:n?r.i-e.i:e.i-r.i}}function Kn(n,e,r,t){var i=n.children(e),o=n.node(e),a=o?o.borderLeft:void 0,u=o?o.borderRight:void 0,d={};a&&(i=T(i,function(p){return p!==a&&p!==u}));var f=ft(n,i);c(f,function(p){if(n.children(p.v).length){var b=Kn(n,p.v,r,t);d[p.v]=b,Object.prototype.hasOwnProperty.call(b,"barycenter")&&wt(p,b)}});var s=st(f,r);pt(s,d);var l=ht(s,t);if(a&&(l.vs=P([a,l.vs,u]),n.predecessors(a).length)){var h=n.node(n.predecessors(a)[0]),v=n.node(n.predecessors(u)[0]);Object.prototype.hasOwnProperty.call(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+v.order)/(l.weight+2),l.weight+=2}return l}function pt(n,e){c(n,function(r){r.vs=P(r.vs.map(function(t){return e[t]?e[t].vs:t}))})}function wt(n,e){m(n.barycenter)?(n.barycenter=e.barycenter,n.weight=e.weight):(n.barycenter=(n.barycenter*n.weight+e.barycenter*e.weight)/(n.weight+e.weight),n.weight+=e.weight)}function bt(n){var e=Vn(n),r=En(n,k(1,e+1),"inEdges"),t=En(n,k(e-1,-1,-1),"outEdges"),i=dt(n);On(n,i);for(var o=Number.POSITIVE_INFINITY,a,u=0,d=0;d<4;++u,++d){mt(u%2?r:t,u%4>=2),i=$(n);var f=ot(n,i);f<o&&(d=0,a=We(i),o=f)}On(n,a)}function En(n,e,r){return w(e,function(t){return it(n,t,r)})}function mt(n,e){var r=new g;c(n,function(t){var i=t.graph().root,o=Kn(t,i,r,e);c(o.vs,function(a,u){t.node(a).order=u}),tt(t,r,o.vs)})}function On(n,e){c(e,function(r){c(r,function(t,i){n.node(t).order=i})})}function gt(n){var e=xt(n);c(n.graph().dummyChains,function(r){for(var t=n.node(r),i=t.edgeObj,o=yt(n,e,i.v,i.w),a=o.path,u=o.lca,d=0,f=a[d],s=!0;r!==i.w;){if(t=n.node(r),s){for(;(f=a[d])!==u&&n.node(f).maxRank<t.rank;)d++;f===u&&(s=!1)}if(!s){for(;d<a.length-1&&n.node(f=a[d+1]).minRank<=t.rank;)d++;f=a[d]}n.setParent(r,f),r=n.successors(r)[0]}})}function yt(n,e,r,t){var i=[],o=[],a=Math.min(e[r].low,e[t].low),u=Math.max(e[r].lim,e[t].lim),d,f;d=r;do d=n.parent(d),i.push(d);while(d&&(e[d].low>a||u>e[d].lim));for(f=d,d=t;(d=n.parent(d))!==f;)o.push(d);return{path:i.concat(o.reverse()),lca:f}}function xt(n){var e={},r=0;function t(i){var o=r;c(n.children(i),t),e[i]={low:o,lim:r++}}return c(n.children(),t),e}function Et(n,e){var r={};function t(i,o){var a=0,u=0,d=i.length,f=B(o);return c(o,function(s,l){var h=kt(n,s),v=h?n.node(h).order:d;(h||s===f)&&(c(o.slice(u,l+1),function(p){c(n.predecessors(p),function(b){var L=n.node(b),sn=L.order;(sn<a||v<sn)&&!(L.dummy&&n.node(p).dummy)&&Zn(r,b,p)})}),u=l+1,a=v)}),o}return G(e,t),r}function Ot(n,e){var r={};function t(o,a,u,d,f){var s;c(k(a,u),function(l){s=o[l],n.node(s).dummy&&c(n.predecessors(s),function(h){var v=n.node(h);v.dummy&&(v.order<d||v.order>f)&&Zn(r,h,s)})})}function i(o,a){var u=-1,d,f=0;return c(a,function(s,l){if(n.node(s).dummy==="border"){var h=n.predecessors(s);h.length&&(d=n.node(h[0]).order,t(a,f,l,u,d),f=l,u=d)}t(a,f,a.length,d,o.length)}),a}return G(e,i),r}function kt(n,e){if(n.node(e).dummy)return rn(n.predecessors(e),function(r){return n.node(r).dummy})}function Zn(n,e,r){if(e>r){var t=e;e=r,r=t}Object.prototype.hasOwnProperty.call(n,e)||Object.defineProperty(n,e,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=n[e];Object.defineProperty(i,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Pt(n,e,r){if(e>r){var t=e;e=r,r=t}return!!n[e]&&Object.prototype.hasOwnProperty.call(n[e],r)}function Nt(n,e,r,t){var i={},o={},a={};return c(e,function(u){c(u,function(d,f){i[d]=d,o[d]=d,a[d]=f})}),c(e,function(u){var d=-1;c(u,function(f){var s=t(f);if(s.length){s=M(s,function(b){return a[b]});for(var l=(s.length-1)/2,h=Math.floor(l),v=Math.ceil(l);h<=v;++h){var p=s[h];o[f]===f&&d<a[p]&&!Pt(r,f,p)&&(o[p]=f,o[f]=i[f]=i[p],d=a[p])}}})}),{root:i,align:o}}function Lt(n,e,r,t,i){var o={},a=_t(n,e,r,i),u=i?"borderLeft":"borderRight";function d(l,h){for(var v=a.nodes(),p=v.pop(),b={};p;)b[p]?l(p):(b[p]=!0,v.push(p),v=v.concat(h(p))),p=v.pop()}function f(l){o[l]=a.inEdges(l).reduce(function(h,v){return Math.max(h,o[v.v]+a.edge(v))},0)}function s(l){var h=a.outEdges(l).reduce(function(p,b){return Math.min(p,o[b.w]-a.edge(b))},Number.POSITIVE_INFINITY),v=n.node(l);h!==Number.POSITIVE_INFINITY&&v.borderType!==u&&(o[l]=Math.max(o[l],h))}return d(f,a.predecessors.bind(a)),d(s,a.successors.bind(a)),c(t,function(l){o[l]=o[r[l]]}),o}function _t(n,e,r,t){var i=new g,o=n.graph(),a=Mt(o.nodesep,o.edgesep,t);return c(e,function(u){var d;c(u,function(f){var s=r[f];if(i.setNode(s),d){var l=r[d],h=i.edge(l,s);i.setEdge(l,s,Math.max(a(n,f,d),h||0))}d=f})}),i}function Ct(n,e){return an(O(e),function(r){var t=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;return Qe(r,function(o,a){var u=St(n,a)/2;t=Math.max(o+u,t),i=Math.min(o-u,i)}),t-i})}function It(n,e){var r=O(e),t=C(r),i=x(r);c(["u","d"],function(o){c(["l","r"],function(a){var u=o+a,d=n[u],f;if(d!==e){var s=O(d);f=a==="l"?t-C(s):i-x(s),f&&(n[u]=Y(d,function(l){return l+f}))}})})}function Rt(n,e){return Y(n.ul,function(r,t){if(e)return n[e.toLowerCase()][t];var i=M(w(n,t));return(i[1]+i[2])/2})}function Tt(n){var e=$(n),r=K(Et(n,e),Ot(n,e)),t={},i;c(["u","d"],function(a){i=a==="u"?e:O(e).reverse(),c(["l","r"],function(u){u==="r"&&(i=w(i,function(l){return O(l).reverse()}));var d=(a==="u"?n.predecessors:n.successors).bind(n),f=Nt(n,i,r,d),s=Lt(n,i,f.root,f.align,u==="r");u==="r"&&(s=Y(s,function(l){return-l})),t[a+u]=s})});var o=Ct(n,t);return It(t,o),Rt(t,n.graph().align)}function Mt(n,e,r){return function(t,i,o){var a=t.node(i),u=t.node(o),d=0,f;if(d+=a.width/2,Object.prototype.hasOwnProperty.call(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":f=-a.width/2;break;case"r":f=a.width/2;break}if(f&&(d+=r?f:-f),f=0,d+=(a.dummy?e:n)/2,d+=(u.dummy?e:n)/2,d+=u.width/2,Object.prototype.hasOwnProperty.call(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":f=u.width/2;break;case"r":f=-u.width/2;break}return f&&(d+=r?f:-f),f=0,d}}function St(n,e){return n.node(e).width}function Ft(n){n=Gn(n),At(n),nr(Tt(n),function(e,r){n.node(r).x=e})}function At(n){var e=$(n),r=n.graph().ranksep,t=0;c(e,function(i){var o=x(w(i,function(a){return n.node(a).height}));c(i,function(a){n.node(a).y=t+o/2}),t+=o+r})}function di(n,e){var r=Tr;r("layout",()=>{var t=r(" buildLayoutGraph",()=>Ht(n));r(" runLayout",()=>Bt(t,r)),r(" updateInputGraph",()=>jt(n,t))})}function Bt(n,e){e(" makeSpaceForEdgeLabels",()=>zt(n)),e(" removeSelfEdges",()=>ti(n)),e(" acyclic",()=>Pr(n)),e(" nestingGraph.run",()=>Qr(n)),e(" rank",()=>Jr(Gn(n))),e(" injectEdgeLabelProxies",()=>Ut(n)),e(" removeEmptyRanks",()=>Ir(n)),e(" nestingGraph.cleanup",()=>rt(n)),e(" normalizeRanks",()=>Cr(n)),e(" assignRankMinMax",()=>Jt(n)),e(" removeEdgeLabelProxies",()=>Kt(n)),e(" normalize.run",()=>jr(n)),e(" parentDummyChains",()=>gt(n)),e(" addBorderSegments",()=>Mr(n)),e(" order",()=>bt(n)),e(" insertSelfEdges",()=>ii(n)),e(" adjustCoordinateSystem",()=>Sr(n)),e(" position",()=>Ft(n)),e(" positionSelfEdges",()=>ai(n)),e(" removeBorderNodes",()=>ri(n)),e(" normalize.undo",()=>Vr(n)),e(" fixupEdgeLabelCoords",()=>ni(n)),e(" undoCoordinateSystem",()=>Fr(n)),e(" translateGraph",()=>Zt(n)),e(" assignNodeIntersects",()=>Qt(n)),e(" reversePoints",()=>ei(n)),e(" acyclic.undo",()=>Lr(n))}function jt(n,e){c(n.nodes(),function(r){var t=n.node(r),i=e.node(r);t&&(t.x=i.x,t.y=i.y,e.children(r).length&&(t.width=i.width,t.height=i.height))}),c(n.edges(),function(r){var t=n.edge(r),i=e.edge(r);t.points=i.points,Object.prototype.hasOwnProperty.call(i,"x")&&(t.x=i.x,t.y=i.y)}),n.graph().width=e.graph().width,n.graph().height=e.graph().height}var Gt=["nodesep","edgesep","ranksep","marginx","marginy"],Vt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Yt=["acyclicer","ranker","rankdir","align"],$t=["width","height"],Dt={width:0,height:0},qt=["minlen","weight","width","height","labeloffset"],Wt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Xt=["labelpos"];function Ht(n){var e=new g({multigraph:!0,compound:!0}),r=z(n.graph());return e.setGraph(K({},Vt,H(r,Gt),j(r,Yt))),c(n.nodes(),function(t){var i=z(n.node(t));e.setNode(t,He(H(i,$t),Dt)),e.setParent(t,n.parent(t))}),c(n.edges(),function(t){var i=z(n.edge(t));e.setEdge(t,K({},Wt,H(i,qt),j(i,Xt)))}),e}function zt(n){var e=n.graph();e.ranksep/=2,c(n.edges(),function(r){var t=n.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function Ut(n){c(n.edges(),function(e){var r=n.edge(e);if(r.width&&r.height){var t=n.node(e.v),i=n.node(e.w),o={rank:(i.rank-t.rank)/2+t.rank,e};N(n,"edge-proxy",o,"_ep")}})}function Jt(n){var e=0;c(n.nodes(),function(r){var t=n.node(r);t.borderTop&&(t.minRank=n.node(t.borderTop).rank,t.maxRank=n.node(t.borderBottom).rank,e=x(e,t.maxRank))}),n.graph().maxRank=e}function Kt(n){c(n.nodes(),function(e){var r=n.node(e);r.dummy==="edge-proxy"&&(n.edge(r.e).labelRank=r.rank,n.removeNode(e))})}function Zt(n){var e=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,i=0,o=n.graph(),a=o.marginx||0,u=o.marginy||0;function d(f){var s=f.x,l=f.y,h=f.width,v=f.height;e=Math.min(e,s-h/2),r=Math.max(r,s+h/2),t=Math.min(t,l-v/2),i=Math.max(i,l+v/2)}c(n.nodes(),function(f){d(n.node(f))}),c(n.edges(),function(f){var s=n.edge(f);Object.prototype.hasOwnProperty.call(s,"x")&&d(s)}),e-=a,t-=u,c(n.nodes(),function(f){var s=n.node(f);s.x-=e,s.y-=t}),c(n.edges(),function(f){var s=n.edge(f);c(s.points,function(l){l.x-=e,l.y-=t}),Object.prototype.hasOwnProperty.call(s,"x")&&(s.x-=e),Object.prototype.hasOwnProperty.call(s,"y")&&(s.y-=t)}),o.width=r-e+a,o.height=i-t+u}function Qt(n){c(n.edges(),function(e){var r=n.edge(e),t=n.node(e.v),i=n.node(e.w),o,a;r.points?(o=r.points[0],a=r.points[r.points.length-1]):(r.points=[],o=i,a=t),r.points.unshift(pn(t,o)),r.points.push(pn(i,a))})}function ni(n){c(n.edges(),function(e){var r=n.edge(e);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function ei(n){c(n.edges(),function(e){var r=n.edge(e);r.reversed&&r.points.reverse()})}function ri(n){c(n.nodes(),function(e){if(n.children(e).length){var r=n.node(e),t=n.node(r.borderTop),i=n.node(r.borderBottom),o=n.node(B(r.borderLeft)),a=n.node(B(r.borderRight));r.width=Math.abs(a.x-o.x),r.height=Math.abs(i.y-t.y),r.x=o.x+r.width/2,r.y=t.y+r.height/2}}),c(n.nodes(),function(e){n.node(e).dummy==="border"&&n.removeNode(e)})}function ti(n){c(n.edges(),function(e){if(e.v===e.w){var r=n.node(e.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e,label:n.edge(e)}),n.removeEdge(e)}})}function ii(n){var e=$(n);c(e,function(r){var t=0;c(r,function(i,o){var a=n.node(i);a.order=o+t,c(a.selfEdges,function(u){N(n,"selfedge",{width:u.label.width,height:u.label.height,rank:a.rank,order:o+ ++t,e:u.e,label:u.label},"_se")}),delete a.selfEdges})})}function ai(n){c(n.nodes(),function(e){var r=n.node(e);if(r.dummy==="selfedge"){var t=n.node(r.e.v),i=t.x+t.width/2,o=t.y,a=r.x-i,u=t.height/2;n.setEdge(r.e,r.label),n.removeNode(e),r.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}],r.label.x=r.x,r.label.y=r.y}})}function H(n,e){return Y(j(n,e),Number)}function z(n){var e={};return c(n,function(r,t){e[t.toLowerCase()]=r}),e}export{di as l};
|