@mcp-graph-workflow/mcp-graph 5.13.0 → 5.14.0

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.
Files changed (22) hide show
  1. package/dist/web/dashboard/dist/assets/{benchmark-tab-BEhOzJlc.js → benchmark-tab-bAsb6b5p.js} +1 -1
  2. package/dist/web/dashboard/dist/assets/{context-tab-ByaP4N46.js → context-tab-C5KST5qM.js} +1 -1
  3. package/dist/web/dashboard/dist/assets/{gitnexus-tab-DJRcS3G4.js → gitnexus-tab-D394pCd3.js} +1 -1
  4. package/dist/web/dashboard/dist/assets/{graph-section-BaZ4D0V3.js → graph-section-CuB14sAc.js} +1 -1
  5. package/dist/web/dashboard/dist/assets/{graph-tab-DtcApd98.js → graph-tab-aL8V0k7E.js} +1 -1
  6. package/dist/web/dashboard/dist/assets/{graph-utils-D63XCNDU.js → graph-utils-DOsrZg2o.js} +1 -1
  7. package/dist/web/dashboard/dist/assets/{index-DQtPV3qe.js → index-B2nBqQj2.js} +1 -1
  8. package/dist/web/dashboard/dist/assets/{index-kFRgiPES.js → index-CGEJi5Pf.js} +51 -46
  9. package/dist/web/dashboard/dist/assets/{index-HSRYSwKs.js → index-DabDEe52.js} +1 -1
  10. package/dist/web/dashboard/dist/assets/index-bRmGsVKn.css +1 -0
  11. package/dist/web/dashboard/dist/assets/{insights-tab-T0-9T-Z4.js → insights-tab-DzBWnqLw.js} +1 -1
  12. package/dist/web/dashboard/dist/assets/{journey-tab-mvsQLYuc.js → journey-tab-Do_W90S1.js} +1 -1
  13. package/dist/web/dashboard/dist/assets/{logs-tab-HnGNd4kM.js → logs-tab-COo6RMr0.js} +1 -1
  14. package/dist/web/dashboard/dist/assets/lsp-tab-Cgj0U3s7.js +69 -0
  15. package/dist/web/dashboard/dist/assets/{memories-tab-DFzupuld.js → memories-tab-BxiHkGJB.js} +1 -1
  16. package/dist/web/dashboard/dist/assets/{prd-backlog-tab-D6rg9QUS.js → prd-backlog-tab-C6SbmrLs.js} +1 -1
  17. package/dist/web/dashboard/dist/assets/{siebel-tab-_cudpzBi.js → siebel-tab-CEBNzwrk.js} +3 -3
  18. package/dist/web/dashboard/dist/assets/{skills-tab-wVTeNO96.js → skills-tab-Cf977wNJ.js} +1 -1
  19. package/dist/web/dashboard/dist/assets/{style-B2fcRCDQ.js → style-4NfIX256.js} +1 -1
  20. package/dist/web/dashboard/dist/index.html +2 -2
  21. package/package.json +1 -1
  22. package/dist/web/dashboard/dist/assets/index-CArYPWPp.css +0 -1
