veoflow 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/veoflow.mjs +1 -1
- package/dist/veo.mjs +1631 -487
- package/native/veo-extract.darwin-arm64.node +0 -0
- package/native/veo-extract.darwin-x64.node +0 -0
- package/native/veo-extract.linux-arm64-gnu.node +0 -0
- package/native/veo-extract.linux-x64-gnu.node +0 -0
- package/native/veo-extract.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
- package/web/assets/{callLayout.worker-BugXMtxI.js → callLayout.worker-Bq-i56H_.js} +1 -1
- package/web/assets/index-DLPLxvCf.js +342 -0
- package/web/assets/index-Dsixf95A.css +1 -0
- package/web/index.html +2 -2
- package/web/assets/index-BsdwON5l.js +0 -340
- package/web/assets/index-DNTJe1b0.css +0 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -345,4 +345,4 @@ var Tu=function(){function e(e){return-e.tension*e.x-e.friction*e.v}function t(t
|
|
|
345
345
|
function Qh(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function $h(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(!n){if(Array.isArray(e)||(n=tg(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
346
346
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||n.return==null||n.return()}finally{if(s)throw a}}}}function eg(e){"@babel/helpers - typeof";return eg=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},eg(e)}function tg(e,t){if(e){if(typeof e==`string`)return Qh(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qh(e,t):void 0}}var ng={nodeSep:void 0,edgeSep:void 0,rankSep:void 0,rankDir:void 0,align:void 0,acyclicer:void 0,ranker:void 0,minLen:function(e){return 1},edgeWeight:function(e){return 1},fit:!0,padding:30,spacingFactor:void 0,nodeDimensionsIncludeLabels:!1,useDagreEdgeControlPoints:!1,automaticDagreEdgeStyle:!1,dagreEdgeStyle:{"curve-style":`unbundled-bezier`,"control-point-weights":function(e){return e.scratch(`controlPointWeights`)},"control-point-distances":function(e){return e.scratch(`controlPointDistances`)},"edge-distances":`intersection`,"edge-ends-overlap":!1},animate:!1,animateFilter:function(e,t){return!0},animationDuration:500,animationEasing:void 0,boundingBox:void 0,transform:function(e,t){return t},ready:function(){},sort:void 0,stop:function(){}},rg=Object.assign==null?function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return n.forEach(function(t){Object.keys(t).forEach(function(n){return e[n]=t[n]})}),e}:Object.assign.bind(Object),ig=Object.defineProperty,ag=(e,t,n)=>t in e?ig(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,og=(e,t)=>{for(var n in t)ig(e,n,{get:t[n],enumerable:!0})},sg=(e,t,n)=>ag(e,t+``,n),cg={};og(cg,{Graph:()=>dg,alg:()=>Cg,json:()=>vg,version:()=>_g});var lg=Object.defineProperty,ug=(e,t)=>{for(var n in t)lg(e,n,{get:t[n],enumerable:!0})},dg=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let t of this.successors(e))n.add(t);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=mg(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=hg(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,fg(this._preds[a],i),fg(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?gg(this._isDirected,e):mg(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r==`object`?r:{label:r}}hasEdge(e,t,n){return(arguments.length===1?gg(this._isDirected,e):mg(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?gg(this._isDirected,e):mg(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],pg(this._preds[t],e),pg(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function fg(e,t){e[t]?e[t]++:e[t]=1}function pg(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function mg(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function hg(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function gg(e,t){return mg(e,t.v,t.w,t.name)}var _g=`4.0.1`,vg={};ug(vg,{read:()=>Sg,write:()=>yg});function yg(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:bg(e),edges:xg(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function bg(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function xg(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Sg(e){let t=new dg(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var Cg={};ug(Cg,{CycleException:()=>Rg,bellmanFord:()=>Tg,components:()=>Dg,dijkstra:()=>Ag,dijkstraAll:()=>Mg,findCycles:()=>Pg,floydWarshall:()=>Ig,isAcyclic:()=>Bg,postorder:()=>Wg,preorder:()=>Gg,prim:()=>Kg,shortestPaths:()=>qg,tarjan:()=>Ng,topsort:()=>zg});var wg=()=>1;function Tg(e,t,n,r){return Eg(e,String(t),n||wg,r||function(t){return e.outEdges(t)})}function Eg(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=n(e);i[e.v].distance+t<i[e.w].distance&&(i[e.w]={distance:i[e.v].distance+t,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function Dg(e){let t={},n=[],r;function i(n){n in t||(t[n]=!0,r.push(n),e.successors(n).forEach(i),e.predecessors(n).forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var Og=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},kg=()=>1;function Ag(e,t,n,r){return jg(e,String(t),n||kg,r||function(t){return e.outEdges(t)})}function jg(e,t,n,r){let i={},a=new Og,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t],c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0&&(o=a.removeMin(),s=i[o],s.distance!==1/0);)r(o).forEach(c);return i}function Mg(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=Ag(e,i,t,n),r},{})}function Ng(e){let t=0,n=[],r={},i=[];function a(o){let s=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),e.successors(o).forEach(function(e){e in r?r[e].onStack&&(s.lowlink=Math.min(s.lowlink,r[e].index)):(a(e),s.lowlink=Math.min(s.lowlink,r[e].lowlink))}),s.lowlink===s.index){let e=[],t;do t=n.pop(),r[t].onStack=!1,e.push(t);while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function Pg(e){return Ng(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Fg=()=>1;function Ig(e,t,n){return Lg(e,t||Fg,n||function(t){return e.outEdges(t)})}function Lg(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){let t=r[e];i.forEach(function(n){let a=r[n];i.forEach(function(n){let r=a[e],i=t[n],o=a[n],s=r.distance+i.distance;s<o.distance&&(o.distance=s,o.predecessor=i.predecessor)})})}),r}var Rg=class extends Error{constructor(...e){super(...e)}};function zg(e){let t={},n={},r=[];function i(a){if(a in n)throw new Rg;a in t||(n[a]=!0,t[a]=!0,e.predecessors(a).forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new Rg;return r}function Bg(e){try{zg(e)}catch(e){if(e instanceof Rg)return!1;throw e}return!0}function Vg(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=Hg(e,t,n===`post`,o,a,r,i)}),i}function Hg(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=Hg(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function Ug(e,t,n){return Vg(e,t,n,function(e,t){return e.push(t),e},[])}function Wg(e,t){return Ug(e,t,`post`)}function Gg(e,t){return Ug(e,t,`pre`)}function Kg(e,t){let n=new dg,r={},i=new Og,a;function o(e){let n=e.v===a?e.w:e.v,o=i.priority(n);if(o!==void 0){let s=t(e);s<o&&(r[n]=a,i.decrease(n,s))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(e){i.add(e,1/0),n.setNode(e)}),i.decrease(e.nodes()[0],0);let s=!1;for(;i.size()>0;){if(a=i.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw Error(`Input graph is not connected: `+e);s=!0}e.nodeEdges(a).forEach(o)}return n}function qg(e,t,n,r){return Jg(e,t,n,r??(t=>e.outEdges(t)??[]))}function Jg(e,t,n,r){if(n===void 0)return Ag(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=r(a[o]);for(let e=0;e<s.length;e++){let t=s[e],r=t.v===a[o]?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return Tg(e,t,n,r)}return Ag(e,t,n,r)}function Yg(e,t,n,r){let i=r;for(;e.hasNode(i);)i=d_(r);return n.dummy=t,e.setNode(i,n),i}function Xg(e){let t=new dg().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function Zg(e){let t=new dg({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Qg(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function $g(e){let t=f_(o_(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function e_(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=a_(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function t_(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=a_(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function n_(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Yg(e,`border`,i,t)}function r_(e,t=i_){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var i_=65535;function a_(e,t){return t.length>i_?e(...r_(t).map(t=>e(...t))):e(...t)}function o_(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return a_(Math.max,t)}function s_(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function c_(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function l_(e,t){return t()}var u_=0;function d_(e){return e+(``+ ++u_)}function f_(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function p_(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function m_(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function h_(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var g_=`\0`,__=`3.0.0`,v_=class{constructor(){sg(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return y_(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&y_(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,b_)),n=n._prev;return`[`+e.join(`, `)+`]`}};function y_(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function b_(e,t){if(e!==`_next`&&e!==`_prev`)return t}var x_=v_,S_=()=>1;function C_(e,t){if(e.nodeCount()<=1)return[];let n=E_(e,t||S_);return w_(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function w_(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)T_(e,t,n,o);for(;o=i.dequeue();)T_(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(T_(e,t,n,o,!0)||[]);break}}}return r}function T_(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,D_(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,D_(t,n,o)}),e.removeNode(r.v),o}function E_(e,t){let n=new dg,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=O_(i+r+3).map(()=>new x_),o=r+1;return n.nodes().forEach(e=>{D_(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function D_(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function O_(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function k_(e){(e.graph().acyclicer===`greedy`?C_(e,t(e)):A_(e)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,d_(`rev`))});function t(e){return t=>e.edge(t).weight}}function A_(e){let t=[],n={},r={};function i(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,e.outEdges(a).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return e.nodes().forEach(i),t}function j_(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function M_(e){e.graph().dummyChains=[],e.edges().forEach(t=>N_(e,t))}function N_(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=Yg(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function P_(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function F_(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=a_(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function I_(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var L_=R_;function R_(e){let t=new dg({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;z_(t,e)<i&&(a=B_(t,e),a);)o=t.hasNode(a.v)?I_(e,a):-I_(e,a),V_(t,e,o);return t}function z_(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!I_(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function B_(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=I_(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function V_(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:H_,postorder:U_}=Cg,W_=G_;G_.initLowLimValues=Y_,G_.initCutValues=K_,G_.calcCutValue=J_,G_.leaveEdge=Z_,G_.enterEdge=Q_,G_.exchangeEdges=$_;function G_(e){e=Xg(e),F_(e);let t=L_(e);Y_(t),K_(t,e);let n,r;for(;n=Z_(t);)r=Q_(t,e,n),$_(t,e,n,r)}function K_(e,t){let n=U_(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>q_(e,t,n))}function q_(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=J_(e,t,n)}function J_(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,tv(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function Y_(e,t){arguments.length<2&&(t=e.nodes()[0]),X_(e,{},1,t)}function X_(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=X_(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Z_(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Q_(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===nv(e,e.node(t.v),s)&&c!==nv(e,e.node(t.w),s)).reduce((e,n)=>I_(t,n)<I_(t,e)?n:e)}function $_(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Y_(e),K_(e,t),ev(e,t)}function ev(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=H_(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function tv(e,t,n){return e.hasEdge(t,n)}function nv(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var rv=iv;function iv(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:sv(e);break;case`tight-tree`:ov(e);break;case`longest-path`:av(e);break;case`none`:break;default:sv(e)}}var av=F_;function ov(e){F_(e),L_(e)}function sv(e){W_(e)}var cv=lv;function lv(e){let t=dv(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=uv(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function uv(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function dv(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(g_).forEach(r),t}function fv(e){let t=Yg(e,`root`,{},`_root`),n=mv(e),r=Object.values(n),i=a_(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=hv(e)+1;e.children(g_).forEach(r=>pv(e,t,a,o,i,n,r)),e.graph().nodeRankFactor=a}function pv(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=n_(e,`_bt`),l=n_(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{pv(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function mv(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(g_).forEach(e=>n(e,1)),t}function hv(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function gv(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var _v=vv;function vv(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)yv(e,`borderLeft`,`_bl`,n,i,t),yv(e,`borderRight`,`_br`,n,i,t)}}e.children(g_).forEach(t)}function yv(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=Yg(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function bv(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&Sv(e)}function xv(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&wv(e),(t===`lr`||t===`rl`)&&(Ev(e),Sv(e))}function Sv(e){e.nodes().forEach(t=>Cv(e.node(t))),e.edges().forEach(t=>Cv(e.edge(t)))}function Cv(e){let t=e.width;e.width=e.height,e.height=t}function wv(e){e.nodes().forEach(t=>Tv(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Tv),Object.hasOwn(r,`y`)&&Tv(r)})}function Tv(e){e.y=-e.y}function Ev(e){e.nodes().forEach(t=>Dv(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Dv),Object.hasOwn(r,`x`)&&Dv(r)})}function Dv(e){let t=e.x;e.x=e.y,e.y=t}function Ov(e){let t={},n=e.nodes().filter(t=>!e.children(t).length),r=n.map(t=>e.node(t).rank),i=f_(a_(Math.max,r)+1).map(()=>[]);function a(n){if(t[n])return;t[n]=!0;let r=e.node(n);i[r.rank].push(n);let o=e.successors(n);o&&o.forEach(a)}return n.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(a),i}function kv(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Av(e,t[r-1],t[r]);return n}function Av(e,t,n){let r=h_(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function jv(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Mv(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Nv(Object.values(n).filter(e=>!e.indegree))}function Nv(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Pv(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>p_(e,[`vs`,`i`,`barycenter`,`weight`]))}function Pv(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Fv(e,t){let n=s_(e,e=>Object.hasOwn(e,`barycenter`)),r=n.lhs,i=n.rhs.sort((e,t)=>t.i-e.i),a=[],o=0,s=0,c=0;r.sort(Lv(!!t)),c=Iv(a,i,c),r.forEach(e=>{c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=Iv(a,i,c)});let l={vs:a.flat(1)};return s&&(l.barycenter=o/s,l.weight=s),l}function Iv(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Lv(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function Rv(e,t,n,r){let i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=i.filter(e=>e!==o&&e!==s));let l=jv(e,i);l.forEach(t=>{if(e.children(t.v).length){let i=Rv(e,t.v,n,r);c[t.v]=i,Object.hasOwn(i,`barycenter`)&&Bv(t,i)}});let u=Mv(l,n);zv(u,c);let d=Fv(u,r);if(o&&s){d.vs=[o,d.vs,s].flat(1);let t=e.predecessors(o);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(s),i=e.node(r[0]);Object.hasOwn(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+n.order+i.order)/(d.weight+2),d.weight+=2}}return d}function zv(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function Bv(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Vv(e,t,n,r){r||=e.nodes();let i=Hv(e),a=new dg({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function Hv(e){let t;for(;e.hasNode(t=d_(`_root`)););return t}function Uv(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function Wv(e,t={}){if(typeof t.customOrder==`function`){t.customOrder(e,Wv);return}let n=o_(e),r=Gv(e,f_(1,n+1),`inEdges`),i=Gv(e,f_(n-1,-1,-1),`outEdges`),a=Ov(e);if(qv(e,a),t.disableOptimalOrderHeuristic)return;let o=1/0,s,c=t.constraints||[];for(let t=0,n=0;n<4;++t,++n){Kv(t%2?r:i,t%4>=2,c),a=$g(e);let l=kv(e,a);l<o?(n=0,s=Object.assign({},a),o=l):l===o&&(s=structuredClone(a))}qv(e,s)}function Gv(e,t,n){let r=/* @__PURE__ */ new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return Vv(e,t,n,r.get(t)||[])})}function Kv(e,t,n){let r=new dg;e.forEach(function(e){n.forEach(e=>r.setEdge(e.left,e.right));let i=e.graph().root,a=Rv(e,i,r,t);a.vs.forEach((t,n)=>e.node(t).order=n),Uv(e,r,a.vs)})}function qv(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function Jv(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=Xv(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Zv(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function Yv(e,t){let n={};function r(t,r,i,a,o){f_(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Zv(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function Xv(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function Zv(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function Qv(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function $v(e,t,n,r){let i={},a={},o={};return t.forEach(e=>{e.forEach((e,t)=>{i[e]=e,a[e]=e,o[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let s=r(e);if(s&&s.length){let r=s.sort((e,t)=>{let n=o[e],r=o[t];return(n===void 0?0:n)-(r===void 0?0:r)}),c=(r.length-1)/2;for(let s=Math.floor(c),l=Math.ceil(c);s<=l;++s){let c=r[s];if(c===void 0)continue;let l=o[c];if(l!==void 0&&a[e]===e&&t<l&&!Qv(n,e,c)){let n=i[c];n!==void 0&&(a[c]=e,a[e]=i[e]=n,t=l)}}}})}),{root:i,align:a}}function ey(e,t,n,r,i=!1){let a={},o=ty(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function ty(e,t,n,r){let i=new dg,a=e.graph(),o=oy(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function ny(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=sy(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function ry(e,t){let n=Object.values(t),r=a_(Math.min,n),i=a_(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-a_(Math.min,c);a!==`l`&&(l=i-a_(Math.max,c)),l&&(e[o]=m_(s,e=>e+l))})})}function iy(e,t=void 0){let n=e.ul;return n?m_(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function ay(e){let t=$g(e),n=Object.assign(Jv(e,t),Yv(e,t)),r={},i;return[`u`,`d`].forEach(a=>{i=a===`u`?t:Object.values(t).reverse(),[`l`,`r`].forEach(t=>{t===`r`&&(i=i.map(e=>Object.values(e).reverse()));let o=$v(e,i,n,t=>(a===`u`?e.predecessors(t):e.successors(t))||[]),s=ey(e,i,o.root,o.align,t===`r`);t===`r`&&(s=m_(s,e=>-e)),r[a+t]=s})}),ry(r,ny(e,r)),iy(r,e.graph().align)}function oy(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function sy(e,t){return e.node(t).width}function cy(e){e=Zg(e),ly(e),Object.entries(ay(e)).forEach(([t,n])=>e.node(t).x=n)}function ly(e){let t=$g(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}function uy(e,t={}){let n=t.debugTiming?c_:l_;return n(`layout`,()=>{let r=n(` buildLayoutGraph`,()=>xy(e));return n(` runLayout`,()=>dy(r,n,t)),n(` updateInputGraph`,()=>fy(e,r)),r})}function dy(e,t,n){t(` makeSpaceForEdgeLabels`,()=>Sy(e)),t(` removeSelfEdges`,()=>jy(e)),t(` acyclic`,()=>k_(e)),t(` nestingGraph.run`,()=>fv(e)),t(` rank`,()=>rv(Zg(e))),t(` injectEdgeLabelProxies`,()=>Cy(e)),t(` removeEmptyRanks`,()=>t_(e)),t(` nestingGraph.cleanup`,()=>gv(e)),t(` normalizeRanks`,()=>e_(e)),t(` assignRankMinMax`,()=>wy(e)),t(` removeEdgeLabelProxies`,()=>Ty(e)),t(` normalize.run`,()=>M_(e)),t(` parentDummyChains`,()=>cv(e)),t(` addBorderSegments`,()=>_v(e)),t(` order`,()=>Wv(e,n)),t(` insertSelfEdges`,()=>My(e)),t(` adjustCoordinateSystem`,()=>bv(e)),t(` position`,()=>cy(e)),t(` positionSelfEdges`,()=>Ny(e)),t(` removeBorderNodes`,()=>Ay(e)),t(` normalize.undo`,()=>P_(e)),t(` fixupEdgeLabelCoords`,()=>Oy(e)),t(` undoCoordinateSystem`,()=>xv(e)),t(` translateGraph`,()=>Ey(e)),t(` assignNodeIntersects`,()=>Dy(e)),t(` reversePoints`,()=>ky(e)),t(` acyclic.undo`,()=>j_(e))}function fy(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var py=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],my={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},hy=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],gy=[`width`,`height`,`rank`],_y={width:0,height:0},vy=[`minlen`,`weight`,`width`,`height`,`labeloffset`],yy={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},by=[`labelpos`];function xy(e){let t=new dg({multigraph:!0,compound:!0}),n=Fy(e.graph());return t.setGraph(Object.assign({},my,Py(n,py),p_(n,hy))),e.nodes().forEach(n=>{let r=Py(Fy(e.node(n)),gy);Object.keys(_y).forEach(e=>{r[e]===void 0&&(r[e]=_y[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=Fy(e.edge(n));t.setEdge(n,Object.assign({},yy,Py(r,vy),p_(r,by)))}),t}function Sy(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Cy(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);Yg(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function wy(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Ty(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Ey(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function Dy(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(Qg(r,a)),n.points.push(Qg(i,o))})}function Oy(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function ky(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Ay(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function jy(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function My(e){$g(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);i.order=r+n,(i.selfEdges||[]).forEach(t=>{Yg(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function Ny(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`selfedge`){let r=n,i=e.node(r.e.v),a=i.x+i.width/2,o=i.y,s=n.x-a,c=i.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:a+2*s/3,y:o-c},{x:a+5*s/6,y:o-c},{x:a+s,y:o},{x:a+5*s/6,y:o+c},{x:a+2*s/3,y:o+c}],r.label.x=n.x,r.label.y=n.y}})}function Py(e,t){return m_(p_(e,t),Number)}function Fy(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function Iy(e){let t=$g(e),n=new dg({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var Ly={graphlib:cg,version:__,layout:uy,debug:Iy,util:{time:c_,notime:l_}},Ry=function(e){
|
|
347
347
|
/*! For license information please see dagre.esm.js.LEGAL.txt */
|
|
348
|
-
return typeof e==`function`},zy=.001;function By(e){if(e.isParent()){var t=e.children();if(t.length>0)return By(t[0])}return e}function Vy(e){this.options=rg({},ng,e)}function Hy(e,t){return{x:qy(e.x-t.x),y:qy(e.y-t.y)}}function Uy(e,t){return qy(e.x*t.x)+qy(e.y*t.y)}function Wy(e){var t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t,len:t}}function Gy(e){return{x:-e.y,y:e.x}}function Ky(e,t){var n=Wy(Hy(t,e)),r=n.x,i=n.y,a=n.len,o={x:r,y:i};return{src:e,tgt:t,dir:o,normal:Gy(o),len:a}}function qy(e){return Math.abs(e)<zy?e<0?-zy:zy:e}function Jy(e,t){var n=Hy(e,t.src);return{weight:qy(Uy(n,t.dir)/t.len),distance:qy(Uy(n,t.normal))}}function Yy(e){var t=1/0,n=-1/0,r=$h(e),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a.weight<t&&(t=a.weight),a.weight>n&&(n=a.weight)}}catch(e){r.e(e)}finally{r.f()}var o=n-t||1;return e.map(function(e){return{distance:e.distance,weight:(e.weight-t)/o}})}function Xy(e,t){var n=Ky(t.source().position(),t.target().position()),r=Yy(e.points.map(function(e){return Jy(e,n)}));return{controlPointWeights:r.slice(1,-1).map(function(e){return e.weight}),controlPointDistances:r.slice(1,-1).map(function(e){return e.distance})}}Vy.prototype.run=function(){var e=this.options,t=this,n=e.cy,r=e.eles,i=function(e,t){return Ry(t)?t.apply(e,[e]):t},a=e.boundingBox||{x1:0,y1:0,w:n.width(),h:n.height()};a.x2===void 0&&(a.x2=a.x1+a.w),a.w===void 0&&(a.w=a.x2-a.x1),a.y2===void 0&&(a.y2=a.y1+a.h),a.h===void 0&&(a.h=a.y2-a.y1);var o=new Ly.graphlib.Graph({multigraph:!0,compound:!0}),s={},c=function(e,t){t!=null&&(s[e]=t)};c(`nodesep`,e.nodeSep),c(`edgesep`,e.edgeSep),c(`ranksep`,e.rankSep),c(`rankdir`,e.rankDir),c(`align`,e.align),c(`ranker`,e.ranker),c(`acyclicer`,e.acyclicer),o.setGraph(s),o.setDefaultEdgeLabel(function(){return{}}),o.setDefaultNodeLabel(function(){return{}});var l=r.nodes();Ry(e.sort)&&(l=l.sort(e.sort));for(var u=0;u<l.length;u++){var d=l[u],f=d.layoutDimensions(e);o.setNode(d.id(),{width:f.w,height:f.h,shape:`ellipse`,name:d.id()})}for(var p=0;p<l.length;p++){var m=l[p];m.isChild()&&o.setParent(m.id(),m.parent().id())}var h=r.edges();Ry(e.sort)&&(h=h.sort(e.sort));for(var g=0;g<h.length;g++){var _=h[g],v=By(_.source()),y=By(_.target());o.setEdge(v.id(),y.id(),{minlen:i(_,e.minLen),weight:i(_,e.edgeWeight),name:_.id()},_.id())}Ly.layout(o);for(var b=o.nodes(),x=0;x<b.length;x++){var S=b[x],C=o.node(S);n.getElementById(S).scratch().dagre=C}var w;e.boundingBox?(w={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},l.forEach(function(e){var t=e.scratch().dagre;w.x1=Math.min(w.x1,t.x),w.x2=Math.max(w.x2,t.x),w.y1=Math.min(w.y1,t.y),w.y2=Math.max(w.y2,t.y)}),w.w=w.x2-w.x1,w.h=w.y2-w.y1):w=a;var T=function(t){if(e.boundingBox){var n=w.w===0?0:(t.x-w.x1)/w.w,r=w.h===0?0:(t.y-w.y1)/w.h;return{x:a.x1+n*a.w,y:a.y1+r*a.h}}return t};return l.layoutPositions(t,e,function(e){e=eg(e)===`object`?e:this;var t=e.scratch().dagre;return T({x:t.x,y:t.y})}),e.useDagreEdgeControlPoints&&(e.automaticDagreEdgeStyle&&(n.edges().addClass(`useDagreEdgeControlPoints`),n.style().selector(`edge.useDagreEdgeControlPoints`).style(e.dagreEdgeStyle).update()),o.edges().forEach(function(e){var t=n.getElementById(e.name),r=o.edge(e);r&&r.points&&t.scratch(Xy(r,t))})),this};var Zy=function(e){e&&e(`layout`,`dagre`,Vy)};typeof window<`u`&&window.cytoscape!==void 0&&Zy(window.cytoscape),Zh.use(Zy);function
|
|
348
|
+
return typeof e==`function`},zy=.001;function By(e){if(e.isParent()){var t=e.children();if(t.length>0)return By(t[0])}return e}function Vy(e){this.options=rg({},ng,e)}function Hy(e,t){return{x:qy(e.x-t.x),y:qy(e.y-t.y)}}function Uy(e,t){return qy(e.x*t.x)+qy(e.y*t.y)}function Wy(e){var t=Math.hypot(e.x,e.y)||1;return{x:e.x/t,y:e.y/t,len:t}}function Gy(e){return{x:-e.y,y:e.x}}function Ky(e,t){var n=Wy(Hy(t,e)),r=n.x,i=n.y,a=n.len,o={x:r,y:i};return{src:e,tgt:t,dir:o,normal:Gy(o),len:a}}function qy(e){return Math.abs(e)<zy?e<0?-zy:zy:e}function Jy(e,t){var n=Hy(e,t.src);return{weight:qy(Uy(n,t.dir)/t.len),distance:qy(Uy(n,t.normal))}}function Yy(e){var t=1/0,n=-1/0,r=$h(e),i;try{for(r.s();!(i=r.n()).done;){var a=i.value;a.weight<t&&(t=a.weight),a.weight>n&&(n=a.weight)}}catch(e){r.e(e)}finally{r.f()}var o=n-t||1;return e.map(function(e){return{distance:e.distance,weight:(e.weight-t)/o}})}function Xy(e,t){var n=Ky(t.source().position(),t.target().position()),r=Yy(e.points.map(function(e){return Jy(e,n)}));return{controlPointWeights:r.slice(1,-1).map(function(e){return e.weight}),controlPointDistances:r.slice(1,-1).map(function(e){return e.distance})}}Vy.prototype.run=function(){var e=this.options,t=this,n=e.cy,r=e.eles,i=function(e,t){return Ry(t)?t.apply(e,[e]):t},a=e.boundingBox||{x1:0,y1:0,w:n.width(),h:n.height()};a.x2===void 0&&(a.x2=a.x1+a.w),a.w===void 0&&(a.w=a.x2-a.x1),a.y2===void 0&&(a.y2=a.y1+a.h),a.h===void 0&&(a.h=a.y2-a.y1);var o=new Ly.graphlib.Graph({multigraph:!0,compound:!0}),s={},c=function(e,t){t!=null&&(s[e]=t)};c(`nodesep`,e.nodeSep),c(`edgesep`,e.edgeSep),c(`ranksep`,e.rankSep),c(`rankdir`,e.rankDir),c(`align`,e.align),c(`ranker`,e.ranker),c(`acyclicer`,e.acyclicer),o.setGraph(s),o.setDefaultEdgeLabel(function(){return{}}),o.setDefaultNodeLabel(function(){return{}});var l=r.nodes();Ry(e.sort)&&(l=l.sort(e.sort));for(var u=0;u<l.length;u++){var d=l[u],f=d.layoutDimensions(e);o.setNode(d.id(),{width:f.w,height:f.h,shape:`ellipse`,name:d.id()})}for(var p=0;p<l.length;p++){var m=l[p];m.isChild()&&o.setParent(m.id(),m.parent().id())}var h=r.edges();Ry(e.sort)&&(h=h.sort(e.sort));for(var g=0;g<h.length;g++){var _=h[g],v=By(_.source()),y=By(_.target());o.setEdge(v.id(),y.id(),{minlen:i(_,e.minLen),weight:i(_,e.edgeWeight),name:_.id()},_.id())}Ly.layout(o);for(var b=o.nodes(),x=0;x<b.length;x++){var S=b[x],C=o.node(S);n.getElementById(S).scratch().dagre=C}var w;e.boundingBox?(w={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0},l.forEach(function(e){var t=e.scratch().dagre;w.x1=Math.min(w.x1,t.x),w.x2=Math.max(w.x2,t.x),w.y1=Math.min(w.y1,t.y),w.y2=Math.max(w.y2,t.y)}),w.w=w.x2-w.x1,w.h=w.y2-w.y1):w=a;var T=function(t){if(e.boundingBox){var n=w.w===0?0:(t.x-w.x1)/w.w,r=w.h===0?0:(t.y-w.y1)/w.h;return{x:a.x1+n*a.w,y:a.y1+r*a.h}}return t};return l.layoutPositions(t,e,function(e){e=eg(e)===`object`?e:this;var t=e.scratch().dagre;return T({x:t.x,y:t.y})}),e.useDagreEdgeControlPoints&&(e.automaticDagreEdgeStyle&&(n.edges().addClass(`useDagreEdgeControlPoints`),n.style().selector(`edge.useDagreEdgeControlPoints`).style(e.dagreEdgeStyle).update()),o.edges().forEach(function(e){var t=n.getElementById(e.name),r=o.edge(e);r&&r.points&&t.scratch(Xy(r,t))})),this};var Zy=function(e){e&&e(`layout`,`dagre`,Vy)};typeof window<`u`&&window.cytoscape!==void 0&&Zy(window.cytoscape),Zh.use(Zy);let Qy={LR:70,TB:50};function $y(e){try{return tb(e)}catch{return ob(e)}}function eb(e){return{w:Math.max(1,(e.canvas.w-2*e.pad)/e.fitZoom),h:Math.max(1,(e.canvas.h-2*e.pad)/e.fitZoom)}}function tb(e){let t=eb(e),n=nb(e,`LR`,t);if(n.zoom>=e.fitZoom)return n.positions;let r=nb(e,`TB`,t);return r.zoom>n.zoom?r.positions:n.positions}function nb(e,t,n){let{nodes:r,edges:i,blocks:a}=rb(e,t,n),o=Zh({headless:!0,styleEnabled:!0,elements:[...r.map(e=>({data:{id:e.id,w:e.w,h:e.h}})),...i.map(e=>({data:{id:e.id,source:e.source,target:e.target}}))],style:[{selector:`node`,style:{width:`data(w)`,height:`data(h)`}}]}),s={};try{o.layout({name:`dagre`,rankDir:t,nodeSep:14,rankSep:Qy[t],fit:!1,animate:!1}).run();for(let e of o.nodes().toArray())s[e.id()]={...e.position()}}finally{o.destroy()}for(let e of a){let n=s[e.id];delete s[e.id],ib(e,n,t,s)}let c=ab(e.nodes,s);return{positions:s,zoom:e.fitZoom*Math.min(n.w/c.w,n.h/c.h)}}function rb(e,t,n){let r=/* @__PURE__ */ new Map;for(let t of e.edges)for(let e of t.source===t.target?[t.source]:[t.source,t.target])r.has(e)||r.set(e,[]),r.get(e).push(t);let i=/* @__PURE__ */ new Map;for(let t of e.nodes){let e=r.get(t.id)??[];if(e.length===0)continue;let n=e.every(e=>e.source!==t.id&&e.target===t.id),a=e.every(e=>e.source===t.id&&e.target!==t.id);if(!n&&!a)continue;let o=n?e[0].source:e[0].target;if(!e.every(e=>(n?e.source:e.target)===o))continue;let s=`${o}\u0000${n?`out`:`in`}`;i.has(s)||i.set(s,{owner:o,out:n,leaves:[]}),i.get(s).leaves.push(t)}let a=[],o=/* @__PURE__ */ new Set;for(let[e,r]of i){let i={w:Math.max(...r.leaves.map(e=>e.w)),h:Math.max(...r.leaves.map(e=>e.h))},s=t===`LR`?(n.h+14)/(i.h+14):(n.w+14)/(i.w+14),c=Math.max(1,Math.floor(s));if(r.leaves.length<=c)continue;let l=Math.ceil(r.leaves.length/c),u=Math.ceil(r.leaves.length/l),d=(e,t)=>e*(t+14)-14,f={id:`block:${e}`,w:d(t===`LR`?l:u,i.w),h:d(t===`LR`?u:l,i.h),leaves:r.leaves,cell:i,perLine:u};a.push(f);for(let e of r.leaves)o.add(e.id)}if(a.length===0)return{nodes:e.nodes,edges:e.edges,blocks:a};let s=[...e.nodes.filter(e=>!o.has(e.id)),...a.map(e=>({id:e.id,w:e.w,h:e.h}))],c=e.edges.filter(e=>!o.has(e.source)&&!o.has(e.target));for(let[e,t]of i){let n=`block:${e}`;a.some(e=>e.id===n)&&c.push(t.out?{id:`edge:${n}`,source:t.owner,target:n}:{id:`edge:${n}`,source:n,target:t.owner})}return{nodes:s,edges:c,blocks:a}}function ib(e,t,n,r){let i=t.x-e.w/2,a=t.y-e.h/2;e.leaves.forEach((t,o)=>{let s=Math.floor(o/e.perLine),c=o%e.perLine,[l,u]=n===`LR`?[s,c]:[c,s];r[t.id]={x:i+l*(e.cell.w+14)+e.cell.w/2,y:a+u*(e.cell.h+14)+e.cell.h/2}})}function ab(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0;for(let o of e){let e=t[o.id];e&&(n=Math.min(n,e.x-o.w/2),i=Math.max(i,e.x+o.w/2),r=Math.min(r,e.y-o.h/2),a=Math.max(a,e.y+o.h/2))}return{w:Math.max(1,i-n),h:Math.max(1,a-r)}}function ob(e){let t=Math.max(1,Math.ceil(Math.sqrt(e.nodes.length))),n=Math.max(40,...e.nodes.map(e=>e.w))+24,r={};return e.nodes.forEach((e,i)=>{r[e.id]={x:i%t*n,y:Math.floor(i/t)*40}}),r}self.addEventListener(`message`,e=>{try{self.postMessage({id:e.data.id,positions:$y(e.data.input)})}catch(t){self.postMessage({id:e.data.id,error:String(t?.stack??t)})}})})();
|