@rse/gradia 0.9.4 → 0.9.5
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/README.md
CHANGED
|
@@ -215,10 +215,10 @@ color-node-primary-name size-canvas-margin graph-rank-separation
|
|
|
215
215
|
color-node-primary-box size-node-width-min hub-channel-width-max
|
|
216
216
|
color-node-primary-border size-node-width-max hub-channel-width-min
|
|
217
217
|
color-node-ghost-name size-node-height-scale hub-node-gap
|
|
218
|
-
color-node-ghost-box size-edge-corner-radius
|
|
219
|
-
color-node-ghost-border size-edge-hop-radius grid-
|
|
220
|
-
color-group-name size-edge-track-gap grid-gap-
|
|
221
|
-
color-group-box group-box-padding
|
|
218
|
+
color-node-ghost-box size-edge-corner-radius hub-node-degree-max
|
|
219
|
+
color-node-ghost-border size-edge-hop-radius grid-columns-max
|
|
220
|
+
color-group-name size-edge-track-gap grid-gap-horizontal
|
|
221
|
+
color-group-box group-box-padding grid-gap-vertical
|
|
222
222
|
color-group-border group-box-gap
|
|
223
223
|
```
|
|
224
224
|
|
|
@@ -34,6 +34,7 @@ export declare const configDefaults: {
|
|
|
34
34
|
"hub-channel-width-max": number;
|
|
35
35
|
"hub-channel-width-min": number;
|
|
36
36
|
"hub-node-gap": number;
|
|
37
|
+
"hub-node-degree-max": number;
|
|
37
38
|
"grid-columns-max": number;
|
|
38
39
|
"grid-gap-horizontal": number;
|
|
39
40
|
"grid-gap-vertical": number;
|
package/dst/gradia-api-config.js
CHANGED
|
@@ -44,6 +44,7 @@ export const configDefaults = {
|
|
|
44
44
|
"hub-channel-width-max": 340, /* hub: max width of column channels */
|
|
45
45
|
"hub-channel-width-min": 240, /* hub: min width of column channels */
|
|
46
46
|
"hub-node-gap": 20, /* hub: vertical gap of stacked nodes */
|
|
47
|
+
"hub-node-degree-max": 3, /* hub: max edges per side before growth */
|
|
47
48
|
"grid-columns-max": 4, /* grid: max side-by-side tiles */
|
|
48
49
|
"grid-gap-horizontal": 40, /* grid: horizontal gap between tiles */
|
|
49
50
|
"grid-gap-vertical": 20 /* grid: vertical gap between tiles */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Edge } from "./gradia-api-model.js";
|
|
2
2
|
import { Poly } from "./gradia-api-render-base.js";
|
|
3
|
+
export declare const PORT_SEP = 24;
|
|
3
4
|
export declare const simplifyPoly: (pts: Poly) => Poly;
|
|
4
5
|
export type Side = "e" | "w";
|
|
5
6
|
export declare const assignPorts: (edges: Edge[], sides: {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
** Distributed under MIT license <https://spdx.org/licenses/MIT.html>
|
|
5
5
|
*/
|
|
6
6
|
/* edge attachment port geometry */
|
|
7
|
-
const PORT_SEP = 24; /* maximum separation of adjacent ports */
|
|
7
|
+
export const PORT_SEP = 24; /* maximum separation of adjacent ports */
|
|
8
8
|
const PORT_PAD = 10; /* padding of the port band inside the box */
|
|
9
9
|
/* drop duplicate and collinear intermediate points of a polyline */
|
|
10
10
|
export const simplifyPoly = (pts) => {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
** Distributed under MIT license <https://spdx.org/licenses/MIT.html>
|
|
5
5
|
*/
|
|
6
6
|
import { isPrimary, measureNodes, defaultStyleOf } from "./gradia-api-render-node.js";
|
|
7
|
-
import { simplifyPoly, assignPorts, assignTracks } from "./gradia-api-render-edge.js";
|
|
7
|
+
import { PORT_SEP, simplifyPoly, assignPorts, assignTracks } from "./gradia-api-render-edge.js";
|
|
8
8
|
/* the separator between a node id and its placement suffix,
|
|
9
9
|
distinguishing the two clones of a twice-placed node */
|
|
10
10
|
const CLONE = "\u0000";
|
|
@@ -79,9 +79,27 @@ export const render = async (graph, config) => {
|
|
|
79
79
|
const margin = config["size-canvas-margin"];
|
|
80
80
|
const gap = config["hub-node-gap"];
|
|
81
81
|
const scale = config["size-node-height-scale"];
|
|
82
|
-
/*
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
/* the fixed three-column layout assignment */
|
|
83
|
+
const colOf = (id) => id === center.id ? 1 : (inputSet.has(id) ? 0 : 2);
|
|
84
|
+
/* determine node box sizes from their textual content (all boxes at
|
|
85
|
+
half height scale), then grow every box whose edge attachments
|
|
86
|
+
exceed the configured per-side maximum, step-wise by one port
|
|
87
|
+
separation per additional edge, so the edges keep enough
|
|
88
|
+
attachment room without a fixed height increase */
|
|
89
|
+
const { boxW, boxH, contentH } = measureNodes(nodes, config, () => scale / 2);
|
|
90
|
+
const portCnt = new Map();
|
|
91
|
+
for (const edge of edges) {
|
|
92
|
+
const sSide = colOf(edge.source) < colOf(edge.target) ? "e" : "w";
|
|
93
|
+
const tSide = sSide === "e" ? "w" : "e";
|
|
94
|
+
portCnt.set(`${sSide}:${edge.source}`, (portCnt.get(`${sSide}:${edge.source}`) ?? 0) + 1);
|
|
95
|
+
portCnt.set(`${tSide}:${edge.target}`, (portCnt.get(`${tSide}:${edge.target}`) ?? 0) + 1);
|
|
96
|
+
}
|
|
97
|
+
for (const node of nodes) {
|
|
98
|
+
const cnt = Math.max(portCnt.get(`w:${node.id}`) ?? 0, portCnt.get(`e:${node.id}`) ?? 0);
|
|
99
|
+
if (cnt > config["hub-node-degree-max"])
|
|
100
|
+
boxH.set(node.id, boxH.get(node.id) +
|
|
101
|
+
(cnt - config["hub-node-degree-max"]) * PORT_SEP);
|
|
102
|
+
}
|
|
85
103
|
/* fixed three-column layout: stack the input nodes in the first
|
|
86
104
|
column and the output nodes in the third column (each stack
|
|
87
105
|
vertically centered), and place the center node in the second
|
|
@@ -101,7 +119,6 @@ export const render = async (graph, config) => {
|
|
|
101
119
|
nodeCY.set(center.id, margin + totalH / 2);
|
|
102
120
|
/* determine column widths and left edge positions, with the two
|
|
103
121
|
inter-column channel widths sized by actual edge usage */
|
|
104
|
-
const colOf = (id) => id === center.id ? 1 : (inputSet.has(id) ? 0 : 2);
|
|
105
122
|
const colWidth = [
|
|
106
123
|
inputs.reduce((a, node) => Math.max(a, boxW.get(node.id)), 0),
|
|
107
124
|
boxW.get(center.id),
|
package/dst/gradia-api.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Gradia={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule||!o.call(e,`default`)?n(i,`default`,{value:e,enumerable:!0}):i,e)),u=e=>{let t=[],n=1,r=1,i=0,a=/--(?:\((?:"((?:[^"\\\n]|\\.)*)"|([^()"\s]+))\)--)?>(?:\[(?:"((?:[^"\\\n]|\\.)*)"|([^[\]"\s]+))\])?/y,o=/"((?:[^"\\\n]|\\.)*)"/y,s=/(?:(?!--)[^\s[\](),:">#])+/y,c=t=>(t.lastIndex=i,t.exec(e)),l=e=>e.replace(/\\(.)/g,`$1`);for(;i<e.length;){let u=e[i],d;if(u===`
|
|
2
2
|
`)t.push({type:`newline`,text:`
|
|
3
3
|
`,line:n,col:r}),n++,r=1,i++;else if(u===` `||u===` `||u===`\r`)r++,i++;else if(u===`#`)for(;i<e.length&&e[i]!==`
|
|
4
|
-
`;)r++,i++;else if((d=c(a))!==null){let e=d[1]===void 0?d[2]:l(d[1]),a=d[3]===void 0?d[4]:l(d[3]);t.push({type:`edge`,text:d[0],name:e,arity:a,line:n,col:r}),r+=d[0].length,i+=d[0].length}else if((d=c(o))!==null)t.push({type:`string`,text:l(d[1]),line:n,col:r}),r+=d[0].length,i+=d[0].length;else if(u===`"`)throw Error(`unterminated string at line ${n}, column ${r}`);else if(`[](),:`.includes(u))t.push({type:`punct`,text:u,line:n,col:r}),r++,i++;else if((d=c(s))!==null)t.push({type:`word`,text:d[0],line:n,col:r}),r+=d[0].length,i+=d[0].length;else throw Error(`invalid character ${JSON.stringify(u)} at line ${n}, column ${r}`)}return t},d=e=>{let t=u(e),n={nodes:new Map,edges:[]},r=0,i=()=>r<t.length?t[r]:null,a=e=>{let t=i();return t===null||t.type!==`punct`||t.text!==e?!1:(r++,!0)},o=e=>{let t=i(),n=t===null?`end of input`:`line ${t.line}, column ${t.col}`;throw Error(`expected ${e} at ${n}`)},s=()=>{let e=i();return e===null||e.type!==`word`&&e.type!==`string`?o(`bareword or quoted string`):(r++,e.text)},c=()=>{let e=t[r],i=s(),c=null;a(`:`)&&(c=s());let l=[];if(a(`[`)){for(;;){let e=s();a(`:`)||o(`":" in key/value attribute`);let t=s();if(l.push({key:e,val:t}),!a(`,`))break}a(`]`)||o(`"]" after key/value attributes`)}let u=n.nodes.get(i)??{id:i,name:i,attrs:[]};c!==null&&(u.name=c);for(let t of l){let n=u.attrs.findIndex(e=>e.key===t.key);if(n===-1)u.attrs.push(t);else{if(t.key===`group`&&u.attrs[n].val!==t.val)throw Error(`node "${i}" cannot be a member of more than one group ("${u.attrs[n].val}" vs "${t.val}") at line ${e.line}, column ${e.col}`);u.attrs[n]=t}}return n.nodes.set(i,u),i};for(;r<t.length;){if(t[r].type===`newline`){r++;continue}let e=c(),a=i();for(;a!==null&&a.type===`edge`;){r++;let t=c();n.edges.push({source:e,target:t,name:a.name,arity:a.arity}),e=t,a=i()}a!==null&&a.type!==`newline`&&o(`edge operator or end of line`)}return n},f=l(s(((e,t)=>{t.exports={}}))(),1),p={"font-family":`Helvetica`,"font-embed":!1,"color-node-regular-name":`#336699`,"color-node-regular-box":`#e0f0ff`,"color-node-regular-border":`#c0d0e0`,"color-node-primary-name":`#ffffff`,"color-node-primary-box":`#336699`,"color-node-primary-border":`#003366`,"color-node-ghost-name":`#666666`,"color-node-ghost-box":`#f0f0f0`,"color-node-ghost-border":`#a0a0a0`,"color-group-name":`#6699cc`,"color-group-box":`#f4f8fc`,"color-group-border":`#c0d0e0`,"color-edge-line":`#999999`,"color-edge-name":`#333333`,"color-edge-arity":`#333333`,"color-edge-halo":`#ffffff`,"size-canvas-margin":40,"size-node-width-min":220,"size-node-width-max":0,"size-node-height-scale":2.25,"size-edge-corner-radius":20,"size-edge-hop-radius":8,"size-edge-track-gap":12,"group-box-padding":30,"group-box-gap":40,"graph-columns-max":5,"graph-channel-width-max":140,"graph-gutter-height-max":90,"graph-node-separation":30,"graph-rank-separation":60,"hub-channel-width-max":340,"hub-channel-width-min":240,"hub-node-gap":20,"grid-columns-max":4,"grid-gap-horizontal":40,"grid-gap-vertical":20},m=(e,t)=>Object.hasOwn(e,t)?e[t].replace(/[;{}]/g,``):`var(--gradia-${t}, ${p[t]})`,h=e=>{let t={};for(let n of e.split(/\r?\n/)){let e=/^[ \t]*#config[ \t]+([a-z][a-z0-9-]*)[ \t]+(?:"((?:[^"\\]|\\.)*)"|(\S+))[ \t]*$/.exec(n);if(e===null||!Object.hasOwn(p,e[1]))continue;let r=e[1],i=e[2]===void 0?e[3]:e[2].replace(/\\(.)/g,`$1`);if(!(r===`font-embed`||r===`font-family`&&i.endsWith(`.woff2`))){if(typeof p[r]==`boolean`)t[r]=i===`true`;else if(typeof p[r]==`number`){let e=Number(i);if(i===``||!Number.isFinite(e)||e<0)continue;t[r]=e}else t[r]=i}}return t},g={"Source Sans 3":{file:`source-sans/WOFF2/VF/SourceSans3VF-Upright.ttf.woff2`,weight:`200 900`}},_=e=>{let t=e[`font-family`];if(Object.hasOwn(g,t)){let n=g[t];if(e[`font-embed`]){let e=f.default.fileURLToPath((e=>e)(n.file));return{family:t,embed:f.default.readFileSync(e).toString(`base64`),weight:n.weight}}return{family:t}}if(t.endsWith(`.woff2`)){let n=f.default.basename(t,`.woff2`);return e[`font-embed`]?{family:n,embed:f.default.readFileSync(t).toString(`base64`)}:{family:n}}if(e[`font-embed`])throw Error(`option "font-embed" requires option "font-family" to be a built-in font family (${Object.keys(g).map(e=>`"${e}"`).join(`, `)}) or the path to a WOFF2 file`);return{family:t}},v=(e,t)=>e.length*t*.52,y=(e,t,n)=>{let r=e.split(/\s+/).filter(e=>e!==``);if(n<=0||r.length<=1||v(e,t)<=n)return[e];let i=[],a=r[0];for(let e of r.slice(1))v(`${a} ${e}`,t)>n?(i.push(a),a=e):a=`${a} ${e}`;return i.push(a),i},b=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),x=34,S=e=>e.attrs.findLast(e=>e.key===`group`)?.val,C=e=>{let t=Array.from(e.nodes.values());if(!t.some(e=>S(e)!==void 0))return null;let n=new Map,r=new Map;for(let e of t){let t=S(e)??`default`;r.set(e.id,t);let i=n.get(t);i===void 0&&(i={nodes:new Map,edges:[]},n.set(t,i)),i.nodes.set(e.id,e)}for(let t of e.edges){let e=r.get(t.source),i=r.get(t.target);if(e!==i)throw Error(`edge "${t.source}" --> "${t.target}" crosses groups "${e}" and "${i}"`);n.get(e).edges.push(t)}return Array.from(n.entries()).map(([e,t])=>({name:e,graph:t}))},w=e=>{let{nodes:t,cx:n,cy:r,boxW:i,boxH:a,polys:o}=e,[s,c,l,u]=[1/0,1/0,-1/0,-1/0];for(let e of t)s=Math.min(s,n(e.id)-i.get(e.id)/2),c=Math.min(c,r(e.id)-a.get(e.id)/2),l=Math.max(l,n(e.id)+i.get(e.id)/2),u=Math.max(u,r(e.id)+a.get(e.id)/2);for(let e of o)for(let[t,n]of e)s=Math.min(s,t),c=Math.min(c,n),l=Math.max(l,t),u=Math.max(u,n);return{minX:s,minY:c,maxX:l,maxY:u}},T=(e,t,n)=>{let r=n[`size-canvas-margin`],i=n[`group-box-padding`],a=n[`group-box-gap`],o=[],s=[],c=[],l=new Map,u=r;t.forEach((t,n)=>{let d=w(t),f=Math.max(d.maxX-d.minX+i*2,v(e[n].name,24)+i*2),p=d.maxY-d.minY+i*2+x;s.push(r+i-d.minX),c.push(u+x+i-d.minY);for(let e of t.nodes)l.set(e.id,n);o.push({name:e[n].name,x:r,y:u,w:f,h:p}),u+=p+a});let d=e=>new Map(t.flatMap(t=>Array.from(e(t).entries()))),f=e=>l.get(e);return{nodes:t.flatMap(e=>e.nodes),edges:t.flatMap(e=>e.edges),cx:e=>t[f(e)].cx(e)+s[f(e)],cy:e=>t[f(e)].cy(e)+c[f(e)],boxW:d(e=>e.boxW),boxH:d(e=>e.boxH),contentH:d(e=>e.contentH),polys:t.flatMap((e,t)=>e.polys.map(e=>e.map(([e,n])=>[e+s[t],n+c[t]]))),styleOf:t.every(e=>e.styleOf!==void 0)?e=>t[f(e.id)].styleOf(e):void 0,groups:o}},E=e=>crypto.getRandomValues(new Uint8Array(e)),D=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(409.6*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},O=(e,t=21)=>D(e,t|0,E),k=e=>e.attrs.findLast(e=>e.key===`primary`)?.val===`true`,ee=e=>k(e)?{fill:`color-node-primary-box`,stroke:`color-node-primary-border`,text:`color-node-primary-name`}:{fill:`color-node-regular-box`,stroke:`color-node-regular-border`,text:`color-node-regular-name`},te=e=>e.attrs.findLast(e=>e.key===`type`)?.val,A=e=>e.attrs.filter(e=>e.key!==`url`&&e.key!==`type`&&e.key!==`primary`&&e.key!==`group`),j=/^\s*([A-Za-z][A-Za-z0-9+.-]*):/,ne=[`http`,`https`,`mailto`],M=e=>{let t=e.attrs.findLast(e=>e.key===`url`)?.val;if(t===void 0)return;let n=t.replace(/[\u0000-\u001F\u007F]/g,``),r=j.exec(n);if(!(r!==null&&!ne.includes(r[1].toLowerCase())))return n},N=(e,t)=>{let n=t[`size-node-width-max`]>0?t[`size-node-width-max`]-36:0,r=te(e);return{name:y(e.name,30,n),type:r===void 0?[]:y(r,16,n),attrs:A(e).flatMap(e=>y(`${e.key}: ${e.val}`,22,n))}},P=(e,t,n)=>{let r=new Map,i=new Map,a=new Map;for(let o of e){let e=N(o,t),s=0;for(let t of e.name)s=Math.max(s,v(t,30));for(let t of e.type)s=Math.max(s,v(t,16));for(let t of e.attrs)s=Math.max(s,v(t,22));let c=64+(e.name.length-1)*38+e.type.length*26+(e.attrs.length>0?e.attrs.length*30+8:0);r.set(o.id,Math.max(t[`size-node-width-min`],Math.ceil(s)+36)),i.set(o.id,Math.ceil(c*n(o))),a.set(o.id,c)}return{boxW:r,boxH:i,contentH:a}},re=24,ie=10,F=e=>{let t=[...e];for(let e=t.length-2;e>0;e--){let[n,r,i]=[t[e-1],t[e],t[e+1]];(n[0]===r[0]&&r[0]===i[0]||n[1]===r[1]&&r[1]===i[1])&&t.splice(e,1)}let n=[];for(let e of t)n.length>0&&n[n.length-1][0]===e[0]&&n[n.length-1][1]===e[1]||n.push(e);return n},ae=(e,t,n,r,i,a)=>{let o=new Map,s=(e,t,n)=>{let r=o.get(e);r===void 0?o.set(e,[{edge:t,role:n}]):r.push({edge:t,role:n})};e.forEach((e,n)=>{s(`${e.source}:${t[n].s}`,n,`s`),s(`${e.target}:${t[n].t}`,n,`t`)});let c=new Map;for(let[t,s]of o){let o=t.lastIndexOf(`:`),l=t.slice(0,o),u=t.slice(o+1),d=t=>t.role===`s`?e[t.edge].target:e[t.edge].source;s.sort((e,t)=>r(d(e))-r(d(t))||e.edge-t.edge);let f=Math.min(re,(a.get(l)-ie)/s.length);s.forEach((e,t)=>{c.set(`${e.edge}:${e.role}`,{x:n(l)+(u===`e`?1:-1)*i.get(l)/2,y:r(l)+(t-(s.length-1)/2)*f})})}return c},oe=(e,t,n,r)=>{let i=(e,t)=>{let n=t?-1:1,r=e.filter(e=>e.posOut<e.posIn).sort((e,t)=>n*(e.posIn-t.posIn||e.posOut-t.posOut)),i=e.filter(e=>e.posOut>=e.posIn).sort((e,t)=>n*(t.posIn-e.posIn||t.posOut-e.posOut));return[...r,...i]},a=[...i(e.filter(e=>!e.mirror),!1),...i(e.filter(e=>e.mirror),!0)],o=Math.min(r,(t-n)/Math.max(a.length-1,1)),s=new Map;return a.forEach((e,t)=>{s.set(e.edge,(t-(a.length-1)/2)*o)}),s},se=e=>{let t=[];return e.forEach((e,n)=>{for(let r=0;r<e.length-1;r++){let[i,a]=[e[r],e[r+1]];i[0]===a[0]&&t.push({owner:n,x:i[0],y1:Math.min(i[1],a[1]),y2:Math.max(i[1],a[1])})}}),e.map((e,n)=>{let r=new Map;for(let i=0;i<e.length-1;i++){let[a,o]=[e[i],e[i+1]];if(a[1]!==o[1])continue;let s=a[1],c=Math.min(a[0],o[0]),l=Math.max(a[0],o[0]),u=[];for(let e of t)e.owner!==n&&e.x>c+1&&e.x<l-1&&s>e.y1+1&&s<e.y2-1&&u.push(e.x);u.length>0&&r.set(i,u)}return r})},ce=(e,t,n,r)=>{let i=(e,t)=>Math.abs(t[0]-e[0])+Math.abs(t[1]-e[1]),a=a=>{if(a<=0||a>=e.length-1)return 0;let o=Math.min(n,i(e[a-1],e[a])/2,i(e[a],e[a+1])/2);for(let n of[a-1,a])for(let i of t.get(n)??[])o=Math.min(o,Math.max(Math.abs(i-e[a][0])-r-2,4));return o},o=[];for(let n=0;n<e.length-1;n++){let[s,c]=[e[n],e[n+1]],l=i(s,c),u=(c[0]-s[0])/l,d=(c[1]-s[1])/l,f=a(n),p=a(n+1),m=[s[0]+u*f,s[1]+d*f],h=[c[0]-u*p,c[1]-d*p];if(n===0&&o.push(`M ${m[0]} ${m[1]}`),s[1]===c[1]&&t.has(n)){let e=Math.sign(c[0]-s[0]),i=t.get(n).filter(t=>(t-m[0])*e>2&&(h[0]-t)*e>2).sort((t,n)=>(t-n)*e),a=[];for(let e of i){let t=a[a.length-1];t!==void 0&&Math.abs(e-t[t.length-1])<=r*2+14?t.push(e):a.push([e])}for(let t of a){let n=t[0]-e*r,i=t[t.length-1]+e*r;(n-m[0])*e<0&&(n=m[0]),(h[0]-i)*e<0&&(i=h[0]),o.push(`L ${n} ${s[1]}`),o.push(`A ${Math.abs(i-n)/2} ${r} 0 0 ${+(e>0)} ${i} ${s[1]}`)}}if(o.push(`L ${h[0]} ${h[1]}`),n<e.length-2){let t=e[n+1],r=e[n+2],a=i(t,r),s=[t[0]+(r[0]-t[0])/a*p,t[1]+(r[1]-t[1])/a*p];o.push(`Q ${c[0]} ${c[1]} ${s[0]} ${s[1]}`)}}return o.join(` `)},le=(e,t)=>{let n=e.slice(0,-1).map((t,n)=>Math.abs(e[n+1][0]-t[0])+Math.abs(e[n+1][1]-t[1])),r=n.reduce((e,t)=>e+t,0)*t;for(let t=0;t<n.length;t++){if(r<=n[t]||t===n.length-1){let i=n[t]>0?r/n[t]:0;return{x:e[t][0]+(e[t+1][0]-e[t][0])*Math.min(i,1),y:e[t][1]+(e[t+1][1]-e[t][1])*Math.min(i,1),horizontal:e[t][1]===e[t+1][1]}}r-=n[t]}return{x:e[0][0],y:e[0][1],horizontal:!0}},ue=e=>e.replace(/[\\"']/g,`\\$&`).replace(/[\r\n]/g,` `),de=O(`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`,12),fe=()=>`gradia-${de()}`,pe=18,me=12,I=e=>{let{nodes:t,cx:n,cy:r,boxW:i,boxH:a}=e,o=t.map(e=>[n(e.id)-i.get(e.id)/2,r(e.id)-a.get(e.id)/2,n(e.id)+i.get(e.id)/2,r(e.id)+a.get(e.id)/2]);for(let t of e.groups??[])o.push([t.x+pe,t.y+me,t.x+pe+v(t.name,24),t.y+me+24*1.2]);let s=e=>o.some(t=>e[0]<t[2]&&e[2]>t[0]&&e[1]<t[3]&&e[3]>t[1]);return{claim:e=>{let t=e.find(e=>!s(e))??e[0];return o.push(t),t},occupied:o}},he=(e,t,n,r,i,a)=>{let{cx:o,cy:s,boxW:c,boxH:l,contentH:u}=t,d=c.get(e.id),f=l.get(e.id),p=o(e.id)-d/2,m=s(e.id)-f/2,h=N(e,a),g=M(e),_=[];_.push(`<rect x="${p}" y="${m}" width="${d}" height="${f}" rx="6" style="fill: ${i(n.fill)}; stroke: ${i(n.stroke)}" stroke-width="4.0"${n.dash===void 0?``:` stroke-dasharray="${b(n.dash)}"`}/>`);let v=s(e.id)-u.get(e.id)/2,y=h.type.length*26,x=(h.name.length-1)*38,S=h.attrs.length>0?v+y+42:s(e.id)+y/2+30*.36-x/2;return h.type.forEach((t,a)=>{_.push(`<text x="${o(e.id)}" y="${S-36-(h.type.length-1-a)*26}" text-anchor="middle" font-size="16" style="font-family: ${r}; fill: ${i(n.text)}">${b(t)}</text>`)}),h.name.forEach((t,a)=>{_.push(`<text x="${o(e.id)}" y="${S+a*38}" text-anchor="middle" font-size="30" font-weight="600" style="font-family: ${r}; fill: ${i(n.text)}">${b(t)}</text>`)}),h.attrs.forEach((t,a)=>{_.push(`<text x="${o(e.id)}" y="${v+y+x+64+8+a*30}" text-anchor="middle" font-size="22" style="font-family: ${r}; fill: ${i(n.text)}">${b(t)}</text>`)}),g===void 0?_:[`<a href="${b(g)}" xlink:href="${b(g)}">`,..._,`</a>`]},ge=(e,t,n)=>{let{polys:r}=e,[i,a,o,s]=[1/0,1/0,-1/0,-1/0];for(let[e,n,r,c]of t)i=Math.min(i,e),a=Math.min(a,n),o=Math.max(o,r),s=Math.max(s,c);for(let e of r)for(let[t,n]of e)i=Math.min(i,t),a=Math.min(a,n),o=Math.max(o,t),s=Math.max(s,n);return Number.isFinite(i)||([i,a,o,s]=[0,0,0,0]),{x:Math.floor(i-n/2),y:Math.floor(a-n/2),w:Math.ceil(o-i+n),h:Math.ceil(s-a+n)}},_e=(e,t,n)=>{let{nodes:r,edges:i,polys:a}=e,o=e.groups??[],s=e.styleOf??ee,c=e=>b(m(n,e)),l=`${fe()}-arrow`,{family:u,embed:d,weight:f}=_(t),p=b(`${Object.hasOwn(n,`font-family`)?`'${ue(u)}'`:`var(--gradia-font-family, '${ue(u)}')`}, ui-sans-serif, -apple-system, Helvetica, Arial, sans-serif`),h=se(a),{claim:g,occupied:y}=I(e),x=[],S=[],C=`stroke-width="4.5" paint-order="stroke" stroke-linejoin="round"`;i.forEach((e,n)=>{if(x.push(`<path d="${ce(a[n],h[n],t[`size-edge-corner-radius`],t[`size-edge-hop-radius`])}" fill="none" style="stroke: ${c(`color-edge-line`)}" stroke-width="3.0" marker-end="url(#${l})"/>`),e.name!==void 0){let t=v(e.name,16),r=[];for(let e of[.5,.4,.6,.3,.7,.2,.8]){let i=le(a[n],e);i.horizontal?(r.push([i.x-t/2,i.y-23,i.x+t/2,i.y-3]),r.push([i.x-t/2,i.y+3,i.x+t/2,i.y+23])):(r.push([i.x+5,i.y-10,i.x+5+t,i.y+10]),r.push([i.x-5-t,i.y-10,i.x-5,i.y+10]))}let i=g(r);S.push(`<text x="${(i[0]+i[2])/2}" y="${i[3]-3}" text-anchor="middle" font-size="16" style="font-family: ${p}; fill: ${c(`color-edge-name`)}; stroke: ${c(`color-edge-halo`)}" ${C}>${b(e.name)}</text>`)}if(e.arity!==void 0){let t=v(e.arity,16),r=le(a[n],1),i=le(a[n],.999),o=Math.sign(r.x-i.x)||1,s=r.x-o*(24+t/2),l=g([[s-t/2,r.y-17,s+t/2,r.y-4],[s-t/2,r.y+4,s+t/2,r.y+17],[s-t/2-o*14,r.y-17,s+t/2-o*14,r.y-4]]);S.push(`<text x="${(l[0]+l[2])/2}" y="${l[3]-3}" text-anchor="middle" font-size="16" style="font-family: ${p}; fill: ${c(`color-edge-arity`)}; stroke: ${c(`color-edge-halo`)}" ${C}>${b(e.arity)}</text>`)}});let w=r.flatMap(n=>he(n,e,s(n),p,c,t)),T=o.flatMap(e=>[`<rect x="${e.x}" y="${e.y}" width="${e.w}" height="${e.h}" rx="12" style="fill: ${c(`color-group-box`)}; stroke: ${c(`color-group-border`)}" stroke-width="3.0"/>`,`<text x="${e.x+pe}" y="${e.y+me+24}" font-size="24" font-weight="600" style="font-family: ${p}; fill: ${c(`color-group-name`)}">${b(e.name)}</text>`]),E=o.map(e=>[e.x,e.y,e.x+e.w,e.y+e.h]),D=ge(e,[...y,...E],t[`size-canvas-margin`]);return[`<?xml version="1.0" encoding="UTF-8"?>`,`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="${D.x} ${D.y} ${D.w} ${D.h}" width="${D.w}" height="${D.h}">`,`<defs>`,...d===void 0?[]:[`<style>`,`@font-face { font-family: "${b(ue(u))}"; `+(f===void 0?``:`font-weight: ${b(ue(f))}; `)+`src: url(data:font/woff2;base64,${d}) format("woff2"); }`,`</style>`],`<marker id="${l}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="21" markerHeight="21" markerUnits="userSpaceOnUse" orient="auto-start-reverse">`,`<path d="M 0 1 L 9 5 L 0 9 z" style="fill: ${c(`color-edge-line`)}"/>`,`</marker>`,`</defs>`,...T,...x,...w,...S,`</svg>`,``].join(`
|
|
5
|
-
`)};function ve(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var ye={abs:Math.abs,ceil:Math.ceil,floor:Math.floor,max:Math.max,min:Math.min,round:Math.round,sqrt:Math.sqrt,pow:Math.pow},L=class extends Error{constructor(e,t,n){super(e),this.position=t,this.token=n,this.name=`ExpressionError`}},R;(function(e){e[e.STRING=0]=`STRING`,e[e.NUMBER=1]=`NUMBER`,e[e.BOOLEAN=2]=`BOOLEAN`,e[e.NULL=3]=`NULL`,e[e.IDENTIFIER=4]=`IDENTIFIER`,e[e.OPERATOR=5]=`OPERATOR`,e[e.FUNCTION=6]=`FUNCTION`,e[e.DOT=7]=`DOT`,e[e.BRACKET_LEFT=8]=`BRACKET_LEFT`,e[e.BRACKET_RIGHT=9]=`BRACKET_RIGHT`,e[e.PAREN_LEFT=10]=`PAREN_LEFT`,e[e.PAREN_RIGHT=11]=`PAREN_RIGHT`,e[e.COMMA=12]=`COMMA`,e[e.QUESTION=13]=`QUESTION`,e[e.COLON=14]=`COLON`,e[e.DOLLAR=15]=`DOLLAR`})(R||={});var be=new Set([32,9,10,13]),xe=new Set([43,45,42,47,37,33,38,124,61,60,62]),Se=new Map([[`true`,R.BOOLEAN],[`false`,R.BOOLEAN],[`null`,R.NULL]]),Ce=new Map([[`===`,!0],[`!==`,!0],[`<=`,!0],[`>=`,!0],[`&&`,!0],[`||`,!0],[`+`,!0],[`-`,!0],[`*`,!0],[`/`,!0],[`%`,!0],[`!`,!0],[`<`,!0],[`>`,!0]]),we=new Map([[46,R.DOT],[91,R.BRACKET_LEFT],[93,R.BRACKET_RIGHT],[40,R.PAREN_LEFT],[41,R.PAREN_RIGHT],[44,R.COMMA],[63,R.QUESTION],[58,R.COLON],[36,R.DOLLAR]]),Te=new Map;for(let[e,t]of we.entries())Te.set(e,{type:t,value:String.fromCharCode(e)});function Ee(e){return e>=48&&e<=57}function De(e){return e>=97&&e<=122||e>=65&&e<=90||e===95}function Oe(e){return De(e)||Ee(e)}function ke(e){return xe.has(e)}var z;(function(e){e[e.Program=0]=`Program`,e[e.Literal=1]=`Literal`,e[e.Identifier=2]=`Identifier`,e[e.MemberExpression=3]=`MemberExpression`,e[e.CallExpression=4]=`CallExpression`,e[e.BinaryExpression=5]=`BinaryExpression`,e[e.UnaryExpression=6]=`UnaryExpression`,e[e.ConditionalExpression=7]=`ConditionalExpression`})(z||={});var Ae=new Map([[`||`,2],[`&&`,3],[`===`,4],[`!==`,4],[`>`,5],[`>=`,5],[`<`,5],[`<=`,5],[`+`,6],[`-`,6],[`*`,7],[`/`,7],[`%`,7],[`!`,8]]),je={type:z.Literal,value:null},Me={type:z.Literal,value:!0},Ne={type:z.Literal,value:!1},Pe=e=>{let t=0,n=e.length,r=()=>t>=n?null:e[t],i=()=>e[t++],a=e=>{let t=r();return t!==null&&t.type===e},o=e=>e.type===R.OPERATOR?Ae.get(e.value)||-1:e.type===R.DOT||e.type===R.BRACKET_LEFT?9:e.type===R.QUESTION?1:-1,s=e=>{let n,o;if(i().type===R.DOT){if(!a(R.IDENTIFIER)){let e=r();throw new L(`Expected property name`,t,e?e.value:`<end of input>`)}let e=i();n={type:z.Identifier,name:e.value},o=!1}else{if(n=l(0),!a(R.BRACKET_RIGHT)){let e=r();throw new L(`Expected closing bracket`,t,e?e.value:`<end of input>`)}i(),o=!0}return{type:z.MemberExpression,object:e,property:n,computed:o}},c=()=>{let e=r();if(!e)throw new L(`Unexpected end of input`,t,`<end of input>`);if(e.type===R.OPERATOR&&(e.value===`!`||e.value===`-`)){i();let t=c();return{type:z.UnaryExpression,operator:e.value,argument:t,prefix:!0}}switch(e.type){case R.NUMBER:return i(),{type:z.Literal,value:Number(e.value)};case R.STRING:return i(),{type:z.Literal,value:e.value};case R.BOOLEAN:return i(),e.value===`true`?Me:Ne;case R.NULL:return i(),je;case R.IDENTIFIER:return i(),{type:z.Identifier,name:e.value};case R.FUNCTION:return(()=>{let e=i(),n=[];if(!a(R.PAREN_LEFT)){let e=r();throw new L(`Expected opening parenthesis after function name`,t,e?e.value:`<end of input>`)}for(i();;){if(a(R.PAREN_RIGHT)){i();break}if(!r()){let e=r();throw new L(`Expected closing parenthesis`,t,e?e.value:`<end of input>`)}if(n.length>0){if(!a(R.COMMA)){let e=r();throw new L(`Expected comma between function arguments`,t,e?e.value:`<end of input>`)}i()}let e=l(0);n.push(e)}return{type:z.CallExpression,callee:{type:z.Identifier,name:e.value},arguments:n}})();case R.PAREN_LEFT:{i();let e=l(0);if(!a(R.PAREN_RIGHT)){let e=r();throw new L(`Expected closing parenthesis`,t,e?e.value:`<end of input>`)}return i(),e}default:throw new L(`Unexpected token: ${e.type}`,t,e.value)}},l=(u=0)=>{let d=c();for(;t<n;){let n=e[t],c=o(n);if(c<=u)break;if(n.type!==R.QUESTION){if(n.type!==R.OPERATOR){if(n.type!==R.DOT&&n.type!==R.BRACKET_LEFT)break;d=s(d)}else{i();let e=l(c);d={type:z.BinaryExpression,operator:n.value,left:d,right:e}}}else{i();let e=l(0);if(!a(R.COLON)){let e=r();throw new L(`Expected : in conditional expression`,t,e?e.value:`<end of input>`)}i();let n=l(0);d={type:z.ConditionalExpression,test:d,consequent:e,alternate:n}}}return d},u=l();return{type:z.Program,body:u}},Fe=(e,t,n)=>{let r=t;n&&(r={...t,context:{...t.context,...n}});let i=e=>{switch(e.type){case z.Literal:return(e=>e.value)(e);case z.Identifier:return(e=>{if(!(e.name in r.context))throw new L(`Undefined variable: ${e.name}`);return r.context[e.name]})(e);case z.MemberExpression:return(e=>{let t=i(e.object);if(t==null)throw new L(`Cannot access property of null or undefined`);return t[e.computed?i(e.property):e.property.name]})(e);case z.CallExpression:return(e=>{let t=r.functions[e.callee.name];if(!t)throw new L(`Undefined function: ${e.callee.name}`);return t(...e.arguments.map((e=>i(e))))})(e);case z.BinaryExpression:return(e=>{if(e.operator===`&&`)return i(e.left)&&i(e.right);if(e.operator===`||`)return i(e.left)||i(e.right);let t=i(e.left),n=i(e.right);switch(e.operator){case`+`:return t+n;case`-`:return t-n;case`*`:return t*n;case`/`:return t/n;case`%`:return t%n;case`===`:return t===n;case`!==`:return t!==n;case`>`:return t>n;case`>=`:return t>=n;case`<`:return t<n;case`<=`:return t<=n;default:throw new L(`Unknown operator: ${e.operator}`)}})(e);case z.UnaryExpression:return(e=>{let t=i(e.argument);if(e.prefix)switch(e.operator){case`!`:return!t;case`-`:if(typeof t!=`number`)throw new L(`Cannot apply unary - to non-number: ${t}`);return-t;default:throw new L(`Unknown operator: ${e.operator}`)}throw new L(`Postfix operators are not supported: ${e.operator}`)})(e);case z.ConditionalExpression:return(e=>{let t=i(e.test);return i(t?e.consequent:e.alternate)})(e);default:throw new L(`Evaluation error: Unsupported node type: ${e.type}`)}};return i(e.body)};function Ie(e){let t=Pe((e=>{let t=e,n=t.length,r=Array(Math.ceil(n/3)),i=0,a=0;function o(e){let r=a+1;a++;let i=``,o=!1;for(;a<n;){let n=t.charCodeAt(a);if(n===e)return o||(i=t.substring(r,a)),a++,{type:R.STRING,value:i};n===92?(o||=(i=t.substring(r,a),!0),a++,i+=t[a]):o&&(i+=t[a]),a++}throw new L(`Unterminated string starting with ${String.fromCharCode(e)}`,a,t.substring(Math.max(0,a-10),a))}function s(){let e=a;for(t.charCodeAt(a)===45&&a++;a<n&&Ee(t.charCodeAt(a));)a++;if(a<n&&t.charCodeAt(a)===46)for(a++;a<n&&Ee(t.charCodeAt(a));)a++;let r=t.slice(e,a);return{type:R.NUMBER,value:r}}function c(){a++;let e=a;if(a<n&&De(t.charCodeAt(a)))for(a++;a<n&&Oe(t.charCodeAt(a));)a++;let r=t.slice(e,a);return{type:R.FUNCTION,value:r}}function l(){let e=a++;for(;a<n&&Oe(t.charCodeAt(a));)a++;let r=t.slice(e,a),i=Se.get(r);return i?{type:i,value:r}:{type:R.IDENTIFIER,value:r}}function u(){if(a+2<n){let e=t.substring(a,a+3);if(Ce.has(e))return a+=3,{type:R.OPERATOR,value:e}}if(a+1<n){let e=t.substring(a,a+2);if(Ce.has(e))return a+=2,{type:R.OPERATOR,value:e}}let e=t[a];if(Ce.has(e))return a++,{type:R.OPERATOR,value:e};throw new L(`Unknown operator at position ${a}: ${t.substring(a,a+1)}`,a,t.substring(Math.max(0,a-10),a))}for(;a<n;){let e=t.charCodeAt(a);if(d=e,be.has(d)){a++;continue}let f=Te.get(e);if(f)r[i++]=f,a++;else if(e!==34&&e!==39){if(Ee(e)||e===45&&a+1<n&&Ee(t.charCodeAt(a+1)))r[i++]=s();else if(e!==64){if(De(e))r[i++]=l();else{if(!ke(e))throw new L(`Unexpected character: ${t[a]}`,a,t.substring(Math.max(0,a-10),a));r[i++]=u()}}else r[i++]=c()}else r[i++]=o(e)}var d;return i===r.length?r:r.slice(0,i)})(e)),n=((e={},t={})=>({context:e,functions:t}))({},ye);return(e={})=>Fe(t,n,e)}function Le(e,t={}){return Ie(e)(t)}function Re(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)try{return Ie(n),Le(n,t)}catch{return}}function ze(e){return typeof e==`number`}function Be(e){if(!e)return[0,0,0];if(ze(e))return[e,e,e];if(Array.isArray(e)&&e.length===0)return[0,0,0];let[t,n=t,r=t]=e;return[t,n,r]}function Ve(e){return ze(e)?!0:Array.isArray(e)?e.every(e=>ze(e)):!1}function B(e){return e==null}function He(e){return typeof e==`string`}function Ue(e){return typeof e==`function`}function We(e,t){if(typeof e==`function`)return e;if(typeof e==`string`){let n=e;return(...e)=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return Re(n,r)}}return()=>e}function Ge(e,t,n=`node`){if(B(e))return()=>t;if(He(e)){let r=We(e,[n]);return e=>{let n=r(e);return ze(n)?n:t}}return Ue(e)?e:ze(e)?()=>e:()=>t}function Ke(e,t=10,n=`node`){if(B(e))return()=>t;if(He(e)){let r=We(e,[n]);return e=>{let n=r(e);return Ve(n)?n:t}}return Ue(e)?e:ze(e)||Array.isArray(e)?()=>e:()=>t}function qe(e){return[e.x,e.y,e.z??0]}var Je=class{constructor(e,t={}){this.edgeIdCounter=new Map,this.nodeMap=Ze(e.nodes,t.node),this.edgeMap=Qe(e.edges||[],t.edge,this.getEdgeId.bind(this))}data(){return{nodes:this.nodeMap,edges:this.edgeMap}}replace(e){this.nodeMap=e.nodes,this.edgeMap=e.edges,this.clearCache()}nodes(){return Array.from(this.nodeMap.values())}node(e){return this.nodeMap.get(e)}nodeAt(e){this.indexNodeCache||this.buildNodeIndexCache();let t=this.indexNodeCache.get(e);return t?this.nodeMap.get(t):void 0}nodeIndexOf(e){return this.nodeIndexCache||this.buildNodeIndexCache(),this.nodeIndexCache.get(e)??-1}firstNode(){return this.nodeMap.values().next().value}forEachNode(e){let t=0;this.nodeMap.forEach(n=>e(n,t++))}originalNode(e){return this.nodeMap.get(e)?._original}nodeCount(){return this.nodeMap.size}edges(){return Array.from(this.edgeMap.values())}edge(e){return this.edgeMap.get(e)}firstEdge(){return this.edgeMap.values().next().value}forEachEdge(e){let t=0;this.edgeMap.forEach(n=>e(n,t++))}originalEdge(e){return this.edgeMap.get(e)?._original}edgeCount(){return this.edgeMap.size}getEdgeId(e){if(e.id)return e.id;let t=`${e.source}-${e.target}`,n=this.edgeIdCounter.get(t)||0,r=n===0?t:`${t}-${n}`;return this.edgeIdCounter.set(t,n+1),r}degree(e,t=`both`){this.degreeCache||this.buildDegreeCache();let n=this.degreeCache.get(e);return n?n[t]:0}neighbors(e,t=`both`){if((!this.outAdjacencyCache||!this.inAdjacencyCache)&&this.buildAdjacencyCache(),t===`out`)return Array.from(this.outAdjacencyCache.get(e)||[]);if(t===`in`)return Array.from(this.inAdjacencyCache.get(e)||[]);if(this.bothAdjacencyCache)return Array.from(this.bothAdjacencyCache.get(e)||[]);let n=this.inAdjacencyCache.get(e),r=this.outAdjacencyCache.get(e);if(!n&&!r)return[];if(!n)return Array.from(r);if(!r)return Array.from(n);let i=new Set;return n.forEach(e=>i.add(e)),r.forEach(e=>i.add(e)),Array.from(i)}successors(e){return this.neighbors(e,`out`)}predecessors(e){return this.neighbors(e,`in`)}setNodeOrder(e){let t=new Map;for(let n of e)t.set(n.id,n);this.nodeMap=t,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}clearCache(){this.degreeCache=void 0,this.inAdjacencyCache=void 0,this.outAdjacencyCache=void 0,this.bothAdjacencyCache=void 0,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}buildDegreeCache(){this.degreeCache=new Map;for(let e of this.edges()){let{source:t,target:n}=e;if(e.source===e.target)continue;this.degreeCache.has(t)||this.degreeCache.set(t,{in:0,out:0,both:0});let r=this.degreeCache.get(e.source);r&&(r.out++,r.both++),this.degreeCache.has(n)||this.degreeCache.set(n,{in:0,out:0,both:0});let i=this.degreeCache.get(e.target);i&&(i.in++,i.both++)}}buildAdjacencyCache(){this.inAdjacencyCache=new Map,this.outAdjacencyCache=new Map;for(let e of this.edges())!this.nodeMap.has(e.source)||!this.nodeMap.has(e.target)||(this.outAdjacencyCache.has(e.source)||this.outAdjacencyCache.set(e.source,new Set),this.outAdjacencyCache.get(e.source).add(e.target),this.inAdjacencyCache.has(e.target)||this.inAdjacencyCache.set(e.target,new Set),this.inAdjacencyCache.get(e.target).add(e.source))}buildNodeIndexCache(){this.nodeIndexCache=new Map,this.indexNodeCache=new Map;let e=0;this.nodeMap.forEach((t,n)=>{this.nodeIndexCache.set(n,e),this.indexNodeCache.set(e,n),e++})}destroy(){this.clearCache(),this.nodeMap.clear(),this.edgeMap.clear(),this.edgeIdCounter.clear()}},Ye=[`id`,`x`,`y`,`z`,`vx`,`vy`,`vz`,`fx`,`fy`,`fz`,`parentId`],Xe=[`id`,`source`,`target`,`points`];function Ze(e,t){if(!e)throw Error(`Data.nodes is required`);let n=new Map;for(let r of e){let e={_original:r};for(let t of Ye){let n=r[t];B(n)||(e[t]=n)}if(t){let n=t(r);for(let t in n){let r=n[t];B(r)||(e[t]=r)}}if(B(e.id))throw Error(`Node is missing id field`);n.set(e.id,e)}return n}function Qe(e,t,n){let r=new Map;for(let i of e){let e={_original:i};for(let t of Xe){let n=i[t];B(n)||(e[t]=n)}if(t){let n=t(i);for(let t in n){let r=n[t];B(r)||(e[t]=r)}}if(B(e.source)||B(e.target))throw Error(`Edge is missing source or target field`);B(e.id)&&(e.id=n?.(i)),r.set(e.id,e)}return r}var $e=class{constructor(e,t={}){this.graph=new Je(e,t)}export(){return this.graph.data()}replace(e){this.graph.replace(e)}forEachNode(e){this.graph.forEachNode(e)}forEachEdge(e){this.graph.forEachEdge((t,n)=>{t.sourceNode=this.graph.node(t.source),t.targetNode=this.graph.node(t.target),e(t,n)})}destroy(){this.graph.destroy()}},et=Symbol(`Comlink.proxy`),tt=Symbol(`Comlink.endpoint`),nt=Symbol(`Comlink.releaseProxy`),rt=Symbol(`Comlink.finalizer`),it=Symbol(`Comlink.thrown`),at=e=>typeof e==`object`&&!!e||typeof e==`function`,ot=new Map([[`proxy`,{canHandle:e=>at(e)&&e[et],serialize(e){let{port1:t,port2:n}=new MessageChannel;return ct(e,t),[n,[n]]},deserialize(e){return e.start(),dt(e)}}],[`throw`,{canHandle:e=>at(e)&&it in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function st(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function ct(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function r(i){if(!i||!i.data)return;if(!st(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:a,type:o,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(V),l;try{let t=s.slice(0,-1).reduce((e,t)=>e[t],e),n=s.reduce((e,t)=>e[t],e);switch(o){case`GET`:l=n;break;case`SET`:t[s.slice(-1)[0]]=V(i.data.value),l=!0;break;case`APPLY`:l=n.apply(t,c);break;case`CONSTRUCT`:l=Ct(new n(...c));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;ct(e,n),l=St(t,[t])}break;case`RELEASE`:l=void 0;break;default:return}}catch(e){l={value:e,[it]:0}}Promise.resolve(l).catch(e=>({value:e,[it]:0})).then(n=>{let[i,s]=wt(n);t.postMessage(Object.assign(Object.assign({},i),{id:a}),s),o===`RELEASE`&&(t.removeEventListener(`message`,r),ut(t),rt in e&&typeof e[rt]==`function`&&e[rt]())}).catch(e=>{let[n,r]=wt({value:TypeError(`Unserializable return value`),[it]:0});t.postMessage(Object.assign(Object.assign({},n),{id:a}),r)})}),t.start&&t.start()}function lt(e){return e.constructor.name===`MessagePort`}function ut(e){lt(e)&&e.close()}function dt(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),vt(e,n,[],t)}function ft(e){if(e)throw Error(`Proxy has been released and is not useable`)}function pt(e){return Tt(e,new Map,{type:`RELEASE`}).then(()=>{ut(e)})}var mt=new WeakMap,ht=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(mt.get(e)||0)-1;mt.set(e,t),t===0&&pt(e)});function gt(e,t){let n=(mt.get(t)||0)+1;mt.set(t,n),ht&&ht.register(e,t,e)}function _t(e){ht&&ht.unregister(e)}function vt(e,t,n=[],r=function(){}){let i=!1,a=new Proxy(r,{get(r,o){if(ft(i),o===nt)return()=>{_t(a),pt(e),t.clear(),i=!0};if(o===`then`){if(n.length===0)return{then:()=>a};let r=Tt(e,t,{type:`GET`,path:n.map(e=>e.toString())}).then(V);return r.then.bind(r)}return vt(e,t,[...n,o])},set(r,a,o){ft(i);let[s,c]=wt(o);return Tt(e,t,{type:`SET`,path:[...n,a].map(e=>e.toString()),value:s},c).then(V)},apply(r,a,o){ft(i);let s=n[n.length-1];if(s===tt)return Tt(e,t,{type:`ENDPOINT`}).then(V);if(s===`bind`)return vt(e,t,n.slice(0,-1));let[c,l]=bt(o);return Tt(e,t,{type:`APPLY`,path:n.map(e=>e.toString()),argumentList:c},l).then(V)},construct(r,a){ft(i);let[o,s]=bt(a);return Tt(e,t,{type:`CONSTRUCT`,path:n.map(e=>e.toString()),argumentList:o},s).then(V)}});return gt(a,e),a}function yt(e){return Array.prototype.concat.apply([],e)}function bt(e){let t=e.map(wt);return[t.map(e=>e[0]),yt(t.map(e=>e[1]))]}var xt=new WeakMap;function St(e,t){return xt.set(e,t),e}function Ct(e){return Object.assign(e,{[et]:!0})}function wt(e){for(let[t,n]of ot)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},xt.get(e)||[]]}function V(e){switch(e.type){case`HANDLER`:return ot.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function Tt(e,t,n,r){return new Promise(i=>{let a=Et();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function Et(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}var Dt=class{constructor(){this.worker=null,this.workerApi=null}execute(e,t,n){return ve(this,void 0,void 0,function*(){if(this.worker||(yield this.initWorker()),!this.workerApi)throw Error(`Worker API not initialized`);return yield this.workerApi.execute(e,t,n)})}destroy(){this.workerApi&&this.workerApi.destroy(),this.worker&&(this.worker.terminate(),this.worker=null,this.workerApi=null)}initWorker(){return ve(this,void 0,void 0,function*(){let e=this.resolveWorkerPath(),t=e.includes(`/lib/`)||e.endsWith(`.mjs`)?`module`:`classic`;this.worker=new Worker(e,{type:t}),this.workerApi=dt(this.worker)})}resolveWorkerPath(){let e=(()=>{if(typeof document>`u`)return null;let e=document.currentScript;if(e?.src)return e.src;let t=document.getElementsByTagName(`script`);for(let e=t.length-1;e>=0;e--){let n=t[e].src;if(n&&(n.includes(`index.js`)||n.includes(`index.min.js`)))return n}return null})();if(e){if(e.includes(`index.js`)||e.includes(`index.min.js`)){let t=e.replace(/index(\.min)?\.(m?js)(\?.*)?$/,`worker.js`);if(t!==e)return t}let t=e.replace(/\/runtime\/[^/]+\.(m?js)(\?.*)?$/,`/worker.js`);if(t!==e)return t;let n=e.replace(/\/[^/]+\.(m?js)(\?.*)?$/,`/worker.js`);if(n!==e)return n}return`./worker.js`}},Ot=class{constructor(e){this.supervisor=null,this.initialOptions=this.mergeOptions(this.getDefaultOptions(),e)}get options(){return this.runtimeOptions||this.initialOptions}mergeOptions(e,t){return Object.assign({},e,t||{})}execute(e,t){return ve(this,void 0,void 0,function*(){this.runtimeOptions=this.mergeOptions(this.initialOptions,t);let{node:n,edge:r,enableWorker:i}=this.runtimeOptions;this.context=new $e(e,{node:n,edge:r}),this.model=this.context.graph,i&&typeof Worker<`u`?yield this.layoutInWorker(e,this.runtimeOptions):yield this.layout(this.runtimeOptions)})}layoutInWorker(e,t){var n;return ve(this,void 0,void 0,function*(){try{this.supervisor||=new Dt;let r=yield this.supervisor.execute(this.id,e,t);(n=this.context)==null||n.replace(r)}catch(e){console.error(`Layout in worker failed, fallback to main thread layout.`,e),yield this.layout(t)}})}forEachNode(e){this.context.forEachNode(e)}forEachEdge(e){this.context.forEachEdge(e)}destroy(){var e;(e=this.context)==null||e.destroy(),this.model=null,this.context=null,this.supervisor&&=(this.supervisor.destroy(),null)}};function kt(e){return Array.isArray(e)}var At=(function(e){var t=typeof e;return e!==null&&t===`object`||t===`function`}),jt=function(e){return typeof e==`object`&&!!e},Mt={}.toString,Nt=function(e,t){return Mt.call(e)===`[object `+t+`]`},Pt=function(e){if(!jt(e)||!Nt(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},Ft=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function It(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Lt(e){throw Error(`Could not dynamically require "`+e+`". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.`)}var Rt,zt;function Bt(){if(zt)return Rt;zt=1;function e(){this.__data__=[],this.size=0}return Rt=e,Rt}var Vt,Ht;function Ut(){if(Ht)return Vt;Ht=1;function e(e,t){return e===t||e!==e&&t!==t}return Vt=e,Vt}var Wt,Gt;function Kt(){if(Gt)return Wt;Gt=1;var e=Ut();function t(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}return Wt=t,Wt}var qt,Jt;function Yt(){if(Jt)return qt;Jt=1;var e=Kt(),t=Array.prototype.splice;function n(n){var r=this.__data__,i=e(r,n);return i<0?!1:(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}return qt=n,qt}var Xt,Zt;function Qt(){if(Zt)return Xt;Zt=1;var e=Kt();function t(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}return Xt=t,Xt}var $t,en;function tn(){if(en)return $t;en=1;var e=Kt();function t(t){return e(this.__data__,t)>-1}return $t=t,$t}var nn,rn;function an(){if(rn)return nn;rn=1;var e=Kt();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return nn=t,nn}var on,sn;function cn(){if(sn)return on;sn=1;var e=Bt(),t=Yt(),n=Qt(),r=tn(),i=an();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,on=a,on}var ln,un;function dn(){if(un)return ln;un=1;var e=cn();function t(){this.__data__=new e,this.size=0}return ln=t,ln}var fn,pn;function mn(){if(pn)return fn;pn=1;function e(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}return fn=e,fn}var hn,gn;function _n(){if(gn)return hn;gn=1;function e(e){return this.__data__.get(e)}return hn=e,hn}var vn,yn;function bn(){if(yn)return vn;yn=1;function e(e){return this.__data__.has(e)}return vn=e,vn}var xn,Sn;function Cn(){return Sn?xn:(Sn=1,xn=typeof Ft==`object`&&Ft&&Ft.Object===Object&&Ft,xn)}var wn,Tn;function H(){if(Tn)return wn;Tn=1;var e=Cn(),t=typeof self==`object`&&self&&self.Object===Object&&self;return wn=e||t||Function(`return this`)(),wn}var En,Dn;function On(){return Dn?En:(Dn=1,En=H().Symbol,En)}var kn,An;function jn(){if(An)return kn;An=1;var e=On(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch{}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}return kn=a,kn}var Mn,Nn;function Pn(){if(Nn)return Mn;Nn=1;var e=Object.prototype.toString;function t(t){return e.call(t)}return Mn=t,Mn}var Fn,In;function U(){if(In)return Fn;In=1;var e=On(),t=jn(),n=Pn(),r=`[object Null]`,i=`[object Undefined]`,a=e?e.toStringTag:void 0;function o(e){return e==null?e===void 0?i:r:a&&a in Object(e)?t(e):n(e)}return Fn=o,Fn}var Ln,Rn;function W(){if(Rn)return Ln;Rn=1;function e(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}return Ln=e,Ln}var zn,Bn;function Vn(){if(Bn)return zn;Bn=1;var e=U(),t=W(),n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Proxy]`;function o(o){if(!t(o))return!1;var s=e(o);return s==r||s==i||s==n||s==a}return zn=o,zn}var Hn,Un;function Wn(){return Un?Hn:(Un=1,Hn=H()[`__core-js_shared__`],Hn)}var Gn,Kn;function qn(){if(Kn)return Gn;Kn=1;var e=Wn(),t=function(){var t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||``);return t?`Symbol(src)_1.`+t:``}();function n(e){return!!t&&t in e}return Gn=n,Gn}var Jn,Yn;function Xn(){if(Yn)return Jn;Yn=1;var e=Function.prototype.toString;function t(t){if(t!=null){try{return e.call(t)}catch{}try{return t+``}catch{}}return``}return Jn=t,Jn}var Zn,Qn;function $n(){if(Qn)return Zn;Qn=1;var e=Vn(),t=qn(),n=W(),r=Xn(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=RegExp(`^`+c.call(l).replace(i,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function d(i){return!n(i)||t(i)?!1:(e(i)?u:a).test(r(i))}return Zn=d,Zn}var er,tr;function nr(){if(tr)return er;tr=1;function e(e,t){return e?.[t]}return er=e,er}var rr,ir;function ar(){if(ir)return rr;ir=1;var e=$n(),t=nr();function n(n,r){var i=t(n,r);return e(i)?i:void 0}return rr=n,rr}var or,sr;function cr(){return sr?or:(sr=1,or=ar()(H(),`Map`),or)}var lr,ur;function dr(){return ur?lr:(ur=1,lr=ar()(Object,`create`),lr)}var fr,pr;function mr(){if(pr)return fr;pr=1;var e=dr();function t(){this.__data__=e?e(null):{},this.size=0}return fr=t,fr}var hr,gr;function _r(){if(gr)return hr;gr=1;function e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}return hr=e,hr}var vr,yr;function br(){if(yr)return vr;yr=1;var e=dr(),t=`__lodash_hash_undefined__`,n=Object.prototype.hasOwnProperty;function r(r){var i=this.__data__;if(e){var a=i[r];return a===t?void 0:a}return n.call(i,r)?i[r]:void 0}return vr=r,vr}var xr,Sr;function Cr(){if(Sr)return xr;Sr=1;var e=dr(),t=Object.prototype.hasOwnProperty;function n(n){var r=this.__data__;return e?r[n]!==void 0:t.call(r,n)}return xr=n,xr}var wr,Tr;function Er(){if(Tr)return wr;Tr=1;var e=dr(),t=`__lodash_hash_undefined__`;function n(n,r){var i=this.__data__;return this.size+=+!this.has(n),i[n]=e&&r===void 0?t:r,this}return wr=n,wr}var Dr,Or;function kr(){if(Or)return Dr;Or=1;var e=mr(),t=_r(),n=br(),r=Cr(),i=Er();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Dr=a,Dr}var Ar,jr;function Mr(){if(jr)return Ar;jr=1;var e=kr(),t=cn(),n=cr();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Ar=r,Ar}var Nr,Pr;function Fr(){if(Pr)return Nr;Pr=1;function e(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}return Nr=e,Nr}var Ir,Lr;function Rr(){if(Lr)return Ir;Lr=1;var e=Fr();function t(t,n){var r=t.__data__;return e(n)?r[typeof n==`string`?`string`:`hash`]:r.map}return Ir=t,Ir}var zr,Br;function Vr(){if(Br)return zr;Br=1;var e=Rr();function t(t){var n=e(this,t).delete(t);return this.size-=+!!n,n}return zr=t,zr}var Hr,Ur;function Wr(){if(Ur)return Hr;Ur=1;var e=Rr();function t(t){return e(this,t).get(t)}return Hr=t,Hr}var Gr,Kr;function qr(){if(Kr)return Gr;Kr=1;var e=Rr();function t(t){return e(this,t).has(t)}return Gr=t,Gr}var Jr,Yr;function Xr(){if(Yr)return Jr;Yr=1;var e=Rr();function t(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}return Jr=t,Jr}var Zr,Qr;function $r(){if(Qr)return Zr;Qr=1;var e=Mr(),t=Vr(),n=Wr(),r=qr(),i=Xr();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Zr=a,Zr}var ei,ti;function ni(){if(ti)return ei;ti=1;var e=cn(),t=cr(),n=$r(),r=200;function i(i,a){var o=this.__data__;if(o instanceof e){var s=o.__data__;if(!t||s.length<r-1)return s.push([i,a]),this.size=++o.size,this;o=this.__data__=new n(s)}return o.set(i,a),this.size=o.size,this}return ei=i,ei}var ri,ii;function ai(){if(ii)return ri;ii=1;var e=cn(),t=dn(),n=mn(),r=_n(),i=bn(),a=ni();function o(t){var n=this.__data__=new e(t);this.size=n.size}return o.prototype.clear=t,o.prototype.delete=n,o.prototype.get=r,o.prototype.has=i,o.prototype.set=a,ri=o,ri}var oi,si;function ci(){if(si)return oi;si=1;function e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}return oi=e,oi}var li,ui;function di(){if(ui)return li;ui=1;var e=ar();return li=function(){try{var t=e(Object,`defineProperty`);return t({},``,{}),t}catch{}}(),li}var fi,pi;function mi(){if(pi)return fi;pi=1;var e=di();function t(t,n,r){n==`__proto__`&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}return fi=t,fi}var hi,gi;function _i(){if(gi)return hi;gi=1;var e=mi(),t=Ut(),n=Object.prototype.hasOwnProperty;function r(r,i,a){var o=r[i];(!(n.call(r,i)&&t(o,a))||a===void 0&&!(i in r))&&e(r,i,a)}return hi=r,hi}var vi,yi;function bi(){if(yi)return vi;yi=1;var e=_i(),t=mi();function n(n,r,i,a){var o=!i;i||={};for(var s=-1,c=r.length;++s<c;){var l=r[s],u=a?a(i[l],n[l],l,i,n):void 0;u===void 0&&(u=n[l]),o?t(i,l,u):e(i,l,u)}return i}return vi=n,vi}var xi,Si;function Ci(){if(Si)return xi;Si=1;function e(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}return xi=e,xi}var wi,Ti;function G(){if(Ti)return wi;Ti=1;function e(e){return typeof e==`object`&&!!e}return wi=e,wi}var Ei,Di;function Oi(){if(Di)return Ei;Di=1;var e=U(),t=G(),n=`[object Arguments]`;function r(r){return t(r)&&e(r)==n}return Ei=r,Ei}var ki,Ai;function ji(){if(Ai)return ki;Ai=1;var e=Oi(),t=G(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable;return ki=e(function(){return arguments}())?e:function(e){return t(e)&&r.call(e,`callee`)&&!i.call(e,`callee`)},ki}var Mi,Ni;function K(){return Ni?Mi:(Ni=1,Mi=Array.isArray,Mi)}var Pi={exports:{}},Fi,Ii;function Li(){if(Ii)return Fi;Ii=1;function e(){return!1}return Fi=e,Fi}Pi.exports;var Ri;function zi(){return Ri?Pi.exports:(Ri=1,(function(e,t){var n=H(),r=Li(),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i?n.Buffer:void 0;e.exports=(o?o.isBuffer:void 0)||r})(Pi,Pi.exports),Pi.exports)}var Bi,Vi;function Hi(){if(Vi)return Bi;Vi=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(n,r){var i=typeof n;return r??=e,!!r&&(i==`number`||i!=`symbol`&&t.test(n))&&n>-1&&n%1==0&&n<r}return Bi=n,Bi}var Ui,Wi;function Gi(){if(Wi)return Ui;Wi=1;var e=9007199254740991;function t(t){return typeof t==`number`&&t>-1&&t%1==0&&t<=e}return Ui=t,Ui}var Ki,qi;function Ji(){if(qi)return Ki;qi=1;var e=U(),t=Gi(),n=G(),r=`[object Arguments]`,i=`[object Array]`,a=`[object Boolean]`,o=`[object Date]`,s=`[object Error]`,c=`[object Function]`,l=`[object Map]`,u=`[object Number]`,d=`[object Object]`,f=`[object RegExp]`,p=`[object Set]`,m=`[object String]`,h=`[object WeakMap]`,g=`[object ArrayBuffer]`,_=`[object DataView]`,v=`[object Float32Array]`,y=`[object Float64Array]`,b=`[object Int8Array]`,x=`[object Int16Array]`,S=`[object Int32Array]`,C=`[object Uint8Array]`,w=`[object Uint8ClampedArray]`,T=`[object Uint16Array]`,E=`[object Uint32Array]`,D={};D[v]=D[y]=D[b]=D[x]=D[S]=D[C]=D[w]=D[T]=D[E]=!0,D[r]=D[i]=D[g]=D[a]=D[_]=D[o]=D[s]=D[c]=D[l]=D[u]=D[d]=D[f]=D[p]=D[m]=D[h]=!1;function O(r){return n(r)&&t(r.length)&&!!D[e(r)]}return Ki=O,Ki}var Yi,Xi;function Zi(){if(Xi)return Yi;Xi=1;function e(e){return function(t){return e(t)}}return Yi=e,Yi}var Qi={exports:{}};Qi.exports;var $i;function ea(){return $i?Qi.exports:($i=1,(function(e,t){var n=Cn(),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r&&n.process;e.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})(Qi,Qi.exports),Qi.exports)}var ta,na;function ra(){if(na)return ta;na=1;var e=Ji(),t=Zi(),n=ea(),r=n&&n.isTypedArray;return ta=r?t(r):e,ta}var ia,aa;function oa(){if(aa)return ia;aa=1;var e=Ci(),t=ji(),n=K(),r=zi(),i=Hi(),a=ra(),o=Object.prototype.hasOwnProperty;function s(s,c){var l=n(s),u=!l&&t(s),d=!l&&!u&&r(s),f=!l&&!u&&!d&&a(s),p=l||u||d||f,m=p?e(s.length,String):[],h=m.length;for(var g in s)(c||o.call(s,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||i(g,h)))&&m.push(g);return m}return ia=s,ia}var sa,ca;function la(){if(ca)return sa;ca=1;var e=Object.prototype;function t(t){var n=t&&t.constructor;return t===(typeof n==`function`&&n.prototype||e)}return sa=t,sa}var ua,da;function fa(){if(da)return ua;da=1;function e(e,t){return function(n){return e(t(n))}}return ua=e,ua}var pa,ma;function ha(){return ma?pa:(ma=1,pa=fa()(Object.keys,Object),pa)}var ga,_a;function va(){if(_a)return ga;_a=1;var e=la(),t=ha(),n=Object.prototype.hasOwnProperty;function r(r){if(!e(r))return t(r);var i=[];for(var a in Object(r))n.call(r,a)&&a!=`constructor`&&i.push(a);return i}return ga=r,ga}var ya,ba;function q(){if(ba)return ya;ba=1;var e=Vn(),t=Gi();function n(n){return n!=null&&t(n.length)&&!e(n)}return ya=n,ya}var xa,Sa;function J(){if(Sa)return xa;Sa=1;var e=oa(),t=va(),n=q();function r(r){return n(r)?e(r):t(r)}return xa=r,xa}var Ca,wa;function Ta(){if(wa)return Ca;wa=1;var e=bi(),t=J();function n(n,r){return n&&e(r,t(r),n)}return Ca=n,Ca}var Ea,Da;function Oa(){if(Da)return Ea;Da=1;function e(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}return Ea=e,Ea}var ka,Aa;function ja(){if(Aa)return ka;Aa=1;var e=W(),t=la(),n=Oa(),r=Object.prototype.hasOwnProperty;function i(i){if(!e(i))return n(i);var a=t(i),o=[];for(var s in i)s==`constructor`&&(a||!r.call(i,s))||o.push(s);return o}return ka=i,ka}var Ma,Na;function Pa(){if(Na)return Ma;Na=1;var e=oa(),t=ja(),n=q();function r(r){return n(r)?e(r,!0):t(r)}return Ma=r,Ma}var Fa,Ia;function La(){if(Ia)return Fa;Ia=1;var e=bi(),t=Pa();function n(n,r){return n&&e(r,t(r),n)}return Fa=n,Fa}var Ra={exports:{}};Ra.exports;var za;function Ba(){return za?Ra.exports:(za=1,(function(e,t){var n=H(),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r?n.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(e,t){if(t)return e.slice();var n=e.length,r=o?o(n):new e.constructor(n);return e.copy(r),r}e.exports=s})(Ra,Ra.exports),Ra.exports)}var Va,Ha;function Ua(){if(Ha)return Va;Ha=1;function e(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}return Va=e,Va}var Wa,Ga;function Ka(){if(Ga)return Wa;Ga=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}return Wa=e,Wa}var qa,Ja;function Ya(){if(Ja)return qa;Ja=1;function e(){return[]}return qa=e,qa}var Xa,Za;function Qa(){if(Za)return Xa;Za=1;var e=Ka(),t=Ya(),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Xa=r?function(t){return t==null?[]:(t=Object(t),e(r(t),function(e){return n.call(t,e)}))}:t,Xa}var $a,eo;function to(){if(eo)return $a;eo=1;var e=bi(),t=Qa();function n(n,r){return e(n,t(n),r)}return $a=n,$a}var no,ro;function io(){if(ro)return no;ro=1;function e(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}return no=e,no}var ao,oo;function so(){return oo?ao:(oo=1,ao=fa()(Object.getPrototypeOf,Object),ao)}var co,lo;function uo(){if(lo)return co;lo=1;var e=io(),t=so(),n=Qa(),r=Ya();return co=Object.getOwnPropertySymbols?function(r){for(var i=[];r;)e(i,n(r)),r=t(r);return i}:r,co}var fo,po;function mo(){if(po)return fo;po=1;var e=bi(),t=uo();function n(n,r){return e(n,t(n),r)}return fo=n,fo}var ho,go;function _o(){if(go)return ho;go=1;var e=io(),t=K();function n(n,r,i){var a=r(n);return t(n)?a:e(a,i(n))}return ho=n,ho}var vo,yo;function bo(){if(yo)return vo;yo=1;var e=_o(),t=Qa(),n=J();function r(r){return e(r,n,t)}return vo=r,vo}var xo,So;function Co(){if(So)return xo;So=1;var e=_o(),t=uo(),n=Pa();function r(r){return e(r,n,t)}return xo=r,xo}var wo,To;function Eo(){return To?wo:(To=1,wo=ar()(H(),`DataView`),wo)}var Do,Oo;function ko(){return Oo?Do:(Oo=1,Do=ar()(H(),`Promise`),Do)}var Ao,jo;function Mo(){return jo?Ao:(jo=1,Ao=ar()(H(),`Set`),Ao)}var No,Po;function Fo(){return Po?No:(Po=1,No=ar()(H(),`WeakMap`),No)}var Io,Lo;function Ro(){if(Lo)return Io;Lo=1;var e=Eo(),t=cr(),n=ko(),r=Mo(),i=Fo(),a=U(),o=Xn(),s=`[object Map]`,c=`[object Object]`,l=`[object Promise]`,u=`[object Set]`,d=`[object WeakMap]`,f=`[object DataView]`,p=o(e),m=o(t),h=o(n),g=o(r),_=o(i),v=a;return(e&&v(new e(new ArrayBuffer(1)))!=f||t&&v(new t)!=s||n&&v(n.resolve())!=l||r&&v(new r)!=u||i&&v(new i)!=d)&&(v=function(e){var t=a(e),n=t==c?e.constructor:void 0,r=n?o(n):``;if(r)switch(r){case p:return f;case m:return s;case h:return l;case g:return u;case _:return d}return t}),Io=v,Io}var zo,Bo;function Vo(){if(Bo)return zo;Bo=1;var e=Object.prototype.hasOwnProperty;function t(t){var n=t.length,r=new t.constructor(n);return n&&typeof t[0]==`string`&&e.call(t,`index`)&&(r.index=t.index,r.input=t.input),r}return zo=t,zo}var Ho,Uo;function Wo(){return Uo?Ho:(Uo=1,Ho=H().Uint8Array,Ho)}var Go,Ko;function qo(){if(Ko)return Go;Ko=1;var e=Wo();function t(t){var n=new t.constructor(t.byteLength);return new e(n).set(new e(t)),n}return Go=t,Go}var Jo,Yo;function Xo(){if(Yo)return Jo;Yo=1;var e=qo();function t(t,n){var r=n?e(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}return Jo=t,Jo}var Zo,Qo;function $o(){if(Qo)return Zo;Qo=1;var e=/\w*$/;function t(t){var n=new t.constructor(t.source,e.exec(t));return n.lastIndex=t.lastIndex,n}return Zo=t,Zo}var es,ts;function ns(){if(ts)return es;ts=1;var e=On(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(e){return n?Object(n.call(e)):{}}return es=r,es}var rs,is;function as(){if(is)return rs;is=1;var e=qo();function t(t,n){var r=n?e(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}return rs=t,rs}var os,ss;function cs(){if(ss)return os;ss=1;var e=qo(),t=Xo(),n=$o(),r=ns(),i=as(),a=`[object Boolean]`,o=`[object Date]`,s=`[object Map]`,c=`[object Number]`,l=`[object RegExp]`,u=`[object Set]`,d=`[object String]`,f=`[object Symbol]`,p=`[object ArrayBuffer]`,m=`[object DataView]`,h=`[object Float32Array]`,g=`[object Float64Array]`,_=`[object Int8Array]`,v=`[object Int16Array]`,y=`[object Int32Array]`,b=`[object Uint8Array]`,x=`[object Uint8ClampedArray]`,S=`[object Uint16Array]`,C=`[object Uint32Array]`;function w(w,T,E){var D=w.constructor;switch(T){case p:return e(w);case a:case o:return new D(+w);case m:return t(w,E);case h:case g:case _:case v:case y:case b:case x:case S:case C:return i(w,E);case s:return new D;case c:case d:return new D(w);case l:return n(w);case u:return new D;case f:return r(w)}}return os=w,os}var ls,us;function ds(){if(us)return ls;us=1;var e=W(),t=Object.create;return ls=function(){function n(){}return function(r){if(!e(r))return{};if(t)return t(r);n.prototype=r;var i=new n;return n.prototype=void 0,i}}(),ls}var fs,ps;function ms(){if(ps)return fs;ps=1;var e=ds(),t=so(),n=la();function r(r){return typeof r.constructor==`function`&&!n(r)?e(t(r)):{}}return fs=r,fs}var hs,gs;function _s(){if(gs)return hs;gs=1;var e=Ro(),t=G(),n=`[object Map]`;function r(r){return t(r)&&e(r)==n}return hs=r,hs}var vs,ys;function bs(){if(ys)return vs;ys=1;var e=_s(),t=Zi(),n=ea(),r=n&&n.isMap;return vs=r?t(r):e,vs}var xs,Ss;function Cs(){if(Ss)return xs;Ss=1;var e=Ro(),t=G(),n=`[object Set]`;function r(r){return t(r)&&e(r)==n}return xs=r,xs}var ws,Ts;function Es(){if(Ts)return ws;Ts=1;var e=Cs(),t=Zi(),n=ea(),r=n&&n.isSet;return ws=r?t(r):e,ws}var Ds,Os;function ks(){if(Os)return Ds;Os=1;var e=ai(),t=ci(),n=_i(),r=Ta(),i=La(),a=Ba(),o=Ua(),s=to(),c=mo(),l=bo(),u=Co(),d=Ro(),f=Vo(),p=cs(),m=ms(),h=K(),g=zi(),_=bs(),v=W(),y=Es(),b=J(),x=Pa(),S=1,C=2,w=4,T=`[object Arguments]`,E=`[object Array]`,D=`[object Boolean]`,O=`[object Date]`,k=`[object Error]`,ee=`[object Function]`,te=`[object GeneratorFunction]`,A=`[object Map]`,j=`[object Number]`,ne=`[object Object]`,M=`[object RegExp]`,N=`[object Set]`,P=`[object String]`,re=`[object Symbol]`,ie=`[object WeakMap]`,F=`[object ArrayBuffer]`,ae=`[object DataView]`,oe=`[object Float32Array]`,se=`[object Float64Array]`,ce=`[object Int8Array]`,le=`[object Int16Array]`,ue=`[object Int32Array]`,de=`[object Uint8Array]`,fe=`[object Uint8ClampedArray]`,pe=`[object Uint16Array]`,me=`[object Uint32Array]`,I={};I[T]=I[E]=I[F]=I[ae]=I[D]=I[O]=I[oe]=I[se]=I[ce]=I[le]=I[ue]=I[A]=I[j]=I[ne]=I[M]=I[N]=I[P]=I[re]=I[de]=I[fe]=I[pe]=I[me]=!0,I[k]=I[ee]=I[ie]=!1;function he(E,D,O,k,A,j){var M,N=D&S,P=D&C,re=D&w;if(O&&(M=A?O(E,k,A,j):O(E)),M!==void 0)return M;if(!v(E))return E;var ie=h(E);if(ie){if(M=f(E),!N)return o(E,M)}else{var F=d(E),ae=F==ee||F==te;if(g(E))return a(E,N);if(F==ne||F==T||ae&&!A){if(M=P||ae?{}:m(E),!N)return P?c(E,i(M,E)):s(E,r(M,E))}else{if(!I[F])return A?E:{};M=p(E,F,N)}}j||=new e;var oe=j.get(E);if(oe)return oe;j.set(E,M),y(E)?E.forEach(function(e){M.add(he(e,D,O,e,E,j))}):_(E)&&E.forEach(function(e,t){M.set(t,he(e,D,O,t,E,j))});var se=ie?void 0:(re?P?u:l:P?x:b)(E);return t(se||E,function(e,t){se&&(t=e,e=E[t]),n(M,t,he(e,D,O,t,E,j))}),M}return Ds=he,Ds}var As,js;function Ms(){if(js)return As;js=1;var e=ks(),t=4;function n(n){return e(n,t)}return As=n,As}var Ns,Ps;function Fs(){if(Ps)return Ns;Ps=1;function e(e){return function(){return e}}return Ns=e,Ns}var Is,Ls;function Rs(){if(Ls)return Is;Ls=1;function e(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}return Is=e,Is}var zs,Bs;function Vs(){return Bs?zs:(Bs=1,zs=Rs()(),zs)}var Hs,Us;function Ws(){if(Us)return Hs;Us=1;var e=Vs(),t=J();function n(n,r){return n&&e(n,r,t)}return Hs=n,Hs}var Gs,Ks;function qs(){if(Ks)return Gs;Ks=1;var e=q();function t(t,n){return function(r,i){if(r==null)return r;if(!e(r))return t(r,i);for(var a=r.length,o=n?a:-1,s=Object(r);(n?o--:++o<a)&&i(s[o],o,s)!==!1;);return r}}return Gs=t,Gs}var Js,Ys;function Xs(){if(Ys)return Js;Ys=1;var e=Ws();return Js=qs()(e),Js}var Zs,Qs;function $s(){if(Qs)return Zs;Qs=1;function e(e){return e}return Zs=e,Zs}var ec,tc;function nc(){if(tc)return ec;tc=1;var e=$s();function t(t){return typeof t==`function`?t:e}return ec=t,ec}var rc,ic;function ac(){if(ic)return rc;ic=1;var e=ci(),t=Xs(),n=nc(),r=K();function i(i,a){return(r(i)?e:t)(i,n(a))}return rc=i,rc}var oc,sc;function cc(){return sc?oc:(sc=1,oc=ac(),oc)}var lc,uc;function dc(){if(uc)return lc;uc=1;var e=Xs();function t(t,n){var r=[];return e(t,function(e,t,i){n(e,t,i)&&r.push(e)}),r}return lc=t,lc}var fc,pc;function mc(){if(pc)return fc;pc=1;var e=`__lodash_hash_undefined__`;function t(t){return this.__data__.set(t,e),this}return fc=t,fc}var hc,gc;function _c(){if(gc)return hc;gc=1;function e(e){return this.__data__.has(e)}return hc=e,hc}var vc,yc;function bc(){if(yc)return vc;yc=1;var e=$r(),t=mc(),n=_c();function r(t){var n=-1,r=t==null?0:t.length;for(this.__data__=new e;++n<r;)this.add(t[n])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,vc=r,vc}var xc,Sc;function Cc(){if(Sc)return xc;Sc=1;function e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}return xc=e,xc}var wc,Tc;function Ec(){if(Tc)return wc;Tc=1;function e(e,t){return e.has(t)}return wc=e,wc}var Dc,Oc;function kc(){if(Oc)return Dc;Oc=1;var e=bc(),t=Cc(),n=Ec(),r=1,i=2;function a(a,o,s,c,l,u){var d=s&r,f=a.length,p=o.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(a),h=u.get(o);if(m&&h)return m==o&&h==a;var g=-1,_=!0,v=s&i?new e:void 0;for(u.set(a,o),u.set(o,a);++g<f;){var y=a[g],b=o[g];if(c)var x=d?c(b,y,g,o,a,u):c(y,b,g,a,o,u);if(x!==void 0){if(x)continue;_=!1;break}if(v){if(!t(o,function(e,t){if(!n(v,t)&&(y===e||l(y,e,s,c,u)))return v.push(t)})){_=!1;break}}else if(!(y===b||l(y,b,s,c,u))){_=!1;break}}return u.delete(a),u.delete(o),_}return Dc=a,Dc}var Ac,jc;function Mc(){if(jc)return Ac;jc=1;function e(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}return Ac=e,Ac}var Nc,Pc;function Fc(){if(Pc)return Nc;Pc=1;function e(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}return Nc=e,Nc}var Ic,Lc;function Rc(){if(Lc)return Ic;Lc=1;var e=On(),t=Wo(),n=Ut(),r=kc(),i=Mc(),a=Fc(),o=1,s=2,c=`[object Boolean]`,l=`[object Date]`,u=`[object Error]`,d=`[object Map]`,f=`[object Number]`,p=`[object RegExp]`,m=`[object Set]`,h=`[object String]`,g=`[object Symbol]`,_=`[object ArrayBuffer]`,v=`[object DataView]`,y=e?e.prototype:void 0,b=y?y.valueOf:void 0;function x(e,y,x,S,C,w,T){switch(x){case v:if(e.byteLength!=y.byteLength||e.byteOffset!=y.byteOffset)return!1;e=e.buffer,y=y.buffer;case _:return!(e.byteLength!=y.byteLength||!w(new t(e),new t(y)));case c:case l:case f:return n(+e,+y);case u:return e.name==y.name&&e.message==y.message;case p:case h:return e==y+``;case d:var E=i;case m:var D=S&o;if(E||=a,e.size!=y.size&&!D)return!1;var O=T.get(e);if(O)return O==y;S|=s,T.set(e,y);var k=r(E(e),E(y),S,C,w,T);return T.delete(e),k;case g:if(b)return b.call(e)==b.call(y)}return!1}return Ic=x,Ic}var zc,Bc;function Vc(){if(Bc)return zc;Bc=1;var e=bo(),t=1,n=Object.prototype.hasOwnProperty;function r(r,i,a,o,s,c){var l=a&t,u=e(r),d=u.length;if(d!=e(i).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in i:n.call(i,p)))return!1}var m=c.get(r),h=c.get(i);if(m&&h)return m==i&&h==r;var g=!0;c.set(r,i),c.set(i,r);for(var _=l;++f<d;){p=u[f];var v=r[p],y=i[p];if(o)var b=l?o(y,v,p,i,r,c):o(v,y,p,r,i,c);if(!(b===void 0?v===y||s(v,y,a,o,c):b)){g=!1;break}_||=p==`constructor`}if(g&&!_){var x=r.constructor,S=i.constructor;x!=S&&`constructor`in r&&`constructor`in i&&!(typeof x==`function`&&x instanceof x&&typeof S==`function`&&S instanceof S)&&(g=!1)}return c.delete(r),c.delete(i),g}return zc=r,zc}var Hc,Uc;function Wc(){if(Uc)return Hc;Uc=1;var e=ai(),t=kc(),n=Rc(),r=Vc(),i=Ro(),a=K(),o=zi(),s=ra(),c=1,l=`[object Arguments]`,u=`[object Array]`,d=`[object Object]`,f=Object.prototype.hasOwnProperty;function p(p,m,h,g,_,v){var y=a(p),b=a(m),x=y?u:i(p),S=b?u:i(m);x=x==l?d:x,S=S==l?d:S;var C=x==d,w=S==d,T=x==S;if(T&&o(p)){if(!o(m))return!1;y=!0,C=!1}if(T&&!C)return v||=new e,y||s(p)?t(p,m,h,g,_,v):n(p,m,x,h,g,_,v);if(!(h&c)){var E=C&&f.call(p,`__wrapped__`),D=w&&f.call(m,`__wrapped__`);if(E||D){var O=E?p.value():p,k=D?m.value():m;return v||=new e,_(O,k,h,g,v)}}return T?(v||=new e,r(p,m,h,g,_,v)):!1}return Hc=p,Hc}var Gc,Kc;function qc(){if(Kc)return Gc;Kc=1;var e=Wc(),t=G();function n(r,i,a,o,s){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,a,o,n,s)}return Gc=n,Gc}var Jc,Yc;function Xc(){if(Yc)return Jc;Yc=1;var e=ai(),t=qc(),n=1,r=2;function i(i,a,o,s){var c=o.length,l=c,u=!s;if(i==null)return!l;for(i=Object(i);c--;){var d=o[c];if(u&&d[2]?d[1]!==i[d[0]]:!(d[0]in i))return!1}for(;++c<l;){d=o[c];var f=d[0],p=i[f],m=d[1];if(u&&d[2]){if(p===void 0&&!(f in i))return!1}else{var h=new e;if(s)var g=s(p,m,f,i,a,h);if(!(g===void 0?t(m,p,n|r,s,h):g))return!1}}return!0}return Jc=i,Jc}var Zc,Qc;function $c(){if(Qc)return Zc;Qc=1;var e=W();function t(t){return t===t&&!e(t)}return Zc=t,Zc}var el,tl;function nl(){if(tl)return el;tl=1;var e=$c(),t=J();function n(n){for(var r=t(n),i=r.length;i--;){var a=r[i],o=n[a];r[i]=[a,o,e(o)]}return r}return el=n,el}var rl,il;function al(){if(il)return rl;il=1;function e(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}return rl=e,rl}var ol,sl;function cl(){if(sl)return ol;sl=1;var e=Xc(),t=nl(),n=al();function r(r){var i=t(r);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(t){return t===r||e(t,r,i)}}return ol=r,ol}var ll,ul;function dl(){if(ul)return ll;ul=1;var e=U(),t=G(),n=`[object Symbol]`;function r(r){return typeof r==`symbol`||t(r)&&e(r)==n}return ll=r,ll}var fl,pl;function ml(){if(pl)return fl;pl=1;var e=K(),t=dl(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,a){if(e(i))return!1;var o=typeof i;return o==`number`||o==`symbol`||o==`boolean`||i==null||t(i)?!0:r.test(i)||!n.test(i)||a!=null&&i in Object(a)}return fl=i,fl}var hl,gl;function _l(){if(gl)return hl;gl=1;var e=$r(),t=`Expected a function`;function n(r,i){if(typeof r!=`function`||i!=null&&typeof i!=`function`)throw TypeError(t);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;if(n.has(t))return n.get(t);var o=r.apply(this,e);return a.cache=n.set(t,o)||n,o};return a.cache=new(n.Cache||e),a}return n.Cache=e,hl=n,hl}var vl,yl;function bl(){if(yl)return vl;yl=1;var e=_l(),t=500;function n(n){var r=e(n,function(e){return i.size===t&&i.clear(),e}),i=r.cache;return r}return vl=n,vl}var xl,Sl;function Cl(){if(Sl)return xl;Sl=1;var e=bl(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return xl=e(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(``),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,`$1`):t||e)}),r}),xl}var wl,Tl;function El(){if(Tl)return wl;Tl=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}return wl=e,wl}var Dl,Ol;function kl(){if(Ol)return Dl;Ol=1;var e=On(),t=El(),n=K(),r=dl(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(e){if(typeof e==`string`)return e;if(n(e))return t(e,o)+``;if(r(e))return a?a.call(e):``;var i=e+``;return i==`0`&&1/e==-1/0?`-0`:i}return Dl=o,Dl}var Al,jl;function Ml(){if(jl)return Al;jl=1;var e=kl();function t(t){return t==null?``:e(t)}return Al=t,Al}var Nl,Pl;function Fl(){if(Pl)return Nl;Pl=1;var e=K(),t=ml(),n=Cl(),r=Ml();function i(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}return Nl=i,Nl}var Il,Ll;function Rl(){if(Ll)return Il;Ll=1;var e=dl();function t(t){if(typeof t==`string`||e(t))return t;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n}return Il=t,Il}var zl,Bl;function Vl(){if(Bl)return zl;Bl=1;var e=Fl(),t=Rl();function n(n,r){r=e(r,n);for(var i=0,a=r.length;n!=null&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}return zl=n,zl}var Hl,Ul;function Wl(){if(Ul)return Hl;Ul=1;var e=Vl();function t(t,n,r){var i=t==null?void 0:e(t,n);return i===void 0?r:i}return Hl=t,Hl}var Gl,Kl;function ql(){if(Kl)return Gl;Kl=1;function e(e,t){return e!=null&&t in Object(e)}return Gl=e,Gl}var Jl,Yl;function Xl(){if(Yl)return Jl;Yl=1;var e=Fl(),t=ji(),n=K(),r=Hi(),i=Gi(),a=Rl();function o(o,s,c){s=e(s,o);for(var l=-1,u=s.length,d=!1;++l<u;){var f=a(s[l]);if(!(d=o!=null&&c(o,f)))break;o=o[f]}return d||++l!=u?d:(u=o==null?0:o.length,!!u&&i(u)&&r(f,u)&&(n(o)||t(o)))}return Jl=o,Jl}var Zl,Ql;function $l(){if(Ql)return Zl;Ql=1;var e=ql(),t=Xl();function n(n,r){return n!=null&&t(n,r,e)}return Zl=n,Zl}var eu,tu;function nu(){if(tu)return eu;tu=1;var e=qc(),t=Wl(),n=$l(),r=ml(),i=$c(),a=al(),o=Rl(),s=1,c=2;function l(l,u){return r(l)&&i(u)?a(o(l),u):function(r){var i=t(r,l);return i===void 0&&i===u?n(r,l):e(u,i,s|c)}}return eu=l,eu}var ru,iu;function au(){if(iu)return ru;iu=1;function e(e){return function(t){return t?.[e]}}return ru=e,ru}var ou,su;function cu(){if(su)return ou;su=1;var e=Vl();function t(t){return function(n){return e(n,t)}}return ou=t,ou}var lu,uu;function du(){if(uu)return lu;uu=1;var e=au(),t=cu(),n=ml(),r=Rl();function i(i){return n(i)?e(r(i)):t(i)}return lu=i,lu}var fu,pu;function Y(){if(pu)return fu;pu=1;var e=cl(),t=nu(),n=$s(),r=K(),i=du();function a(a){return typeof a==`function`?a:a==null?n:typeof a==`object`?r(a)?t(a[0],a[1]):e(a):i(a)}return fu=a,fu}var mu,hu;function gu(){if(hu)return mu;hu=1;var e=Ka(),t=dc(),n=Y(),r=K();function i(i,a){return(r(i)?e:t)(i,n(a,3))}return mu=i,mu}var _u,vu;function yu(){if(vu)return _u;vu=1;var e=Object.prototype.hasOwnProperty;function t(t,n){return t!=null&&e.call(t,n)}return _u=t,_u}var bu,xu;function Su(){if(xu)return bu;xu=1;var e=yu(),t=Xl();function n(n,r){return n!=null&&t(n,r,e)}return bu=n,bu}var Cu,wu;function Tu(){if(wu)return Cu;wu=1;var e=va(),t=Ro(),n=ji(),r=K(),i=q(),a=zi(),o=la(),s=ra(),c=`[object Map]`,l=`[object Set]`,u=Object.prototype.hasOwnProperty;function d(d){if(d==null)return!0;if(i(d)&&(r(d)||typeof d==`string`||typeof d.splice==`function`||a(d)||s(d)||n(d)))return!d.length;var f=t(d);if(f==c||f==l)return!d.size;if(o(d))return!e(d).length;for(var p in d)if(u.call(d,p))return!1;return!0}return Cu=d,Cu}var Eu,Du;function Ou(){if(Du)return Eu;Du=1;function e(e){return e===void 0}return Eu=e,Eu}var ku,Au;function ju(){if(Au)return ku;Au=1;var e=Xs(),t=q();function n(n,r){var i=-1,a=t(n)?Array(n.length):[];return e(n,function(e,t,n){a[++i]=r(e,t,n)}),a}return ku=n,ku}var Mu,Nu;function Pu(){if(Nu)return Mu;Nu=1;var e=El(),t=Y(),n=ju(),r=K();function i(i,a){return(r(i)?e:n)(i,t(a,3))}return Mu=i,Mu}var Fu,Iu;function Lu(){if(Iu)return Fu;Iu=1;function e(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}return Fu=e,Fu}var Ru,zu;function Bu(){if(zu)return Ru;zu=1;function e(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}return Ru=e,Ru}var Vu,Hu;function Uu(){if(Hu)return Vu;Hu=1;var e=Lu(),t=Xs(),n=Y(),r=Bu(),i=K();function a(a,o,s){var c=i(a)?e:r,l=arguments.length<3;return c(a,n(o,4),s,l,t)}return Vu=a,Vu}var Wu,Gu;function Ku(){if(Gu)return Wu;Gu=1;var e=U(),t=K(),n=G(),r=`[object String]`;function i(i){return typeof i==`string`||!t(i)&&n(i)&&e(i)==r}return Wu=i,Wu}var qu,Ju;function Yu(){return Ju?qu:(Ju=1,qu=au()(`length`),qu)}var Xu,Zu;function Qu(){if(Zu)return Xu;Zu=1;var e=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function t(t){return e.test(t)}return Xu=t,Xu}var $u,ed;function td(){if(ed)return $u;ed=1;var e=`\\ud800-\\udfff`,t=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,n=`\\ufe0e\\ufe0f`,r=`[`+e+`]`,i=`[`+t+`]`,a=`\\ud83c[\\udffb-\\udfff]`,o=`(?:`+i+`|`+a+`)`,s=`[^`+e+`]`,c=`(?:\\ud83c[\\udde6-\\uddff]){2}`,l=`[\\ud800-\\udbff][\\udc00-\\udfff]`,u=`\\u200d`,d=o+`?`,f=`[`+n+`]?`,p=`(?:`+u+`(?:`+[s,c,l].join(`|`)+`)`+f+d+`)*`,m=f+d+p,h=`(?:`+[s+i+`?`,i,c,l,r].join(`|`)+`)`,g=RegExp(a+`(?=`+a+`)|`+h+m,`g`);function _(e){for(var t=g.lastIndex=0;g.test(e);)++t;return t}return $u=_,$u}var nd,rd;function id(){if(rd)return nd;rd=1;var e=Yu(),t=Qu(),n=td();function r(r){return t(r)?n(r):e(r)}return nd=r,nd}var ad,od;function sd(){if(od)return ad;od=1;var e=va(),t=Ro(),n=q(),r=Ku(),i=id(),a=`[object Map]`,o=`[object Set]`;function s(s){if(s==null)return 0;if(n(s))return r(s)?i(s):s.length;var c=t(s);return c==a||c==o?s.size:e(s).length}return ad=s,ad}var cd,ld;function ud(){if(ld)return cd;ld=1;var e=ci(),t=ds(),n=Ws(),r=Y(),i=so(),a=K(),o=zi(),s=Vn(),c=W(),l=ra();function u(u,d,f){var p=a(u),m=p||o(u)||l(u);if(d=r(d,4),f==null){var h=u&&u.constructor;f=m?p?new h:[]:c(u)&&s(h)?t(i(u)):{}}return(m?e:n)(u,function(e,t,n){return d(f,e,t,n)}),f}return cd=u,cd}var dd,fd;function pd(){if(fd)return dd;fd=1;var e=On(),t=ji(),n=K(),r=e?e.isConcatSpreadable:void 0;function i(e){return n(e)||t(e)||!!(r&&e&&e[r])}return dd=i,dd}var md,hd;function gd(){if(hd)return md;hd=1;var e=io(),t=pd();function n(r,i,a,o,s){var c=-1,l=r.length;for(a||=t,s||=[];++c<l;){var u=r[c];i>0&&a(u)?i>1?n(u,i-1,a,o,s):e(s,u):o||(s[s.length]=u)}return s}return md=n,md}var _d,vd;function yd(){if(vd)return _d;vd=1;function e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}return _d=e,_d}var bd,xd;function Sd(){if(xd)return bd;xd=1;var e=yd(),t=Math.max;function n(n,r,i){return r=t(r===void 0?n.length-1:r,0),function(){for(var a=arguments,o=-1,s=t(a.length-r,0),c=Array(s);++o<s;)c[o]=a[r+o];o=-1;for(var l=Array(r+1);++o<r;)l[o]=a[o];return l[r]=i(c),e(n,this,l)}}return bd=n,bd}var Cd,wd;function Td(){if(wd)return Cd;wd=1;var e=Fs(),t=di(),n=$s();return Cd=t?function(n,r){return t(n,`toString`,{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:n,Cd}var Ed,Dd;function Od(){if(Dd)return Ed;Dd=1;var e=800,t=16,n=Date.now;function r(r){var i=0,a=0;return function(){var o=n(),s=t-(o-a);if(a=o,s>0){if(++i>=e)return arguments[0]}else i=0;return r.apply(void 0,arguments)}}return Ed=r,Ed}var kd,Ad;function jd(){if(Ad)return kd;Ad=1;var e=Td();return kd=Od()(e),kd}var Md,Nd;function Pd(){if(Nd)return Md;Nd=1;var e=$s(),t=Sd(),n=jd();function r(r,i){return n(t(r,i,e),r+``)}return Md=r,Md}var Fd,Id;function Ld(){if(Id)return Fd;Id=1;function e(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}return Fd=e,Fd}var Rd,zd;function Bd(){if(zd)return Rd;zd=1;function e(e){return e!==e}return Rd=e,Rd}var Vd,Hd;function Ud(){if(Hd)return Vd;Hd=1;function e(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}return Vd=e,Vd}var Wd,Gd;function Kd(){if(Gd)return Wd;Gd=1;var e=Ld(),t=Bd(),n=Ud();function r(r,i,a){return i===i?n(r,i,a):e(r,t,a)}return Wd=r,Wd}var qd,Jd;function Yd(){if(Jd)return qd;Jd=1;var e=Kd();function t(t,n){return!!(t!=null&&t.length)&&e(t,n,0)>-1}return qd=t,qd}var Xd,Zd;function Qd(){if(Zd)return Xd;Zd=1;function e(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}return Xd=e,Xd}var $d,ef;function tf(){if(ef)return $d;ef=1;function e(){}return $d=e,$d}var nf,rf;function af(){if(rf)return nf;rf=1;var e=Mo(),t=tf(),n=Fc();return nf=e&&1/n(new e([,-0]))[1]==1/0?function(t){return new e(t)}:t,nf}var of,sf;function cf(){if(sf)return of;sf=1;var e=bc(),t=Yd(),n=Qd(),r=Ec(),i=af(),a=Fc(),o=200;function s(s,c,l){var u=-1,d=t,f=s.length,p=!0,m=[],h=m;if(l)p=!1,d=n;else if(f>=o){var g=c?null:i(s);if(g)return a(g);p=!1,d=r,h=new e}else h=c?[]:m;outer:for(;++u<f;){var _=s[u],v=c?c(_):_;if(_=l||_!==0?_:0,p&&v===v){for(var y=h.length;y--;)if(h[y]===v)continue outer;c&&h.push(v),m.push(_)}else d(h,v,l)||(h!==m&&h.push(v),m.push(_))}return m}return of=s,of}var lf,uf;function df(){if(uf)return lf;uf=1;var e=q(),t=G();function n(n){return t(n)&&e(n)}return lf=n,lf}var ff,pf;function mf(){if(pf)return ff;pf=1;var e=gd(),t=Pd(),n=cf(),r=df();return ff=t(function(t){return n(e(t,1,r,!0))}),ff}var hf,gf;function _f(){if(gf)return hf;gf=1;var e=El();function t(t,n){return e(n,function(e){return t[e]})}return hf=t,hf}var vf,yf;function bf(){if(yf)return vf;yf=1;var e=_f(),t=J();function n(n){return n==null?[]:e(n,t(n))}return vf=n,vf}var xf,Sf;function X(){if(Sf)return xf;Sf=1;var e;if(typeof Lt==`function`)try{e={clone:Ms(),constant:Fs(),each:cc(),filter:gu(),has:Su(),isArray:K(),isEmpty:Tu(),isFunction:Vn(),isUndefined:Ou(),keys:J(),map:Pu(),reduce:Uu(),size:sd(),transform:ud(),union:mf(),values:bf()}}catch{}return e||=window._,xf=e,xf}var Cf,wf;function Tf(){if(wf)return Cf;wf=1;var e=X();Cf=i;var t=`\0`,n=`\0`,r=``;function i(t){this._isDirected=!e.has(t,`directed`)||t.directed,this._isMultigraph=e.has(t,`multigraph`)?t.multigraph:!1,this._isCompound=e.has(t,`compound`)?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(e){return this._label=e,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return e.isFunction(t)||(t=e.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var t=this;return e.filter(this.nodes(),function(n){return e.isEmpty(t._in[n])})},i.prototype.sinks=function(){var t=this;return e.filter(this.nodes(),function(n){return e.isEmpty(t._out[n])})},i.prototype.setNodes=function(t,n){var r=arguments,i=this;return e.each(t,function(e){r.length>1?i.setNode(e,n):i.setNode(e)}),this},i.prototype.setNode=function(t,r){return e.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=n,this._children[t]={},this._children[n][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(e){return this._nodes[e]},i.prototype.hasNode=function(t){return e.has(this._nodes,t)},i.prototype.removeNode=function(t){var n=this;if(e.has(this._nodes,t)){var r=function(e){n.removeEdge(n._edgeObjs[e])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],e.each(this.children(t),function(e){n.setParent(e)}),delete this._children[t]),e.each(e.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],e.each(e.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,r){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(e.isUndefined(r))r=n;else{r+=``;for(var i=r;!e.isUndefined(i);i=this.parent(i))if(i===t)throw Error(`Setting `+r+` as parent of `+t+` would create a cycle`);this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this},i.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},i.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==n)return t}},i.prototype.children=function(t){if(e.isUndefined(t)&&(t=n),this._isCompound){var r=this._children[t];if(r)return e.keys(r)}else if(t===n)return this.nodes();else if(this.hasNode(t))return[]},i.prototype.predecessors=function(t){var n=this._preds[t];if(n)return e.keys(n)},i.prototype.successors=function(t){var n=this._sucs[t];if(n)return e.keys(n)},i.prototype.neighbors=function(t){var n=this.predecessors(t);if(n)return e.union(n,this.successors(t))},i.prototype.isLeaf=function(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0},i.prototype.filterNodes=function(t){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;e.each(this._nodes,function(e,r){t(r)&&n.setNode(r,e)}),e.each(this._edgeObjs,function(e){n.hasNode(e.v)&&n.hasNode(e.w)&&n.setEdge(e,r.edge(e))});var i={};function a(e){var t=r.parent(e);return t===void 0||n.hasNode(t)?(i[e]=t,t):t in i?i[t]:a(t)}return this._isCompound&&e.each(n.nodes(),function(e){n.setParent(e,a(e))}),n},i.prototype.setDefaultEdgeLabel=function(t){return e.isFunction(t)||(t=e.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(t,n){var r=this,i=arguments;return e.reduce(t,function(e,t){return i.length>1?r.setEdge(e,t,n):r.setEdge(e,t),t}),this},i.prototype.setEdge=function(){var t,n,r,i,o=!1,l=arguments[0];typeof l==`object`&&l&&`v`in l?(t=l.v,n=l.w,r=l.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=l,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=``+t,n=``+n,e.isUndefined(r)||(r=``+r);var u=s(this._isDirected,t,n,r);if(e.has(this._edgeLabels,u))return o&&(this._edgeLabels[u]=i),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(t),this.setNode(n),this._edgeLabels[u]=o?i:this._defaultEdgeLabelFn(t,n,r);var d=c(this._isDirected,t,n,r);return t=d.v,n=d.w,Object.freeze(d),this._edgeObjs[u]=d,a(this._preds[n],t),a(this._sucs[t],n),this._in[n][u]=d,this._out[t][u]=d,this._edgeCount++,this},i.prototype.edge=function(e,t,n){var r=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,n);return this._edgeLabels[r]},i.prototype.hasEdge=function(t,n,r){var i=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,t,n,r);return e.has(this._edgeLabels,i)},i.prototype.removeEdge=function(e,t,n){var r=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},i.prototype.inEdges=function(t,n){var r=this._in[t];if(r){var i=e.values(r);return n?e.filter(i,function(e){return e.v===n}):i}},i.prototype.outEdges=function(t,n){var r=this._out[t];if(r){var i=e.values(r);return n?e.filter(i,function(e){return e.w===n}):i}},i.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))};function a(e,t){e[t]?e[t]++:e[t]=1}function o(e,t){--e[t]||delete e[t]}function s(n,i,a,o){var s=``+i,c=``+a;if(!n&&s>c){var l=s;s=c,c=l}return s+r+c+r+(e.isUndefined(o)?t:o)}function c(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function l(e,t){return s(e,t.v,t.w,t.name)}return Cf}var Ef,Df;function Of(){return Df?Ef:(Df=1,Ef=`2.1.8`,Ef)}var kf,Af;function jf(){return Af?kf:(Af=1,kf={Graph:Tf(),version:Of()},kf)}var Mf,Nf;function Pf(){if(Nf)return Mf;Nf=1;var e=X(),t=Tf();Mf={write:n,read:a};function n(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:r(t),edges:i(t)};return e.isUndefined(t.graph())||(n.value=e.clone(t.graph())),n}function r(t){return e.map(t.nodes(),function(n){var r=t.node(n),i=t.parent(n),a={v:n};return e.isUndefined(r)||(a.value=r),e.isUndefined(i)||(a.parent=i),a})}function i(t){return e.map(t.edges(),function(n){var r=t.edge(n),i={v:n.v,w:n.w};return e.isUndefined(n.name)||(i.name=n.name),e.isUndefined(r)||(i.value=r),i})}function a(n){var r=new t(n.options).setGraph(n.value);return e.each(n.nodes,function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)}),e.each(n.edges,function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),r}return Mf}var Ff,If;function Lf(){if(If)return Ff;If=1;var e=X();Ff=t;function t(t){var n={},r=[],i;function a(r){e.has(n,r)||(n[r]=!0,i.push(r),e.each(t.successors(r),a),e.each(t.predecessors(r),a))}return e.each(t.nodes(),function(e){i=[],a(e),i.length&&r.push(i)}),r}return Ff}var Rf,zf;function Bf(){if(zf)return Rf;zf=1;var e=X();Rf=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(e){return e.key})},t.prototype.has=function(t){return e.has(this._keyIndices,t)},t.prototype.priority=function(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority},t.prototype.min=function(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key},t.prototype.add=function(t,n){var r=this._keyIndices;if(t=String(t),!e.has(r,t)){var i=this._arr,a=i.length;return r[t]=a,i.push({key:t,priority:n}),this._decrease(a),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},t.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)},t.prototype._heapify=function(e){var 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)))},t.prototype._decrease=function(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r},t.prototype._swap=function(e,t){var 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},Rf}var Vf,Hf;function Uf(){if(Hf)return Vf;Hf=1;var e=X(),t=Bf();Vf=r;var n=e.constant(1);function r(e,t,r,a){return i(e,String(t),r||n,a||function(t){return e.outEdges(t)})}function i(e,n,r,i){var a={},o=new t,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var t=e===n?0:1/0;a[e]={distance:t},o.add(e,t)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}return Vf}var Wf,Gf;function Kf(){if(Gf)return Wf;Gf=1;var e=Uf(),t=X();Wf=n;function n(n,r,i){return t.transform(n.nodes(),function(t,a){t[a]=e(n,a,r,i)},{})}return Wf}var qf,Jf;function Yf(){if(Jf)return qf;Jf=1;var e=X();qf=t;function t(t){var n=0,r=[],i={},a=[];function o(s){var c=i[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),t.successors(s).forEach(function(t){e.has(i,t)?i[t].onStack&&(c.lowlink=Math.min(c.lowlink,i[t].index)):(o(t),c.lowlink=Math.min(c.lowlink,i[t].lowlink))}),c.lowlink===c.index){var l=[],u;do u=r.pop(),i[u].onStack=!1,l.push(u);while(s!==u);a.push(l)}}return t.nodes().forEach(function(t){e.has(i,t)||o(t)}),a}return qf}var Xf,Zf;function Qf(){if(Zf)return Xf;Zf=1;var e=X(),t=Yf();Xf=n;function n(n){return e.filter(t(n),function(e){return e.length>1||e.length===1&&n.hasEdge(e[0],e[0])})}return Xf}var $f,ep;function tp(){if(ep)return $f;ep=1;var e=X();$f=n;var t=e.constant(1);function n(e,n,i){return r(e,n||t,i||function(t){return e.outEdges(t)})}function r(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var 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}return $f}var np,rp;function ip(){if(rp)return np;rp=1;var e=X();np=t,t.CycleException=n;function t(t){var r={},i={},a=[];function o(s){if(e.has(i,s))throw new n;e.has(r,s)||(i[s]=!0,r[s]=!0,e.each(t.predecessors(s),o),delete i[s],a.push(s))}if(e.each(t.sinks(),o),e.size(r)!==t.nodeCount())throw new n;return a}function n(){}return n.prototype=Error(),np}var ap,op;function sp(){if(op)return ap;op=1;var e=ip();ap=t;function t(t){try{e(t)}catch(t){if(t instanceof e.CycleException)return!1;throw t}return!0}return ap}var cp,lp;function up(){if(lp)return cp;lp=1;var e=X();cp=t;function t(t,r,i){e.isArray(r)||(r=[r]);var a=(t.isDirected()?t.successors:t.neighbors).bind(t),o=[],s={};return e.each(r,function(e){if(!t.hasNode(e))throw Error(`Graph does not have node: `+e);n(t,e,i===`post`,s,a,o)}),o}function n(t,r,i,a,o,s){e.has(a,r)||(a[r]=!0,i||s.push(r),e.each(o(r),function(e){n(t,e,i,a,o,s)}),i&&s.push(r))}return cp}var dp,fp;function pp(){if(fp)return dp;fp=1;var e=up();dp=t;function t(t,n){return e(t,n,`post`)}return dp}var mp,hp;function gp(){if(hp)return mp;hp=1;var e=up();mp=t;function t(t,n){return e(t,n,`pre`)}return mp}var _p,vp;function yp(){if(vp)return _p;vp=1;var e=X(),t=Tf(),n=Bf();_p=r;function r(r,i){var a=new t,o={},s=new n,c;function l(e){var t=e.v===c?e.w:e.v,n=s.priority(t);if(n!==void 0){var r=i(e);r<n&&(o[t]=c,s.decrease(t,r))}}if(r.nodeCount()===0)return a;e.each(r.nodes(),function(e){s.add(e,1/0),a.setNode(e)}),s.decrease(r.nodes()[0],0);for(var u=!1;s.size()>0;){if(c=s.removeMin(),e.has(o,c))a.setEdge(c,o[c]);else if(u)throw Error(`Input graph is not connected: `+r);else u=!0;r.nodeEdges(c).forEach(l)}return a}return _p}var bp,xp;function Sp(){return xp?bp:(xp=1,bp={components:Lf(),dijkstra:Uf(),dijkstraAll:Kf(),findCycles:Qf(),floydWarshall:tp(),isAcyclic:sp(),postorder:pp(),preorder:gp(),prim:yp(),tarjan:Yf(),topsort:ip()},bp)}var Cp,wp;function Tp(){if(wp)return Cp;wp=1;var e=jf();return Cp={Graph:e.Graph,json:Pf(),alg:Sp(),version:e.version},Cp}var Ep,Dp;function Z(){if(Dp)return Ep;Dp=1;var e;if(typeof Lt==`function`)try{e=Tp()}catch{}return e||=window.graphlib,Ep=e,Ep}var Op,kp;function Ap(){if(kp)return Op;kp=1;var e=ks(),t=1,n=4;function r(r){return e(r,t|n)}return Op=r,Op}var jp,Mp;function Np(){if(Mp)return jp;Mp=1;var e=Ut(),t=q(),n=Hi(),r=W();function i(i,a,o){if(!r(o))return!1;var s=typeof a;return(s==`number`?t(o)&&n(a,o.length):s==`string`&&a in o)?e(o[a],i):!1}return jp=i,jp}var Pp,Fp;function Ip(){if(Fp)return Pp;Fp=1;var e=Pd(),t=Ut(),n=Np(),r=Pa(),i=Object.prototype,a=i.hasOwnProperty;return Pp=e(function(e,o){e=Object(e);var s=-1,c=o.length,l=c>2?o[2]:void 0;for(l&&n(o[0],o[1],l)&&(c=1);++s<c;)for(var u=o[s],d=r(u),f=-1,p=d.length;++f<p;){var m=d[f],h=e[m];(h===void 0||t(h,i[m])&&!a.call(e,m))&&(e[m]=u[m])}return e}),Pp}var Lp,Rp;function zp(){if(Rp)return Lp;Rp=1;var e=Y(),t=q(),n=J();function r(r){return function(i,a,o){var s=Object(i);if(!t(i)){var c=e(a,3);i=n(i),a=function(e){return c(s[e],e,s)}}var l=r(i,a,o);return l>-1?s[c?i[l]:l]:void 0}}return Lp=r,Lp}var Bp,Vp;function Hp(){if(Vp)return Bp;Vp=1;var e=/\s/;function t(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return Bp=t,Bp}var Up,Wp;function Gp(){if(Wp)return Up;Wp=1;var e=Hp(),t=/^\s+/;function n(n){return n&&n.slice(0,e(n)+1).replace(t,``)}return Up=n,Up}var Kp,qp;function Jp(){if(qp)return Kp;qp=1;var e=Gp(),t=W(),n=dl(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(c){if(typeof c==`number`)return c;if(n(c))return r;if(t(c)){var l=typeof c.valueOf==`function`?c.valueOf():c;c=t(l)?l+``:l}if(typeof c!=`string`)return c===0?c:+c;c=e(c);var u=a.test(c);return u||o.test(c)?s(c.slice(2),u?2:8):i.test(c)?r:+c}return Kp=c,Kp}var Yp,Xp;function Zp(){if(Xp)return Yp;Xp=1;var e=Jp(),t=1/0,n=17976931348623157e292;function r(r){return r?(r=e(r),r===t||r===-t?(r<0?-1:1)*n:r===r?r:0):r===0?r:0}return Yp=r,Yp}var Qp,$p;function em(){if($p)return Qp;$p=1;var e=Zp();function t(t){var n=e(t),r=n%1;return n===n?r?n-r:n:0}return Qp=t,Qp}var tm,nm;function rm(){if(nm)return tm;nm=1;var e=Ld(),t=Y(),n=em(),r=Math.max;function i(i,a,o){var s=i==null?0:i.length;if(!s)return-1;var c=o==null?0:n(o);return c<0&&(c=r(s+c,0)),e(i,t(a,3),c)}return tm=i,tm}var im,am;function om(){return am?im:(am=1,im=zp()(rm()),im)}var sm,cm;function lm(){if(cm)return sm;cm=1;var e=gd();function t(t){return t!=null&&t.length?e(t,1):[]}return sm=t,sm}var um,dm;function fm(){if(dm)return um;dm=1;var e=Vs(),t=nc(),n=Pa();function r(r,i){return r==null?r:e(r,t(i),n)}return um=r,um}var pm,mm;function hm(){if(mm)return pm;mm=1;function e(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}return pm=e,pm}var gm,_m;function vm(){if(_m)return gm;_m=1;var e=mi(),t=Ws(),n=Y();function r(r,i){var a={};return i=n(i,3),t(r,function(t,n,r){e(a,n,i(t,n,r))}),a}return gm=r,gm}var ym,bm;function xm(){if(bm)return ym;bm=1;var e=dl();function t(t,n,r){for(var i=-1,a=t.length;++i<a;){var o=t[i],s=n(o);if(s!=null&&(c===void 0?s===s&&!e(s):r(s,c)))var c=s,l=o}return l}return ym=t,ym}var Sm,Cm;function wm(){if(Cm)return Sm;Cm=1;function e(e,t){return e>t}return Sm=e,Sm}var Tm,Em;function Dm(){if(Em)return Tm;Em=1;var e=xm(),t=wm(),n=$s();function r(r){return r&&r.length?e(r,n,t):void 0}return Tm=r,Tm}var Om,km;function Am(){if(km)return Om;km=1;var e=mi(),t=Ut();function n(n,r,i){(i!==void 0&&!t(n[r],i)||i===void 0&&!(r in n))&&e(n,r,i)}return Om=n,Om}var jm,Mm;function Nm(){if(Mm)return jm;Mm=1;var e=U(),t=so(),n=G(),r=`[object Object]`,i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,c=o.call(Object);function l(i){if(!n(i)||e(i)!=r)return!1;var a=t(i);if(a===null)return!0;var l=s.call(a,`constructor`)&&a.constructor;return typeof l==`function`&&l instanceof l&&o.call(l)==c}return jm=l,jm}var Pm,Fm;function Im(){if(Fm)return Pm;Fm=1;function e(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}return Pm=e,Pm}var Lm,Rm;function zm(){if(Rm)return Lm;Rm=1;var e=bi(),t=Pa();function n(n){return e(n,t(n))}return Lm=n,Lm}var Bm,Vm;function Hm(){if(Vm)return Bm;Vm=1;var e=Am(),t=Ba(),n=as(),r=Ua(),i=ms(),a=ji(),o=K(),s=df(),c=zi(),l=Vn(),u=W(),d=Nm(),f=ra(),p=Im(),m=zm();function h(h,g,_,v,y,b,x){var S=p(h,_),C=p(g,_),w=x.get(C);if(w){e(h,_,w);return}var T=b?b(S,C,_+``,h,g,x):void 0,E=T===void 0;if(E){var D=o(C),O=!D&&c(C),k=!D&&!O&&f(C);T=C,D||O||k?o(S)?T=S:s(S)?T=r(S):O?(E=!1,T=t(C,!0)):k?(E=!1,T=n(C,!0)):T=[]:d(C)||a(C)?(T=S,a(S)?T=m(S):(!u(S)||l(S))&&(T=i(C))):E=!1}E&&(x.set(C,T),y(T,C,v,b,x),x.delete(C)),e(h,_,T)}return Bm=h,Bm}var Um,Wm;function Gm(){if(Wm)return Um;Wm=1;var e=ai(),t=Am(),n=Vs(),r=Hm(),i=W(),a=Pa(),o=Im();function s(c,l,u,d,f){c!==l&&n(l,function(n,a){if(f||=new e,i(n))r(c,l,a,u,s,d,f);else{var p=d?d(o(c,a),n,a+``,c,l,f):void 0;p===void 0&&(p=n),t(c,a,p)}},a)}return Um=s,Um}var Km,qm;function Jm(){if(qm)return Km;qm=1;var e=Pd(),t=Np();function n(n){return e(function(e,r){var i=-1,a=r.length,o=a>1?r[a-1]:void 0,s=a>2?r[2]:void 0;for(o=n.length>3&&typeof o==`function`?(a--,o):void 0,s&&t(r[0],r[1],s)&&(o=a<3?void 0:o,a=1),e=Object(e);++i<a;){var c=r[i];c&&n(e,c,i,o)}return e})}return Km=n,Km}var Ym,Xm;function Zm(){if(Xm)return Ym;Xm=1;var e=Gm();return Ym=Jm()(function(t,n,r){e(t,n,r)}),Ym}var Qm,$m;function eh(){if($m)return Qm;$m=1;function e(e,t){return e<t}return Qm=e,Qm}var th,nh;function rh(){if(nh)return th;nh=1;var e=xm(),t=eh(),n=$s();function r(r){return r&&r.length?e(r,n,t):void 0}return th=r,th}var ih,ah;function oh(){if(ah)return ih;ah=1;var e=xm(),t=Y(),n=eh();function r(r,i){return r&&r.length?e(r,t(i,2),n):void 0}return ih=r,ih}var sh,ch;function lh(){if(ch)return sh;ch=1;var e=H();return sh=function(){return e.Date.now()},sh}var uh,dh;function fh(){if(dh)return uh;dh=1;var e=_i(),t=Fl(),n=Hi(),r=W(),i=Rl();function a(a,o,s,c){if(!r(a))return a;o=t(o,a);for(var l=-1,u=o.length,d=u-1,f=a;f!=null&&++l<u;){var p=i(o[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return a;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=r(h)?h:n(o[l+1])?[]:{})}e(f,p,m),f=f[p]}return a}return uh=a,uh}var ph,mh;function hh(){if(mh)return ph;mh=1;var e=Vl(),t=fh(),n=Fl();function r(r,i,a){for(var o=-1,s=i.length,c={};++o<s;){var l=i[o],u=e(r,l);a(u,l)&&t(c,n(l,r),u)}return c}return ph=r,ph}var gh,_h;function vh(){if(_h)return gh;_h=1;var e=hh(),t=$l();function n(n,r){return e(n,r,function(e,r){return t(n,r)})}return gh=n,gh}var yh,bh;function xh(){if(bh)return yh;bh=1;var e=lm(),t=Sd(),n=jd();function r(r){return n(t(r,void 0,e),r+``)}return yh=r,yh}var Sh,Ch;function wh(){if(Ch)return Sh;Ch=1;var e=vh();return Sh=xh()(function(t,n){return t==null?{}:e(t,n)}),Sh}var Th,Eh;function Dh(){if(Eh)return Th;Eh=1;var e=Math.ceil,t=Math.max;function n(n,r,i,a){for(var o=-1,s=t(e((r-n)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=n,n+=i;return c}return Th=n,Th}var Oh,kh;function Ah(){if(kh)return Oh;kh=1;var e=Dh(),t=Np(),n=Zp();function r(r){return function(i,a,o){return o&&typeof o!=`number`&&t(i,a,o)&&(a=o=void 0),i=n(i),a===void 0?(a=i,i=0):a=n(a),o=o===void 0?i<a?1:-1:n(o),e(i,a,o,r)}}return Oh=r,Oh}var jh,Mh;function Nh(){return Mh?jh:(Mh=1,jh=Ah()(),jh)}var Ph,Fh;function Ih(){if(Fh)return Ph;Fh=1;function e(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}return Ph=e,Ph}var Lh,Rh;function zh(){if(Rh)return Lh;Rh=1;var e=dl();function t(t,n){if(t!==n){var r=t!==void 0,i=t===null,a=t===t,o=e(t),s=n!==void 0,c=n===null,l=n===n,u=e(n);if(!c&&!u&&!o&&t>n||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&t<n||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}return Lh=t,Lh}var Bh,Vh;function Hh(){if(Vh)return Bh;Vh=1;var e=zh();function t(t,n,r){for(var i=-1,a=t.criteria,o=n.criteria,s=a.length,c=r.length;++i<s;){var l=e(a[i],o[i]);if(l)return i>=c?l:l*(r[i]==`desc`?-1:1)}return t.index-n.index}return Bh=t,Bh}var Uh,Wh;function Gh(){if(Wh)return Uh;Wh=1;var e=El(),t=Vl(),n=Y(),r=ju(),i=Ih(),a=Zi(),o=Hh(),s=$s(),c=K();function l(l,u,d){u=u.length?e(u,function(e){return c(e)?function(n){return t(n,e.length===1?e[0]:e)}:e}):[s];var f=-1;return u=e(u,a(n)),i(r(l,function(t,n,r){return{criteria:e(u,function(e){return e(t)}),index:++f,value:t}}),function(e,t){return o(e,t,d)})}return Uh=l,Uh}var Kh,qh;function Jh(){if(qh)return Kh;qh=1;var e=gd(),t=Gh(),n=Pd(),r=Np();return Kh=n(function(n,i){if(n==null)return[];var a=i.length;return a>1&&r(n,i[0],i[1])?i=[]:a>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),t(n,e(i,1),[])}),Kh}var Yh,Xh;function Zh(){if(Xh)return Yh;Xh=1;var e=Ml(),t=0;function n(n){var r=++t;return e(n)+r}return Yh=n,Yh}var Qh,$h;function eg(){if($h)return Qh;$h=1;function e(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}return Qh=e,Qh}var tg,ng;function rg(){if(ng)return tg;ng=1;var e=_i(),t=eg();function n(n,r){return t(n||[],r||[],e)}return tg=n,tg}var ig,ag;function Q(){if(ag)return ig;ag=1;var e;if(typeof Lt==`function`)try{e={cloneDeep:Ap(),constant:Fs(),defaults:Ip(),each:cc(),filter:gu(),find:om(),flatten:lm(),forEach:ac(),forIn:fm(),has:Su(),isUndefined:Ou(),last:hm(),map:Pu(),mapValues:vm(),max:Dm(),merge:Zm(),min:rh(),minBy:oh(),now:lh(),pick:wh(),range:Nh(),reduce:Uu(),sortBy:Jh(),uniqueId:Zh(),values:bf(),zipObject:rg()}}catch{}return e||=window._,ig=e,ig}var og,sg;function cg(){if(sg)return og;sg=1,og=e;function e(){var e={};e._next=e._prev=e,this._sentinel=e}e.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return t(n),n},e.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&t(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},e.prototype.toString=function(){for(var e=[],t=this._sentinel,r=t._prev;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return`[`+e.join(`, `)+`]`};function t(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if(e!==`_next`&&e!==`_prev`)return t}return og}var lg,ug;function dg(){if(ug)return lg;ug=1;var e=Q(),t=Z().Graph,n=cg();lg=i;var r=e.constant(1);function i(t,n){if(t.nodeCount()<=1)return[];var i=s(t,n||r),o=a(i.graph,i.buckets,i.zeroIdx);return e.flatten(e.map(o,function(e){return t.outEdges(e.v,e.w)}),!0)}function a(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],s;e.nodeCount();){for(;s=a.dequeue();)o(e,t,n,s);for(;s=i.dequeue();)o(e,t,n,s);if(e.nodeCount()){for(var c=t.length-2;c>0;--c)if(s=t[c].dequeue(),s){r=r.concat(o(e,t,n,s,!0));break}}}return r}function o(t,n,r,i,a){var o=a?[]:void 0;return e.forEach(t.inEdges(i.v),function(e){var i=t.edge(e),s=t.node(e.v);a&&o.push({v:e.v,w:e.w}),s.out-=i,c(n,r,s)}),e.forEach(t.outEdges(i.v),function(e){var i=t.edge(e),a=e.w,o=t.node(a);o.in-=i,c(n,r,o)}),t.removeNode(i.v),o}function s(r,i){var a=new t,o=0,s=0;e.forEach(r.nodes(),function(e){a.setNode(e,{v:e,in:0,out:0})}),e.forEach(r.edges(),function(e){var t=a.edge(e.v,e.w)||0,n=i(e),r=t+n;a.setEdge(e.v,e.w,r),s=Math.max(s,a.node(e.v).out+=n),o=Math.max(o,a.node(e.w).in+=n)});var l=e.range(s+o+3).map(function(){return new n}),u=o+1;return e.forEach(a.nodes(),function(e){c(l,u,a.node(e))}),{graph:a,buckets:l,zeroIdx:u}}function c(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}return lg}var fg,pg;function mg(){if(pg)return fg;pg=1;var e=Q(),t=dg();fg={run:n,undo:i};function n(n){var i=n.graph().acyclicer===`greedy`?t(n,a(n)):r(n);e.forEach(i,function(t){var r=n.edge(t);n.removeEdge(t),r.forwardName=t.name,r.reversed=!0,n.setEdge(t.w,t.v,r,e.uniqueId(`rev`))});function a(e){return function(t){return e.edge(t).weight}}}function r(t){var n=[],r={},i={};function a(o){e.has(i,o)||(i[o]=!0,r[o]=!0,e.forEach(t.outEdges(o),function(t){e.has(r,t.w)?n.push(t):a(t.w)}),delete r[o])}return e.forEach(t.nodes(),a),n}function i(t){e.forEach(t.edges(),function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}return fg}var hg,gg;function $(){if(gg)return hg;gg=1;var e=Q(),t=Z().Graph;hg={addDummyNode:n,simplify:r,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:o,intersectRect:s,buildLayerMatrix:c,normalizeRanks:l,removeEmptyRanks:u,addBorderNode:d,maxRank:f,partition:p,time:m,notime:h};function n(t,n,r,i){var a;do a=e.uniqueId(i);while(t.hasNode(a));return r.dummy=n,t.setNode(a,r),a}function r(n){var r=new t().setGraph(n.graph());return e.forEach(n.nodes(),function(e){r.setNode(e,n.node(e))}),e.forEach(n.edges(),function(e){var t=r.edge(e.v,e.w)||{weight:0,minlen:1},i=n.edge(e);r.setEdge(e.v,e.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),r}function i(n){var r=new t({multigraph:n.isMultigraph()}).setGraph(n.graph());return e.forEach(n.nodes(),function(e){n.children(e).length||r.setNode(e,n.node(e))}),e.forEach(n.edges(),function(e){r.setEdge(e,n.edge(e))}),r}function a(t){var n=e.map(t.nodes(),function(n){var r={};return e.forEach(t.outEdges(n),function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight}),r});return e.zipObject(t.nodes(),n)}function o(t){var n=e.map(t.nodes(),function(n){var r={};return e.forEach(t.inEdges(n),function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight}),r});return e.zipObject(t.nodes(),n)}function s(e,t){var 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`);var 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 c(t){var n=e.map(e.range(f(t)+1),function(){return[]});return e.forEach(t.nodes(),function(r){var i=t.node(r),a=i.rank;e.isUndefined(a)||(n[a][i.order]=r)}),n}function l(t){var n=e.min(e.map(t.nodes(),function(e){return t.node(e).rank}));e.forEach(t.nodes(),function(r){var i=t.node(r);e.has(i,`rank`)&&(i.rank-=n)})}function u(t){var n=e.min(e.map(t.nodes(),function(e){return t.node(e).rank})),r=[];e.forEach(t.nodes(),function(e){var i=t.node(e).rank-n;r[i]||(r[i]=[]),r[i].push(e)});var i=0,a=t.graph().nodeRankFactor;e.forEach(r,function(n,r){e.isUndefined(n)&&r%a!==0?--i:i&&e.forEach(n,function(e){t.node(e).rank+=i})})}function d(e,t,r,i){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=i),n(e,`border`,a,t)}function f(t){return e.max(e.map(t.nodes(),function(n){var r=t.node(n).rank;if(!e.isUndefined(r))return r}))}function p(t,n){var r={lhs:[],rhs:[]};return e.forEach(t,function(e){n(e)?r.lhs.push(e):r.rhs.push(e)}),r}function m(t,n){var r=e.now();try{return n()}finally{console.log(t+` time: `+(e.now()-r)+`ms`)}}function h(e,t){return t()}return hg}var _g,vg;function yg(){if(vg)return _g;vg=1;var e=Q(),t=$();_g={run:n,undo:i};function n(t){t.graph().dummyChains=[],e.forEach(t.edges(),function(e){r(t,e)})}function r(e,n){var r=n.v,i=e.node(r).rank,a=n.w,o=e.node(a).rank,s=n.name,c=e.edge(n),l=c.labelRank;if(o!==i+1){e.removeEdge(n);var u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:n,rank:i},u=t.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}}function i(t){e.forEach(t.graph().dummyChains,function(e){var n=t.node(e),r=n.edgeLabel,i;for(t.setEdge(n.edgeObj,r);n.dummy;)i=t.successors(e)[0],t.removeNode(e),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),e=i,n=t.node(e)})}return _g}var bg,xg;function Sg(){if(xg)return bg;xg=1;var e=Q();bg={longestPath:t,slack:n};function t(t){var n={};function r(i){var a=t.node(i);if(e.has(n,i))return a.rank;n[i]=!0;var o=e.min(e.map(t.outEdges(i),function(e){return r(e.w)-t.edge(e).minlen}));return(o===1/0||o==null)&&(o=0),a.rank=o}e.forEach(t.sources(),r)}function n(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}return bg}var Cg,wg;function Tg(){if(wg)return Cg;wg=1;var e=Q(),t=Z().Graph,n=Sg().slack;Cg=r;function r(e){var r=new t({directed:!1}),s=e.nodes()[0],c=e.nodeCount();r.setNode(s,{});for(var l,u;i(r,e)<c;)l=a(r,e),u=r.hasNode(l.v)?n(e,l):-n(e,l),o(r,e,u);return r}function i(t,r){function i(a){e.forEach(r.nodeEdges(a),function(e){var o=e.v,s=a===o?e.w:o;!t.hasNode(s)&&!n(r,e)&&(t.setNode(s,{}),t.setEdge(a,s,{}),i(s))})}return e.forEach(t.nodes(),i),t.nodeCount()}function a(t,r){return e.minBy(r.edges(),function(e){if(t.hasNode(e.v)!==t.hasNode(e.w))return n(r,e)})}function o(t,n,r){e.forEach(t.nodes(),function(e){n.node(e).rank+=r})}return Cg}var Eg,Dg;function Og(){if(Dg)return Eg;Dg=1;var e=Q(),t=Tg(),n=Sg().slack,r=Sg().longestPath,i=Z().alg.preorder,a=Z().alg.postorder,o=$().simplify;Eg=s,s.initLowLimValues=d,s.initCutValues=c,s.calcCutValue=u,s.leaveEdge=p,s.enterEdge=m,s.exchangeEdges=h;function s(e){e=o(e),r(e);var n=t(e);d(n),c(n,e);for(var i,a;i=p(n);)a=m(n,e,i),h(n,e,i,a)}function c(t,n){var r=a(t,t.nodes());r=r.slice(0,r.length-1),e.forEach(r,function(e){l(t,n,e)})}function l(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=u(e,t,n)}function u(t,n,r){var i=t.node(r).parent,a=!0,o=n.edge(r,i),s=0;return o||=(a=!1,n.edge(i,r)),s=o.weight,e.forEach(n.nodeEdges(r),function(e){var o=e.v===r,c=o?e.w:e.v;if(c!==i){var l=o===a,u=n.edge(e).weight;if(s+=l?u:-u,_(t,r,c)){var d=t.edge(r,c).cutvalue;s+=l?-d:d}}}),s}function d(e,t){arguments.length<2&&(t=e.nodes()[0]),f(e,{},1,t)}function f(t,n,r,i,a){var o=r,s=t.node(i);return n[i]=!0,e.forEach(t.neighbors(i),function(a){e.has(n,a)||(r=f(t,n,r,a,i))}),s.low=o,s.lim=r++,a?s.parent=a:delete s.parent,r}function p(t){return e.find(t.edges(),function(e){return t.edge(e).cutvalue<0})}function m(t,r,i){var a=i.v,o=i.w;r.hasEdge(a,o)||(a=i.w,o=i.v);var s=t.node(a),c=t.node(o),l=s,u=!1;s.lim>c.lim&&(l=c,u=!0);var d=e.filter(r.edges(),function(e){return u===v(t,t.node(e.v),l)&&u!==v(t,t.node(e.w),l)});return e.minBy(d,function(e){return n(r,e)})}function h(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),d(e),c(e,t),g(e,t)}function g(t,n){var r=i(t,e.find(t.nodes(),function(e){return!n.node(e).parent}));r=r.slice(1),e.forEach(r,function(e){var r=t.node(e).parent,i=n.edge(e,r),a=!1;i||(i=n.edge(r,e),a=!0),n.node(e).rank=n.node(r).rank+(a?i.minlen:-i.minlen)})}function _(e,t,n){return e.hasEdge(t,n)}function v(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}return Eg}var kg,Ag;function jg(){if(Ag)return kg;Ag=1;var e=Sg().longestPath,t=Tg(),n=Og();kg=r;function r(e){switch(e.graph().ranker){case`network-simplex`:o(e);break;case`tight-tree`:a(e);break;case`longest-path`:i(e);break;default:o(e)}}var i=e;function a(n){e(n),t(n)}function o(e){n(e)}return kg}var Mg,Ng;function Pg(){if(Ng)return Mg;Ng=1;var e=Q();Mg=t;function t(t){var i=r(t);e.forEach(t.graph().dummyChains,function(e){for(var r=t.node(e),a=r.edgeObj,o=n(t,i,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;e!==a.w;){if(r=t.node(e),d){for(;(u=s[l])!==c&&t.node(u).maxRank<r.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&t.node(u=s[l+1]).minRank<=r.rank;)l++;u=s[l]}t.setParent(e,u),e=t.successors(e)[0]}})}function n(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function r(t){var n={},r=0;function i(a){var o=r;e.forEach(t.children(a),i),n[a]={low:o,lim:r++}}return e.forEach(t.children(),i),n}return Mg}var Fg,Ig;function Lg(){if(Ig)return Fg;Ig=1;var e=Q(),t=$();Fg={run:n,cleanup:o};function n(n){var o=t.addDummyNode(n,`root`,{},`_root`),s=i(n),c=e.max(e.values(s))-1,l=2*c+1;n.graph().nestingRoot=o,e.forEach(n.edges(),function(e){n.edge(e).minlen*=l});var u=a(n)+1;e.forEach(n.children(),function(e){r(n,o,l,u,c,s,e)}),n.graph().nodeRankFactor=l}function r(n,i,a,o,s,c,l){var u=n.children(l);if(!u.length){l!==i&&n.setEdge(i,l,{weight:0,minlen:a});return}var d=t.addBorderNode(n,`_bt`),f=t.addBorderNode(n,`_bb`),p=n.node(l);n.setParent(d,l),p.borderTop=d,n.setParent(f,l),p.borderBottom=f,e.forEach(u,function(e){r(n,i,a,o,s,c,e);var t=n.node(e),u=t.borderTop?t.borderTop:e,p=t.borderBottom?t.borderBottom:e,m=t.borderTop?o:2*o,h=u===p?s-c[l]+1:1;n.setEdge(d,u,{weight:m,minlen:h,nestingEdge:!0}),n.setEdge(p,f,{weight:m,minlen:h,nestingEdge:!0})}),n.parent(l)||n.setEdge(i,d,{weight:0,minlen:s+c[l]})}function i(t){var n={};function r(i,a){var o=t.children(i);o&&o.length&&e.forEach(o,function(e){r(e,a+1)}),n[i]=a}return e.forEach(t.children(),function(e){r(e,1)}),n}function a(t){return e.reduce(t.edges(),function(e,n){return e+t.edge(n).weight},0)}function o(t){var n=t.graph();t.removeNode(n.nestingRoot),delete n.nestingRoot,e.forEach(t.edges(),function(e){t.edge(e).nestingEdge&&t.removeEdge(e)})}return Fg}var Rg,zg;function Bg(){if(zg)return Rg;zg=1;var e=Q(),t=$();Rg=n;function n(t){function n(i){var a=t.children(i),o=t.node(i);if(a.length&&e.forEach(a,n),e.has(o,`minRank`)){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,c=o.maxRank+1;s<c;++s)r(t,`borderLeft`,`_bl`,i,o,s),r(t,`borderRight`,`_br`,i,o,s)}}e.forEach(t.children(),n)}function r(e,n,r,i,a,o){var s={width:0,height:0,rank:o,borderType:n},c=a[n][o-1],l=t.addDummyNode(e,`border`,s,r);a[n][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}return Rg}var Vg,Hg;function Ug(){if(Hg)return Vg;Hg=1;var e=Q();Vg={adjust:t,undo:n};function t(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&r(e)}function n(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&a(e),(t===`lr`||t===`rl`)&&(s(e),r(e))}function r(t){e.forEach(t.nodes(),function(e){i(t.node(e))}),e.forEach(t.edges(),function(e){i(t.edge(e))})}function i(e){var t=e.width;e.width=e.height,e.height=t}function a(t){e.forEach(t.nodes(),function(e){o(t.node(e))}),e.forEach(t.edges(),function(n){var r=t.edge(n);e.forEach(r.points,o),e.has(r,`y`)&&o(r)})}function o(e){e.y=-e.y}function s(t){e.forEach(t.nodes(),function(e){c(t.node(e))}),e.forEach(t.edges(),function(n){var r=t.edge(n);e.forEach(r.points,c),e.has(r,`x`)&&c(r)})}function c(e){var t=e.x;e.x=e.y,e.y=t}return Vg}var Wg,Gg;function Kg(){if(Gg)return Wg;Gg=1;var e=Q();Wg=t;function t(t){var n={},r=e.filter(t.nodes(),function(e){return!t.children(e).length}),i=e.max(e.map(r,function(e){return t.node(e).rank})),a=e.map(e.range(i+1),function(){return[]});function o(r){e.has(n,r)||(n[r]=!0,a[t.node(r).rank].push(r),e.forEach(t.successors(r),o))}var s=e.sortBy(r,function(e){return t.node(e).rank});return e.forEach(s,o),a}return Wg}var qg,Jg;function Yg(){if(Jg)return qg;Jg=1;var e=Q();qg=t;function t(e,t){for(var r=0,i=1;i<t.length;++i)r+=n(e,t[i-1],t[i]);return r}function n(t,n,r){for(var i=e.zipObject(r,e.map(r,function(e,t){return t})),a=e.flatten(e.map(n,function(n){return e.sortBy(e.map(t.outEdges(n),function(e){return{pos:i[e.w],weight:t.edge(e).weight}}),`pos`)}),!0),o=1;o<r.length;)o<<=1;var s=2*o-1;--o;var c=e.map(Array(s),function(){return 0}),l=0;return e.forEach(a.forEach(function(e){var t=e.pos+o;c[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n})),l}return qg}var Xg,Zg;function Qg(){if(Zg)return Xg;Zg=1;var e=Q();Xg=t;function t(t,n){return e.map(n,function(n){var r=t.inEdges(n);if(r.length){var i=e.reduce(r,function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}return{v:n}})}return Xg}var $g,e_;function t_(){if(e_)return $g;e_=1;var e=Q();$g=t;function t(t,r){var i={};return e.forEach(t,function(t,n){var r=i[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:n};e.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)}),e.forEach(r.edges(),function(t){var n=i[t.v],r=i[t.w];!e.isUndefined(n)&&!e.isUndefined(r)&&(r.indegree++,n.out.push(i[t.w]))}),n(e.filter(i,function(e){return!e.indegree}))}function n(t){var n=[];function i(t){return function(n){n.merged||(e.isUndefined(n.barycenter)||e.isUndefined(t.barycenter)||n.barycenter>=t.barycenter)&&r(t,n)}}function a(e){return function(n){n.in.push(e),--n.indegree===0&&t.push(n)}}for(;t.length;){var o=t.pop();n.push(o),e.forEach(o.in.reverse(),i(o)),e.forEach(o.out,a(o))}return e.map(e.filter(n,function(e){return!e.merged}),function(t){return e.pick(t,[`vs`,`i`,`barycenter`,`weight`])})}function r(e,t){var 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}return $g}var n_,r_;function i_(){if(r_)return n_;r_=1;var e=Q(),t=$();n_=n;function n(n,a){var o=t.partition(n,function(t){return e.has(t,`barycenter`)}),s=o.lhs,c=e.sortBy(o.rhs,function(e){return-e.i}),l=[],u=0,d=0,f=0;s.sort(i(!!a)),f=r(l,c,f),e.forEach(s,function(e){f+=e.vs.length,l.push(e.vs),u+=e.barycenter*e.weight,d+=e.weight,f=r(l,c,f)});var p={vs:e.flatten(l,!0)};return d&&(p.barycenter=u/d,p.weight=d),p}function r(t,n,r){for(var i;n.length&&(i=e.last(n)).i<=r;)n.pop(),t.push(i.vs),r++;return r}function i(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}return n_}var a_,o_;function s_(){if(o_)return a_;o_=1;var e=Q(),t=Qg(),n=t_(),r=i_();a_=i;function i(s,c,l,u){var d=s.children(c),f=s.node(c),p=f?f.borderLeft:void 0,m=f?f.borderRight:void 0,h={};p&&(d=e.filter(d,function(e){return e!==p&&e!==m}));var g=t(s,d);e.forEach(g,function(t){if(s.children(t.v).length){var n=i(s,t.v,l,u);h[t.v]=n,e.has(n,`barycenter`)&&o(t,n)}});var _=n(g,l);a(_,h);var v=r(_,u);if(p&&(v.vs=e.flatten([p,v.vs,m],!0),s.predecessors(p).length)){var y=s.node(s.predecessors(p)[0]),b=s.node(s.predecessors(m)[0]);e.has(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+y.order+b.order)/(v.weight+2),v.weight+=2}return v}function a(t,n){e.forEach(t,function(t){t.vs=e.flatten(t.vs.map(function(e){return n[e]?n[e].vs:e}),!0)})}function o(t,n){e.isUndefined(t.barycenter)?(t.barycenter=n.barycenter,t.weight=n.weight):(t.barycenter=(t.barycenter*t.weight+n.barycenter*n.weight)/(t.weight+n.weight),t.weight+=n.weight)}return a_}var c_,l_;function u_(){if(l_)return c_;l_=1;var e=Q(),t=Z().Graph;c_=n;function n(n,i,a){var o=r(n),s=new t({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(e){return n.node(e)});return e.forEach(n.nodes(),function(t){var r=n.node(t),c=n.parent(t);(r.rank===i||r.minRank<=i&&i<=r.maxRank)&&(s.setNode(t),s.setParent(t,c||o),e.forEach(n[a](t),function(r){var i=r.v===t?r.w:r.v,a=s.edge(i,t),o=e.isUndefined(a)?0:a.weight;s.setEdge(i,t,{weight:n.edge(r).weight+o})}),e.has(r,`minRank`)&&s.setNode(t,{borderLeft:r.borderLeft[i],borderRight:r.borderRight[i]}))}),s}function r(t){for(var n;t.hasNode(n=e.uniqueId(`_root`)););return n}return c_}var d_,f_;function p_(){if(f_)return d_;f_=1;var e=Q();d_=t;function t(t,n,r){var i={},a;e.forEach(r,function(e){for(var r=t.parent(e),o,s;r;){if(o=t.parent(r),o?(s=i[o],i[o]=r):(s=a,a=r),s&&s!==r){n.setEdge(s,r);return}r=o}})}return d_}var m_,h_;function g_(){if(h_)return m_;h_=1;var e=Q(),t=Kg(),n=Yg(),r=s_(),i=u_(),a=p_(),o=Z().Graph,s=$();m_=c;function c(r){var i=s.maxRank(r),a=l(r,e.range(1,i+1),`inEdges`),o=l(r,e.range(i-1,-1,-1),`outEdges`),c=t(r);d(r,c);for(var f=1/0,p,m=0,h=0;h<4;++m,++h){u(m%2?a:o,m%4>=2),c=s.buildLayerMatrix(r);var g=n(r,c);g<f&&(h=0,p=e.cloneDeep(c),f=g)}d(r,p)}function l(t,n,r){return e.map(n,function(e){return i(t,e,r)})}function u(t,n){var i=new o;e.forEach(t,function(t){var o=t.graph().root,s=r(t,o,i,n);e.forEach(s.vs,function(e,n){t.node(e).order=n}),a(t,i,s.vs)})}function d(t,n){e.forEach(n,function(n){e.forEach(n,function(e,n){t.node(e).order=n})})}return m_}var __,v_;function y_(){if(v_)return __;v_=1;var e=Q(),t=Z().Graph,n=$();__={positionX:m,findType1Conflicts:r,findType2Conflicts:i,addConflict:o,hasConflict:s,verticalAlignment:c,horizontalCompaction:l,alignCoordinates:f,findSmallestWidthAlignment:d,balance:p};function r(t,n){var r={};function i(n,i){var s=0,c=0,l=n.length,u=e.last(i);return e.forEach(i,function(n,d){var f=a(t,n),p=f?t.node(f).order:l;(f||n===u)&&(e.forEach(i.slice(c,d+1),function(n){e.forEach(t.predecessors(n),function(e){var i=t.node(e),a=i.order;(a<s||p<a)&&!(i.dummy&&t.node(n).dummy)&&o(r,e,n)})}),c=d+1,s=p)}),i}return e.reduce(n,i),r}function i(t,n){var r={};function i(n,i,a,s,c){var l;e.forEach(e.range(i,a),function(i){l=n[i],t.node(l).dummy&&e.forEach(t.predecessors(l),function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>c)&&o(r,e,l)})})}function a(n,r){var a=-1,o,s=0;return e.forEach(r,function(e,c){if(t.node(e).dummy===`border`){var l=t.predecessors(e);l.length&&(o=t.node(l[0]).order,i(r,s,c,a,o),s=c,a=o)}i(r,s,r.length,o,n.length)}),r}return e.reduce(n,a),r}function a(t,n){if(t.node(n).dummy)return e.find(t.predecessors(n),function(e){return t.node(e).dummy})}function o(e,t,n){if(t>n){var r=t;t=n,n=r}var i=e[t];i||(e[t]=i={}),i[n]=!0}function s(t,n,r){if(n>r){var i=n;n=r,r=i}return e.has(t[n],r)}function c(t,n,r,i){var a={},o={},c={};return e.forEach(n,function(t){e.forEach(t,function(e,t){a[e]=e,o[e]=e,c[e]=t})}),e.forEach(n,function(t){var n=-1;e.forEach(t,function(t){var l=i(t);if(l.length){l=e.sortBy(l,function(e){return c[e]});for(var u=(l.length-1)/2,d=Math.floor(u),f=Math.ceil(u);d<=f;++d){var p=l[d];o[t]===t&&n<c[p]&&!s(r,t,p)&&(o[p]=t,o[t]=a[t]=a[p],n=c[p])}}})}),{root:a,align:o}}function l(t,n,r,i,a){var o={},s=u(t,n,r,a),c=a?`borderLeft`:`borderRight`;function l(e,t){for(var n=s.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function d(e){o[e]=s.inEdges(e).reduce(function(e,t){return Math.max(e,o[t.v]+s.edge(t))},0)}function f(e){var n=s.outEdges(e).reduce(function(e,t){return Math.min(e,o[t.w]-s.edge(t))},1/0),r=t.node(e);n!==1/0&&r.borderType!==c&&(o[e]=Math.max(o[e],n))}return l(d,s.predecessors.bind(s)),l(f,s.successors.bind(s)),e.forEach(i,function(e){o[e]=o[r[e]]}),o}function u(n,r,i,a){var o=new t,s=n.graph(),c=h(s.nodesep,s.edgesep,a);return e.forEach(r,function(t){var r;e.forEach(t,function(e){var t=i[e];if(o.setNode(t),r){var a=i[r],s=o.edge(a,t);o.setEdge(a,t,Math.max(c(n,e,r),s||0))}r=e})}),o}function d(t,n){return e.minBy(e.values(n),function(n){var r=-1/0,i=1/0;return e.forIn(n,function(e,n){var a=g(t,n)/2;r=Math.max(e+a,r),i=Math.min(e-a,i)}),r-i})}function f(t,n){var r=e.values(n),i=e.min(r),a=e.max(r);e.forEach([`u`,`d`],function(r){e.forEach([`l`,`r`],function(o){var s=r+o,c=t[s],l;if(c!==n){var u=e.values(c);l=o===`l`?i-e.min(u):a-e.max(u),l&&(t[s]=e.mapValues(c,function(e){return e+l}))}})})}function p(t,n){return e.mapValues(t.ul,function(r,i){if(n)return t[n.toLowerCase()][i];var a=e.sortBy(e.map(t,i));return(a[1]+a[2])/2})}function m(t){var a=n.buildLayerMatrix(t),o=e.merge(r(t,a),i(t,a)),s={},u;return e.forEach([`u`,`d`],function(n){u=n===`u`?a:e.values(a).reverse(),e.forEach([`l`,`r`],function(r){r===`r`&&(u=e.map(u,function(t){return e.values(t).reverse()}));var i=(n===`u`?t.predecessors:t.successors).bind(t),a=c(t,u,o,i),d=l(t,u,a.root,a.align,r===`r`);r===`r`&&(d=e.mapValues(d,function(e){return-e})),s[n+r]=d})}),f(s,d(t,s)),p(s,t.graph().align)}function h(t,n,r){return function(i,a,o){var s=i.node(a),c=i.node(o),l=0,u;if(l+=s.width/2,e.has(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:u=-s.width/2;break;case`r`:u=s.width/2}if(u&&(l+=r?u:-u),u=0,l+=(s.dummy?n:t)/2,l+=(c.dummy?n:t)/2,l+=c.width/2,e.has(c,`labelpos`))switch(c.labelpos.toLowerCase()){case`l`:u=c.width/2;break;case`r`:u=-c.width/2}return u&&(l+=r?u:-u),u=0,l}}function g(e,t){return e.node(t).width}return __}var b_,x_;function S_(){if(x_)return b_;x_=1;var e=Q(),t=$(),n=y_().positionX;b_=r;function r(r){r=t.asNonCompoundGraph(r),i(r),e.forEach(n(r),function(e,t){r.node(t).x=e})}function i(n){var r=t.buildLayerMatrix(n),i=n.graph().ranksep,a=0;e.forEach(r,function(t){var r=e.max(e.map(t,function(e){return n.node(e).height}));e.forEach(t,function(e){n.node(e).y=a+r/2}),a+=r+i})}return b_}var C_,w_;function T_(){if(w_)return C_;w_=1;var e=Q(),t=mg(),n=yg(),r=jg(),i=$().normalizeRanks,a=Pg(),o=$().removeEmptyRanks,s=Lg(),c=Bg(),l=Ug(),u=g_(),d=S_(),f=$(),p=Z().Graph;C_=m;function m(e,t){var n=t&&t.debugTiming?f.time:f.notime;n(`layout`,function(){var t=n(` buildLayoutGraph`,function(){return T(e)});n(` runLayout`,function(){h(t,n)}),n(` updateInputGraph`,function(){g(e,t)})})}function h(e,p){p(` makeSpaceForEdgeLabels`,function(){E(e)}),p(` removeSelfEdges`,function(){M(e)}),p(` acyclic`,function(){t.run(e)}),p(` nestingGraph.run`,function(){s.run(e)}),p(` rank`,function(){r(f.asNonCompoundGraph(e))}),p(` injectEdgeLabelProxies`,function(){D(e)}),p(` removeEmptyRanks`,function(){o(e)}),p(` nestingGraph.cleanup`,function(){s.cleanup(e)}),p(` normalizeRanks`,function(){i(e)}),p(` assignRankMinMax`,function(){O(e)}),p(` removeEdgeLabelProxies`,function(){k(e)}),p(` normalize.run`,function(){n.run(e)}),p(` parentDummyChains`,function(){a(e)}),p(` addBorderSegments`,function(){c(e)}),p(` order`,function(){u(e)}),p(` insertSelfEdges`,function(){N(e)}),p(` adjustCoordinateSystem`,function(){l.adjust(e)}),p(` position`,function(){d(e)}),p(` positionSelfEdges`,function(){P(e)}),p(` removeBorderNodes`,function(){ne(e)}),p(` normalize.undo`,function(){n.undo(e)}),p(` fixupEdgeLabelCoords`,function(){A(e)}),p(` undoCoordinateSystem`,function(){l.undo(e)}),p(` translateGraph`,function(){ee(e)}),p(` assignNodeIntersects`,function(){te(e)}),p(` reversePoints`,function(){j(e)}),p(` acyclic.undo`,function(){t.undo(e)})}function g(t,n){e.forEach(t.nodes(),function(e){var r=t.node(e),i=n.node(e);r&&(r.x=i.x,r.y=i.y,n.children(e).length&&(r.width=i.width,r.height=i.height))}),e.forEach(t.edges(),function(r){var i=t.edge(r),a=n.edge(r);i.points=a.points,e.has(a,`x`)&&(i.x=a.x,i.y=a.y)}),t.graph().width=n.graph().width,t.graph().height=n.graph().height}var _=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],v={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},y=[`acyclicer`,`ranker`,`rankdir`,`align`],b=[`width`,`height`],x={width:0,height:0},S=[`minlen`,`weight`,`width`,`height`,`labeloffset`],C={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},w=[`labelpos`];function T(t){var n=new p({multigraph:!0,compound:!0}),r=ie(t.graph());return n.setGraph(e.merge({},v,re(r,_),e.pick(r,y))),e.forEach(t.nodes(),function(r){var i=ie(t.node(r));n.setNode(r,e.defaults(re(i,b),x)),n.setParent(r,t.parent(r))}),e.forEach(t.edges(),function(r){var i=ie(t.edge(r));n.setEdge(r,e.merge({},C,re(i,S),e.pick(i,w)))}),n}function E(t){var n=t.graph();n.ranksep/=2,e.forEach(t.edges(),function(e){var r=t.edge(e);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(n.rankdir===`TB`||n.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function D(t){e.forEach(t.edges(),function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};f.addDummyNode(t,`edge-proxy`,i,`_ep`)}})}function O(t){var n=0;e.forEach(t.nodes(),function(r){var i=t.node(r);i.borderTop&&(i.minRank=t.node(i.borderTop).rank,i.maxRank=t.node(i.borderBottom).rank,n=e.max(n,i.maxRank))}),t.graph().maxRank=n}function k(t){e.forEach(t.nodes(),function(e){var n=t.node(e);n.dummy===`edge-proxy`&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}function ee(t){var n=1/0,r=0,i=1/0,a=0,o=t.graph(),s=o.marginx||0,c=o.marginy||0;function l(e){var t=e.x,o=e.y,s=e.width,c=e.height;n=Math.min(n,t-s/2),r=Math.max(r,t+s/2),i=Math.min(i,o-c/2),a=Math.max(a,o+c/2)}e.forEach(t.nodes(),function(e){l(t.node(e))}),e.forEach(t.edges(),function(n){var r=t.edge(n);e.has(r,`x`)&&l(r)}),n-=s,i-=c,e.forEach(t.nodes(),function(e){var r=t.node(e);r.x-=n,r.y-=i}),e.forEach(t.edges(),function(r){var a=t.edge(r);e.forEach(a.points,function(e){e.x-=n,e.y-=i}),e.has(a,`x`)&&(a.x-=n),e.has(a,`y`)&&(a.y-=i)}),o.width=r-n+s,o.height=a-i+c}function te(t){e.forEach(t.edges(),function(e){var n=t.edge(e),r=t.node(e.v),i=t.node(e.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(f.intersectRect(r,a)),n.points.push(f.intersectRect(i,o))})}function A(t){e.forEach(t.edges(),function(n){var r=t.edge(n);if(e.has(r,`x`))switch((r.labelpos===`l`||r.labelpos===`r`)&&(r.width-=r.labeloffset),r.labelpos){case`l`:r.x-=r.width/2+r.labeloffset;break;case`r`:r.x+=r.width/2+r.labeloffset}})}function j(t){e.forEach(t.edges(),function(e){var n=t.edge(e);n.reversed&&n.points.reverse()})}function ne(t){e.forEach(t.nodes(),function(n){if(t.children(n).length){var r=t.node(n),i=t.node(r.borderTop),a=t.node(r.borderBottom),o=t.node(e.last(r.borderLeft)),s=t.node(e.last(r.borderRight));r.width=Math.abs(s.x-o.x),r.height=Math.abs(a.y-i.y),r.x=o.x+r.width/2,r.y=i.y+r.height/2}}),e.forEach(t.nodes(),function(e){t.node(e).dummy===`border`&&t.removeNode(e)})}function M(t){e.forEach(t.edges(),function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||=[],n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function N(t){var n=f.buildLayerMatrix(t);e.forEach(n,function(n){var r=0;e.forEach(n,function(n,i){var a=t.node(n);a.order=i+r,e.forEach(a.selfEdges,function(e){f.addDummyNode(t,`selfedge`,{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++r,e:e.e,label:e.label},`_se`)}),delete a.selfEdges})})}function P(t){e.forEach(t.nodes(),function(e){var n=t.node(e);if(n.dummy===`selfedge`){var r=t.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function re(t,n){return e.mapValues(e.pick(t,n),Number)}function ie(t){var n={};return e.forEach(t,function(e,t){n[t.toLowerCase()]=e}),n}return C_}var E_,D_;function O_(){if(D_)return E_;D_=1;var e=Q(),t=$(),n=Z().Graph;E_={debugOrdering:r};function r(r){var i=t.buildLayerMatrix(r),a=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(r.nodes(),function(e){a.setNode(e,{label:e}),a.setParent(e,`layer`+r.node(e).rank)}),e.forEach(r.edges(),function(e){a.setEdge(e.v,e.w,{},e.name)}),e.forEach(i,function(t,n){var r=`layer`+n;a.setNode(r,{rank:`same`}),e.reduce(t,function(e,t){return a.setEdge(e,t,{style:`invis`}),t})}),a}return E_}var k_,A_;function j_(){return A_?k_:(A_=1,k_=`0.8.5`,k_)}var M_,N_;function P_(){return N_?M_:(N_=1,M_={graphlib:Z(),layout:T_(),debug:O_(),util:{time:$().time,notime:$().notime},version:j_()},M_)}var F_=P_(),I_=It(F_),L_=function(e){return Nt(e,`Boolean`)};function R_(e,t){if(e){var n;if(kt(e))for(var r=0,i=e.length;r<i&&(n=t(e[r],r),n!==!1);r++);else if(At(e)){for(var a in e)if(e.hasOwnProperty(a)&&(n=t(e[a],a),n===!1))break}}}var z_=Object.prototype.hasOwnProperty,B_=(function(e,t){if(e===null||!Pt(e))return{};var n={};return R_(t,function(t){z_.call(e,t)&&(n[t]=e[t])}),n}),V_=class extends Ot{constructor(){super(...arguments),this.id=`dagre`,this.isCompoundGraph=null,this.config={graphAttributes:[`rankdir`,`align`,`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`,`acyclicer`,`ranker`],nodeAttributes:[`width`,`height`],edgeAttributes:[`minlen`,`weight`,`width`,`height`,`labelpos`,`labeloffset`]}}getDefaultOptions(){return{directed:!0,multigraph:!0,rankdir:`TB`,align:void 0,nodesep:50,edgesep:10,ranksep:50,marginx:0,marginy:0,acyclicer:void 0,ranker:`network-simplex`,nodeSize:[0,0],edgeMinLen:1,edgeWeight:1,edgeLabelSize:[0,0],edgeLabelPos:`r`,edgeLabelOffset:10}}layout(){return ve(this,void 0,void 0,function*(){let e=new F_.graphlib.Graph({directed:!!this.options.directed,multigraph:!!this.options.multigraph,compound:this.isCompound()});e.setGraph(B_(this.options,this.config.graphAttributes)),e.setDefaultEdgeLabel(()=>({}));let t=Ke(this.options.nodeSize,0);this.model.forEachNode(n=>{let r=n._original,[i,a]=Be(t(r)),o={width:i,height:a};if(e.setNode(String(n.id),o),this.isCompound()){if(B(n.parentId))return;e.setParent(String(n.id),String(n.parentId))}});let{edgeLabelSize:n,edgeLabelOffset:r,edgeLabelPos:i,edgeMinLen:a,edgeWeight:o}=this.options,s=Ke(n,0,`edge`),c=Ge(r,10,`edge`),l=typeof i==`string`?()=>i:We(i,[`edge`]),u=Ge(a,1,`edge`),d=Ge(o,1,`edge`);this.model.forEachEdge(t=>{let n=t._original,[r,i]=Be(s(n)),a={width:r,height:i,labelpos:l(n),labeloffset:c(n),minlen:u(n),weight:d(n)};e.setEdge(String(t.source),String(t.target),a,String(t.id))}),I_.layout(e),this.model.forEachNode(t=>{let n=e.node(String(t.id));n&&(t.x=n.x,t.y=n.y,t.size=[n.width,n.height])}),this.model.forEachEdge(t=>{let n=e.edge(String(t.source),String(t.target),String(t.id));if(!n)return;let{width:r,height:i,weight:a,minlen:o,labelpos:s,labeloffset:c,points:l}=n;t.labelSize=[r,i],t.weight=a,t.minLen=o,t.labelPos=s,t.labelOffset=c,t.points=l.map(qe)})})}isCompound(){return this.isCompoundGraph===null?L_(this.options.compound)?this.isCompoundGraph=this.options.compound:(this.isCompoundGraph=this.model.nodes().some(e=>!B(e.parentId)),this.isCompoundGraph):this.isCompoundGraph}},H_=26,U_=72,W_=(e,t,n)=>{let r=(e,t)=>{let n=Array.from(new Set(e)).sort((e,t)=>e-t),r=[];for(let e of n)(r.length===0||e-r[r.length-1]>t)&&r.push(e);return r},i=r(e.map(e=>t.get(e.id)),H_),a=r(e.map(e=>n.get(e.id)),U_),o=(e,t)=>{let n=0;for(let r=1;r<e.length;r++)Math.abs(e[r]-t)<Math.abs(e[n]-t)&&(n=r);return n},s=new Map,c=new Map;for(let r of e)s.set(r.id,o(i,t.get(r.id))),c.set(r.id,o(a,n.get(r.id)));return{col:s,row:c,ncols:i.length,nrows:a.length}},G_=(e,t,n)=>{let r=e.get(t);r===void 0?e.set(t,[n]):r.push(n)},K_=(e,t,n,r)=>{let i=new Set;for(let t of e)i.add(`${n.get(t.id)}:${r.get(t.id)}`);let a=new Map;for(let e of t)e.source!==e.target&&(G_(a,e.source,e.target),G_(a,e.target,e.source));for(let t of e){let e=a.get(t.id);if(e===void 0)continue;let o=e.map(e=>r.get(e)).sort((e,t)=>e-t),s=o[Math.floor((o.length-1)/2)],c=r.get(t.id),l=Math.abs(s-c);if(l===0)continue;let u=Math.sign(s-c),d;if(l===1){if(!e.some(e=>r.get(e)===s&&Math.abs(n.get(e)-n.get(t.id))===1))continue;d=s}else d=c+u*Math.ceil(l/2);for(let e=d;e!==c;e-=u)if(!i.has(`${n.get(t.id)}:${e}`)){i.delete(`${n.get(t.id)}:${c}`),i.add(`${n.get(t.id)}:${e}`),r.set(t.id,e);break}}},q_=(e,t,n)=>{let r=e.map(e=>{if(e.source===e.target)return{chans:[],guts:[]};let r=t.get(e.source),i=t.get(e.target),a=n.get(e.source),o=n.get(e.target),s,c=[];return r===i?s=[r]:Math.abs(r-i)===1?s=[Math.min(r,i)]:(s=[r<i?r:r-1,r<i?i-1:i],c=[o>a?o-1:o]),{chans:s,guts:c}}),i=new Map,a=new Map;for(let e of r){for(let t of e.chans)i.set(t,(i.get(t)??0)+1);for(let t of e.guts)a.set(t,(a.get(t)??0)+1)}return{plans:r,chanCnt:i,gutCnt:a}},J_=(e,t,n,r,i,a,o,s,c,l)=>{let u=Array.from({length:a},()=>0),d=Array.from({length:o},()=>0);for(let a of e)u[t.get(a.id)]=Math.max(u[t.get(a.id)],r.get(a.id)),d[n.get(a.id)]=Math.max(d[n.get(a.id)],i.get(a.id));let f=Array.from({length:a},(e,t)=>{let n=s.get(t)??0;return n===0?24:Math.min(l[`graph-channel-width-max`],28+(n-1)*l[`size-edge-track-gap`])}),p=Array.from({length:o},(e,t)=>{let n=c.get(t)??0;return n===0?20:Math.min(l[`graph-gutter-height-max`],24+(n-1)*l[`size-edge-track-gap`])}),m=[],h=[],g=l[`size-canvas-margin`];for(let e=0;e<u.length;e++)m.push(g+u[e]/2),g+=u[e]+f[e];let _=l[`size-canvas-margin`];for(let e=0;e<d.length;e++)h.push(_+d[e]/2),_+=d[e]+p[e];return{colWidth:u,rowHeight:d,chanW:f,gutH:p,colCX:m,rowCY:h}},Y_=(e,t,n,r,i,a)=>{let{colWidth:o,rowHeight:s,chanW:c,gutH:l,colCX:u,rowCY:d}=i,f=e=>d[e]+s[e]/2+l[e]/2,p=new Map;e.forEach((e,i)=>{let{chans:a,guts:o}=t[i];if(a.length===0)return;let s=n.get(e.target)<n.get(e.source),c=r.get(`${i}:s`),l=r.get(`${i}:t`);if(a.length===1)G_(p,a[0],{edge:i,posIn:c.y,posOut:l.y,mirror:s});else{let e=f(o[0]);G_(p,a[0],{edge:i,posIn:c.y,posOut:e,mirror:s}),G_(p,a[1],{edge:i,posIn:e,posOut:l.y,mirror:s})}});let m=new Map;for(let[e,t]of p)for(let[n,r]of oe(t,c[e],16,a[`size-edge-track-gap`]))m.set(`${e}:${n}`,r);let h=(e,t)=>u[e]+o[e]/2+c[e]/2+m.get(`${e}:${t}`),g=new Map;e.forEach((e,n)=>{let{chans:i,guts:a}=t[n];if(a.length===0)return;let o=r.get(`${n}:s`);G_(g,a[0],{edge:n,posIn:h(i[0],n),posOut:h(i[1],n),mirror:o.y>f(a[0])})});let _=new Map;for(let[e,t]of g)for(let[n,r]of oe(t,l[e],12,a[`size-edge-track-gap`]))_.set(`${e}:${n}`,r);return{chanX:h,gutY:(e,t)=>f(e)+_.get(`${e}:${t}`)}},X_=(e,t,n,r,i,a,o,s,c)=>{let l=new Map;return e.map((e,u)=>{let d=n.get(e.source),f=n.get(e.target),p=r.get(`${u}:s`),m=r.get(`${u}:t`),{chans:h,guts:g}=t[u],_;if(e.source===e.target){let t=l.get(e.source)??0;l.set(e.source,t+1);let n=a(e.source)+i.get(e.source)/2+24+t*c[`size-edge-track-gap`];_=[[p.x,p.y],[n,p.y],[n,m.y],[m.x,m.y]]}else if(h.length===1){let e=o(h[0],u);_=Math.abs(d-f)===1&&p.y===m.y?[[p.x,p.y],[m.x,m.y]]:[[p.x,p.y],[e,p.y],[e,m.y],[m.x,m.y]]}else{let e=o(h[0],u),t=o(h[1],u),n=s(g[0],u);_=[[p.x,p.y],[e,p.y],[e,n],[t,n],[t,m.y],[m.x,m.y]]}return F(_)})},Z_=async(e,t)=>{let n=Array.from(e.nodes.values()),r=e.edges,{boxW:i,boxH:a,contentH:o}=P(n,t,()=>t[`size-node-height-scale`]),s=new V_({rankdir:`LR`,nodesep:t[`graph-node-separation`],ranksep:t[`graph-rank-separation`],nodeSize:e=>e.size});await s.execute({nodes:n.map(e=>({id:e.id,size:[i.get(e.id),a.get(e.id)]})),edges:r.map((e,t)=>({id:`e${t}`,source:e.source,target:e.target}))});let c=new Map,l=new Map;s.forEachNode(e=>{c.set(String(e.id),e.x),l.set(String(e.id),e.y)});let{col:u,row:d,ncols:f,nrows:p}=W_(n,c,l);K_(n,r,u,d);let m=Math.max(Math.floor(t[`graph-columns-max`]),1);if(f>m)for(let e of n){let t=u.get(e.id);u.set(e.id,t%m),d.set(e.id,d.get(e.id)+Math.floor(t/m)*p)}let h=Math.min(f,m),g=Array.from(new Set(n.map(e=>d.get(e.id)))).sort((e,t)=>e-t),_=new Map(g.map((e,t)=>[e,t]));for(let e of n)d.set(e.id,_.get(d.get(e.id)));let v=g.length,{plans:y,chanCnt:b,gutCnt:x}=q_(r,u,d),S=J_(n,u,d,i,a,h,v,b,x,t),C=e=>S.colCX[u.get(e)],w=e=>S.rowCY[d.get(e)],T=ae(r,r.map(e=>{let t=u.get(e.source),n=u.get(e.target);return t<n?{s:`e`,t:`w`}:t>n?{s:`w`,t:`e`}:{s:`e`,t:`e`}}),C,w,i,a),{chanX:E,gutY:D}=Y_(r,y,u,T,S,t);return{nodes:n,edges:r,cx:C,cy:w,boxW:i,boxH:a,contentH:o,polys:X_(r,y,u,T,i,C,E,D,t)}},Q_=`\0`,$_=e=>{let t=Array.from(e.nodes.values());for(let e of t)if(e.id.includes(Q_))throw Error(`node id ${JSON.stringify(e.id)} contains a reserved control character`);let n=t.filter(k);if(n.length!==1)throw Error(`expected exactly one node annotated with "primary: true" (found ${n.length})`);let r=n[0],i=new Set,a=new Set;for(let t of e.edges)if(t.source===r.id&&t.target===r.id)throw Error(`self-loop on primary node "${r.id}" not supported`);else if(t.target===r.id)i.add(t.source);else if(t.source===r.id)a.add(t.target);else throw Error(`edge "${t.source}" --> "${t.target}" does not connect to primary node "${r.id}"`);let o=new Set,s=[],c=[];for(let e of t){if(e.id===r.id)continue;let t=i.has(e.id),n=a.has(e.id);if(!t&&!n)throw Error(`node "${e.id}" is neither input nor output of primary node "${r.id}"`);t&&n?(o.add(e.id),s.push({...e,id:e.id+`\0in`}),c.push({...e,id:e.id+`\0out`})):t?s.push(e):c.push(e)}let l=e.edges.map(e=>e.target===r.id&&o.has(e.source)?{...e,source:e.source+`\0in`}:e.source===r.id&&o.has(e.target)?{...e,target:e.target+`\0out`}:e);return{center:r,inputs:s,outputs:c,nodes:[r,...s,...c],edges:l}},ev={graph:Z_,hub:async(e,t)=>{let{center:n,inputs:r,outputs:i,nodes:a,edges:o}=$_(e),s=new Set(r.map(e=>e.id)),c=t[`size-canvas-margin`],l=t[`hub-node-gap`],u=t[`size-node-height-scale`],{boxW:d,boxH:f,contentH:p}=P(a,t,e=>e.id===n.id?u:u/2),m=e=>e.reduce((e,t)=>e+f.get(t.id),0)+Math.max(e.length-1,0)*l,h=Math.max(m(r),f.get(n.id),m(i)),g=new Map,_=e=>{let t=c+(h-m(e))/2;for(let n of e)g.set(n.id,t+f.get(n.id)/2),t+=f.get(n.id)+l};_(r),_(i),g.set(n.id,c+h/2);let v=e=>e===n.id?1:s.has(e)?0:2,y=[r.reduce((e,t)=>Math.max(e,d.get(t.id)),0),d.get(n.id),i.reduce((e,t)=>Math.max(e,d.get(t.id)),0)],b=e=>Math.min(v(e.source),v(e.target)),x=[o.filter(e=>b(e)===0).length,o.filter(e=>b(e)===1).length].map(e=>Math.min(t[`hub-channel-width-max`],Math.max(t[`hub-channel-width-min`],28+(e-1)*t[`size-edge-track-gap`]))),S=[],C=c;for(let e=0;e<3;e++)S.push(C),C+=y[e]+(e<2?x[e]:0);let w=e=>{let t=v(e);return t===0?S[0]+y[0]-d.get(e)/2:t===2?S[2]+d.get(e)/2:S[1]+y[1]/2},T=e=>g.get(e),E=ae(o,o.map(e=>v(e.source)<v(e.target)?{s:`e`,t:`w`}:{s:`w`,t:`e`}),w,T,d,f),D=[[],[]];o.forEach((e,t)=>{D[b(e)].push({edge:t,posIn:E.get(`${t}:s`).y,posOut:E.get(`${t}:t`).y,mirror:!1})});let O=new Map;D.forEach((e,n)=>{for(let[r,i]of oe(e,x[n],16,t[`size-edge-track-gap`]))O.set(`${n}:${r}`,i)});let k=(e,t)=>S[e]+y[e]+x[e]/2+O.get(`${e}:${t}`);return{nodes:a,edges:o,cx:w,cy:T,boxW:d,boxH:f,contentH:p,polys:o.map((e,t)=>{let n=E.get(`${t}:s`),r=E.get(`${t}:t`),i=k(b(e),t),a;return a=n.y===r.y?[[n.x,n.y],[r.x,r.y]]:[[n.x,n.y],[i,n.y],[i,r.y],[r.x,r.y]],F(a)}),styleOf:e=>e.id.endsWith(`\0out`)?{fill:`color-node-ghost-box`,stroke:`color-node-ghost-border`,text:`color-node-ghost-name`,dash:`10 6`}:ee(e)}},grid:async(e,t)=>{let n=Array.from(e.nodes.values()),r=t[`size-canvas-margin`],i=t[`grid-gap-horizontal`],a=t[`grid-gap-vertical`],o=Math.max(Math.floor(t[`grid-columns-max`]),1);if(e.edges.length>0){let t=e.edges[0];throw Error(`diagram type "grid" does not support edges (found ${e.edges.length}, first is "${t.source}" --> "${t.target}")`)}let{boxW:s,boxH:c,contentH:l}=P(n,t,()=>t[`size-node-height-scale`]/2),u=n.reduce((e,t)=>Math.max(e,c.get(t.id)),0);for(let e of n)c.set(e.id,u);let d=Math.max(Math.min(Math.ceil(Math.sqrt(n.length)),o),1),f=Array.from({length:d},()=>0);n.forEach((e,t)=>{f[t%d]=Math.max(f[t%d],s.get(e.id))});let p=[],m=r;for(let e=0;e<d;e++)p.push(m),m+=f[e]+i;let h=new Map,g=new Map;return n.forEach((e,t)=>{h.set(e.id,p[t%d]+s.get(e.id)/2),g.set(e.id,r+Math.floor(t/d)*(u+a)+u/2)}),{nodes:n,edges:[],cx:e=>h.get(e),cy:e=>g.get(e),boxW:s,boxH:c,contentH:l,polys:[]}}},tv=Object.keys(ev),nv=`graph`,rv=e=>{let t;for(let n of e.split(/\r?\n/)){let e=/^[ \t]*#type[ \t]+([a-z][a-z0-9-]*)[ \t]*$/.exec(n);e===null||!Object.hasOwn(ev,e[1])||(t=e[1])}return t},iv=[`svg:standalone`,`svg:embedded`,`url:xml`,`url:base64`];e.Gradia=class e{static config=p;static parse(e){return d(e)}static async generate(e,t={}){let n=t.type??`graph`;if(!Object.hasOwn(ev,n))throw Error(`invalid diagram type "${n}"`);let r=t.format??`svg:standalone`;if(!iv.includes(r))throw Error(`invalid output format "${r}"`);let i=t.config??{},a={...p,...i},o=C(e),s=_e(o===null?await ev[n](e,a):T(o,await Promise.all(o.map(e=>ev[n](e.graph,a))),a),a,i);return r===`svg:embedded`?s.replace(/^<\?xml[^?]*\?>\n/,``):r===`url:xml`?`data:image/svg+xml,${encodeURIComponent(s)}`:r===`url:base64`?`data:image/svg+xml;base64,${Buffer.from(s,`utf8`).toString(`base64`)}`:s}static async render(t,n={}){let r=e.parse(t),i=n.type??rv(t),a={...h(t),...n.config??{}};return e.generate(r,{...n,type:i,config:a})}},e.diagramFormatDefault=`svg:standalone`,e.diagramFormats=iv,e.diagramTypeDefault=nv,e.diagramTypes=tv});
|
|
4
|
+
`;)r++,i++;else if((d=c(a))!==null){let e=d[1]===void 0?d[2]:l(d[1]),a=d[3]===void 0?d[4]:l(d[3]);t.push({type:`edge`,text:d[0],name:e,arity:a,line:n,col:r}),r+=d[0].length,i+=d[0].length}else if((d=c(o))!==null)t.push({type:`string`,text:l(d[1]),line:n,col:r}),r+=d[0].length,i+=d[0].length;else if(u===`"`)throw Error(`unterminated string at line ${n}, column ${r}`);else if(`[](),:`.includes(u))t.push({type:`punct`,text:u,line:n,col:r}),r++,i++;else if((d=c(s))!==null)t.push({type:`word`,text:d[0],line:n,col:r}),r+=d[0].length,i+=d[0].length;else throw Error(`invalid character ${JSON.stringify(u)} at line ${n}, column ${r}`)}return t},d=e=>{let t=u(e),n={nodes:new Map,edges:[]},r=0,i=()=>r<t.length?t[r]:null,a=e=>{let t=i();return t===null||t.type!==`punct`||t.text!==e?!1:(r++,!0)},o=e=>{let t=i(),n=t===null?`end of input`:`line ${t.line}, column ${t.col}`;throw Error(`expected ${e} at ${n}`)},s=()=>{let e=i();return e===null||e.type!==`word`&&e.type!==`string`?o(`bareword or quoted string`):(r++,e.text)},c=()=>{let e=t[r],i=s(),c=null;a(`:`)&&(c=s());let l=[];if(a(`[`)){for(;;){let e=s();a(`:`)||o(`":" in key/value attribute`);let t=s();if(l.push({key:e,val:t}),!a(`,`))break}a(`]`)||o(`"]" after key/value attributes`)}let u=n.nodes.get(i)??{id:i,name:i,attrs:[]};c!==null&&(u.name=c);for(let t of l){let n=u.attrs.findIndex(e=>e.key===t.key);if(n===-1)u.attrs.push(t);else{if(t.key===`group`&&u.attrs[n].val!==t.val)throw Error(`node "${i}" cannot be a member of more than one group ("${u.attrs[n].val}" vs "${t.val}") at line ${e.line}, column ${e.col}`);u.attrs[n]=t}}return n.nodes.set(i,u),i};for(;r<t.length;){if(t[r].type===`newline`){r++;continue}let e=c(),a=i();for(;a!==null&&a.type===`edge`;){r++;let t=c();n.edges.push({source:e,target:t,name:a.name,arity:a.arity}),e=t,a=i()}a!==null&&a.type!==`newline`&&o(`edge operator or end of line`)}return n},f=l(s(((e,t)=>{t.exports={}}))(),1),p={"font-family":`Helvetica`,"font-embed":!1,"color-node-regular-name":`#336699`,"color-node-regular-box":`#e0f0ff`,"color-node-regular-border":`#c0d0e0`,"color-node-primary-name":`#ffffff`,"color-node-primary-box":`#336699`,"color-node-primary-border":`#003366`,"color-node-ghost-name":`#666666`,"color-node-ghost-box":`#f0f0f0`,"color-node-ghost-border":`#a0a0a0`,"color-group-name":`#6699cc`,"color-group-box":`#f4f8fc`,"color-group-border":`#c0d0e0`,"color-edge-line":`#999999`,"color-edge-name":`#333333`,"color-edge-arity":`#333333`,"color-edge-halo":`#ffffff`,"size-canvas-margin":40,"size-node-width-min":220,"size-node-width-max":0,"size-node-height-scale":2.25,"size-edge-corner-radius":20,"size-edge-hop-radius":8,"size-edge-track-gap":12,"group-box-padding":30,"group-box-gap":40,"graph-columns-max":5,"graph-channel-width-max":140,"graph-gutter-height-max":90,"graph-node-separation":30,"graph-rank-separation":60,"hub-channel-width-max":340,"hub-channel-width-min":240,"hub-node-gap":20,"hub-node-degree-max":3,"grid-columns-max":4,"grid-gap-horizontal":40,"grid-gap-vertical":20},m=(e,t)=>Object.hasOwn(e,t)?e[t].replace(/[;{}]/g,``):`var(--gradia-${t}, ${p[t]})`,h=e=>{let t={};for(let n of e.split(/\r?\n/)){let e=/^[ \t]*#config[ \t]+([a-z][a-z0-9-]*)[ \t]+(?:"((?:[^"\\]|\\.)*)"|(\S+))[ \t]*$/.exec(n);if(e===null||!Object.hasOwn(p,e[1]))continue;let r=e[1],i=e[2]===void 0?e[3]:e[2].replace(/\\(.)/g,`$1`);if(!(r===`font-embed`||r===`font-family`&&i.endsWith(`.woff2`))){if(typeof p[r]==`boolean`)t[r]=i===`true`;else if(typeof p[r]==`number`){let e=Number(i);if(i===``||!Number.isFinite(e)||e<0)continue;t[r]=e}else t[r]=i}}return t},g={"Source Sans 3":{file:`source-sans/WOFF2/VF/SourceSans3VF-Upright.ttf.woff2`,weight:`200 900`}},_=e=>{let t=e[`font-family`];if(Object.hasOwn(g,t)){let n=g[t];if(e[`font-embed`]){let e=f.default.fileURLToPath((e=>e)(n.file));return{family:t,embed:f.default.readFileSync(e).toString(`base64`),weight:n.weight}}return{family:t}}if(t.endsWith(`.woff2`)){let n=f.default.basename(t,`.woff2`);return e[`font-embed`]?{family:n,embed:f.default.readFileSync(t).toString(`base64`)}:{family:n}}if(e[`font-embed`])throw Error(`option "font-embed" requires option "font-family" to be a built-in font family (${Object.keys(g).map(e=>`"${e}"`).join(`, `)}) or the path to a WOFF2 file`);return{family:t}},v=(e,t)=>e.length*t*.52,y=(e,t,n)=>{let r=e.split(/\s+/).filter(e=>e!==``);if(n<=0||r.length<=1||v(e,t)<=n)return[e];let i=[],a=r[0];for(let e of r.slice(1))v(`${a} ${e}`,t)>n?(i.push(a),a=e):a=`${a} ${e}`;return i.push(a),i},b=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),x=34,S=e=>e.attrs.findLast(e=>e.key===`group`)?.val,C=e=>{let t=Array.from(e.nodes.values());if(!t.some(e=>S(e)!==void 0))return null;let n=new Map,r=new Map;for(let e of t){let t=S(e)??`default`;r.set(e.id,t);let i=n.get(t);i===void 0&&(i={nodes:new Map,edges:[]},n.set(t,i)),i.nodes.set(e.id,e)}for(let t of e.edges){let e=r.get(t.source),i=r.get(t.target);if(e!==i)throw Error(`edge "${t.source}" --> "${t.target}" crosses groups "${e}" and "${i}"`);n.get(e).edges.push(t)}return Array.from(n.entries()).map(([e,t])=>({name:e,graph:t}))},w=e=>{let{nodes:t,cx:n,cy:r,boxW:i,boxH:a,polys:o}=e,[s,c,l,u]=[1/0,1/0,-1/0,-1/0];for(let e of t)s=Math.min(s,n(e.id)-i.get(e.id)/2),c=Math.min(c,r(e.id)-a.get(e.id)/2),l=Math.max(l,n(e.id)+i.get(e.id)/2),u=Math.max(u,r(e.id)+a.get(e.id)/2);for(let e of o)for(let[t,n]of e)s=Math.min(s,t),c=Math.min(c,n),l=Math.max(l,t),u=Math.max(u,n);return{minX:s,minY:c,maxX:l,maxY:u}},T=(e,t,n)=>{let r=n[`size-canvas-margin`],i=n[`group-box-padding`],a=n[`group-box-gap`],o=[],s=[],c=[],l=new Map,u=r;t.forEach((t,n)=>{let d=w(t),f=Math.max(d.maxX-d.minX+i*2,v(e[n].name,24)+i*2),p=d.maxY-d.minY+i*2+x;s.push(r+i-d.minX),c.push(u+x+i-d.minY);for(let e of t.nodes)l.set(e.id,n);o.push({name:e[n].name,x:r,y:u,w:f,h:p}),u+=p+a});let d=e=>new Map(t.flatMap(t=>Array.from(e(t).entries()))),f=e=>l.get(e);return{nodes:t.flatMap(e=>e.nodes),edges:t.flatMap(e=>e.edges),cx:e=>t[f(e)].cx(e)+s[f(e)],cy:e=>t[f(e)].cy(e)+c[f(e)],boxW:d(e=>e.boxW),boxH:d(e=>e.boxH),contentH:d(e=>e.contentH),polys:t.flatMap((e,t)=>e.polys.map(e=>e.map(([e,n])=>[e+s[t],n+c[t]]))),styleOf:t.every(e=>e.styleOf!==void 0)?e=>t[f(e.id)].styleOf(e):void 0,groups:o}},E=e=>crypto.getRandomValues(new Uint8Array(e)),D=(e,t,n)=>{let r=256-256%e.length;if(r===256){let r=e.length-1;return(i=t)=>{if(!i)return``;let a=``;for(;;){let t=n(i),o=i;for(;o--;)if(a+=e[t[o]&r],a.length>=i)return a}}}let i=Math.ceil(409.6*t/r);return(a=t)=>{if(!a)return``;let o=``;for(;;){let t=n(i),s=i;for(;s--;)if(t[s]<r&&(o+=e[t[s]%e.length],o.length>=a))return o}}},O=(e,t=21)=>D(e,t|0,E),k=e=>e.attrs.findLast(e=>e.key===`primary`)?.val===`true`,ee=e=>k(e)?{fill:`color-node-primary-box`,stroke:`color-node-primary-border`,text:`color-node-primary-name`}:{fill:`color-node-regular-box`,stroke:`color-node-regular-border`,text:`color-node-regular-name`},te=e=>e.attrs.findLast(e=>e.key===`type`)?.val,ne=e=>e.attrs.filter(e=>e.key!==`url`&&e.key!==`type`&&e.key!==`primary`&&e.key!==`group`),A=/^\s*([A-Za-z][A-Za-z0-9+.-]*):/,re=[`http`,`https`,`mailto`],j=e=>{let t=e.attrs.findLast(e=>e.key===`url`)?.val;if(t===void 0)return;let n=t.replace(/[\u0000-\u001F\u007F]/g,``),r=A.exec(n);if(!(r!==null&&!re.includes(r[1].toLowerCase())))return n},M=(e,t)=>{let n=t[`size-node-width-max`]>0?t[`size-node-width-max`]-36:0,r=te(e);return{name:y(e.name,30,n),type:r===void 0?[]:y(r,16,n),attrs:ne(e).flatMap(e=>y(`${e.key}: ${e.val}`,22,n))}},N=(e,t,n)=>{let r=new Map,i=new Map,a=new Map;for(let o of e){let e=M(o,t),s=0;for(let t of e.name)s=Math.max(s,v(t,30));for(let t of e.type)s=Math.max(s,v(t,16));for(let t of e.attrs)s=Math.max(s,v(t,22));let c=64+(e.name.length-1)*38+e.type.length*26+(e.attrs.length>0?e.attrs.length*30+8:0);r.set(o.id,Math.max(t[`size-node-width-min`],Math.ceil(s)+36)),i.set(o.id,Math.ceil(c*n(o))),a.set(o.id,c)}return{boxW:r,boxH:i,contentH:a}},ie=10,P=e=>{let t=[...e];for(let e=t.length-2;e>0;e--){let[n,r,i]=[t[e-1],t[e],t[e+1]];(n[0]===r[0]&&r[0]===i[0]||n[1]===r[1]&&r[1]===i[1])&&t.splice(e,1)}let n=[];for(let e of t)n.length>0&&n[n.length-1][0]===e[0]&&n[n.length-1][1]===e[1]||n.push(e);return n},F=(e,t,n,r,i,a)=>{let o=new Map,s=(e,t,n)=>{let r=o.get(e);r===void 0?o.set(e,[{edge:t,role:n}]):r.push({edge:t,role:n})};e.forEach((e,n)=>{s(`${e.source}:${t[n].s}`,n,`s`),s(`${e.target}:${t[n].t}`,n,`t`)});let c=new Map;for(let[t,s]of o){let o=t.lastIndexOf(`:`),l=t.slice(0,o),u=t.slice(o+1),d=t=>t.role===`s`?e[t.edge].target:e[t.edge].source;s.sort((e,t)=>r(d(e))-r(d(t))||e.edge-t.edge);let f=Math.min(24,(a.get(l)-ie)/s.length);s.forEach((e,t)=>{c.set(`${e.edge}:${e.role}`,{x:n(l)+(u===`e`?1:-1)*i.get(l)/2,y:r(l)+(t-(s.length-1)/2)*f})})}return c},ae=(e,t,n,r)=>{let i=(e,t)=>{let n=t?-1:1,r=e.filter(e=>e.posOut<e.posIn).sort((e,t)=>n*(e.posIn-t.posIn||e.posOut-t.posOut)),i=e.filter(e=>e.posOut>=e.posIn).sort((e,t)=>n*(t.posIn-e.posIn||t.posOut-e.posOut));return[...r,...i]},a=[...i(e.filter(e=>!e.mirror),!1),...i(e.filter(e=>e.mirror),!0)],o=Math.min(r,(t-n)/Math.max(a.length-1,1)),s=new Map;return a.forEach((e,t)=>{s.set(e.edge,(t-(a.length-1)/2)*o)}),s},oe=e=>{let t=[];return e.forEach((e,n)=>{for(let r=0;r<e.length-1;r++){let[i,a]=[e[r],e[r+1]];i[0]===a[0]&&t.push({owner:n,x:i[0],y1:Math.min(i[1],a[1]),y2:Math.max(i[1],a[1])})}}),e.map((e,n)=>{let r=new Map;for(let i=0;i<e.length-1;i++){let[a,o]=[e[i],e[i+1]];if(a[1]!==o[1])continue;let s=a[1],c=Math.min(a[0],o[0]),l=Math.max(a[0],o[0]),u=[];for(let e of t)e.owner!==n&&e.x>c+1&&e.x<l-1&&s>e.y1+1&&s<e.y2-1&&u.push(e.x);u.length>0&&r.set(i,u)}return r})},se=(e,t,n,r)=>{let i=(e,t)=>Math.abs(t[0]-e[0])+Math.abs(t[1]-e[1]),a=a=>{if(a<=0||a>=e.length-1)return 0;let o=Math.min(n,i(e[a-1],e[a])/2,i(e[a],e[a+1])/2);for(let n of[a-1,a])for(let i of t.get(n)??[])o=Math.min(o,Math.max(Math.abs(i-e[a][0])-r-2,4));return o},o=[];for(let n=0;n<e.length-1;n++){let[s,c]=[e[n],e[n+1]],l=i(s,c),u=(c[0]-s[0])/l,d=(c[1]-s[1])/l,f=a(n),p=a(n+1),m=[s[0]+u*f,s[1]+d*f],h=[c[0]-u*p,c[1]-d*p];if(n===0&&o.push(`M ${m[0]} ${m[1]}`),s[1]===c[1]&&t.has(n)){let e=Math.sign(c[0]-s[0]),i=t.get(n).filter(t=>(t-m[0])*e>2&&(h[0]-t)*e>2).sort((t,n)=>(t-n)*e),a=[];for(let e of i){let t=a[a.length-1];t!==void 0&&Math.abs(e-t[t.length-1])<=r*2+14?t.push(e):a.push([e])}for(let t of a){let n=t[0]-e*r,i=t[t.length-1]+e*r;(n-m[0])*e<0&&(n=m[0]),(h[0]-i)*e<0&&(i=h[0]),o.push(`L ${n} ${s[1]}`),o.push(`A ${Math.abs(i-n)/2} ${r} 0 0 ${+(e>0)} ${i} ${s[1]}`)}}if(o.push(`L ${h[0]} ${h[1]}`),n<e.length-2){let t=e[n+1],r=e[n+2],a=i(t,r),s=[t[0]+(r[0]-t[0])/a*p,t[1]+(r[1]-t[1])/a*p];o.push(`Q ${c[0]} ${c[1]} ${s[0]} ${s[1]}`)}}return o.join(` `)},ce=(e,t)=>{let n=e.slice(0,-1).map((t,n)=>Math.abs(e[n+1][0]-t[0])+Math.abs(e[n+1][1]-t[1])),r=n.reduce((e,t)=>e+t,0)*t;for(let t=0;t<n.length;t++){if(r<=n[t]||t===n.length-1){let i=n[t]>0?r/n[t]:0;return{x:e[t][0]+(e[t+1][0]-e[t][0])*Math.min(i,1),y:e[t][1]+(e[t+1][1]-e[t][1])*Math.min(i,1),horizontal:e[t][1]===e[t+1][1]}}r-=n[t]}return{x:e[0][0],y:e[0][1],horizontal:!0}},le=e=>e.replace(/[\\"']/g,`\\$&`).replace(/[\r\n]/g,` `),ue=O(`0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`,12),de=()=>`gradia-${ue()}`,fe=18,pe=12,me=e=>{let{nodes:t,cx:n,cy:r,boxW:i,boxH:a}=e,o=t.map(e=>[n(e.id)-i.get(e.id)/2,r(e.id)-a.get(e.id)/2,n(e.id)+i.get(e.id)/2,r(e.id)+a.get(e.id)/2]);for(let t of e.groups??[])o.push([t.x+fe,t.y+pe,t.x+fe+v(t.name,24),t.y+pe+24*1.2]);let s=e=>o.some(t=>e[0]<t[2]&&e[2]>t[0]&&e[1]<t[3]&&e[3]>t[1]);return{claim:e=>{let t=e.find(e=>!s(e))??e[0];return o.push(t),t},occupied:o}},I=(e,t,n,r,i,a)=>{let{cx:o,cy:s,boxW:c,boxH:l,contentH:u}=t,d=c.get(e.id),f=l.get(e.id),p=o(e.id)-d/2,m=s(e.id)-f/2,h=M(e,a),g=j(e),_=[];_.push(`<rect x="${p}" y="${m}" width="${d}" height="${f}" rx="6" style="fill: ${i(n.fill)}; stroke: ${i(n.stroke)}" stroke-width="4.0"${n.dash===void 0?``:` stroke-dasharray="${b(n.dash)}"`}/>`);let v=s(e.id)-u.get(e.id)/2,y=h.type.length*26,x=(h.name.length-1)*38,S=h.attrs.length>0?v+y+42:s(e.id)+y/2+30*.36-x/2;return h.type.forEach((t,a)=>{_.push(`<text x="${o(e.id)}" y="${S-36-(h.type.length-1-a)*26}" text-anchor="middle" font-size="16" style="font-family: ${r}; fill: ${i(n.text)}">${b(t)}</text>`)}),h.name.forEach((t,a)=>{_.push(`<text x="${o(e.id)}" y="${S+a*38}" text-anchor="middle" font-size="30" font-weight="600" style="font-family: ${r}; fill: ${i(n.text)}">${b(t)}</text>`)}),h.attrs.forEach((t,a)=>{_.push(`<text x="${o(e.id)}" y="${v+y+x+64+8+a*30}" text-anchor="middle" font-size="22" style="font-family: ${r}; fill: ${i(n.text)}">${b(t)}</text>`)}),g===void 0?_:[`<a href="${b(g)}" xlink:href="${b(g)}">`,..._,`</a>`]},he=(e,t,n)=>{let{polys:r}=e,[i,a,o,s]=[1/0,1/0,-1/0,-1/0];for(let[e,n,r,c]of t)i=Math.min(i,e),a=Math.min(a,n),o=Math.max(o,r),s=Math.max(s,c);for(let e of r)for(let[t,n]of e)i=Math.min(i,t),a=Math.min(a,n),o=Math.max(o,t),s=Math.max(s,n);return Number.isFinite(i)||([i,a,o,s]=[0,0,0,0]),{x:Math.floor(i-n/2),y:Math.floor(a-n/2),w:Math.ceil(o-i+n),h:Math.ceil(s-a+n)}},ge=(e,t,n)=>{let{nodes:r,edges:i,polys:a}=e,o=e.groups??[],s=e.styleOf??ee,c=e=>b(m(n,e)),l=`${de()}-arrow`,{family:u,embed:d,weight:f}=_(t),p=b(`${Object.hasOwn(n,`font-family`)?`'${le(u)}'`:`var(--gradia-font-family, '${le(u)}')`}, ui-sans-serif, -apple-system, Helvetica, Arial, sans-serif`),h=oe(a),{claim:g,occupied:y}=me(e),x=[],S=[],C=`stroke-width="4.5" paint-order="stroke" stroke-linejoin="round"`;i.forEach((e,n)=>{if(x.push(`<path d="${se(a[n],h[n],t[`size-edge-corner-radius`],t[`size-edge-hop-radius`])}" fill="none" style="stroke: ${c(`color-edge-line`)}" stroke-width="3.0" marker-end="url(#${l})"/>`),e.name!==void 0){let t=v(e.name,16),r=[];for(let e of[.5,.4,.6,.3,.7,.2,.8]){let i=ce(a[n],e);i.horizontal?(r.push([i.x-t/2,i.y-23,i.x+t/2,i.y-3]),r.push([i.x-t/2,i.y+3,i.x+t/2,i.y+23])):(r.push([i.x+5,i.y-10,i.x+5+t,i.y+10]),r.push([i.x-5-t,i.y-10,i.x-5,i.y+10]))}let i=g(r);S.push(`<text x="${(i[0]+i[2])/2}" y="${i[3]-3}" text-anchor="middle" font-size="16" style="font-family: ${p}; fill: ${c(`color-edge-name`)}; stroke: ${c(`color-edge-halo`)}" ${C}>${b(e.name)}</text>`)}if(e.arity!==void 0){let t=v(e.arity,16),r=ce(a[n],1),i=ce(a[n],.999),o=Math.sign(r.x-i.x)||1,s=r.x-o*(24+t/2),l=g([[s-t/2,r.y-17,s+t/2,r.y-4],[s-t/2,r.y+4,s+t/2,r.y+17],[s-t/2-o*14,r.y-17,s+t/2-o*14,r.y-4]]);S.push(`<text x="${(l[0]+l[2])/2}" y="${l[3]-3}" text-anchor="middle" font-size="16" style="font-family: ${p}; fill: ${c(`color-edge-arity`)}; stroke: ${c(`color-edge-halo`)}" ${C}>${b(e.arity)}</text>`)}});let w=r.flatMap(n=>I(n,e,s(n),p,c,t)),T=o.flatMap(e=>[`<rect x="${e.x}" y="${e.y}" width="${e.w}" height="${e.h}" rx="12" style="fill: ${c(`color-group-box`)}; stroke: ${c(`color-group-border`)}" stroke-width="3.0"/>`,`<text x="${e.x+fe}" y="${e.y+pe+24}" font-size="24" font-weight="600" style="font-family: ${p}; fill: ${c(`color-group-name`)}">${b(e.name)}</text>`]),E=o.map(e=>[e.x,e.y,e.x+e.w,e.y+e.h]),D=he(e,[...y,...E],t[`size-canvas-margin`]);return[`<?xml version="1.0" encoding="UTF-8"?>`,`<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="${D.x} ${D.y} ${D.w} ${D.h}" width="${D.w}" height="${D.h}">`,`<defs>`,...d===void 0?[]:[`<style>`,`@font-face { font-family: "${b(le(u))}"; `+(f===void 0?``:`font-weight: ${b(le(f))}; `)+`src: url(data:font/woff2;base64,${d}) format("woff2"); }`,`</style>`],`<marker id="${l}" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="21" markerHeight="21" markerUnits="userSpaceOnUse" orient="auto-start-reverse">`,`<path d="M 0 1 L 9 5 L 0 9 z" style="fill: ${c(`color-edge-line`)}"/>`,`</marker>`,`</defs>`,...T,...x,...w,...S,`</svg>`,``].join(`
|
|
5
|
+
`)};function _e(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}var ve={abs:Math.abs,ceil:Math.ceil,floor:Math.floor,max:Math.max,min:Math.min,round:Math.round,sqrt:Math.sqrt,pow:Math.pow},L=class extends Error{constructor(e,t,n){super(e),this.position=t,this.token=n,this.name=`ExpressionError`}},R;(function(e){e[e.STRING=0]=`STRING`,e[e.NUMBER=1]=`NUMBER`,e[e.BOOLEAN=2]=`BOOLEAN`,e[e.NULL=3]=`NULL`,e[e.IDENTIFIER=4]=`IDENTIFIER`,e[e.OPERATOR=5]=`OPERATOR`,e[e.FUNCTION=6]=`FUNCTION`,e[e.DOT=7]=`DOT`,e[e.BRACKET_LEFT=8]=`BRACKET_LEFT`,e[e.BRACKET_RIGHT=9]=`BRACKET_RIGHT`,e[e.PAREN_LEFT=10]=`PAREN_LEFT`,e[e.PAREN_RIGHT=11]=`PAREN_RIGHT`,e[e.COMMA=12]=`COMMA`,e[e.QUESTION=13]=`QUESTION`,e[e.COLON=14]=`COLON`,e[e.DOLLAR=15]=`DOLLAR`})(R||={});var ye=new Set([32,9,10,13]),be=new Set([43,45,42,47,37,33,38,124,61,60,62]),xe=new Map([[`true`,R.BOOLEAN],[`false`,R.BOOLEAN],[`null`,R.NULL]]),Se=new Map([[`===`,!0],[`!==`,!0],[`<=`,!0],[`>=`,!0],[`&&`,!0],[`||`,!0],[`+`,!0],[`-`,!0],[`*`,!0],[`/`,!0],[`%`,!0],[`!`,!0],[`<`,!0],[`>`,!0]]),Ce=new Map([[46,R.DOT],[91,R.BRACKET_LEFT],[93,R.BRACKET_RIGHT],[40,R.PAREN_LEFT],[41,R.PAREN_RIGHT],[44,R.COMMA],[63,R.QUESTION],[58,R.COLON],[36,R.DOLLAR]]),we=new Map;for(let[e,t]of Ce.entries())we.set(e,{type:t,value:String.fromCharCode(e)});function Te(e){return e>=48&&e<=57}function Ee(e){return e>=97&&e<=122||e>=65&&e<=90||e===95}function De(e){return Ee(e)||Te(e)}function Oe(e){return be.has(e)}var z;(function(e){e[e.Program=0]=`Program`,e[e.Literal=1]=`Literal`,e[e.Identifier=2]=`Identifier`,e[e.MemberExpression=3]=`MemberExpression`,e[e.CallExpression=4]=`CallExpression`,e[e.BinaryExpression=5]=`BinaryExpression`,e[e.UnaryExpression=6]=`UnaryExpression`,e[e.ConditionalExpression=7]=`ConditionalExpression`})(z||={});var ke=new Map([[`||`,2],[`&&`,3],[`===`,4],[`!==`,4],[`>`,5],[`>=`,5],[`<`,5],[`<=`,5],[`+`,6],[`-`,6],[`*`,7],[`/`,7],[`%`,7],[`!`,8]]),Ae={type:z.Literal,value:null},je={type:z.Literal,value:!0},Me={type:z.Literal,value:!1},Ne=e=>{let t=0,n=e.length,r=()=>t>=n?null:e[t],i=()=>e[t++],a=e=>{let t=r();return t!==null&&t.type===e},o=e=>e.type===R.OPERATOR?ke.get(e.value)||-1:e.type===R.DOT||e.type===R.BRACKET_LEFT?9:e.type===R.QUESTION?1:-1,s=e=>{let n,o;if(i().type===R.DOT){if(!a(R.IDENTIFIER)){let e=r();throw new L(`Expected property name`,t,e?e.value:`<end of input>`)}let e=i();n={type:z.Identifier,name:e.value},o=!1}else{if(n=l(0),!a(R.BRACKET_RIGHT)){let e=r();throw new L(`Expected closing bracket`,t,e?e.value:`<end of input>`)}i(),o=!0}return{type:z.MemberExpression,object:e,property:n,computed:o}},c=()=>{let e=r();if(!e)throw new L(`Unexpected end of input`,t,`<end of input>`);if(e.type===R.OPERATOR&&(e.value===`!`||e.value===`-`)){i();let t=c();return{type:z.UnaryExpression,operator:e.value,argument:t,prefix:!0}}switch(e.type){case R.NUMBER:return i(),{type:z.Literal,value:Number(e.value)};case R.STRING:return i(),{type:z.Literal,value:e.value};case R.BOOLEAN:return i(),e.value===`true`?je:Me;case R.NULL:return i(),Ae;case R.IDENTIFIER:return i(),{type:z.Identifier,name:e.value};case R.FUNCTION:return(()=>{let e=i(),n=[];if(!a(R.PAREN_LEFT)){let e=r();throw new L(`Expected opening parenthesis after function name`,t,e?e.value:`<end of input>`)}for(i();;){if(a(R.PAREN_RIGHT)){i();break}if(!r()){let e=r();throw new L(`Expected closing parenthesis`,t,e?e.value:`<end of input>`)}if(n.length>0){if(!a(R.COMMA)){let e=r();throw new L(`Expected comma between function arguments`,t,e?e.value:`<end of input>`)}i()}let e=l(0);n.push(e)}return{type:z.CallExpression,callee:{type:z.Identifier,name:e.value},arguments:n}})();case R.PAREN_LEFT:{i();let e=l(0);if(!a(R.PAREN_RIGHT)){let e=r();throw new L(`Expected closing parenthesis`,t,e?e.value:`<end of input>`)}return i(),e}default:throw new L(`Unexpected token: ${e.type}`,t,e.value)}},l=(u=0)=>{let d=c();for(;t<n;){let n=e[t],c=o(n);if(c<=u)break;if(n.type!==R.QUESTION){if(n.type!==R.OPERATOR){if(n.type!==R.DOT&&n.type!==R.BRACKET_LEFT)break;d=s(d)}else{i();let e=l(c);d={type:z.BinaryExpression,operator:n.value,left:d,right:e}}}else{i();let e=l(0);if(!a(R.COLON)){let e=r();throw new L(`Expected : in conditional expression`,t,e?e.value:`<end of input>`)}i();let n=l(0);d={type:z.ConditionalExpression,test:d,consequent:e,alternate:n}}}return d},u=l();return{type:z.Program,body:u}},Pe=(e,t,n)=>{let r=t;n&&(r={...t,context:{...t.context,...n}});let i=e=>{switch(e.type){case z.Literal:return(e=>e.value)(e);case z.Identifier:return(e=>{if(!(e.name in r.context))throw new L(`Undefined variable: ${e.name}`);return r.context[e.name]})(e);case z.MemberExpression:return(e=>{let t=i(e.object);if(t==null)throw new L(`Cannot access property of null or undefined`);return t[e.computed?i(e.property):e.property.name]})(e);case z.CallExpression:return(e=>{let t=r.functions[e.callee.name];if(!t)throw new L(`Undefined function: ${e.callee.name}`);return t(...e.arguments.map((e=>i(e))))})(e);case z.BinaryExpression:return(e=>{if(e.operator===`&&`)return i(e.left)&&i(e.right);if(e.operator===`||`)return i(e.left)||i(e.right);let t=i(e.left),n=i(e.right);switch(e.operator){case`+`:return t+n;case`-`:return t-n;case`*`:return t*n;case`/`:return t/n;case`%`:return t%n;case`===`:return t===n;case`!==`:return t!==n;case`>`:return t>n;case`>=`:return t>=n;case`<`:return t<n;case`<=`:return t<=n;default:throw new L(`Unknown operator: ${e.operator}`)}})(e);case z.UnaryExpression:return(e=>{let t=i(e.argument);if(e.prefix)switch(e.operator){case`!`:return!t;case`-`:if(typeof t!=`number`)throw new L(`Cannot apply unary - to non-number: ${t}`);return-t;default:throw new L(`Unknown operator: ${e.operator}`)}throw new L(`Postfix operators are not supported: ${e.operator}`)})(e);case z.ConditionalExpression:return(e=>{let t=i(e.test);return i(t?e.consequent:e.alternate)})(e);default:throw new L(`Evaluation error: Unsupported node type: ${e.type}`)}};return i(e.body)};function Fe(e){let t=Ne((e=>{let t=e,n=t.length,r=Array(Math.ceil(n/3)),i=0,a=0;function o(e){let r=a+1;a++;let i=``,o=!1;for(;a<n;){let n=t.charCodeAt(a);if(n===e)return o||(i=t.substring(r,a)),a++,{type:R.STRING,value:i};n===92?(o||=(i=t.substring(r,a),!0),a++,i+=t[a]):o&&(i+=t[a]),a++}throw new L(`Unterminated string starting with ${String.fromCharCode(e)}`,a,t.substring(Math.max(0,a-10),a))}function s(){let e=a;for(t.charCodeAt(a)===45&&a++;a<n&&Te(t.charCodeAt(a));)a++;if(a<n&&t.charCodeAt(a)===46)for(a++;a<n&&Te(t.charCodeAt(a));)a++;let r=t.slice(e,a);return{type:R.NUMBER,value:r}}function c(){a++;let e=a;if(a<n&&Ee(t.charCodeAt(a)))for(a++;a<n&&De(t.charCodeAt(a));)a++;let r=t.slice(e,a);return{type:R.FUNCTION,value:r}}function l(){let e=a++;for(;a<n&&De(t.charCodeAt(a));)a++;let r=t.slice(e,a),i=xe.get(r);return i?{type:i,value:r}:{type:R.IDENTIFIER,value:r}}function u(){if(a+2<n){let e=t.substring(a,a+3);if(Se.has(e))return a+=3,{type:R.OPERATOR,value:e}}if(a+1<n){let e=t.substring(a,a+2);if(Se.has(e))return a+=2,{type:R.OPERATOR,value:e}}let e=t[a];if(Se.has(e))return a++,{type:R.OPERATOR,value:e};throw new L(`Unknown operator at position ${a}: ${t.substring(a,a+1)}`,a,t.substring(Math.max(0,a-10),a))}for(;a<n;){let e=t.charCodeAt(a);if(d=e,ye.has(d)){a++;continue}let f=we.get(e);if(f)r[i++]=f,a++;else if(e!==34&&e!==39){if(Te(e)||e===45&&a+1<n&&Te(t.charCodeAt(a+1)))r[i++]=s();else if(e!==64){if(Ee(e))r[i++]=l();else{if(!Oe(e))throw new L(`Unexpected character: ${t[a]}`,a,t.substring(Math.max(0,a-10),a));r[i++]=u()}}else r[i++]=c()}else r[i++]=o(e)}var d;return i===r.length?r:r.slice(0,i)})(e)),n=((e={},t={})=>({context:e,functions:t}))({},ve);return(e={})=>Pe(t,n,e)}function Ie(e,t={}){return Fe(e)(t)}function Le(e,t){if(typeof e!=`string`)return;let n=e.trim();if(n)try{return Fe(n),Ie(n,t)}catch{return}}function Re(e){return typeof e==`number`}function ze(e){if(!e)return[0,0,0];if(Re(e))return[e,e,e];if(Array.isArray(e)&&e.length===0)return[0,0,0];let[t,n=t,r=t]=e;return[t,n,r]}function Be(e){return Re(e)?!0:Array.isArray(e)?e.every(e=>Re(e)):!1}function B(e){return e==null}function Ve(e){return typeof e==`string`}function He(e){return typeof e==`function`}function Ue(e,t){if(typeof e==`function`)return e;if(typeof e==`string`){let n=e;return(...e)=>{let r={};for(let n=0;n<t.length;n++)r[t[n]]=e[n];return Le(n,r)}}return()=>e}function We(e,t,n=`node`){if(B(e))return()=>t;if(Ve(e)){let r=Ue(e,[n]);return e=>{let n=r(e);return Re(n)?n:t}}return He(e)?e:Re(e)?()=>e:()=>t}function Ge(e,t=10,n=`node`){if(B(e))return()=>t;if(Ve(e)){let r=Ue(e,[n]);return e=>{let n=r(e);return Be(n)?n:t}}return He(e)?e:Re(e)||Array.isArray(e)?()=>e:()=>t}function Ke(e){return[e.x,e.y,e.z??0]}var qe=class{constructor(e,t={}){this.edgeIdCounter=new Map,this.nodeMap=Xe(e.nodes,t.node),this.edgeMap=Ze(e.edges||[],t.edge,this.getEdgeId.bind(this))}data(){return{nodes:this.nodeMap,edges:this.edgeMap}}replace(e){this.nodeMap=e.nodes,this.edgeMap=e.edges,this.clearCache()}nodes(){return Array.from(this.nodeMap.values())}node(e){return this.nodeMap.get(e)}nodeAt(e){this.indexNodeCache||this.buildNodeIndexCache();let t=this.indexNodeCache.get(e);return t?this.nodeMap.get(t):void 0}nodeIndexOf(e){return this.nodeIndexCache||this.buildNodeIndexCache(),this.nodeIndexCache.get(e)??-1}firstNode(){return this.nodeMap.values().next().value}forEachNode(e){let t=0;this.nodeMap.forEach(n=>e(n,t++))}originalNode(e){return this.nodeMap.get(e)?._original}nodeCount(){return this.nodeMap.size}edges(){return Array.from(this.edgeMap.values())}edge(e){return this.edgeMap.get(e)}firstEdge(){return this.edgeMap.values().next().value}forEachEdge(e){let t=0;this.edgeMap.forEach(n=>e(n,t++))}originalEdge(e){return this.edgeMap.get(e)?._original}edgeCount(){return this.edgeMap.size}getEdgeId(e){if(e.id)return e.id;let t=`${e.source}-${e.target}`,n=this.edgeIdCounter.get(t)||0,r=n===0?t:`${t}-${n}`;return this.edgeIdCounter.set(t,n+1),r}degree(e,t=`both`){this.degreeCache||this.buildDegreeCache();let n=this.degreeCache.get(e);return n?n[t]:0}neighbors(e,t=`both`){if((!this.outAdjacencyCache||!this.inAdjacencyCache)&&this.buildAdjacencyCache(),t===`out`)return Array.from(this.outAdjacencyCache.get(e)||[]);if(t===`in`)return Array.from(this.inAdjacencyCache.get(e)||[]);if(this.bothAdjacencyCache)return Array.from(this.bothAdjacencyCache.get(e)||[]);let n=this.inAdjacencyCache.get(e),r=this.outAdjacencyCache.get(e);if(!n&&!r)return[];if(!n)return Array.from(r);if(!r)return Array.from(n);let i=new Set;return n.forEach(e=>i.add(e)),r.forEach(e=>i.add(e)),Array.from(i)}successors(e){return this.neighbors(e,`out`)}predecessors(e){return this.neighbors(e,`in`)}setNodeOrder(e){let t=new Map;for(let n of e)t.set(n.id,n);this.nodeMap=t,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}clearCache(){this.degreeCache=void 0,this.inAdjacencyCache=void 0,this.outAdjacencyCache=void 0,this.bothAdjacencyCache=void 0,this.nodeIndexCache=void 0,this.indexNodeCache=void 0}buildDegreeCache(){this.degreeCache=new Map;for(let e of this.edges()){let{source:t,target:n}=e;if(e.source===e.target)continue;this.degreeCache.has(t)||this.degreeCache.set(t,{in:0,out:0,both:0});let r=this.degreeCache.get(e.source);r&&(r.out++,r.both++),this.degreeCache.has(n)||this.degreeCache.set(n,{in:0,out:0,both:0});let i=this.degreeCache.get(e.target);i&&(i.in++,i.both++)}}buildAdjacencyCache(){this.inAdjacencyCache=new Map,this.outAdjacencyCache=new Map;for(let e of this.edges())!this.nodeMap.has(e.source)||!this.nodeMap.has(e.target)||(this.outAdjacencyCache.has(e.source)||this.outAdjacencyCache.set(e.source,new Set),this.outAdjacencyCache.get(e.source).add(e.target),this.inAdjacencyCache.has(e.target)||this.inAdjacencyCache.set(e.target,new Set),this.inAdjacencyCache.get(e.target).add(e.source))}buildNodeIndexCache(){this.nodeIndexCache=new Map,this.indexNodeCache=new Map;let e=0;this.nodeMap.forEach((t,n)=>{this.nodeIndexCache.set(n,e),this.indexNodeCache.set(e,n),e++})}destroy(){this.clearCache(),this.nodeMap.clear(),this.edgeMap.clear(),this.edgeIdCounter.clear()}},Je=[`id`,`x`,`y`,`z`,`vx`,`vy`,`vz`,`fx`,`fy`,`fz`,`parentId`],Ye=[`id`,`source`,`target`,`points`];function Xe(e,t){if(!e)throw Error(`Data.nodes is required`);let n=new Map;for(let r of e){let e={_original:r};for(let t of Je){let n=r[t];B(n)||(e[t]=n)}if(t){let n=t(r);for(let t in n){let r=n[t];B(r)||(e[t]=r)}}if(B(e.id))throw Error(`Node is missing id field`);n.set(e.id,e)}return n}function Ze(e,t,n){let r=new Map;for(let i of e){let e={_original:i};for(let t of Ye){let n=i[t];B(n)||(e[t]=n)}if(t){let n=t(i);for(let t in n){let r=n[t];B(r)||(e[t]=r)}}if(B(e.source)||B(e.target))throw Error(`Edge is missing source or target field`);B(e.id)&&(e.id=n?.(i)),r.set(e.id,e)}return r}var Qe=class{constructor(e,t={}){this.graph=new qe(e,t)}export(){return this.graph.data()}replace(e){this.graph.replace(e)}forEachNode(e){this.graph.forEachNode(e)}forEachEdge(e){this.graph.forEachEdge((t,n)=>{t.sourceNode=this.graph.node(t.source),t.targetNode=this.graph.node(t.target),e(t,n)})}destroy(){this.graph.destroy()}},$e=Symbol(`Comlink.proxy`),et=Symbol(`Comlink.endpoint`),tt=Symbol(`Comlink.releaseProxy`),nt=Symbol(`Comlink.finalizer`),rt=Symbol(`Comlink.thrown`),it=e=>typeof e==`object`&&!!e||typeof e==`function`,at=new Map([[`proxy`,{canHandle:e=>it(e)&&e[$e],serialize(e){let{port1:t,port2:n}=new MessageChannel;return st(e,t),[n,[n]]},deserialize(e){return e.start(),ut(e)}}],[`throw`,{canHandle:e=>it(e)&&rt in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function ot(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function st(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function r(i){if(!i||!i.data)return;if(!ot(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:a,type:o,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(wt),l;try{let t=s.slice(0,-1).reduce((e,t)=>e[t],e),n=s.reduce((e,t)=>e[t],e);switch(o){case`GET`:l=n;break;case`SET`:t[s.slice(-1)[0]]=wt(i.data.value),l=!0;break;case`APPLY`:l=n.apply(t,c);break;case`CONSTRUCT`:l=St(new n(...c));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;st(e,n),l=xt(t,[t])}break;case`RELEASE`:l=void 0;break;default:return}}catch(e){l={value:e,[rt]:0}}Promise.resolve(l).catch(e=>({value:e,[rt]:0})).then(n=>{let[i,s]=Ct(n);t.postMessage(Object.assign(Object.assign({},i),{id:a}),s),o===`RELEASE`&&(t.removeEventListener(`message`,r),lt(t),nt in e&&typeof e[nt]==`function`&&e[nt]())}).catch(e=>{let[n,r]=Ct({value:TypeError(`Unserializable return value`),[rt]:0});t.postMessage(Object.assign(Object.assign({},n),{id:a}),r)})}),t.start&&t.start()}function ct(e){return e.constructor.name===`MessagePort`}function lt(e){ct(e)&&e.close()}function ut(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),_t(e,n,[],t)}function dt(e){if(e)throw Error(`Proxy has been released and is not useable`)}function ft(e){return Tt(e,new Map,{type:`RELEASE`}).then(()=>{lt(e)})}var pt=new WeakMap,mt=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(pt.get(e)||0)-1;pt.set(e,t),t===0&&ft(e)});function ht(e,t){let n=(pt.get(t)||0)+1;pt.set(t,n),mt&&mt.register(e,t,e)}function gt(e){mt&&mt.unregister(e)}function _t(e,t,n=[],r=function(){}){let i=!1,a=new Proxy(r,{get(r,o){if(dt(i),o===tt)return()=>{gt(a),ft(e),t.clear(),i=!0};if(o===`then`){if(n.length===0)return{then:()=>a};let r=Tt(e,t,{type:`GET`,path:n.map(e=>e.toString())}).then(wt);return r.then.bind(r)}return _t(e,t,[...n,o])},set(r,a,o){dt(i);let[s,c]=Ct(o);return Tt(e,t,{type:`SET`,path:[...n,a].map(e=>e.toString()),value:s},c).then(wt)},apply(r,a,o){dt(i);let s=n[n.length-1];if(s===et)return Tt(e,t,{type:`ENDPOINT`}).then(wt);if(s===`bind`)return _t(e,t,n.slice(0,-1));let[c,l]=yt(o);return Tt(e,t,{type:`APPLY`,path:n.map(e=>e.toString()),argumentList:c},l).then(wt)},construct(r,a){dt(i);let[o,s]=yt(a);return Tt(e,t,{type:`CONSTRUCT`,path:n.map(e=>e.toString()),argumentList:o},s).then(wt)}});return ht(a,e),a}function vt(e){return Array.prototype.concat.apply([],e)}function yt(e){let t=e.map(Ct);return[t.map(e=>e[0]),vt(t.map(e=>e[1]))]}var bt=new WeakMap;function xt(e,t){return bt.set(e,t),e}function St(e){return Object.assign(e,{[$e]:!0})}function Ct(e){for(let[t,n]of at)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},bt.get(e)||[]]}function wt(e){switch(e.type){case`HANDLER`:return at.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function Tt(e,t,n,r){return new Promise(i=>{let a=Et();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function Et(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}var Dt=class{constructor(){this.worker=null,this.workerApi=null}execute(e,t,n){return _e(this,void 0,void 0,function*(){if(this.worker||(yield this.initWorker()),!this.workerApi)throw Error(`Worker API not initialized`);return yield this.workerApi.execute(e,t,n)})}destroy(){this.workerApi&&this.workerApi.destroy(),this.worker&&(this.worker.terminate(),this.worker=null,this.workerApi=null)}initWorker(){return _e(this,void 0,void 0,function*(){let e=this.resolveWorkerPath(),t=e.includes(`/lib/`)||e.endsWith(`.mjs`)?`module`:`classic`;this.worker=new Worker(e,{type:t}),this.workerApi=ut(this.worker)})}resolveWorkerPath(){let e=(()=>{if(typeof document>`u`)return null;let e=document.currentScript;if(e?.src)return e.src;let t=document.getElementsByTagName(`script`);for(let e=t.length-1;e>=0;e--){let n=t[e].src;if(n&&(n.includes(`index.js`)||n.includes(`index.min.js`)))return n}return null})();if(e){if(e.includes(`index.js`)||e.includes(`index.min.js`)){let t=e.replace(/index(\.min)?\.(m?js)(\?.*)?$/,`worker.js`);if(t!==e)return t}let t=e.replace(/\/runtime\/[^/]+\.(m?js)(\?.*)?$/,`/worker.js`);if(t!==e)return t;let n=e.replace(/\/[^/]+\.(m?js)(\?.*)?$/,`/worker.js`);if(n!==e)return n}return`./worker.js`}},Ot=class{constructor(e){this.supervisor=null,this.initialOptions=this.mergeOptions(this.getDefaultOptions(),e)}get options(){return this.runtimeOptions||this.initialOptions}mergeOptions(e,t){return Object.assign({},e,t||{})}execute(e,t){return _e(this,void 0,void 0,function*(){this.runtimeOptions=this.mergeOptions(this.initialOptions,t);let{node:n,edge:r,enableWorker:i}=this.runtimeOptions;this.context=new Qe(e,{node:n,edge:r}),this.model=this.context.graph,i&&typeof Worker<`u`?yield this.layoutInWorker(e,this.runtimeOptions):yield this.layout(this.runtimeOptions)})}layoutInWorker(e,t){var n;return _e(this,void 0,void 0,function*(){try{this.supervisor||=new Dt;let r=yield this.supervisor.execute(this.id,e,t);(n=this.context)==null||n.replace(r)}catch(e){console.error(`Layout in worker failed, fallback to main thread layout.`,e),yield this.layout(t)}})}forEachNode(e){this.context.forEachNode(e)}forEachEdge(e){this.context.forEachEdge(e)}destroy(){var e;(e=this.context)==null||e.destroy(),this.model=null,this.context=null,this.supervisor&&=(this.supervisor.destroy(),null)}};function kt(e){return Array.isArray(e)}var At=(function(e){var t=typeof e;return e!==null&&t===`object`||t===`function`}),jt=function(e){return typeof e==`object`&&!!e},Mt={}.toString,Nt=function(e,t){return Mt.call(e)===`[object `+t+`]`},Pt=function(e){if(!jt(e)||!Nt(e,`Object`))return!1;if(Object.getPrototypeOf(e)===null)return!0;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},Ft=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function It(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Lt(e){throw Error(`Could not dynamically require "`+e+`". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.`)}var Rt,zt;function Bt(){if(zt)return Rt;zt=1;function e(){this.__data__=[],this.size=0}return Rt=e,Rt}var Vt,Ht;function Ut(){if(Ht)return Vt;Ht=1;function e(e,t){return e===t||e!==e&&t!==t}return Vt=e,Vt}var Wt,Gt;function Kt(){if(Gt)return Wt;Gt=1;var e=Ut();function t(t,n){for(var r=t.length;r--;)if(e(t[r][0],n))return r;return-1}return Wt=t,Wt}var qt,Jt;function Yt(){if(Jt)return qt;Jt=1;var e=Kt(),t=Array.prototype.splice;function n(n){var r=this.__data__,i=e(r,n);return i<0?!1:(i==r.length-1?r.pop():t.call(r,i,1),--this.size,!0)}return qt=n,qt}var Xt,Zt;function Qt(){if(Zt)return Xt;Zt=1;var e=Kt();function t(t){var n=this.__data__,r=e(n,t);return r<0?void 0:n[r][1]}return Xt=t,Xt}var $t,en;function tn(){if(en)return $t;en=1;var e=Kt();function t(t){return e(this.__data__,t)>-1}return $t=t,$t}var nn,rn;function an(){if(rn)return nn;rn=1;var e=Kt();function t(t,n){var r=this.__data__,i=e(r,t);return i<0?(++this.size,r.push([t,n])):r[i][1]=n,this}return nn=t,nn}var on,sn;function cn(){if(sn)return on;sn=1;var e=Bt(),t=Yt(),n=Qt(),r=tn(),i=an();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,on=a,on}var ln,un;function dn(){if(un)return ln;un=1;var e=cn();function t(){this.__data__=new e,this.size=0}return ln=t,ln}var fn,pn;function mn(){if(pn)return fn;pn=1;function e(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}return fn=e,fn}var hn,gn;function _n(){if(gn)return hn;gn=1;function e(e){return this.__data__.get(e)}return hn=e,hn}var vn,yn;function bn(){if(yn)return vn;yn=1;function e(e){return this.__data__.has(e)}return vn=e,vn}var xn,Sn;function Cn(){return Sn?xn:(Sn=1,xn=typeof Ft==`object`&&Ft&&Ft.Object===Object&&Ft,xn)}var wn,Tn;function V(){if(Tn)return wn;Tn=1;var e=Cn(),t=typeof self==`object`&&self&&self.Object===Object&&self;return wn=e||t||Function(`return this`)(),wn}var En,Dn;function On(){return Dn?En:(Dn=1,En=V().Symbol,En)}var kn,An;function jn(){if(An)return kn;An=1;var e=On(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(e){var t=n.call(e,i),a=e[i];try{e[i]=void 0;var o=!0}catch{}var s=r.call(e);return o&&(t?e[i]=a:delete e[i]),s}return kn=a,kn}var Mn,Nn;function Pn(){if(Nn)return Mn;Nn=1;var e=Object.prototype.toString;function t(t){return e.call(t)}return Mn=t,Mn}var Fn,In;function Ln(){if(In)return Fn;In=1;var e=On(),t=jn(),n=Pn(),r=`[object Null]`,i=`[object Undefined]`,a=e?e.toStringTag:void 0;function o(e){return e==null?e===void 0?i:r:a&&a in Object(e)?t(e):n(e)}return Fn=o,Fn}var Rn,zn;function H(){if(zn)return Rn;zn=1;function e(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}return Rn=e,Rn}var Bn,Vn;function Hn(){if(Vn)return Bn;Vn=1;var e=Ln(),t=H(),n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Proxy]`;function o(o){if(!t(o))return!1;var s=e(o);return s==r||s==i||s==n||s==a}return Bn=o,Bn}var Un,Wn;function Gn(){return Wn?Un:(Wn=1,Un=V()[`__core-js_shared__`],Un)}var Kn,qn;function Jn(){if(qn)return Kn;qn=1;var e=Gn(),t=function(){var t=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||``);return t?`Symbol(src)_1.`+t:``}();function n(e){return!!t&&t in e}return Kn=n,Kn}var Yn,Xn;function Zn(){if(Xn)return Yn;Xn=1;var e=Function.prototype.toString;function t(t){if(t!=null){try{return e.call(t)}catch{}try{return t+``}catch{}}return``}return Yn=t,Yn}var Qn,$n;function er(){if($n)return Qn;$n=1;var e=Hn(),t=Jn(),n=H(),r=Zn(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=RegExp(`^`+c.call(l).replace(i,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function d(i){return!n(i)||t(i)?!1:(e(i)?u:a).test(r(i))}return Qn=d,Qn}var tr,nr;function rr(){if(nr)return tr;nr=1;function e(e,t){return e?.[t]}return tr=e,tr}var ir,ar;function U(){if(ar)return ir;ar=1;var e=er(),t=rr();function n(n,r){var i=t(n,r);return e(i)?i:void 0}return ir=n,ir}var or,sr;function cr(){return sr?or:(sr=1,or=U()(V(),`Map`),or)}var lr,ur;function dr(){return ur?lr:(ur=1,lr=U()(Object,`create`),lr)}var fr,pr;function mr(){if(pr)return fr;pr=1;var e=dr();function t(){this.__data__=e?e(null):{},this.size=0}return fr=t,fr}var hr,gr;function _r(){if(gr)return hr;gr=1;function e(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}return hr=e,hr}var vr,yr;function br(){if(yr)return vr;yr=1;var e=dr(),t=`__lodash_hash_undefined__`,n=Object.prototype.hasOwnProperty;function r(r){var i=this.__data__;if(e){var a=i[r];return a===t?void 0:a}return n.call(i,r)?i[r]:void 0}return vr=r,vr}var xr,Sr;function Cr(){if(Sr)return xr;Sr=1;var e=dr(),t=Object.prototype.hasOwnProperty;function n(n){var r=this.__data__;return e?r[n]!==void 0:t.call(r,n)}return xr=n,xr}var wr,Tr;function Er(){if(Tr)return wr;Tr=1;var e=dr(),t=`__lodash_hash_undefined__`;function n(n,r){var i=this.__data__;return this.size+=+!this.has(n),i[n]=e&&r===void 0?t:r,this}return wr=n,wr}var Dr,Or;function kr(){if(Or)return Dr;Or=1;var e=mr(),t=_r(),n=br(),r=Cr(),i=Er();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Dr=a,Dr}var Ar,jr;function Mr(){if(jr)return Ar;jr=1;var e=kr(),t=cn(),n=cr();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Ar=r,Ar}var Nr,Pr;function Fr(){if(Pr)return Nr;Pr=1;function e(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}return Nr=e,Nr}var Ir,Lr;function Rr(){if(Lr)return Ir;Lr=1;var e=Fr();function t(t,n){var r=t.__data__;return e(n)?r[typeof n==`string`?`string`:`hash`]:r.map}return Ir=t,Ir}var zr,Br;function Vr(){if(Br)return zr;Br=1;var e=Rr();function t(t){var n=e(this,t).delete(t);return this.size-=+!!n,n}return zr=t,zr}var Hr,Ur;function Wr(){if(Ur)return Hr;Ur=1;var e=Rr();function t(t){return e(this,t).get(t)}return Hr=t,Hr}var Gr,Kr;function qr(){if(Kr)return Gr;Kr=1;var e=Rr();function t(t){return e(this,t).has(t)}return Gr=t,Gr}var Jr,Yr;function Xr(){if(Yr)return Jr;Yr=1;var e=Rr();function t(t,n){var r=e(this,t),i=r.size;return r.set(t,n),this.size+=r.size==i?0:1,this}return Jr=t,Jr}var Zr,Qr;function $r(){if(Qr)return Zr;Qr=1;var e=Mr(),t=Vr(),n=Wr(),r=qr(),i=Xr();function a(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Zr=a,Zr}var ei,ti;function ni(){if(ti)return ei;ti=1;var e=cn(),t=cr(),n=$r(),r=200;function i(i,a){var o=this.__data__;if(o instanceof e){var s=o.__data__;if(!t||s.length<r-1)return s.push([i,a]),this.size=++o.size,this;o=this.__data__=new n(s)}return o.set(i,a),this.size=o.size,this}return ei=i,ei}var ri,ii;function ai(){if(ii)return ri;ii=1;var e=cn(),t=dn(),n=mn(),r=_n(),i=bn(),a=ni();function o(t){var n=this.__data__=new e(t);this.size=n.size}return o.prototype.clear=t,o.prototype.delete=n,o.prototype.get=r,o.prototype.has=i,o.prototype.set=a,ri=o,ri}var oi,si;function ci(){if(si)return oi;si=1;function e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r&&t(e[n],n,e)!==!1;);return e}return oi=e,oi}var li,ui;function di(){if(ui)return li;ui=1;var e=U();return li=function(){try{var t=e(Object,`defineProperty`);return t({},``,{}),t}catch{}}(),li}var fi,pi;function mi(){if(pi)return fi;pi=1;var e=di();function t(t,n,r){n==`__proto__`&&e?e(t,n,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[n]=r}return fi=t,fi}var hi,gi;function _i(){if(gi)return hi;gi=1;var e=mi(),t=Ut(),n=Object.prototype.hasOwnProperty;function r(r,i,a){var o=r[i];(!(n.call(r,i)&&t(o,a))||a===void 0&&!(i in r))&&e(r,i,a)}return hi=r,hi}var vi,yi;function bi(){if(yi)return vi;yi=1;var e=_i(),t=mi();function n(n,r,i,a){var o=!i;i||={};for(var s=-1,c=r.length;++s<c;){var l=r[s],u=a?a(i[l],n[l],l,i,n):void 0;u===void 0&&(u=n[l]),o?t(i,l,u):e(i,l,u)}return i}return vi=n,vi}var xi,Si;function Ci(){if(Si)return xi;Si=1;function e(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}return xi=e,xi}var wi,Ti;function W(){if(Ti)return wi;Ti=1;function e(e){return typeof e==`object`&&!!e}return wi=e,wi}var Ei,Di;function Oi(){if(Di)return Ei;Di=1;var e=Ln(),t=W(),n=`[object Arguments]`;function r(r){return t(r)&&e(r)==n}return Ei=r,Ei}var ki,Ai;function ji(){if(Ai)return ki;Ai=1;var e=Oi(),t=W(),n=Object.prototype,r=n.hasOwnProperty,i=n.propertyIsEnumerable;return ki=e(function(){return arguments}())?e:function(e){return t(e)&&r.call(e,`callee`)&&!i.call(e,`callee`)},ki}var Mi,Ni;function G(){return Ni?Mi:(Ni=1,Mi=Array.isArray,Mi)}var Pi={exports:{}},Fi,Ii;function Li(){if(Ii)return Fi;Ii=1;function e(){return!1}return Fi=e,Fi}Pi.exports;var Ri;function zi(){return Ri?Pi.exports:(Ri=1,(function(e,t){var n=V(),r=Li(),i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i?n.Buffer:void 0;e.exports=(o?o.isBuffer:void 0)||r})(Pi,Pi.exports),Pi.exports)}var Bi,Vi;function Hi(){if(Vi)return Bi;Vi=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(n,r){var i=typeof n;return r??=e,!!r&&(i==`number`||i!=`symbol`&&t.test(n))&&n>-1&&n%1==0&&n<r}return Bi=n,Bi}var Ui,Wi;function Gi(){if(Wi)return Ui;Wi=1;var e=9007199254740991;function t(t){return typeof t==`number`&&t>-1&&t%1==0&&t<=e}return Ui=t,Ui}var Ki,qi;function Ji(){if(qi)return Ki;qi=1;var e=Ln(),t=Gi(),n=W(),r=`[object Arguments]`,i=`[object Array]`,a=`[object Boolean]`,o=`[object Date]`,s=`[object Error]`,c=`[object Function]`,l=`[object Map]`,u=`[object Number]`,d=`[object Object]`,f=`[object RegExp]`,p=`[object Set]`,m=`[object String]`,h=`[object WeakMap]`,g=`[object ArrayBuffer]`,_=`[object DataView]`,v=`[object Float32Array]`,y=`[object Float64Array]`,b=`[object Int8Array]`,x=`[object Int16Array]`,S=`[object Int32Array]`,C=`[object Uint8Array]`,w=`[object Uint8ClampedArray]`,T=`[object Uint16Array]`,E=`[object Uint32Array]`,D={};D[v]=D[y]=D[b]=D[x]=D[S]=D[C]=D[w]=D[T]=D[E]=!0,D[r]=D[i]=D[g]=D[a]=D[_]=D[o]=D[s]=D[c]=D[l]=D[u]=D[d]=D[f]=D[p]=D[m]=D[h]=!1;function O(r){return n(r)&&t(r.length)&&!!D[e(r)]}return Ki=O,Ki}var Yi,Xi;function Zi(){if(Xi)return Yi;Xi=1;function e(e){return function(t){return e(t)}}return Yi=e,Yi}var Qi={exports:{}};Qi.exports;var $i;function ea(){return $i?Qi.exports:($i=1,(function(e,t){var n=Cn(),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r&&n.process;e.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})(Qi,Qi.exports),Qi.exports)}var ta,na;function ra(){if(na)return ta;na=1;var e=Ji(),t=Zi(),n=ea(),r=n&&n.isTypedArray;return ta=r?t(r):e,ta}var ia,aa;function oa(){if(aa)return ia;aa=1;var e=Ci(),t=ji(),n=G(),r=zi(),i=Hi(),a=ra(),o=Object.prototype.hasOwnProperty;function s(s,c){var l=n(s),u=!l&&t(s),d=!l&&!u&&r(s),f=!l&&!u&&!d&&a(s),p=l||u||d||f,m=p?e(s.length,String):[],h=m.length;for(var g in s)(c||o.call(s,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||i(g,h)))&&m.push(g);return m}return ia=s,ia}var sa,ca;function la(){if(ca)return sa;ca=1;var e=Object.prototype;function t(t){var n=t&&t.constructor;return t===(typeof n==`function`&&n.prototype||e)}return sa=t,sa}var ua,da;function fa(){if(da)return ua;da=1;function e(e,t){return function(n){return e(t(n))}}return ua=e,ua}var pa,ma;function ha(){return ma?pa:(ma=1,pa=fa()(Object.keys,Object),pa)}var ga,_a;function va(){if(_a)return ga;_a=1;var e=la(),t=ha(),n=Object.prototype.hasOwnProperty;function r(r){if(!e(r))return t(r);var i=[];for(var a in Object(r))n.call(r,a)&&a!=`constructor`&&i.push(a);return i}return ga=r,ga}var ya,ba;function K(){if(ba)return ya;ba=1;var e=Hn(),t=Gi();function n(n){return n!=null&&t(n.length)&&!e(n)}return ya=n,ya}var xa,Sa;function q(){if(Sa)return xa;Sa=1;var e=oa(),t=va(),n=K();function r(r){return n(r)?e(r):t(r)}return xa=r,xa}var Ca,wa;function Ta(){if(wa)return Ca;wa=1;var e=bi(),t=q();function n(n,r){return n&&e(r,t(r),n)}return Ca=n,Ca}var Ea,Da;function Oa(){if(Da)return Ea;Da=1;function e(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}return Ea=e,Ea}var ka,Aa;function ja(){if(Aa)return ka;Aa=1;var e=H(),t=la(),n=Oa(),r=Object.prototype.hasOwnProperty;function i(i){if(!e(i))return n(i);var a=t(i),o=[];for(var s in i)s==`constructor`&&(a||!r.call(i,s))||o.push(s);return o}return ka=i,ka}var Ma,Na;function J(){if(Na)return Ma;Na=1;var e=oa(),t=ja(),n=K();function r(r){return n(r)?e(r,!0):t(r)}return Ma=r,Ma}var Pa,Fa;function Ia(){if(Fa)return Pa;Fa=1;var e=bi(),t=J();function n(n,r){return n&&e(r,t(r),n)}return Pa=n,Pa}var La={exports:{}};La.exports;var Ra;function za(){return Ra?La.exports:(Ra=1,(function(e,t){var n=V(),r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r?n.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(e,t){if(t)return e.slice();var n=e.length,r=o?o(n):new e.constructor(n);return e.copy(r),r}e.exports=s})(La,La.exports),La.exports)}var Ba,Va;function Ha(){if(Va)return Ba;Va=1;function e(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}return Ba=e,Ba}var Ua,Wa;function Ga(){if(Wa)return Ua;Wa=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}return Ua=e,Ua}var Ka,qa;function Ja(){if(qa)return Ka;qa=1;function e(){return[]}return Ka=e,Ka}var Ya,Xa;function Za(){if(Xa)return Ya;Xa=1;var e=Ga(),t=Ja(),n=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Ya=r?function(t){return t==null?[]:(t=Object(t),e(r(t),function(e){return n.call(t,e)}))}:t,Ya}var Qa,$a;function eo(){if($a)return Qa;$a=1;var e=bi(),t=Za();function n(n,r){return e(n,t(n),r)}return Qa=n,Qa}var to,no;function ro(){if(no)return to;no=1;function e(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}return to=e,to}var io,ao;function oo(){return ao?io:(ao=1,io=fa()(Object.getPrototypeOf,Object),io)}var so,co;function lo(){if(co)return so;co=1;var e=ro(),t=oo(),n=Za(),r=Ja();return so=Object.getOwnPropertySymbols?function(r){for(var i=[];r;)e(i,n(r)),r=t(r);return i}:r,so}var uo,fo;function po(){if(fo)return uo;fo=1;var e=bi(),t=lo();function n(n,r){return e(n,t(n),r)}return uo=n,uo}var mo,ho;function go(){if(ho)return mo;ho=1;var e=ro(),t=G();function n(n,r,i){var a=r(n);return t(n)?a:e(a,i(n))}return mo=n,mo}var _o,vo;function yo(){if(vo)return _o;vo=1;var e=go(),t=Za(),n=q();function r(r){return e(r,n,t)}return _o=r,_o}var bo,xo;function So(){if(xo)return bo;xo=1;var e=go(),t=lo(),n=J();function r(r){return e(r,n,t)}return bo=r,bo}var Co,wo;function To(){return wo?Co:(wo=1,Co=U()(V(),`DataView`),Co)}var Eo,Do;function Oo(){return Do?Eo:(Do=1,Eo=U()(V(),`Promise`),Eo)}var ko,Ao;function jo(){return Ao?ko:(Ao=1,ko=U()(V(),`Set`),ko)}var Mo,No;function Po(){return No?Mo:(No=1,Mo=U()(V(),`WeakMap`),Mo)}var Fo,Io;function Lo(){if(Io)return Fo;Io=1;var e=To(),t=cr(),n=Oo(),r=jo(),i=Po(),a=Ln(),o=Zn(),s=`[object Map]`,c=`[object Object]`,l=`[object Promise]`,u=`[object Set]`,d=`[object WeakMap]`,f=`[object DataView]`,p=o(e),m=o(t),h=o(n),g=o(r),_=o(i),v=a;return(e&&v(new e(new ArrayBuffer(1)))!=f||t&&v(new t)!=s||n&&v(n.resolve())!=l||r&&v(new r)!=u||i&&v(new i)!=d)&&(v=function(e){var t=a(e),n=t==c?e.constructor:void 0,r=n?o(n):``;if(r)switch(r){case p:return f;case m:return s;case h:return l;case g:return u;case _:return d}return t}),Fo=v,Fo}var Ro,zo;function Bo(){if(zo)return Ro;zo=1;var e=Object.prototype.hasOwnProperty;function t(t){var n=t.length,r=new t.constructor(n);return n&&typeof t[0]==`string`&&e.call(t,`index`)&&(r.index=t.index,r.input=t.input),r}return Ro=t,Ro}var Vo,Ho;function Uo(){return Ho?Vo:(Ho=1,Vo=V().Uint8Array,Vo)}var Wo,Go;function Ko(){if(Go)return Wo;Go=1;var e=Uo();function t(t){var n=new t.constructor(t.byteLength);return new e(n).set(new e(t)),n}return Wo=t,Wo}var qo,Jo;function Yo(){if(Jo)return qo;Jo=1;var e=Ko();function t(t,n){var r=n?e(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}return qo=t,qo}var Xo,Zo;function Qo(){if(Zo)return Xo;Zo=1;var e=/\w*$/;function t(t){var n=new t.constructor(t.source,e.exec(t));return n.lastIndex=t.lastIndex,n}return Xo=t,Xo}var $o,es;function ts(){if(es)return $o;es=1;var e=On(),t=e?e.prototype:void 0,n=t?t.valueOf:void 0;function r(e){return n?Object(n.call(e)):{}}return $o=r,$o}var ns,rs;function is(){if(rs)return ns;rs=1;var e=Ko();function t(t,n){var r=n?e(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}return ns=t,ns}var as,os;function ss(){if(os)return as;os=1;var e=Ko(),t=Yo(),n=Qo(),r=ts(),i=is(),a=`[object Boolean]`,o=`[object Date]`,s=`[object Map]`,c=`[object Number]`,l=`[object RegExp]`,u=`[object Set]`,d=`[object String]`,f=`[object Symbol]`,p=`[object ArrayBuffer]`,m=`[object DataView]`,h=`[object Float32Array]`,g=`[object Float64Array]`,_=`[object Int8Array]`,v=`[object Int16Array]`,y=`[object Int32Array]`,b=`[object Uint8Array]`,x=`[object Uint8ClampedArray]`,S=`[object Uint16Array]`,C=`[object Uint32Array]`;function w(w,T,E){var D=w.constructor;switch(T){case p:return e(w);case a:case o:return new D(+w);case m:return t(w,E);case h:case g:case _:case v:case y:case b:case x:case S:case C:return i(w,E);case s:return new D;case c:case d:return new D(w);case l:return n(w);case u:return new D;case f:return r(w)}}return as=w,as}var cs,ls;function us(){if(ls)return cs;ls=1;var e=H(),t=Object.create;return cs=function(){function n(){}return function(r){if(!e(r))return{};if(t)return t(r);n.prototype=r;var i=new n;return n.prototype=void 0,i}}(),cs}var ds,fs;function ps(){if(fs)return ds;fs=1;var e=us(),t=oo(),n=la();function r(r){return typeof r.constructor==`function`&&!n(r)?e(t(r)):{}}return ds=r,ds}var ms,hs;function gs(){if(hs)return ms;hs=1;var e=Lo(),t=W(),n=`[object Map]`;function r(r){return t(r)&&e(r)==n}return ms=r,ms}var _s,vs;function ys(){if(vs)return _s;vs=1;var e=gs(),t=Zi(),n=ea(),r=n&&n.isMap;return _s=r?t(r):e,_s}var bs,xs;function Ss(){if(xs)return bs;xs=1;var e=Lo(),t=W(),n=`[object Set]`;function r(r){return t(r)&&e(r)==n}return bs=r,bs}var Cs,ws;function Ts(){if(ws)return Cs;ws=1;var e=Ss(),t=Zi(),n=ea(),r=n&&n.isSet;return Cs=r?t(r):e,Cs}var Es,Ds;function Os(){if(Ds)return Es;Ds=1;var e=ai(),t=ci(),n=_i(),r=Ta(),i=Ia(),a=za(),o=Ha(),s=eo(),c=po(),l=yo(),u=So(),d=Lo(),f=Bo(),p=ss(),m=ps(),h=G(),g=zi(),_=ys(),v=H(),y=Ts(),b=q(),x=J(),S=1,C=2,w=4,T=`[object Arguments]`,E=`[object Array]`,D=`[object Boolean]`,O=`[object Date]`,k=`[object Error]`,ee=`[object Function]`,te=`[object GeneratorFunction]`,ne=`[object Map]`,A=`[object Number]`,re=`[object Object]`,j=`[object RegExp]`,M=`[object Set]`,N=`[object String]`,ie=`[object Symbol]`,P=`[object WeakMap]`,F=`[object ArrayBuffer]`,ae=`[object DataView]`,oe=`[object Float32Array]`,se=`[object Float64Array]`,ce=`[object Int8Array]`,le=`[object Int16Array]`,ue=`[object Int32Array]`,de=`[object Uint8Array]`,fe=`[object Uint8ClampedArray]`,pe=`[object Uint16Array]`,me=`[object Uint32Array]`,I={};I[T]=I[E]=I[F]=I[ae]=I[D]=I[O]=I[oe]=I[se]=I[ce]=I[le]=I[ue]=I[ne]=I[A]=I[re]=I[j]=I[M]=I[N]=I[ie]=I[de]=I[fe]=I[pe]=I[me]=!0,I[k]=I[ee]=I[P]=!1;function he(E,D,O,k,ne,A){var j,M=D&S,N=D&C,ie=D&w;if(O&&(j=ne?O(E,k,ne,A):O(E)),j!==void 0)return j;if(!v(E))return E;var P=h(E);if(P){if(j=f(E),!M)return o(E,j)}else{var F=d(E),ae=F==ee||F==te;if(g(E))return a(E,M);if(F==re||F==T||ae&&!ne){if(j=N||ae?{}:m(E),!M)return N?c(E,i(j,E)):s(E,r(j,E))}else{if(!I[F])return ne?E:{};j=p(E,F,M)}}A||=new e;var oe=A.get(E);if(oe)return oe;A.set(E,j),y(E)?E.forEach(function(e){j.add(he(e,D,O,e,E,A))}):_(E)&&E.forEach(function(e,t){j.set(t,he(e,D,O,t,E,A))});var se=P?void 0:(ie?N?u:l:N?x:b)(E);return t(se||E,function(e,t){se&&(t=e,e=E[t]),n(j,t,he(e,D,O,t,E,A))}),j}return Es=he,Es}var ks,As;function js(){if(As)return ks;As=1;var e=Os(),t=4;function n(n){return e(n,t)}return ks=n,ks}var Ms,Ns;function Ps(){if(Ns)return Ms;Ns=1;function e(e){return function(){return e}}return Ms=e,Ms}var Fs,Is;function Ls(){if(Is)return Fs;Is=1;function e(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}return Fs=e,Fs}var Rs,zs;function Bs(){return zs?Rs:(zs=1,Rs=Ls()(),Rs)}var Vs,Hs;function Us(){if(Hs)return Vs;Hs=1;var e=Bs(),t=q();function n(n,r){return n&&e(n,r,t)}return Vs=n,Vs}var Ws,Gs;function Ks(){if(Gs)return Ws;Gs=1;var e=K();function t(t,n){return function(r,i){if(r==null)return r;if(!e(r))return t(r,i);for(var a=r.length,o=n?a:-1,s=Object(r);(n?o--:++o<a)&&i(s[o],o,s)!==!1;);return r}}return Ws=t,Ws}var qs,Js;function Ys(){if(Js)return qs;Js=1;var e=Us();return qs=Ks()(e),qs}var Xs,Zs;function Qs(){if(Zs)return Xs;Zs=1;function e(e){return e}return Xs=e,Xs}var $s,ec;function tc(){if(ec)return $s;ec=1;var e=Qs();function t(t){return typeof t==`function`?t:e}return $s=t,$s}var nc,rc;function ic(){if(rc)return nc;rc=1;var e=ci(),t=Ys(),n=tc(),r=G();function i(i,a){return(r(i)?e:t)(i,n(a))}return nc=i,nc}var ac,oc;function sc(){return oc?ac:(oc=1,ac=ic(),ac)}var cc,lc;function uc(){if(lc)return cc;lc=1;var e=Ys();function t(t,n){var r=[];return e(t,function(e,t,i){n(e,t,i)&&r.push(e)}),r}return cc=t,cc}var dc,fc;function pc(){if(fc)return dc;fc=1;var e=`__lodash_hash_undefined__`;function t(t){return this.__data__.set(t,e),this}return dc=t,dc}var mc,hc;function gc(){if(hc)return mc;hc=1;function e(e){return this.__data__.has(e)}return mc=e,mc}var _c,vc;function yc(){if(vc)return _c;vc=1;var e=$r(),t=pc(),n=gc();function r(t){var n=-1,r=t==null?0:t.length;for(this.__data__=new e;++n<r;)this.add(t[n])}return r.prototype.add=r.prototype.push=t,r.prototype.has=n,_c=r,_c}var bc,xc;function Sc(){if(xc)return bc;xc=1;function e(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}return bc=e,bc}var Cc,wc;function Tc(){if(wc)return Cc;wc=1;function e(e,t){return e.has(t)}return Cc=e,Cc}var Ec,Dc;function Oc(){if(Dc)return Ec;Dc=1;var e=yc(),t=Sc(),n=Tc(),r=1,i=2;function a(a,o,s,c,l,u){var d=s&r,f=a.length,p=o.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(a),h=u.get(o);if(m&&h)return m==o&&h==a;var g=-1,_=!0,v=s&i?new e:void 0;for(u.set(a,o),u.set(o,a);++g<f;){var y=a[g],b=o[g];if(c)var x=d?c(b,y,g,o,a,u):c(y,b,g,a,o,u);if(x!==void 0){if(x)continue;_=!1;break}if(v){if(!t(o,function(e,t){if(!n(v,t)&&(y===e||l(y,e,s,c,u)))return v.push(t)})){_=!1;break}}else if(!(y===b||l(y,b,s,c,u))){_=!1;break}}return u.delete(a),u.delete(o),_}return Ec=a,Ec}var kc,Ac;function jc(){if(Ac)return kc;Ac=1;function e(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}return kc=e,kc}var Mc,Nc;function Pc(){if(Nc)return Mc;Nc=1;function e(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}return Mc=e,Mc}var Fc,Ic;function Lc(){if(Ic)return Fc;Ic=1;var e=On(),t=Uo(),n=Ut(),r=Oc(),i=jc(),a=Pc(),o=1,s=2,c=`[object Boolean]`,l=`[object Date]`,u=`[object Error]`,d=`[object Map]`,f=`[object Number]`,p=`[object RegExp]`,m=`[object Set]`,h=`[object String]`,g=`[object Symbol]`,_=`[object ArrayBuffer]`,v=`[object DataView]`,y=e?e.prototype:void 0,b=y?y.valueOf:void 0;function x(e,y,x,S,C,w,T){switch(x){case v:if(e.byteLength!=y.byteLength||e.byteOffset!=y.byteOffset)return!1;e=e.buffer,y=y.buffer;case _:return!(e.byteLength!=y.byteLength||!w(new t(e),new t(y)));case c:case l:case f:return n(+e,+y);case u:return e.name==y.name&&e.message==y.message;case p:case h:return e==y+``;case d:var E=i;case m:var D=S&o;if(E||=a,e.size!=y.size&&!D)return!1;var O=T.get(e);if(O)return O==y;S|=s,T.set(e,y);var k=r(E(e),E(y),S,C,w,T);return T.delete(e),k;case g:if(b)return b.call(e)==b.call(y)}return!1}return Fc=x,Fc}var Rc,zc;function Bc(){if(zc)return Rc;zc=1;var e=yo(),t=1,n=Object.prototype.hasOwnProperty;function r(r,i,a,o,s,c){var l=a&t,u=e(r),d=u.length;if(d!=e(i).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in i:n.call(i,p)))return!1}var m=c.get(r),h=c.get(i);if(m&&h)return m==i&&h==r;var g=!0;c.set(r,i),c.set(i,r);for(var _=l;++f<d;){p=u[f];var v=r[p],y=i[p];if(o)var b=l?o(y,v,p,i,r,c):o(v,y,p,r,i,c);if(!(b===void 0?v===y||s(v,y,a,o,c):b)){g=!1;break}_||=p==`constructor`}if(g&&!_){var x=r.constructor,S=i.constructor;x!=S&&`constructor`in r&&`constructor`in i&&!(typeof x==`function`&&x instanceof x&&typeof S==`function`&&S instanceof S)&&(g=!1)}return c.delete(r),c.delete(i),g}return Rc=r,Rc}var Vc,Hc;function Uc(){if(Hc)return Vc;Hc=1;var e=ai(),t=Oc(),n=Lc(),r=Bc(),i=Lo(),a=G(),o=zi(),s=ra(),c=1,l=`[object Arguments]`,u=`[object Array]`,d=`[object Object]`,f=Object.prototype.hasOwnProperty;function p(p,m,h,g,_,v){var y=a(p),b=a(m),x=y?u:i(p),S=b?u:i(m);x=x==l?d:x,S=S==l?d:S;var C=x==d,w=S==d,T=x==S;if(T&&o(p)){if(!o(m))return!1;y=!0,C=!1}if(T&&!C)return v||=new e,y||s(p)?t(p,m,h,g,_,v):n(p,m,x,h,g,_,v);if(!(h&c)){var E=C&&f.call(p,`__wrapped__`),D=w&&f.call(m,`__wrapped__`);if(E||D){var O=E?p.value():p,k=D?m.value():m;return v||=new e,_(O,k,h,g,v)}}return T?(v||=new e,r(p,m,h,g,_,v)):!1}return Vc=p,Vc}var Wc,Gc;function Kc(){if(Gc)return Wc;Gc=1;var e=Uc(),t=W();function n(r,i,a,o,s){return r===i?!0:r==null||i==null||!t(r)&&!t(i)?r!==r&&i!==i:e(r,i,a,o,n,s)}return Wc=n,Wc}var qc,Jc;function Yc(){if(Jc)return qc;Jc=1;var e=ai(),t=Kc(),n=1,r=2;function i(i,a,o,s){var c=o.length,l=c,u=!s;if(i==null)return!l;for(i=Object(i);c--;){var d=o[c];if(u&&d[2]?d[1]!==i[d[0]]:!(d[0]in i))return!1}for(;++c<l;){d=o[c];var f=d[0],p=i[f],m=d[1];if(u&&d[2]){if(p===void 0&&!(f in i))return!1}else{var h=new e;if(s)var g=s(p,m,f,i,a,h);if(!(g===void 0?t(m,p,n|r,s,h):g))return!1}}return!0}return qc=i,qc}var Xc,Zc;function Qc(){if(Zc)return Xc;Zc=1;var e=H();function t(t){return t===t&&!e(t)}return Xc=t,Xc}var $c,el;function tl(){if(el)return $c;el=1;var e=Qc(),t=q();function n(n){for(var r=t(n),i=r.length;i--;){var a=r[i],o=n[a];r[i]=[a,o,e(o)]}return r}return $c=n,$c}var nl,rl;function il(){if(rl)return nl;rl=1;function e(e,t){return function(n){return n!=null&&n[e]===t&&(t!==void 0||e in Object(n))}}return nl=e,nl}var al,ol;function sl(){if(ol)return al;ol=1;var e=Yc(),t=tl(),n=il();function r(r){var i=t(r);return i.length==1&&i[0][2]?n(i[0][0],i[0][1]):function(t){return t===r||e(t,r,i)}}return al=r,al}var cl,ll;function ul(){if(ll)return cl;ll=1;var e=Ln(),t=W(),n=`[object Symbol]`;function r(r){return typeof r==`symbol`||t(r)&&e(r)==n}return cl=r,cl}var dl,fl;function pl(){if(fl)return dl;fl=1;var e=G(),t=ul(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,a){if(e(i))return!1;var o=typeof i;return o==`number`||o==`symbol`||o==`boolean`||i==null||t(i)?!0:r.test(i)||!n.test(i)||a!=null&&i in Object(a)}return dl=i,dl}var ml,hl;function gl(){if(hl)return ml;hl=1;var e=$r(),t=`Expected a function`;function n(r,i){if(typeof r!=`function`||i!=null&&typeof i!=`function`)throw TypeError(t);var a=function(){var e=arguments,t=i?i.apply(this,e):e[0],n=a.cache;if(n.has(t))return n.get(t);var o=r.apply(this,e);return a.cache=n.set(t,o)||n,o};return a.cache=new(n.Cache||e),a}return n.Cache=e,ml=n,ml}var _l,vl;function yl(){if(vl)return _l;vl=1;var e=gl(),t=500;function n(n){var r=e(n,function(e){return i.size===t&&i.clear(),e}),i=r.cache;return r}return _l=n,_l}var bl,xl;function Sl(){if(xl)return bl;xl=1;var e=yl(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g;return bl=e(function(e){var r=[];return e.charCodeAt(0)===46&&r.push(``),e.replace(t,function(e,t,i,a){r.push(i?a.replace(n,`$1`):t||e)}),r}),bl}var Cl,wl;function Tl(){if(wl)return Cl;wl=1;function e(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}return Cl=e,Cl}var El,Dl;function Ol(){if(Dl)return El;Dl=1;var e=On(),t=Tl(),n=G(),r=ul(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(e){if(typeof e==`string`)return e;if(n(e))return t(e,o)+``;if(r(e))return a?a.call(e):``;var i=e+``;return i==`0`&&1/e==-1/0?`-0`:i}return El=o,El}var kl,Al;function jl(){if(Al)return kl;Al=1;var e=Ol();function t(t){return t==null?``:e(t)}return kl=t,kl}var Ml,Nl;function Pl(){if(Nl)return Ml;Nl=1;var e=G(),t=pl(),n=Sl(),r=jl();function i(i,a){return e(i)?i:t(i,a)?[i]:n(r(i))}return Ml=i,Ml}var Fl,Il;function Ll(){if(Il)return Fl;Il=1;var e=ul();function t(t){if(typeof t==`string`||e(t))return t;var n=t+``;return n==`0`&&1/t==-1/0?`-0`:n}return Fl=t,Fl}var Rl,zl;function Bl(){if(zl)return Rl;zl=1;var e=Pl(),t=Ll();function n(n,r){r=e(r,n);for(var i=0,a=r.length;n!=null&&i<a;)n=n[t(r[i++])];return i&&i==a?n:void 0}return Rl=n,Rl}var Vl,Hl;function Ul(){if(Hl)return Vl;Hl=1;var e=Bl();function t(t,n,r){var i=t==null?void 0:e(t,n);return i===void 0?r:i}return Vl=t,Vl}var Wl,Gl;function Kl(){if(Gl)return Wl;Gl=1;function e(e,t){return e!=null&&t in Object(e)}return Wl=e,Wl}var ql,Jl;function Yl(){if(Jl)return ql;Jl=1;var e=Pl(),t=ji(),n=G(),r=Hi(),i=Gi(),a=Ll();function o(o,s,c){s=e(s,o);for(var l=-1,u=s.length,d=!1;++l<u;){var f=a(s[l]);if(!(d=o!=null&&c(o,f)))break;o=o[f]}return d||++l!=u?d:(u=o==null?0:o.length,!!u&&i(u)&&r(f,u)&&(n(o)||t(o)))}return ql=o,ql}var Xl,Zl;function Ql(){if(Zl)return Xl;Zl=1;var e=Kl(),t=Yl();function n(n,r){return n!=null&&t(n,r,e)}return Xl=n,Xl}var $l,eu;function tu(){if(eu)return $l;eu=1;var e=Kc(),t=Ul(),n=Ql(),r=pl(),i=Qc(),a=il(),o=Ll(),s=1,c=2;function l(l,u){return r(l)&&i(u)?a(o(l),u):function(r){var i=t(r,l);return i===void 0&&i===u?n(r,l):e(u,i,s|c)}}return $l=l,$l}var nu,ru;function iu(){if(ru)return nu;ru=1;function e(e){return function(t){return t?.[e]}}return nu=e,nu}var au,ou;function su(){if(ou)return au;ou=1;var e=Bl();function t(t){return function(n){return e(n,t)}}return au=t,au}var cu,lu;function uu(){if(lu)return cu;lu=1;var e=iu(),t=su(),n=pl(),r=Ll();function i(i){return n(i)?e(r(i)):t(i)}return cu=i,cu}var du,fu;function Y(){if(fu)return du;fu=1;var e=sl(),t=tu(),n=Qs(),r=G(),i=uu();function a(a){return typeof a==`function`?a:a==null?n:typeof a==`object`?r(a)?t(a[0],a[1]):e(a):i(a)}return du=a,du}var pu,mu;function hu(){if(mu)return pu;mu=1;var e=Ga(),t=uc(),n=Y(),r=G();function i(i,a){return(r(i)?e:t)(i,n(a,3))}return pu=i,pu}var gu,_u;function vu(){if(_u)return gu;_u=1;var e=Object.prototype.hasOwnProperty;function t(t,n){return t!=null&&e.call(t,n)}return gu=t,gu}var yu,bu;function xu(){if(bu)return yu;bu=1;var e=vu(),t=Yl();function n(n,r){return n!=null&&t(n,r,e)}return yu=n,yu}var Su,Cu;function wu(){if(Cu)return Su;Cu=1;var e=va(),t=Lo(),n=ji(),r=G(),i=K(),a=zi(),o=la(),s=ra(),c=`[object Map]`,l=`[object Set]`,u=Object.prototype.hasOwnProperty;function d(d){if(d==null)return!0;if(i(d)&&(r(d)||typeof d==`string`||typeof d.splice==`function`||a(d)||s(d)||n(d)))return!d.length;var f=t(d);if(f==c||f==l)return!d.size;if(o(d))return!e(d).length;for(var p in d)if(u.call(d,p))return!1;return!0}return Su=d,Su}var Tu,Eu;function Du(){if(Eu)return Tu;Eu=1;function e(e){return e===void 0}return Tu=e,Tu}var Ou,ku;function Au(){if(ku)return Ou;ku=1;var e=Ys(),t=K();function n(n,r){var i=-1,a=t(n)?Array(n.length):[];return e(n,function(e,t,n){a[++i]=r(e,t,n)}),a}return Ou=n,Ou}var ju,Mu;function Nu(){if(Mu)return ju;Mu=1;var e=Tl(),t=Y(),n=Au(),r=G();function i(i,a){return(r(i)?e:n)(i,t(a,3))}return ju=i,ju}var Pu,Fu;function Iu(){if(Fu)return Pu;Fu=1;function e(e,t,n,r){var i=-1,a=e==null?0:e.length;for(r&&a&&(n=e[++i]);++i<a;)n=t(n,e[i],i,e);return n}return Pu=e,Pu}var Lu,Ru;function zu(){if(Ru)return Lu;Ru=1;function e(e,t,n,r,i){return i(e,function(e,i,a){n=r?(r=!1,e):t(n,e,i,a)}),n}return Lu=e,Lu}var Bu,Vu;function Hu(){if(Vu)return Bu;Vu=1;var e=Iu(),t=Ys(),n=Y(),r=zu(),i=G();function a(a,o,s){var c=i(a)?e:r,l=arguments.length<3;return c(a,n(o,4),s,l,t)}return Bu=a,Bu}var Uu,Wu;function Gu(){if(Wu)return Uu;Wu=1;var e=Ln(),t=G(),n=W(),r=`[object String]`;function i(i){return typeof i==`string`||!t(i)&&n(i)&&e(i)==r}return Uu=i,Uu}var Ku,qu;function Ju(){return qu?Ku:(qu=1,Ku=iu()(`length`),Ku)}var Yu,Xu;function Zu(){if(Xu)return Yu;Xu=1;var e=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function t(t){return e.test(t)}return Yu=t,Yu}var Qu,$u;function ed(){if($u)return Qu;$u=1;var e=`\\ud800-\\udfff`,t=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,n=`\\ufe0e\\ufe0f`,r=`[`+e+`]`,i=`[`+t+`]`,a=`\\ud83c[\\udffb-\\udfff]`,o=`(?:`+i+`|`+a+`)`,s=`[^`+e+`]`,c=`(?:\\ud83c[\\udde6-\\uddff]){2}`,l=`[\\ud800-\\udbff][\\udc00-\\udfff]`,u=`\\u200d`,d=o+`?`,f=`[`+n+`]?`,p=`(?:`+u+`(?:`+[s,c,l].join(`|`)+`)`+f+d+`)*`,m=f+d+p,h=`(?:`+[s+i+`?`,i,c,l,r].join(`|`)+`)`,g=RegExp(a+`(?=`+a+`)|`+h+m,`g`);function _(e){for(var t=g.lastIndex=0;g.test(e);)++t;return t}return Qu=_,Qu}var td,nd;function rd(){if(nd)return td;nd=1;var e=Ju(),t=Zu(),n=ed();function r(r){return t(r)?n(r):e(r)}return td=r,td}var id,ad;function od(){if(ad)return id;ad=1;var e=va(),t=Lo(),n=K(),r=Gu(),i=rd(),a=`[object Map]`,o=`[object Set]`;function s(s){if(s==null)return 0;if(n(s))return r(s)?i(s):s.length;var c=t(s);return c==a||c==o?s.size:e(s).length}return id=s,id}var sd,cd;function ld(){if(cd)return sd;cd=1;var e=ci(),t=us(),n=Us(),r=Y(),i=oo(),a=G(),o=zi(),s=Hn(),c=H(),l=ra();function u(u,d,f){var p=a(u),m=p||o(u)||l(u);if(d=r(d,4),f==null){var h=u&&u.constructor;f=m?p?new h:[]:c(u)&&s(h)?t(i(u)):{}}return(m?e:n)(u,function(e,t,n){return d(f,e,t,n)}),f}return sd=u,sd}var ud,dd;function fd(){if(dd)return ud;dd=1;var e=On(),t=ji(),n=G(),r=e?e.isConcatSpreadable:void 0;function i(e){return n(e)||t(e)||!!(r&&e&&e[r])}return ud=i,ud}var pd,md;function hd(){if(md)return pd;md=1;var e=ro(),t=fd();function n(r,i,a,o,s){var c=-1,l=r.length;for(a||=t,s||=[];++c<l;){var u=r[c];i>0&&a(u)?i>1?n(u,i-1,a,o,s):e(s,u):o||(s[s.length]=u)}return s}return pd=n,pd}var gd,_d;function vd(){if(_d)return gd;_d=1;function e(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}return gd=e,gd}var yd,bd;function xd(){if(bd)return yd;bd=1;var e=vd(),t=Math.max;function n(n,r,i){return r=t(r===void 0?n.length-1:r,0),function(){for(var a=arguments,o=-1,s=t(a.length-r,0),c=Array(s);++o<s;)c[o]=a[r+o];o=-1;for(var l=Array(r+1);++o<r;)l[o]=a[o];return l[r]=i(c),e(n,this,l)}}return yd=n,yd}var Sd,Cd;function wd(){if(Cd)return Sd;Cd=1;var e=Ps(),t=di(),n=Qs();return Sd=t?function(n,r){return t(n,`toString`,{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:n,Sd}var Td,Ed;function Dd(){if(Ed)return Td;Ed=1;var e=800,t=16,n=Date.now;function r(r){var i=0,a=0;return function(){var o=n(),s=t-(o-a);if(a=o,s>0){if(++i>=e)return arguments[0]}else i=0;return r.apply(void 0,arguments)}}return Td=r,Td}var Od,kd;function Ad(){if(kd)return Od;kd=1;var e=wd();return Od=Dd()(e),Od}var jd,Md;function Nd(){if(Md)return jd;Md=1;var e=Qs(),t=xd(),n=Ad();function r(r,i){return n(t(r,i,e),r+``)}return jd=r,jd}var Pd,Fd;function Id(){if(Fd)return Pd;Fd=1;function e(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}return Pd=e,Pd}var Ld,Rd;function zd(){if(Rd)return Ld;Rd=1;function e(e){return e!==e}return Ld=e,Ld}var Bd,Vd;function Hd(){if(Vd)return Bd;Vd=1;function e(e,t,n){for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}return Bd=e,Bd}var Ud,Wd;function Gd(){if(Wd)return Ud;Wd=1;var e=Id(),t=zd(),n=Hd();function r(r,i,a){return i===i?n(r,i,a):e(r,t,a)}return Ud=r,Ud}var Kd,qd;function Jd(){if(qd)return Kd;qd=1;var e=Gd();function t(t,n){return!!(t!=null&&t.length)&&e(t,n,0)>-1}return Kd=t,Kd}var Yd,Xd;function Zd(){if(Xd)return Yd;Xd=1;function e(e,t,n){for(var r=-1,i=e==null?0:e.length;++r<i;)if(n(t,e[r]))return!0;return!1}return Yd=e,Yd}var Qd,$d;function ef(){if($d)return Qd;$d=1;function e(){}return Qd=e,Qd}var tf,nf;function rf(){if(nf)return tf;nf=1;var e=jo(),t=ef(),n=Pc();return tf=e&&1/n(new e([,-0]))[1]==1/0?function(t){return new e(t)}:t,tf}var af,of;function sf(){if(of)return af;of=1;var e=yc(),t=Jd(),n=Zd(),r=Tc(),i=rf(),a=Pc(),o=200;function s(s,c,l){var u=-1,d=t,f=s.length,p=!0,m=[],h=m;if(l)p=!1,d=n;else if(f>=o){var g=c?null:i(s);if(g)return a(g);p=!1,d=r,h=new e}else h=c?[]:m;outer:for(;++u<f;){var _=s[u],v=c?c(_):_;if(_=l||_!==0?_:0,p&&v===v){for(var y=h.length;y--;)if(h[y]===v)continue outer;c&&h.push(v),m.push(_)}else d(h,v,l)||(h!==m&&h.push(v),m.push(_))}return m}return af=s,af}var cf,lf;function uf(){if(lf)return cf;lf=1;var e=K(),t=W();function n(n){return t(n)&&e(n)}return cf=n,cf}var df,ff;function pf(){if(ff)return df;ff=1;var e=hd(),t=Nd(),n=sf(),r=uf();return df=t(function(t){return n(e(t,1,r,!0))}),df}var mf,hf;function gf(){if(hf)return mf;hf=1;var e=Tl();function t(t,n){return e(n,function(e){return t[e]})}return mf=t,mf}var _f,vf;function yf(){if(vf)return _f;vf=1;var e=gf(),t=q();function n(n){return n==null?[]:e(n,t(n))}return _f=n,_f}var bf,xf;function X(){if(xf)return bf;xf=1;var e;if(typeof Lt==`function`)try{e={clone:js(),constant:Ps(),each:sc(),filter:hu(),has:xu(),isArray:G(),isEmpty:wu(),isFunction:Hn(),isUndefined:Du(),keys:q(),map:Nu(),reduce:Hu(),size:od(),transform:ld(),union:pf(),values:yf()}}catch{}return e||=window._,bf=e,bf}var Sf,Cf;function wf(){if(Cf)return Sf;Cf=1;var e=X();Sf=i;var t=`\0`,n=`\0`,r=``;function i(t){this._isDirected=!e.has(t,`directed`)||t.directed,this._isMultigraph=e.has(t,`multigraph`)?t.multigraph:!1,this._isCompound=e.has(t,`compound`)?t.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[n]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(e){return this._label=e,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(t){return e.isFunction(t)||(t=e.constant(t)),this._defaultNodeLabelFn=t,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var t=this;return e.filter(this.nodes(),function(n){return e.isEmpty(t._in[n])})},i.prototype.sinks=function(){var t=this;return e.filter(this.nodes(),function(n){return e.isEmpty(t._out[n])})},i.prototype.setNodes=function(t,n){var r=arguments,i=this;return e.each(t,function(e){r.length>1?i.setNode(e,n):i.setNode(e)}),this},i.prototype.setNode=function(t,r){return e.has(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=r),this):(this._nodes[t]=arguments.length>1?r:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=n,this._children[t]={},this._children[n][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)},i.prototype.node=function(e){return this._nodes[e]},i.prototype.hasNode=function(t){return e.has(this._nodes,t)},i.prototype.removeNode=function(t){var n=this;if(e.has(this._nodes,t)){var r=function(e){n.removeEdge(n._edgeObjs[e])};delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],e.each(this.children(t),function(e){n.setParent(e)}),delete this._children[t]),e.each(e.keys(this._in[t]),r),delete this._in[t],delete this._preds[t],e.each(e.keys(this._out[t]),r),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this},i.prototype.setParent=function(t,r){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(e.isUndefined(r))r=n;else{r+=``;for(var i=r;!e.isUndefined(i);i=this.parent(i))if(i===t)throw Error(`Setting `+r+` as parent of `+t+` would create a cycle`);this.setNode(r)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=r,this._children[r][t]=!0,this},i.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},i.prototype.parent=function(e){if(this._isCompound){var t=this._parent[e];if(t!==n)return t}},i.prototype.children=function(t){if(e.isUndefined(t)&&(t=n),this._isCompound){var r=this._children[t];if(r)return e.keys(r)}else if(t===n)return this.nodes();else if(this.hasNode(t))return[]},i.prototype.predecessors=function(t){var n=this._preds[t];if(n)return e.keys(n)},i.prototype.successors=function(t){var n=this._sucs[t];if(n)return e.keys(n)},i.prototype.neighbors=function(t){var n=this.predecessors(t);if(n)return e.union(n,this.successors(t))},i.prototype.isLeaf=function(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0},i.prototype.filterNodes=function(t){var n=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});n.setGraph(this.graph());var r=this;e.each(this._nodes,function(e,r){t(r)&&n.setNode(r,e)}),e.each(this._edgeObjs,function(e){n.hasNode(e.v)&&n.hasNode(e.w)&&n.setEdge(e,r.edge(e))});var i={};function a(e){var t=r.parent(e);return t===void 0||n.hasNode(t)?(i[e]=t,t):t in i?i[t]:a(t)}return this._isCompound&&e.each(n.nodes(),function(e){n.setParent(e,a(e))}),n},i.prototype.setDefaultEdgeLabel=function(t){return e.isFunction(t)||(t=e.constant(t)),this._defaultEdgeLabelFn=t,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(t,n){var r=this,i=arguments;return e.reduce(t,function(e,t){return i.length>1?r.setEdge(e,t,n):r.setEdge(e,t),t}),this},i.prototype.setEdge=function(){var t,n,r,i,o=!1,l=arguments[0];typeof l==`object`&&l&&`v`in l?(t=l.v,n=l.w,r=l.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=l,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=``+t,n=``+n,e.isUndefined(r)||(r=``+r);var u=s(this._isDirected,t,n,r);if(e.has(this._edgeLabels,u))return o&&(this._edgeLabels[u]=i),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(t),this.setNode(n),this._edgeLabels[u]=o?i:this._defaultEdgeLabelFn(t,n,r);var d=c(this._isDirected,t,n,r);return t=d.v,n=d.w,Object.freeze(d),this._edgeObjs[u]=d,a(this._preds[n],t),a(this._sucs[t],n),this._in[n][u]=d,this._out[t][u]=d,this._edgeCount++,this},i.prototype.edge=function(e,t,n){var r=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,n);return this._edgeLabels[r]},i.prototype.hasEdge=function(t,n,r){var i=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,t,n,r);return e.has(this._edgeLabels,i)},i.prototype.removeEdge=function(e,t,n){var r=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],o(this._preds[t],e),o(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this},i.prototype.inEdges=function(t,n){var r=this._in[t];if(r){var i=e.values(r);return n?e.filter(i,function(e){return e.v===n}):i}},i.prototype.outEdges=function(t,n){var r=this._out[t];if(r){var i=e.values(r);return n?e.filter(i,function(e){return e.w===n}):i}},i.prototype.nodeEdges=function(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))};function a(e,t){e[t]?e[t]++:e[t]=1}function o(e,t){--e[t]||delete e[t]}function s(n,i,a,o){var s=``+i,c=``+a;if(!n&&s>c){var l=s;s=c,c=l}return s+r+c+r+(e.isUndefined(o)?t:o)}function c(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function l(e,t){return s(e,t.v,t.w,t.name)}return Sf}var Tf,Ef;function Df(){return Ef?Tf:(Ef=1,Tf=`2.1.8`,Tf)}var Of,kf;function Af(){return kf?Of:(kf=1,Of={Graph:wf(),version:Df()},Of)}var jf,Mf;function Nf(){if(Mf)return jf;Mf=1;var e=X(),t=wf();jf={write:n,read:a};function n(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:r(t),edges:i(t)};return e.isUndefined(t.graph())||(n.value=e.clone(t.graph())),n}function r(t){return e.map(t.nodes(),function(n){var r=t.node(n),i=t.parent(n),a={v:n};return e.isUndefined(r)||(a.value=r),e.isUndefined(i)||(a.parent=i),a})}function i(t){return e.map(t.edges(),function(n){var r=t.edge(n),i={v:n.v,w:n.w};return e.isUndefined(n.name)||(i.name=n.name),e.isUndefined(r)||(i.value=r),i})}function a(n){var r=new t(n.options).setGraph(n.value);return e.each(n.nodes,function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)}),e.each(n.edges,function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),r}return jf}var Pf,Ff;function If(){if(Ff)return Pf;Ff=1;var e=X();Pf=t;function t(t){var n={},r=[],i;function a(r){e.has(n,r)||(n[r]=!0,i.push(r),e.each(t.successors(r),a),e.each(t.predecessors(r),a))}return e.each(t.nodes(),function(e){i=[],a(e),i.length&&r.push(i)}),r}return Pf}var Lf,Rf;function zf(){if(Rf)return Lf;Rf=1;var e=X();Lf=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(e){return e.key})},t.prototype.has=function(t){return e.has(this._keyIndices,t)},t.prototype.priority=function(e){var t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority},t.prototype.min=function(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key},t.prototype.add=function(t,n){var r=this._keyIndices;if(t=String(t),!e.has(r,t)){var i=this._arr,a=i.length;return r[t]=a,i.push({key:t,priority:n}),this._decrease(a),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},t.prototype.decrease=function(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw Error(`New priority is greater than current priority. Key: `+e+` Old: `+this._arr[n].priority+` New: `+t);this._arr[n].priority=t,this._decrease(n)},t.prototype._heapify=function(e){var 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)))},t.prototype._decrease=function(e){for(var t=this._arr,n=t[e].priority,r;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r},t.prototype._swap=function(e,t){var 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},Lf}var Bf,Vf;function Hf(){if(Vf)return Bf;Vf=1;var e=X(),t=zf();Bf=r;var n=e.constant(1);function r(e,t,r,a){return i(e,String(t),r||n,a||function(t){return e.outEdges(t)})}function i(e,n,r,i){var a={},o=new t,s,c,l=function(e){var t=e.v===s?e.w:e.v,n=a[t],i=r(e),l=c.distance+i;if(i<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+i);l<n.distance&&(n.distance=l,n.predecessor=s,o.decrease(t,l))};for(e.nodes().forEach(function(e){var t=e===n?0:1/0;a[e]={distance:t},o.add(e,t)});o.size()>0&&(s=o.removeMin(),c=a[s],c.distance!==1/0);)i(s).forEach(l);return a}return Bf}var Uf,Wf;function Gf(){if(Wf)return Uf;Wf=1;var e=Hf(),t=X();Uf=n;function n(n,r,i){return t.transform(n.nodes(),function(t,a){t[a]=e(n,a,r,i)},{})}return Uf}var Kf,qf;function Jf(){if(qf)return Kf;qf=1;var e=X();Kf=t;function t(t){var n=0,r=[],i={},a=[];function o(s){var c=i[s]={onStack:!0,lowlink:n,index:n++};if(r.push(s),t.successors(s).forEach(function(t){e.has(i,t)?i[t].onStack&&(c.lowlink=Math.min(c.lowlink,i[t].index)):(o(t),c.lowlink=Math.min(c.lowlink,i[t].lowlink))}),c.lowlink===c.index){var l=[],u;do u=r.pop(),i[u].onStack=!1,l.push(u);while(s!==u);a.push(l)}}return t.nodes().forEach(function(t){e.has(i,t)||o(t)}),a}return Kf}var Yf,Xf;function Zf(){if(Xf)return Yf;Xf=1;var e=X(),t=Jf();Yf=n;function n(n){return e.filter(t(n),function(e){return e.length>1||e.length===1&&n.hasEdge(e[0],e[0])})}return Yf}var Qf,$f;function ep(){if($f)return Qf;$f=1;var e=X();Qf=n;var t=e.constant(1);function n(e,n,i){return r(e,n||t,i||function(t){return e.outEdges(t)})}function r(e,t,n){var r={},i=e.nodes();return i.forEach(function(e){r[e]={},r[e][e]={distance:0},i.forEach(function(t){e!==t&&(r[e][t]={distance:1/0})}),n(e).forEach(function(n){var i=n.v===e?n.w:n.v,a=t(n);r[e][i]={distance:a,predecessor:e}})}),i.forEach(function(e){var t=r[e];i.forEach(function(n){var a=r[n];i.forEach(function(n){var 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}return Qf}var tp,np;function rp(){if(np)return tp;np=1;var e=X();tp=t,t.CycleException=n;function t(t){var r={},i={},a=[];function o(s){if(e.has(i,s))throw new n;e.has(r,s)||(i[s]=!0,r[s]=!0,e.each(t.predecessors(s),o),delete i[s],a.push(s))}if(e.each(t.sinks(),o),e.size(r)!==t.nodeCount())throw new n;return a}function n(){}return n.prototype=Error(),tp}var ip,ap;function op(){if(ap)return ip;ap=1;var e=rp();ip=t;function t(t){try{e(t)}catch(t){if(t instanceof e.CycleException)return!1;throw t}return!0}return ip}var sp,cp;function lp(){if(cp)return sp;cp=1;var e=X();sp=t;function t(t,r,i){e.isArray(r)||(r=[r]);var a=(t.isDirected()?t.successors:t.neighbors).bind(t),o=[],s={};return e.each(r,function(e){if(!t.hasNode(e))throw Error(`Graph does not have node: `+e);n(t,e,i===`post`,s,a,o)}),o}function n(t,r,i,a,o,s){e.has(a,r)||(a[r]=!0,i||s.push(r),e.each(o(r),function(e){n(t,e,i,a,o,s)}),i&&s.push(r))}return sp}var up,dp;function fp(){if(dp)return up;dp=1;var e=lp();up=t;function t(t,n){return e(t,n,`post`)}return up}var pp,mp;function hp(){if(mp)return pp;mp=1;var e=lp();pp=t;function t(t,n){return e(t,n,`pre`)}return pp}var gp,_p;function vp(){if(_p)return gp;_p=1;var e=X(),t=wf(),n=zf();gp=r;function r(r,i){var a=new t,o={},s=new n,c;function l(e){var t=e.v===c?e.w:e.v,n=s.priority(t);if(n!==void 0){var r=i(e);r<n&&(o[t]=c,s.decrease(t,r))}}if(r.nodeCount()===0)return a;e.each(r.nodes(),function(e){s.add(e,1/0),a.setNode(e)}),s.decrease(r.nodes()[0],0);for(var u=!1;s.size()>0;){if(c=s.removeMin(),e.has(o,c))a.setEdge(c,o[c]);else if(u)throw Error(`Input graph is not connected: `+r);else u=!0;r.nodeEdges(c).forEach(l)}return a}return gp}var yp,bp;function xp(){return bp?yp:(bp=1,yp={components:If(),dijkstra:Hf(),dijkstraAll:Gf(),findCycles:Zf(),floydWarshall:ep(),isAcyclic:op(),postorder:fp(),preorder:hp(),prim:vp(),tarjan:Jf(),topsort:rp()},yp)}var Sp,Cp;function wp(){if(Cp)return Sp;Cp=1;var e=Af();return Sp={Graph:e.Graph,json:Nf(),alg:xp(),version:e.version},Sp}var Tp,Ep;function Z(){if(Ep)return Tp;Ep=1;var e;if(typeof Lt==`function`)try{e=wp()}catch{}return e||=window.graphlib,Tp=e,Tp}var Dp,Op;function kp(){if(Op)return Dp;Op=1;var e=Os(),t=1,n=4;function r(r){return e(r,t|n)}return Dp=r,Dp}var Ap,jp;function Mp(){if(jp)return Ap;jp=1;var e=Ut(),t=K(),n=Hi(),r=H();function i(i,a,o){if(!r(o))return!1;var s=typeof a;return(s==`number`?t(o)&&n(a,o.length):s==`string`&&a in o)?e(o[a],i):!1}return Ap=i,Ap}var Np,Pp;function Fp(){if(Pp)return Np;Pp=1;var e=Nd(),t=Ut(),n=Mp(),r=J(),i=Object.prototype,a=i.hasOwnProperty;return Np=e(function(e,o){e=Object(e);var s=-1,c=o.length,l=c>2?o[2]:void 0;for(l&&n(o[0],o[1],l)&&(c=1);++s<c;)for(var u=o[s],d=r(u),f=-1,p=d.length;++f<p;){var m=d[f],h=e[m];(h===void 0||t(h,i[m])&&!a.call(e,m))&&(e[m]=u[m])}return e}),Np}var Ip,Lp;function Rp(){if(Lp)return Ip;Lp=1;var e=Y(),t=K(),n=q();function r(r){return function(i,a,o){var s=Object(i);if(!t(i)){var c=e(a,3);i=n(i),a=function(e){return c(s[e],e,s)}}var l=r(i,a,o);return l>-1?s[c?i[l]:l]:void 0}}return Ip=r,Ip}var zp,Bp;function Vp(){if(Bp)return zp;Bp=1;var e=/\s/;function t(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}return zp=t,zp}var Hp,Up;function Wp(){if(Up)return Hp;Up=1;var e=Vp(),t=/^\s+/;function n(n){return n&&n.slice(0,e(n)+1).replace(t,``)}return Hp=n,Hp}var Gp,Kp;function qp(){if(Kp)return Gp;Kp=1;var e=Wp(),t=H(),n=ul(),r=NaN,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,o=/^0o[0-7]+$/i,s=parseInt;function c(c){if(typeof c==`number`)return c;if(n(c))return r;if(t(c)){var l=typeof c.valueOf==`function`?c.valueOf():c;c=t(l)?l+``:l}if(typeof c!=`string`)return c===0?c:+c;c=e(c);var u=a.test(c);return u||o.test(c)?s(c.slice(2),u?2:8):i.test(c)?r:+c}return Gp=c,Gp}var Jp,Yp;function Xp(){if(Yp)return Jp;Yp=1;var e=qp(),t=1/0,n=17976931348623157e292;function r(r){return r?(r=e(r),r===t||r===-t?(r<0?-1:1)*n:r===r?r:0):r===0?r:0}return Jp=r,Jp}var Zp,Qp;function $p(){if(Qp)return Zp;Qp=1;var e=Xp();function t(t){var n=e(t),r=n%1;return n===n?r?n-r:n:0}return Zp=t,Zp}var em,tm;function nm(){if(tm)return em;tm=1;var e=Id(),t=Y(),n=$p(),r=Math.max;function i(i,a,o){var s=i==null?0:i.length;if(!s)return-1;var c=o==null?0:n(o);return c<0&&(c=r(s+c,0)),e(i,t(a,3),c)}return em=i,em}var rm,im;function am(){return im?rm:(im=1,rm=Rp()(nm()),rm)}var om,sm;function cm(){if(sm)return om;sm=1;var e=hd();function t(t){return t!=null&&t.length?e(t,1):[]}return om=t,om}var lm,um;function dm(){if(um)return lm;um=1;var e=Bs(),t=tc(),n=J();function r(r,i){return r==null?r:e(r,t(i),n)}return lm=r,lm}var fm,pm;function mm(){if(pm)return fm;pm=1;function e(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}return fm=e,fm}var hm,gm;function _m(){if(gm)return hm;gm=1;var e=mi(),t=Us(),n=Y();function r(r,i){var a={};return i=n(i,3),t(r,function(t,n,r){e(a,n,i(t,n,r))}),a}return hm=r,hm}var vm,ym;function bm(){if(ym)return vm;ym=1;var e=ul();function t(t,n,r){for(var i=-1,a=t.length;++i<a;){var o=t[i],s=n(o);if(s!=null&&(c===void 0?s===s&&!e(s):r(s,c)))var c=s,l=o}return l}return vm=t,vm}var xm,Sm;function Cm(){if(Sm)return xm;Sm=1;function e(e,t){return e>t}return xm=e,xm}var wm,Tm;function Em(){if(Tm)return wm;Tm=1;var e=bm(),t=Cm(),n=Qs();function r(r){return r&&r.length?e(r,n,t):void 0}return wm=r,wm}var Dm,Om;function km(){if(Om)return Dm;Om=1;var e=mi(),t=Ut();function n(n,r,i){(i!==void 0&&!t(n[r],i)||i===void 0&&!(r in n))&&e(n,r,i)}return Dm=n,Dm}var Am,jm;function Mm(){if(jm)return Am;jm=1;var e=Ln(),t=oo(),n=W(),r=`[object Object]`,i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,c=o.call(Object);function l(i){if(!n(i)||e(i)!=r)return!1;var a=t(i);if(a===null)return!0;var l=s.call(a,`constructor`)&&a.constructor;return typeof l==`function`&&l instanceof l&&o.call(l)==c}return Am=l,Am}var Nm,Pm;function Fm(){if(Pm)return Nm;Pm=1;function e(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}return Nm=e,Nm}var Im,Lm;function Rm(){if(Lm)return Im;Lm=1;var e=bi(),t=J();function n(n){return e(n,t(n))}return Im=n,Im}var zm,Bm;function Vm(){if(Bm)return zm;Bm=1;var e=km(),t=za(),n=is(),r=Ha(),i=ps(),a=ji(),o=G(),s=uf(),c=zi(),l=Hn(),u=H(),d=Mm(),f=ra(),p=Fm(),m=Rm();function h(h,g,_,v,y,b,x){var S=p(h,_),C=p(g,_),w=x.get(C);if(w){e(h,_,w);return}var T=b?b(S,C,_+``,h,g,x):void 0,E=T===void 0;if(E){var D=o(C),O=!D&&c(C),k=!D&&!O&&f(C);T=C,D||O||k?o(S)?T=S:s(S)?T=r(S):O?(E=!1,T=t(C,!0)):k?(E=!1,T=n(C,!0)):T=[]:d(C)||a(C)?(T=S,a(S)?T=m(S):(!u(S)||l(S))&&(T=i(C))):E=!1}E&&(x.set(C,T),y(T,C,v,b,x),x.delete(C)),e(h,_,T)}return zm=h,zm}var Hm,Um;function Wm(){if(Um)return Hm;Um=1;var e=ai(),t=km(),n=Bs(),r=Vm(),i=H(),a=J(),o=Fm();function s(c,l,u,d,f){c!==l&&n(l,function(n,a){if(f||=new e,i(n))r(c,l,a,u,s,d,f);else{var p=d?d(o(c,a),n,a+``,c,l,f):void 0;p===void 0&&(p=n),t(c,a,p)}},a)}return Hm=s,Hm}var Gm,Km;function qm(){if(Km)return Gm;Km=1;var e=Nd(),t=Mp();function n(n){return e(function(e,r){var i=-1,a=r.length,o=a>1?r[a-1]:void 0,s=a>2?r[2]:void 0;for(o=n.length>3&&typeof o==`function`?(a--,o):void 0,s&&t(r[0],r[1],s)&&(o=a<3?void 0:o,a=1),e=Object(e);++i<a;){var c=r[i];c&&n(e,c,i,o)}return e})}return Gm=n,Gm}var Jm,Ym;function Xm(){if(Ym)return Jm;Ym=1;var e=Wm();return Jm=qm()(function(t,n,r){e(t,n,r)}),Jm}var Zm,Qm;function $m(){if(Qm)return Zm;Qm=1;function e(e,t){return e<t}return Zm=e,Zm}var eh,th;function nh(){if(th)return eh;th=1;var e=bm(),t=$m(),n=Qs();function r(r){return r&&r.length?e(r,n,t):void 0}return eh=r,eh}var rh,ih;function ah(){if(ih)return rh;ih=1;var e=bm(),t=Y(),n=$m();function r(r,i){return r&&r.length?e(r,t(i,2),n):void 0}return rh=r,rh}var oh,sh;function ch(){if(sh)return oh;sh=1;var e=V();return oh=function(){return e.Date.now()},oh}var lh,uh;function dh(){if(uh)return lh;uh=1;var e=_i(),t=Pl(),n=Hi(),r=H(),i=Ll();function a(a,o,s,c){if(!r(a))return a;o=t(o,a);for(var l=-1,u=o.length,d=u-1,f=a;f!=null&&++l<u;){var p=i(o[l]),m=s;if(p===`__proto__`||p===`constructor`||p===`prototype`)return a;if(l!=d){var h=f[p];m=c?c(h,p,f):void 0,m===void 0&&(m=r(h)?h:n(o[l+1])?[]:{})}e(f,p,m),f=f[p]}return a}return lh=a,lh}var fh,ph;function mh(){if(ph)return fh;ph=1;var e=Bl(),t=dh(),n=Pl();function r(r,i,a){for(var o=-1,s=i.length,c={};++o<s;){var l=i[o],u=e(r,l);a(u,l)&&t(c,n(l,r),u)}return c}return fh=r,fh}var hh,gh;function _h(){if(gh)return hh;gh=1;var e=mh(),t=Ql();function n(n,r){return e(n,r,function(e,r){return t(n,r)})}return hh=n,hh}var vh,yh;function bh(){if(yh)return vh;yh=1;var e=cm(),t=xd(),n=Ad();function r(r){return n(t(r,void 0,e),r+``)}return vh=r,vh}var xh,Sh;function Ch(){if(Sh)return xh;Sh=1;var e=_h();return xh=bh()(function(t,n){return t==null?{}:e(t,n)}),xh}var wh,Th;function Eh(){if(Th)return wh;Th=1;var e=Math.ceil,t=Math.max;function n(n,r,i,a){for(var o=-1,s=t(e((r-n)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=n,n+=i;return c}return wh=n,wh}var Dh,Oh;function kh(){if(Oh)return Dh;Oh=1;var e=Eh(),t=Mp(),n=Xp();function r(r){return function(i,a,o){return o&&typeof o!=`number`&&t(i,a,o)&&(a=o=void 0),i=n(i),a===void 0?(a=i,i=0):a=n(a),o=o===void 0?i<a?1:-1:n(o),e(i,a,o,r)}}return Dh=r,Dh}var Ah,jh;function Mh(){return jh?Ah:(jh=1,Ah=kh()(),Ah)}var Nh,Ph;function Fh(){if(Ph)return Nh;Ph=1;function e(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}return Nh=e,Nh}var Ih,Lh;function Rh(){if(Lh)return Ih;Lh=1;var e=ul();function t(t,n){if(t!==n){var r=t!==void 0,i=t===null,a=t===t,o=e(t),s=n!==void 0,c=n===null,l=n===n,u=e(n);if(!c&&!u&&!o&&t>n||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&t<n||u&&r&&a&&!i&&!o||c&&r&&a||!s&&a||!l)return-1}return 0}return Ih=t,Ih}var zh,Bh;function Vh(){if(Bh)return zh;Bh=1;var e=Rh();function t(t,n,r){for(var i=-1,a=t.criteria,o=n.criteria,s=a.length,c=r.length;++i<s;){var l=e(a[i],o[i]);if(l)return i>=c?l:l*(r[i]==`desc`?-1:1)}return t.index-n.index}return zh=t,zh}var Hh,Uh;function Wh(){if(Uh)return Hh;Uh=1;var e=Tl(),t=Bl(),n=Y(),r=Au(),i=Fh(),a=Zi(),o=Vh(),s=Qs(),c=G();function l(l,u,d){u=u.length?e(u,function(e){return c(e)?function(n){return t(n,e.length===1?e[0]:e)}:e}):[s];var f=-1;return u=e(u,a(n)),i(r(l,function(t,n,r){return{criteria:e(u,function(e){return e(t)}),index:++f,value:t}}),function(e,t){return o(e,t,d)})}return Hh=l,Hh}var Gh,Kh;function qh(){if(Kh)return Gh;Kh=1;var e=hd(),t=Wh(),n=Nd(),r=Mp();return Gh=n(function(n,i){if(n==null)return[];var a=i.length;return a>1&&r(n,i[0],i[1])?i=[]:a>2&&r(i[0],i[1],i[2])&&(i=[i[0]]),t(n,e(i,1),[])}),Gh}var Jh,Yh;function Xh(){if(Yh)return Jh;Yh=1;var e=jl(),t=0;function n(n){var r=++t;return e(n)+r}return Jh=n,Jh}var Zh,Qh;function $h(){if(Qh)return Zh;Qh=1;function e(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}return Zh=e,Zh}var eg,tg;function ng(){if(tg)return eg;tg=1;var e=_i(),t=$h();function n(n,r){return t(n||[],r||[],e)}return eg=n,eg}var rg,ig;function Q(){if(ig)return rg;ig=1;var e;if(typeof Lt==`function`)try{e={cloneDeep:kp(),constant:Ps(),defaults:Fp(),each:sc(),filter:hu(),find:am(),flatten:cm(),forEach:ic(),forIn:dm(),has:xu(),isUndefined:Du(),last:mm(),map:Nu(),mapValues:_m(),max:Em(),merge:Xm(),min:nh(),minBy:ah(),now:ch(),pick:Ch(),range:Mh(),reduce:Hu(),sortBy:qh(),uniqueId:Xh(),values:yf(),zipObject:ng()}}catch{}return e||=window._,rg=e,rg}var ag,og;function sg(){if(og)return ag;og=1,ag=e;function e(){var e={};e._next=e._prev=e,this._sentinel=e}e.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return t(n),n},e.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&t(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},e.prototype.toString=function(){for(var e=[],t=this._sentinel,r=t._prev;r!==t;)e.push(JSON.stringify(r,n)),r=r._prev;return`[`+e.join(`, `)+`]`};function t(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function n(e,t){if(e!==`_next`&&e!==`_prev`)return t}return ag}var cg,lg;function ug(){if(lg)return cg;lg=1;var e=Q(),t=Z().Graph,n=sg();cg=i;var r=e.constant(1);function i(t,n){if(t.nodeCount()<=1)return[];var i=s(t,n||r),o=a(i.graph,i.buckets,i.zeroIdx);return e.flatten(e.map(o,function(e){return t.outEdges(e.v,e.w)}),!0)}function a(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],s;e.nodeCount();){for(;s=a.dequeue();)o(e,t,n,s);for(;s=i.dequeue();)o(e,t,n,s);if(e.nodeCount()){for(var c=t.length-2;c>0;--c)if(s=t[c].dequeue(),s){r=r.concat(o(e,t,n,s,!0));break}}}return r}function o(t,n,r,i,a){var o=a?[]:void 0;return e.forEach(t.inEdges(i.v),function(e){var i=t.edge(e),s=t.node(e.v);a&&o.push({v:e.v,w:e.w}),s.out-=i,c(n,r,s)}),e.forEach(t.outEdges(i.v),function(e){var i=t.edge(e),a=e.w,o=t.node(a);o.in-=i,c(n,r,o)}),t.removeNode(i.v),o}function s(r,i){var a=new t,o=0,s=0;e.forEach(r.nodes(),function(e){a.setNode(e,{v:e,in:0,out:0})}),e.forEach(r.edges(),function(e){var t=a.edge(e.v,e.w)||0,n=i(e),r=t+n;a.setEdge(e.v,e.w,r),s=Math.max(s,a.node(e.v).out+=n),o=Math.max(o,a.node(e.w).in+=n)});var l=e.range(s+o+3).map(function(){return new n}),u=o+1;return e.forEach(a.nodes(),function(e){c(l,u,a.node(e))}),{graph:a,buckets:l,zeroIdx:u}}function c(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}return cg}var dg,fg;function pg(){if(fg)return dg;fg=1;var e=Q(),t=ug();dg={run:n,undo:i};function n(n){var i=n.graph().acyclicer===`greedy`?t(n,a(n)):r(n);e.forEach(i,function(t){var r=n.edge(t);n.removeEdge(t),r.forwardName=t.name,r.reversed=!0,n.setEdge(t.w,t.v,r,e.uniqueId(`rev`))});function a(e){return function(t){return e.edge(t).weight}}}function r(t){var n=[],r={},i={};function a(o){e.has(i,o)||(i[o]=!0,r[o]=!0,e.forEach(t.outEdges(o),function(t){e.has(r,t.w)?n.push(t):a(t.w)}),delete r[o])}return e.forEach(t.nodes(),a),n}function i(t){e.forEach(t.edges(),function(e){var n=t.edge(e);if(n.reversed){t.removeEdge(e);var r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}return dg}var mg,hg;function $(){if(hg)return mg;hg=1;var e=Q(),t=Z().Graph;mg={addDummyNode:n,simplify:r,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:o,intersectRect:s,buildLayerMatrix:c,normalizeRanks:l,removeEmptyRanks:u,addBorderNode:d,maxRank:f,partition:p,time:m,notime:h};function n(t,n,r,i){var a;do a=e.uniqueId(i);while(t.hasNode(a));return r.dummy=n,t.setNode(a,r),a}function r(n){var r=new t().setGraph(n.graph());return e.forEach(n.nodes(),function(e){r.setNode(e,n.node(e))}),e.forEach(n.edges(),function(e){var t=r.edge(e.v,e.w)||{weight:0,minlen:1},i=n.edge(e);r.setEdge(e.v,e.w,{weight:t.weight+i.weight,minlen:Math.max(t.minlen,i.minlen)})}),r}function i(n){var r=new t({multigraph:n.isMultigraph()}).setGraph(n.graph());return e.forEach(n.nodes(),function(e){n.children(e).length||r.setNode(e,n.node(e))}),e.forEach(n.edges(),function(e){r.setEdge(e,n.edge(e))}),r}function a(t){var n=e.map(t.nodes(),function(n){var r={};return e.forEach(t.outEdges(n),function(e){r[e.w]=(r[e.w]||0)+t.edge(e).weight}),r});return e.zipObject(t.nodes(),n)}function o(t){var n=e.map(t.nodes(),function(n){var r={};return e.forEach(t.inEdges(n),function(e){r[e.v]=(r[e.v]||0)+t.edge(e).weight}),r});return e.zipObject(t.nodes(),n)}function s(e,t){var 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`);var 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 c(t){var n=e.map(e.range(f(t)+1),function(){return[]});return e.forEach(t.nodes(),function(r){var i=t.node(r),a=i.rank;e.isUndefined(a)||(n[a][i.order]=r)}),n}function l(t){var n=e.min(e.map(t.nodes(),function(e){return t.node(e).rank}));e.forEach(t.nodes(),function(r){var i=t.node(r);e.has(i,`rank`)&&(i.rank-=n)})}function u(t){var n=e.min(e.map(t.nodes(),function(e){return t.node(e).rank})),r=[];e.forEach(t.nodes(),function(e){var i=t.node(e).rank-n;r[i]||(r[i]=[]),r[i].push(e)});var i=0,a=t.graph().nodeRankFactor;e.forEach(r,function(n,r){e.isUndefined(n)&&r%a!==0?--i:i&&e.forEach(n,function(e){t.node(e).rank+=i})})}function d(e,t,r,i){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=i),n(e,`border`,a,t)}function f(t){return e.max(e.map(t.nodes(),function(n){var r=t.node(n).rank;if(!e.isUndefined(r))return r}))}function p(t,n){var r={lhs:[],rhs:[]};return e.forEach(t,function(e){n(e)?r.lhs.push(e):r.rhs.push(e)}),r}function m(t,n){var r=e.now();try{return n()}finally{console.log(t+` time: `+(e.now()-r)+`ms`)}}function h(e,t){return t()}return mg}var gg,_g;function vg(){if(_g)return gg;_g=1;var e=Q(),t=$();gg={run:n,undo:i};function n(t){t.graph().dummyChains=[],e.forEach(t.edges(),function(e){r(t,e)})}function r(e,n){var r=n.v,i=e.node(r).rank,a=n.w,o=e.node(a).rank,s=n.name,c=e.edge(n),l=c.labelRank;if(o!==i+1){e.removeEdge(n);var u,d,f;for(f=0,++i;i<o;++f,++i)c.points=[],d={width:0,height:0,edgeLabel:c,edgeObj:n,rank:i},u=t.addDummyNode(e,`edge`,d,`_d`),i===l&&(d.width=c.width,d.height=c.height,d.dummy=`edge-label`,d.labelpos=c.labelpos),e.setEdge(r,u,{weight:c.weight},s),f===0&&e.graph().dummyChains.push(u),r=u;e.setEdge(r,a,{weight:c.weight},s)}}function i(t){e.forEach(t.graph().dummyChains,function(e){var n=t.node(e),r=n.edgeLabel,i;for(t.setEdge(n.edgeObj,r);n.dummy;)i=t.successors(e)[0],t.removeNode(e),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),e=i,n=t.node(e)})}return gg}var yg,bg;function xg(){if(bg)return yg;bg=1;var e=Q();yg={longestPath:t,slack:n};function t(t){var n={};function r(i){var a=t.node(i);if(e.has(n,i))return a.rank;n[i]=!0;var o=e.min(e.map(t.outEdges(i),function(e){return r(e.w)-t.edge(e).minlen}));return(o===1/0||o==null)&&(o=0),a.rank=o}e.forEach(t.sources(),r)}function n(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}return yg}var Sg,Cg;function wg(){if(Cg)return Sg;Cg=1;var e=Q(),t=Z().Graph,n=xg().slack;Sg=r;function r(e){var r=new t({directed:!1}),s=e.nodes()[0],c=e.nodeCount();r.setNode(s,{});for(var l,u;i(r,e)<c;)l=a(r,e),u=r.hasNode(l.v)?n(e,l):-n(e,l),o(r,e,u);return r}function i(t,r){function i(a){e.forEach(r.nodeEdges(a),function(e){var o=e.v,s=a===o?e.w:o;!t.hasNode(s)&&!n(r,e)&&(t.setNode(s,{}),t.setEdge(a,s,{}),i(s))})}return e.forEach(t.nodes(),i),t.nodeCount()}function a(t,r){return e.minBy(r.edges(),function(e){if(t.hasNode(e.v)!==t.hasNode(e.w))return n(r,e)})}function o(t,n,r){e.forEach(t.nodes(),function(e){n.node(e).rank+=r})}return Sg}var Tg,Eg;function Dg(){if(Eg)return Tg;Eg=1;var e=Q(),t=wg(),n=xg().slack,r=xg().longestPath,i=Z().alg.preorder,a=Z().alg.postorder,o=$().simplify;Tg=s,s.initLowLimValues=d,s.initCutValues=c,s.calcCutValue=u,s.leaveEdge=p,s.enterEdge=m,s.exchangeEdges=h;function s(e){e=o(e),r(e);var n=t(e);d(n),c(n,e);for(var i,a;i=p(n);)a=m(n,e,i),h(n,e,i,a)}function c(t,n){var r=a(t,t.nodes());r=r.slice(0,r.length-1),e.forEach(r,function(e){l(t,n,e)})}function l(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=u(e,t,n)}function u(t,n,r){var i=t.node(r).parent,a=!0,o=n.edge(r,i),s=0;return o||=(a=!1,n.edge(i,r)),s=o.weight,e.forEach(n.nodeEdges(r),function(e){var o=e.v===r,c=o?e.w:e.v;if(c!==i){var l=o===a,u=n.edge(e).weight;if(s+=l?u:-u,_(t,r,c)){var d=t.edge(r,c).cutvalue;s+=l?-d:d}}}),s}function d(e,t){arguments.length<2&&(t=e.nodes()[0]),f(e,{},1,t)}function f(t,n,r,i,a){var o=r,s=t.node(i);return n[i]=!0,e.forEach(t.neighbors(i),function(a){e.has(n,a)||(r=f(t,n,r,a,i))}),s.low=o,s.lim=r++,a?s.parent=a:delete s.parent,r}function p(t){return e.find(t.edges(),function(e){return t.edge(e).cutvalue<0})}function m(t,r,i){var a=i.v,o=i.w;r.hasEdge(a,o)||(a=i.w,o=i.v);var s=t.node(a),c=t.node(o),l=s,u=!1;s.lim>c.lim&&(l=c,u=!0);var d=e.filter(r.edges(),function(e){return u===v(t,t.node(e.v),l)&&u!==v(t,t.node(e.w),l)});return e.minBy(d,function(e){return n(r,e)})}function h(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),d(e),c(e,t),g(e,t)}function g(t,n){var r=i(t,e.find(t.nodes(),function(e){return!n.node(e).parent}));r=r.slice(1),e.forEach(r,function(e){var r=t.node(e).parent,i=n.edge(e,r),a=!1;i||(i=n.edge(r,e),a=!0),n.node(e).rank=n.node(r).rank+(a?i.minlen:-i.minlen)})}function _(e,t,n){return e.hasEdge(t,n)}function v(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}return Tg}var Og,kg;function Ag(){if(kg)return Og;kg=1;var e=xg().longestPath,t=wg(),n=Dg();Og=r;function r(e){switch(e.graph().ranker){case`network-simplex`:o(e);break;case`tight-tree`:a(e);break;case`longest-path`:i(e);break;default:o(e)}}var i=e;function a(n){e(n),t(n)}function o(e){n(e)}return Og}var jg,Mg;function Ng(){if(Mg)return jg;Mg=1;var e=Q();jg=t;function t(t){var i=r(t);e.forEach(t.graph().dummyChains,function(e){for(var r=t.node(e),a=r.edgeObj,o=n(t,i,a.v,a.w),s=o.path,c=o.lca,l=0,u=s[l],d=!0;e!==a.w;){if(r=t.node(e),d){for(;(u=s[l])!==c&&t.node(u).maxRank<r.rank;)l++;u===c&&(d=!1)}if(!d){for(;l<s.length-1&&t.node(u=s[l+1]).minRank<=r.rank;)l++;u=s[l]}t.setParent(e,u),e=t.successors(e)[0]}})}function n(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function r(t){var n={},r=0;function i(a){var o=r;e.forEach(t.children(a),i),n[a]={low:o,lim:r++}}return e.forEach(t.children(),i),n}return jg}var Pg,Fg;function Ig(){if(Fg)return Pg;Fg=1;var e=Q(),t=$();Pg={run:n,cleanup:o};function n(n){var o=t.addDummyNode(n,`root`,{},`_root`),s=i(n),c=e.max(e.values(s))-1,l=2*c+1;n.graph().nestingRoot=o,e.forEach(n.edges(),function(e){n.edge(e).minlen*=l});var u=a(n)+1;e.forEach(n.children(),function(e){r(n,o,l,u,c,s,e)}),n.graph().nodeRankFactor=l}function r(n,i,a,o,s,c,l){var u=n.children(l);if(!u.length){l!==i&&n.setEdge(i,l,{weight:0,minlen:a});return}var d=t.addBorderNode(n,`_bt`),f=t.addBorderNode(n,`_bb`),p=n.node(l);n.setParent(d,l),p.borderTop=d,n.setParent(f,l),p.borderBottom=f,e.forEach(u,function(e){r(n,i,a,o,s,c,e);var t=n.node(e),u=t.borderTop?t.borderTop:e,p=t.borderBottom?t.borderBottom:e,m=t.borderTop?o:2*o,h=u===p?s-c[l]+1:1;n.setEdge(d,u,{weight:m,minlen:h,nestingEdge:!0}),n.setEdge(p,f,{weight:m,minlen:h,nestingEdge:!0})}),n.parent(l)||n.setEdge(i,d,{weight:0,minlen:s+c[l]})}function i(t){var n={};function r(i,a){var o=t.children(i);o&&o.length&&e.forEach(o,function(e){r(e,a+1)}),n[i]=a}return e.forEach(t.children(),function(e){r(e,1)}),n}function a(t){return e.reduce(t.edges(),function(e,n){return e+t.edge(n).weight},0)}function o(t){var n=t.graph();t.removeNode(n.nestingRoot),delete n.nestingRoot,e.forEach(t.edges(),function(e){t.edge(e).nestingEdge&&t.removeEdge(e)})}return Pg}var Lg,Rg;function zg(){if(Rg)return Lg;Rg=1;var e=Q(),t=$();Lg=n;function n(t){function n(i){var a=t.children(i),o=t.node(i);if(a.length&&e.forEach(a,n),e.has(o,`minRank`)){o.borderLeft=[],o.borderRight=[];for(var s=o.minRank,c=o.maxRank+1;s<c;++s)r(t,`borderLeft`,`_bl`,i,o,s),r(t,`borderRight`,`_br`,i,o,s)}}e.forEach(t.children(),n)}function r(e,n,r,i,a,o){var s={width:0,height:0,rank:o,borderType:n},c=a[n][o-1],l=t.addDummyNode(e,`border`,s,r);a[n][o]=l,e.setParent(l,i),c&&e.setEdge(c,l,{weight:1})}return Lg}var Bg,Vg;function Hg(){if(Vg)return Bg;Vg=1;var e=Q();Bg={adjust:t,undo:n};function t(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&r(e)}function n(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&a(e),(t===`lr`||t===`rl`)&&(s(e),r(e))}function r(t){e.forEach(t.nodes(),function(e){i(t.node(e))}),e.forEach(t.edges(),function(e){i(t.edge(e))})}function i(e){var t=e.width;e.width=e.height,e.height=t}function a(t){e.forEach(t.nodes(),function(e){o(t.node(e))}),e.forEach(t.edges(),function(n){var r=t.edge(n);e.forEach(r.points,o),e.has(r,`y`)&&o(r)})}function o(e){e.y=-e.y}function s(t){e.forEach(t.nodes(),function(e){c(t.node(e))}),e.forEach(t.edges(),function(n){var r=t.edge(n);e.forEach(r.points,c),e.has(r,`x`)&&c(r)})}function c(e){var t=e.x;e.x=e.y,e.y=t}return Bg}var Ug,Wg;function Gg(){if(Wg)return Ug;Wg=1;var e=Q();Ug=t;function t(t){var n={},r=e.filter(t.nodes(),function(e){return!t.children(e).length}),i=e.max(e.map(r,function(e){return t.node(e).rank})),a=e.map(e.range(i+1),function(){return[]});function o(r){e.has(n,r)||(n[r]=!0,a[t.node(r).rank].push(r),e.forEach(t.successors(r),o))}var s=e.sortBy(r,function(e){return t.node(e).rank});return e.forEach(s,o),a}return Ug}var Kg,qg;function Jg(){if(qg)return Kg;qg=1;var e=Q();Kg=t;function t(e,t){for(var r=0,i=1;i<t.length;++i)r+=n(e,t[i-1],t[i]);return r}function n(t,n,r){for(var i=e.zipObject(r,e.map(r,function(e,t){return t})),a=e.flatten(e.map(n,function(n){return e.sortBy(e.map(t.outEdges(n),function(e){return{pos:i[e.w],weight:t.edge(e).weight}}),`pos`)}),!0),o=1;o<r.length;)o<<=1;var s=2*o-1;--o;var c=e.map(Array(s),function(){return 0}),l=0;return e.forEach(a.forEach(function(e){var t=e.pos+o;c[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=c[t+1]),t=t-1>>1,c[t]+=e.weight;l+=e.weight*n})),l}return Kg}var Yg,Xg;function Zg(){if(Xg)return Yg;Xg=1;var e=Q();Yg=t;function t(t,n){return e.map(n,function(n){var r=t.inEdges(n);if(r.length){var i=e.reduce(r,function(e,n){var r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:n,barycenter:i.sum/i.weight,weight:i.weight}}return{v:n}})}return Yg}var Qg,$g;function e_(){if($g)return Qg;$g=1;var e=Q();Qg=t;function t(t,r){var i={};return e.forEach(t,function(t,n){var r=i[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:n};e.isUndefined(t.barycenter)||(r.barycenter=t.barycenter,r.weight=t.weight)}),e.forEach(r.edges(),function(t){var n=i[t.v],r=i[t.w];!e.isUndefined(n)&&!e.isUndefined(r)&&(r.indegree++,n.out.push(i[t.w]))}),n(e.filter(i,function(e){return!e.indegree}))}function n(t){var n=[];function i(t){return function(n){n.merged||(e.isUndefined(n.barycenter)||e.isUndefined(t.barycenter)||n.barycenter>=t.barycenter)&&r(t,n)}}function a(e){return function(n){n.in.push(e),--n.indegree===0&&t.push(n)}}for(;t.length;){var o=t.pop();n.push(o),e.forEach(o.in.reverse(),i(o)),e.forEach(o.out,a(o))}return e.map(e.filter(n,function(e){return!e.merged}),function(t){return e.pick(t,[`vs`,`i`,`barycenter`,`weight`])})}function r(e,t){var 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}return Qg}var t_,n_;function r_(){if(n_)return t_;n_=1;var e=Q(),t=$();t_=n;function n(n,a){var o=t.partition(n,function(t){return e.has(t,`barycenter`)}),s=o.lhs,c=e.sortBy(o.rhs,function(e){return-e.i}),l=[],u=0,d=0,f=0;s.sort(i(!!a)),f=r(l,c,f),e.forEach(s,function(e){f+=e.vs.length,l.push(e.vs),u+=e.barycenter*e.weight,d+=e.weight,f=r(l,c,f)});var p={vs:e.flatten(l,!0)};return d&&(p.barycenter=u/d,p.weight=d),p}function r(t,n,r){for(var i;n.length&&(i=e.last(n)).i<=r;)n.pop(),t.push(i.vs),r++;return r}function i(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}return t_}var i_,a_;function o_(){if(a_)return i_;a_=1;var e=Q(),t=Zg(),n=e_(),r=r_();i_=i;function i(s,c,l,u){var d=s.children(c),f=s.node(c),p=f?f.borderLeft:void 0,m=f?f.borderRight:void 0,h={};p&&(d=e.filter(d,function(e){return e!==p&&e!==m}));var g=t(s,d);e.forEach(g,function(t){if(s.children(t.v).length){var n=i(s,t.v,l,u);h[t.v]=n,e.has(n,`barycenter`)&&o(t,n)}});var _=n(g,l);a(_,h);var v=r(_,u);if(p&&(v.vs=e.flatten([p,v.vs,m],!0),s.predecessors(p).length)){var y=s.node(s.predecessors(p)[0]),b=s.node(s.predecessors(m)[0]);e.has(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+y.order+b.order)/(v.weight+2),v.weight+=2}return v}function a(t,n){e.forEach(t,function(t){t.vs=e.flatten(t.vs.map(function(e){return n[e]?n[e].vs:e}),!0)})}function o(t,n){e.isUndefined(t.barycenter)?(t.barycenter=n.barycenter,t.weight=n.weight):(t.barycenter=(t.barycenter*t.weight+n.barycenter*n.weight)/(t.weight+n.weight),t.weight+=n.weight)}return i_}var s_,c_;function l_(){if(c_)return s_;c_=1;var e=Q(),t=Z().Graph;s_=n;function n(n,i,a){var o=r(n),s=new t({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(e){return n.node(e)});return e.forEach(n.nodes(),function(t){var r=n.node(t),c=n.parent(t);(r.rank===i||r.minRank<=i&&i<=r.maxRank)&&(s.setNode(t),s.setParent(t,c||o),e.forEach(n[a](t),function(r){var i=r.v===t?r.w:r.v,a=s.edge(i,t),o=e.isUndefined(a)?0:a.weight;s.setEdge(i,t,{weight:n.edge(r).weight+o})}),e.has(r,`minRank`)&&s.setNode(t,{borderLeft:r.borderLeft[i],borderRight:r.borderRight[i]}))}),s}function r(t){for(var n;t.hasNode(n=e.uniqueId(`_root`)););return n}return s_}var u_,d_;function f_(){if(d_)return u_;d_=1;var e=Q();u_=t;function t(t,n,r){var i={},a;e.forEach(r,function(e){for(var r=t.parent(e),o,s;r;){if(o=t.parent(r),o?(s=i[o],i[o]=r):(s=a,a=r),s&&s!==r){n.setEdge(s,r);return}r=o}})}return u_}var p_,m_;function h_(){if(m_)return p_;m_=1;var e=Q(),t=Gg(),n=Jg(),r=o_(),i=l_(),a=f_(),o=Z().Graph,s=$();p_=c;function c(r){var i=s.maxRank(r),a=l(r,e.range(1,i+1),`inEdges`),o=l(r,e.range(i-1,-1,-1),`outEdges`),c=t(r);d(r,c);for(var f=1/0,p,m=0,h=0;h<4;++m,++h){u(m%2?a:o,m%4>=2),c=s.buildLayerMatrix(r);var g=n(r,c);g<f&&(h=0,p=e.cloneDeep(c),f=g)}d(r,p)}function l(t,n,r){return e.map(n,function(e){return i(t,e,r)})}function u(t,n){var i=new o;e.forEach(t,function(t){var o=t.graph().root,s=r(t,o,i,n);e.forEach(s.vs,function(e,n){t.node(e).order=n}),a(t,i,s.vs)})}function d(t,n){e.forEach(n,function(n){e.forEach(n,function(e,n){t.node(e).order=n})})}return p_}var g_,__;function v_(){if(__)return g_;__=1;var e=Q(),t=Z().Graph,n=$();g_={positionX:m,findType1Conflicts:r,findType2Conflicts:i,addConflict:o,hasConflict:s,verticalAlignment:c,horizontalCompaction:l,alignCoordinates:f,findSmallestWidthAlignment:d,balance:p};function r(t,n){var r={};function i(n,i){var s=0,c=0,l=n.length,u=e.last(i);return e.forEach(i,function(n,d){var f=a(t,n),p=f?t.node(f).order:l;(f||n===u)&&(e.forEach(i.slice(c,d+1),function(n){e.forEach(t.predecessors(n),function(e){var i=t.node(e),a=i.order;(a<s||p<a)&&!(i.dummy&&t.node(n).dummy)&&o(r,e,n)})}),c=d+1,s=p)}),i}return e.reduce(n,i),r}function i(t,n){var r={};function i(n,i,a,s,c){var l;e.forEach(e.range(i,a),function(i){l=n[i],t.node(l).dummy&&e.forEach(t.predecessors(l),function(e){var n=t.node(e);n.dummy&&(n.order<s||n.order>c)&&o(r,e,l)})})}function a(n,r){var a=-1,o,s=0;return e.forEach(r,function(e,c){if(t.node(e).dummy===`border`){var l=t.predecessors(e);l.length&&(o=t.node(l[0]).order,i(r,s,c,a,o),s=c,a=o)}i(r,s,r.length,o,n.length)}),r}return e.reduce(n,a),r}function a(t,n){if(t.node(n).dummy)return e.find(t.predecessors(n),function(e){return t.node(e).dummy})}function o(e,t,n){if(t>n){var r=t;t=n,n=r}var i=e[t];i||(e[t]=i={}),i[n]=!0}function s(t,n,r){if(n>r){var i=n;n=r,r=i}return e.has(t[n],r)}function c(t,n,r,i){var a={},o={},c={};return e.forEach(n,function(t){e.forEach(t,function(e,t){a[e]=e,o[e]=e,c[e]=t})}),e.forEach(n,function(t){var n=-1;e.forEach(t,function(t){var l=i(t);if(l.length){l=e.sortBy(l,function(e){return c[e]});for(var u=(l.length-1)/2,d=Math.floor(u),f=Math.ceil(u);d<=f;++d){var p=l[d];o[t]===t&&n<c[p]&&!s(r,t,p)&&(o[p]=t,o[t]=a[t]=a[p],n=c[p])}}})}),{root:a,align:o}}function l(t,n,r,i,a){var o={},s=u(t,n,r,a),c=a?`borderLeft`:`borderRight`;function l(e,t){for(var n=s.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function d(e){o[e]=s.inEdges(e).reduce(function(e,t){return Math.max(e,o[t.v]+s.edge(t))},0)}function f(e){var n=s.outEdges(e).reduce(function(e,t){return Math.min(e,o[t.w]-s.edge(t))},1/0),r=t.node(e);n!==1/0&&r.borderType!==c&&(o[e]=Math.max(o[e],n))}return l(d,s.predecessors.bind(s)),l(f,s.successors.bind(s)),e.forEach(i,function(e){o[e]=o[r[e]]}),o}function u(n,r,i,a){var o=new t,s=n.graph(),c=h(s.nodesep,s.edgesep,a);return e.forEach(r,function(t){var r;e.forEach(t,function(e){var t=i[e];if(o.setNode(t),r){var a=i[r],s=o.edge(a,t);o.setEdge(a,t,Math.max(c(n,e,r),s||0))}r=e})}),o}function d(t,n){return e.minBy(e.values(n),function(n){var r=-1/0,i=1/0;return e.forIn(n,function(e,n){var a=g(t,n)/2;r=Math.max(e+a,r),i=Math.min(e-a,i)}),r-i})}function f(t,n){var r=e.values(n),i=e.min(r),a=e.max(r);e.forEach([`u`,`d`],function(r){e.forEach([`l`,`r`],function(o){var s=r+o,c=t[s],l;if(c!==n){var u=e.values(c);l=o===`l`?i-e.min(u):a-e.max(u),l&&(t[s]=e.mapValues(c,function(e){return e+l}))}})})}function p(t,n){return e.mapValues(t.ul,function(r,i){if(n)return t[n.toLowerCase()][i];var a=e.sortBy(e.map(t,i));return(a[1]+a[2])/2})}function m(t){var a=n.buildLayerMatrix(t),o=e.merge(r(t,a),i(t,a)),s={},u;return e.forEach([`u`,`d`],function(n){u=n===`u`?a:e.values(a).reverse(),e.forEach([`l`,`r`],function(r){r===`r`&&(u=e.map(u,function(t){return e.values(t).reverse()}));var i=(n===`u`?t.predecessors:t.successors).bind(t),a=c(t,u,o,i),d=l(t,u,a.root,a.align,r===`r`);r===`r`&&(d=e.mapValues(d,function(e){return-e})),s[n+r]=d})}),f(s,d(t,s)),p(s,t.graph().align)}function h(t,n,r){return function(i,a,o){var s=i.node(a),c=i.node(o),l=0,u;if(l+=s.width/2,e.has(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:u=-s.width/2;break;case`r`:u=s.width/2}if(u&&(l+=r?u:-u),u=0,l+=(s.dummy?n:t)/2,l+=(c.dummy?n:t)/2,l+=c.width/2,e.has(c,`labelpos`))switch(c.labelpos.toLowerCase()){case`l`:u=c.width/2;break;case`r`:u=-c.width/2}return u&&(l+=r?u:-u),u=0,l}}function g(e,t){return e.node(t).width}return g_}var y_,b_;function x_(){if(b_)return y_;b_=1;var e=Q(),t=$(),n=v_().positionX;y_=r;function r(r){r=t.asNonCompoundGraph(r),i(r),e.forEach(n(r),function(e,t){r.node(t).x=e})}function i(n){var r=t.buildLayerMatrix(n),i=n.graph().ranksep,a=0;e.forEach(r,function(t){var r=e.max(e.map(t,function(e){return n.node(e).height}));e.forEach(t,function(e){n.node(e).y=a+r/2}),a+=r+i})}return y_}var S_,C_;function w_(){if(C_)return S_;C_=1;var e=Q(),t=pg(),n=vg(),r=Ag(),i=$().normalizeRanks,a=Ng(),o=$().removeEmptyRanks,s=Ig(),c=zg(),l=Hg(),u=h_(),d=x_(),f=$(),p=Z().Graph;S_=m;function m(e,t){var n=t&&t.debugTiming?f.time:f.notime;n(`layout`,function(){var t=n(` buildLayoutGraph`,function(){return T(e)});n(` runLayout`,function(){h(t,n)}),n(` updateInputGraph`,function(){g(e,t)})})}function h(e,p){p(` makeSpaceForEdgeLabels`,function(){E(e)}),p(` removeSelfEdges`,function(){j(e)}),p(` acyclic`,function(){t.run(e)}),p(` nestingGraph.run`,function(){s.run(e)}),p(` rank`,function(){r(f.asNonCompoundGraph(e))}),p(` injectEdgeLabelProxies`,function(){D(e)}),p(` removeEmptyRanks`,function(){o(e)}),p(` nestingGraph.cleanup`,function(){s.cleanup(e)}),p(` normalizeRanks`,function(){i(e)}),p(` assignRankMinMax`,function(){O(e)}),p(` removeEdgeLabelProxies`,function(){k(e)}),p(` normalize.run`,function(){n.run(e)}),p(` parentDummyChains`,function(){a(e)}),p(` addBorderSegments`,function(){c(e)}),p(` order`,function(){u(e)}),p(` insertSelfEdges`,function(){M(e)}),p(` adjustCoordinateSystem`,function(){l.adjust(e)}),p(` position`,function(){d(e)}),p(` positionSelfEdges`,function(){N(e)}),p(` removeBorderNodes`,function(){re(e)}),p(` normalize.undo`,function(){n.undo(e)}),p(` fixupEdgeLabelCoords`,function(){ne(e)}),p(` undoCoordinateSystem`,function(){l.undo(e)}),p(` translateGraph`,function(){ee(e)}),p(` assignNodeIntersects`,function(){te(e)}),p(` reversePoints`,function(){A(e)}),p(` acyclic.undo`,function(){t.undo(e)})}function g(t,n){e.forEach(t.nodes(),function(e){var r=t.node(e),i=n.node(e);r&&(r.x=i.x,r.y=i.y,n.children(e).length&&(r.width=i.width,r.height=i.height))}),e.forEach(t.edges(),function(r){var i=t.edge(r),a=n.edge(r);i.points=a.points,e.has(a,`x`)&&(i.x=a.x,i.y=a.y)}),t.graph().width=n.graph().width,t.graph().height=n.graph().height}var _=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],v={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},y=[`acyclicer`,`ranker`,`rankdir`,`align`],b=[`width`,`height`],x={width:0,height:0},S=[`minlen`,`weight`,`width`,`height`,`labeloffset`],C={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},w=[`labelpos`];function T(t){var n=new p({multigraph:!0,compound:!0}),r=P(t.graph());return n.setGraph(e.merge({},v,ie(r,_),e.pick(r,y))),e.forEach(t.nodes(),function(r){var i=P(t.node(r));n.setNode(r,e.defaults(ie(i,b),x)),n.setParent(r,t.parent(r))}),e.forEach(t.edges(),function(r){var i=P(t.edge(r));n.setEdge(r,e.merge({},C,ie(i,S),e.pick(i,w)))}),n}function E(t){var n=t.graph();n.ranksep/=2,e.forEach(t.edges(),function(e){var r=t.edge(e);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(n.rankdir===`TB`||n.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function D(t){e.forEach(t.edges(),function(e){var n=t.edge(e);if(n.width&&n.height){var r=t.node(e.v),i={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};f.addDummyNode(t,`edge-proxy`,i,`_ep`)}})}function O(t){var n=0;e.forEach(t.nodes(),function(r){var i=t.node(r);i.borderTop&&(i.minRank=t.node(i.borderTop).rank,i.maxRank=t.node(i.borderBottom).rank,n=e.max(n,i.maxRank))}),t.graph().maxRank=n}function k(t){e.forEach(t.nodes(),function(e){var n=t.node(e);n.dummy===`edge-proxy`&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}function ee(t){var n=1/0,r=0,i=1/0,a=0,o=t.graph(),s=o.marginx||0,c=o.marginy||0;function l(e){var t=e.x,o=e.y,s=e.width,c=e.height;n=Math.min(n,t-s/2),r=Math.max(r,t+s/2),i=Math.min(i,o-c/2),a=Math.max(a,o+c/2)}e.forEach(t.nodes(),function(e){l(t.node(e))}),e.forEach(t.edges(),function(n){var r=t.edge(n);e.has(r,`x`)&&l(r)}),n-=s,i-=c,e.forEach(t.nodes(),function(e){var r=t.node(e);r.x-=n,r.y-=i}),e.forEach(t.edges(),function(r){var a=t.edge(r);e.forEach(a.points,function(e){e.x-=n,e.y-=i}),e.has(a,`x`)&&(a.x-=n),e.has(a,`y`)&&(a.y-=i)}),o.width=r-n+s,o.height=a-i+c}function te(t){e.forEach(t.edges(),function(e){var n=t.edge(e),r=t.node(e.v),i=t.node(e.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(f.intersectRect(r,a)),n.points.push(f.intersectRect(i,o))})}function ne(t){e.forEach(t.edges(),function(n){var r=t.edge(n);if(e.has(r,`x`))switch((r.labelpos===`l`||r.labelpos===`r`)&&(r.width-=r.labeloffset),r.labelpos){case`l`:r.x-=r.width/2+r.labeloffset;break;case`r`:r.x+=r.width/2+r.labeloffset}})}function A(t){e.forEach(t.edges(),function(e){var n=t.edge(e);n.reversed&&n.points.reverse()})}function re(t){e.forEach(t.nodes(),function(n){if(t.children(n).length){var r=t.node(n),i=t.node(r.borderTop),a=t.node(r.borderBottom),o=t.node(e.last(r.borderLeft)),s=t.node(e.last(r.borderRight));r.width=Math.abs(s.x-o.x),r.height=Math.abs(a.y-i.y),r.x=o.x+r.width/2,r.y=i.y+r.height/2}}),e.forEach(t.nodes(),function(e){t.node(e).dummy===`border`&&t.removeNode(e)})}function j(t){e.forEach(t.edges(),function(e){if(e.v===e.w){var n=t.node(e.v);n.selfEdges||=[],n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function M(t){var n=f.buildLayerMatrix(t);e.forEach(n,function(n){var r=0;e.forEach(n,function(n,i){var a=t.node(n);a.order=i+r,e.forEach(a.selfEdges,function(e){f.addDummyNode(t,`selfedge`,{width:e.label.width,height:e.label.height,rank:a.rank,order:i+ ++r,e:e.e,label:e.label},`_se`)}),delete a.selfEdges})})}function N(t){e.forEach(t.nodes(),function(e){var n=t.node(e);if(n.dummy===`selfedge`){var r=t.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function ie(t,n){return e.mapValues(e.pick(t,n),Number)}function P(t){var n={};return e.forEach(t,function(e,t){n[t.toLowerCase()]=e}),n}return S_}var T_,E_;function D_(){if(E_)return T_;E_=1;var e=Q(),t=$(),n=Z().Graph;T_={debugOrdering:r};function r(r){var i=t.buildLayerMatrix(r),a=new n({compound:!0,multigraph:!0}).setGraph({});return e.forEach(r.nodes(),function(e){a.setNode(e,{label:e}),a.setParent(e,`layer`+r.node(e).rank)}),e.forEach(r.edges(),function(e){a.setEdge(e.v,e.w,{},e.name)}),e.forEach(i,function(t,n){var r=`layer`+n;a.setNode(r,{rank:`same`}),e.reduce(t,function(e,t){return a.setEdge(e,t,{style:`invis`}),t})}),a}return T_}var O_,k_;function A_(){return k_?O_:(k_=1,O_=`0.8.5`,O_)}var j_,M_;function N_(){return M_?j_:(M_=1,j_={graphlib:Z(),layout:w_(),debug:D_(),util:{time:$().time,notime:$().notime},version:A_()},j_)}var P_=N_(),F_=It(P_),I_=function(e){return Nt(e,`Boolean`)};function L_(e,t){if(e){var n;if(kt(e))for(var r=0,i=e.length;r<i&&(n=t(e[r],r),n!==!1);r++);else if(At(e)){for(var a in e)if(e.hasOwnProperty(a)&&(n=t(e[a],a),n===!1))break}}}var R_=Object.prototype.hasOwnProperty,z_=(function(e,t){if(e===null||!Pt(e))return{};var n={};return L_(t,function(t){R_.call(e,t)&&(n[t]=e[t])}),n}),B_=class extends Ot{constructor(){super(...arguments),this.id=`dagre`,this.isCompoundGraph=null,this.config={graphAttributes:[`rankdir`,`align`,`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`,`acyclicer`,`ranker`],nodeAttributes:[`width`,`height`],edgeAttributes:[`minlen`,`weight`,`width`,`height`,`labelpos`,`labeloffset`]}}getDefaultOptions(){return{directed:!0,multigraph:!0,rankdir:`TB`,align:void 0,nodesep:50,edgesep:10,ranksep:50,marginx:0,marginy:0,acyclicer:void 0,ranker:`network-simplex`,nodeSize:[0,0],edgeMinLen:1,edgeWeight:1,edgeLabelSize:[0,0],edgeLabelPos:`r`,edgeLabelOffset:10}}layout(){return _e(this,void 0,void 0,function*(){let e=new P_.graphlib.Graph({directed:!!this.options.directed,multigraph:!!this.options.multigraph,compound:this.isCompound()});e.setGraph(z_(this.options,this.config.graphAttributes)),e.setDefaultEdgeLabel(()=>({}));let t=Ge(this.options.nodeSize,0);this.model.forEachNode(n=>{let r=n._original,[i,a]=ze(t(r)),o={width:i,height:a};if(e.setNode(String(n.id),o),this.isCompound()){if(B(n.parentId))return;e.setParent(String(n.id),String(n.parentId))}});let{edgeLabelSize:n,edgeLabelOffset:r,edgeLabelPos:i,edgeMinLen:a,edgeWeight:o}=this.options,s=Ge(n,0,`edge`),c=We(r,10,`edge`),l=typeof i==`string`?()=>i:Ue(i,[`edge`]),u=We(a,1,`edge`),d=We(o,1,`edge`);this.model.forEachEdge(t=>{let n=t._original,[r,i]=ze(s(n)),a={width:r,height:i,labelpos:l(n),labeloffset:c(n),minlen:u(n),weight:d(n)};e.setEdge(String(t.source),String(t.target),a,String(t.id))}),F_.layout(e),this.model.forEachNode(t=>{let n=e.node(String(t.id));n&&(t.x=n.x,t.y=n.y,t.size=[n.width,n.height])}),this.model.forEachEdge(t=>{let n=e.edge(String(t.source),String(t.target),String(t.id));if(!n)return;let{width:r,height:i,weight:a,minlen:o,labelpos:s,labeloffset:c,points:l}=n;t.labelSize=[r,i],t.weight=a,t.minLen=o,t.labelPos=s,t.labelOffset=c,t.points=l.map(Ke)})})}isCompound(){return this.isCompoundGraph===null?I_(this.options.compound)?this.isCompoundGraph=this.options.compound:(this.isCompoundGraph=this.model.nodes().some(e=>!B(e.parentId)),this.isCompoundGraph):this.isCompoundGraph}},V_=26,H_=72,U_=(e,t,n)=>{let r=(e,t)=>{let n=Array.from(new Set(e)).sort((e,t)=>e-t),r=[];for(let e of n)(r.length===0||e-r[r.length-1]>t)&&r.push(e);return r},i=r(e.map(e=>t.get(e.id)),V_),a=r(e.map(e=>n.get(e.id)),H_),o=(e,t)=>{let n=0;for(let r=1;r<e.length;r++)Math.abs(e[r]-t)<Math.abs(e[n]-t)&&(n=r);return n},s=new Map,c=new Map;for(let r of e)s.set(r.id,o(i,t.get(r.id))),c.set(r.id,o(a,n.get(r.id)));return{col:s,row:c,ncols:i.length,nrows:a.length}},W_=(e,t,n)=>{let r=e.get(t);r===void 0?e.set(t,[n]):r.push(n)},G_=(e,t,n,r)=>{let i=new Set;for(let t of e)i.add(`${n.get(t.id)}:${r.get(t.id)}`);let a=new Map;for(let e of t)e.source!==e.target&&(W_(a,e.source,e.target),W_(a,e.target,e.source));for(let t of e){let e=a.get(t.id);if(e===void 0)continue;let o=e.map(e=>r.get(e)).sort((e,t)=>e-t),s=o[Math.floor((o.length-1)/2)],c=r.get(t.id),l=Math.abs(s-c);if(l===0)continue;let u=Math.sign(s-c),d;if(l===1){if(!e.some(e=>r.get(e)===s&&Math.abs(n.get(e)-n.get(t.id))===1))continue;d=s}else d=c+u*Math.ceil(l/2);for(let e=d;e!==c;e-=u)if(!i.has(`${n.get(t.id)}:${e}`)){i.delete(`${n.get(t.id)}:${c}`),i.add(`${n.get(t.id)}:${e}`),r.set(t.id,e);break}}},K_=(e,t,n)=>{let r=e.map(e=>{if(e.source===e.target)return{chans:[],guts:[]};let r=t.get(e.source),i=t.get(e.target),a=n.get(e.source),o=n.get(e.target),s,c=[];return r===i?s=[r]:Math.abs(r-i)===1?s=[Math.min(r,i)]:(s=[r<i?r:r-1,r<i?i-1:i],c=[o>a?o-1:o]),{chans:s,guts:c}}),i=new Map,a=new Map;for(let e of r){for(let t of e.chans)i.set(t,(i.get(t)??0)+1);for(let t of e.guts)a.set(t,(a.get(t)??0)+1)}return{plans:r,chanCnt:i,gutCnt:a}},q_=(e,t,n,r,i,a,o,s,c,l)=>{let u=Array.from({length:a},()=>0),d=Array.from({length:o},()=>0);for(let a of e)u[t.get(a.id)]=Math.max(u[t.get(a.id)],r.get(a.id)),d[n.get(a.id)]=Math.max(d[n.get(a.id)],i.get(a.id));let f=Array.from({length:a},(e,t)=>{let n=s.get(t)??0;return n===0?24:Math.min(l[`graph-channel-width-max`],28+(n-1)*l[`size-edge-track-gap`])}),p=Array.from({length:o},(e,t)=>{let n=c.get(t)??0;return n===0?20:Math.min(l[`graph-gutter-height-max`],24+(n-1)*l[`size-edge-track-gap`])}),m=[],h=[],g=l[`size-canvas-margin`];for(let e=0;e<u.length;e++)m.push(g+u[e]/2),g+=u[e]+f[e];let _=l[`size-canvas-margin`];for(let e=0;e<d.length;e++)h.push(_+d[e]/2),_+=d[e]+p[e];return{colWidth:u,rowHeight:d,chanW:f,gutH:p,colCX:m,rowCY:h}},J_=(e,t,n,r,i,a)=>{let{colWidth:o,rowHeight:s,chanW:c,gutH:l,colCX:u,rowCY:d}=i,f=e=>d[e]+s[e]/2+l[e]/2,p=new Map;e.forEach((e,i)=>{let{chans:a,guts:o}=t[i];if(a.length===0)return;let s=n.get(e.target)<n.get(e.source),c=r.get(`${i}:s`),l=r.get(`${i}:t`);if(a.length===1)W_(p,a[0],{edge:i,posIn:c.y,posOut:l.y,mirror:s});else{let e=f(o[0]);W_(p,a[0],{edge:i,posIn:c.y,posOut:e,mirror:s}),W_(p,a[1],{edge:i,posIn:e,posOut:l.y,mirror:s})}});let m=new Map;for(let[e,t]of p)for(let[n,r]of ae(t,c[e],16,a[`size-edge-track-gap`]))m.set(`${e}:${n}`,r);let h=(e,t)=>u[e]+o[e]/2+c[e]/2+m.get(`${e}:${t}`),g=new Map;e.forEach((e,n)=>{let{chans:i,guts:a}=t[n];if(a.length===0)return;let o=r.get(`${n}:s`);W_(g,a[0],{edge:n,posIn:h(i[0],n),posOut:h(i[1],n),mirror:o.y>f(a[0])})});let _=new Map;for(let[e,t]of g)for(let[n,r]of ae(t,l[e],12,a[`size-edge-track-gap`]))_.set(`${e}:${n}`,r);return{chanX:h,gutY:(e,t)=>f(e)+_.get(`${e}:${t}`)}},Y_=(e,t,n,r,i,a,o,s,c)=>{let l=new Map;return e.map((e,u)=>{let d=n.get(e.source),f=n.get(e.target),p=r.get(`${u}:s`),m=r.get(`${u}:t`),{chans:h,guts:g}=t[u],_;if(e.source===e.target){let t=l.get(e.source)??0;l.set(e.source,t+1);let n=a(e.source)+i.get(e.source)/2+24+t*c[`size-edge-track-gap`];_=[[p.x,p.y],[n,p.y],[n,m.y],[m.x,m.y]]}else if(h.length===1){let e=o(h[0],u);_=Math.abs(d-f)===1&&p.y===m.y?[[p.x,p.y],[m.x,m.y]]:[[p.x,p.y],[e,p.y],[e,m.y],[m.x,m.y]]}else{let e=o(h[0],u),t=o(h[1],u),n=s(g[0],u);_=[[p.x,p.y],[e,p.y],[e,n],[t,n],[t,m.y],[m.x,m.y]]}return P(_)})},X_=async(e,t)=>{let n=Array.from(e.nodes.values()),r=e.edges,{boxW:i,boxH:a,contentH:o}=N(n,t,()=>t[`size-node-height-scale`]),s=new B_({rankdir:`LR`,nodesep:t[`graph-node-separation`],ranksep:t[`graph-rank-separation`],nodeSize:e=>e.size});await s.execute({nodes:n.map(e=>({id:e.id,size:[i.get(e.id),a.get(e.id)]})),edges:r.map((e,t)=>({id:`e${t}`,source:e.source,target:e.target}))});let c=new Map,l=new Map;s.forEachNode(e=>{c.set(String(e.id),e.x),l.set(String(e.id),e.y)});let{col:u,row:d,ncols:f,nrows:p}=U_(n,c,l);G_(n,r,u,d);let m=Math.max(Math.floor(t[`graph-columns-max`]),1);if(f>m)for(let e of n){let t=u.get(e.id);u.set(e.id,t%m),d.set(e.id,d.get(e.id)+Math.floor(t/m)*p)}let h=Math.min(f,m),g=Array.from(new Set(n.map(e=>d.get(e.id)))).sort((e,t)=>e-t),_=new Map(g.map((e,t)=>[e,t]));for(let e of n)d.set(e.id,_.get(d.get(e.id)));let v=g.length,{plans:y,chanCnt:b,gutCnt:x}=K_(r,u,d),S=q_(n,u,d,i,a,h,v,b,x,t),C=e=>S.colCX[u.get(e)],w=e=>S.rowCY[d.get(e)],T=F(r,r.map(e=>{let t=u.get(e.source),n=u.get(e.target);return t<n?{s:`e`,t:`w`}:t>n?{s:`w`,t:`e`}:{s:`e`,t:`e`}}),C,w,i,a),{chanX:E,gutY:D}=J_(r,y,u,T,S,t);return{nodes:n,edges:r,cx:C,cy:w,boxW:i,boxH:a,contentH:o,polys:Y_(r,y,u,T,i,C,E,D,t)}},Z_=`\0`,Q_=e=>{let t=Array.from(e.nodes.values());for(let e of t)if(e.id.includes(Z_))throw Error(`node id ${JSON.stringify(e.id)} contains a reserved control character`);let n=t.filter(k);if(n.length!==1)throw Error(`expected exactly one node annotated with "primary: true" (found ${n.length})`);let r=n[0],i=new Set,a=new Set;for(let t of e.edges)if(t.source===r.id&&t.target===r.id)throw Error(`self-loop on primary node "${r.id}" not supported`);else if(t.target===r.id)i.add(t.source);else if(t.source===r.id)a.add(t.target);else throw Error(`edge "${t.source}" --> "${t.target}" does not connect to primary node "${r.id}"`);let o=new Set,s=[],c=[];for(let e of t){if(e.id===r.id)continue;let t=i.has(e.id),n=a.has(e.id);if(!t&&!n)throw Error(`node "${e.id}" is neither input nor output of primary node "${r.id}"`);t&&n?(o.add(e.id),s.push({...e,id:e.id+`\0in`}),c.push({...e,id:e.id+`\0out`})):t?s.push(e):c.push(e)}let l=e.edges.map(e=>e.target===r.id&&o.has(e.source)?{...e,source:e.source+`\0in`}:e.source===r.id&&o.has(e.target)?{...e,target:e.target+`\0out`}:e);return{center:r,inputs:s,outputs:c,nodes:[r,...s,...c],edges:l}},$_={graph:X_,hub:async(e,t)=>{let{center:n,inputs:r,outputs:i,nodes:a,edges:o}=Q_(e),s=new Set(r.map(e=>e.id)),c=t[`size-canvas-margin`],l=t[`hub-node-gap`],u=t[`size-node-height-scale`],d=e=>e===n.id?1:s.has(e)?0:2,{boxW:f,boxH:p,contentH:m}=N(a,t,()=>u/2),h=new Map;for(let e of o){let t=d(e.source)<d(e.target)?`e`:`w`,n=t===`e`?`w`:`e`;h.set(`${t}:${e.source}`,(h.get(`${t}:${e.source}`)??0)+1),h.set(`${n}:${e.target}`,(h.get(`${n}:${e.target}`)??0)+1)}for(let e of a){let n=Math.max(h.get(`w:${e.id}`)??0,h.get(`e:${e.id}`)??0);n>t[`hub-node-degree-max`]&&p.set(e.id,p.get(e.id)+(n-t[`hub-node-degree-max`])*24)}let g=e=>e.reduce((e,t)=>e+p.get(t.id),0)+Math.max(e.length-1,0)*l,_=Math.max(g(r),p.get(n.id),g(i)),v=new Map,y=e=>{let t=c+(_-g(e))/2;for(let n of e)v.set(n.id,t+p.get(n.id)/2),t+=p.get(n.id)+l};y(r),y(i),v.set(n.id,c+_/2);let b=[r.reduce((e,t)=>Math.max(e,f.get(t.id)),0),f.get(n.id),i.reduce((e,t)=>Math.max(e,f.get(t.id)),0)],x=e=>Math.min(d(e.source),d(e.target)),S=[o.filter(e=>x(e)===0).length,o.filter(e=>x(e)===1).length].map(e=>Math.min(t[`hub-channel-width-max`],Math.max(t[`hub-channel-width-min`],28+(e-1)*t[`size-edge-track-gap`]))),C=[],w=c;for(let e=0;e<3;e++)C.push(w),w+=b[e]+(e<2?S[e]:0);let T=e=>{let t=d(e);return t===0?C[0]+b[0]-f.get(e)/2:t===2?C[2]+f.get(e)/2:C[1]+b[1]/2},E=e=>v.get(e),D=F(o,o.map(e=>d(e.source)<d(e.target)?{s:`e`,t:`w`}:{s:`w`,t:`e`}),T,E,f,p),O=[[],[]];o.forEach((e,t)=>{O[x(e)].push({edge:t,posIn:D.get(`${t}:s`).y,posOut:D.get(`${t}:t`).y,mirror:!1})});let k=new Map;O.forEach((e,n)=>{for(let[r,i]of ae(e,S[n],16,t[`size-edge-track-gap`]))k.set(`${n}:${r}`,i)});let te=(e,t)=>C[e]+b[e]+S[e]/2+k.get(`${e}:${t}`);return{nodes:a,edges:o,cx:T,cy:E,boxW:f,boxH:p,contentH:m,polys:o.map((e,t)=>{let n=D.get(`${t}:s`),r=D.get(`${t}:t`),i=te(x(e),t),a;return a=n.y===r.y?[[n.x,n.y],[r.x,r.y]]:[[n.x,n.y],[i,n.y],[i,r.y],[r.x,r.y]],P(a)}),styleOf:e=>e.id.endsWith(`\0out`)?{fill:`color-node-ghost-box`,stroke:`color-node-ghost-border`,text:`color-node-ghost-name`,dash:`10 6`}:ee(e)}},grid:async(e,t)=>{let n=Array.from(e.nodes.values()),r=t[`size-canvas-margin`],i=t[`grid-gap-horizontal`],a=t[`grid-gap-vertical`],o=Math.max(Math.floor(t[`grid-columns-max`]),1);if(e.edges.length>0){let t=e.edges[0];throw Error(`diagram type "grid" does not support edges (found ${e.edges.length}, first is "${t.source}" --> "${t.target}")`)}let{boxW:s,boxH:c,contentH:l}=N(n,t,()=>t[`size-node-height-scale`]/2),u=n.reduce((e,t)=>Math.max(e,c.get(t.id)),0);for(let e of n)c.set(e.id,u);let d=Math.max(Math.min(Math.ceil(Math.sqrt(n.length)),o),1),f=Array.from({length:d},()=>0);n.forEach((e,t)=>{f[t%d]=Math.max(f[t%d],s.get(e.id))});let p=[],m=r;for(let e=0;e<d;e++)p.push(m),m+=f[e]+i;let h=new Map,g=new Map;return n.forEach((e,t)=>{h.set(e.id,p[t%d]+s.get(e.id)/2),g.set(e.id,r+Math.floor(t/d)*(u+a)+u/2)}),{nodes:n,edges:[],cx:e=>h.get(e),cy:e=>g.get(e),boxW:s,boxH:c,contentH:l,polys:[]}}},ev=Object.keys($_),tv=`graph`,nv=e=>{let t;for(let n of e.split(/\r?\n/)){let e=/^[ \t]*#type[ \t]+([a-z][a-z0-9-]*)[ \t]*$/.exec(n);e===null||!Object.hasOwn($_,e[1])||(t=e[1])}return t},rv=[`svg:standalone`,`svg:embedded`,`url:xml`,`url:base64`];e.Gradia=class e{static config=p;static parse(e){return d(e)}static async generate(e,t={}){let n=t.type??`graph`;if(!Object.hasOwn($_,n))throw Error(`invalid diagram type "${n}"`);let r=t.format??`svg:standalone`;if(!rv.includes(r))throw Error(`invalid output format "${r}"`);let i=t.config??{},a={...p,...i},o=C(e),s=ge(o===null?await $_[n](e,a):T(o,await Promise.all(o.map(e=>$_[n](e.graph,a))),a),a,i);return r===`svg:embedded`?s.replace(/^<\?xml[^?]*\?>\n/,``):r===`url:xml`?`data:image/svg+xml,${encodeURIComponent(s)}`:r===`url:base64`?`data:image/svg+xml;base64,${Buffer.from(s,`utf8`).toString(`base64`)}`:s}static async render(t,n={}){let r=e.parse(t),i=n.type??nv(t),a={...h(t),...n.config??{}};return e.generate(r,{...n,type:i,config:a})}},e.diagramFormatDefault=`svg:standalone`,e.diagramFormats=rv,e.diagramTypeDefault=tv,e.diagramTypes=ev});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Object Graph Diagram Rendering",
|
|
4
4
|
"keywords": [ "object", "graph", "diagram", "rendering", "svg", "layout", "api", "cli" ],
|
|
5
5
|
"publishConfig": { "access": "public" },
|
|
6
|
-
"version": "0.9.
|
|
6
|
+
"version": "0.9.5",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Dr. Ralf S. Engelschall",
|