@@ -1 +1 @@
1
- import{r as s,j as e,a as re}from"./index-kFRgiPES.js";import{u as oe,a as de,i as ce,B as ie,C as xe}from"./style-B2fcRCDQ.js";import{b as ue,a as pe,g as W,t as me,s as he,c as fe,d as be,W as ge,e as je,N as Ne}from"./graph-utils-D63XCNDU.js";import{A as ye,S as L,a as ve,N as _,E as Ce}from"./constants-lq4BIQN3.js";import"./index-HSRYSwKs.js";import"./index-DQtPV3qe.js";const ke=s.memo(function({statuses:h,types:f,direction:y,onStatusToggle:b,onTypeToggle:m,onDirectionChange:o,onClear:u,visibleNodeCount:c,totalNodeCount:i,onExpandAll:v,onCollapseAll:p}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2 border-b border-edge bg-surface-alt text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-muted",children:"Status:"}),ye.map(r=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h.has(r),onChange:()=>b(r),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:L[r]}}),e.jsx("span",{children:r.replace("_"," ")})]},r))]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-muted",children:"Type:"}),ve.map(r=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:f.has(r),onChange:()=>m(r),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:_[r]}}),e.jsx("span",{children:r.replace("_"," ")})]},r))]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-muted",children:"Layout:"}),e.jsxs("select",{value:y,onChange:r=>o(r.target.value),className:"bg-surface border border-edge rounded px-1 py-0.5 text-xs",children:[e.jsx("option",{value:"TB",children:"Top → Down"}),e.jsx("option",{value:"LR",children:"Left → Right"})]})]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:v,className:"px-2 py-0.5 rounded border border-edge hover:bg-surface-elevated transition-colors",title:i>100?`Warning: ${i} nodes — may be slow`:"Expand all nodes",children:"Expand All"}),e.jsx("button",{onClick:p,className:"px-2 py-0.5 rounded border border-edge hover:bg-surface-elevated transition-colors",children:"Collapse All"})]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("span",{className:"text-muted",children:["Showing ",c," of ",i]}),e.jsx("button",{onClick:u,className:"text-muted hover:text-foreground underline",children:"Clear"})]})}),Se=s.memo(function({tree:h,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m}){const[o,u]=s.useState(!1),c=s.useCallback(()=>u(i=>!i),[]);return o?e.jsx("div",{className:"w-8 border-r border-edge bg-surface-alt flex flex-col items-center pt-2",children:e.jsx("button",{onClick:c,className:"text-xs text-muted hover:text-foreground p-1",title:"Show tree panel",children:"▸"})}):e.jsxs("div",{className:"w-64 border-r border-edge bg-surface-alt flex flex-col min-h-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-edge",children:[e.jsx("span",{className:"text-xs font-medium text-muted",children:"Hierarchy"}),e.jsx("button",{onClick:c,className:"text-xs text-muted hover:text-foreground",title:"Collapse panel",children:"◂"})]}),e.jsx("div",{className:"overflow-y-auto flex-1 py-1",children:h.length===0?e.jsx("div",{className:"px-3 py-4 text-xs text-muted text-center",children:"No nodes"}):h.map(i=>e.jsx($,{item:i,depth:0,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m},i.node.id))})]})});function $({item:l,depth:h,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m}){const{node:o,children:u}=l,c=f.has(o.id),i=y===o.id,v=u.length>0,p=L[o.status]||"#9e9e9e",r=_[o.type]||"#6c757d",j=s.useCallback(n=>{n.stopPropagation(),b(o.id)},[o.id,b]),C=s.useCallback(()=>{m(o.id)},[o.id,m]);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:C,className:`w-full text-left flex items-center gap-1 px-2 py-1 text-xs hover:bg-surface-elevated transition-colors ${i?"bg-surface-elevated font-semibold":""}`,style:{paddingLeft:`${h*16+8}px`},children:[v?e.jsx("span",{onClick:j,className:"w-4 text-center text-muted hover:text-foreground cursor-pointer shrink-0",children:c?"▾":"▸"}):e.jsx("span",{className:"w-4 shrink-0"}),e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:p},title:o.status.replace("_"," ")}),e.jsx("span",{className:"text-[9px] px-1 rounded shrink-0",style:{background:`${r}20`,color:r},children:o.type.slice(0,3)}),e.jsx("span",{className:"truncate",children:o.title}),v&&e.jsx("span",{className:"text-[9px] text-muted ml-auto shrink-0",children:u.length})]}),c&&u.map(n=>e.jsx($,{item:n,depth:h+1,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m},n.node.id))]})}const I=50,we=s.memo(function({nodes:h,allNodes:f=[],onNodeClick:y}){const b=s.useMemo(()=>{const t=new Map;for(const g of f)t.set(g.id,g.title);return t},[f]),[m,o]=s.useState("priority"),[u,c]=s.useState("asc"),[i,v]=s.useState(""),[p,r]=s.useState(0),j=s.useMemo(()=>{if(!i)return h;const t=i.toLowerCase();return h.filter(g=>g.title.toLowerCase().includes(t)||g.type.toLowerCase().includes(t)||g.status.toLowerCase().includes(t)||(g.sprint||"").toLowerCase().includes(t))},[h,i]),C=s.useMemo(()=>[...j].sort((t,g)=>{const w=t[m]??"",E=g[m]??"",N=typeof w=="number"?w-E:String(w).localeCompare(String(E));return u==="asc"?N:-N}),[j,m,u]),n=Math.max(1,Math.ceil(C.length/I)),S=s.useMemo(()=>C.slice(p*I,(p+1)*I),[C,p]),k=t=>{m===t?c(g=>g==="asc"?"desc":"asc"):(o(t),c("asc"))},T=[{key:"title",label:"Title"},{key:"type",label:"Type"},{key:"status",label:"Status"},{key:"priority",label:"Priority"},{key:"xpSize",label:"Size"},{key:"sprint",label:"Sprint"},{key:"parentId",label:"Parent"}];return e.jsxs("div",{className:"border-t border-edge",children:[e.jsx("div",{className:"px-4 py-2 bg-surface-alt",children:e.jsx("input",{type:"text",placeholder:"Search nodes...",value:i,onChange:t=>v(t.target.value),className:"w-full max-w-xs px-2 py-1 text-sm border border-edge rounded bg-surface"})}),e.jsx("div",{className:"overflow-x-auto max-h-64",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-surface-elevated",children:T.map(t=>e.jsxs("th",{onClick:()=>k(t.key),className:"px-3 py-1.5 text-left text-xs font-medium text-muted cursor-pointer hover:text-foreground",children:[t.label,m===t.key&&(u==="asc"?" ↑":" ↓")]},t.key))})}),e.jsx("tbody",{children:S.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-3 py-4 text-center text-muted",children:"No nodes found"})}):S.map(t=>e.jsxs("tr",{onClick:()=>y(t),className:"border-t border-edge hover:bg-surface-alt cursor-pointer",children:[e.jsx("td",{className:"px-3 py-1.5 max-w-[200px] truncate",children:t.title}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{background:`${_[t.type]}20`,color:_[t.type]},children:t.type})}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{background:`${L[t.status]}20`,color:L[t.status]},children:t.status.replace("_"," ")})}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:t.priority}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:t.xpSize||"-"}),e.jsx("td",{className:"px-3 py-1.5",children:t.sprint||"-"}),e.jsx("td",{className:"px-3 py-1.5 max-w-[150px] truncate text-muted",children:t.parentId?b.get(t.parentId)??"-":"-"})]},t.id))})]})}),n>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-surface-alt border-t border-edge text-xs text-muted",children:[e.jsxs("span",{children:[C.length," nodes"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{disabled:p===0,onClick:()=>r(t=>Math.max(0,t-1)),className:"px-2 py-0.5 rounded border border-edge disabled:opacity-30",children:"Prev"}),e.jsxs("span",{children:[p+1,"/",n]}),e.jsx("button",{disabled:p>=n-1,onClick:()=>r(t=>Math.min(n-1,t+1)),className:"px-2 py-0.5 rounded border border-edge disabled:opacity-30",children:"Next"})]})]})]})}),Te=["depends_on","blocks","parent_of","child_of","related_to","priority_over","implements","derived_from"];function Ee({fromId:l,toId:h,fromTitle:f,toTitle:y,onCreated:b,onCancel:m}){const[o,u]=s.useState("depends_on"),[c,i]=s.useState(""),[v,p]=s.useState(!1),[r,j]=s.useState(null),C=s.useCallback(async()=>{p(!0),j(null);try{await re.createEdge({from:l,to:h,relationType:o,reason:c.trim()||void 0}),b()}catch(n){j(n instanceof Error?n.message:"Failed to create edge")}finally{p(!1)}},[l,h,o,c,b]);return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-surface border border-edge rounded-lg shadow-xl w-96 p-4",children:[e.jsx("h3",{className:"text-sm font-bold mb-3",children:"Create Relationship"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"From"}),e.jsx("div",{className:"text-xs bg-surface-elevated px-2 py-1.5 rounded truncate",children:f??l})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"To"}),e.jsx("div",{className:"text-xs bg-surface-elevated px-2 py-1.5 rounded truncate",children:y??h})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"Relation Type"}),e.jsx("select",{value:o,onChange:n=>u(n.target.value),className:"w-full text-xs px-2 py-1.5 rounded bg-surface-elevated border border-edge focus:outline-none focus:border-accent",children:Te.map(n=>{const S=Ce[n];return e.jsx("option",{value:n,children:S.label},n)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"Reason (optional)"}),e.jsx("input",{type:"text",value:c,onChange:n=>i(n.target.value),placeholder:"Why this relationship exists...",className:"w-full text-xs px-2 py-1.5 rounded bg-surface-elevated border border-edge focus:outline-none focus:border-accent"})]}),r&&e.jsx("div",{className:"text-xs text-danger bg-surface-elevated px-2 py-1.5 rounded",children:r})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{onClick:m,className:"text-xs px-3 py-1.5 rounded bg-surface-elevated hover:bg-edge transition-colors",children:"Cancel"}),e.jsx("button",{onClick:C,disabled:v,className:"text-xs px-3 py-1.5 rounded bg-accent text-white font-medium disabled:opacity-50 hover:opacity-90 transition-opacity",children:v?"Creating...":"Create"})]})]})})}const Le={workflowNode:je},_e={workflowEdge:ge},Pe={hideAttribution:!0};function De({graph:l}){var R,F;const[h,f,y]=oe([]),[b,m,o]=de([]),[u,c]=s.useState(null),[i,v]=s.useState("TB"),[p,r]=s.useState(new Set),[j,C]=s.useState(new Set),[n,S]=s.useState(new Set),[k,T]=s.useState(null),t=s.useDeferredValue(p),g=s.useDeferredValue(j),w=s.useDeferredValue(i),E=s.useRef(null),N=s.useMemo(()=>ue(l.nodes,l.edges),[l.nodes,l.edges]),G=s.useMemo(()=>pe(l.nodes,N),[l.nodes,N]),P=s.useCallback(a=>{S(x=>{const d=new Set(x);return d.has(a)?d.delete(a):d.add(a),d})},[]),V=s.useCallback(()=>{const a=new Set;for(const[x]of N)a.add(x);S(a)},[N]),B=s.useCallback(()=>{S(new Set)},[]),M=s.useCallback((a,x,d)=>{const te=W(l.nodes,n,N),z=me(te,{statuses:a,types:x},N,n,P),D=z.map(ne=>ne.id);if(he(E.current,D)&&d===w)return;E.current=D;const ae=new Set(D),le=fe(l.edges,ae),O=be(z,le,d);f(O.nodes),m(O.edges)},[l,f,m,w,n,N,P]);s.useEffect(()=>{M(t,g,w)},[l,M,t,g,w]);const H=s.useCallback((a,x)=>{c(x.data.sourceNode)},[]),Y=s.useCallback(a=>{c(a)},[]),Z=s.useCallback(a=>{const x=l.nodes.find(d=>d.id===a);x&&c(x)},[l.nodes]),K=s.useCallback(a=>{const x=l.nodes.find(d=>d.id===a);x&&c(x)},[l.nodes]),U=s.useCallback(a=>{a.source&&a.target&&a.source!==a.target&&T({fromId:a.source,toId:a.target})},[]),q=s.useCallback(()=>{T(null)},[]),J=s.useCallback(a=>{r(x=>{const d=new Set(x);return d.has(a)?d.delete(a):d.add(a),d})},[]),Q=s.useCallback(a=>{C(x=>{const d=new Set(x);return d.has(a)?d.delete(a):d.add(a),d})},[]),X=s.useCallback(()=>{r(new Set),C(new Set)},[]),A=s.useMemo(()=>W(l.nodes,n,N).filter(x=>!(p.size&&!p.has(x.status)||j.size&&!j.has(x.type))),[l.nodes,n,N,p,j]),ee=k?(R=l.nodes.find(a=>a.id===k.fromId))==null?void 0:R.title:void 0,se=k?(F=l.nodes.find(a=>a.id===k.toId))==null?void 0:F.title:void 0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(ke,{statuses:p,types:j,direction:i,onStatusToggle:J,onTypeToggle:Q,onDirectionChange:v,onClear:X,visibleNodeCount:A.length,totalNodeCount:l.nodes.length,onExpandAll:V,onCollapseAll:B}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(Se,{tree:G,expandedIds:n,selectedNodeId:(u==null?void 0:u.id)??null,onToggleExpand:P,onSelectNode:K}),e.jsx("div",{className:"flex-1 relative",children:l.nodes.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg mb-2",children:"No nodes in graph"}),e.jsx("p",{className:"text-sm",children:"Import a PRD to get started"})]})}):e.jsxs(ce,{nodes:h,edges:b,onNodesChange:y,onEdgesChange:o,onNodeClick:H,onConnect:U,nodeTypes:Le,edgeTypes:_e,nodesDraggable:!1,nodesConnectable:!0,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Pe,children:[e.jsx(ie,{gap:16,size:1}),e.jsx(xe,{showInteractive:!1})]})}),u&&e.jsx(Ne,{node:u,edges:l.edges,allNodes:l.nodes,childrenMap:N,onClose:()=>c(null),onNodeNavigate:Z})]}),e.jsx(we,{nodes:A,allNodes:l.nodes,onNodeClick:Y}),k&&e.jsx(Ee,{fromId:k.fromId,toId:k.toId,fromTitle:ee,toTitle:se,onCreated:q,onCancel:()=>T(null)})]})}function We({graph:l}){return e.jsx("div",{className:"h-full",children:e.jsx(De,{graph:l})})}export{We as GraphTab};
1
+ import{r as s,j as e,a as re}from"./index-CGEJi5Pf.js";import{u as oe,a as de,i as ce,B as ie,C as xe}from"./style-4NfIX256.js";import{b as ue,a as pe,g as W,t as me,s as he,c as fe,d as be,W as ge,e as je,N as Ne}from"./graph-utils-DOsrZg2o.js";import{A as ye,S as L,a as ve,N as _,E as Ce}from"./constants-lq4BIQN3.js";import"./index-DabDEe52.js";import"./index-B2nBqQj2.js";const ke=s.memo(function({statuses:h,types:f,direction:y,onStatusToggle:b,onTypeToggle:m,onDirectionChange:o,onClear:u,visibleNodeCount:c,totalNodeCount:i,onExpandAll:v,onCollapseAll:p}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-4 py-2 border-b border-edge bg-surface-alt text-xs",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-muted",children:"Status:"}),ye.map(r=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:h.has(r),onChange:()=>b(r),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:L[r]}}),e.jsx("span",{children:r.replace("_"," ")})]},r))]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-muted",children:"Type:"}),ve.map(r=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:f.has(r),onChange:()=>m(r),className:"w-3 h-3"}),e.jsx("span",{className:"w-2 h-2 rounded-full inline-block",style:{background:_[r]}}),e.jsx("span",{children:r.replace("_"," ")})]},r))]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"font-medium text-muted",children:"Layout:"}),e.jsxs("select",{value:y,onChange:r=>o(r.target.value),className:"bg-surface border border-edge rounded px-1 py-0.5 text-xs",children:[e.jsx("option",{value:"TB",children:"Top → Down"}),e.jsx("option",{value:"LR",children:"Left → Right"})]})]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:v,className:"px-2 py-0.5 rounded border border-edge hover:bg-surface-elevated transition-colors",title:i>100?`Warning: ${i} nodes — may be slow`:"Expand all nodes",children:"Expand All"}),e.jsx("button",{onClick:p,className:"px-2 py-0.5 rounded border border-edge hover:bg-surface-elevated transition-colors",children:"Collapse All"})]}),e.jsx("div",{className:"w-px h-4 bg-edge"}),e.jsxs("span",{className:"text-muted",children:["Showing ",c," of ",i]}),e.jsx("button",{onClick:u,className:"text-muted hover:text-foreground underline",children:"Clear"})]})}),Se=s.memo(function({tree:h,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m}){const[o,u]=s.useState(!1),c=s.useCallback(()=>u(i=>!i),[]);return o?e.jsx("div",{className:"w-8 border-r border-edge bg-surface-alt flex flex-col items-center pt-2",children:e.jsx("button",{onClick:c,className:"text-xs text-muted hover:text-foreground p-1",title:"Show tree panel",children:"▸"})}):e.jsxs("div",{className:"w-64 border-r border-edge bg-surface-alt flex flex-col min-h-0",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-edge",children:[e.jsx("span",{className:"text-xs font-medium text-muted",children:"Hierarchy"}),e.jsx("button",{onClick:c,className:"text-xs text-muted hover:text-foreground",title:"Collapse panel",children:"◂"})]}),e.jsx("div",{className:"overflow-y-auto flex-1 py-1",children:h.length===0?e.jsx("div",{className:"px-3 py-4 text-xs text-muted text-center",children:"No nodes"}):h.map(i=>e.jsx($,{item:i,depth:0,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m},i.node.id))})]})});function $({item:l,depth:h,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m}){const{node:o,children:u}=l,c=f.has(o.id),i=y===o.id,v=u.length>0,p=L[o.status]||"#9e9e9e",r=_[o.type]||"#6c757d",j=s.useCallback(n=>{n.stopPropagation(),b(o.id)},[o.id,b]),C=s.useCallback(()=>{m(o.id)},[o.id,m]);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{onClick:C,className:`w-full text-left flex items-center gap-1 px-2 py-1 text-xs hover:bg-surface-elevated transition-colors ${i?"bg-surface-elevated font-semibold":""}`,style:{paddingLeft:`${h*16+8}px`},children:[v?e.jsx("span",{onClick:j,className:"w-4 text-center text-muted hover:text-foreground cursor-pointer shrink-0",children:c?"▾":"▸"}):e.jsx("span",{className:"w-4 shrink-0"}),e.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:p},title:o.status.replace("_"," ")}),e.jsx("span",{className:"text-[9px] px-1 rounded shrink-0",style:{background:`${r}20`,color:r},children:o.type.slice(0,3)}),e.jsx("span",{className:"truncate",children:o.title}),v&&e.jsx("span",{className:"text-[9px] text-muted ml-auto shrink-0",children:u.length})]}),c&&u.map(n=>e.jsx($,{item:n,depth:h+1,expandedIds:f,selectedNodeId:y,onToggleExpand:b,onSelectNode:m},n.node.id))]})}const I=50,we=s.memo(function({nodes:h,allNodes:f=[],onNodeClick:y}){const b=s.useMemo(()=>{const t=new Map;for(const g of f)t.set(g.id,g.title);return t},[f]),[m,o]=s.useState("priority"),[u,c]=s.useState("asc"),[i,v]=s.useState(""),[p,r]=s.useState(0),j=s.useMemo(()=>{if(!i)return h;const t=i.toLowerCase();return h.filter(g=>g.title.toLowerCase().includes(t)||g.type.toLowerCase().includes(t)||g.status.toLowerCase().includes(t)||(g.sprint||"").toLowerCase().includes(t))},[h,i]),C=s.useMemo(()=>[...j].sort((t,g)=>{const w=t[m]??"",E=g[m]??"",N=typeof w=="number"?w-E:String(w).localeCompare(String(E));return u==="asc"?N:-N}),[j,m,u]),n=Math.max(1,Math.ceil(C.length/I)),S=s.useMemo(()=>C.slice(p*I,(p+1)*I),[C,p]),k=t=>{m===t?c(g=>g==="asc"?"desc":"asc"):(o(t),c("asc"))},T=[{key:"title",label:"Title"},{key:"type",label:"Type"},{key:"status",label:"Status"},{key:"priority",label:"Priority"},{key:"xpSize",label:"Size"},{key:"sprint",label:"Sprint"},{key:"parentId",label:"Parent"}];return e.jsxs("div",{className:"border-t border-edge",children:[e.jsx("div",{className:"px-4 py-2 bg-surface-alt",children:e.jsx("input",{type:"text",placeholder:"Search nodes...",value:i,onChange:t=>v(t.target.value),className:"w-full max-w-xs px-2 py-1 text-sm border border-edge rounded bg-surface"})}),e.jsx("div",{className:"overflow-x-auto max-h-64",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsx("tr",{className:"bg-surface-elevated",children:T.map(t=>e.jsxs("th",{onClick:()=>k(t.key),className:"px-3 py-1.5 text-left text-xs font-medium text-muted cursor-pointer hover:text-foreground",children:[t.label,m===t.key&&(u==="asc"?" ↑":" ↓")]},t.key))})}),e.jsx("tbody",{children:S.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-3 py-4 text-center text-muted",children:"No nodes found"})}):S.map(t=>e.jsxs("tr",{onClick:()=>y(t),className:"border-t border-edge hover:bg-surface-alt cursor-pointer",children:[e.jsx("td",{className:"px-3 py-1.5 max-w-[200px] truncate",children:t.title}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium",style:{background:`${_[t.type]}20`,color:_[t.type]},children:t.type})}),e.jsx("td",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full font-medium",style:{background:`${L[t.status]}20`,color:L[t.status]},children:t.status.replace("_"," ")})}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:t.priority}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:t.xpSize||"-"}),e.jsx("td",{className:"px-3 py-1.5",children:t.sprint||"-"}),e.jsx("td",{className:"px-3 py-1.5 max-w-[150px] truncate text-muted",children:t.parentId?b.get(t.parentId)??"-":"-"})]},t.id))})]})}),n>1&&e.jsxs("div",{className:"flex items-center justify-between px-4 py-1.5 bg-surface-alt border-t border-edge text-xs text-muted",children:[e.jsxs("span",{children:[C.length," nodes"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{disabled:p===0,onClick:()=>r(t=>Math.max(0,t-1)),className:"px-2 py-0.5 rounded border border-edge disabled:opacity-30",children:"Prev"}),e.jsxs("span",{children:[p+1,"/",n]}),e.jsx("button",{disabled:p>=n-1,onClick:()=>r(t=>Math.min(n-1,t+1)),className:"px-2 py-0.5 rounded border border-edge disabled:opacity-30",children:"Next"})]})]})]})}),Te=["depends_on","blocks","parent_of","child_of","related_to","priority_over","implements","derived_from"];function Ee({fromId:l,toId:h,fromTitle:f,toTitle:y,onCreated:b,onCancel:m}){const[o,u]=s.useState("depends_on"),[c,i]=s.useState(""),[v,p]=s.useState(!1),[r,j]=s.useState(null),C=s.useCallback(async()=>{p(!0),j(null);try{await re.createEdge({from:l,to:h,relationType:o,reason:c.trim()||void 0}),b()}catch(n){j(n instanceof Error?n.message:"Failed to create edge")}finally{p(!1)}},[l,h,o,c,b]);return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50",children:e.jsxs("div",{className:"bg-surface border border-edge rounded-lg shadow-xl w-96 p-4",children:[e.jsx("h3",{className:"text-sm font-bold mb-3",children:"Create Relationship"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"From"}),e.jsx("div",{className:"text-xs bg-surface-elevated px-2 py-1.5 rounded truncate",children:f??l})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"To"}),e.jsx("div",{className:"text-xs bg-surface-elevated px-2 py-1.5 rounded truncate",children:y??h})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"Relation Type"}),e.jsx("select",{value:o,onChange:n=>u(n.target.value),className:"w-full text-xs px-2 py-1.5 rounded bg-surface-elevated border border-edge focus:outline-none focus:border-accent",children:Te.map(n=>{const S=Ce[n];return e.jsx("option",{value:n,children:S.label},n)})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-xs text-muted block mb-1",children:"Reason (optional)"}),e.jsx("input",{type:"text",value:c,onChange:n=>i(n.target.value),placeholder:"Why this relationship exists...",className:"w-full text-xs px-2 py-1.5 rounded bg-surface-elevated border border-edge focus:outline-none focus:border-accent"})]}),r&&e.jsx("div",{className:"text-xs text-danger bg-surface-elevated px-2 py-1.5 rounded",children:r})]}),e.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[e.jsx("button",{onClick:m,className:"text-xs px-3 py-1.5 rounded bg-surface-elevated hover:bg-edge transition-colors",children:"Cancel"}),e.jsx("button",{onClick:C,disabled:v,className:"text-xs px-3 py-1.5 rounded bg-accent text-white font-medium disabled:opacity-50 hover:opacity-90 transition-opacity",children:v?"Creating...":"Create"})]})]})})}const Le={workflowNode:je},_e={workflowEdge:ge},Pe={hideAttribution:!0};function De({graph:l}){var R,F;const[h,f,y]=oe([]),[b,m,o]=de([]),[u,c]=s.useState(null),[i,v]=s.useState("TB"),[p,r]=s.useState(new Set),[j,C]=s.useState(new Set),[n,S]=s.useState(new Set),[k,T]=s.useState(null),t=s.useDeferredValue(p),g=s.useDeferredValue(j),w=s.useDeferredValue(i),E=s.useRef(null),N=s.useMemo(()=>ue(l.nodes,l.edges),[l.nodes,l.edges]),G=s.useMemo(()=>pe(l.nodes,N),[l.nodes,N]),P=s.useCallback(a=>{S(x=>{const d=new Set(x);return d.has(a)?d.delete(a):d.add(a),d})},[]),V=s.useCallback(()=>{const a=new Set;for(const[x]of N)a.add(x);S(a)},[N]),B=s.useCallback(()=>{S(new Set)},[]),M=s.useCallback((a,x,d)=>{const te=W(l.nodes,n,N),z=me(te,{statuses:a,types:x},N,n,P),D=z.map(ne=>ne.id);if(he(E.current,D)&&d===w)return;E.current=D;const ae=new Set(D),le=fe(l.edges,ae),O=be(z,le,d);f(O.nodes),m(O.edges)},[l,f,m,w,n,N,P]);s.useEffect(()=>{M(t,g,w)},[l,M,t,g,w]);const H=s.useCallback((a,x)=>{c(x.data.sourceNode)},[]),Y=s.useCallback(a=>{c(a)},[]),Z=s.useCallback(a=>{const x=l.nodes.find(d=>d.id===a);x&&c(x)},[l.nodes]),K=s.useCallback(a=>{const x=l.nodes.find(d=>d.id===a);x&&c(x)},[l.nodes]),U=s.useCallback(a=>{a.source&&a.target&&a.source!==a.target&&T({fromId:a.source,toId:a.target})},[]),q=s.useCallback(()=>{T(null)},[]),J=s.useCallback(a=>{r(x=>{const d=new Set(x);return d.has(a)?d.delete(a):d.add(a),d})},[]),Q=s.useCallback(a=>{C(x=>{const d=new Set(x);return d.has(a)?d.delete(a):d.add(a),d})},[]),X=s.useCallback(()=>{r(new Set),C(new Set)},[]),A=s.useMemo(()=>W(l.nodes,n,N).filter(x=>!(p.size&&!p.has(x.status)||j.size&&!j.has(x.type))),[l.nodes,n,N,p,j]),ee=k?(R=l.nodes.find(a=>a.id===k.fromId))==null?void 0:R.title:void 0,se=k?(F=l.nodes.find(a=>a.id===k.toId))==null?void 0:F.title:void 0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(ke,{statuses:p,types:j,direction:i,onStatusToggle:J,onTypeToggle:Q,onDirectionChange:v,onClear:X,visibleNodeCount:A.length,totalNodeCount:l.nodes.length,onExpandAll:V,onCollapseAll:B}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(Se,{tree:G,expandedIds:n,selectedNodeId:(u==null?void 0:u.id)??null,onToggleExpand:P,onSelectNode:K}),e.jsx("div",{className:"flex-1 relative",children:l.nodes.length===0?e.jsx("div",{className:"flex items-center justify-center h-full text-muted",children:e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-lg mb-2",children:"No nodes in graph"}),e.jsx("p",{className:"text-sm",children:"Import a PRD to get started"})]})}):e.jsxs(ce,{nodes:h,edges:b,onNodesChange:y,onEdgesChange:o,onNodeClick:H,onConnect:U,nodeTypes:Le,edgeTypes:_e,nodesDraggable:!1,nodesConnectable:!0,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Pe,children:[e.jsx(ie,{gap:16,size:1}),e.jsx(xe,{showInteractive:!1})]})}),u&&e.jsx(Ne,{node:u,edges:l.edges,allNodes:l.nodes,childrenMap:N,onClose:()=>c(null),onNodeNavigate:Z})]}),e.jsx(we,{nodes:A,allNodes:l.nodes,onNodeClick:Y}),k&&e.jsx(Ee,{fromId:k.fromId,toId:k.toId,fromTitle:ee,toTitle:se,onCreated:q,onCancel:()=>T(null)})]})}function We({graph:l}){return e.jsx("div",{className:"h-full",children:e.jsx(De,{graph:l})})}export{We as GraphTab};
@@ -1 +1 @@
1
- import{r as b,j as t}from"./index-kFRgiPES.js";import{H as v,P as k,g as L,c as _,E as P}from"./style-B2fcRCDQ.js";import{N as j,S as N,E as h}from"./constants-lq4BIQN3.js";import{d as C}from"./index-DQtPV3qe.js";function H(a,e){const r=new Map,i=(s,o)=>{let u=r.get(s);u||(u=new Set,r.set(s,u)),u.add(o)};for(const s of a)s.parentId&&i(s.parentId,s.id);for(const s of e)s.relationType==="parent_of"?i(s.from,s.to):s.relationType==="child_of"&&i(s.to,s.from);const d=new Map;for(const[s,o]of r)d.set(s,[...o]);return d}function A(a,e,r){const i=new Map,d=new Set;for(const n of a)i.set(n.id,n),d.add(n.id);const s=a.filter(n=>!n.parentId||!d.has(n.parentId)),o=[],u=new Set,l=n=>{if(u.has(n))return;u.add(n);const m=i.get(n);if(m&&o.push(m),e.has(n)){const f=r.get(n)??[];for(const c of f)l(c)}};for(const n of s)l(n.id);return o}function B(a,e){if(a.length===0)return[];const r=new Map,i=new Set;for(const l of a)r.set(l.id,l),i.add(l.id);const d=(l,n)=>{if(n.has(l))return null;n.add(l);const m=r.get(l);if(!m)return null;const f=e.get(l)??[],c=[];for(const p of f){const x=d(p,n);x&&c.push(x)}return{node:m,children:c}},s=a.filter(l=>!l.parentId||!i.has(l.parentId)),o=new Set,u=[];for(const l of s){const n=d(l.id,o);n&&u.push(n)}return u}const F=b.memo(function({data:e}){const r=j[e.nodeType]||"#6c757d",i=N[e.status]||"#9e9e9e",d=b.useCallback(s=>{var o;s.stopPropagation(),(o=e.onExpand)==null||o.call(e,e.sourceNode.id)},[e]);return t.jsxs(t.Fragment,{children:[t.jsx(v,{type:"target",position:k.Top,className:"!w-2 !h-2"}),t.jsxs("div",{className:"bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px]",children:[t.jsxs("div",{className:"p-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${r}20`,color:r},children:e.nodeType}),t.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:`${i}20`,color:i},children:e.status.replace("_"," ")})]}),t.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:e.label}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[t.jsxs("span",{children:["P",e.priority]}),e.xpSize&&t.jsx("span",{children:e.xpSize}),e.sprint&&t.jsx("span",{children:e.sprint})]})]}),e.hasChildren&&t.jsxs("button",{onClick:d,className:"w-full flex items-center justify-center gap-1.5 py-1.5 text-xs font-medium border-t border-edge text-muted hover:text-foreground hover:bg-surface-elevated transition-colors rounded-b-lg",title:e.isExpanded?"Collapse children":"Expand children",children:[t.jsx("span",{children:e.isExpanded?"▼":"▶"}),t.jsxs("span",{children:[e.childCount," ",e.childCount===1?"child":"children"]})]})]}),t.jsx(v,{type:"source",position:k.Bottom,className:"!w-2 !h-2"})]})}),G=b.memo(function({id:e,sourceX:r,sourceY:i,targetX:d,targetY:s,sourcePosition:o,targetPosition:u,data:l,style:n={}}){const[m,f,c]=L({sourceX:r,sourceY:i,sourcePosition:o,targetX:d,targetY:s,targetPosition:u}),p=(l==null?void 0:l.relationType)||"related_to",x=h[p]||h.related_to;return t.jsxs(t.Fragment,{children:[t.jsx(_,{id:e,path:m,style:{...n,stroke:x.color,strokeDasharray:x.dashed?"5 5":void 0,strokeWidth:1.5}}),t.jsx(P,{children:t.jsx("div",{className:"text-[9px] text-muted bg-surface px-1 rounded pointer-events-none absolute",style:{transform:`translate(-50%, -50%) translate(${f}px,${c}px)`},children:x.label})})]})});function R(a,e){const r=[],i=[];for(const d of e)d.from===a&&r.push(d),d.to===a&&i.push(d);return{outgoing:r,incoming:i}}const Y=b.memo(function({node:e,edges:r=[],allNodes:i=[],childrenMap:d,onClose:s,onNodeNavigate:o}){if(!e)return null;const u=j[e.type]||"#6c757d",l=N[e.status]||"#9e9e9e",n=b.useMemo(()=>R(e.id,r),[e.id,r]),m=b.useMemo(()=>{const c=new Map;for(const p of i)c.set(p.id,p);return c},[i]),f=n.outgoing.length>0||n.incoming.length>0;return t.jsxs("div",{className:"w-80 border-l border-edge bg-surface-alt overflow-y-auto p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("h3",{className:"text-sm font-bold",children:"Node Details"}),t.jsx("button",{onClick:s,className:"text-muted hover:text-foreground text-lg leading-none",children:"×"})]}),t.jsx("h4",{className:"text-base font-semibold mb-3",children:e.title}),t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsx(g,{label:"ID",children:t.jsx("code",{className:"text-xs bg-surface-elevated px-1 rounded break-all",children:e.id})}),t.jsx(g,{label:"Type",children:t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{background:`${u}20`,color:u},children:e.type})}),t.jsx(g,{label:"Status",children:t.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium",style:{background:`${l}20`,color:l},children:e.status.replace("_"," ")})}),t.jsxs(g,{label:"Priority",children:["P",e.priority]}),e.xpSize&&t.jsx(g,{label:"Size",children:e.xpSize}),e.estimateMinutes!=null&&t.jsxs(g,{label:"Estimate",children:[e.estimateMinutes,"min"]}),e.sprint&&t.jsx(g,{label:"Sprint",children:e.sprint}),e.description&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Description"}),t.jsx("p",{className:"text-xs whitespace-pre-wrap",children:e.description})]}),d&&(()=>{const c=d.get(e.id)??[];return c.length===0?null:t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Children (",c.length,")"]}),t.jsx("div",{className:"space-y-1",children:c.map(p=>{const x=m.get(p);if(!x)return null;const D=N[x.status]||"#9e9e9e",S=j[x.type]||"#6c757d";return t.jsxs("button",{onClick:()=>o==null?void 0:o(p),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:D}}),t.jsx("span",{className:"text-[9px] px-1 rounded shrink-0",style:{background:`${S}20`,color:S},children:x.type}),t.jsx("span",{className:"truncate font-medium",children:x.title})]},p)})})]})})(),f&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Relationships (",n.outgoing.length+n.incoming.length,")"]}),t.jsxs("div",{className:"space-y-1",children:[n.outgoing.map(c=>{const p=m.get(c.to),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"out",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.to,targetId:c.to,onNavigate:o},c.id)}),n.incoming.map(c=>{const p=m.get(c.from),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"in",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.from,targetId:c.from,onNavigate:o},c.id)})]})]}),e.acceptanceCriteria&&e.acceptanceCriteria.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Acceptance Criteria (",e.acceptanceCriteria.length,")"]}),t.jsx("ul",{className:"text-xs space-y-1 list-disc pl-4",children:e.acceptanceCriteria.map((c,p)=>t.jsx("li",{children:c},p))})]}),e.tags&&e.tags.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.map(c=>t.jsx("span",{className:"text-[10px] bg-surface-elevated px-1.5 py-0.5 rounded",children:c},c))})]}),e.sourceRef&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Source"}),t.jsxs("div",{className:"text-xs",children:[e.sourceRef.file,e.sourceRef.startLine!=null&&` (L${e.sourceRef.startLine}–${e.sourceRef.endLine??"?"})`]})]}),t.jsxs("div",{className:"pt-2 border-t border-edge text-[10px] text-muted",children:[t.jsxs("div",{children:["Created: ",new Date(e.createdAt).toLocaleString()]}),t.jsxs("div",{children:["Updated: ",new Date(e.updatedAt).toLocaleString()]})]})]})]})});function g({label:a,children:e}){return t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsx("span",{className:"text-xs text-muted shrink-0",children:a}),t.jsx("div",{className:"text-right",children:e})]})}function E({direction:a,label:e,color:r,targetTitle:i,targetId:d,onNavigate:s}){const o=a==="out"?"→":"←";return t.jsxs("button",{onClick:()=>s==null?void 0:s(d),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{style:{color:r},children:o}),t.jsx("span",{className:"text-[10px] text-muted",children:e}),t.jsx("span",{className:"truncate font-medium",children:i})]})}const w=240,T=80;function K(a,e,r,i,d){return a.filter(s=>{var o,u;return!((o=e==null?void 0:e.statuses)!=null&&o.size&&!e.statuses.has(s.status)||(u=e==null?void 0:e.types)!=null&&u.size&&!e.types.has(s.type))}).map(s=>{const o=r==null?void 0:r.get(s.id),u=o!=null&&o.length>0;return{id:s.id,type:"workflowNode",position:{x:0,y:0},data:{label:s.title,nodeType:s.type,status:s.status,priority:s.priority,xpSize:s.xpSize,sprint:s.sprint,sourceNode:s,hasChildren:u,isExpanded:(i==null?void 0:i.has(s.id))??!1,childCount:(o==null?void 0:o.length)??0,onExpand:d},style:{width:w,borderLeft:`4px solid ${j[s.type]||"#6c757d"}`}}})}function U(a,e){return a.filter(r=>e.has(r.from)&&e.has(r.to)).map(r=>{const i=h[r.relationType]||h.related_to;return{id:r.id,source:r.from,target:r.to,label:i.label,type:"workflowEdge",data:{relationType:r.relationType},style:{stroke:i.color,strokeDasharray:i.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}})}function $(a,e,r){let i=0;const d=[r,...a,"|",...e];for(const s of d)for(let o=0;o<s.length;o++)i=(i<<5)-i+s.charCodeAt(o)|0;return i}function V(a,e){if(a===null||a.length!==e.length)return!1;for(let r=0;r<a.length;r++)if(a[r]!==e[r])return!1;return!0}let y=null;function X(a,e,r="TB"){const i=a.map(l=>l.id),d=e.map(l=>`${l.source}-${l.target}`),s=$(i,d,r);let o;if(y&&y.key===s)o=y.positions;else{const l=new C.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:r,ranksep:60,nodesep:40});for(const n of a)l.setNode(n.id,{width:w,height:T});for(const n of e)l.setEdge(n.source,n.target);C.layout(l),o=new Map;for(const n of a){const m=l.node(n.id);o.set(n.id,{x:m.x-w/2,y:m.y-T/2})}y={key:s,positions:o}}return{nodes:a.map(l=>{const n=o.get(l.id)??{x:0,y:0};return{...l,position:n}}),edges:e}}export{Y as N,G as W,B as a,H as b,U as c,X as d,F as e,A as g,V as s,K as t};
1
+ import{r as b,j as t}from"./index-CGEJi5Pf.js";import{H as v,P as k,g as L,c as _,E as P}from"./style-4NfIX256.js";import{N as j,S as N,E as h}from"./constants-lq4BIQN3.js";import{d as C}from"./index-B2nBqQj2.js";function H(a,e){const r=new Map,i=(s,o)=>{let u=r.get(s);u||(u=new Set,r.set(s,u)),u.add(o)};for(const s of a)s.parentId&&i(s.parentId,s.id);for(const s of e)s.relationType==="parent_of"?i(s.from,s.to):s.relationType==="child_of"&&i(s.to,s.from);const d=new Map;for(const[s,o]of r)d.set(s,[...o]);return d}function A(a,e,r){const i=new Map,d=new Set;for(const n of a)i.set(n.id,n),d.add(n.id);const s=a.filter(n=>!n.parentId||!d.has(n.parentId)),o=[],u=new Set,l=n=>{if(u.has(n))return;u.add(n);const m=i.get(n);if(m&&o.push(m),e.has(n)){const f=r.get(n)??[];for(const c of f)l(c)}};for(const n of s)l(n.id);return o}function B(a,e){if(a.length===0)return[];const r=new Map,i=new Set;for(const l of a)r.set(l.id,l),i.add(l.id);const d=(l,n)=>{if(n.has(l))return null;n.add(l);const m=r.get(l);if(!m)return null;const f=e.get(l)??[],c=[];for(const p of f){const x=d(p,n);x&&c.push(x)}return{node:m,children:c}},s=a.filter(l=>!l.parentId||!i.has(l.parentId)),o=new Set,u=[];for(const l of s){const n=d(l.id,o);n&&u.push(n)}return u}const F=b.memo(function({data:e}){const r=j[e.nodeType]||"#6c757d",i=N[e.status]||"#9e9e9e",d=b.useCallback(s=>{var o;s.stopPropagation(),(o=e.onExpand)==null||o.call(e,e.sourceNode.id)},[e]);return t.jsxs(t.Fragment,{children:[t.jsx(v,{type:"target",position:k.Top,className:"!w-2 !h-2"}),t.jsxs("div",{className:"bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px]",children:[t.jsxs("div",{className:"p-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-1",children:[t.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${r}20`,color:r},children:e.nodeType}),t.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full",style:{background:`${i}20`,color:i},children:e.status.replace("_"," ")})]}),t.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:e.label}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[t.jsxs("span",{children:["P",e.priority]}),e.xpSize&&t.jsx("span",{children:e.xpSize}),e.sprint&&t.jsx("span",{children:e.sprint})]})]}),e.hasChildren&&t.jsxs("button",{onClick:d,className:"w-full flex items-center justify-center gap-1.5 py-1.5 text-xs font-medium border-t border-edge text-muted hover:text-foreground hover:bg-surface-elevated transition-colors rounded-b-lg",title:e.isExpanded?"Collapse children":"Expand children",children:[t.jsx("span",{children:e.isExpanded?"▼":"▶"}),t.jsxs("span",{children:[e.childCount," ",e.childCount===1?"child":"children"]})]})]}),t.jsx(v,{type:"source",position:k.Bottom,className:"!w-2 !h-2"})]})}),G=b.memo(function({id:e,sourceX:r,sourceY:i,targetX:d,targetY:s,sourcePosition:o,targetPosition:u,data:l,style:n={}}){const[m,f,c]=L({sourceX:r,sourceY:i,sourcePosition:o,targetX:d,targetY:s,targetPosition:u}),p=(l==null?void 0:l.relationType)||"related_to",x=h[p]||h.related_to;return t.jsxs(t.Fragment,{children:[t.jsx(_,{id:e,path:m,style:{...n,stroke:x.color,strokeDasharray:x.dashed?"5 5":void 0,strokeWidth:1.5}}),t.jsx(P,{children:t.jsx("div",{className:"text-[9px] text-muted bg-surface px-1 rounded pointer-events-none absolute",style:{transform:`translate(-50%, -50%) translate(${f}px,${c}px)`},children:x.label})})]})});function R(a,e){const r=[],i=[];for(const d of e)d.from===a&&r.push(d),d.to===a&&i.push(d);return{outgoing:r,incoming:i}}const Y=b.memo(function({node:e,edges:r=[],allNodes:i=[],childrenMap:d,onClose:s,onNodeNavigate:o}){if(!e)return null;const u=j[e.type]||"#6c757d",l=N[e.status]||"#9e9e9e",n=b.useMemo(()=>R(e.id,r),[e.id,r]),m=b.useMemo(()=>{const c=new Map;for(const p of i)c.set(p.id,p);return c},[i]),f=n.outgoing.length>0||n.incoming.length>0;return t.jsxs("div",{className:"w-80 border-l border-edge bg-surface-alt overflow-y-auto p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("h3",{className:"text-sm font-bold",children:"Node Details"}),t.jsx("button",{onClick:s,className:"text-muted hover:text-foreground text-lg leading-none",children:"×"})]}),t.jsx("h4",{className:"text-base font-semibold mb-3",children:e.title}),t.jsxs("div",{className:"space-y-2 text-sm",children:[t.jsx(g,{label:"ID",children:t.jsx("code",{className:"text-xs bg-surface-elevated px-1 rounded break-all",children:e.id})}),t.jsx(g,{label:"Type",children:t.jsx("span",{className:"px-2 py-0.5 rounded text-xs font-medium",style:{background:`${u}20`,color:u},children:e.type})}),t.jsx(g,{label:"Status",children:t.jsx("span",{className:"px-2 py-0.5 rounded-full text-xs font-medium",style:{background:`${l}20`,color:l},children:e.status.replace("_"," ")})}),t.jsxs(g,{label:"Priority",children:["P",e.priority]}),e.xpSize&&t.jsx(g,{label:"Size",children:e.xpSize}),e.estimateMinutes!=null&&t.jsxs(g,{label:"Estimate",children:[e.estimateMinutes,"min"]}),e.sprint&&t.jsx(g,{label:"Sprint",children:e.sprint}),e.description&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Description"}),t.jsx("p",{className:"text-xs whitespace-pre-wrap",children:e.description})]}),d&&(()=>{const c=d.get(e.id)??[];return c.length===0?null:t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Children (",c.length,")"]}),t.jsx("div",{className:"space-y-1",children:c.map(p=>{const x=m.get(p);if(!x)return null;const D=N[x.status]||"#9e9e9e",S=j[x.type]||"#6c757d";return t.jsxs("button",{onClick:()=>o==null?void 0:o(p),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{className:"w-2 h-2 rounded-full shrink-0",style:{background:D}}),t.jsx("span",{className:"text-[9px] px-1 rounded shrink-0",style:{background:`${S}20`,color:S},children:x.type}),t.jsx("span",{className:"truncate font-medium",children:x.title})]},p)})})]})})(),f&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Relationships (",n.outgoing.length+n.incoming.length,")"]}),t.jsxs("div",{className:"space-y-1",children:[n.outgoing.map(c=>{const p=m.get(c.to),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"out",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.to,targetId:c.to,onNavigate:o},c.id)}),n.incoming.map(c=>{const p=m.get(c.from),x=h[c.relationType]||h.related_to;return t.jsx(E,{direction:"in",label:x.label,color:x.color,targetTitle:(p==null?void 0:p.title)??c.from,targetId:c.from,onNavigate:o},c.id)})]})]}),e.acceptanceCriteria&&e.acceptanceCriteria.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsxs("div",{className:"text-xs font-medium text-muted mb-1",children:["Acceptance Criteria (",e.acceptanceCriteria.length,")"]}),t.jsx("ul",{className:"text-xs space-y-1 list-disc pl-4",children:e.acceptanceCriteria.map((c,p)=>t.jsx("li",{children:c},p))})]}),e.tags&&e.tags.length>0&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Tags"}),t.jsx("div",{className:"flex flex-wrap gap-1",children:e.tags.map(c=>t.jsx("span",{className:"text-[10px] bg-surface-elevated px-1.5 py-0.5 rounded",children:c},c))})]}),e.sourceRef&&t.jsxs("div",{className:"pt-2 border-t border-edge",children:[t.jsx("div",{className:"text-xs font-medium text-muted mb-1",children:"Source"}),t.jsxs("div",{className:"text-xs",children:[e.sourceRef.file,e.sourceRef.startLine!=null&&` (L${e.sourceRef.startLine}–${e.sourceRef.endLine??"?"})`]})]}),t.jsxs("div",{className:"pt-2 border-t border-edge text-[10px] text-muted",children:[t.jsxs("div",{children:["Created: ",new Date(e.createdAt).toLocaleString()]}),t.jsxs("div",{children:["Updated: ",new Date(e.updatedAt).toLocaleString()]})]})]})]})});function g({label:a,children:e}){return t.jsxs("div",{className:"flex items-start justify-between gap-2",children:[t.jsx("span",{className:"text-xs text-muted shrink-0",children:a}),t.jsx("div",{className:"text-right",children:e})]})}function E({direction:a,label:e,color:r,targetTitle:i,targetId:d,onNavigate:s}){const o=a==="out"?"→":"←";return t.jsxs("button",{onClick:()=>s==null?void 0:s(d),className:"w-full text-left flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-surface-elevated transition-colors text-xs",children:[t.jsx("span",{style:{color:r},children:o}),t.jsx("span",{className:"text-[10px] text-muted",children:e}),t.jsx("span",{className:"truncate font-medium",children:i})]})}const w=240,T=80;function K(a,e,r,i,d){return a.filter(s=>{var o,u;return!((o=e==null?void 0:e.statuses)!=null&&o.size&&!e.statuses.has(s.status)||(u=e==null?void 0:e.types)!=null&&u.size&&!e.types.has(s.type))}).map(s=>{const o=r==null?void 0:r.get(s.id),u=o!=null&&o.length>0;return{id:s.id,type:"workflowNode",position:{x:0,y:0},data:{label:s.title,nodeType:s.type,status:s.status,priority:s.priority,xpSize:s.xpSize,sprint:s.sprint,sourceNode:s,hasChildren:u,isExpanded:(i==null?void 0:i.has(s.id))??!1,childCount:(o==null?void 0:o.length)??0,onExpand:d},style:{width:w,borderLeft:`4px solid ${j[s.type]||"#6c757d"}`}}})}function U(a,e){return a.filter(r=>e.has(r.from)&&e.has(r.to)).map(r=>{const i=h[r.relationType]||h.related_to;return{id:r.id,source:r.from,target:r.to,label:i.label,type:"workflowEdge",data:{relationType:r.relationType},style:{stroke:i.color,strokeDasharray:i.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}})}function $(a,e,r){let i=0;const d=[r,...a,"|",...e];for(const s of d)for(let o=0;o<s.length;o++)i=(i<<5)-i+s.charCodeAt(o)|0;return i}function V(a,e){if(a===null||a.length!==e.length)return!1;for(let r=0;r<a.length;r++)if(a[r]!==e[r])return!1;return!0}let y=null;function X(a,e,r="TB"){const i=a.map(l=>l.id),d=e.map(l=>`${l.source}-${l.target}`),s=$(i,d,r);let o;if(y&&y.key===s)o=y.positions;else{const l=new C.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:r,ranksep:60,nodesep:40});for(const n of a)l.setNode(n.id,{width:w,height:T});for(const n of e)l.setEdge(n.source,n.target);C.layout(l),o=new Map;for(const n of a){const m=l.node(n.id);o.set(n.id,{x:m.x-w/2,y:m.y-T/2})}y={key:s,positions:o}}return{nodes:a.map(l=>{const n=o.get(l.id)??{x:0,y:0};return{...l,position:n}}),edges:e}}export{Y as N,G as W,B as a,H as b,U as c,X as d,F as e,A as g,V as s,K as t};
@@ -1 +1 @@
1
- var $r=Object.defineProperty;var Jr=(_,m,f)=>m in _?$r(_,m,{enumerable:!0,configurable:!0,writable:!0,value:f}):_[m]=f;var F=(_,m,f)=>Jr(_,typeof m!="symbol"?m+"":m,f);import{g as Kr}from"./index-kFRgiPES.js";var J,Xe;function Ye(){if(Xe)return J;Xe=1;var _="\0",m="\0",f="";class u{constructor(r){F(this,"_isDirected",!0);F(this,"_isMultigraph",!1);F(this,"_isCompound",!1);F(this,"_label");F(this,"_defaultNodeLabelFn",()=>{});F(this,"_defaultEdgeLabelFn",()=>{});F(this,"_nodes",{});F(this,"_in",{});F(this,"_preds",{});F(this,"_out",{});F(this,"_sucs",{});F(this,"_edgeObjs",{});F(this,"_edgeLabels",{});F(this,"_nodeCount",0);F(this,"_edgeCount",0);F(this,"_parent");F(this,"_children");r&&(this._isDirected=Object.hasOwn(r,"directed")?r.directed:!0,this._isMultigraph=Object.hasOwn(r,"multigraph")?r.multigraph:!1,this._isCompound=Object.hasOwn(r,"compound")?r.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[m]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(r){return this._label=r,this}graph(){return this._label}setDefaultNodeLabel(r){return this._defaultNodeLabelFn=r,typeof r!="function"&&(this._defaultNodeLabelFn=()=>r),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var r=this;return this.nodes().filter(t=>Object.keys(r._in[t]).length===0)}sinks(){var r=this;return this.nodes().filter(t=>Object.keys(r._out[t]).length===0)}setNodes(r,t){var d=arguments,l=this;return r.forEach(function(w){d.length>1?l.setNode(w,t):l.setNode(w)}),this}setNode(r,t){return Object.hasOwn(this._nodes,r)?(arguments.length>1&&(this._nodes[r]=t),this):(this._nodes[r]=arguments.length>1?t:this._defaultNodeLabelFn(r),this._isCompound&&(this._parent[r]=m,this._children[r]={},this._children[m][r]=!0),this._in[r]={},this._preds[r]={},this._out[r]={},this._sucs[r]={},++this._nodeCount,this)}node(r){return this._nodes[r]}hasNode(r){return Object.hasOwn(this._nodes,r)}removeNode(r){var t=this;if(Object.hasOwn(this._nodes,r)){var d=l=>t.removeEdge(t._edgeObjs[l]);delete this._nodes[r],this._isCompound&&(this._removeFromParentsChildList(r),delete this._parent[r],this.children(r).forEach(function(l){t.setParent(l)}),delete this._children[r]),Object.keys(this._in[r]).forEach(d),delete this._in[r],delete this._preds[r],Object.keys(this._out[r]).forEach(d),delete this._out[r],delete this._sucs[r],--this._nodeCount}return this}setParent(r,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t=m;else{t+="";for(var d=t;d!==void 0;d=this.parent(d))if(d===r)throw new Error("Setting "+t+" as parent of "+r+" would create a cycle");this.setNode(t)}return this.setNode(r),this._removeFromParentsChildList(r),this._parent[r]=t,this._children[t][r]=!0,this}_removeFromParentsChildList(r){delete this._children[this._parent[r]][r]}parent(r){if(this._isCompound){var t=this._parent[r];if(t!==m)return t}}children(r=m){if(this._isCompound){var t=this._children[r];if(t)return Object.keys(t)}else{if(r===m)return this.nodes();if(this.hasNode(r))return[]}}predecessors(r){var t=this._preds[r];if(t)return Object.keys(t)}successors(r){var t=this._sucs[r];if(t)return Object.keys(t)}neighbors(r){var t=this.predecessors(r);if(t){const l=new Set(t);for(var d of this.successors(r))l.add(d);return Array.from(l.values())}}isLeaf(r){var t;return this.isDirected()?t=this.successors(r):t=this.neighbors(r),t.length===0}filterNodes(r){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var d=this;Object.entries(this._nodes).forEach(function([x,c]){r(x)&&t.setNode(x,c)}),Object.values(this._edgeObjs).forEach(function(x){t.hasNode(x.v)&&t.hasNode(x.w)&&t.setEdge(x,d.edge(x))});var l={};function w(x){var c=d.parent(x);return c===void 0||t.hasNode(c)?(l[x]=c,c):c in l?l[c]:w(c)}return this._isCompound&&t.nodes().forEach(x=>t.setParent(x,w(x))),t}setDefaultEdgeLabel(r){return this._defaultEdgeLabelFn=r,typeof r!="function"&&(this._defaultEdgeLabelFn=()=>r),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(r,t){var d=this,l=arguments;return r.reduce(function(w,x){return l.length>1?d.setEdge(w,x,t):d.setEdge(w,x),x}),this}setEdge(){var r,t,d,l,w=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(r=x.v,t=x.w,d=x.name,arguments.length===2&&(l=arguments[1],w=!0)):(r=x,t=arguments[1],d=arguments[3],arguments.length>2&&(l=arguments[2],w=!0)),r=""+r,t=""+t,d!==void 0&&(d=""+d);var c=e(this._isDirected,r,t,d);if(Object.hasOwn(this._edgeLabels,c))return w&&(this._edgeLabels[c]=l),this;if(d!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(t),this._edgeLabels[c]=w?l:this._defaultEdgeLabelFn(r,t,d);var g=s(this._isDirected,r,t,d);return r=g.v,t=g.w,Object.freeze(g),this._edgeObjs[c]=g,a(this._preds[t],r),a(this._sucs[r],t),this._in[t][c]=g,this._out[r][c]=g,this._edgeCount++,this}edge(r,t,d){var l=arguments.length===1?n(this._isDirected,arguments[0]):e(this._isDirected,r,t,d);return this._edgeLabels[l]}edgeAsObj(){const r=this.edge(...arguments);return typeof r!="object"?{label:r}:r}hasEdge(r,t,d){var l=arguments.length===1?n(this._isDirected,arguments[0]):e(this._isDirected,r,t,d);return Object.hasOwn(this._edgeLabels,l)}removeEdge(r,t,d){var l=arguments.length===1?n(this._isDirected,arguments[0]):e(this._isDirected,r,t,d),w=this._edgeObjs[l];return w&&(r=w.v,t=w.w,delete this._edgeLabels[l],delete this._edgeObjs[l],i(this._preds[t],r),i(this._sucs[r],t),delete this._in[t][l],delete this._out[r][l],this._edgeCount--),this}inEdges(r,t){var d=this._in[r];if(d){var l=Object.values(d);return t?l.filter(w=>w.v===t):l}}outEdges(r,t){var d=this._out[r];if(d){var l=Object.values(d);return t?l.filter(w=>w.w===t):l}}nodeEdges(r,t){var d=this.inEdges(r,t);if(d)return d.concat(this.outEdges(r,t))}}function a(o,r){o[r]?o[r]++:o[r]=1}function i(o,r){--o[r]||delete o[r]}function e(o,r,t,d){var l=""+r,w=""+t;if(!o&&l>w){var x=l;l=w,w=x}return l+f+w+f+(d===void 0?_:d)}function s(o,r,t,d){var l=""+r,w=""+t;if(!o&&l>w){var x=l;l=w,w=x}var c={v:l,w};return d&&(c.name=d),c}function n(o,r){return e(o,r.v,r.w,r.name)}return J=u,J}var K,Qe;function Zr(){return Qe||(Qe=1,K="2.2.4"),K}var Z,$e;function et(){return $e||($e=1,Z={Graph:Ye(),version:Zr()}),Z}var ee,Je;function rt(){if(Je)return ee;Je=1;var _=Ye();ee={write:m,read:a};function m(i){var e={options:{directed:i.isDirected(),multigraph:i.isMultigraph(),compound:i.isCompound()},nodes:f(i),edges:u(i)};return i.graph()!==void 0&&(e.value=structuredClone(i.graph())),e}function f(i){return i.nodes().map(function(e){var s=i.node(e),n=i.parent(e),o={v:e};return s!==void 0&&(o.value=s),n!==void 0&&(o.parent=n),o})}function u(i){return i.edges().map(function(e){var s=i.edge(e),n={v:e.v,w:e.w};return e.name!==void 0&&(n.name=e.name),s!==void 0&&(n.value=s),n})}function a(i){var e=new _(i.options).setGraph(i.value);return i.nodes.forEach(function(s){e.setNode(s.v,s.value),s.parent&&e.setParent(s.v,s.parent)}),i.edges.forEach(function(s){e.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),e}return ee}var re,Ke;function tt(){if(Ke)return re;Ke=1,re=_;function _(m){var f={},u=[],a;function i(e){Object.hasOwn(f,e)||(f[e]=!0,a.push(e),m.successors(e).forEach(i),m.predecessors(e).forEach(i))}return m.nodes().forEach(function(e){a=[],i(e),a.length&&u.push(a)}),u}return re}var te,Ze;function Vr(){if(Ze)return te;Ze=1;class _{constructor(){F(this,"_arr",[]);F(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(f){return f.key})}has(f){return Object.hasOwn(this._keyIndices,f)}priority(f){var u=this._keyIndices[f];if(u!==void 0)return this._arr[u].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(f,u){var a=this._keyIndices;if(f=String(f),!Object.hasOwn(a,f)){var i=this._arr,e=i.length;return a[f]=e,i.push({key:f,priority:u}),this._decrease(e),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var f=this._arr.pop();return delete this._keyIndices[f.key],this._heapify(0),f.key}decrease(f,u){var a=this._keyIndices[f];if(u>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+f+" Old: "+this._arr[a].priority+" New: "+u);this._arr[a].priority=u,this._decrease(a)}_heapify(f){var u=this._arr,a=2*f,i=a+1,e=f;a<u.length&&(e=u[a].priority<u[e].priority?a:e,i<u.length&&(e=u[i].priority<u[e].priority?i:e),e!==f&&(this._swap(f,e),this._heapify(e)))}_decrease(f){for(var u=this._arr,a=u[f].priority,i;f!==0&&(i=f>>1,!(u[i].priority<a));)this._swap(f,i),f=i}_swap(f,u){var a=this._arr,i=this._keyIndices,e=a[f],s=a[u];a[f]=s,a[u]=e,i[s.key]=f,i[e.key]=u}}return te=_,te}var ne,er;function Br(){if(er)return ne;er=1;var _=Vr();ne=f;var m=()=>1;function f(a,i,e,s){return u(a,String(i),e||m,s||function(n){return a.outEdges(n)})}function u(a,i,e,s){var n={},o=new _,r,t,d=function(l){var w=l.v!==r?l.v:l.w,x=n[w],c=e(l),g=t.distance+c;if(c<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+l+" Weight: "+c);g<x.distance&&(x.distance=g,x.predecessor=r,o.decrease(w,g))};for(a.nodes().forEach(function(l){var w=l===i?0:Number.POSITIVE_INFINITY;n[l]={distance:w},o.add(l,w)});o.size()>0&&(r=o.removeMin(),t=n[r],t.distance!==Number.POSITIVE_INFINITY);)s(r).forEach(d);return n}return ne}var ie,rr;function nt(){if(rr)return ie;rr=1;var _=Br();ie=m;function m(f,u,a){return f.nodes().reduce(function(i,e){return i[e]=_(f,e,u,a),i},{})}return ie}var ae,tr;function Wr(){if(tr)return ae;tr=1,ae=_;function _(m){var f=0,u=[],a={},i=[];function e(s){var n=a[s]={onStack:!0,lowlink:f,index:f++};if(u.push(s),m.successors(s).forEach(function(t){Object.hasOwn(a,t)?a[t].onStack&&(n.lowlink=Math.min(n.lowlink,a[t].index)):(e(t),n.lowlink=Math.min(n.lowlink,a[t].lowlink))}),n.lowlink===n.index){var o=[],r;do r=u.pop(),a[r].onStack=!1,o.push(r);while(s!==r);i.push(o)}}return m.nodes().forEach(function(s){Object.hasOwn(a,s)||e(s)}),i}return ae}var se,nr;function it(){if(nr)return se;nr=1;var _=Wr();se=m;function m(f){return _(f).filter(function(u){return u.length>1||u.length===1&&f.hasEdge(u[0],u[0])})}return se}var oe,ir;function at(){if(ir)return oe;ir=1,oe=m;var _=()=>1;function m(u,a,i){return f(u,a||_,i||function(e){return u.outEdges(e)})}function f(u,a,i){var e={},s=u.nodes();return s.forEach(function(n){e[n]={},e[n][n]={distance:0},s.forEach(function(o){n!==o&&(e[n][o]={distance:Number.POSITIVE_INFINITY})}),i(n).forEach(function(o){var r=o.v===n?o.w:o.v,t=a(o);e[n][r]={distance:t,predecessor:n}})}),s.forEach(function(n){var o=e[n];s.forEach(function(r){var t=e[r];s.forEach(function(d){var l=t[n],w=o[d],x=t[d],c=l.distance+w.distance;c<x.distance&&(x.distance=c,x.predecessor=w.predecessor)})})}),e}return oe}var ue,ar;function Yr(){if(ar)return ue;ar=1;function _(f){var u={},a={},i=[];function e(s){if(Object.hasOwn(a,s))throw new m;Object.hasOwn(u,s)||(a[s]=!0,u[s]=!0,f.predecessors(s).forEach(e),delete a[s],i.push(s))}if(f.sinks().forEach(e),Object.keys(u).length!==f.nodeCount())throw new m;return i}class m extends Error{constructor(){super(...arguments)}}return ue=_,_.CycleException=m,ue}var de,sr;function st(){if(sr)return de;sr=1;var _=Yr();de=m;function m(f){try{_(f)}catch(u){if(u instanceof _.CycleException)return!1;throw u}return!0}return de}var le,or;function zr(){if(or)return le;or=1,le=_;function _(a,i,e){Array.isArray(i)||(i=[i]);var s=a.isDirected()?t=>a.successors(t):t=>a.neighbors(t),n=e==="post"?m:f,o=[],r={};return i.forEach(t=>{if(!a.hasNode(t))throw new Error("Graph does not have node: "+t);n(t,s,r,o)}),o}function m(a,i,e,s){for(var n=[[a,!1]];n.length>0;){var o=n.pop();o[1]?s.push(o[0]):Object.hasOwn(e,o[0])||(e[o[0]]=!0,n.push([o[0],!0]),u(i(o[0]),r=>n.push([r,!1])))}}function f(a,i,e,s){for(var n=[a];n.length>0;){var o=n.pop();Object.hasOwn(e,o)||(e[o]=!0,s.push(o),u(i(o),r=>n.push(r)))}}function u(a,i){for(var e=a.length;e--;)i(a[e],e,a);return a}return le}var he,ur;function ot(){if(ur)return he;ur=1;var _=zr();he=m;function m(f,u){return _(f,u,"post")}return he}var fe,dr;function ut(){if(dr)return fe;dr=1;var _=zr();fe=m;function m(f,u){return _(f,u,"pre")}return fe}var ce,lr;function dt(){if(lr)return ce;lr=1;var _=Ye(),m=Vr();ce=f;function f(u,a){var i=new _,e={},s=new m,n;function o(t){var d=t.v===n?t.w:t.v,l=s.priority(d);if(l!==void 0){var w=a(t);w<l&&(e[d]=n,s.decrease(d,w))}}if(u.nodeCount()===0)return i;u.nodes().forEach(function(t){s.add(t,Number.POSITIVE_INFINITY),i.setNode(t)}),s.decrease(u.nodes()[0],0);for(var r=!1;s.size()>0;){if(n=s.removeMin(),Object.hasOwn(e,n))i.setEdge(n,e[n]);else{if(r)throw new Error("Input graph is not connected: "+u);r=!0}u.nodeEdges(n).forEach(o)}return i}return ce}var pe,hr;function lt(){return hr||(hr=1,pe={components:tt(),dijkstra:Br(),dijkstraAll:nt(),findCycles:it(),floydWarshall:at(),isAcyclic:st(),postorder:ot(),preorder:ut(),prim:dt(),tarjan:Wr(),topsort:Yr()}),pe}var me,fr;function Y(){if(fr)return me;fr=1;var _=et();return me={Graph:_.Graph,json:rt(),alg:lt(),version:_.version},me}var be,cr;function ht(){if(cr)return be;cr=1;class _{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,i=a._prev;if(i!==a)return m(i),i}enqueue(a){let i=this._sentinel;a._prev&&a._next&&m(a),a._next=i._next,i._next._prev=a,i._next=a,a._prev=i}toString(){let a=[],i=this._sentinel,e=i._prev;for(;e!==i;)a.push(JSON.stringify(e,f)),e=e._prev;return"["+a.join(", ")+"]"}}function m(u){u._prev._next=u._next,u._next._prev=u._prev,delete u._next,delete u._prev}function f(u,a){if(u!=="_next"&&u!=="_prev")return a}return be=_,be}var ve,pr;function ft(){if(pr)return ve;pr=1;let _=Y().Graph,m=ht();ve=u;let f=()=>1;function u(o,r){if(o.nodeCount()<=1)return[];let t=e(o,r||f);return a(t.graph,t.buckets,t.zeroIdx).flatMap(l=>o.outEdges(l.v,l.w))}function a(o,r,t){let d=[],l=r[r.length-1],w=r[0],x;for(;o.nodeCount();){for(;x=w.dequeue();)i(o,r,t,x);for(;x=l.dequeue();)i(o,r,t,x);if(o.nodeCount()){for(let c=r.length-2;c>0;--c)if(x=r[c].dequeue(),x){d=d.concat(i(o,r,t,x,!0));break}}}return d}function i(o,r,t,d,l){let w=l?[]:void 0;return o.inEdges(d.v).forEach(x=>{let c=o.edge(x),g=o.node(x.v);l&&w.push({v:x.v,w:x.w}),g.out-=c,s(r,t,g)}),o.outEdges(d.v).forEach(x=>{let c=o.edge(x),g=x.w,p=o.node(g);p.in-=c,s(r,t,p)}),o.removeNode(d.v),w}function e(o,r){let t=new _,d=0,l=0;o.nodes().forEach(c=>{t.setNode(c,{v:c,in:0,out:0})}),o.edges().forEach(c=>{let g=t.edge(c.v,c.w)||0,p=r(c),O=g+p;t.setEdge(c.v,c.w,O),l=Math.max(l,t.node(c.v).out+=p),d=Math.max(d,t.node(c.w).in+=p)});let w=n(l+d+3).map(()=>new m),x=d+1;return t.nodes().forEach(c=>{s(w,x,t.node(c))}),{graph:t,buckets:w,zeroIdx:x}}function s(o,r,t){t.out?t.in?o[t.out-t.in+r].enqueue(t):o[o.length-1].enqueue(t):o[0].enqueue(t)}function n(o){const r=[];for(let t=0;t<o;t++)r.push(t);return r}return ve}var we,mr;function A(){if(mr)return we;mr=1;let _=Y().Graph;we={addBorderNode:r,addDummyNode:m,applyWithChunking:l,asNonCompoundGraph:u,buildLayerMatrix:s,intersectRect:e,mapValues:j,maxRank:w,normalizeRanks:n,notime:g,partition:x,pick:I,predecessorWeights:i,range:C,removeEmptyRanks:o,simplify:f,successorWeights:a,time:c,uniqueId:O,zipObject:L};function m(h,b,E,k){for(var R=k;h.hasNode(R);)R=O(k);return E.dummy=b,h.setNode(R,E),R}function f(h){let b=new _().setGraph(h.graph());return h.nodes().forEach(E=>b.setNode(E,h.node(E))),h.edges().forEach(E=>{let k=b.edge(E.v,E.w)||{weight:0,minlen:1},R=h.edge(E);b.setEdge(E.v,E.w,{weight:k.weight+R.weight,minlen:Math.max(k.minlen,R.minlen)})}),b}function u(h){let b=new _({multigraph:h.isMultigraph()}).setGraph(h.graph());return h.nodes().forEach(E=>{h.children(E).length||b.setNode(E,h.node(E))}),h.edges().forEach(E=>{b.setEdge(E,h.edge(E))}),b}function a(h){let b=h.nodes().map(E=>{let k={};return h.outEdges(E).forEach(R=>{k[R.w]=(k[R.w]||0)+h.edge(R).weight}),k});return L(h.nodes(),b)}function i(h){let b=h.nodes().map(E=>{let k={};return h.inEdges(E).forEach(R=>{k[R.v]=(k[R.v]||0)+h.edge(R).weight}),k});return L(h.nodes(),b)}function e(h,b){let E=h.x,k=h.y,R=b.x-E,T=b.y-k,S=h.width/2,D=h.height/2;if(!R&&!T)throw new Error("Not possible to find intersection inside of the rectangle");let z,U;return Math.abs(T)*S>Math.abs(R)*D?(T<0&&(D=-D),z=D*R/T,U=D):(R<0&&(S=-S),z=S,U=S*T/R),{x:E+z,y:k+U}}function s(h){let b=C(w(h)+1).map(()=>[]);return h.nodes().forEach(E=>{let k=h.node(E),R=k.rank;R!==void 0&&(b[R][k.order]=E)}),b}function n(h){let b=h.nodes().map(k=>{let R=h.node(k).rank;return R===void 0?Number.MAX_VALUE:R}),E=l(Math.min,b);h.nodes().forEach(k=>{let R=h.node(k);Object.hasOwn(R,"rank")&&(R.rank-=E)})}function o(h){let b=h.nodes().map(S=>h.node(S).rank),E=l(Math.min,b),k=[];h.nodes().forEach(S=>{let D=h.node(S).rank-E;k[D]||(k[D]=[]),k[D].push(S)});let R=0,T=h.graph().nodeRankFactor;Array.from(k).forEach((S,D)=>{S===void 0&&D%T!==0?--R:S!==void 0&&R&&S.forEach(z=>h.node(z).rank+=R)})}function r(h,b,E,k){let R={width:0,height:0};return arguments.length>=4&&(R.rank=E,R.order=k),m(h,"border",R,b)}function t(h,b=d){const E=[];for(let k=0;k<h.length;k+=b){const R=h.slice(k,k+b);E.push(R)}return E}const d=65535;function l(h,b){if(b.length>d){const E=t(b);return h.apply(null,E.map(k=>h.apply(null,k)))}else return h.apply(null,b)}function w(h){const E=h.nodes().map(k=>{let R=h.node(k).rank;return R===void 0?Number.MIN_VALUE:R});return l(Math.max,E)}function x(h,b){let E={lhs:[],rhs:[]};return h.forEach(k=>{b(k)?E.lhs.push(k):E.rhs.push(k)}),E}function c(h,b){let E=Date.now();try{return b()}finally{console.log(h+" time: "+(Date.now()-E)+"ms")}}function g(h,b){return b()}let p=0;function O(h){var b=++p;return h+(""+b)}function C(h,b,E=1){b==null&&(b=h,h=0);let k=T=>T<b;E<0&&(k=T=>b<T);const R=[];for(let T=h;k(T);T+=E)R.push(T);return R}function I(h,b){const E={};for(const k of b)h[k]!==void 0&&(E[k]=h[k]);return E}function j(h,b){let E=b;return typeof b=="string"&&(E=k=>k[b]),Object.entries(h).reduce((k,[R,T])=>(k[R]=E(T,R),k),{})}function L(h,b){return h.reduce((E,k,R)=>(E[k]=b[R],E),{})}return we}var ge,br;function ct(){if(br)return ge;br=1;let _=ft(),m=A().uniqueId;ge={run:f,undo:a};function f(i){(i.graph().acyclicer==="greedy"?_(i,s(i)):u(i)).forEach(n=>{let o=i.edge(n);i.removeEdge(n),o.forwardName=n.name,o.reversed=!0,i.setEdge(n.w,n.v,o,m("rev"))});function s(n){return o=>n.edge(o).weight}}function u(i){let e=[],s={},n={};function o(r){Object.hasOwn(n,r)||(n[r]=!0,s[r]=!0,i.outEdges(r).forEach(t=>{Object.hasOwn(s,t.w)?e.push(t):o(t.w)}),delete s[r])}return i.nodes().forEach(o),e}function a(i){i.edges().forEach(e=>{let s=i.edge(e);if(s.reversed){i.removeEdge(e);let n=s.forwardName;delete s.reversed,delete s.forwardName,i.setEdge(e.w,e.v,s,n)}})}return ge}var Ee,vr;function pt(){if(vr)return Ee;vr=1;let _=A();Ee={run:m,undo:u};function m(a){a.graph().dummyChains=[],a.edges().forEach(i=>f(a,i))}function f(a,i){let e=i.v,s=a.node(e).rank,n=i.w,o=a.node(n).rank,r=i.name,t=a.edge(i),d=t.labelRank;if(o===s+1)return;a.removeEdge(i);let l,w,x;for(x=0,++s;s<o;++x,++s)t.points=[],w={width:0,height:0,edgeLabel:t,edgeObj:i,rank:s},l=_.addDummyNode(a,"edge",w,"_d"),s===d&&(w.width=t.width,w.height=t.height,w.dummy="edge-label",w.labelpos=t.labelpos),a.setEdge(e,l,{weight:t.weight},r),x===0&&a.graph().dummyChains.push(l),e=l;a.setEdge(e,n,{weight:t.weight},r)}function u(a){a.graph().dummyChains.forEach(i=>{let e=a.node(i),s=e.edgeLabel,n;for(a.setEdge(e.edgeObj,s);e.dummy;)n=a.successors(i)[0],a.removeNode(i),s.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(s.x=e.x,s.y=e.y,s.width=e.width,s.height=e.height),i=n,e=a.node(i)})}return Ee}var _e,wr;function X(){if(wr)return _e;wr=1;const{applyWithChunking:_}=A();_e={longestPath:m,slack:f};function m(u){var a={};function i(e){var s=u.node(e);if(Object.hasOwn(a,e))return s.rank;a[e]=!0;let n=u.outEdges(e).map(r=>r==null?Number.POSITIVE_INFINITY:i(r.w)-u.edge(r).minlen);var o=_(Math.min,n);return o===Number.POSITIVE_INFINITY&&(o=0),s.rank=o}u.sources().forEach(i)}function f(u,a){return u.node(a.w).rank-u.node(a.v).rank-u.edge(a).minlen}return _e}var ye,gr;function Ur(){if(gr)return ye;gr=1;var _=Y().Graph,m=X().slack;ye=f;function f(e){var s=new _({directed:!1}),n=e.nodes()[0],o=e.nodeCount();s.setNode(n,{});for(var r,t;u(s,e)<o;)r=a(s,e),t=s.hasNode(r.v)?m(e,r):-m(e,r),i(s,e,t);return s}function u(e,s){function n(o){s.nodeEdges(o).forEach(r=>{var t=r.v,d=o===t?r.w:t;!e.hasNode(d)&&!m(s,r)&&(e.setNode(d,{}),e.setEdge(o,d,{}),n(d))})}return e.nodes().forEach(n),e.nodeCount()}function a(e,s){return s.edges().reduce((o,r)=>{let t=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(t=m(s,r)),t<o[0]?[t,r]:o},[Number.POSITIVE_INFINITY,null])[1]}function i(e,s,n){e.nodes().forEach(o=>s.node(o).rank+=n)}return ye}var ke,Er;function mt(){if(Er)return ke;Er=1;var _=Ur(),m=X().slack,f=X().longestPath,u=Y().alg.preorder,a=Y().alg.postorder,i=A().simplify;ke=e,e.initLowLimValues=r,e.initCutValues=s,e.calcCutValue=o,e.leaveEdge=d,e.enterEdge=l,e.exchangeEdges=w;function e(p){p=i(p),f(p);var O=_(p);r(O),s(O,p);for(var C,I;C=d(O);)I=l(O,p,C),w(O,p,C,I)}function s(p,O){var C=a(p,p.nodes());C=C.slice(0,C.length-1),C.forEach(I=>n(p,O,I))}function n(p,O,C){var I=p.node(C),j=I.parent;p.edge(C,j).cutvalue=o(p,O,C)}function o(p,O,C){var I=p.node(C),j=I.parent,L=!0,h=O.edge(C,j),b=0;return h||(L=!1,h=O.edge(j,C)),b=h.weight,O.nodeEdges(C).forEach(E=>{var k=E.v===C,R=k?E.w:E.v;if(R!==j){var T=k===L,S=O.edge(E).weight;if(b+=T?S:-S,c(p,C,R)){var D=p.edge(C,R).cutvalue;b+=T?-D:D}}}),b}function r(p,O){arguments.length<2&&(O=p.nodes()[0]),t(p,{},1,O)}function t(p,O,C,I,j){var L=C,h=p.node(I);return O[I]=!0,p.neighbors(I).forEach(b=>{Object.hasOwn(O,b)||(C=t(p,O,C,b,I))}),h.low=L,h.lim=C++,j?h.parent=j:delete h.parent,C}function d(p){return p.edges().find(O=>p.edge(O).cutvalue<0)}function l(p,O,C){var I=C.v,j=C.w;O.hasEdge(I,j)||(I=C.w,j=C.v);var L=p.node(I),h=p.node(j),b=L,E=!1;L.lim>h.lim&&(b=h,E=!0);var k=O.edges().filter(R=>E===g(p,p.node(R.v),b)&&E!==g(p,p.node(R.w),b));return k.reduce((R,T)=>m(O,T)<m(O,R)?T:R)}function w(p,O,C,I){var j=C.v,L=C.w;p.removeEdge(j,L),p.setEdge(I.v,I.w,{}),r(p),s(p,O),x(p,O)}function x(p,O){var C=p.nodes().find(j=>!O.node(j).parent),I=u(p,C);I=I.slice(1),I.forEach(j=>{var L=p.node(j).parent,h=O.edge(j,L),b=!1;h||(h=O.edge(L,j),b=!0),O.node(j).rank=O.node(L).rank+(b?h.minlen:-h.minlen)})}function c(p,O,C){return p.hasEdge(O,C)}function g(p,O,C){return C.low<=O.lim&&O.lim<=C.lim}return ke}var Oe,_r;function bt(){if(_r)return Oe;_r=1;var _=X(),m=_.longestPath,f=Ur(),u=mt();Oe=a;function a(n){var o=n.graph().ranker;if(o instanceof Function)return o(n);switch(n.graph().ranker){case"network-simplex":s(n);break;case"tight-tree":e(n);break;case"longest-path":i(n);break;case"none":break;default:s(n)}}var i=m;function e(n){m(n),f(n)}function s(n){u(n)}return Oe}var Ne,yr;function vt(){if(yr)return Ne;yr=1,Ne=_;function _(u){let a=f(u);u.graph().dummyChains.forEach(i=>{let e=u.node(i),s=e.edgeObj,n=m(u,a,s.v,s.w),o=n.path,r=n.lca,t=0,d=o[t],l=!0;for(;i!==s.w;){if(e=u.node(i),l){for(;(d=o[t])!==r&&u.node(d).maxRank<e.rank;)t++;d===r&&(l=!1)}if(!l){for(;t<o.length-1&&u.node(d=o[t+1]).minRank<=e.rank;)t++;d=o[t]}u.setParent(i,d),i=u.successors(i)[0]}})}function m(u,a,i,e){let s=[],n=[],o=Math.min(a[i].low,a[e].low),r=Math.max(a[i].lim,a[e].lim),t,d;t=i;do t=u.parent(t),s.push(t);while(t&&(a[t].low>o||r>a[t].lim));for(d=t,t=e;(t=u.parent(t))!==d;)n.push(t);return{path:s.concat(n.reverse()),lca:d}}function f(u){let a={},i=0;function e(s){let n=i;u.children(s).forEach(e),a[s]={low:n,lim:i++}}return u.children().forEach(e),a}return Ne}var Ce,kr;function wt(){if(kr)return Ce;kr=1;let _=A();Ce={run:m,cleanup:i};function m(e){let s=_.addDummyNode(e,"root",{},"_root"),n=u(e),o=Object.values(n),r=_.applyWithChunking(Math.max,o)-1,t=2*r+1;e.graph().nestingRoot=s,e.edges().forEach(l=>e.edge(l).minlen*=t);let d=a(e)+1;e.children().forEach(l=>f(e,s,t,d,r,n,l)),e.graph().nodeRankFactor=t}function f(e,s,n,o,r,t,d){let l=e.children(d);if(!l.length){d!==s&&e.setEdge(s,d,{weight:0,minlen:n});return}let w=_.addBorderNode(e,"_bt"),x=_.addBorderNode(e,"_bb"),c=e.node(d);e.setParent(w,d),c.borderTop=w,e.setParent(x,d),c.borderBottom=x,l.forEach(g=>{f(e,s,n,o,r,t,g);let p=e.node(g),O=p.borderTop?p.borderTop:g,C=p.borderBottom?p.borderBottom:g,I=p.borderTop?o:2*o,j=O!==C?1:r-t[d]+1;e.setEdge(w,O,{weight:I,minlen:j,nestingEdge:!0}),e.setEdge(C,x,{weight:I,minlen:j,nestingEdge:!0})}),e.parent(d)||e.setEdge(s,w,{weight:0,minlen:r+t[d]})}function u(e){var s={};function n(o,r){var t=e.children(o);t&&t.length&&t.forEach(d=>n(d,r+1)),s[o]=r}return e.children().forEach(o=>n(o,1)),s}function a(e){return e.edges().reduce((s,n)=>s+e.edge(n).weight,0)}function i(e){var s=e.graph();e.removeNode(s.nestingRoot),delete s.nestingRoot,e.edges().forEach(n=>{var o=e.edge(n);o.nestingEdge&&e.removeEdge(n)})}return Ce}var xe,Or;function gt(){if(Or)return xe;Or=1;let _=A();xe=m;function m(u){function a(i){let e=u.children(i),s=u.node(i);if(e.length&&e.forEach(a),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let n=s.minRank,o=s.maxRank+1;n<o;++n)f(u,"borderLeft","_bl",i,s,n),f(u,"borderRight","_br",i,s,n)}}u.children().forEach(a)}function f(u,a,i,e,s,n){let o={width:0,height:0,rank:n,borderType:a},r=s[a][n-1],t=_.addDummyNode(u,"border",o,i);s[a][n]=t,u.setParent(t,e),r&&u.setEdge(r,t,{weight:1})}return xe}var Re,Nr;function Et(){if(Nr)return Re;Nr=1,Re={adjust:_,undo:m};function _(n){let o=n.graph().rankdir.toLowerCase();(o==="lr"||o==="rl")&&f(n)}function m(n){let o=n.graph().rankdir.toLowerCase();(o==="bt"||o==="rl")&&a(n),(o==="lr"||o==="rl")&&(e(n),f(n))}function f(n){n.nodes().forEach(o=>u(n.node(o))),n.edges().forEach(o=>u(n.edge(o)))}function u(n){let o=n.width;n.width=n.height,n.height=o}function a(n){n.nodes().forEach(o=>i(n.node(o))),n.edges().forEach(o=>{let r=n.edge(o);r.points.forEach(i),Object.hasOwn(r,"y")&&i(r)})}function i(n){n.y=-n.y}function e(n){n.nodes().forEach(o=>s(n.node(o))),n.edges().forEach(o=>{let r=n.edge(o);r.points.forEach(s),Object.hasOwn(r,"x")&&s(r)})}function s(n){let o=n.x;n.x=n.y,n.y=o}return Re}var Ie,Cr;function _t(){if(Cr)return Ie;Cr=1;let _=A();Ie=m;function m(f){let u={},a=f.nodes().filter(r=>!f.children(r).length),i=a.map(r=>f.node(r).rank),e=_.applyWithChunking(Math.max,i),s=_.range(e+1).map(()=>[]);function n(r){if(u[r])return;u[r]=!0;let t=f.node(r);s[t.rank].push(r),f.successors(r).forEach(n)}return a.sort((r,t)=>f.node(r).rank-f.node(t).rank).forEach(n),s}return Ie}var je,xr;function yt(){if(xr)return je;xr=1;let _=A().zipObject;je=m;function m(u,a){let i=0;for(let e=1;e<a.length;++e)i+=f(u,a[e-1],a[e]);return i}function f(u,a,i){let e=_(i,i.map((d,l)=>l)),s=a.flatMap(d=>u.outEdges(d).map(l=>({pos:e[l.w],weight:u.edge(l).weight})).sort((l,w)=>l.pos-w.pos)),n=1;for(;n<i.length;)n<<=1;let o=2*n-1;n-=1;let r=new Array(o).fill(0),t=0;return s.forEach(d=>{let l=d.pos+n;r[l]+=d.weight;let w=0;for(;l>0;)l%2&&(w+=r[l+1]),l=l-1>>1,r[l]+=d.weight;t+=d.weight*w}),t}return je}var qe,Rr;function kt(){if(Rr)return qe;Rr=1,qe=_;function _(m,f=[]){return f.map(u=>{let a=m.inEdges(u);if(a.length){let i=a.reduce((e,s)=>{let n=m.edge(s),o=m.node(s.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}},{sum:0,weight:0});return{v:u,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:u}})}return qe}var Le,Ir;function Ot(){if(Ir)return Le;Ir=1;let _=A();Le=m;function m(a,i){let e={};a.forEach((n,o)=>{let r=e[n.v]={indegree:0,in:[],out:[],vs:[n.v],i:o};n.barycenter!==void 0&&(r.barycenter=n.barycenter,r.weight=n.weight)}),i.edges().forEach(n=>{let o=e[n.v],r=e[n.w];o!==void 0&&r!==void 0&&(r.indegree++,o.out.push(e[n.w]))});let s=Object.values(e).filter(n=>!n.indegree);return f(s)}function f(a){let i=[];function e(n){return o=>{o.merged||(o.barycenter===void 0||n.barycenter===void 0||o.barycenter>=n.barycenter)&&u(n,o)}}function s(n){return o=>{o.in.push(n),--o.indegree===0&&a.push(o)}}for(;a.length;){let n=a.pop();i.push(n),n.in.reverse().forEach(e(n)),n.out.forEach(s(n))}return i.filter(n=>!n.merged).map(n=>_.pick(n,["vs","i","barycenter","weight"]))}function u(a,i){let e=0,s=0;a.weight&&(e+=a.barycenter*a.weight,s+=a.weight),i.weight&&(e+=i.barycenter*i.weight,s+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=e/s,a.weight=s,a.i=Math.min(i.i,a.i),i.merged=!0}return Le}var Te,jr;function Nt(){if(jr)return Te;jr=1;let _=A();Te=m;function m(a,i){let e=_.partition(a,w=>Object.hasOwn(w,"barycenter")),s=e.lhs,n=e.rhs.sort((w,x)=>x.i-w.i),o=[],r=0,t=0,d=0;s.sort(u(!!i)),d=f(o,n,d),s.forEach(w=>{d+=w.vs.length,o.push(w.vs),r+=w.barycenter*w.weight,t+=w.weight,d=f(o,n,d)});let l={vs:o.flat(!0)};return t&&(l.barycenter=r/t,l.weight=t),l}function f(a,i,e){let s;for(;i.length&&(s=i[i.length-1]).i<=e;)i.pop(),a.push(s.vs),e++;return e}function u(a){return(i,e)=>i.barycenter<e.barycenter?-1:i.barycenter>e.barycenter?1:a?e.i-i.i:i.i-e.i}return Te}var Se,qr;function Ct(){if(qr)return Se;qr=1;let _=kt(),m=Ot(),f=Nt();Se=u;function u(e,s,n,o){let r=e.children(s),t=e.node(s),d=t?t.borderLeft:void 0,l=t?t.borderRight:void 0,w={};d&&(r=r.filter(p=>p!==d&&p!==l));let x=_(e,r);x.forEach(p=>{if(e.children(p.v).length){let O=u(e,p.v,n,o);w[p.v]=O,Object.hasOwn(O,"barycenter")&&i(p,O)}});let c=m(x,n);a(c,w);let g=f(c,o);if(d&&(g.vs=[d,g.vs,l].flat(!0),e.predecessors(d).length)){let p=e.node(e.predecessors(d)[0]),O=e.node(e.predecessors(l)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+O.order)/(g.weight+2),g.weight+=2}return g}function a(e,s){e.forEach(n=>{n.vs=n.vs.flatMap(o=>s[o]?s[o].vs:o)})}function i(e,s){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+s.barycenter*s.weight)/(e.weight+s.weight),e.weight+=s.weight):(e.barycenter=s.barycenter,e.weight=s.weight)}return Se}var Me,Lr;function xt(){if(Lr)return Me;Lr=1;let _=Y().Graph,m=A();Me=f;function f(a,i,e,s){s||(s=a.nodes());let n=u(a),o=new _({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(r=>a.node(r));return s.forEach(r=>{let t=a.node(r),d=a.parent(r);(t.rank===i||t.minRank<=i&&i<=t.maxRank)&&(o.setNode(r),o.setParent(r,d||n),a[e](r).forEach(l=>{let w=l.v===r?l.w:l.v,x=o.edge(w,r),c=x!==void 0?x.weight:0;o.setEdge(w,r,{weight:a.edge(l).weight+c})}),Object.hasOwn(t,"minRank")&&o.setNode(r,{borderLeft:t.borderLeft[i],borderRight:t.borderRight[i]}))}),o}function u(a){for(var i;a.hasNode(i=m.uniqueId("_root")););return i}return Me}var Pe,Tr;function Rt(){if(Tr)return Pe;Tr=1,Pe=_;function _(m,f,u){let a={},i;u.forEach(e=>{let s=m.parent(e),n,o;for(;s;){if(n=m.parent(s),n?(o=a[n],a[n]=s):(o=i,i=s),o&&o!==s){f.setEdge(o,s);return}s=n}})}return Pe}var De,Sr;function It(){if(Sr)return De;Sr=1;let _=_t(),m=yt(),f=Ct(),u=xt(),a=Rt(),i=Y().Graph,e=A();De=s;function s(t,d){if(d&&typeof d.customOrder=="function"){d.customOrder(t,s);return}let l=e.maxRank(t),w=n(t,e.range(1,l+1),"inEdges"),x=n(t,e.range(l-1,-1,-1),"outEdges"),c=_(t);if(r(t,c),d&&d.disableOptimalOrderHeuristic)return;let g=Number.POSITIVE_INFINITY,p;for(let O=0,C=0;C<4;++O,++C){o(O%2?w:x,O%4>=2),c=e.buildLayerMatrix(t);let I=m(t,c);I<g&&(C=0,p=Object.assign({},c),g=I)}r(t,p)}function n(t,d,l){const w=new Map,x=(c,g)=>{w.has(c)||w.set(c,[]),w.get(c).push(g)};for(const c of t.nodes()){const g=t.node(c);if(typeof g.rank=="number"&&x(g.rank,c),typeof g.minRank=="number"&&typeof g.maxRank=="number")for(let p=g.minRank;p<=g.maxRank;p++)p!==g.rank&&x(p,c)}return d.map(function(c){return u(t,c,l,w.get(c)||[])})}function o(t,d){let l=new i;t.forEach(function(w){let x=w.graph().root,c=f(w,x,l,d);c.vs.forEach((g,p)=>w.node(g).order=p),a(w,l,c.vs)})}function r(t,d){Object.values(d).forEach(l=>l.forEach((w,x)=>t.node(w).order=x))}return De}var Ge,Mr;function jt(){if(Mr)return Ge;Mr=1;let _=Y().Graph,m=A();Ge={positionX:l,findType1Conflicts:f,findType2Conflicts:u,addConflict:i,hasConflict:e,verticalAlignment:s,horizontalCompaction:n,alignCoordinates:t,findSmallestWidthAlignment:r,balance:d};function f(c,g){let p={};function O(C,I){let j=0,L=0,h=C.length,b=I[I.length-1];return I.forEach((E,k)=>{let R=a(c,E),T=R?c.node(R).order:h;(R||E===b)&&(I.slice(L,k+1).forEach(S=>{c.predecessors(S).forEach(D=>{let z=c.node(D),U=z.order;(U<j||T<U)&&!(z.dummy&&c.node(S).dummy)&&i(p,D,S)})}),L=k+1,j=T)}),I}return g.length&&g.reduce(O),p}function u(c,g){let p={};function O(I,j,L,h,b){let E;m.range(j,L).forEach(k=>{E=I[k],c.node(E).dummy&&c.predecessors(E).forEach(R=>{let T=c.node(R);T.dummy&&(T.order<h||T.order>b)&&i(p,R,E)})})}function C(I,j){let L=-1,h,b=0;return j.forEach((E,k)=>{if(c.node(E).dummy==="border"){let R=c.predecessors(E);R.length&&(h=c.node(R[0]).order,O(j,b,k,L,h),b=k,L=h)}O(j,b,j.length,h,I.length)}),j}return g.length&&g.reduce(C),p}function a(c,g){if(c.node(g).dummy)return c.predecessors(g).find(p=>c.node(p).dummy)}function i(c,g,p){if(g>p){let C=g;g=p,p=C}let O=c[g];O||(c[g]=O={}),O[p]=!0}function e(c,g,p){if(g>p){let O=g;g=p,p=O}return!!c[g]&&Object.hasOwn(c[g],p)}function s(c,g,p,O){let C={},I={},j={};return g.forEach(L=>{L.forEach((h,b)=>{C[h]=h,I[h]=h,j[h]=b})}),g.forEach(L=>{let h=-1;L.forEach(b=>{let E=O(b);if(E.length){E=E.sort((R,T)=>j[R]-j[T]);let k=(E.length-1)/2;for(let R=Math.floor(k),T=Math.ceil(k);R<=T;++R){let S=E[R];I[b]===b&&h<j[S]&&!e(p,b,S)&&(I[S]=b,I[b]=C[b]=C[S],h=j[S])}}})}),{root:C,align:I}}function n(c,g,p,O,C){let I={},j=o(c,g,p,C),L=C?"borderLeft":"borderRight";function h(k,R){let T=j.nodes(),S=T.pop(),D={};for(;S;)D[S]?k(S):(D[S]=!0,T.push(S),T=T.concat(R(S))),S=T.pop()}function b(k){I[k]=j.inEdges(k).reduce((R,T)=>Math.max(R,I[T.v]+j.edge(T)),0)}function E(k){let R=j.outEdges(k).reduce((S,D)=>Math.min(S,I[D.w]-j.edge(D)),Number.POSITIVE_INFINITY),T=c.node(k);R!==Number.POSITIVE_INFINITY&&T.borderType!==L&&(I[k]=Math.max(I[k],R))}return h(b,j.predecessors.bind(j)),h(E,j.successors.bind(j)),Object.keys(O).forEach(k=>I[k]=I[p[k]]),I}function o(c,g,p,O){let C=new _,I=c.graph(),j=w(I.nodesep,I.edgesep,O);return g.forEach(L=>{let h;L.forEach(b=>{let E=p[b];if(C.setNode(E),h){var k=p[h],R=C.edge(k,E);C.setEdge(k,E,Math.max(j(c,b,h),R||0))}h=b})}),C}function r(c,g){return Object.values(g).reduce((p,O)=>{let C=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;Object.entries(O).forEach(([L,h])=>{let b=x(c,L)/2;C=Math.max(h+b,C),I=Math.min(h-b,I)});const j=C-I;return j<p[0]&&(p=[j,O]),p},[Number.POSITIVE_INFINITY,null])[1]}function t(c,g){let p=Object.values(g),O=m.applyWithChunking(Math.min,p),C=m.applyWithChunking(Math.max,p);["u","d"].forEach(I=>{["l","r"].forEach(j=>{let L=I+j,h=c[L];if(h===g)return;let b=Object.values(h),E=O-m.applyWithChunking(Math.min,b);j!=="l"&&(E=C-m.applyWithChunking(Math.max,b)),E&&(c[L]=m.mapValues(h,k=>k+E))})})}function d(c,g){return m.mapValues(c.ul,(p,O)=>{if(g)return c[g.toLowerCase()][O];{let C=Object.values(c).map(I=>I[O]).sort((I,j)=>I-j);return(C[1]+C[2])/2}})}function l(c){let g=m.buildLayerMatrix(c),p=Object.assign(f(c,g),u(c,g)),O={},C;["u","d"].forEach(j=>{C=j==="u"?g:Object.values(g).reverse(),["l","r"].forEach(L=>{L==="r"&&(C=C.map(k=>Object.values(k).reverse()));let h=(j==="u"?c.predecessors:c.successors).bind(c),b=s(c,C,p,h),E=n(c,C,b.root,b.align,L==="r");L==="r"&&(E=m.mapValues(E,k=>-k)),O[j+L]=E})});let I=r(c,O);return t(O,I),d(O,c.graph().align)}function w(c,g,p){return(O,C,I)=>{let j=O.node(C),L=O.node(I),h=0,b;if(h+=j.width/2,Object.hasOwn(j,"labelpos"))switch(j.labelpos.toLowerCase()){case"l":b=-j.width/2;break;case"r":b=j.width/2;break}if(b&&(h+=p?b:-b),b=0,h+=(j.dummy?g:c)/2,h+=(L.dummy?g:c)/2,h+=L.width/2,Object.hasOwn(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":b=L.width/2;break;case"r":b=-L.width/2;break}return b&&(h+=p?b:-b),b=0,h}}function x(c,g){return c.node(g).width}return Ge}var Fe,Pr;function qt(){if(Pr)return Fe;Pr=1;let _=A(),m=jt().positionX;Fe=f;function f(a){a=_.asNonCompoundGraph(a),u(a),Object.entries(m(a)).forEach(([i,e])=>a.node(i).x=e)}function u(a){let i=_.buildLayerMatrix(a),e=a.graph().ranksep,s=0;i.forEach(n=>{const o=n.reduce((r,t)=>{const d=a.node(t).height;return r>d?r:d},0);n.forEach(r=>a.node(r).y=s+o/2),s+=o+e})}return Fe}var Ae,Dr;function Lt(){if(Dr)return Ae;Dr=1;let _=ct(),m=pt(),f=bt(),u=A().normalizeRanks,a=vt(),i=A().removeEmptyRanks,e=wt(),s=gt(),n=Et(),o=It(),r=qt(),t=A(),d=Y().Graph;Ae=l;function l(v,y){let N=y&&y.debugTiming?t.time:t.notime;N("layout",()=>{let q=N(" buildLayoutGraph",()=>h(v));N(" runLayout",()=>w(q,N,y)),N(" updateInputGraph",()=>x(v,q))})}function w(v,y,N){y(" makeSpaceForEdgeLabels",()=>b(v)),y(" removeSelfEdges",()=>Hr(v)),y(" acyclic",()=>_.run(v)),y(" nestingGraph.run",()=>e.run(v)),y(" rank",()=>f(t.asNonCompoundGraph(v))),y(" injectEdgeLabelProxies",()=>E(v)),y(" removeEmptyRanks",()=>i(v)),y(" nestingGraph.cleanup",()=>e.cleanup(v)),y(" normalizeRanks",()=>u(v)),y(" assignRankMinMax",()=>k(v)),y(" removeEdgeLabelProxies",()=>R(v)),y(" normalize.run",()=>m.run(v)),y(" parentDummyChains",()=>a(v)),y(" addBorderSegments",()=>s(v)),y(" order",()=>o(v,N)),y(" insertSelfEdges",()=>Xr(v)),y(" adjustCoordinateSystem",()=>n.adjust(v)),y(" position",()=>r(v)),y(" positionSelfEdges",()=>Qr(v)),y(" removeBorderNodes",()=>U(v)),y(" normalize.undo",()=>m.undo(v)),y(" fixupEdgeLabelCoords",()=>D(v)),y(" undoCoordinateSystem",()=>n.undo(v)),y(" translateGraph",()=>T(v)),y(" assignNodeIntersects",()=>S(v)),y(" reversePoints",()=>z(v)),y(" acyclic.undo",()=>_.undo(v))}function x(v,y){v.nodes().forEach(N=>{let q=v.node(N),M=y.node(N);q&&(q.x=M.x,q.y=M.y,q.rank=M.rank,y.children(N).length&&(q.width=M.width,q.height=M.height))}),v.edges().forEach(N=>{let q=v.edge(N),M=y.edge(N);q.points=M.points,Object.hasOwn(M,"x")&&(q.x=M.x,q.y=M.y)}),v.graph().width=y.graph().width,v.graph().height=y.graph().height}let c=["nodesep","edgesep","ranksep","marginx","marginy"],g={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},p=["acyclicer","ranker","rankdir","align"],O=["width","height","rank"],C={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],j={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function h(v){let y=new d({multigraph:!0,compound:!0}),N=$(v.graph());return y.setGraph(Object.assign({},g,Q(N,c),t.pick(N,p))),v.nodes().forEach(q=>{let M=$(v.node(q));const P=Q(M,O);Object.keys(C).forEach(G=>{P[G]===void 0&&(P[G]=C[G])}),y.setNode(q,P),y.setParent(q,v.parent(q))}),v.edges().forEach(q=>{let M=$(v.edge(q));y.setEdge(q,Object.assign({},j,Q(M,I),t.pick(M,L)))}),y}function b(v){let y=v.graph();y.ranksep/=2,v.edges().forEach(N=>{let q=v.edge(N);q.minlen*=2,q.labelpos.toLowerCase()!=="c"&&(y.rankdir==="TB"||y.rankdir==="BT"?q.width+=q.labeloffset:q.height+=q.labeloffset)})}function E(v){v.edges().forEach(y=>{let N=v.edge(y);if(N.width&&N.height){let q=v.node(y.v),P={rank:(v.node(y.w).rank-q.rank)/2+q.rank,e:y};t.addDummyNode(v,"edge-proxy",P,"_ep")}})}function k(v){let y=0;v.nodes().forEach(N=>{let q=v.node(N);q.borderTop&&(q.minRank=v.node(q.borderTop).rank,q.maxRank=v.node(q.borderBottom).rank,y=Math.max(y,q.maxRank))}),v.graph().maxRank=y}function R(v){v.nodes().forEach(y=>{let N=v.node(y);N.dummy==="edge-proxy"&&(v.edge(N.e).labelRank=N.rank,v.removeNode(y))})}function T(v){let y=Number.POSITIVE_INFINITY,N=0,q=Number.POSITIVE_INFINITY,M=0,P=v.graph(),G=P.marginx||0,B=P.marginy||0;function ze(W){let V=W.x,H=W.y,Ue=W.width,He=W.height;y=Math.min(y,V-Ue/2),N=Math.max(N,V+Ue/2),q=Math.min(q,H-He/2),M=Math.max(M,H+He/2)}v.nodes().forEach(W=>ze(v.node(W))),v.edges().forEach(W=>{let V=v.edge(W);Object.hasOwn(V,"x")&&ze(V)}),y-=G,q-=B,v.nodes().forEach(W=>{let V=v.node(W);V.x-=y,V.y-=q}),v.edges().forEach(W=>{let V=v.edge(W);V.points.forEach(H=>{H.x-=y,H.y-=q}),Object.hasOwn(V,"x")&&(V.x-=y),Object.hasOwn(V,"y")&&(V.y-=q)}),P.width=N-y+G,P.height=M-q+B}function S(v){v.edges().forEach(y=>{let N=v.edge(y),q=v.node(y.v),M=v.node(y.w),P,G;N.points?(P=N.points[0],G=N.points[N.points.length-1]):(N.points=[],P=M,G=q),N.points.unshift(t.intersectRect(q,P)),N.points.push(t.intersectRect(M,G))})}function D(v){v.edges().forEach(y=>{let N=v.edge(y);if(Object.hasOwn(N,"x"))switch((N.labelpos==="l"||N.labelpos==="r")&&(N.width-=N.labeloffset),N.labelpos){case"l":N.x-=N.width/2+N.labeloffset;break;case"r":N.x+=N.width/2+N.labeloffset;break}})}function z(v){v.edges().forEach(y=>{let N=v.edge(y);N.reversed&&N.points.reverse()})}function U(v){v.nodes().forEach(y=>{if(v.children(y).length){let N=v.node(y),q=v.node(N.borderTop),M=v.node(N.borderBottom),P=v.node(N.borderLeft[N.borderLeft.length-1]),G=v.node(N.borderRight[N.borderRight.length-1]);N.width=Math.abs(G.x-P.x),N.height=Math.abs(M.y-q.y),N.x=P.x+N.width/2,N.y=q.y+N.height/2}}),v.nodes().forEach(y=>{v.node(y).dummy==="border"&&v.removeNode(y)})}function Hr(v){v.edges().forEach(y=>{if(y.v===y.w){var N=v.node(y.v);N.selfEdges||(N.selfEdges=[]),N.selfEdges.push({e:y,label:v.edge(y)}),v.removeEdge(y)}})}function Xr(v){var y=t.buildLayerMatrix(v);y.forEach(N=>{var q=0;N.forEach((M,P)=>{var G=v.node(M);G.order=P+q,(G.selfEdges||[]).forEach(B=>{t.addDummyNode(v,"selfedge",{width:B.label.width,height:B.label.height,rank:G.rank,order:P+ ++q,e:B.e,label:B.label},"_se")}),delete G.selfEdges})})}function Qr(v){v.nodes().forEach(y=>{var N=v.node(y);if(N.dummy==="selfedge"){var q=v.node(N.e.v),M=q.x+q.width/2,P=q.y,G=N.x-M,B=q.height/2;v.setEdge(N.e,N.label),v.removeNode(y),N.label.points=[{x:M+2*G/3,y:P-B},{x:M+5*G/6,y:P-B},{x:M+G,y:P},{x:M+5*G/6,y:P+B},{x:M+2*G/3,y:P+B}],N.label.x=N.x,N.label.y=N.y}})}function Q(v,y){return t.mapValues(t.pick(v,y),Number)}function $(v){var y={};return v&&Object.entries(v).forEach(([N,q])=>{typeof N=="string"&&(N=N.toLowerCase()),y[N]=q}),y}return Ae}var Ve,Gr;function Tt(){if(Gr)return Ve;Gr=1;let _=A(),m=Y().Graph;Ve={debugOrdering:f};function f(u){let a=_.buildLayerMatrix(u),i=new m({compound:!0,multigraph:!0}).setGraph({});return u.nodes().forEach(e=>{i.setNode(e,{label:e}),i.setParent(e,"layer"+u.node(e).rank)}),u.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),a.forEach((e,s)=>{let n="layer"+s;i.setNode(n,{rank:"same"}),e.reduce((o,r)=>(i.setEdge(o,r,{style:"invis"}),r))}),i}return Ve}var Be,Fr;function St(){return Fr||(Fr=1,Be="1.1.8"),Be}var We,Ar;function Mt(){return Ar||(Ar=1,We={graphlib:Y(),layout:Lt(),debug:Tt(),util:{time:A().time,notime:A().notime},version:St()}),We}var Pt=Mt();const Ft=Kr(Pt);export{Ft as d};
1
+ var $r=Object.defineProperty;var Jr=(_,m,f)=>m in _?$r(_,m,{enumerable:!0,configurable:!0,writable:!0,value:f}):_[m]=f;var F=(_,m,f)=>Jr(_,typeof m!="symbol"?m+"":m,f);import{g as Kr}from"./index-CGEJi5Pf.js";var J,Xe;function Ye(){if(Xe)return J;Xe=1;var _="\0",m="\0",f="";class u{constructor(r){F(this,"_isDirected",!0);F(this,"_isMultigraph",!1);F(this,"_isCompound",!1);F(this,"_label");F(this,"_defaultNodeLabelFn",()=>{});F(this,"_defaultEdgeLabelFn",()=>{});F(this,"_nodes",{});F(this,"_in",{});F(this,"_preds",{});F(this,"_out",{});F(this,"_sucs",{});F(this,"_edgeObjs",{});F(this,"_edgeLabels",{});F(this,"_nodeCount",0);F(this,"_edgeCount",0);F(this,"_parent");F(this,"_children");r&&(this._isDirected=Object.hasOwn(r,"directed")?r.directed:!0,this._isMultigraph=Object.hasOwn(r,"multigraph")?r.multigraph:!1,this._isCompound=Object.hasOwn(r,"compound")?r.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children[m]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(r){return this._label=r,this}graph(){return this._label}setDefaultNodeLabel(r){return this._defaultNodeLabelFn=r,typeof r!="function"&&(this._defaultNodeLabelFn=()=>r),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var r=this;return this.nodes().filter(t=>Object.keys(r._in[t]).length===0)}sinks(){var r=this;return this.nodes().filter(t=>Object.keys(r._out[t]).length===0)}setNodes(r,t){var d=arguments,l=this;return r.forEach(function(w){d.length>1?l.setNode(w,t):l.setNode(w)}),this}setNode(r,t){return Object.hasOwn(this._nodes,r)?(arguments.length>1&&(this._nodes[r]=t),this):(this._nodes[r]=arguments.length>1?t:this._defaultNodeLabelFn(r),this._isCompound&&(this._parent[r]=m,this._children[r]={},this._children[m][r]=!0),this._in[r]={},this._preds[r]={},this._out[r]={},this._sucs[r]={},++this._nodeCount,this)}node(r){return this._nodes[r]}hasNode(r){return Object.hasOwn(this._nodes,r)}removeNode(r){var t=this;if(Object.hasOwn(this._nodes,r)){var d=l=>t.removeEdge(t._edgeObjs[l]);delete this._nodes[r],this._isCompound&&(this._removeFromParentsChildList(r),delete this._parent[r],this.children(r).forEach(function(l){t.setParent(l)}),delete this._children[r]),Object.keys(this._in[r]).forEach(d),delete this._in[r],delete this._preds[r],Object.keys(this._out[r]).forEach(d),delete this._out[r],delete this._sucs[r],--this._nodeCount}return this}setParent(r,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t=m;else{t+="";for(var d=t;d!==void 0;d=this.parent(d))if(d===r)throw new Error("Setting "+t+" as parent of "+r+" would create a cycle");this.setNode(t)}return this.setNode(r),this._removeFromParentsChildList(r),this._parent[r]=t,this._children[t][r]=!0,this}_removeFromParentsChildList(r){delete this._children[this._parent[r]][r]}parent(r){if(this._isCompound){var t=this._parent[r];if(t!==m)return t}}children(r=m){if(this._isCompound){var t=this._children[r];if(t)return Object.keys(t)}else{if(r===m)return this.nodes();if(this.hasNode(r))return[]}}predecessors(r){var t=this._preds[r];if(t)return Object.keys(t)}successors(r){var t=this._sucs[r];if(t)return Object.keys(t)}neighbors(r){var t=this.predecessors(r);if(t){const l=new Set(t);for(var d of this.successors(r))l.add(d);return Array.from(l.values())}}isLeaf(r){var t;return this.isDirected()?t=this.successors(r):t=this.neighbors(r),t.length===0}filterNodes(r){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var d=this;Object.entries(this._nodes).forEach(function([x,c]){r(x)&&t.setNode(x,c)}),Object.values(this._edgeObjs).forEach(function(x){t.hasNode(x.v)&&t.hasNode(x.w)&&t.setEdge(x,d.edge(x))});var l={};function w(x){var c=d.parent(x);return c===void 0||t.hasNode(c)?(l[x]=c,c):c in l?l[c]:w(c)}return this._isCompound&&t.nodes().forEach(x=>t.setParent(x,w(x))),t}setDefaultEdgeLabel(r){return this._defaultEdgeLabelFn=r,typeof r!="function"&&(this._defaultEdgeLabelFn=()=>r),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(r,t){var d=this,l=arguments;return r.reduce(function(w,x){return l.length>1?d.setEdge(w,x,t):d.setEdge(w,x),x}),this}setEdge(){var r,t,d,l,w=!1,x=arguments[0];typeof x=="object"&&x!==null&&"v"in x?(r=x.v,t=x.w,d=x.name,arguments.length===2&&(l=arguments[1],w=!0)):(r=x,t=arguments[1],d=arguments[3],arguments.length>2&&(l=arguments[2],w=!0)),r=""+r,t=""+t,d!==void 0&&(d=""+d);var c=e(this._isDirected,r,t,d);if(Object.hasOwn(this._edgeLabels,c))return w&&(this._edgeLabels[c]=l),this;if(d!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(r),this.setNode(t),this._edgeLabels[c]=w?l:this._defaultEdgeLabelFn(r,t,d);var g=s(this._isDirected,r,t,d);return r=g.v,t=g.w,Object.freeze(g),this._edgeObjs[c]=g,a(this._preds[t],r),a(this._sucs[r],t),this._in[t][c]=g,this._out[r][c]=g,this._edgeCount++,this}edge(r,t,d){var l=arguments.length===1?n(this._isDirected,arguments[0]):e(this._isDirected,r,t,d);return this._edgeLabels[l]}edgeAsObj(){const r=this.edge(...arguments);return typeof r!="object"?{label:r}:r}hasEdge(r,t,d){var l=arguments.length===1?n(this._isDirected,arguments[0]):e(this._isDirected,r,t,d);return Object.hasOwn(this._edgeLabels,l)}removeEdge(r,t,d){var l=arguments.length===1?n(this._isDirected,arguments[0]):e(this._isDirected,r,t,d),w=this._edgeObjs[l];return w&&(r=w.v,t=w.w,delete this._edgeLabels[l],delete this._edgeObjs[l],i(this._preds[t],r),i(this._sucs[r],t),delete this._in[t][l],delete this._out[r][l],this._edgeCount--),this}inEdges(r,t){var d=this._in[r];if(d){var l=Object.values(d);return t?l.filter(w=>w.v===t):l}}outEdges(r,t){var d=this._out[r];if(d){var l=Object.values(d);return t?l.filter(w=>w.w===t):l}}nodeEdges(r,t){var d=this.inEdges(r,t);if(d)return d.concat(this.outEdges(r,t))}}function a(o,r){o[r]?o[r]++:o[r]=1}function i(o,r){--o[r]||delete o[r]}function e(o,r,t,d){var l=""+r,w=""+t;if(!o&&l>w){var x=l;l=w,w=x}return l+f+w+f+(d===void 0?_:d)}function s(o,r,t,d){var l=""+r,w=""+t;if(!o&&l>w){var x=l;l=w,w=x}var c={v:l,w};return d&&(c.name=d),c}function n(o,r){return e(o,r.v,r.w,r.name)}return J=u,J}var K,Qe;function Zr(){return Qe||(Qe=1,K="2.2.4"),K}var Z,$e;function et(){return $e||($e=1,Z={Graph:Ye(),version:Zr()}),Z}var ee,Je;function rt(){if(Je)return ee;Je=1;var _=Ye();ee={write:m,read:a};function m(i){var e={options:{directed:i.isDirected(),multigraph:i.isMultigraph(),compound:i.isCompound()},nodes:f(i),edges:u(i)};return i.graph()!==void 0&&(e.value=structuredClone(i.graph())),e}function f(i){return i.nodes().map(function(e){var s=i.node(e),n=i.parent(e),o={v:e};return s!==void 0&&(o.value=s),n!==void 0&&(o.parent=n),o})}function u(i){return i.edges().map(function(e){var s=i.edge(e),n={v:e.v,w:e.w};return e.name!==void 0&&(n.name=e.name),s!==void 0&&(n.value=s),n})}function a(i){var e=new _(i.options).setGraph(i.value);return i.nodes.forEach(function(s){e.setNode(s.v,s.value),s.parent&&e.setParent(s.v,s.parent)}),i.edges.forEach(function(s){e.setEdge({v:s.v,w:s.w,name:s.name},s.value)}),e}return ee}var re,Ke;function tt(){if(Ke)return re;Ke=1,re=_;function _(m){var f={},u=[],a;function i(e){Object.hasOwn(f,e)||(f[e]=!0,a.push(e),m.successors(e).forEach(i),m.predecessors(e).forEach(i))}return m.nodes().forEach(function(e){a=[],i(e),a.length&&u.push(a)}),u}return re}var te,Ze;function Vr(){if(Ze)return te;Ze=1;class _{constructor(){F(this,"_arr",[]);F(this,"_keyIndices",{})}size(){return this._arr.length}keys(){return this._arr.map(function(f){return f.key})}has(f){return Object.hasOwn(this._keyIndices,f)}priority(f){var u=this._keyIndices[f];if(u!==void 0)return this._arr[u].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(f,u){var a=this._keyIndices;if(f=String(f),!Object.hasOwn(a,f)){var i=this._arr,e=i.length;return a[f]=e,i.push({key:f,priority:u}),this._decrease(e),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var f=this._arr.pop();return delete this._keyIndices[f.key],this._heapify(0),f.key}decrease(f,u){var a=this._keyIndices[f];if(u>this._arr[a].priority)throw new Error("New priority is greater than current priority. Key: "+f+" Old: "+this._arr[a].priority+" New: "+u);this._arr[a].priority=u,this._decrease(a)}_heapify(f){var u=this._arr,a=2*f,i=a+1,e=f;a<u.length&&(e=u[a].priority<u[e].priority?a:e,i<u.length&&(e=u[i].priority<u[e].priority?i:e),e!==f&&(this._swap(f,e),this._heapify(e)))}_decrease(f){for(var u=this._arr,a=u[f].priority,i;f!==0&&(i=f>>1,!(u[i].priority<a));)this._swap(f,i),f=i}_swap(f,u){var a=this._arr,i=this._keyIndices,e=a[f],s=a[u];a[f]=s,a[u]=e,i[s.key]=f,i[e.key]=u}}return te=_,te}var ne,er;function Br(){if(er)return ne;er=1;var _=Vr();ne=f;var m=()=>1;function f(a,i,e,s){return u(a,String(i),e||m,s||function(n){return a.outEdges(n)})}function u(a,i,e,s){var n={},o=new _,r,t,d=function(l){var w=l.v!==r?l.v:l.w,x=n[w],c=e(l),g=t.distance+c;if(c<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+l+" Weight: "+c);g<x.distance&&(x.distance=g,x.predecessor=r,o.decrease(w,g))};for(a.nodes().forEach(function(l){var w=l===i?0:Number.POSITIVE_INFINITY;n[l]={distance:w},o.add(l,w)});o.size()>0&&(r=o.removeMin(),t=n[r],t.distance!==Number.POSITIVE_INFINITY);)s(r).forEach(d);return n}return ne}var ie,rr;function nt(){if(rr)return ie;rr=1;var _=Br();ie=m;function m(f,u,a){return f.nodes().reduce(function(i,e){return i[e]=_(f,e,u,a),i},{})}return ie}var ae,tr;function Wr(){if(tr)return ae;tr=1,ae=_;function _(m){var f=0,u=[],a={},i=[];function e(s){var n=a[s]={onStack:!0,lowlink:f,index:f++};if(u.push(s),m.successors(s).forEach(function(t){Object.hasOwn(a,t)?a[t].onStack&&(n.lowlink=Math.min(n.lowlink,a[t].index)):(e(t),n.lowlink=Math.min(n.lowlink,a[t].lowlink))}),n.lowlink===n.index){var o=[],r;do r=u.pop(),a[r].onStack=!1,o.push(r);while(s!==r);i.push(o)}}return m.nodes().forEach(function(s){Object.hasOwn(a,s)||e(s)}),i}return ae}var se,nr;function it(){if(nr)return se;nr=1;var _=Wr();se=m;function m(f){return _(f).filter(function(u){return u.length>1||u.length===1&&f.hasEdge(u[0],u[0])})}return se}var oe,ir;function at(){if(ir)return oe;ir=1,oe=m;var _=()=>1;function m(u,a,i){return f(u,a||_,i||function(e){return u.outEdges(e)})}function f(u,a,i){var e={},s=u.nodes();return s.forEach(function(n){e[n]={},e[n][n]={distance:0},s.forEach(function(o){n!==o&&(e[n][o]={distance:Number.POSITIVE_INFINITY})}),i(n).forEach(function(o){var r=o.v===n?o.w:o.v,t=a(o);e[n][r]={distance:t,predecessor:n}})}),s.forEach(function(n){var o=e[n];s.forEach(function(r){var t=e[r];s.forEach(function(d){var l=t[n],w=o[d],x=t[d],c=l.distance+w.distance;c<x.distance&&(x.distance=c,x.predecessor=w.predecessor)})})}),e}return oe}var ue,ar;function Yr(){if(ar)return ue;ar=1;function _(f){var u={},a={},i=[];function e(s){if(Object.hasOwn(a,s))throw new m;Object.hasOwn(u,s)||(a[s]=!0,u[s]=!0,f.predecessors(s).forEach(e),delete a[s],i.push(s))}if(f.sinks().forEach(e),Object.keys(u).length!==f.nodeCount())throw new m;return i}class m extends Error{constructor(){super(...arguments)}}return ue=_,_.CycleException=m,ue}var de,sr;function st(){if(sr)return de;sr=1;var _=Yr();de=m;function m(f){try{_(f)}catch(u){if(u instanceof _.CycleException)return!1;throw u}return!0}return de}var le,or;function zr(){if(or)return le;or=1,le=_;function _(a,i,e){Array.isArray(i)||(i=[i]);var s=a.isDirected()?t=>a.successors(t):t=>a.neighbors(t),n=e==="post"?m:f,o=[],r={};return i.forEach(t=>{if(!a.hasNode(t))throw new Error("Graph does not have node: "+t);n(t,s,r,o)}),o}function m(a,i,e,s){for(var n=[[a,!1]];n.length>0;){var o=n.pop();o[1]?s.push(o[0]):Object.hasOwn(e,o[0])||(e[o[0]]=!0,n.push([o[0],!0]),u(i(o[0]),r=>n.push([r,!1])))}}function f(a,i,e,s){for(var n=[a];n.length>0;){var o=n.pop();Object.hasOwn(e,o)||(e[o]=!0,s.push(o),u(i(o),r=>n.push(r)))}}function u(a,i){for(var e=a.length;e--;)i(a[e],e,a);return a}return le}var he,ur;function ot(){if(ur)return he;ur=1;var _=zr();he=m;function m(f,u){return _(f,u,"post")}return he}var fe,dr;function ut(){if(dr)return fe;dr=1;var _=zr();fe=m;function m(f,u){return _(f,u,"pre")}return fe}var ce,lr;function dt(){if(lr)return ce;lr=1;var _=Ye(),m=Vr();ce=f;function f(u,a){var i=new _,e={},s=new m,n;function o(t){var d=t.v===n?t.w:t.v,l=s.priority(d);if(l!==void 0){var w=a(t);w<l&&(e[d]=n,s.decrease(d,w))}}if(u.nodeCount()===0)return i;u.nodes().forEach(function(t){s.add(t,Number.POSITIVE_INFINITY),i.setNode(t)}),s.decrease(u.nodes()[0],0);for(var r=!1;s.size()>0;){if(n=s.removeMin(),Object.hasOwn(e,n))i.setEdge(n,e[n]);else{if(r)throw new Error("Input graph is not connected: "+u);r=!0}u.nodeEdges(n).forEach(o)}return i}return ce}var pe,hr;function lt(){return hr||(hr=1,pe={components:tt(),dijkstra:Br(),dijkstraAll:nt(),findCycles:it(),floydWarshall:at(),isAcyclic:st(),postorder:ot(),preorder:ut(),prim:dt(),tarjan:Wr(),topsort:Yr()}),pe}var me,fr;function Y(){if(fr)return me;fr=1;var _=et();return me={Graph:_.Graph,json:rt(),alg:lt(),version:_.version},me}var be,cr;function ht(){if(cr)return be;cr=1;class _{constructor(){let a={};a._next=a._prev=a,this._sentinel=a}dequeue(){let a=this._sentinel,i=a._prev;if(i!==a)return m(i),i}enqueue(a){let i=this._sentinel;a._prev&&a._next&&m(a),a._next=i._next,i._next._prev=a,i._next=a,a._prev=i}toString(){let a=[],i=this._sentinel,e=i._prev;for(;e!==i;)a.push(JSON.stringify(e,f)),e=e._prev;return"["+a.join(", ")+"]"}}function m(u){u._prev._next=u._next,u._next._prev=u._prev,delete u._next,delete u._prev}function f(u,a){if(u!=="_next"&&u!=="_prev")return a}return be=_,be}var ve,pr;function ft(){if(pr)return ve;pr=1;let _=Y().Graph,m=ht();ve=u;let f=()=>1;function u(o,r){if(o.nodeCount()<=1)return[];let t=e(o,r||f);return a(t.graph,t.buckets,t.zeroIdx).flatMap(l=>o.outEdges(l.v,l.w))}function a(o,r,t){let d=[],l=r[r.length-1],w=r[0],x;for(;o.nodeCount();){for(;x=w.dequeue();)i(o,r,t,x);for(;x=l.dequeue();)i(o,r,t,x);if(o.nodeCount()){for(let c=r.length-2;c>0;--c)if(x=r[c].dequeue(),x){d=d.concat(i(o,r,t,x,!0));break}}}return d}function i(o,r,t,d,l){let w=l?[]:void 0;return o.inEdges(d.v).forEach(x=>{let c=o.edge(x),g=o.node(x.v);l&&w.push({v:x.v,w:x.w}),g.out-=c,s(r,t,g)}),o.outEdges(d.v).forEach(x=>{let c=o.edge(x),g=x.w,p=o.node(g);p.in-=c,s(r,t,p)}),o.removeNode(d.v),w}function e(o,r){let t=new _,d=0,l=0;o.nodes().forEach(c=>{t.setNode(c,{v:c,in:0,out:0})}),o.edges().forEach(c=>{let g=t.edge(c.v,c.w)||0,p=r(c),O=g+p;t.setEdge(c.v,c.w,O),l=Math.max(l,t.node(c.v).out+=p),d=Math.max(d,t.node(c.w).in+=p)});let w=n(l+d+3).map(()=>new m),x=d+1;return t.nodes().forEach(c=>{s(w,x,t.node(c))}),{graph:t,buckets:w,zeroIdx:x}}function s(o,r,t){t.out?t.in?o[t.out-t.in+r].enqueue(t):o[o.length-1].enqueue(t):o[0].enqueue(t)}function n(o){const r=[];for(let t=0;t<o;t++)r.push(t);return r}return ve}var we,mr;function A(){if(mr)return we;mr=1;let _=Y().Graph;we={addBorderNode:r,addDummyNode:m,applyWithChunking:l,asNonCompoundGraph:u,buildLayerMatrix:s,intersectRect:e,mapValues:j,maxRank:w,normalizeRanks:n,notime:g,partition:x,pick:I,predecessorWeights:i,range:C,removeEmptyRanks:o,simplify:f,successorWeights:a,time:c,uniqueId:O,zipObject:L};function m(h,b,E,k){for(var R=k;h.hasNode(R);)R=O(k);return E.dummy=b,h.setNode(R,E),R}function f(h){let b=new _().setGraph(h.graph());return h.nodes().forEach(E=>b.setNode(E,h.node(E))),h.edges().forEach(E=>{let k=b.edge(E.v,E.w)||{weight:0,minlen:1},R=h.edge(E);b.setEdge(E.v,E.w,{weight:k.weight+R.weight,minlen:Math.max(k.minlen,R.minlen)})}),b}function u(h){let b=new _({multigraph:h.isMultigraph()}).setGraph(h.graph());return h.nodes().forEach(E=>{h.children(E).length||b.setNode(E,h.node(E))}),h.edges().forEach(E=>{b.setEdge(E,h.edge(E))}),b}function a(h){let b=h.nodes().map(E=>{let k={};return h.outEdges(E).forEach(R=>{k[R.w]=(k[R.w]||0)+h.edge(R).weight}),k});return L(h.nodes(),b)}function i(h){let b=h.nodes().map(E=>{let k={};return h.inEdges(E).forEach(R=>{k[R.v]=(k[R.v]||0)+h.edge(R).weight}),k});return L(h.nodes(),b)}function e(h,b){let E=h.x,k=h.y,R=b.x-E,T=b.y-k,S=h.width/2,D=h.height/2;if(!R&&!T)throw new Error("Not possible to find intersection inside of the rectangle");let z,U;return Math.abs(T)*S>Math.abs(R)*D?(T<0&&(D=-D),z=D*R/T,U=D):(R<0&&(S=-S),z=S,U=S*T/R),{x:E+z,y:k+U}}function s(h){let b=C(w(h)+1).map(()=>[]);return h.nodes().forEach(E=>{let k=h.node(E),R=k.rank;R!==void 0&&(b[R][k.order]=E)}),b}function n(h){let b=h.nodes().map(k=>{let R=h.node(k).rank;return R===void 0?Number.MAX_VALUE:R}),E=l(Math.min,b);h.nodes().forEach(k=>{let R=h.node(k);Object.hasOwn(R,"rank")&&(R.rank-=E)})}function o(h){let b=h.nodes().map(S=>h.node(S).rank),E=l(Math.min,b),k=[];h.nodes().forEach(S=>{let D=h.node(S).rank-E;k[D]||(k[D]=[]),k[D].push(S)});let R=0,T=h.graph().nodeRankFactor;Array.from(k).forEach((S,D)=>{S===void 0&&D%T!==0?--R:S!==void 0&&R&&S.forEach(z=>h.node(z).rank+=R)})}function r(h,b,E,k){let R={width:0,height:0};return arguments.length>=4&&(R.rank=E,R.order=k),m(h,"border",R,b)}function t(h,b=d){const E=[];for(let k=0;k<h.length;k+=b){const R=h.slice(k,k+b);E.push(R)}return E}const d=65535;function l(h,b){if(b.length>d){const E=t(b);return h.apply(null,E.map(k=>h.apply(null,k)))}else return h.apply(null,b)}function w(h){const E=h.nodes().map(k=>{let R=h.node(k).rank;return R===void 0?Number.MIN_VALUE:R});return l(Math.max,E)}function x(h,b){let E={lhs:[],rhs:[]};return h.forEach(k=>{b(k)?E.lhs.push(k):E.rhs.push(k)}),E}function c(h,b){let E=Date.now();try{return b()}finally{console.log(h+" time: "+(Date.now()-E)+"ms")}}function g(h,b){return b()}let p=0;function O(h){var b=++p;return h+(""+b)}function C(h,b,E=1){b==null&&(b=h,h=0);let k=T=>T<b;E<0&&(k=T=>b<T);const R=[];for(let T=h;k(T);T+=E)R.push(T);return R}function I(h,b){const E={};for(const k of b)h[k]!==void 0&&(E[k]=h[k]);return E}function j(h,b){let E=b;return typeof b=="string"&&(E=k=>k[b]),Object.entries(h).reduce((k,[R,T])=>(k[R]=E(T,R),k),{})}function L(h,b){return h.reduce((E,k,R)=>(E[k]=b[R],E),{})}return we}var ge,br;function ct(){if(br)return ge;br=1;let _=ft(),m=A().uniqueId;ge={run:f,undo:a};function f(i){(i.graph().acyclicer==="greedy"?_(i,s(i)):u(i)).forEach(n=>{let o=i.edge(n);i.removeEdge(n),o.forwardName=n.name,o.reversed=!0,i.setEdge(n.w,n.v,o,m("rev"))});function s(n){return o=>n.edge(o).weight}}function u(i){let e=[],s={},n={};function o(r){Object.hasOwn(n,r)||(n[r]=!0,s[r]=!0,i.outEdges(r).forEach(t=>{Object.hasOwn(s,t.w)?e.push(t):o(t.w)}),delete s[r])}return i.nodes().forEach(o),e}function a(i){i.edges().forEach(e=>{let s=i.edge(e);if(s.reversed){i.removeEdge(e);let n=s.forwardName;delete s.reversed,delete s.forwardName,i.setEdge(e.w,e.v,s,n)}})}return ge}var Ee,vr;function pt(){if(vr)return Ee;vr=1;let _=A();Ee={run:m,undo:u};function m(a){a.graph().dummyChains=[],a.edges().forEach(i=>f(a,i))}function f(a,i){let e=i.v,s=a.node(e).rank,n=i.w,o=a.node(n).rank,r=i.name,t=a.edge(i),d=t.labelRank;if(o===s+1)return;a.removeEdge(i);let l,w,x;for(x=0,++s;s<o;++x,++s)t.points=[],w={width:0,height:0,edgeLabel:t,edgeObj:i,rank:s},l=_.addDummyNode(a,"edge",w,"_d"),s===d&&(w.width=t.width,w.height=t.height,w.dummy="edge-label",w.labelpos=t.labelpos),a.setEdge(e,l,{weight:t.weight},r),x===0&&a.graph().dummyChains.push(l),e=l;a.setEdge(e,n,{weight:t.weight},r)}function u(a){a.graph().dummyChains.forEach(i=>{let e=a.node(i),s=e.edgeLabel,n;for(a.setEdge(e.edgeObj,s);e.dummy;)n=a.successors(i)[0],a.removeNode(i),s.points.push({x:e.x,y:e.y}),e.dummy==="edge-label"&&(s.x=e.x,s.y=e.y,s.width=e.width,s.height=e.height),i=n,e=a.node(i)})}return Ee}var _e,wr;function X(){if(wr)return _e;wr=1;const{applyWithChunking:_}=A();_e={longestPath:m,slack:f};function m(u){var a={};function i(e){var s=u.node(e);if(Object.hasOwn(a,e))return s.rank;a[e]=!0;let n=u.outEdges(e).map(r=>r==null?Number.POSITIVE_INFINITY:i(r.w)-u.edge(r).minlen);var o=_(Math.min,n);return o===Number.POSITIVE_INFINITY&&(o=0),s.rank=o}u.sources().forEach(i)}function f(u,a){return u.node(a.w).rank-u.node(a.v).rank-u.edge(a).minlen}return _e}var ye,gr;function Ur(){if(gr)return ye;gr=1;var _=Y().Graph,m=X().slack;ye=f;function f(e){var s=new _({directed:!1}),n=e.nodes()[0],o=e.nodeCount();s.setNode(n,{});for(var r,t;u(s,e)<o;)r=a(s,e),t=s.hasNode(r.v)?m(e,r):-m(e,r),i(s,e,t);return s}function u(e,s){function n(o){s.nodeEdges(o).forEach(r=>{var t=r.v,d=o===t?r.w:t;!e.hasNode(d)&&!m(s,r)&&(e.setNode(d,{}),e.setEdge(o,d,{}),n(d))})}return e.nodes().forEach(n),e.nodeCount()}function a(e,s){return s.edges().reduce((o,r)=>{let t=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(t=m(s,r)),t<o[0]?[t,r]:o},[Number.POSITIVE_INFINITY,null])[1]}function i(e,s,n){e.nodes().forEach(o=>s.node(o).rank+=n)}return ye}var ke,Er;function mt(){if(Er)return ke;Er=1;var _=Ur(),m=X().slack,f=X().longestPath,u=Y().alg.preorder,a=Y().alg.postorder,i=A().simplify;ke=e,e.initLowLimValues=r,e.initCutValues=s,e.calcCutValue=o,e.leaveEdge=d,e.enterEdge=l,e.exchangeEdges=w;function e(p){p=i(p),f(p);var O=_(p);r(O),s(O,p);for(var C,I;C=d(O);)I=l(O,p,C),w(O,p,C,I)}function s(p,O){var C=a(p,p.nodes());C=C.slice(0,C.length-1),C.forEach(I=>n(p,O,I))}function n(p,O,C){var I=p.node(C),j=I.parent;p.edge(C,j).cutvalue=o(p,O,C)}function o(p,O,C){var I=p.node(C),j=I.parent,L=!0,h=O.edge(C,j),b=0;return h||(L=!1,h=O.edge(j,C)),b=h.weight,O.nodeEdges(C).forEach(E=>{var k=E.v===C,R=k?E.w:E.v;if(R!==j){var T=k===L,S=O.edge(E).weight;if(b+=T?S:-S,c(p,C,R)){var D=p.edge(C,R).cutvalue;b+=T?-D:D}}}),b}function r(p,O){arguments.length<2&&(O=p.nodes()[0]),t(p,{},1,O)}function t(p,O,C,I,j){var L=C,h=p.node(I);return O[I]=!0,p.neighbors(I).forEach(b=>{Object.hasOwn(O,b)||(C=t(p,O,C,b,I))}),h.low=L,h.lim=C++,j?h.parent=j:delete h.parent,C}function d(p){return p.edges().find(O=>p.edge(O).cutvalue<0)}function l(p,O,C){var I=C.v,j=C.w;O.hasEdge(I,j)||(I=C.w,j=C.v);var L=p.node(I),h=p.node(j),b=L,E=!1;L.lim>h.lim&&(b=h,E=!0);var k=O.edges().filter(R=>E===g(p,p.node(R.v),b)&&E!==g(p,p.node(R.w),b));return k.reduce((R,T)=>m(O,T)<m(O,R)?T:R)}function w(p,O,C,I){var j=C.v,L=C.w;p.removeEdge(j,L),p.setEdge(I.v,I.w,{}),r(p),s(p,O),x(p,O)}function x(p,O){var C=p.nodes().find(j=>!O.node(j).parent),I=u(p,C);I=I.slice(1),I.forEach(j=>{var L=p.node(j).parent,h=O.edge(j,L),b=!1;h||(h=O.edge(L,j),b=!0),O.node(j).rank=O.node(L).rank+(b?h.minlen:-h.minlen)})}function c(p,O,C){return p.hasEdge(O,C)}function g(p,O,C){return C.low<=O.lim&&O.lim<=C.lim}return ke}var Oe,_r;function bt(){if(_r)return Oe;_r=1;var _=X(),m=_.longestPath,f=Ur(),u=mt();Oe=a;function a(n){var o=n.graph().ranker;if(o instanceof Function)return o(n);switch(n.graph().ranker){case"network-simplex":s(n);break;case"tight-tree":e(n);break;case"longest-path":i(n);break;case"none":break;default:s(n)}}var i=m;function e(n){m(n),f(n)}function s(n){u(n)}return Oe}var Ne,yr;function vt(){if(yr)return Ne;yr=1,Ne=_;function _(u){let a=f(u);u.graph().dummyChains.forEach(i=>{let e=u.node(i),s=e.edgeObj,n=m(u,a,s.v,s.w),o=n.path,r=n.lca,t=0,d=o[t],l=!0;for(;i!==s.w;){if(e=u.node(i),l){for(;(d=o[t])!==r&&u.node(d).maxRank<e.rank;)t++;d===r&&(l=!1)}if(!l){for(;t<o.length-1&&u.node(d=o[t+1]).minRank<=e.rank;)t++;d=o[t]}u.setParent(i,d),i=u.successors(i)[0]}})}function m(u,a,i,e){let s=[],n=[],o=Math.min(a[i].low,a[e].low),r=Math.max(a[i].lim,a[e].lim),t,d;t=i;do t=u.parent(t),s.push(t);while(t&&(a[t].low>o||r>a[t].lim));for(d=t,t=e;(t=u.parent(t))!==d;)n.push(t);return{path:s.concat(n.reverse()),lca:d}}function f(u){let a={},i=0;function e(s){let n=i;u.children(s).forEach(e),a[s]={low:n,lim:i++}}return u.children().forEach(e),a}return Ne}var Ce,kr;function wt(){if(kr)return Ce;kr=1;let _=A();Ce={run:m,cleanup:i};function m(e){let s=_.addDummyNode(e,"root",{},"_root"),n=u(e),o=Object.values(n),r=_.applyWithChunking(Math.max,o)-1,t=2*r+1;e.graph().nestingRoot=s,e.edges().forEach(l=>e.edge(l).minlen*=t);let d=a(e)+1;e.children().forEach(l=>f(e,s,t,d,r,n,l)),e.graph().nodeRankFactor=t}function f(e,s,n,o,r,t,d){let l=e.children(d);if(!l.length){d!==s&&e.setEdge(s,d,{weight:0,minlen:n});return}let w=_.addBorderNode(e,"_bt"),x=_.addBorderNode(e,"_bb"),c=e.node(d);e.setParent(w,d),c.borderTop=w,e.setParent(x,d),c.borderBottom=x,l.forEach(g=>{f(e,s,n,o,r,t,g);let p=e.node(g),O=p.borderTop?p.borderTop:g,C=p.borderBottom?p.borderBottom:g,I=p.borderTop?o:2*o,j=O!==C?1:r-t[d]+1;e.setEdge(w,O,{weight:I,minlen:j,nestingEdge:!0}),e.setEdge(C,x,{weight:I,minlen:j,nestingEdge:!0})}),e.parent(d)||e.setEdge(s,w,{weight:0,minlen:r+t[d]})}function u(e){var s={};function n(o,r){var t=e.children(o);t&&t.length&&t.forEach(d=>n(d,r+1)),s[o]=r}return e.children().forEach(o=>n(o,1)),s}function a(e){return e.edges().reduce((s,n)=>s+e.edge(n).weight,0)}function i(e){var s=e.graph();e.removeNode(s.nestingRoot),delete s.nestingRoot,e.edges().forEach(n=>{var o=e.edge(n);o.nestingEdge&&e.removeEdge(n)})}return Ce}var xe,Or;function gt(){if(Or)return xe;Or=1;let _=A();xe=m;function m(u){function a(i){let e=u.children(i),s=u.node(i);if(e.length&&e.forEach(a),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let n=s.minRank,o=s.maxRank+1;n<o;++n)f(u,"borderLeft","_bl",i,s,n),f(u,"borderRight","_br",i,s,n)}}u.children().forEach(a)}function f(u,a,i,e,s,n){let o={width:0,height:0,rank:n,borderType:a},r=s[a][n-1],t=_.addDummyNode(u,"border",o,i);s[a][n]=t,u.setParent(t,e),r&&u.setEdge(r,t,{weight:1})}return xe}var Re,Nr;function Et(){if(Nr)return Re;Nr=1,Re={adjust:_,undo:m};function _(n){let o=n.graph().rankdir.toLowerCase();(o==="lr"||o==="rl")&&f(n)}function m(n){let o=n.graph().rankdir.toLowerCase();(o==="bt"||o==="rl")&&a(n),(o==="lr"||o==="rl")&&(e(n),f(n))}function f(n){n.nodes().forEach(o=>u(n.node(o))),n.edges().forEach(o=>u(n.edge(o)))}function u(n){let o=n.width;n.width=n.height,n.height=o}function a(n){n.nodes().forEach(o=>i(n.node(o))),n.edges().forEach(o=>{let r=n.edge(o);r.points.forEach(i),Object.hasOwn(r,"y")&&i(r)})}function i(n){n.y=-n.y}function e(n){n.nodes().forEach(o=>s(n.node(o))),n.edges().forEach(o=>{let r=n.edge(o);r.points.forEach(s),Object.hasOwn(r,"x")&&s(r)})}function s(n){let o=n.x;n.x=n.y,n.y=o}return Re}var Ie,Cr;function _t(){if(Cr)return Ie;Cr=1;let _=A();Ie=m;function m(f){let u={},a=f.nodes().filter(r=>!f.children(r).length),i=a.map(r=>f.node(r).rank),e=_.applyWithChunking(Math.max,i),s=_.range(e+1).map(()=>[]);function n(r){if(u[r])return;u[r]=!0;let t=f.node(r);s[t.rank].push(r),f.successors(r).forEach(n)}return a.sort((r,t)=>f.node(r).rank-f.node(t).rank).forEach(n),s}return Ie}var je,xr;function yt(){if(xr)return je;xr=1;let _=A().zipObject;je=m;function m(u,a){let i=0;for(let e=1;e<a.length;++e)i+=f(u,a[e-1],a[e]);return i}function f(u,a,i){let e=_(i,i.map((d,l)=>l)),s=a.flatMap(d=>u.outEdges(d).map(l=>({pos:e[l.w],weight:u.edge(l).weight})).sort((l,w)=>l.pos-w.pos)),n=1;for(;n<i.length;)n<<=1;let o=2*n-1;n-=1;let r=new Array(o).fill(0),t=0;return s.forEach(d=>{let l=d.pos+n;r[l]+=d.weight;let w=0;for(;l>0;)l%2&&(w+=r[l+1]),l=l-1>>1,r[l]+=d.weight;t+=d.weight*w}),t}return je}var qe,Rr;function kt(){if(Rr)return qe;Rr=1,qe=_;function _(m,f=[]){return f.map(u=>{let a=m.inEdges(u);if(a.length){let i=a.reduce((e,s)=>{let n=m.edge(s),o=m.node(s.v);return{sum:e.sum+n.weight*o.order,weight:e.weight+n.weight}},{sum:0,weight:0});return{v:u,barycenter:i.sum/i.weight,weight:i.weight}}else return{v:u}})}return qe}var Le,Ir;function Ot(){if(Ir)return Le;Ir=1;let _=A();Le=m;function m(a,i){let e={};a.forEach((n,o)=>{let r=e[n.v]={indegree:0,in:[],out:[],vs:[n.v],i:o};n.barycenter!==void 0&&(r.barycenter=n.barycenter,r.weight=n.weight)}),i.edges().forEach(n=>{let o=e[n.v],r=e[n.w];o!==void 0&&r!==void 0&&(r.indegree++,o.out.push(e[n.w]))});let s=Object.values(e).filter(n=>!n.indegree);return f(s)}function f(a){let i=[];function e(n){return o=>{o.merged||(o.barycenter===void 0||n.barycenter===void 0||o.barycenter>=n.barycenter)&&u(n,o)}}function s(n){return o=>{o.in.push(n),--o.indegree===0&&a.push(o)}}for(;a.length;){let n=a.pop();i.push(n),n.in.reverse().forEach(e(n)),n.out.forEach(s(n))}return i.filter(n=>!n.merged).map(n=>_.pick(n,["vs","i","barycenter","weight"]))}function u(a,i){let e=0,s=0;a.weight&&(e+=a.barycenter*a.weight,s+=a.weight),i.weight&&(e+=i.barycenter*i.weight,s+=i.weight),a.vs=i.vs.concat(a.vs),a.barycenter=e/s,a.weight=s,a.i=Math.min(i.i,a.i),i.merged=!0}return Le}var Te,jr;function Nt(){if(jr)return Te;jr=1;let _=A();Te=m;function m(a,i){let e=_.partition(a,w=>Object.hasOwn(w,"barycenter")),s=e.lhs,n=e.rhs.sort((w,x)=>x.i-w.i),o=[],r=0,t=0,d=0;s.sort(u(!!i)),d=f(o,n,d),s.forEach(w=>{d+=w.vs.length,o.push(w.vs),r+=w.barycenter*w.weight,t+=w.weight,d=f(o,n,d)});let l={vs:o.flat(!0)};return t&&(l.barycenter=r/t,l.weight=t),l}function f(a,i,e){let s;for(;i.length&&(s=i[i.length-1]).i<=e;)i.pop(),a.push(s.vs),e++;return e}function u(a){return(i,e)=>i.barycenter<e.barycenter?-1:i.barycenter>e.barycenter?1:a?e.i-i.i:i.i-e.i}return Te}var Se,qr;function Ct(){if(qr)return Se;qr=1;let _=kt(),m=Ot(),f=Nt();Se=u;function u(e,s,n,o){let r=e.children(s),t=e.node(s),d=t?t.borderLeft:void 0,l=t?t.borderRight:void 0,w={};d&&(r=r.filter(p=>p!==d&&p!==l));let x=_(e,r);x.forEach(p=>{if(e.children(p.v).length){let O=u(e,p.v,n,o);w[p.v]=O,Object.hasOwn(O,"barycenter")&&i(p,O)}});let c=m(x,n);a(c,w);let g=f(c,o);if(d&&(g.vs=[d,g.vs,l].flat(!0),e.predecessors(d).length)){let p=e.node(e.predecessors(d)[0]),O=e.node(e.predecessors(l)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+p.order+O.order)/(g.weight+2),g.weight+=2}return g}function a(e,s){e.forEach(n=>{n.vs=n.vs.flatMap(o=>s[o]?s[o].vs:o)})}function i(e,s){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+s.barycenter*s.weight)/(e.weight+s.weight),e.weight+=s.weight):(e.barycenter=s.barycenter,e.weight=s.weight)}return Se}var Me,Lr;function xt(){if(Lr)return Me;Lr=1;let _=Y().Graph,m=A();Me=f;function f(a,i,e,s){s||(s=a.nodes());let n=u(a),o=new _({compound:!0}).setGraph({root:n}).setDefaultNodeLabel(r=>a.node(r));return s.forEach(r=>{let t=a.node(r),d=a.parent(r);(t.rank===i||t.minRank<=i&&i<=t.maxRank)&&(o.setNode(r),o.setParent(r,d||n),a[e](r).forEach(l=>{let w=l.v===r?l.w:l.v,x=o.edge(w,r),c=x!==void 0?x.weight:0;o.setEdge(w,r,{weight:a.edge(l).weight+c})}),Object.hasOwn(t,"minRank")&&o.setNode(r,{borderLeft:t.borderLeft[i],borderRight:t.borderRight[i]}))}),o}function u(a){for(var i;a.hasNode(i=m.uniqueId("_root")););return i}return Me}var Pe,Tr;function Rt(){if(Tr)return Pe;Tr=1,Pe=_;function _(m,f,u){let a={},i;u.forEach(e=>{let s=m.parent(e),n,o;for(;s;){if(n=m.parent(s),n?(o=a[n],a[n]=s):(o=i,i=s),o&&o!==s){f.setEdge(o,s);return}s=n}})}return Pe}var De,Sr;function It(){if(Sr)return De;Sr=1;let _=_t(),m=yt(),f=Ct(),u=xt(),a=Rt(),i=Y().Graph,e=A();De=s;function s(t,d){if(d&&typeof d.customOrder=="function"){d.customOrder(t,s);return}let l=e.maxRank(t),w=n(t,e.range(1,l+1),"inEdges"),x=n(t,e.range(l-1,-1,-1),"outEdges"),c=_(t);if(r(t,c),d&&d.disableOptimalOrderHeuristic)return;let g=Number.POSITIVE_INFINITY,p;for(let O=0,C=0;C<4;++O,++C){o(O%2?w:x,O%4>=2),c=e.buildLayerMatrix(t);let I=m(t,c);I<g&&(C=0,p=Object.assign({},c),g=I)}r(t,p)}function n(t,d,l){const w=new Map,x=(c,g)=>{w.has(c)||w.set(c,[]),w.get(c).push(g)};for(const c of t.nodes()){const g=t.node(c);if(typeof g.rank=="number"&&x(g.rank,c),typeof g.minRank=="number"&&typeof g.maxRank=="number")for(let p=g.minRank;p<=g.maxRank;p++)p!==g.rank&&x(p,c)}return d.map(function(c){return u(t,c,l,w.get(c)||[])})}function o(t,d){let l=new i;t.forEach(function(w){let x=w.graph().root,c=f(w,x,l,d);c.vs.forEach((g,p)=>w.node(g).order=p),a(w,l,c.vs)})}function r(t,d){Object.values(d).forEach(l=>l.forEach((w,x)=>t.node(w).order=x))}return De}var Ge,Mr;function jt(){if(Mr)return Ge;Mr=1;let _=Y().Graph,m=A();Ge={positionX:l,findType1Conflicts:f,findType2Conflicts:u,addConflict:i,hasConflict:e,verticalAlignment:s,horizontalCompaction:n,alignCoordinates:t,findSmallestWidthAlignment:r,balance:d};function f(c,g){let p={};function O(C,I){let j=0,L=0,h=C.length,b=I[I.length-1];return I.forEach((E,k)=>{let R=a(c,E),T=R?c.node(R).order:h;(R||E===b)&&(I.slice(L,k+1).forEach(S=>{c.predecessors(S).forEach(D=>{let z=c.node(D),U=z.order;(U<j||T<U)&&!(z.dummy&&c.node(S).dummy)&&i(p,D,S)})}),L=k+1,j=T)}),I}return g.length&&g.reduce(O),p}function u(c,g){let p={};function O(I,j,L,h,b){let E;m.range(j,L).forEach(k=>{E=I[k],c.node(E).dummy&&c.predecessors(E).forEach(R=>{let T=c.node(R);T.dummy&&(T.order<h||T.order>b)&&i(p,R,E)})})}function C(I,j){let L=-1,h,b=0;return j.forEach((E,k)=>{if(c.node(E).dummy==="border"){let R=c.predecessors(E);R.length&&(h=c.node(R[0]).order,O(j,b,k,L,h),b=k,L=h)}O(j,b,j.length,h,I.length)}),j}return g.length&&g.reduce(C),p}function a(c,g){if(c.node(g).dummy)return c.predecessors(g).find(p=>c.node(p).dummy)}function i(c,g,p){if(g>p){let C=g;g=p,p=C}let O=c[g];O||(c[g]=O={}),O[p]=!0}function e(c,g,p){if(g>p){let O=g;g=p,p=O}return!!c[g]&&Object.hasOwn(c[g],p)}function s(c,g,p,O){let C={},I={},j={};return g.forEach(L=>{L.forEach((h,b)=>{C[h]=h,I[h]=h,j[h]=b})}),g.forEach(L=>{let h=-1;L.forEach(b=>{let E=O(b);if(E.length){E=E.sort((R,T)=>j[R]-j[T]);let k=(E.length-1)/2;for(let R=Math.floor(k),T=Math.ceil(k);R<=T;++R){let S=E[R];I[b]===b&&h<j[S]&&!e(p,b,S)&&(I[S]=b,I[b]=C[b]=C[S],h=j[S])}}})}),{root:C,align:I}}function n(c,g,p,O,C){let I={},j=o(c,g,p,C),L=C?"borderLeft":"borderRight";function h(k,R){let T=j.nodes(),S=T.pop(),D={};for(;S;)D[S]?k(S):(D[S]=!0,T.push(S),T=T.concat(R(S))),S=T.pop()}function b(k){I[k]=j.inEdges(k).reduce((R,T)=>Math.max(R,I[T.v]+j.edge(T)),0)}function E(k){let R=j.outEdges(k).reduce((S,D)=>Math.min(S,I[D.w]-j.edge(D)),Number.POSITIVE_INFINITY),T=c.node(k);R!==Number.POSITIVE_INFINITY&&T.borderType!==L&&(I[k]=Math.max(I[k],R))}return h(b,j.predecessors.bind(j)),h(E,j.successors.bind(j)),Object.keys(O).forEach(k=>I[k]=I[p[k]]),I}function o(c,g,p,O){let C=new _,I=c.graph(),j=w(I.nodesep,I.edgesep,O);return g.forEach(L=>{let h;L.forEach(b=>{let E=p[b];if(C.setNode(E),h){var k=p[h],R=C.edge(k,E);C.setEdge(k,E,Math.max(j(c,b,h),R||0))}h=b})}),C}function r(c,g){return Object.values(g).reduce((p,O)=>{let C=Number.NEGATIVE_INFINITY,I=Number.POSITIVE_INFINITY;Object.entries(O).forEach(([L,h])=>{let b=x(c,L)/2;C=Math.max(h+b,C),I=Math.min(h-b,I)});const j=C-I;return j<p[0]&&(p=[j,O]),p},[Number.POSITIVE_INFINITY,null])[1]}function t(c,g){let p=Object.values(g),O=m.applyWithChunking(Math.min,p),C=m.applyWithChunking(Math.max,p);["u","d"].forEach(I=>{["l","r"].forEach(j=>{let L=I+j,h=c[L];if(h===g)return;let b=Object.values(h),E=O-m.applyWithChunking(Math.min,b);j!=="l"&&(E=C-m.applyWithChunking(Math.max,b)),E&&(c[L]=m.mapValues(h,k=>k+E))})})}function d(c,g){return m.mapValues(c.ul,(p,O)=>{if(g)return c[g.toLowerCase()][O];{let C=Object.values(c).map(I=>I[O]).sort((I,j)=>I-j);return(C[1]+C[2])/2}})}function l(c){let g=m.buildLayerMatrix(c),p=Object.assign(f(c,g),u(c,g)),O={},C;["u","d"].forEach(j=>{C=j==="u"?g:Object.values(g).reverse(),["l","r"].forEach(L=>{L==="r"&&(C=C.map(k=>Object.values(k).reverse()));let h=(j==="u"?c.predecessors:c.successors).bind(c),b=s(c,C,p,h),E=n(c,C,b.root,b.align,L==="r");L==="r"&&(E=m.mapValues(E,k=>-k)),O[j+L]=E})});let I=r(c,O);return t(O,I),d(O,c.graph().align)}function w(c,g,p){return(O,C,I)=>{let j=O.node(C),L=O.node(I),h=0,b;if(h+=j.width/2,Object.hasOwn(j,"labelpos"))switch(j.labelpos.toLowerCase()){case"l":b=-j.width/2;break;case"r":b=j.width/2;break}if(b&&(h+=p?b:-b),b=0,h+=(j.dummy?g:c)/2,h+=(L.dummy?g:c)/2,h+=L.width/2,Object.hasOwn(L,"labelpos"))switch(L.labelpos.toLowerCase()){case"l":b=L.width/2;break;case"r":b=-L.width/2;break}return b&&(h+=p?b:-b),b=0,h}}function x(c,g){return c.node(g).width}return Ge}var Fe,Pr;function qt(){if(Pr)return Fe;Pr=1;let _=A(),m=jt().positionX;Fe=f;function f(a){a=_.asNonCompoundGraph(a),u(a),Object.entries(m(a)).forEach(([i,e])=>a.node(i).x=e)}function u(a){let i=_.buildLayerMatrix(a),e=a.graph().ranksep,s=0;i.forEach(n=>{const o=n.reduce((r,t)=>{const d=a.node(t).height;return r>d?r:d},0);n.forEach(r=>a.node(r).y=s+o/2),s+=o+e})}return Fe}var Ae,Dr;function Lt(){if(Dr)return Ae;Dr=1;let _=ct(),m=pt(),f=bt(),u=A().normalizeRanks,a=vt(),i=A().removeEmptyRanks,e=wt(),s=gt(),n=Et(),o=It(),r=qt(),t=A(),d=Y().Graph;Ae=l;function l(v,y){let N=y&&y.debugTiming?t.time:t.notime;N("layout",()=>{let q=N(" buildLayoutGraph",()=>h(v));N(" runLayout",()=>w(q,N,y)),N(" updateInputGraph",()=>x(v,q))})}function w(v,y,N){y(" makeSpaceForEdgeLabels",()=>b(v)),y(" removeSelfEdges",()=>Hr(v)),y(" acyclic",()=>_.run(v)),y(" nestingGraph.run",()=>e.run(v)),y(" rank",()=>f(t.asNonCompoundGraph(v))),y(" injectEdgeLabelProxies",()=>E(v)),y(" removeEmptyRanks",()=>i(v)),y(" nestingGraph.cleanup",()=>e.cleanup(v)),y(" normalizeRanks",()=>u(v)),y(" assignRankMinMax",()=>k(v)),y(" removeEdgeLabelProxies",()=>R(v)),y(" normalize.run",()=>m.run(v)),y(" parentDummyChains",()=>a(v)),y(" addBorderSegments",()=>s(v)),y(" order",()=>o(v,N)),y(" insertSelfEdges",()=>Xr(v)),y(" adjustCoordinateSystem",()=>n.adjust(v)),y(" position",()=>r(v)),y(" positionSelfEdges",()=>Qr(v)),y(" removeBorderNodes",()=>U(v)),y(" normalize.undo",()=>m.undo(v)),y(" fixupEdgeLabelCoords",()=>D(v)),y(" undoCoordinateSystem",()=>n.undo(v)),y(" translateGraph",()=>T(v)),y(" assignNodeIntersects",()=>S(v)),y(" reversePoints",()=>z(v)),y(" acyclic.undo",()=>_.undo(v))}function x(v,y){v.nodes().forEach(N=>{let q=v.node(N),M=y.node(N);q&&(q.x=M.x,q.y=M.y,q.rank=M.rank,y.children(N).length&&(q.width=M.width,q.height=M.height))}),v.edges().forEach(N=>{let q=v.edge(N),M=y.edge(N);q.points=M.points,Object.hasOwn(M,"x")&&(q.x=M.x,q.y=M.y)}),v.graph().width=y.graph().width,v.graph().height=y.graph().height}let c=["nodesep","edgesep","ranksep","marginx","marginy"],g={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},p=["acyclicer","ranker","rankdir","align"],O=["width","height","rank"],C={width:0,height:0},I=["minlen","weight","width","height","labeloffset"],j={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},L=["labelpos"];function h(v){let y=new d({multigraph:!0,compound:!0}),N=$(v.graph());return y.setGraph(Object.assign({},g,Q(N,c),t.pick(N,p))),v.nodes().forEach(q=>{let M=$(v.node(q));const P=Q(M,O);Object.keys(C).forEach(G=>{P[G]===void 0&&(P[G]=C[G])}),y.setNode(q,P),y.setParent(q,v.parent(q))}),v.edges().forEach(q=>{let M=$(v.edge(q));y.setEdge(q,Object.assign({},j,Q(M,I),t.pick(M,L)))}),y}function b(v){let y=v.graph();y.ranksep/=2,v.edges().forEach(N=>{let q=v.edge(N);q.minlen*=2,q.labelpos.toLowerCase()!=="c"&&(y.rankdir==="TB"||y.rankdir==="BT"?q.width+=q.labeloffset:q.height+=q.labeloffset)})}function E(v){v.edges().forEach(y=>{let N=v.edge(y);if(N.width&&N.height){let q=v.node(y.v),P={rank:(v.node(y.w).rank-q.rank)/2+q.rank,e:y};t.addDummyNode(v,"edge-proxy",P,"_ep")}})}function k(v){let y=0;v.nodes().forEach(N=>{let q=v.node(N);q.borderTop&&(q.minRank=v.node(q.borderTop).rank,q.maxRank=v.node(q.borderBottom).rank,y=Math.max(y,q.maxRank))}),v.graph().maxRank=y}function R(v){v.nodes().forEach(y=>{let N=v.node(y);N.dummy==="edge-proxy"&&(v.edge(N.e).labelRank=N.rank,v.removeNode(y))})}function T(v){let y=Number.POSITIVE_INFINITY,N=0,q=Number.POSITIVE_INFINITY,M=0,P=v.graph(),G=P.marginx||0,B=P.marginy||0;function ze(W){let V=W.x,H=W.y,Ue=W.width,He=W.height;y=Math.min(y,V-Ue/2),N=Math.max(N,V+Ue/2),q=Math.min(q,H-He/2),M=Math.max(M,H+He/2)}v.nodes().forEach(W=>ze(v.node(W))),v.edges().forEach(W=>{let V=v.edge(W);Object.hasOwn(V,"x")&&ze(V)}),y-=G,q-=B,v.nodes().forEach(W=>{let V=v.node(W);V.x-=y,V.y-=q}),v.edges().forEach(W=>{let V=v.edge(W);V.points.forEach(H=>{H.x-=y,H.y-=q}),Object.hasOwn(V,"x")&&(V.x-=y),Object.hasOwn(V,"y")&&(V.y-=q)}),P.width=N-y+G,P.height=M-q+B}function S(v){v.edges().forEach(y=>{let N=v.edge(y),q=v.node(y.v),M=v.node(y.w),P,G;N.points?(P=N.points[0],G=N.points[N.points.length-1]):(N.points=[],P=M,G=q),N.points.unshift(t.intersectRect(q,P)),N.points.push(t.intersectRect(M,G))})}function D(v){v.edges().forEach(y=>{let N=v.edge(y);if(Object.hasOwn(N,"x"))switch((N.labelpos==="l"||N.labelpos==="r")&&(N.width-=N.labeloffset),N.labelpos){case"l":N.x-=N.width/2+N.labeloffset;break;case"r":N.x+=N.width/2+N.labeloffset;break}})}function z(v){v.edges().forEach(y=>{let N=v.edge(y);N.reversed&&N.points.reverse()})}function U(v){v.nodes().forEach(y=>{if(v.children(y).length){let N=v.node(y),q=v.node(N.borderTop),M=v.node(N.borderBottom),P=v.node(N.borderLeft[N.borderLeft.length-1]),G=v.node(N.borderRight[N.borderRight.length-1]);N.width=Math.abs(G.x-P.x),N.height=Math.abs(M.y-q.y),N.x=P.x+N.width/2,N.y=q.y+N.height/2}}),v.nodes().forEach(y=>{v.node(y).dummy==="border"&&v.removeNode(y)})}function Hr(v){v.edges().forEach(y=>{if(y.v===y.w){var N=v.node(y.v);N.selfEdges||(N.selfEdges=[]),N.selfEdges.push({e:y,label:v.edge(y)}),v.removeEdge(y)}})}function Xr(v){var y=t.buildLayerMatrix(v);y.forEach(N=>{var q=0;N.forEach((M,P)=>{var G=v.node(M);G.order=P+q,(G.selfEdges||[]).forEach(B=>{t.addDummyNode(v,"selfedge",{width:B.label.width,height:B.label.height,rank:G.rank,order:P+ ++q,e:B.e,label:B.label},"_se")}),delete G.selfEdges})})}function Qr(v){v.nodes().forEach(y=>{var N=v.node(y);if(N.dummy==="selfedge"){var q=v.node(N.e.v),M=q.x+q.width/2,P=q.y,G=N.x-M,B=q.height/2;v.setEdge(N.e,N.label),v.removeNode(y),N.label.points=[{x:M+2*G/3,y:P-B},{x:M+5*G/6,y:P-B},{x:M+G,y:P},{x:M+5*G/6,y:P+B},{x:M+2*G/3,y:P+B}],N.label.x=N.x,N.label.y=N.y}})}function Q(v,y){return t.mapValues(t.pick(v,y),Number)}function $(v){var y={};return v&&Object.entries(v).forEach(([N,q])=>{typeof N=="string"&&(N=N.toLowerCase()),y[N]=q}),y}return Ae}var Ve,Gr;function Tt(){if(Gr)return Ve;Gr=1;let _=A(),m=Y().Graph;Ve={debugOrdering:f};function f(u){let a=_.buildLayerMatrix(u),i=new m({compound:!0,multigraph:!0}).setGraph({});return u.nodes().forEach(e=>{i.setNode(e,{label:e}),i.setParent(e,"layer"+u.node(e).rank)}),u.edges().forEach(e=>i.setEdge(e.v,e.w,{},e.name)),a.forEach((e,s)=>{let n="layer"+s;i.setNode(n,{rank:"same"}),e.reduce((o,r)=>(i.setEdge(o,r,{style:"invis"}),r))}),i}return Ve}var Be,Fr;function St(){return Fr||(Fr=1,Be="1.1.8"),Be}var We,Ar;function Mt(){return Ar||(Ar=1,We={graphlib:Y(),layout:Lt(),debug:Tt(),util:{time:A().time,notime:A().notime},version:St()}),We}var Pt=Mt();const Ft=Kr(Pt);export{Ft as d};