var nv=Object.defineProperty,tv=Object.defineProperties;var av=Object.getOwnPropertyDescriptors;var Qu=Object.getOwnPropertySymbols;var iv=Object.prototype.hasOwnProperty,uv=Object.prototype.propertyIsEnumerable;var es=(e,r,n)=>r in e?nv(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n,Ir=(e,r)=>{for(var n in r||(r={}))iv.call(r,n)&&es(e,n,r[n]);if(Qu)for(var n of Qu(r))uv.call(r,n)&&es(e,n,r[n]);return e},Tr=(e,r)=>tv(e,av(r));var Q=(e,r,n)=>new Promise((t,a)=>{var i=o=>{try{s(n.next(o))}catch(c){a(c)}},u=o=>{try{s(n.throw(o))}catch(c){a(c)}},s=o=>o.done?t(o.value):Promise.resolve(o.value).then(i,u);s((n=n.apply(e,r)).next())});import{_ as Pe}from"./icon.vue_vue_type_script_setup_true_lang-CRa4AaUc.js";import{c as Ye,W as sv,a as Te,S as Ru,R as rs,d as ch,p as ov,f as pe,k as De,U as Cr,g as ce,u as D,b as ns,j as ts,s as fv,N as dh,i as H,w as Xe,y as as,C as cv,D as dv,_ as hv}from"./index-DfCnXJsB.js";import{c as Cu}from"./_commonjs-dynamic-modules-TDtrdbi3.js";import{u as ar,P as Ze,_ as lv,a as vv}from"./vue-flow-core-lVUbwXqL.js";import pv from"./processNode-C7WJVHWC.js";import _v from"./animationEdge-C0SgFYPM.js";var Ar,is;function gv(){if(is)return Ar;is=1;function e(){this.__data__=[],this.size=0}return Ar=e,Ar}var Sr,us;function Ce(){if(us)return Sr;us=1;function e(r,n){return r===n||r!==r&&n!==n}return Sr=e,Sr}var Or,ss;function ir(){if(ss)return Or;ss=1;var e=Ce();function r(n,t){for(var a=n.length;a--;)if(e(n[a][0],t))return a;return-1}return Or=r,Or}var xr,os;function bv(){if(os)return xr;os=1;var e=ir(),r=Array.prototype,n=r.splice;function t(a){var i=this.__data__,u=e(i,a);if(u<0)return!1;var s=i.length-1;return u==s?i.pop():n.call(i,u,1),--this.size,!0}return xr=t,xr}var Pr,fs;function yv(){if(fs)return Pr;fs=1;var e=ir();function r(n){var t=this.__data__,a=e(t,n);return a<0?void 0:t[a][1]}return Pr=r,Pr}var Mr,cs;function mv(){if(cs)return Mr;cs=1;var e=ir();function r(n){return e(this.__data__,n)>-1}return Mr=r,Mr}var Lr,ds;function qv(){if(ds)return Lr;ds=1;var e=ir();function r(n,t){var a=this.__data__,i=e(a,n);return i<0?(++this.size,a.push([n,t])):a[i][1]=t,this}return Lr=r,Lr}var kr,hs;function ur(){if(hs)return kr;hs=1;var e=gv(),r=bv(),n=yv(),t=mv(),a=qv();function i(u){var s=-1,o=u==null?0:u.length;for(this.clear();++s-1&&t%1==0&&t-1&&n%1==0&&n<=e}return xn=r,xn}var Pn,fo;function Wv(){if(fo)return Pn;fo=1;var e=ge(),r=xu(),n=Z(),t="[object Arguments]",a="[object Array]",i="[object Boolean]",u="[object Date]",s="[object Error]",o="[object Function]",c="[object Map]",f="[object Number]",d="[object Object]",h="[object RegExp]",l="[object Set]",p="[object String]",v="[object WeakMap]",_="[object ArrayBuffer]",g="[object DataView]",b="[object Float32Array]",m="[object Float64Array]",w="[object Int8Array]",C="[object Int16Array]",q="[object Int32Array]",y="[object Uint8Array]",T="[object Uint8ClampedArray]",S="[object Uint16Array]",x="[object Uint32Array]",E={};E[b]=E[m]=E[w]=E[C]=E[q]=E[y]=E[T]=E[S]=E[x]=!0,E[t]=E[a]=E[_]=E[i]=E[g]=E[u]=E[s]=E[o]=E[c]=E[f]=E[d]=E[h]=E[l]=E[p]=E[v]=!1;function L(N){return n(N)&&r(N.length)&&!!E[e(N)]}return Pn=L,Pn}var Mn,co;function lr(){if(co)return Mn;co=1;function e(r){return function(n){return r(n)}}return Mn=e,Mn}var Le={exports:{}};Le.exports;var ho;function Pu(){return ho||(ho=1,function(e,r){var n=hh(),t=r&&!r.nodeType&&r,a=t&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===t,u=i&&n.process,s=function(){try{var o=a&&a.require&&a.require("util").types;return o||u&&u.binding&&u.binding("util")}catch(c){}}();e.exports=s}(Le,Le.exports)),Le.exports}var Ln,lo;function Ue(){if(lo)return Ln;lo=1;var e=Wv(),r=lr(),n=Pu(),t=n&&n.isTypedArray,a=t?r(t):e;return Ln=a,Ln}var kn,vo;function ph(){if(vo)return kn;vo=1;var e=Kv(),r=$e(),n=k(),t=Se(),a=hr(),i=Ue(),u=Object.prototype,s=u.hasOwnProperty;function o(c,f){var d=n(c),h=!d&&r(c),l=!d&&!h&&t(c),p=!d&&!h&&!l&&i(c),v=d||h||l||p,_=v?e(c.length,String):[],g=_.length;for(var b in c)(f||s.call(c,b))&&!(v&&(b=="length"||l&&(b=="offset"||b=="parent")||p&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||a(b,g)))&&_.push(b);return _}return kn=o,kn}var Nn,po;function vr(){if(po)return Nn;po=1;var e=Object.prototype;function r(n){var t=n&&n.constructor,a=typeof t=="function"&&t.prototype||e;return n===a}return Nn=r,Nn}var Fn,_o;function _h(){if(_o)return Fn;_o=1;function e(r,n){return function(t){return r(n(t))}}return Fn=e,Fn}var jn,go;function Yv(){if(go)return jn;go=1;var e=_h(),r=e(Object.keys,Object);return jn=r,jn}var Dn,bo;function Mu(){if(bo)return Dn;bo=1;var e=vr(),r=Yv(),n=Object.prototype,t=n.hasOwnProperty;function a(i){if(!e(i))return r(i);var u=[];for(var s in Object(i))t.call(i,s)&&s!="constructor"&&u.push(s);return u}return Dn=a,Dn}var Gn,yo;function ae(){if(yo)return Gn;yo=1;var e=Ge(),r=xu();function n(t){return t!=null&&r(t.length)&&!e(t)}return Gn=n,Gn}var Bn,mo;function le(){if(mo)return Bn;mo=1;var e=ph(),r=Mu(),n=ae();function t(a){return n(a)?e(a):r(a)}return Bn=t,Bn}var $n,qo;function Xv(){if(qo)return $n;qo=1;var e=Be(),r=le();function n(t,a){return t&&e(a,r(a),t)}return $n=n,$n}var Un,wo;function Zv(){if(wo)return Un;wo=1;function e(r){var n=[];if(r!=null)for(var t in Object(r))n.push(t);return n}return Un=e,Un}var zn,Ro;function Jv(){if(Ro)return zn;Ro=1;var e=B(),r=vr(),n=Zv(),t=Object.prototype,a=t.hasOwnProperty;function i(u){if(!e(u))return n(u);var s=r(u),o=[];for(var c in u)c=="constructor"&&(s||!a.call(u,c))||o.push(c);return o}return zn=i,zn}var Kn,Eo;function ye(){if(Eo)return Kn;Eo=1;var e=ph(),r=Jv(),n=ae();function t(a){return n(a)?e(a,!0):r(a)}return Kn=t,Kn}var Vn,Io;function Qv(){if(Io)return Vn;Io=1;var e=Be(),r=ye();function n(t,a){return t&&e(a,r(a),t)}return Vn=n,Vn}var ke={exports:{}};ke.exports;var To;function gh(){return To||(To=1,function(e,r){var n=K(),t=r&&!r.nodeType&&r,a=t&&!0&&e&&!e.nodeType&&e,i=a&&a.exports===t,u=i?n.Buffer:void 0,s=u?u.allocUnsafe:void 0;function o(c,f){if(f)return c.slice();var d=c.length,h=s?s(d):new c.constructor(d);return c.copy(h),h}e.exports=o}(ke,ke.exports)),ke.exports}var Hn,Co;function bh(){if(Co)return Hn;Co=1;function e(r,n){var t=-1,a=r.length;for(n||(n=Array(a));++tl))return!1;var v=d.get(u),_=d.get(s);if(v&&_)return v==s&&_==u;var g=-1,b=!0,m=o&a?new e:void 0;for(d.set(u,s),d.set(s,u);++g0&&i(f)?a>1?n(f,a-1,i,u,s):e(s,f):u||(s[s.length]=f)}return s}return ja=n,ja}var Da,mc;function Xp(){if(mc)return Da;mc=1;function e(r,n,t){switch(t.length){case 0:return r.call(n);case 1:return r.call(n,t[0]);case 2:return r.call(n,t[0],t[1]);case 3:return r.call(n,t[0],t[1],t[2])}return r.apply(n,t)}return Da=e,Da}var Ga,qc;function Yh(){if(qc)return Ga;qc=1;var e=Xp(),r=Math.max;function n(t,a,i){return a=r(a===void 0?t.length-1:a,0),function(){for(var u=arguments,s=-1,o=r(u.length-a,0),c=Array(o);++s0){if(++i>=e)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return $a=t,$a}var Ua,Ec;function Xh(){if(Ec)return Ua;Ec=1;var e=Zp(),r=Jp(),n=r(e);return Ua=n,Ua}var za,Ic;function mr(){if(Ic)return za;Ic=1;var e=me(),r=Yh(),n=Xh();function t(a,i){return n(r(a,i,e),a+"")}return za=t,za}var Ka,Tc;function Zh(){if(Tc)return Ka;Tc=1;function e(r,n,t,a){for(var i=r.length,u=t+(a?1:-1);a?u--:++u-1}return Ya=r,Ya}var Xa,xc;function t_(){if(xc)return Xa;xc=1;function e(r,n,t){for(var a=-1,i=r==null?0:r.length;++a=u){var g=c?null:a(o);if(g)return i(g);p=!1,h=t,_=new e}else _=c?[]:v;e:for(;++d1?l.setNode(p,d):l.setNode(p)}),this},a.prototype.setNode=function(f,d){return e.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=d),this):(this._nodes[f]=arguments.length>1?d:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},a.prototype.node=function(f){return this._nodes[f]},a.prototype.hasNode=function(f){return e.has(this._nodes,f)},a.prototype.removeNode=function(f){var d=this;if(e.has(this._nodes,f)){var h=function(l){d.removeEdge(d._edgeObjs[l])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],e.each(this.children(f),function(l){d.setParent(l)}),delete this._children[f]),e.each(e.keys(this._in[f]),h),delete this._in[f],delete this._preds[f],e.each(e.keys(this._out[f]),h),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},a.prototype.setParent=function(f,d){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(d))d=n;else{d+="";for(var h=d;!e.isUndefined(h);h=this.parent(h))if(h===f)throw new Error("Setting "+d+" as parent of "+f+" would create a cycle");this.setNode(d)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=d,this._children[d][f]=!0,this},a.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},a.prototype.parent=function(f){if(this._isCompound){var d=this._parent[f];if(d!==n)return d}},a.prototype.children=function(f){if(e.isUndefined(f)&&(f=n),this._isCompound){var d=this._children[f];if(d)return e.keys(d)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},a.prototype.predecessors=function(f){var d=this._preds[f];if(d)return e.keys(d)},a.prototype.successors=function(f){var d=this._sucs[f];if(d)return e.keys(d)},a.prototype.neighbors=function(f){var d=this.predecessors(f);if(d)return e.union(d,this.successors(f))},a.prototype.isLeaf=function(f){var d;return this.isDirected()?d=this.successors(f):d=this.neighbors(f),d.length===0},a.prototype.filterNodes=function(f){var d=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});d.setGraph(this.graph());var h=this;e.each(this._nodes,function(v,_){f(_)&&d.setNode(_,v)}),e.each(this._edgeObjs,function(v){d.hasNode(v.v)&&d.hasNode(v.w)&&d.setEdge(v,h.edge(v))});var l={};function p(v){var _=h.parent(v);return _===void 0||d.hasNode(_)?(l[v]=_,_):_ in l?l[_]:p(_)}return this._isCompound&&e.each(d.nodes(),function(v){d.setParent(v,p(v))}),d},a.prototype.setDefaultEdgeLabel=function(f){return e.isFunction(f)||(f=e.constant(f)),this._defaultEdgeLabelFn=f,this},a.prototype.edgeCount=function(){return this._edgeCount},a.prototype.edges=function(){return e.values(this._edgeObjs)},a.prototype.setPath=function(f,d){var h=this,l=arguments;return e.reduce(f,function(p,v){return l.length>1?h.setEdge(p,v,d):h.setEdge(p,v),v}),this},a.prototype.setEdge=function(){var f,d,h,l,p=!1,v=arguments[0];typeof v=="object"&&v!==null&&"v"in v?(f=v.v,d=v.w,h=v.name,arguments.length===2&&(l=arguments[1],p=!0)):(f=v,d=arguments[1],h=arguments[3],arguments.length>2&&(l=arguments[2],p=!0)),f=""+f,d=""+d,e.isUndefined(h)||(h=""+h);var _=s(this._isDirected,f,d,h);if(e.has(this._edgeLabels,_))return p&&(this._edgeLabels[_]=l),this;if(!e.isUndefined(h)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(d),this._edgeLabels[_]=p?l:this._defaultEdgeLabelFn(f,d,h);var g=o(this._isDirected,f,d,h);return f=g.v,d=g.w,Object.freeze(g),this._edgeObjs[_]=g,i(this._preds[d],f),i(this._sucs[f],d),this._in[d][_]=g,this._out[f][_]=g,this._edgeCount++,this},a.prototype.edge=function(f,d,h){var l=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,f,d,h);return this._edgeLabels[l]},a.prototype.hasEdge=function(f,d,h){var l=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,f,d,h);return e.has(this._edgeLabels,l)},a.prototype.removeEdge=function(f,d,h){var l=arguments.length===1?c(this._isDirected,arguments[0]):s(this._isDirected,f,d,h),p=this._edgeObjs[l];return p&&(f=p.v,d=p.w,delete this._edgeLabels[l],delete this._edgeObjs[l],u(this._preds[d],f),u(this._sucs[f],d),delete this._in[d][l],delete this._out[f][l],this._edgeCount--),this},a.prototype.inEdges=function(f,d){var h=this._in[f];if(h){var l=e.values(h);return d?e.filter(l,function(p){return p.v===d}):l}},a.prototype.outEdges=function(f,d){var h=this._out[f];if(h){var l=e.values(h);return d?e.filter(l,function(p){return p.w===d}):l}},a.prototype.nodeEdges=function(f,d){var h=this.inEdges(f,d);if(h)return h.concat(this.outEdges(f,d))};function i(f,d){f[d]?f[d]++:f[d]=1}function u(f,d){--f[d]||delete f[d]}function s(f,d,h,l){var p=""+d,v=""+h;if(!f&&p>v){var _=p;p=v,v=_}return p+t+v+t+(e.isUndefined(l)?r:l)}function o(f,d,h,l){var p=""+d,v=""+h;if(!f&&p>v){var _=p;p=v,v=_}var g={v:p,w:v};return l&&(g.name=l),g}function c(f,d){return s(f,d.v,d.w,d.name)}return ii}var ui,Bc;function f_(){return Bc||(Bc=1,ui="2.1.8"),ui}var si,$c;function c_(){return $c||($c=1,si={Graph:Uu(),version:f_()}),si}var oi,Uc;function d_(){if(Uc)return oi;Uc=1;var e=$(),r=Uu();oi={write:n,read:i};function n(u){var s={options:{directed:u.isDirected(),multigraph:u.isMultigraph(),compound:u.isCompound()},nodes:t(u),edges:a(u)};return e.isUndefined(u.graph())||(s.value=e.clone(u.graph())),s}function t(u){return e.map(u.nodes(),function(s){var o=u.node(s),c=u.parent(s),f={v:s};return e.isUndefined(o)||(f.value=o),e.isUndefined(c)||(f.parent=c),f})}function a(u){return e.map(u.edges(),function(s){var o=u.edge(s),c={v:s.v,w:s.w};return e.isUndefined(s.name)||(c.name=s.name),e.isUndefined(o)||(c.value=o),c})}function i(u){var s=new r(u.options).setGraph(u.value);return e.each(u.nodes,function(o){s.setNode(o.v,o.value),o.parent&&s.setParent(o.v,o.parent)}),e.each(u.edges,function(o){s.setEdge({v:o.v,w:o.w,name:o.name},o.value)}),s}return oi}var fi,zc;function h_(){if(zc)return fi;zc=1;var e=$();fi=r;function r(n){var t={},a=[],i;function u(s){e.has(t,s)||(t[s]=!0,i.push(s),e.each(n.successors(s),u),e.each(n.predecessors(s),u))}return e.each(n.nodes(),function(s){i=[],u(s),i.length&&a.push(i)}),a}return fi}var ci,Kc;function el(){if(Kc)return ci;Kc=1;var e=$();ci=r;function r(){this._arr=[],this._keyIndices={}}return r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(n){return n.key})},r.prototype.has=function(n){return e.has(this._keyIndices,n)},r.prototype.priority=function(n){var t=this._keyIndices[n];if(t!==void 0)return this._arr[t].priority},r.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(n,t){var a=this._keyIndices;if(n=String(n),!e.has(a,n)){var i=this._arr,u=i.length;return a[n]=u,i.push({key:n,priority:t}),this._decrease(u),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},r.prototype.decrease=function(n,t){var a=this._keyIndices[n];if(t>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[a].priority+" New: "+t);this._arr[a].priority=t,this._decrease(a)},r.prototype._heapify=function(n){var t=this._arr,a=2*n,i=a+1,u=n;a>1,!(t[i].priority0&&(d=f.removeMin(),h=c[d],h.distance!==Number.POSITIVE_INFINITY);)o(d).forEach(l);return c}return di}var hi,Hc;function l_(){if(Hc)return hi;Hc=1;var e=rl(),r=$();hi=n;function n(t,a,i){return r.transform(t.nodes(),function(u,s){u[s]=e(t,s,a,i)},{})}return hi}var li,Wc;function nl(){if(Wc)return li;Wc=1;var e=$();li=r;function r(n){var t=0,a=[],i={},u=[];function s(o){var c=i[o]={onStack:!0,lowlink:t,index:t++};if(a.push(o),n.successors(o).forEach(function(h){e.has(i,h)?i[h].onStack&&(c.lowlink=Math.min(c.lowlink,i[h].index)):(s(h),c.lowlink=Math.min(c.lowlink,i[h].lowlink))}),c.lowlink===c.index){var f=[],d;do d=a.pop(),i[d].onStack=!1,f.push(d);while(o!==d);u.push(f)}}return n.nodes().forEach(function(o){e.has(i,o)||s(o)}),u}return li}var vi,Yc;function v_(){if(Yc)return vi;Yc=1;var e=$(),r=nl();vi=n;function n(t){return e.filter(r(t),function(a){return a.length>1||a.length===1&&t.hasEdge(a[0],a[0])})}return vi}var pi,Xc;function p_(){if(Xc)return pi;Xc=1;var e=$();pi=n;var r=e.constant(1);function n(a,i,u){return t(a,i||r,u||function(s){return a.outEdges(s)})}function t(a,i,u){var s={},o=a.nodes();return o.forEach(function(c){s[c]={},s[c][c]={distance:0},o.forEach(function(f){c!==f&&(s[c][f]={distance:Number.POSITIVE_INFINITY})}),u(c).forEach(function(f){var d=f.v===c?f.w:f.v,h=i(f);s[c][d]={distance:h,predecessor:c}})}),o.forEach(function(c){var f=s[c];o.forEach(function(d){var h=s[d];o.forEach(function(l){var p=h[c],v=f[l],_=h[l],g=p.distance+v.distance;g<_.distance&&(_.distance=g,_.predecessor=v.predecessor)})})}),s}return pi}var _i,Zc;function tl(){if(Zc)return _i;Zc=1;var e=$();_i=r,r.CycleException=n;function r(t){var a={},i={},u=[];function s(o){if(e.has(i,o))throw new n;e.has(a,o)||(i[o]=!0,a[o]=!0,e.each(t.predecessors(o),s),delete i[o],u.push(o))}if(e.each(t.sinks(),s),e.size(a)!==t.nodeCount())throw new n;return u}function n(){}return n.prototype=new Error,_i}var gi,Jc;function __(){if(Jc)return gi;Jc=1;var e=tl();gi=r;function r(n){try{e(n)}catch(t){if(t instanceof e.CycleException)return!1;throw t}return!0}return gi}var bi,Qc;function al(){if(Qc)return bi;Qc=1;var e=$();bi=r;function r(t,a,i){e.isArray(a)||(a=[a]);var u=(t.isDirected()?t.successors:t.neighbors).bind(t),s=[],o={};return e.each(a,function(c){if(!t.hasNode(c))throw new Error("Graph does not have node: "+c);n(t,c,i==="post",o,u,s)}),s}function n(t,a,i,u,s,o){e.has(u,a)||(u[a]=!0,i||o.push(a),e.each(s(a),function(c){n(t,c,i,u,s,o)}),i&&o.push(a))}return bi}var yi,ed;function g_(){if(ed)return yi;ed=1;var e=al();yi=r;function r(n,t){return e(n,t,"post")}return yi}var mi,rd;function b_(){if(rd)return mi;rd=1;var e=al();mi=r;function r(n,t){return e(n,t,"pre")}return mi}var qi,nd;function y_(){if(nd)return qi;nd=1;var e=$(),r=Uu(),n=el();qi=t;function t(a,i){var u=new r,s={},o=new n,c;function f(h){var l=h.v===c?h.w:h.v,p=o.priority(l);if(p!==void 0){var v=i(h);v0;){if(c=o.removeMin(),e.has(s,c))u.setEdge(c,s[c]);else{if(d)throw new Error("Input graph is not connected: "+a);d=!0}a.nodeEdges(c).forEach(f)}return u}return qi}var wi,td;function m_(){return td||(td=1,wi={components:h_(),dijkstra:rl(),dijkstraAll:l_(),findCycles:v_(),floydWarshall:p_(),isAcyclic:__(),postorder:g_(),preorder:b_(),prim:y_(),tarjan:nl(),topsort:tl()}),wi}var Ri,ad;function q_(){if(ad)return Ri;ad=1;var e=c_();return Ri={Graph:e.Graph,json:d_(),alg:m_(),version:e.version},Ri}var er;if(typeof Cu=="function")try{er=q_()}catch(e){}er||(er=window.graphlib);var V=er,Ei,id;function w_(){if(id)return Ei;id=1;var e=Sh(),r=1,n=4;function t(a){return e(a,r|n)}return Ei=t,Ei}var Ii,ud;function qr(){if(ud)return Ii;ud=1;var e=Ce(),r=ae(),n=hr(),t=B();function a(i,u,s){if(!t(s))return!1;var o=typeof u;return(o=="number"?r(s)&&n(u,s.length):o=="string"&&u in s)?e(s[u],i):!1}return Ii=a,Ii}var Ti,sd;function R_(){if(sd)return Ti;sd=1;var e=mr(),r=Ce(),n=qr(),t=ye(),a=Object.prototype,i=a.hasOwnProperty,u=e(function(s,o){s=Object(s);var c=-1,f=o.length,d=f>2?o[2]:void 0;for(d&&n(o[0],o[1],d)&&(f=1);++c-1?o[c?i[f]:f]:void 0}}return Ci=t,Ci}var Ai,fd;function I_(){if(fd)return Ai;fd=1;var e=/\s/;function r(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}return Ai=r,Ai}var Si,cd;function T_(){if(cd)return Si;cd=1;var e=I_(),r=/^\s+/;function n(t){return t&&t.slice(0,e(t)+1).replace(r,"")}return Si=n,Si}var Oi,dd;function C_(){if(dd)return Oi;dd=1;var e=T_(),r=B(),n=xe(),t=NaN,a=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,u=/^0o[0-7]+$/i,s=parseInt;function o(c){if(typeof c=="number")return c;if(n(c))return t;if(r(c)){var f=typeof c.valueOf=="function"?c.valueOf():c;c=r(f)?f+"":f}if(typeof c!="string")return c===0?c:+c;c=e(c);var d=i.test(c);return d||u.test(c)?s(c.slice(2),d?2:8):a.test(c)?t:+c}return Oi=o,Oi}var xi,hd;function il(){if(hd)return xi;hd=1;var e=C_(),r=1/0,n=17976931348623157e292;function t(a){if(!a)return a===0?a:0;if(a=e(a),a===r||a===-r){var i=a<0?-1:1;return i*n}return a===a?a:0}return xi=t,xi}var Pi,ld;function A_(){if(ld)return Pi;ld=1;var e=il();function r(n){var t=e(n),a=t%1;return t===t?a?t-a:t:0}return Pi=r,Pi}var Mi,vd;function S_(){if(vd)return Mi;vd=1;var e=Zh(),r=ie(),n=A_(),t=Math.max;function a(i,u,s){var o=i==null?0:i.length;if(!o)return-1;var c=s==null?0:n(s);return c<0&&(c=t(o+c,0)),e(i,r(u,3),c)}return Mi=a,Mi}var Li,pd;function O_(){if(pd)return Li;pd=1;var e=E_(),r=S_(),n=e(r);return Li=n,Li}var ki,_d;function ul(){if(_d)return ki;_d=1;var e=$u();function r(n){var t=n==null?0:n.length;return t?e(n,1):[]}return ki=r,ki}var Ni,gd;function x_(){if(gd)return Ni;gd=1;var e=ju(),r=Oh(),n=ye();function t(a,i){return a==null?a:e(a,r(i),n)}return Ni=t,Ni}var Fi,bd;function P_(){if(bd)return Fi;bd=1;function e(r){var n=r==null?0:r.length;return n?r[n-1]:void 0}return Fi=e,Fi}var ji,yd;function M_(){if(yd)return ji;yd=1;var e=cr(),r=Du(),n=ie();function t(a,i){var u={};return i=n(i,3),r(a,function(s,o,c){e(u,o,i(s,o,c))}),u}return ji=t,ji}var Di,md;function zu(){if(md)return Di;md=1;var e=xe();function r(n,t,a){for(var i=-1,u=n.length;++in}return Gi=e,Gi}var Bi,wd;function k_(){if(wd)return Bi;wd=1;var e=zu(),r=L_(),n=me();function t(a){return a&&a.length?e(a,n,r):void 0}return Bi=t,Bi}var $i,Rd;function sl(){if(Rd)return $i;Rd=1;var e=cr(),r=Ce();function n(t,a,i){(i!==void 0&&!r(t[a],i)||i===void 0&&!(a in t))&&e(t,a,i)}return $i=n,$i}var Ui,Ed;function N_(){if(Ed)return Ui;Ed=1;var e=ge(),r=pr(),n=Z(),t="[object Object]",a=Function.prototype,i=Object.prototype,u=a.toString,s=i.hasOwnProperty,o=u.call(Object);function c(f){if(!n(f)||e(f)!=t)return!1;var d=r(f);if(d===null)return!0;var h=s.call(d,"constructor")&&d.constructor;return typeof h=="function"&&h instanceof h&&u.call(h)==o}return Ui=c,Ui}var zi,Id;function ol(){if(Id)return zi;Id=1;function e(r,n){if(!(n==="constructor"&&typeof r[n]=="function")&&n!="__proto__")return r[n]}return zi=e,zi}var Ki,Td;function F_(){if(Td)return Ki;Td=1;var e=Be(),r=ye();function n(t){return e(t,r(t))}return Ki=n,Ki}var Vi,Cd;function j_(){if(Cd)return Vi;Cd=1;var e=sl(),r=gh(),n=Th(),t=bh(),a=Ah(),i=$e(),u=k(),s=Jh(),o=Se(),c=Ge(),f=B(),d=N_(),h=Ue(),l=ol(),p=F_();function v(_,g,b,m,w,C,q){var y=l(_,b),T=l(g,b),S=q.get(T);if(S){e(_,b,S);return}var x=C?C(y,T,b+"",_,g,q):void 0,E=x===void 0;if(E){var L=u(T),N=!L&&o(T),J=!L&&!N&&h(T);x=T,L||N||J?u(y)?x=y:s(y)?x=t(y):N?(E=!1,x=r(T,!0)):J?(E=!1,x=n(T,!0)):x=[]:d(T)||i(T)?(x=y,i(y)?x=p(y):(!f(y)||c(y))&&(x=a(T))):E=!1}E&&(q.set(T,x),w(x,T,m,C,q),q.delete(T)),e(_,b,x)}return Vi=v,Vi}var Hi,Ad;function D_(){if(Ad)return Hi;Ad=1;var e=fr(),r=sl(),n=ju(),t=j_(),a=B(),i=ye(),u=ol();function s(o,c,f,d,h){o!==c&&n(c,function(l,p){if(h||(h=new e),a(l))t(o,c,p,f,s,d,h);else{var v=d?d(u(o,p),l,p+"",o,c,h):void 0;v===void 0&&(v=l),r(o,p,v)}},i)}return Hi=s,Hi}var Wi,Sd;function G_(){if(Sd)return Wi;Sd=1;var e=mr(),r=qr();function n(t){return e(function(a,i){var u=-1,s=i.length,o=s>1?i[s-1]:void 0,c=s>2?i[2]:void 0;for(o=t.length>3&&typeof o=="function"?(s--,o):void 0,c&&r(i[0],i[1],c)&&(o=s<3?void 0:o,s=1),a=Object(a);++ut||s&&o&&f&&!c&&!d||i&&o&&f||!a&&f||!u)return 1;if(!i&&!s&&!d&&n=c)return f;var d=a[i];return f*(d=="desc"?-1:1)}}return n.index-t.index}return cu=r,cu}var du,Vd;function ng(){if(Vd)return du;Vd=1;var e=gr(),r=yr(),n=ie(),t=Vh(),a=Q_(),i=lr(),u=rg(),s=me(),o=k();function c(f,d,h){d.length?d=e(d,function(v){return o(v)?function(_){return r(_,v.length===1?v[0]:v)}:v}):d=[s];var l=-1;d=e(d,i(n));var p=t(f,function(v,_,g){var b=e(d,function(m){return m(v)});return{criteria:b,index:++l,value:v}});return a(p,function(v,_){return u(v,_,h)})}return du=c,du}var hu,Hd;function tg(){if(Hd)return hu;Hd=1;var e=$u(),r=ng(),n=mr(),t=qr(),a=n(function(i,u){if(i==null)return[];var s=u.length;return s>1&&t(i,u[0],u[1])?u=[]:s>2&&t(u[0],u[1],u[2])&&(u=[u[0]]),r(i,e(u,1),[])});return hu=a,hu}var lu,Wd;function ag(){if(Wd)return lu;Wd=1;var e=Dh(),r=0;function n(t){var a=++r;return e(t)+a}return lu=n,lu}var vu,Yd;function ig(){if(Yd)return vu;Yd=1;function e(r,n,t){for(var a=-1,i=r.length,u=n.length,s={};++a0;--s)if(u=r[s].dequeue(),u){t=t.concat(_u(e,r,n,u,!0));break}}}return t}function _u(e,r,n,t,a){var i=a?[]:void 0;return re.forEach(e.inEdges(t.v),function(u){var s=e.edge(u),o=e.node(u.v);a&&i.push({v:u.v,w:u.w}),o.out-=s,Eu(r,n,o)}),re.forEach(e.outEdges(t.v),function(u){var s=e.edge(u),o=u.w,c=e.node(o);c.in-=s,Eu(r,n,c)}),e.removeNode(t.v),i}function pg(e,r){var n=new fg,t=0,a=0;re.forEach(e.nodes(),function(s){n.setNode(s,{v:s,in:0,out:0})}),re.forEach(e.edges(),function(s){var o=n.edge(s.v,s.w)||0,c=r(s),f=o+c;n.setEdge(s.v,s.w,f),a=Math.max(a,n.node(s.v).out+=c),t=Math.max(t,n.node(s.w).in+=c)});var i=re.range(a+t+3).map(function(){return new cg}),u=t+1;return re.forEach(n.nodes(),function(s){Eu(i,u,n.node(s))}),{graph:n,buckets:i,zeroIdx:u}}function Eu(e,r,n){n.out?n.in?e[n.out-n.in+r].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}var _e=M,_g=dg,gg={run:bg,undo:mg};function bg(e){var r=e.graph().acyclicer==="greedy"?_g(e,n(e)):yg(e);_e.forEach(r,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,_e.uniqueId("rev"))});function n(t){return function(a){return t.edge(a).weight}}}function yg(e){var r=[],n={},t={};function a(i){_e.has(t,i)||(t[i]=!0,n[i]=!0,_e.forEach(e.outEdges(i),function(u){_e.has(n,u.w)?r.push(u):a(u.w)}),delete n[i])}return _e.forEach(e.nodes(),a),r}function mg(e){_e.forEach(e.edges(),function(r){var n=e.edge(r);if(n.reversed){e.removeEdge(r);var t=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(r.w,r.v,n,t)}})}var A=M,dl=V.Graph,j={addDummyNode:hl,simplify:qg,asNonCompoundGraph:wg,successorWeights:Rg,predecessorWeights:Eg,intersectRect:Ig,buildLayerMatrix:Tg,normalizeRanks:Cg,removeEmptyRanks:Ag,addBorderNode:Sg,maxRank:ll,partition:Og,time:xg,notime:Pg};function hl(e,r,n,t){var a;do a=A.uniqueId(t);while(e.hasNode(a));return n.dummy=r,e.setNode(a,n),a}function qg(e){var r=new dl().setGraph(e.graph());return A.forEach(e.nodes(),function(n){r.setNode(n,e.node(n))}),A.forEach(e.edges(),function(n){var t=r.edge(n.v,n.w)||{weight:0,minlen:1},a=e.edge(n);r.setEdge(n.v,n.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),r}function wg(e){var r=new dl({multigraph:e.isMultigraph()}).setGraph(e.graph());return A.forEach(e.nodes(),function(n){e.children(n).length||r.setNode(n,e.node(n))}),A.forEach(e.edges(),function(n){r.setEdge(n,e.edge(n))}),r}function Rg(e){var r=A.map(e.nodes(),function(n){var t={};return A.forEach(e.outEdges(n),function(a){t[a.w]=(t[a.w]||0)+e.edge(a).weight}),t});return A.zipObject(e.nodes(),r)}function Eg(e){var r=A.map(e.nodes(),function(n){var t={};return A.forEach(e.inEdges(n),function(a){t[a.v]=(t[a.v]||0)+e.edge(a).weight}),t});return A.zipObject(e.nodes(),r)}function Ig(e,r){var n=e.x,t=e.y,a=r.x-n,i=r.y-t,u=e.width/2,s=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var o,c;return Math.abs(i)*u>Math.abs(a)*s?(i<0&&(s=-s),o=s*a/i,c=s):(a<0&&(u=-u),o=u,c=u*i/a),{x:n+o,y:t+c}}function Tg(e){var r=A.map(A.range(ll(e)+1),function(){return[]});return A.forEach(e.nodes(),function(n){var t=e.node(n),a=t.rank;A.isUndefined(a)||(r[a][t.order]=n)}),r}function Cg(e){var r=A.min(A.map(e.nodes(),function(n){return e.node(n).rank}));A.forEach(e.nodes(),function(n){var t=e.node(n);A.has(t,"rank")&&(t.rank-=r)})}function Ag(e){var r=A.min(A.map(e.nodes(),function(i){return e.node(i).rank})),n=[];A.forEach(e.nodes(),function(i){var u=e.node(i).rank-r;n[u]||(n[u]=[]),n[u].push(i)});var t=0,a=e.graph().nodeRankFactor;A.forEach(n,function(i,u){A.isUndefined(i)&&u%a!==0?--t:t&&A.forEach(i,function(s){e.node(s).rank+=t})})}function Sg(e,r,n,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=n,a.order=t),hl(e,"border",a,r)}function ll(e){return A.max(A.map(e.nodes(),function(r){var n=e.node(r).rank;if(!A.isUndefined(n))return n}))}function Og(e,r){var n={lhs:[],rhs:[]};return A.forEach(e,function(t){r(t)?n.lhs.push(t):n.rhs.push(t)}),n}function xg(e,r){var n=A.now();try{return r()}finally{console.log(e+" time: "+(A.now()-n)+"ms")}}function Pg(e,r){return r()}var vl=M,Mg=j,Lg={run:kg,undo:Fg};function kg(e){e.graph().dummyChains=[],vl.forEach(e.edges(),function(r){Ng(e,r)})}function Ng(e,r){var n=r.v,t=e.node(n).rank,a=r.w,i=e.node(a).rank,u=r.name,s=e.edge(r),o=s.labelRank;if(i!==t+1){e.removeEdge(r);var c,f,d;for(d=0,++t;tu.lim&&(s=u,o=!0);var c=te.filter(r.edges(),function(f){return o===Zd(e,e.node(f.v),s)&&o!==Zd(e,e.node(f.w),s)});return te.minBy(c,function(f){return Vg(r,f)})}function ml(e,r,n,t){var a=n.v,i=n.w;e.removeEdge(a,i),e.setEdge(t.v,t.w,{}),Vu(e),Ku(e,r),Qg(e,r)}function Qg(e,r){var n=te.find(e.nodes(),function(a){return!r.node(a).parent}),t=Wg(e,n);t=t.slice(1),te.forEach(t,function(a){var i=e.node(a).parent,u=r.edge(a,i),s=!1;u||(u=r.edge(i,a),s=!0),r.node(a).rank=r.node(i).rank+(s?u.minlen:-u.minlen)})}function eb(e,r,n){return e.hasEdge(r,n)}function Zd(e,r,n){return n.low<=r.lim&&r.lim<=n.lim}var rb=Rr,ql=rb.longestPath,nb=pl,tb=Zg,ab=ib;function ib(e){switch(e.graph().ranker){case"network-simplex":Jd(e);break;case"tight-tree":sb(e);break;case"longest-path":ub(e);break;default:Jd(e)}}var ub=ql;function sb(e){ql(e),nb(e)}function Jd(e){tb(e)}var Iu=M,ob=fb;function fb(e){var r=db(e);Iu.forEach(e.graph().dummyChains,function(n){for(var t=e.node(n),a=t.edgeObj,i=cb(e,r,a.v,a.w),u=i.path,s=i.lca,o=0,c=u[o],f=!0;n!==a.w;){if(t=e.node(n),f){for(;(c=u[o])!==s&&e.node(c).maxRanku||s>r[o].lim));for(c=o,o=t;(o=e.parent(o))!==c;)i.push(o);return{path:a.concat(i.reverse()),lca:c}}function db(e){var r={},n=0;function t(a){var i=n;Iu.forEach(e.children(a),t),r[a]={low:i,lim:n++}}return Iu.forEach(e.children(),t),r}var ne=M,Tu=j,hb={run:lb,cleanup:_b};function lb(e){var r=Tu.addDummyNode(e,"root",{},"_root"),n=vb(e),t=ne.max(ne.values(n))-1,a=2*t+1;e.graph().nestingRoot=r,ne.forEach(e.edges(),function(u){e.edge(u).minlen*=a});var i=pb(e)+1;ne.forEach(e.children(),function(u){wl(e,r,a,i,t,n,u)}),e.graph().nodeRankFactor=a}function wl(e,r,n,t,a,i,u){var s=e.children(u);if(!s.length){u!==r&&e.setEdge(r,u,{weight:0,minlen:n});return}var o=Tu.addBorderNode(e,"_bt"),c=Tu.addBorderNode(e,"_bb"),f=e.node(u);e.setParent(o,u),f.borderTop=o,e.setParent(c,u),f.borderBottom=c,ne.forEach(s,function(d){wl(e,r,n,t,a,i,d);var h=e.node(d),l=h.borderTop?h.borderTop:d,p=h.borderBottom?h.borderBottom:d,v=h.borderTop?t:2*t,_=l!==p?1:a-i[u]+1;e.setEdge(o,l,{weight:v,minlen:_,nestingEdge:!0}),e.setEdge(p,c,{weight:v,minlen:_,nestingEdge:!0})}),e.parent(u)||e.setEdge(r,o,{weight:0,minlen:a+i[u]})}function vb(e){var r={};function n(t,a){var i=e.children(t);i&&i.length&&ne.forEach(i,function(u){n(u,a+1)}),r[t]=a}return ne.forEach(e.children(),function(t){n(t,1)}),r}function pb(e){return ne.reduce(e.edges(),function(r,n){return r+e.edge(n).weight},0)}function _b(e){var r=e.graph();e.removeNode(r.nestingRoot),delete r.nestingRoot,ne.forEach(e.edges(),function(n){var t=e.edge(n);t.nestingEdge&&e.removeEdge(n)})}var gu=M,gb=j,bb=yb;function yb(e){function r(n){var t=e.children(n),a=e.node(n);if(t.length&&gu.forEach(t,r),gu.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,u=a.maxRank+1;i0;)f%2&&(d+=s[f+1]),f=f-1>>1,s[f]+=c.weight;o+=c.weight*d})),o}var rh=M,Ob=xb;function xb(e,r){return rh.map(r,function(n){var t=e.inEdges(n);if(t.length){var a=rh.reduce(t,function(i,u){var s=e.edge(u),o=e.node(u.v);return{sum:i.sum+s.weight*o.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:n}})}var G=M,Pb=Mb;function Mb(e,r){var n={};G.forEach(e,function(a,i){var u=n[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};G.isUndefined(a.barycenter)||(u.barycenter=a.barycenter,u.weight=a.weight)}),G.forEach(r.edges(),function(a){var i=n[a.v],u=n[a.w];!G.isUndefined(i)&&!G.isUndefined(u)&&(u.indegree++,i.out.push(n[a.w]))});var t=G.filter(n,function(a){return!a.indegree});return Lb(t)}function Lb(e){var r=[];function n(i){return function(u){u.merged||(G.isUndefined(u.barycenter)||G.isUndefined(i.barycenter)||u.barycenter>=i.barycenter)&&kb(i,u)}}function t(i){return function(u){u.in.push(i),--u.indegree===0&&e.push(u)}}for(;e.length;){var a=e.pop();r.push(a),G.forEach(a.in.reverse(),n(a)),G.forEach(a.out,t(a))}return G.map(G.filter(r,function(i){return!i.merged}),function(i){return G.pick(i,["vs","i","barycenter","weight"])})}function kb(e,r){var n=0,t=0;e.weight&&(n+=e.barycenter*e.weight,t+=e.weight),r.weight&&(n+=r.barycenter*r.weight,t+=r.weight),e.vs=r.vs.concat(e.vs),e.barycenter=n/t,e.weight=t,e.i=Math.min(r.i,e.i),r.merged=!0}var Ne=M,Nb=j,Fb=jb;function jb(e,r){var n=Nb.partition(e,function(f){return Ne.has(f,"barycenter")}),t=n.lhs,a=Ne.sortBy(n.rhs,function(f){return-f.i}),i=[],u=0,s=0,o=0;t.sort(Db(!!r)),o=nh(i,a,o),Ne.forEach(t,function(f){o+=f.vs.length,i.push(f.vs),u+=f.barycenter*f.weight,s+=f.weight,o=nh(i,a,o)});var c={vs:Ne.flatten(i,!0)};return s&&(c.barycenter=u/s,c.weight=s),c}function nh(e,r,n){for(var t;r.length&&(t=Ne.last(r)).i<=n;)r.pop(),e.push(t.vs),n++;return n}function Db(e){return function(r,n){return r.barycentern.barycenter?1:e?n.i-r.i:r.i-n.i}}var fe=M,Gb=Ob,Bb=Pb,$b=Fb,Ub=El;function El(e,r,n,t){var a=e.children(r),i=e.node(r),u=i?i.borderLeft:void 0,s=i?i.borderRight:void 0,o={};u&&(a=fe.filter(a,function(p){return p!==u&&p!==s}));var c=Gb(e,a);fe.forEach(c,function(p){if(e.children(p.v).length){var v=El(e,p.v,n,t);o[p.v]=v,fe.has(v,"barycenter")&&Kb(p,v)}});var f=Bb(c,n);zb(f,o);var d=$b(f,t);if(u&&(d.vs=fe.flatten([u,d.vs,s],!0),e.predecessors(u).length)){var h=e.node(e.predecessors(u)[0]),l=e.node(e.predecessors(s)[0]);fe.has(d,"barycenter")||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+h.order+l.order)/(d.weight+2),d.weight+=2}return d}function zb(e,r){fe.forEach(e,function(n){n.vs=fe.flatten(n.vs.map(function(t){return r[t]?r[t].vs:t}),!0)})}function Kb(e,r){fe.isUndefined(e.barycenter)?(e.barycenter=r.barycenter,e.weight=r.weight):(e.barycenter=(e.barycenter*e.weight+r.barycenter*r.weight)/(e.weight+r.weight),e.weight+=r.weight)}var Fe=M,Vb=V.Graph,Hb=Wb;function Wb(e,r,n){var t=Yb(e),a=new Vb({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(i){return e.node(i)});return Fe.forEach(e.nodes(),function(i){var u=e.node(i),s=e.parent(i);(u.rank===r||u.minRank<=r&&r<=u.maxRank)&&(a.setNode(i),a.setParent(i,s||t),Fe.forEach(e[n](i),function(o){var c=o.v===i?o.w:o.v,f=a.edge(c,i),d=Fe.isUndefined(f)?0:f.weight;a.setEdge(c,i,{weight:e.edge(o).weight+d})}),Fe.has(u,"minRank")&&a.setNode(i,{borderLeft:u.borderLeft[r],borderRight:u.borderRight[r]}))}),a}function Yb(e){for(var r;e.hasNode(r=Fe.uniqueId("_root")););return r}var Xb=M,Zb=Jb;function Jb(e,r,n){var t={},a;Xb.forEach(n,function(i){for(var u=e.parent(i),s,o;u;){if(s=e.parent(u),s?(o=t[s],t[s]=u):(o=a,a=u),o&&o!==u){r.setEdge(o,u);return}u=s}})}var de=M,Qb=Ib,ey=Cb,ry=Ub,ny=Hb,ty=Zb,ay=V.Graph,th=j,iy=uy;function uy(e){var r=th.maxRank(e),n=ah(e,de.range(1,r+1),"inEdges"),t=ah(e,de.range(r-1,-1,-1),"outEdges"),a=Qb(e);ih(e,a);for(var i=Number.POSITIVE_INFINITY,u,s=0,o=0;o<4;++s,++o){sy(s%2?n:t,s%4>=2),a=th.buildLayerMatrix(e);var c=ey(e,a);cc)&&Hu(n,h,f)})})}function a(i,u){var s=-1,o,c=0;return R.forEach(u,function(f,d){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(o=e.node(h[0]).order,t(u,c,d,s,o),c=d,s=o)}t(u,c,u.length,o,i.length)}),u}return R.reduce(r,a),n}function dy(e,r){if(e.node(r).dummy)return R.find(e.predecessors(r),function(n){return e.node(n).dummy})}function Hu(e,r,n){if(r>n){var t=r;r=n,n=t}var a=e[r];a||(e[r]=a={}),a[n]=!0}function Cl(e,r,n){if(r>n){var t=r;r=n,n=t}return R.has(e[r],n)}function Al(e,r,n,t){var a={},i={},u={};return R.forEach(r,function(s){R.forEach(s,function(o,c){a[o]=o,i[o]=o,u[o]=c})}),R.forEach(r,function(s){var o=-1;R.forEach(s,function(c){var f=t(c);if(f.length){f=R.sortBy(f,function(v){return u[v]});for(var d=(f.length-1)/2,h=Math.floor(d),l=Math.ceil(d);h<=l;++h){var p=f[h];i[c]===c&&o({}));const o=u==="LR";s.setGraph({rankdir:u}),n.value=u;for(const c of a){const f=e(c.id);s.setNode(c.id,{width:f.dimensions.width||150,height:f.dimensions.height||50})}for(const c of i)s.setEdge(c.source,c.target);return wu.layout(s),a.map(c=>{const f=s.node(c.id);return Tr(Ir({},c),{targetPosition:o?Ze.Left:Ze.Top,sourcePosition:o?Ze.Right:Ze.Bottom,position:{x:f.x,y:f.y}})})}return{graph:r,layout:t,previousDirection:n}}function um(e){for(let r=e.length-1;r>0;r--){const n=Math.floor(Math.random()*(r+1));[e[r],e[n]]=[e[n],e[r]]}}function sm(e){const r=[];for(const n of e)for(const t of e)if(n.id!==t.id){const a=`e${n.id}-${t.id}`;r.push({id:a,source:n.id,target:t.id,type:"animation",animated:!0})}return r}function om(){return e=>{const r=sm(e);um(r);const n=new Set,t=[];for(const a of r)!n.has(a.target)&&(n.size===0||n.has(a.source))&&(t.push(a),n.add(a.source),n.add(a.target));return t}}function fm({graph:e,cancelOnError:r=!0}){const{updateNodeData:n,getConnectedEdges:t}=ar(),a=Ru(()=>rs(e)),i=Te(!1),u=new Set,s=new Map,o=new Set;function c(v,_=!1){return Q(this,null,function*(){if(u.has(v.id))return;o.add(v.id);const g=t(v.id).filter(m=>m.target===v.id);if(yield Promise.all(g.map(m=>cm(()=>!m.data.isAnimating))),o.clear(),!i.value)return;u.add(v.id),n(v.id,{isRunning:!0,isFinished:!1,hasError:!1,isCancelled:!1});const b=Math.floor(Math.random()*2e3)+1e3;return new Promise(m=>{const w=setTimeout(()=>Q(this,null,function*(){const C=a.value.successors(v.id),q=Math.random()<.15;if(!_&&q&&(n(v.id,{isRunning:!1,hasError:!0}),rs(r))){yield h(v.id),s.delete(v.id),m();return}n(v.id,{isRunning:!1,isFinished:!0}),s.delete(v.id),C.length>0&&(yield Promise.all(C.map(y=>c({id:y})))),m()}),_?0:b);s.set(v.id,w)})})}function f(v){return Q(this,null,function*(){if(i.value)return;d(v),i.value=!0;const _=v.filter(g=>{var b;return((b=a.value.predecessors(g.id))==null?void 0:b.length)===0});yield Promise.all(_.map(g=>c(g,!0))),p()})}function d(v){p();for(const _ of v)n(_.id,{isRunning:!1,isFinished:!1,hasError:!1,isSkipped:!1,isCancelled:!1})}function h(v){return Q(this,null,function*(){const _=a.value.successors(v);for(const g of _)n(g,{isRunning:!1,isSkipped:!0}),yield h(g)})}function l(){return Q(this,null,function*(){i.value=!1;for(const v of o)clearTimeout(s.get(v)),s.delete(v),n(v,{isRunning:!1,isFinished:!1,hasError:!1,isSkipped:!1,isCancelled:!0}),yield h(v);for(const[v,_]of s)clearTimeout(_),s.delete(v),n(v,{isRunning:!1,isFinished:!1,hasError:!1,isSkipped:!1,isCancelled:!0}),yield h(v);u.clear(),o.clear()})}function p(){i.value=!1,u.clear(),s.clear()}return{run:f,stop:l,reset:d,isRunning:i}}function cm(e){return Q(this,null,function*(){return new Promise(r=>{const n=setInterval(()=>{e()&&(clearInterval(n),r())},100)})})}var Y=(e=>(e.Lines="lines",e.Dots="dots",e))(Y||{});const Ll=function({dimensions:e,size:r,color:n}){return dh("path",{stroke:n,"stroke-width":r,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},kl=function({radius:e,color:r}){return dh("circle",{cx:e,cy:e,r:e,fill:r})};Y.Lines+"",Y.Dots+"";const dm={[Y.Dots]:"#81818a",[Y.Lines]:"#eee"},hm=["id","x","y","width","height","patternTransform"],lm={key:2,height:"100",width:"100"},vm=["fill"],pm=["x","y","fill"],_m={name:"Background",compatConfig:{MODE:3}},gm=ch(Tr(Ir({},_m),{props:{id:{},variant:{default:()=>Y.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:2}},setup(e){const{id:r,viewport:n}=ar(),t=ov(()=>{const[u,s]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],o=[u*n.value.zoom||1,s*n.value.zoom||1],c=e.size*n.value.zoom,f=e.variant===Y.Dots?[c/e.offset,c/e.offset]:[o[0]/e.offset,o[1]/e.offset];return{scaledGap:o,offset:f,size:c}}),a=Ru(()=>`pattern-${r}${e.id?`-${e.id}`:""}`),i=Ru(()=>e.color||e.patternColor||dm[e.variant||Y.Dots]);return(u,s)=>(pe(),De("svg",{class:"vue-flow__background vue-flow__container",style:fv({height:`${u.height>100?100:u.height}%`,width:`${u.width>100?100:u.width}%`})},[Cr(u.$slots,"pattern-container",{id:a.value},()=>[ce("pattern",{id:a.value,x:D(n).x%t.value.scaledGap[0],y:D(n).y%t.value.scaledGap[1],width:t.value.scaledGap[0],height:t.value.scaledGap[1],patternTransform:`translate(-${t.value.offset[0]},-${t.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[Cr(u.$slots,"pattern",{},()=>[u.variant===D(Y).Lines?(pe(),ns(D(Ll),{key:0,size:u.lineWidth,color:i.value,dimensions:t.value.scaledGap},null,8,["size","color","dimensions"])):u.variant===D(Y).Dots?(pe(),ns(D(kl),{key:1,color:i.value,radius:t.value.size/u.offset},null,8,["color","radius"])):ts("",!0),u.bgColor?(pe(),De("svg",lm,[ce("rect",{width:"100%",height:"100%",fill:u.bgColor},null,8,vm)])):ts("",!0)])],8,hm)]),ce("rect",{x:u.x,y:u.y,width:"100%",height:"100%",fill:`url(#${a.value})`},null,8,pm),Cr(u.$slots,"default",{id:a.value})],4))}})),U={x:0,y:0},z="process",W="animation",bm=[{id:"1",position:U,type:z},{id:"2",position:U,type:z},{id:"2a",position:U,type:z},{id:"2b",position:U,type:z},{id:"2c",position:U,type:z},{id:"2d",position:U,type:z},{id:"3",position:U,type:z},{id:"4",position:U,type:z},{id:"5",position:U,type:z},{id:"6",position:U,type:z},{id:"7",position:U,type:z}],ym=[{id:"e1-2",source:"1",target:"2",type:W,animated:!0},{id:"e1-3",source:"1",target:"3",type:W,animated:!0},{id:"e2-2a",source:"2",target:"2a",type:W,animated:!0},{id:"e2-2b",source:"2",target:"2b",type:W,animated:!0},{id:"e2-2c",source:"2",target:"2c",type:W,animated:!0},{id:"e2c-2d",source:"2c",target:"2d",type:W,animated:!0},{id:"e3-7",source:"3",target:"4",type:W,animated:!0},{id:"e4-5",source:"4",target:"5",type:W,animated:!0},{id:"e5-6",source:"5",target:"6",type:W,animated:!0},{id:"e5-7",source:"5",target:"7",type:W,animated:!0}],mm=e=>(cv("data-v-6094ddc5"),e=e(),dv(),e),qm={class:"layout-flow"},wm={class:"layout-panel"},Rm=mm(()=>ce("span",{class:"spinner"},null,-1)),Em=ch({__name:"index",setup(e){const r=Te(bm),n=Te(ym),t=Te(!0),a=om(),{graph:i,layout:u,previousDirection:s}=im(),{run:o,stop:c,reset:f,isRunning:d}=fm({graph:i,cancelOnError:t}),{fitView:h}=ar();function l(){return Q(this,null,function*(){yield c(),f(r.value),n.value=a(r.value),as(()=>{p(s.value)})})}function p(v){return Q(this,null,function*(){yield c(),f(r.value),r.value=u(r.value,n.value,v),as(()=>{h(),o(r.value)})})}return(v,_)=>(pe(),De("div",qm,[H(D(vv),{nodes:r.value,edges:n.value,onNodesInitialized:_[4]||(_[4]=g=>p("LR"))},{"node-process":Xe(g=>[H(pv,{data:g.data,"source-position":g.sourcePosition,"target-position":g.targetPosition},null,8,["data","source-position","target-position"])]),"edge-animation":Xe(g=>[H(_v,{id:g.id,source:g.source,target:g.target,"source-x":g.sourceX,"source-y":g.sourceY,targetX:g.targetX,targetY:g.targetY,"source-position":g.sourcePosition,"target-position":g.targetPosition},null,8,["id","source","target","source-x","source-y","targetX","targetY","source-position","target-position"])]),default:Xe(()=>[H(D(gm)),H(D(lv),{class:"process-panel",position:"top-left"},{default:Xe(()=>[ce("div",wm,[D(d)?(pe(),De("button",{key:0,class:"stop-btn",title:"stop",onClick:_[0]||(_[0]=(...g)=>D(c)&&D(c)(...g))},[H(Pe,{name:"stop"}),Rm])):(pe(),De("button",{key:1,title:"start",onClick:_[1]||(_[1]=g=>D(o)(r.value))},[H(Pe,{name:"play"})])),ce("button",{title:"set horizontal layout",onClick:_[2]||(_[2]=g=>p("LR"))},[H(Pe,{name:"horizontal"})]),ce("button",{title:"set vertical layout",onClick:_[3]||(_[3]=g=>p("TB"))},[H(Pe,{name:"vertical"})]),ce("button",{title:"shuffle graph",onClick:l},[H(Pe,{name:"shuffle"})])])]),_:1})]),_:1},8,["nodes","edges"])]))}}),Pm=hv(Em,[["__scopeId","data-v-6094ddc5"]]);export{Pm as default};