@mcp-graph-workflow/mcp-graph 5.21.0 → 5.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/routes/benchmark.d.ts.map +1 -1
- package/dist/api/routes/benchmark.js +22 -6
- package/dist/api/routes/benchmark.js.map +1 -1
- package/dist/api/routes/code-graph.d.ts.map +1 -1
- package/dist/api/routes/code-graph.js +2 -1
- package/dist/api/routes/code-graph.js.map +1 -1
- package/dist/api/routes/folder.d.ts +6 -0
- package/dist/api/routes/folder.d.ts.map +1 -1
- package/dist/api/routes/folder.js +53 -8
- package/dist/api/routes/folder.js.map +1 -1
- package/dist/api/routes/import.js +2 -1
- package/dist/api/routes/import.js.map +1 -1
- package/dist/api/routes/siebel.d.ts.map +1 -1
- package/dist/api/routes/siebel.js +4 -2
- package/dist/api/routes/siebel.js.map +1 -1
- package/dist/api/routes/skills.d.ts.map +1 -1
- package/dist/api/routes/skills.js +5 -2
- package/dist/api/routes/skills.js.map +1 -1
- package/dist/api/routes/translation.d.ts.map +1 -1
- package/dist/api/routes/translation.js +30 -8
- package/dist/api/routes/translation.js.map +1 -1
- package/dist/core/context/context-assembler.d.ts.map +1 -1
- package/dist/core/context/context-assembler.js +7 -0
- package/dist/core/context/context-assembler.js.map +1 -1
- package/dist/core/docs/docs-cache-store.js +1 -1
- package/dist/core/docs/docs-cache-store.js.map +1 -1
- package/dist/core/docs/stack-detector.js +6 -3
- package/dist/core/docs/stack-detector.js.map +1 -1
- package/dist/core/events/event-bus.d.ts +1 -1
- package/dist/core/events/event-bus.d.ts.map +1 -1
- package/dist/core/events/event-bus.js +13 -3
- package/dist/core/events/event-bus.js.map +1 -1
- package/dist/core/importer/prd-to-graph.d.ts.map +1 -1
- package/dist/core/importer/prd-to-graph.js +20 -5
- package/dist/core/importer/prd-to-graph.js.map +1 -1
- package/dist/core/integrations/integration-orchestrator.d.ts +1 -0
- package/dist/core/integrations/integration-orchestrator.d.ts.map +1 -1
- package/dist/core/integrations/integration-orchestrator.js +40 -19
- package/dist/core/integrations/integration-orchestrator.js.map +1 -1
- package/dist/core/parser/classify.js +2 -2
- package/dist/core/parser/classify.js.map +1 -1
- package/dist/core/parser/file-reader.d.ts.map +1 -1
- package/dist/core/parser/file-reader.js +9 -2
- package/dist/core/parser/file-reader.js.map +1 -1
- package/dist/core/parser/read-pdf.d.ts.map +1 -1
- package/dist/core/parser/read-pdf.js +5 -1
- package/dist/core/parser/read-pdf.js.map +1 -1
- package/dist/core/rag/knowledge-synthesizer.js +2 -2
- package/dist/core/rag/knowledge-synthesizer.js.map +1 -1
- package/dist/core/rag/node-indexer.d.ts.map +1 -1
- package/dist/core/rag/node-indexer.js +3 -2
- package/dist/core/rag/node-indexer.js.map +1 -1
- package/dist/core/store/migrations.d.ts.map +1 -1
- package/dist/core/store/migrations.js +10 -0
- package/dist/core/store/migrations.js.map +1 -1
- package/dist/core/store/sqlite-store.d.ts.map +1 -1
- package/dist/core/store/sqlite-store.js +39 -19
- package/dist/core/store/sqlite-store.js.map +1 -1
- package/dist/core/translation/chunked-analyzer.d.ts +36 -0
- package/dist/core/translation/chunked-analyzer.d.ts.map +1 -0
- package/dist/core/translation/chunked-analyzer.js +146 -0
- package/dist/core/translation/chunked-analyzer.js.map +1 -0
- package/dist/core/translation/confidence/ambiguity-detector.d.ts.map +1 -1
- package/dist/core/translation/confidence/ambiguity-detector.js +3 -1
- package/dist/core/translation/confidence/ambiguity-detector.js.map +1 -1
- package/dist/core/translation/language-detect.d.ts.map +1 -1
- package/dist/core/translation/language-detect.js +131 -0
- package/dist/core/translation/language-detect.js.map +1 -1
- package/dist/core/translation/memory/translation-memory.d.ts +14 -0
- package/dist/core/translation/memory/translation-memory.d.ts.map +1 -1
- package/dist/core/translation/memory/translation-memory.js +93 -0
- package/dist/core/translation/memory/translation-memory.js.map +1 -1
- package/dist/core/translation/parsers/csharp-parser-adapter.d.ts.map +1 -1
- package/dist/core/translation/parsers/csharp-parser-adapter.js +19 -22
- package/dist/core/translation/parsers/csharp-parser-adapter.js.map +1 -1
- package/dist/core/translation/parsers/go-parser-adapter.d.ts.map +1 -1
- package/dist/core/translation/parsers/go-parser-adapter.js +5 -2
- package/dist/core/translation/parsers/go-parser-adapter.js.map +1 -1
- package/dist/core/translation/parsers/java-parser-adapter.d.ts.map +1 -1
- package/dist/core/translation/parsers/java-parser-adapter.js +6 -1
- package/dist/core/translation/parsers/java-parser-adapter.js.map +1 -1
- package/dist/core/translation/parsers/rust-parser-adapter.js +1 -1
- package/dist/core/translation/pre-indexed-analyzer.d.ts +19 -0
- package/dist/core/translation/pre-indexed-analyzer.d.ts.map +1 -0
- package/dist/core/translation/pre-indexed-analyzer.js +100 -0
- package/dist/core/translation/pre-indexed-analyzer.js.map +1 -0
- package/dist/core/translation/prompt-builder.d.ts +2 -0
- package/dist/core/translation/prompt-builder.d.ts.map +1 -1
- package/dist/core/translation/prompt-builder.js +56 -8
- package/dist/core/translation/prompt-builder.js.map +1 -1
- package/dist/core/translation/prompt-paginator.d.ts +20 -0
- package/dist/core/translation/prompt-paginator.d.ts.map +1 -0
- package/dist/core/translation/prompt-paginator.js +108 -0
- package/dist/core/translation/prompt-paginator.js.map +1 -0
- package/dist/core/translation/translation-orchestrator.d.ts +4 -1
- package/dist/core/translation/translation-orchestrator.d.ts.map +1 -1
- package/dist/core/translation/translation-orchestrator.js +81 -14
- package/dist/core/translation/translation-orchestrator.js.map +1 -1
- package/dist/core/translation/translation-store.d.ts +6 -0
- package/dist/core/translation/translation-store.d.ts.map +1 -1
- package/dist/core/translation/translation-store.js +28 -0
- package/dist/core/translation/translation-store.js.map +1 -1
- package/dist/core/utils/circularity.d.ts +13 -0
- package/dist/core/utils/circularity.d.ts.map +1 -0
- package/dist/core/utils/circularity.js +30 -0
- package/dist/core/utils/circularity.js.map +1 -0
- package/dist/mcp/code-intelligence-wrapper.d.ts.map +1 -1
- package/dist/mcp/code-intelligence-wrapper.js +4 -2
- package/dist/mcp/code-intelligence-wrapper.js.map +1 -1
- package/dist/mcp/init-project.d.ts.map +1 -1
- package/dist/mcp/init-project.js +4 -2
- package/dist/mcp/init-project.js.map +1 -1
- package/dist/mcp/server.js +21 -4
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tool-classification.d.ts.map +1 -1
- package/dist/mcp/tool-classification.js +0 -1
- package/dist/mcp/tool-classification.js.map +1 -1
- package/dist/mcp/tools/analyze-translation.d.ts.map +1 -1
- package/dist/mcp/tools/analyze-translation.js +45 -5
- package/dist/mcp/tools/analyze-translation.js.map +1 -1
- package/dist/mcp/tools/clone-node.d.ts.map +1 -1
- package/dist/mcp/tools/clone-node.js +8 -3
- package/dist/mcp/tools/clone-node.js.map +1 -1
- package/dist/mcp/tools/edge.js +1 -1
- package/dist/mcp/tools/edge.js.map +1 -1
- package/dist/mcp/tools/import-graph.d.ts.map +1 -1
- package/dist/mcp/tools/import-graph.js +4 -2
- package/dist/mcp/tools/import-graph.js.map +1 -1
- package/dist/mcp/tools/index.d.ts.map +1 -1
- package/dist/mcp/tools/index.js +2 -0
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/memory.d.ts.map +1 -1
- package/dist/mcp/tools/memory.js +1 -0
- package/dist/mcp/tools/memory.js.map +1 -1
- package/dist/mcp/tools/move-node.d.ts.map +1 -1
- package/dist/mcp/tools/move-node.js +4 -14
- package/dist/mcp/tools/move-node.js.map +1 -1
- package/dist/mcp/tools/node.d.ts.map +1 -1
- package/dist/mcp/tools/node.js +5 -16
- package/dist/mcp/tools/node.js.map +1 -1
- package/dist/mcp/tools/siebel-generate-sif.js +4 -2
- package/dist/mcp/tools/siebel-generate-sif.js.map +1 -1
- package/dist/mcp/tools/translate-code.d.ts.map +1 -1
- package/dist/mcp/tools/translate-code.js +47 -5
- package/dist/mcp/tools/translate-code.js.map +1 -1
- package/dist/mcp/tools/translation-jobs.d.ts +8 -0
- package/dist/mcp/tools/translation-jobs.d.ts.map +1 -0
- package/dist/mcp/tools/translation-jobs.js +97 -0
- package/dist/mcp/tools/translation-jobs.js.map +1 -0
- package/dist/web/dashboard/dist/assets/benchmark-tab-sjsZBd-4.js +1 -0
- package/dist/web/dashboard/dist/assets/circle-alert-DcTbCUEa.js +6 -0
- package/dist/web/dashboard/dist/assets/context-tab-DNMJ2Pv-.js +1 -0
- package/dist/web/dashboard/dist/assets/{gitnexus-tab-D6MEUR3O.js → gitnexus-tab-CZ9LJbwz.js} +10 -10
- package/dist/web/dashboard/dist/assets/{graph-section-CyaVBqJB.js → graph-section-BdcXKKoS.js} +1 -1
- package/dist/web/dashboard/dist/assets/graph-tab-CFzux3kf.js +6 -0
- package/dist/web/dashboard/dist/assets/{graph-utils-dWjSQUrT.js → graph-utils-_8jpWA5z.js} +1 -1
- package/dist/web/dashboard/dist/assets/{index-BpSI95md.js → index-Bny20bel.js} +1 -1
- package/dist/web/dashboard/dist/assets/index-CITYTuX5.js +218 -0
- package/dist/web/dashboard/dist/assets/index-CvAguK65.css +1 -0
- package/dist/web/dashboard/dist/assets/{index-BKNOfKcX.js → index-DSI2SYWO.js} +1 -1
- package/dist/web/dashboard/dist/assets/{insights-tab-qfYmJM2I.js → insights-tab-DUA76KUY.js} +15 -15
- package/dist/web/dashboard/dist/assets/journey-tab-FTd6jBta.js +1 -0
- package/dist/web/dashboard/dist/assets/{languages-tab-CrgWsmId.js → languages-tab-B_nhFL2q.js} +7 -12
- package/dist/web/dashboard/dist/assets/loader-circle-D1DpGd2u.js +6 -0
- package/dist/web/dashboard/dist/assets/{logs-tab-CQ8bSvRy.js → logs-tab-CzL36_Qy.js} +2 -2
- package/dist/web/dashboard/dist/assets/lsp-tab-DdHhJq_H.js +49 -0
- package/dist/web/dashboard/dist/assets/memories-tab-CzgCahnV.js +1 -0
- package/dist/web/dashboard/dist/assets/prd-backlog-tab-C8Cl7swI.js +1 -0
- package/dist/web/dashboard/dist/assets/refresh-cw-DSYiHmbh.js +6 -0
- package/dist/web/dashboard/dist/assets/{siebel-tab-rX5raaJc.js → siebel-tab-B4XOaUGz.js} +3 -3
- package/dist/web/dashboard/dist/assets/skills-tab-CkpnwPJY.js +1 -0
- package/dist/web/dashboard/dist/assets/{style-D_2CfpkF.js → style-BOQDk6qp.js} +1 -1
- package/dist/web/dashboard/dist/assets/triangle-alert-Bf6Ly19h.js +16 -0
- package/dist/web/dashboard/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/dashboard/dist/assets/benchmark-tab-CA0tgawW.js +0 -1
- package/dist/web/dashboard/dist/assets/context-tab-CwKPhEgw.js +0 -1
- package/dist/web/dashboard/dist/assets/graph-tab-xMRobj4G.js +0 -1
- package/dist/web/dashboard/dist/assets/index-DUIBILM9.js +0 -218
- package/dist/web/dashboard/dist/assets/index-QMfM-nWT.css +0 -1
- package/dist/web/dashboard/dist/assets/journey-tab-BB5ei9Re.js +0 -1
- package/dist/web/dashboard/dist/assets/lsp-tab-BKKSyuSj.js +0 -54
- package/dist/web/dashboard/dist/assets/memories-tab-BshQ8DL8.js +0 -1
- package/dist/web/dashboard/dist/assets/prd-backlog-tab-nfXaOLTF.js +0 -1
- package/dist/web/dashboard/dist/assets/skills-tab-DyX_XWmC.js +0 -1
- package/dist/web/dashboard/dist/assets/triangle-alert-T9o21Q4O.js +0 -21
package/dist/web/dashboard/dist/assets/{graph-section-CyaVBqJB.js → graph-section-BdcXKKoS.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as e}from"./index-DUIBILM9.js";import{H as E,P as T,g as V,c as W,E as Y,u as K,a as Z,i as q,B as U,C as X}from"./style-D_2CfpkF.js";import{e as b,f as L}from"./constants-lq4BIQN3.js";import{d as $}from"./index-BpSI95md.js";import"./index-BKNOfKcX.js";const J=x.memo(function({data:r}){const a=b[r.siebelType]||"#6b7280";return e.jsxs(e.Fragment,{children:[e.jsx(E,{type:"target",position:T.Top,className:"!w-2 !h-2"}),e.jsx("div",{className:`bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px] ${r.isImpacted?r.impactLevel==="direct"?"ring-2 ring-red-500/60":"ring-2 ring-orange-400/50":""} ${r.inactive?"opacity-50":""}`,children:e.jsxs("div",{className:"p-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${a}20`,color:a},children:r.siebelType.replace(/_/g," ")}),r.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-surface-alt text-muted",children:"inactive"})]}),e.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:r.label}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[r.project&&e.jsx("span",{children:r.project}),e.jsxs("span",{children:[r.propertyCount," props"]}),r.childCount>0&&e.jsxs("span",{children:[r.childCount," children"]})]})]})}),e.jsx(E,{type:"source",position:T.Bottom,className:"!w-2 !h-2"})]})}),Q=x.memo(function({id:r,sourceX:a,sourceY:n,targetX:i,targetY:d,sourcePosition:o,targetPosition:h,style:l,data:t}){const[c,m,g]=V({sourceX:a,sourceY:n,sourcePosition:o,targetX:i,targetY:d,targetPosition:h});return e.jsxs(e.Fragment,{children:[e.jsx(W,{id:r,path:c,style:l}),(t==null?void 0:t.relationType)&&e.jsx(Y,{children:e.jsx("div",{className:"absolute text-[9px] px-1 py-0.5 rounded bg-surface border border-edge text-muted pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${m}px, ${g}px)`},children:t.relationType.replace(/_/g," ")})})]})});function ee({object:s,dependencies:r,onClose:a,onShowImpact:n,impactTarget:i}){const d=b[s.type]||"#6b7280",o=x.useMemo(()=>r.filter(t=>t.from.name===s.name&&t.from.type===s.type),[r,s]),h=x.useMemo(()=>r.filter(t=>t.to.name===s.name&&t.to.type===s.type),[r,s]),l=(i==null?void 0:i.name)===s.name&&(i==null?void 0:i.type)===s.type;return e.jsxs("aside",{className:"w-80 flex-shrink-0 border-l border-edge bg-surface-alt overflow-y-auto",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded flex-shrink-0",style:{background:`${d}20`,color:d},children:s.type.replace(/_/g," ")}),s.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted",children:"inactive"})]}),e.jsx("h3",{className:"text-sm font-semibold truncate",children:s.name}),s.project&&e.jsx("p",{className:"text-xs text-muted",children:s.project})]}),e.jsx("button",{onClick:a,"aria-label":"Close detail panel",className:"p-1 text-muted hover:text-foreground cursor-pointer transition-colors",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"px-4 py-2 border-b border-edge",children:e.jsx("button",{onClick:()=>{l||n(s.type,s.name)},disabled:l,"aria-label":"Show impact analysis",className:`w-full px-3 py-1.5 text-xs font-medium rounded-md transition-opacity cursor-pointer ${l?"bg-orange-500/20 text-orange-400 cursor-default":"bg-accent text-white hover:opacity-90"}`,children:l?"Impact Analysis Active":"Show Impact"})}),s.properties.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Properties (",s.properties.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.properties.map((t,c)=>e.jsxs("div",{className:"flex gap-2 text-[11px]",children:[e.jsx("span",{className:"font-mono text-muted flex-shrink-0",children:t.name}),e.jsx("span",{className:"text-foreground truncate",children:t.value})]},c))})]}),s.children.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Children (",s.children.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.children.map((t,c)=>{const m=b[t.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.type}),e.jsx("span",{className:"truncate",children:t.name})]},c)})})]}),o.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Depends On (",o.length,")"]}),e.jsx("div",{className:"space-y-1",children:o.map((t,c)=>{const m=b[t.to.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.to.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.to.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]}),h.length>0&&e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Referenced By (",h.length,")"]}),e.jsx("div",{className:"space-y-1",children:h.map((t,c)=>{const m=b[t.from.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.from.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.from.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]})]})}const w=220,B=72;function v(s,r){return`siebel:${s}:${r}`}function te(s,r,a){return s.filter(n=>{var i;return!((i=r==null?void 0:r.types)!=null&&i.size&&!r.types.has(n.type)||!(r!=null&&r.showInactive)&&n.inactive)}).map(n=>{const i=v(n.type,n.name),d=b[n.type]||"#6b7280",o=a==null?void 0:a.get(i);return{id:i,type:"siebelNode",position:{x:0,y:0},data:{label:n.name,siebelType:n.type,project:n.project,propertyCount:n.properties.length,childCount:n.children.length,inactive:n.inactive,sourceObject:n,isImpacted:!!o,impactLevel:o},style:{width:w,borderLeft:`4px solid ${d}`}}})}function se(s,r){return s.map((a,n)=>{const i=v(a.from.type,a.from.name),d=v(a.to.type,a.to.name);if(!r.has(i)||!r.has(d))return null;const o=L[a.relationType]||L.references;return{id:`siebel-edge-${n}`,source:i,target:d,label:o.label,type:"siebelEdge",data:{relationType:a.relationType,inferred:a.inferred},style:{stroke:o.color,strokeDasharray:o.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}}).filter(a=>a!==null)}let j=null;function re(s,r,a){let n=0;const i=[a,...s,"|",...r];for(const d of i)for(let o=0;o<d.length;o++)n=(n<<5)-n+d.charCodeAt(o)|0;return n}function ne(s,r,a="TB"){const n=s.map(l=>l.id),i=r.map(l=>`${l.source}-${l.target}`),d=re(n,i,a);let o;if(j&&j.key===d)o=j.positions;else{const l=new $.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:a,ranksep:80,nodesep:50});for(const t of s)l.setNode(t.id,{width:w,height:B});for(const t of r)l.setEdge(t.source,t.target);$.layout(l),o=new Map;for(const t of s){const c=l.node(t.id);o.set(t.id,{x:c.x-w/2,y:c.y-B/2})}j={key:d,positions:o}}return{nodes:s.map(l=>{const t=o.get(l.id)??{x:0,y:0};return{...l,position:t}}),edges:r}}function oe(s,r,a){const n=v(r,a),i=new Map,d=new Map;for(const t of s){const c=v(t.to.type,t.to.name),m=v(t.from.type,t.from.name);d.has(c)||d.set(c,[]),d.get(c).push(m)}const o=[n],h=new Set([n]);let l=0;for(;o.length>0;){const t=o.length;l++;for(let c=0;c<t;c++){const m=o.shift(),g=d.get(m)||[];for(const N of g)h.has(N)||(h.add(N),i.set(N,l===1?"direct":"transitive"),o.push(N))}}return i}const ae={siebelNode:J},le={siebelEdge:Q},ie={hideAttribution:!0};function ue({objects:s,dependencies:r}){const[a,n,i]=K([]),[d,o,h]=Z([]),[l,t]=x.useState(null),[c,m]=x.useState("TB"),[g,N]=x.useState(new Set),[k,_]=x.useState(!1),[y,C]=x.useState(null),S=x.useDeferredValue(g),D=x.useMemo(()=>{const p=new Set;for(const u of s)p.add(u.type);return[...p].sort()},[s]),I=x.useMemo(()=>{if(y)return oe(r,y.type,y.name)},[r,y]);x.useEffect(()=>{if(s.length===0){n([]),o([]);return}const u=te(s,{types:S,showInactive:k},I),f=new Set(u.map(G=>G.id)),F=se(r,f),{nodes:R,edges:H}=ne(u,F,c);n(R),o(H)},[s,r,S,k,c,I,n,o]);const M=x.useCallback((p,u)=>{t(u.data.sourceObject)},[]),A=x.useCallback(()=>{t(null)},[]),P=x.useCallback(p=>{N(u=>{const f=new Set(u);return f.has(p)?f.delete(p):f.add(p),f})},[]),O=x.useCallback((p,u)=>{C({type:p,name:u})},[]),z=x.useCallback(()=>{C(null)},[]);return s.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("svg",{className:"w-12 h-12 mx-auto text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0020.25 18V6A2.25 2.25 0 0018 3.75H6A2.25 2.25 0 003.75 6v12A2.25 2.25 0 006 20.25z"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"SIF Dependency Graph"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:"Upload a .sif file to visualize Siebel object relationships"})]})]})}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex flex-wrap gap-1 flex-1",children:D.map(p=>{const u=b[p]||"#6b7280",f=g.size===0||g.has(p);return e.jsx("button",{onClick:()=>P(p),"aria-label":`Filter ${p}`,"aria-pressed":g.has(p),className:"px-2 py-0.5 text-[10px] rounded-md border transition-colors cursor-pointer",style:{borderColor:f?u:"var(--color-border)",backgroundColor:f?`${u}15`:"transparent",color:f?u:"var(--color-text-muted)",opacity:f?1:.5},children:p.replace(/_/g," ")},p)})}),e.jsxs("div",{className:"flex items-center gap-1 border-l border-edge pl-3",children:[e.jsx("button",{onClick:()=>m("TB"),"aria-label":"Top to bottom layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="TB"?"bg-accent/10 text-accent":"text-muted"}`,children:"TB"}),e.jsx("button",{onClick:()=>m("LR"),"aria-label":"Left to right layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="LR"?"bg-accent/10 text-accent":"text-muted"}`,children:"LR"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] text-muted cursor-pointer border-l border-edge pl-3",children:[e.jsx("input",{type:"checkbox",checked:k,onChange:p=>_(p.target.checked),className:"rounded"}),"Inactive"]}),y&&e.jsxs("div",{className:"flex items-center gap-1.5 border-l border-edge pl-3",children:[e.jsxs("span",{className:"text-[10px] text-orange-400",children:["Impact: ",y.name]}),e.jsx("button",{onClick:z,"aria-label":"Clear impact analysis",className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted hover:text-foreground cursor-pointer transition-colors",children:"Clear"})]}),e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," nodes"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(q,{nodes:a,edges:d,onNodesChange:i,onEdgesChange:h,onNodeClick:M,onPaneClick:A,nodeTypes:ae,edgeTypes:le,proOptions:ie,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,children:[e.jsx(U,{gap:16,size:1}),e.jsx(X,{showInteractive:!1})]})}),l&&e.jsx(ee,{object:l,dependencies:r,onClose:()=>t(null),onShowImpact:O,impactTarget:y})]})]})}export{ue as GraphSection};
|
|
1
|
+
import{r as x,j as e}from"./index-CITYTuX5.js";import{H as E,P as T,g as V,c as W,E as Y,u as K,a as Z,i as q,B as U,C as X}from"./style-BOQDk6qp.js";import{e as b,f as L}from"./constants-lq4BIQN3.js";import{d as $}from"./index-Bny20bel.js";import"./index-DSI2SYWO.js";const J=x.memo(function({data:r}){const a=b[r.siebelType]||"#6b7280";return e.jsxs(e.Fragment,{children:[e.jsx(E,{type:"target",position:T.Top,className:"!w-2 !h-2"}),e.jsx("div",{className:`bg-surface border border-edge rounded-lg shadow-sm hover:shadow-md transition-shadow cursor-pointer min-w-[200px] ${r.isImpacted?r.impactLevel==="direct"?"ring-2 ring-red-500/60":"ring-2 ring-orange-400/50":""} ${r.inactive?"opacity-50":""}`,children:e.jsxs("div",{className:"p-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded",style:{background:`${a}20`,color:a},children:r.siebelType.replace(/_/g," ")}),r.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-surface-alt text-muted",children:"inactive"})]}),e.jsx("div",{className:"text-sm font-medium leading-tight line-clamp-2 mb-1",children:r.label}),e.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted",children:[r.project&&e.jsx("span",{children:r.project}),e.jsxs("span",{children:[r.propertyCount," props"]}),r.childCount>0&&e.jsxs("span",{children:[r.childCount," children"]})]})]})}),e.jsx(E,{type:"source",position:T.Bottom,className:"!w-2 !h-2"})]})}),Q=x.memo(function({id:r,sourceX:a,sourceY:n,targetX:i,targetY:d,sourcePosition:o,targetPosition:h,style:l,data:t}){const[c,m,g]=V({sourceX:a,sourceY:n,sourcePosition:o,targetX:i,targetY:d,targetPosition:h});return e.jsxs(e.Fragment,{children:[e.jsx(W,{id:r,path:c,style:l}),(t==null?void 0:t.relationType)&&e.jsx(Y,{children:e.jsx("div",{className:"absolute text-[9px] px-1 py-0.5 rounded bg-surface border border-edge text-muted pointer-events-none",style:{transform:`translate(-50%, -50%) translate(${m}px, ${g}px)`},children:t.relationType.replace(/_/g," ")})})]})});function ee({object:s,dependencies:r,onClose:a,onShowImpact:n,impactTarget:i}){const d=b[s.type]||"#6b7280",o=x.useMemo(()=>r.filter(t=>t.from.name===s.name&&t.from.type===s.type),[r,s]),h=x.useMemo(()=>r.filter(t=>t.to.name===s.name&&t.to.type===s.type),[r,s]),l=(i==null?void 0:i.name)===s.name&&(i==null?void 0:i.type)===s.type;return e.jsxs("aside",{className:"w-80 flex-shrink-0 border-l border-edge bg-surface-alt overflow-y-auto",children:[e.jsxs("div",{className:"px-4 py-3 border-b border-edge flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"text-[10px] font-semibold uppercase px-1.5 py-0.5 rounded flex-shrink-0",style:{background:`${d}20`,color:d},children:s.type.replace(/_/g," ")}),s.inactive&&e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted",children:"inactive"})]}),e.jsx("h3",{className:"text-sm font-semibold truncate",children:s.name}),s.project&&e.jsx("p",{className:"text-xs text-muted",children:s.project})]}),e.jsx("button",{onClick:a,"aria-label":"Close detail panel",className:"p-1 text-muted hover:text-foreground cursor-pointer transition-colors",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),e.jsx("div",{className:"px-4 py-2 border-b border-edge",children:e.jsx("button",{onClick:()=>{l||n(s.type,s.name)},disabled:l,"aria-label":"Show impact analysis",className:`w-full px-3 py-1.5 text-xs font-medium rounded-md transition-opacity cursor-pointer ${l?"bg-orange-500/20 text-orange-400 cursor-default":"bg-accent text-white hover:opacity-90"}`,children:l?"Impact Analysis Active":"Show Impact"})}),s.properties.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Properties (",s.properties.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.properties.map((t,c)=>e.jsxs("div",{className:"flex gap-2 text-[11px]",children:[e.jsx("span",{className:"font-mono text-muted flex-shrink-0",children:t.name}),e.jsx("span",{className:"text-foreground truncate",children:t.value})]},c))})]}),s.children.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Children (",s.children.length,")"]}),e.jsx("div",{className:"space-y-1 max-h-48 overflow-y-auto",children:s.children.map((t,c)=>{const m=b[t.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.type}),e.jsx("span",{className:"truncate",children:t.name})]},c)})})]}),o.length>0&&e.jsxs("div",{className:"px-4 py-3 border-b border-edge",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Depends On (",o.length,")"]}),e.jsx("div",{className:"space-y-1",children:o.map((t,c)=>{const m=b[t.to.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.to.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.to.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]}),h.length>0&&e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("h4",{className:"text-[10px] font-semibold uppercase text-muted mb-2 tracking-wider",children:["Referenced By (",h.length,")"]}),e.jsx("div",{className:"space-y-1",children:h.map((t,c)=>{const m=b[t.from.type]||"#6b7280";return e.jsxs("div",{className:"flex items-center gap-2 text-[11px]",children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase px-1 py-0.5 rounded flex-shrink-0",style:{background:`${m}20`,color:m},children:t.from.type.replace(/_/g," ")}),e.jsx("span",{className:"truncate",children:t.from.name}),e.jsx("span",{className:"text-[9px] text-muted ml-auto flex-shrink-0",children:t.relationType})]},c)})})]})]})}const w=220,B=72;function v(s,r){return`siebel:${s}:${r}`}function te(s,r,a){return s.filter(n=>{var i;return!((i=r==null?void 0:r.types)!=null&&i.size&&!r.types.has(n.type)||!(r!=null&&r.showInactive)&&n.inactive)}).map(n=>{const i=v(n.type,n.name),d=b[n.type]||"#6b7280",o=a==null?void 0:a.get(i);return{id:i,type:"siebelNode",position:{x:0,y:0},data:{label:n.name,siebelType:n.type,project:n.project,propertyCount:n.properties.length,childCount:n.children.length,inactive:n.inactive,sourceObject:n,isImpacted:!!o,impactLevel:o},style:{width:w,borderLeft:`4px solid ${d}`}}})}function se(s,r){return s.map((a,n)=>{const i=v(a.from.type,a.from.name),d=v(a.to.type,a.to.name);if(!r.has(i)||!r.has(d))return null;const o=L[a.relationType]||L.references;return{id:`siebel-edge-${n}`,source:i,target:d,label:o.label,type:"siebelEdge",data:{relationType:a.relationType,inferred:a.inferred},style:{stroke:o.color,strokeDasharray:o.dashed?"5 5":void 0},labelStyle:{fontSize:10,fill:"#6c757d"}}}).filter(a=>a!==null)}let j=null;function re(s,r,a){let n=0;const i=[a,...s,"|",...r];for(const d of i)for(let o=0;o<d.length;o++)n=(n<<5)-n+d.charCodeAt(o)|0;return n}function ne(s,r,a="TB"){const n=s.map(l=>l.id),i=r.map(l=>`${l.source}-${l.target}`),d=re(n,i,a);let o;if(j&&j.key===d)o=j.positions;else{const l=new $.graphlib.Graph;l.setDefaultEdgeLabel(()=>({})),l.setGraph({rankdir:a,ranksep:80,nodesep:50});for(const t of s)l.setNode(t.id,{width:w,height:B});for(const t of r)l.setEdge(t.source,t.target);$.layout(l),o=new Map;for(const t of s){const c=l.node(t.id);o.set(t.id,{x:c.x-w/2,y:c.y-B/2})}j={key:d,positions:o}}return{nodes:s.map(l=>{const t=o.get(l.id)??{x:0,y:0};return{...l,position:t}}),edges:r}}function oe(s,r,a){const n=v(r,a),i=new Map,d=new Map;for(const t of s){const c=v(t.to.type,t.to.name),m=v(t.from.type,t.from.name);d.has(c)||d.set(c,[]),d.get(c).push(m)}const o=[n],h=new Set([n]);let l=0;for(;o.length>0;){const t=o.length;l++;for(let c=0;c<t;c++){const m=o.shift(),g=d.get(m)||[];for(const N of g)h.has(N)||(h.add(N),i.set(N,l===1?"direct":"transitive"),o.push(N))}}return i}const ae={siebelNode:J},le={siebelEdge:Q},ie={hideAttribution:!0};function ue({objects:s,dependencies:r}){const[a,n,i]=K([]),[d,o,h]=Z([]),[l,t]=x.useState(null),[c,m]=x.useState("TB"),[g,N]=x.useState(new Set),[k,_]=x.useState(!1),[y,C]=x.useState(null),S=x.useDeferredValue(g),D=x.useMemo(()=>{const p=new Set;for(const u of s)p.add(u.type);return[...p].sort()},[s]),I=x.useMemo(()=>{if(y)return oe(r,y.type,y.name)},[r,y]);x.useEffect(()=>{if(s.length===0){n([]),o([]);return}const u=te(s,{types:S,showInactive:k},I),f=new Set(u.map(G=>G.id)),F=se(r,f),{nodes:R,edges:H}=ne(u,F,c);n(R),o(H)},[s,r,S,k,c,I,n,o]);const M=x.useCallback((p,u)=>{t(u.data.sourceObject)},[]),A=x.useCallback(()=>{t(null)},[]),P=x.useCallback(p=>{N(u=>{const f=new Set(u);return f.has(p)?f.delete(p):f.add(p),f})},[]),O=x.useCallback((p,u)=>{C({type:p,name:u})},[]),z=x.useCallback(()=>{C(null)},[]);return s.length===0?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center space-y-3",children:[e.jsx("svg",{className:"w-12 h-12 mx-auto text-muted",fill:"none",viewBox:"0 0 24 24",strokeWidth:1,stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 14.25v2.25m3-4.5v4.5m3-6.75v6.75m3-9v9M6 20.25h12A2.25 2.25 0 0020.25 18V6A2.25 2.25 0 0018 3.75H6A2.25 2.25 0 003.75 6v12A2.25 2.25 0 006 20.25z"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"SIF Dependency Graph"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:"Upload a .sif file to visualize Siebel object relationships"})]})]})}):e.jsxs("div",{className:"h-full flex flex-col",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 border-b border-edge bg-surface-alt",children:[e.jsx("div",{className:"flex flex-wrap gap-1 flex-1",children:D.map(p=>{const u=b[p]||"#6b7280",f=g.size===0||g.has(p);return e.jsx("button",{onClick:()=>P(p),"aria-label":`Filter ${p}`,"aria-pressed":g.has(p),className:"px-2 py-0.5 text-[10px] rounded-md border transition-colors cursor-pointer",style:{borderColor:f?u:"var(--color-border)",backgroundColor:f?`${u}15`:"transparent",color:f?u:"var(--color-text-muted)",opacity:f?1:.5},children:p.replace(/_/g," ")},p)})}),e.jsxs("div",{className:"flex items-center gap-1 border-l border-edge pl-3",children:[e.jsx("button",{onClick:()=>m("TB"),"aria-label":"Top to bottom layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="TB"?"bg-accent/10 text-accent":"text-muted"}`,children:"TB"}),e.jsx("button",{onClick:()=>m("LR"),"aria-label":"Left to right layout",className:`px-2 py-0.5 text-[10px] rounded cursor-pointer transition-colors ${c==="LR"?"bg-accent/10 text-accent":"text-muted"}`,children:"LR"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] text-muted cursor-pointer border-l border-edge pl-3",children:[e.jsx("input",{type:"checkbox",checked:k,onChange:p=>_(p.target.checked),className:"rounded"}),"Inactive"]}),y&&e.jsxs("div",{className:"flex items-center gap-1.5 border-l border-edge pl-3",children:[e.jsxs("span",{className:"text-[10px] text-orange-400",children:["Impact: ",y.name]}),e.jsx("button",{onClick:z,"aria-label":"Clear impact analysis",className:"text-[10px] px-1.5 py-0.5 rounded bg-surface text-muted hover:text-foreground cursor-pointer transition-colors",children:"Clear"})]}),e.jsxs("span",{className:"text-[10px] text-muted",children:[a.length," nodes"]})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsx("div",{className:"flex-1",children:e.jsxs(q,{nodes:a,edges:d,onNodesChange:i,onEdgesChange:h,onNodeClick:M,onPaneClick:A,nodeTypes:ae,edgeTypes:le,proOptions:ie,fitView:!0,fitViewOptions:{padding:.2},minZoom:.1,maxZoom:2,children:[e.jsx(U,{gap:16,size:1}),e.jsx(X,{showInteractive:!1})]})}),l&&e.jsx(ee,{object:l,dependencies:r,onClose:()=>t(null),onShowImpact:O,impactTarget:y})]})]})}export{ue as GraphSection};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{c as oe,r as s,j as e,a as de,F as ce}from"./index-CITYTuX5.js";import{u as ie,a as xe,i as ue,B as me,C as pe}from"./style-BOQDk6qp.js";import{b as he,a as fe,g as O,t as be,s as ge,c as je,d as Ne,W as ye,e as ve,N as Ce}from"./graph-utils-_8jpWA5z.js";import{A as ke,S as L,a as we,N as _,E as Se}from"./constants-lq4BIQN3.js";import{L as W}from"./loader-circle-D1DpGd2u.js";import{C as Te}from"./circle-alert-DcTbCUEa.js";import"./index-DSI2SYWO.js";import"./index-Bny20bel.js";/**
|
|
2
|
+
* @license lucide-react v1.7.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Ee=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],Le=oe("layout-grid",Ee),_e=s.memo(function({statuses:d,types:f,direction:g,onStatusToggle:b,onTypeToggle:h,onDirectionChange:o,onClear:m,visibleNodeCount:i,totalNodeCount:x,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:"}),ke.map(r=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:d.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:"}),we.map(r=>e.jsxs("label",{className:"flex items-center gap-1 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:f.has(r),onChange:()=>h(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:g,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:x>100?`Warning: ${x} 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 ",i," of ",x]}),e.jsx("button",{onClick:m,className:"text-muted hover:text-foreground underline",children:"Clear"})]})}),Pe=s.memo(function({tree:d,expandedIds:f,selectedNodeId:g,onToggleExpand:b,onSelectNode:h}){const[o,m]=s.useState(!1),i=s.useCallback(()=>m(x=>!x),[]);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:i,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:i,className:"text-xs text-muted hover:text-foreground",title:"Collapse panel",children:"◂"})]}),e.jsx("div",{className:"overflow-y-auto flex-1 py-1",children:d.length===0?e.jsx("div",{className:"px-3 py-4 text-xs text-muted text-center",children:"No nodes"}):d.map(x=>e.jsx($,{item:x,depth:0,expandedIds:f,selectedNodeId:g,onToggleExpand:b,onSelectNode:h},x.node.id))})]})});function $({item:t,depth:d,expandedIds:f,selectedNodeId:g,onToggleExpand:b,onSelectNode:h}){const{node:o,children:m}=t,i=f.has(o.id),x=g===o.id,v=m.length>0,p=L[o.status]||"#9e9e9e",r=_[o.type]||"#6c757d",N=s.useCallback(n=>{n.stopPropagation(),b(o.id)},[o.id,b]),C=s.useCallback(()=>{h(o.id)},[o.id,h]);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 ${x?"bg-surface-elevated font-semibold":""}`,style:{paddingLeft:`${d*16+8}px`},children:[v?e.jsx("span",{onClick:N,className:"w-4 text-center text-muted hover:text-foreground cursor-pointer shrink-0",children:i?"▾":"▸"}):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:m.length})]}),i&&m.map(n=>e.jsx($,{item:n,depth:d+1,expandedIds:f,selectedNodeId:g,onToggleExpand:b,onSelectNode:h},n.node.id))]})}const I=50,De=s.memo(function({nodes:d,allNodes:f=[],onNodeClick:g}){const b=s.useMemo(()=>{const a=new Map;for(const j of f)a.set(j.id,j.title);return a},[f]),[h,o]=s.useState("priority"),[m,i]=s.useState("asc"),[x,v]=s.useState(""),[p,r]=s.useState(0),N=s.useMemo(()=>{if(!x)return d;const a=x.toLowerCase();return d.filter(j=>j.title.toLowerCase().includes(a)||j.type.toLowerCase().includes(a)||j.status.toLowerCase().includes(a)||(j.sprint||"").toLowerCase().includes(a))},[d,x]),C=s.useMemo(()=>[...N].sort((a,j)=>{const S=a[h]??"",E=j[h]??"",y=typeof S=="number"?S-E:String(S).localeCompare(String(E));return m==="asc"?y:-y}),[N,h,m]),n=Math.max(1,Math.ceil(C.length/I)),w=s.useMemo(()=>C.slice(p*I,(p+1)*I),[C,p]),k=a=>{h===a?i(j=>j==="asc"?"desc":"asc"):(o(a),i("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:x,onChange:a=>v(a.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(a=>e.jsxs("th",{onClick:()=>k(a.key),className:"px-3 py-1.5 text-left text-xs font-medium text-muted cursor-pointer hover:text-foreground",children:[a.label,h===a.key&&(m==="asc"?" ↑":" ↓")]},a.key))})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:7,className:"px-3 py-4 text-center text-muted",children:"No nodes found"})}):w.map(a=>e.jsxs("tr",{onClick:()=>g(a),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:a.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:`${_[a.type]}20`,color:_[a.type]},children:a.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[a.status]}20`,color:L[a.status]},children:a.status.replace("_"," ")})}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:a.priority}),e.jsx("td",{className:"px-3 py-1.5 text-center",children:a.xpSize||"-"}),e.jsx("td",{className:"px-3 py-1.5",children:a.sprint||"-"}),e.jsx("td",{className:"px-3 py-1.5 max-w-[150px] truncate text-muted",children:a.parentId?b.get(a.parentId)??"-":"-"})]},a.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(a=>Math.max(0,a-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(a=>Math.min(n-1,a+1)),className:"px-2 py-0.5 rounded border border-edge disabled:opacity-30",children:"Next"})]})]})]})}),Ie=["depends_on","blocks","parent_of","child_of","related_to","priority_over","implements","derived_from"];function Re({fromId:t,toId:d,fromTitle:f,toTitle:g,onCreated:b,onCancel:h}){const[o,m]=s.useState("depends_on"),[i,x]=s.useState(""),[v,p]=s.useState(!1),[r,N]=s.useState(null),C=s.useCallback(async()=>{p(!0),N(null);try{await de.createEdge({from:t,to:d,relationType:o,reason:i.trim()||void 0}),b()}catch(n){N(n instanceof Error?n.message:"Failed to create edge")}finally{p(!1)}},[t,d,o,i,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??t})]}),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:g??d})]}),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=>m(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:Ie.map(n=>{const w=Se[n];return e.jsx("option",{value:n,children:w.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:i,onChange:n=>x(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:h,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 Ae={workflowNode:ve},Me={workflowEdge:ye},Fe={hideAttribution:!0};function Ge({graph:t}){var M,F;const[d,f,g]=ie([]),[b,h,o]=xe([]),[m,i]=s.useState(null),[x,v]=s.useState("TB"),[p,r]=s.useState(new Set),[N,C]=s.useState(new Set),[n,w]=s.useState(new Set),[k,T]=s.useState(null),a=s.useDeferredValue(p),j=s.useDeferredValue(N),S=s.useDeferredValue(x),E=s.useRef(null),y=s.useMemo(()=>he(t.nodes,t.edges),[t.nodes,t.edges]),V=s.useMemo(()=>fe(t.nodes,y),[t.nodes,y]),P=s.useCallback(l=>{w(u=>{const c=new Set(u);return c.has(l)?c.delete(l):c.add(l),c})},[]),B=s.useCallback(()=>{const l=new Set;for(const[u]of y)l.add(u);w(l)},[y]),H=s.useCallback(()=>{w(new Set)},[]),R=s.useCallback((l,u,c)=>{const ae=O(t.nodes,n,y),G=be(ae,{statuses:l,types:u},y,n,P),D=G.map(re=>re.id);if(ge(E.current,D)&&c===S)return;E.current=D;const le=new Set(D),ne=je(t.edges,le),z=Ne(G,ne,c);f(z.nodes),h(z.edges)},[t,f,h,S,n,y,P]);s.useEffect(()=>{R(a,j,S)},[t,R,a,j,S]);const Y=s.useCallback((l,u)=>{i(u.data.sourceNode)},[]),U=s.useCallback(l=>{i(l)},[]),Z=s.useCallback(l=>{const u=t.nodes.find(c=>c.id===l);u&&i(u)},[t.nodes]),K=s.useCallback(l=>{const u=t.nodes.find(c=>c.id===l);u&&i(u)},[t.nodes]),q=s.useCallback(l=>{l.source&&l.target&&l.source!==l.target&&T({fromId:l.source,toId:l.target})},[]),J=s.useCallback(()=>{T(null)},[]),Q=s.useCallback(l=>{r(u=>{const c=new Set(u);return c.has(l)?c.delete(l):c.add(l),c})},[]),X=s.useCallback(l=>{C(u=>{const c=new Set(u);return c.has(l)?c.delete(l):c.add(l),c})},[]),ee=s.useCallback(()=>{r(new Set),C(new Set)},[]),A=s.useMemo(()=>O(t.nodes,n,y).filter(u=>!(p.size&&!p.has(u.status)||N.size&&!N.has(u.type))),[t.nodes,n,y,p,N]),se=k?(M=t.nodes.find(l=>l.id===k.fromId))==null?void 0:M.title:void 0,te=k?(F=t.nodes.find(l=>l.id===k.toId))==null?void 0:F.title:void 0;return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsx(_e,{statuses:p,types:N,direction:x,onStatusToggle:Q,onTypeToggle:X,onDirectionChange:v,onClear:ee,visibleNodeCount:A.length,totalNodeCount:t.nodes.length,onExpandAll:B,onCollapseAll:H}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx(Pe,{tree:V,expandedIds:n,selectedNodeId:(m==null?void 0:m.id)??null,onToggleExpand:P,onSelectNode:K}),e.jsx("div",{className:"flex-1 relative",children:t.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(ue,{nodes:d,edges:b,onNodesChange:g,onEdgesChange:o,onNodeClick:Y,onConnect:q,nodeTypes:Ae,edgeTypes:Me,nodesDraggable:!1,nodesConnectable:!0,fitView:!0,minZoom:.1,maxZoom:2,proOptions:Fe,children:[e.jsx(me,{gap:16,size:1}),e.jsx(pe,{showInteractive:!1})]})}),m&&e.jsx(Ce,{node:m,edges:t.edges,allNodes:t.nodes,childrenMap:y,onClose:()=>i(null),onNodeNavigate:Z})]}),e.jsx(De,{nodes:A,allNodes:t.nodes,onNodeClick:U}),k&&e.jsx(Re,{fromId:k.fromId,toId:k.toId,fromTitle:se,toTitle:te,onCreated:J,onCancel:()=>T(null)})]})}function ze(){return e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4",children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 rounded-full bg-accent/20 animate-ping"}),e.jsx(W,{className:"w-8 h-8 text-accent animate-spin relative"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Loading graph..."}),e.jsx("p",{className:"text-[10px] text-muted mt-1",children:"Computing layout and rendering nodes"})]})]})}function Oe({message:t,onRetry:d}){return e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4",children:[e.jsx(Te,{className:"w-10 h-10 text-red-400"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Failed to load graph"}),e.jsx("p",{className:"text-xs text-muted mt-1 max-w-md",children:t})]}),d&&e.jsxs("button",{onClick:d,className:"flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-md border border-edge text-muted hover:text-foreground hover:border-accent/50 transition-colors cursor-pointer",children:[e.jsx(W,{className:"w-3.5 h-3.5"}),"Retry"]})]})}function We({onImportPrd:t}){return e.jsxs("div",{className:"h-full flex flex-col items-center justify-center gap-4",children:[e.jsx(Le,{className:"w-12 h-12 text-muted/30"}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No nodes in the graph"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:"Import a PRD or add nodes to get started"})]}),t&&e.jsxs("button",{onClick:t,className:"flex items-center gap-1.5 px-4 py-2 text-xs font-medium rounded-md bg-accent text-white hover:opacity-90 transition-opacity cursor-pointer",children:[e.jsx(ce,{className:"w-3.5 h-3.5"}),"Import PRD"]})]})}function Je({graph:t,loading:d,error:f,onRetry:g,onImportPrd:b}){return d&&!t?e.jsx(ze,{}):f&&!t?e.jsx(Oe,{message:f,onRetry:g}):!t||t.nodes.length===0&&t.edges.length===0?e.jsx(We,{onImportPrd:b}):e.jsx("div",{className:"h-full",children:e.jsx(Ge,{graph:t})})}export{Je as GraphTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as b,j as t}from"./index-DUIBILM9.js";import{H as v,P as k,g as L,c as _,E as P}from"./style-D_2CfpkF.js";import{N as j,S as N,E as h}from"./constants-lq4BIQN3.js";import{d as C}from"./index-BpSI95md.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-CITYTuX5.js";import{H as v,P as k,g as L,c as _,E as P}from"./style-BOQDk6qp.js";import{N as j,S as N,E as h}from"./constants-lq4BIQN3.js";import{d as C}from"./index-Bny20bel.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-DUIBILM9.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-CITYTuX5.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};
|