jekyll-obsidian-site 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +133 -0
- data/website/_config.yml +21 -0
- data/website/_includes/website/archive-timeline.html +8 -0
- data/website/_includes/website/blog-ledger.html +19 -0
- data/website/_includes/website/blog-navigation.html +7 -0
- data/website/_includes/website/comments.html +22 -0
- data/website/_includes/website/contact-icon.html +14 -0
- data/website/_includes/website/context-tags.html +7 -0
- data/website/_includes/website/context.html +3 -0
- data/website/_includes/website/dialogs.html +71 -0
- data/website/_includes/website/docs-navigation.html +7 -0
- data/website/_includes/website/docs-tree.html +8 -0
- data/website/_includes/website/footer.html +14 -0
- data/website/_includes/website/github-icon.html +3 -0
- data/website/_includes/website/head.html +41 -0
- data/website/_includes/website/header.html +35 -0
- data/website/_includes/website/language-switcher.html +16 -0
- data/website/_includes/website/local-graph.html +25 -0
- data/website/_includes/website/note-header.html +35 -0
- data/website/_includes/website/outline.html +9 -0
- data/website/_includes/website/page-actions.html +34 -0
- data/website/_includes/website/portfolio-grid.html +36 -0
- data/website/_includes/website/portfolio-topics.html +4 -0
- data/website/_includes/website/post-cards.html +16 -0
- data/website/_includes/website/related-articles.html +7 -0
- data/website/_includes/website/relations.html +16 -0
- data/website/_includes/website/source-actions.html +28 -0
- data/website/_includes/website/system-page.html +31 -0
- data/website/_includes/website/tab-collection.html +28 -0
- data/website/_includes/website/tag-filter.html +12 -0
- data/website/_layouts/website-docs.html +20 -0
- data/website/_layouts/website-minimal.html +93 -0
- data/website/_layouts/website-redirect.html +17 -0
- data/website/assets/chunks/abnfDiagram-N423BO3Z-TSORAEI2.js +1 -0
- data/website/assets/chunks/architecture-TIHT7OUA-OUC5PEC7.js +1 -0
- data/website/assets/chunks/architectureDiagram-T3A2C74G-6P5MB2DJ.js +36 -0
- data/website/assets/chunks/blockDiagram-VBNYF7ZC-ZWINYROZ.js +132 -0
- data/website/assets/chunks/c4Diagram-5PPSVZJV-R5RMEAOT.js +10 -0
- data/website/assets/chunks/chunk-22DRK7VS.js +1 -0
- data/website/assets/chunks/chunk-25REBZ7M.js +2 -0
- data/website/assets/chunks/chunk-2RQCUDTG.js +1 -0
- data/website/assets/chunks/chunk-34FHPXU4.js +1 -0
- data/website/assets/chunks/chunk-57XXJOQN.js +10 -0
- data/website/assets/chunks/chunk-6DCNDVBX.js +2 -0
- data/website/assets/chunks/chunk-6DHFEWGX.js +1 -0
- data/website/assets/chunks/chunk-6VQ47JJS.js +2 -0
- data/website/assets/chunks/chunk-7CSIRG7W.js +127 -0
- data/website/assets/chunks/chunk-A43YELH5.js +1 -0
- data/website/assets/chunks/chunk-AIX6IH4O.js +1 -0
- data/website/assets/chunks/chunk-B3K7RH5O.js +88 -0
- data/website/assets/chunks/chunk-CBGUD2NP.js +1 -0
- data/website/assets/chunks/chunk-D3WOCELE.js +1 -0
- data/website/assets/chunks/chunk-D6FURU6X.js +1 -0
- data/website/assets/chunks/chunk-DGEGT77F.js +1 -0
- data/website/assets/chunks/chunk-DN52R6U7.js +1 -0
- data/website/assets/chunks/chunk-E3T3IFAC.js +1 -0
- data/website/assets/chunks/chunk-EIBFAW37.js +1 -0
- data/website/assets/chunks/chunk-ERWOH47R.js +1 -0
- data/website/assets/chunks/chunk-ETOVTYWF.js +1 -0
- data/website/assets/chunks/chunk-GHD3PFWA.js +231 -0
- data/website/assets/chunks/chunk-GMBKQ7NZ.js +1 -0
- data/website/assets/chunks/chunk-GQM25EPP.js +156 -0
- data/website/assets/chunks/chunk-GSOU4UTT.js +1 -0
- data/website/assets/chunks/chunk-HEMELP7J.js +1 -0
- data/website/assets/chunks/chunk-HZ5I5NJO.js +1 -0
- data/website/assets/chunks/chunk-IP56FOSI.js +70 -0
- data/website/assets/chunks/chunk-L7BMR7WL.js +1 -0
- data/website/assets/chunks/chunk-LGUG3SQB.js +1 -0
- data/website/assets/chunks/chunk-LOMHZYS2.js +1 -0
- data/website/assets/chunks/chunk-MII4VZEB.js +3 -0
- data/website/assets/chunks/chunk-MYMJLHQL.js +62 -0
- data/website/assets/chunks/chunk-NBH7YOBD.js +15 -0
- data/website/assets/chunks/chunk-NCOVM3YF.js +1 -0
- data/website/assets/chunks/chunk-OAGTSILX.js +1 -0
- data/website/assets/chunks/chunk-OCX5OCIU.js +321 -0
- data/website/assets/chunks/chunk-OE3NOVIH.js +1 -0
- data/website/assets/chunks/chunk-PLP5XUTJ.js +1 -0
- data/website/assets/chunks/chunk-PNOERP6G.js +1 -0
- data/website/assets/chunks/chunk-QBPQ7DPE.js +1 -0
- data/website/assets/chunks/chunk-RWFFDL53.js +1 -0
- data/website/assets/chunks/chunk-SEGIW3MP.js +1 -0
- data/website/assets/chunks/chunk-SZDMZNUS.js +1 -0
- data/website/assets/chunks/chunk-T2QBAPVT.js +1 -0
- data/website/assets/chunks/chunk-UE533OZ7.js +1 -0
- data/website/assets/chunks/chunk-UTWOJE2A.js +1 -0
- data/website/assets/chunks/chunk-VOCDYA3H.js +1 -0
- data/website/assets/chunks/chunk-VYZZPKGK.js +161 -0
- data/website/assets/chunks/chunk-WWLZIRS6.js +1 -0
- data/website/assets/chunks/chunk-XNXYDBKX.js +32 -0
- data/website/assets/chunks/chunk-XQUIO562.js +1 -0
- data/website/assets/chunks/chunk-Y2XVFW7T.js +2 -0
- data/website/assets/chunks/chunk-YORIST7Z.js +1 -0
- data/website/assets/chunks/chunk-Z2WBQPVY.js +206 -0
- data/website/assets/chunks/classDiagram-JCYQIIEL-OFDVDDIM.js +1 -0
- data/website/assets/chunks/classDiagram-v2-OCEON4UE-E36B6BGQ.js +1 -0
- data/website/assets/chunks/cose-bilkent-JH36ORCC-CBAW64AB.js +1 -0
- data/website/assets/chunks/cynefin-VYW2F7L2-CBO6DLNV.js +1 -0
- data/website/assets/chunks/cynefinDiagram-MW4NZA55-DFINLOUY.js +62 -0
- data/website/assets/chunks/dagre-VZM6K2ZE-BZFBSZAH.js +4 -0
- data/website/assets/chunks/diagram-7IWD3JNH-XQHTVOU2.js +30 -0
- data/website/assets/chunks/diagram-B4RE2ZJO-FTSXBZJR.js +3 -0
- data/website/assets/chunks/diagram-LBJQPF4R-ZSZW4OLH.js +24 -0
- data/website/assets/chunks/diagram-Q27KOJAE-2IV5TVCJ.js +24 -0
- data/website/assets/chunks/diagram-UB23O5K3-D6PDUTFL.js +41 -0
- data/website/assets/chunks/ebnfDiagram-BXEA7PRR-C6MAER3M.js +1 -0
- data/website/assets/chunks/erDiagram-JOGREHBK-EDAD2H5M.js +85 -0
- data/website/assets/chunks/eventmodeling-45OFAUF4-4K577DMF.js +1 -0
- data/website/assets/chunks/flowDiagram-UKHOOZJN-545F4YX3.js +1 -0
- data/website/assets/chunks/ganttDiagram-PKOTCBZU-7A7EKMY3.js +292 -0
- data/website/assets/chunks/gitGraph-TEB2WS4Q-3WUB7WYQ.js +1 -0
- data/website/assets/chunks/gitGraphDiagram-DS77QQ5N-A5UWV5FF.js +106 -0
- data/website/assets/chunks/info-DKCQHKI2-EOOHI7XS.js +1 -0
- data/website/assets/chunks/infoDiagram-6WML65LV-CWIOOWJP.js +2 -0
- data/website/assets/chunks/ishikawaDiagram-WSZJBQD7-CEASQVDL.js +70 -0
- data/website/assets/chunks/journeyDiagram-NVQOT4AX-LYG3S2AW.js +139 -0
- data/website/assets/chunks/kanban-definition-27J2QSJJ-HCC6KAYI.js +89 -0
- data/website/assets/chunks/katex-F4MQ6FB3.js +257 -0
- data/website/assets/chunks/mindmap-definition-FAOFIHXS-JMGSM3RE.js +96 -0
- data/website/assets/chunks/packet-7NZHBO7P-W3SJA3MY.js +1 -0
- data/website/assets/chunks/pegDiagram-VL7TDLO6-4JO3Y3Z3.js +1 -0
- data/website/assets/chunks/pie-RZYD4A2V-YOIQBTY7.js +1 -0
- data/website/assets/chunks/pieDiagram-7S7Q4E2Y-VFQ7SE46.js +39 -0
- data/website/assets/chunks/quadrantDiagram-CIZ2JOQS-JISDI2S6.js +7 -0
- data/website/assets/chunks/radar-I7S5WNFK-NMKP5AZO.js +1 -0
- data/website/assets/chunks/railroad-3IZDKUUU-7MOIV7CI.js +1 -0
- data/website/assets/chunks/railroad-abnf-AHOZXSZD-HXNH5SLO.js +1 -0
- data/website/assets/chunks/railroad-ebnf-EBAXGLYW-OWDJEWMK.js +1 -0
- data/website/assets/chunks/railroad-peg-LSFZ7HO6-ASSINGP5.js +1 -0
- data/website/assets/chunks/railroadDiagram-AXF67PYL-AFV5VP5F.js +1 -0
- data/website/assets/chunks/requirementDiagram-LRYGKXZP-RNRPEHHN.js +84 -0
- data/website/assets/chunks/sankeyDiagram-W5VNT64P-O54R2L3E.js +40 -0
- data/website/assets/chunks/sequenceDiagram-SI44F4Z6-42WISKJ7.js +162 -0
- data/website/assets/chunks/sizeCapture-X5ZJPWSS-LRN2Q37T.js +1 -0
- data/website/assets/chunks/stateDiagram-OKZ733FA-BWIBJXIR.js +1 -0
- data/website/assets/chunks/stateDiagram-v2-UEYNNEHI-L73LHL3L.js +1 -0
- data/website/assets/chunks/swimlanes-SLNWSIFB-ECOAE7LQ.js +1 -0
- data/website/assets/chunks/swimlanesDiagram-ULZ7WXOC-3CKKKFZZ.js +8 -0
- data/website/assets/chunks/timeline-definition-Z64GVDOM-HR2OL5G7.js +120 -0
- data/website/assets/chunks/treeView-QDETBFTQ-C6D5WFJA.js +1 -0
- data/website/assets/chunks/treemap-6X3UGDF4-JFCDMSCA.js +1 -0
- data/website/assets/chunks/vennDiagram-T6HMQDX7-62WAAPTF.js +34 -0
- data/website/assets/chunks/wardley-OPB4EBWU-RQIOII7I.js +1 -0
- data/website/assets/chunks/wardleyDiagram-T6FBY63Y-KUXO3NHV.js +78 -0
- data/website/assets/chunks/xychartDiagram-ELKLHX3M-I54W4HJ7.js +7 -0
- data/website/assets/color-scheme-bootstrap-4H4ZR4BW.js +1 -0
- data/website/assets/docs-3WBBQT6K.css +1 -0
- data/website/assets/docs-W3D5DWQF.js +1 -0
- data/website/assets/docs-navigation-75ALFYBA.js +1 -0
- data/website/assets/graph-QWL54LWD.js +1 -0
- data/website/assets/manifest.json +314 -0
- data/website/assets/math-7JTH4OWZ.js +21 -0
- data/website/assets/mermaid-RXC6URG4.js +10 -0
- data/website/assets/minimal-3NPTDWQX.js +1 -0
- data/website/assets/minimal-E2VATXXS.css +1 -0
- data/website/assets/previews-FMHOX7UX.js +1 -0
- data/website/assets/search-BH73JZDU.js +1 -0
- data/website/assets/search-worker-SM4IM4J7.js +1 -0
- data/website/exe/jekyll-obsidian +5 -0
- data/website/lib/jekyll_obsidian/adapter.rb +733 -0
- data/website/lib/jekyll_obsidian/built_in_themes.rb +855 -0
- data/website/lib/jekyll_obsidian/cli.rb +84 -0
- data/website/lib/jekyll_obsidian/content_policy.rb +194 -0
- data/website/lib/jekyll_obsidian/destination_registry.rb +39 -0
- data/website/lib/jekyll_obsidian/directory_indexes.rb +30 -0
- data/website/lib/jekyll_obsidian/external_media.rb +371 -0
- data/website/lib/jekyll_obsidian/front_matter.rb +453 -0
- data/website/lib/jekyll_obsidian/github_markdown.rb +664 -0
- data/website/lib/jekyll_obsidian/html_publication.rb +206 -0
- data/website/lib/jekyll_obsidian/initializer.rb +68 -0
- data/website/lib/jekyll_obsidian/localized_compiler.rb +1044 -0
- data/website/lib/jekyll_obsidian/media_policy.rb +41 -0
- data/website/lib/jekyll_obsidian/ofm_scanner.rb +493 -0
- data/website/lib/jekyll_obsidian/output_text.rb +13 -0
- data/website/lib/jekyll_obsidian/preview.rb +93 -0
- data/website/lib/jekyll_obsidian/published_markdown.rb +32 -0
- data/website/lib/jekyll_obsidian/raw_html_manifest.rb +66 -0
- data/website/lib/jekyll_obsidian/runtime.rb +197 -0
- data/website/lib/jekyll_obsidian/site_compilation.rb +147 -0
- data/website/lib/jekyll_obsidian/site_navigation.rb +517 -0
- data/website/lib/jekyll_obsidian/url_builder.rb +163 -0
- data/website/lib/jekyll_obsidian/value_objects.rb +198 -0
- data/website/lib/jekyll_obsidian/vault_compiler.rb +2771 -0
- data/website/lib/jekyll_obsidian/version.rb +6 -0
- data/website/lib/jekyll_obsidian/workspace_layout.rb +104 -0
- data/website/lib/jekyll_obsidian.rb +22 -0
- data/website/scripts/audit-site.rb +120 -0
- data/website/scripts/templates/pages.yml +55 -0
- data/website/scripts/verify-site-urls.rb +585 -0
- metadata +319 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as zo}from"./chunk-T2QBAPVT.js";import{D as $o}from"./chunk-E3T3IFAC.js";import{a as Do,b as Pe,c as Ho,d as Xo,f as Yo,g as Go}from"./chunk-57XXJOQN.js";import{d as Bo,e as Po,g as Fo,i as ko,j as _o}from"./chunk-MYMJLHQL.js";import"./chunk-YORIST7Z.js";import"./chunk-QBPQ7DPE.js";import{b as Mn}from"./chunk-XQUIO562.js";import{a as Oo}from"./chunk-GSOU4UTT.js";import"./chunk-IP56FOSI.js";import"./chunk-CBGUD2NP.js";import{p as Te}from"./chunk-6DCNDVBX.js";import"./chunk-22DRK7VS.js";import{_ as No,u as Ro}from"./chunk-7CSIRG7W.js";import{b as Be}from"./chunk-ERWOH47R.js";import{a as f}from"./chunk-EIBFAW37.js";import"./chunk-LGUG3SQB.js";import"./chunk-6DHFEWGX.js";async function Jo(t,e){let n=new $o({multigraph:!0,compound:!0}),o=[...e.edges],s=No(),r=t.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),u=r.insert("g").attr("class","edges edgePath"),c=r.insert("g").attr("class","edgeLabels"),l=r.insert("g").attr("class","nodes"),h=new Map,y=t.node()!=null;await Promise.all(e.nodes.map(async I=>{if(I.isGroup)n.setNode(I.id,{...I});else{if(y){let p=await Fo(l,I,{config:s,dir:I.dir}),g=p.node()?.getBBox()??{width:0,height:0};h.set(I.id,p),I.width=g.width,I.height=g.height}n.setNode(I.id,{...I})}}));for(let I of o)n.setEdge(I.start,I.end,{...I},I.id),e.edges.some(g=>g.id===I.id)||e.edges.push(I);if(globalThis.mermaidCaptureSizes){let{captureNodeSizes:I}=await import("./sizeCapture-X5ZJPWSS-LRN2Q37T.js");I(t,e)}return{graph:n,groups:{clusters:i,edgePaths:u,edgeLabels:c,nodes:l,rootGroups:r},nodeElements:h}}f(Jo,"createGraphWithElements");var Vo=5,$e=1e-5,ze=1e-6;function qe(t){let e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}f(qe,"buildSegmentList");function Zo(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,u=o.y-n.y,c=s*u-r*i;if(c===0)return null;let l=n.x-t.x,h=n.y-t.y,y=(l*u-h*i)/c,I=(l*r-h*s)/c;return y<=ze||y>=1-ze||I<=ze||I>=1-ze?null:{point:{x:t.x+y*s,y:t.y+y*r},tA:y,tB:I}}f(Zo,"segmentIntersection");function Ln(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}f(Ln,"isHorizontalSeg");function Qo(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n],s=qe(o.points);for(let r=n+1;r<t.length;r++){let i=t[r],u=qe(i.points);for(let[c,l]of s.entries())for(let[h,y]of u.entries()){let I=Zo(l.a,l.b,y.a,y.b);if(!I)continue;let p=Ln(l),g=Ln(y);(p!==g?p:!1)?e.push({jumpEdgeId:o.id,otherEdgeId:i.id,segIndex:c,t:I.tA,point:I.point}):e.push({jumpEdgeId:i.id,otherEdgeId:o.id,segIndex:h,t:I.tB,point:I.point})}}}return e}f(Qo,"findEdgeIntersections");function re(t){let e=Math.round(t*1e3)/1e3;return Number.isInteger(e)?`${e}`:`${e}`}f(re,"fmt");function Ae(t){return`${re(t.x)},${re(t.y)}`}f(Ae,"pointToString");function ts(t){let e=t.b.x-t.a.x,n=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(n)?e>=0?1:0:n>=0?1:0}f(ts,"getArcSweepFlag");var Yr=.001;function es(t,e){if(t.length<2)return t.map(r=>({...r}));let n=t.map(r=>({...r})),o=e.arrowTypeStart&&Mn[e.arrowTypeStart];if(o){let r=t[0],i=t[1],u=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(u),n[0].y=r.y+o*Math.sin(u)}let s=e.arrowTypeEnd&&Mn[e.arrowTypeEnd];if(s){let r=t.length,i=t[r-2],u=t[r-1],c=Math.atan2(u.y-i.y,u.x-i.x);n[r-1].x=u.x-s*Math.cos(c),n[r-1].y=u.y-s*Math.sin(c)}return n}f(es,"applyMarkerOffsets");function ns(t,e,n,o,s){let r=t.point.x,i=t.point.y,u={x:r-e*t.r,y:i-n*t.r},c={x:r+e*t.r,y:i+n*t.r},l=[`L${Ae(u)}`];return s==="arc"?l.push(`A${re(t.r)},${re(t.r)} 0 0 ${o} ${Ae(c)}`):l.push(`M${Ae(c)}`),l}f(ns,"emitJump");function En(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,u=n.y-e.y,c=Math.hypot(s,r),l=Math.hypot(i,u);if(c<$e||l<$e)return null;let h=s/c,y=r/c,I=i/l,p=u/l,g=h*I+y*p,a=Math.max(-1,Math.min(1,g)),m=Math.acos(a);if(m<$e||Math.abs(Math.PI-m)<$e)return null;let v=Math.min(o/Math.sin(m/2),c/2,l/2);return{startX:e.x-h*v,startY:e.y-y*v,endX:e.x+I*v,endY:e.y+p*v,ctrlX:e.x,ctrlY:e.y,cutLen:v}}f(En,"computeRoundedCorner");function os(t,e,n){let o=t.points;if(o.length<2)return"";let s=es(o,t),r=t.curve==="rounded",i=qe(s),u=new Map;for(let l of e){let h=i[l.segIndex];if(!h)continue;let y=Math.hypot(h.b.x-h.a.x,h.b.y-h.a.y),I=u.get(l.segIndex)??[];I.push({t:l.t,point:l.point,d:l.t*y,r:n.jumpRadius}),u.set(l.segIndex,I)}let c=[`M${Ae(s[0])}`];for(let l=0;l<i.length;l++){let h=i[l],y=Math.hypot(h.b.x-h.a.x,h.b.y-h.a.y),I=y===0?0:(h.b.x-h.a.x)/y,p=y===0?0:(h.b.y-h.a.y)/y,g=ts(h),a=0;if(r&&l>0){let L=En(s[l-1],s[l],s[l+1]??s[l],Vo);L&&(a=L.cutLen)}let m=y,v=null;r&&l<i.length-1&&(v=En(s[l],s[l+1],s[l+2]??s[l+1],Vo),v&&(m=y-v.cutLen));let M=[...u.get(l)??[]].sort((L,R)=>L.t-R.t);for(let L of M)L.r=Math.min(L.r,L.d-a,m-L.d);for(let L=0;L<M.length-1;L++){let R=M[L+1].d-M[L].d;if(M[L].r+M[L+1].r>R){let S=R/2;M[L].r=Math.min(M[L].r,S),M[L+1].r=Math.min(M[L+1].r,S)}}for(let L of M)L.r<Yr||c.push(...ns(L,I,p,g,n.jumpStyle));r&&v?(c.push(`L${re(v.startX)},${re(v.startY)}`),c.push(`Q${re(v.ctrlX)},${re(v.ctrlY)} ${re(v.endX)},${re(v.endY)}`)):c.push(`L${Ae(h.b)}`)}return c.join(" ")}f(os,"rewriteEdgePath");function ss(t){return/^[\d\s+,.LMelm-]*$/.test(t)}f(ss,"isStraightPath");function rs(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}f(rs,"curveSupportsLineHops");function is(t){if(!t)return null;try{let e=typeof atob=="function"?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;let o=[];for(let s of n)s&&typeof s.x=="number"&&typeof s.y=="number"&&o.push({x:s.x,y:s.y});return o.length>=2?o:null}catch{return null}}f(is,"decodeDataPoints");function cs(t,e,n){if(!n.enabled)return;let o=t.node();if(!o)return;let s=new Map;for(let l of e)s.set(l.id,l);let r=[],i=new Map;for(let l of e){let h=typeof CSS<"u"&&CSS.escape?CSS.escape(l.id):l.id,y=o.querySelector(`path[data-id="${h}"]`);if(!y)continue;i.set(l.id,y);let p=is(y.getAttribute("data-points"))??l.points;r.push({...l,points:p})}let u=Qo(r);if(u.length===0)return;let c=new Map;for(let l of u){let h=c.get(l.jumpEdgeId)??[];h.push(l),c.set(l.jumpEdgeId,h)}for(let l of r){let h=c.get(l.id);if(!h||h.length===0)continue;let I=s.get(l.id)?.curve;if(I!==void 0&&!rs(I))continue;let p=i.get(l.id);if(!p)continue;if(I===void 0){let L=p.getAttribute("d")??"";if(!ss(L))continue}let g=p.getAttribute("style")??"",a=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(g),m=a?Number.parseFloat(a[1]):null,v=a?Number.parseFloat(a[2]):null,M=os(l,h,n);if(p.setAttribute("d",M),m!==null&&v!==null&&typeof p.getTotalLength=="function"){let L=p.getTotalLength(),R=Math.max(0,L-m-v),S=`0 ${m} ${R} ${v}`,b=g.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${S};`).replace(/;\s*;+/g,";");p.setAttribute("style",b)}}}f(cs,"applyLineJumpsToSvg");async function as(t,e){for(let s of t.nodes)s.isGroup?await Bo(e.clusters,s):_o(s);let n=new Map;for(let s of t.nodes)s?.id&&n.set(s.id,s);for(let s of t.edges){let r=s.start?n.get(s.start)??{}:{},i=s.end?n.get(s.end)??{}:{},u=Yo(e.edgePaths,{...s},{},t.type,r,i,t.diagramId);s.label&&await Xo(e.rootGroups,s),s.label&&ls(s,u)}let o=t.config?.swimlane?.lineHops;if(o!==!1){let s=o==="gap"?"gap":"arc",r=t.edges.filter(i=>Array.isArray(i.points)&&i.points.length>=2).map(i=>({id:i.id,points:i.points,curve:i.curve,arrowTypeStart:i.arrowTypeStart,arrowTypeEnd:i.arrowTypeEnd}));cs(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:s})}}f(as,"adjustLayout");function ls(t,e){let n=e?.updatedPath??e?.originalPath,o=Ro(),{subGraphTitleTotalMargin:s}=Oo({flowchart:o.flowchart??{}});if(t.label){let r=Do.get(t.id),i=t.x,u=t.y;if(n){let c=Te.calcLabelPosition(n);Be.debug("Moving label "+t.label+" from (",i,",",u,") to (",c.x,",",c.y,") abc88"),e&&(i=c.x,u=c.y)}r.attr("transform",`translate(${i}, ${u+s/2})`)}if(t?.startLabelLeft){let r=Pe.get(t.id).startLeft,i=t?.x,u=t?.y;if(n){let c=Te.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);i=c.x,u=c.y}r.attr("transform",`translate(${i}, ${u})`)}if(t.startLabelRight){let r=Pe.get(t.id).startRight,i=t.x,u=t.y;if(n){let c=Te.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);i=c.x,u=c.y}r.attr("transform",`translate(${i}, ${u})`)}if(t.endLabelLeft){let r=Pe.get(t.id).endLeft,i=t.x,u=t.y;if(n){let c=Te.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);i=c.x,u=c.y}r.attr("transform",`translate(${i}, ${u})`)}if(t.endLabelRight){let r=Pe.get(t.id).endRight,i=t.x,u=t.y;if(n){let c=Te.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);i=c.x,u=c.y}r.attr("transform",`translate(${i}, ${u})`)}}f(ls,"positionEdgeLabel");var In="__swimlane_default__",Gr=21,jo=20;function Tn(t){return Math.max(t.padding??jo,jo)}f(Tn,"topLaneHorizontalPadding");function fs(t){let{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}let i=n-s/2,u=Math.min(r,n+s/2),c=Math.min(Gr,Math.max(0,u-i)),l=i+c;if(l<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:l}}f(fs,"assignTopLaneTitleRect");function ds(t){let e=t.direction,n=t.nodes??=[];for(let r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));let o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===In);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:In,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(let r of o)r.parentId=In}f(ds,"prepareLayoutForSwimlanes");function us(t){let e=new Map;for(let c of t.nodes??[])e.set(c.id,c);let n=[];for(let c of t.edges??[]){let l=typeof c.start=="string"?c.start:void 0,h=typeof c.end=="string"?c.end:void 0;!l||!h||c.labelNodeId||n.push({id:c.id,src:l,dst:h,ref:c})}let o=t.nodes??[],s=o.filter(c=>c.isGroup),r=o.filter(c=>!c.isGroup);return{nodes:[...[...s].reverse(),...r].map(c=>c.id),edges:n,layout:t,nodeById:e}}f(us,"toGraphView");function hs(t,e,n,o){let{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,u=o?.nodeGap??40,c=0;for(let I of e.layers){let p=0;for(let g of I){let a=r.get(g);if(!a){p++;continue}a.layer=c,a.order=p;let m=n.x[g]??p*u,v=n.y[g]??c*i;a.x=m,a.y=v,p++}c++}let l=s.nodes??[],h=new Map,y=[];for(let I of l){if(!I?.isGroup)continue;I.parentId||y.push(I);let p=l.filter(M=>M.parentId===I.id),g=1/0,a=-1/0,m=1/0,v=-1/0;for(let M of p){let L=M.x??n.x[M.id],R=M.y??n.y[M.id],S=M.width??0,b=M.height??0;L!=null&&R!=null&&(g=Math.min(g,L-S/2),a=Math.max(a,L+S/2),m=Math.min(m,R-b/2),v=Math.max(v,R+b/2))}if(g===1/0||m===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{let M=I.padding??20,L=I.parentId?M:2*Tn(I),R=M,S=Math.max(0,a-g)+L,b=Math.max(0,v-m)+R,T=(g+a)/2,N=(m+v)/2;I.x=T,I.y=N,I.width=S,I.height=b,h.set(I.id,{minX:g,maxX:a,minY:m,maxY:v})}}if(y.length>0&&h.size>0){let I=1/0,p=-1/0,g=0;for(let a of y){let m=a.padding??20;m>g&&(g=m);let v=h.get(a.id);v&&(I=Math.min(I,v.minY),p=Math.max(p,v.maxY))}if(I!==1/0&&p!==-1/0){let a=Math.max(0,p-I),v=Math.max(g,36),M=a+2*v,L=(I+p)/2;for(let P of y)P.y=L,P.height=M,P.swimlaneContentTop=I;let R=[...y].sort((P,A)=>{let _=P.x??0,k=A.x??0;return _-k}),S=[],b=[],T=[];for(let P of R){let A=h.get(P.id);if(!A)continue;let _=Math.max(0,A.maxX-A.minX)+2*Tn(P),k=(A.minX+A.maxX)/2;S.push(P.id),b.push(k),T.push(_)}let N=S.length;if(N>0){let P=new Map;if(N===1)P.set(S[0],T[0]);else{let A=[];for(let $=0;$<N-1;$++)A.push(b[$+1]-b[$]);let _=new Array(N);_[0]=0;for(let $=0;$<N-1;$++)_[$+1]=2*A[$]-_[$];let k=0,B=Number.POSITIVE_INFINITY;for(let $=0;$<N;$++){let K=T[$];$%2===0?k=Math.max(k,K-_[$]):B=Math.min(B,_[$]-K)}let X=k;k<=B?X=(k+B)/2:X=k;for(let $=0;$<N;$++){let K=_[$]+($%2===0?X:-X),ct=Math.max(T[$],K);P.set(S[$],ct)}}for(let A of y){let _=P.get(A.id);_!=null&&(A.width=_),fs(A)}}}}}f(hs,"writeBackToLayoutData");var $r="[EdgeLabelNodes]";function gs(t){let e=[],n=[],o=new Map;for(let i of t.nodes)o.set(i.id,i);for(let i of t.edges){if(!i.label||i.label.length===0||i.isLayoutOnly||i.labelNodeId)continue;let u=i.start?o.get(i.start):void 0,c=i.end?o.get(i.end):void 0;if(!u||!c){Be.warn($r,`Edge ${i.id} has missing source or target node`);continue}let l=`edge-label-${i.start}-${i.end}-${i.id}`,y=u.parentId!==c.parentId?c.parentId:u.parentId,I={id:l,label:i.label,edgeStart:i.start??"",edgeEnd:i.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:y,isGroup:!1,labelStyle:Array.isArray(i.labelStyle)?i.labelStyle[0]:i.labelStyle??"",...u.dir?{dir:u.dir}:{}};e.push(I),i.labelNodeId=l,i.label=void 0,i.text=void 0;let p={id:`${i.id}-to-label`,start:i.start,end:l,type:"normal",isLayoutOnly:!0},g={id:`${i.id}-from-label`,start:l,end:i.end,type:"normal",isLayoutOnly:!0};n.push(p,g)}let s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}f(gs,"createEdgeLabelNodes");var _t=.001;function so(t){let e=t.x??0,n=t.y??0,o=t.width??0,s=t.height??0;return o>0&&s>0?{cx:e,cy:n,rect:Re(e,n,o,s)}:void 0}f(so,"measuredNodeRect");function ro(t){if(t.isGroup)return;let e=so(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}f(ro,"nodeBoundsInfoFor");function oe(t,e,n=_t){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}f(oe,"samePoint");function dt(t,e,n=_t){return Math.abs(t.x-e.x)<n}f(dt,"sameX");function ht(t,e,n=_t){return Math.abs(t.y-e.y)<n}f(ht,"sameY");function Tt(t,e,n=_t){return ht(t,e,n)&&Math.abs(t.x-e.x)>n}f(Tt,"isHorizontalSegment");function wt(t,e,n=_t){return dt(t,e,n)&&Math.abs(t.y-e.y)>n}f(wt,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}f(zt,"overlapLength");function ce(t,e,n=_t){return t.horizontal&&e.horizontal&&ht(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&dt(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}f(ce,"sameAxisSegmentOverlapLength");function Ne(t,e=_t){let n=[];for(let o=0;o<t.length-1;o++){let s=t[o],r=t[o+1],i=Tt(s,r,e),u=wt(s,r,e);(i||u)&&n.push({index:o,a:s,b:r,horizontal:i,vertical:u})}return n}f(Ne,"orthogonalSegmentsForPoints");function Qt(t,e=_t){let n=Ne(t,e),o=0;for(let s=1;s<n.length;s++)n[s-1].horizontal!==n[s].horizontal&&o++;return o}f(Qt,"countOrthogonalBends");function pt(t,e=_t){let n=[];for(let o of t){let s=n.length>0?n[n.length-1]:void 0;(!s||!oe(s,o,e))&&n.push({x:o.x,y:o.y})}return n}f(pt,"dedupeConsecutivePoints");function io(t,e=_t){if(!t||t.length!==4)return;let[n,o,s,r]=t;return Tt(n,o,e)&&wt(o,s,e)&&Tt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:wt(n,o,e)&&Tt(o,s,e)&&wt(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}f(io,"classifyThreeSegmentRoute");function cn(t,e,n,o=0){let s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),u=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&u>n.top-o&&i<n.bottom+o}f(cn,"segmentBoundsOverlapRect");function co(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}f(co,"pointInsideRect");function ps(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}f(ps,"rectContainsRect");function Je(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}f(Je,"rectsOverlap");function wn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}f(wn,"inflateRect");function Re(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}f(Re,"rectFromCenterSize");function qt(t){return so(t)?.rect}f(qt,"rectOfNodeBounds");function Ie(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}f(Ie,"portForRectSide");function ao(t,e,n,o,s,r=_t){let i=e==="left"||e==="right",u=o==="left"||o==="right";if(i&&u){if(e==="right"&&o==="left"&&t.x<n.x||e==="left"&&o==="right"&&t.x>n.x){if(ht(t,n,r))return[t,n];let y=(t.x+n.x)/2;return[t,{x:y,y:t.y},{x:y,y:n.y},n]}if(e===o){if(ht(t,n,r))return;let y=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x:y,y:t.y},{x:y,y:n.y},n]}return}if(!i&&!u){if(e===o){if(dt(t,n,r))return;let I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.y<n.y||e==="top"&&o==="bottom"&&t.y>n.y))return;if(dt(t,n,r))return[t,n];let y=(t.y+n.y)/2;return[t,{x:t.x,y},{x:n.x,y},n]}if(i&&!u){let h=e==="right"&&n.x>t.x||e==="left"&&n.x<t.x,y=o==="top"&&t.y<n.y||o==="bottom"&&t.y>n.y;return h&&y?[t,{x:n.x,y:t.y},n]:void 0}let c=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,l=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return c&&l?[t,{x:t.x,y:n.y},n]:void 0}f(ao,"buildOrthogonalPortPath");function lo(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}f(lo,"buildSameSideTrackPath");function an(t){let e=new Map,n=[];for(let o of t){if(o.isEdgeLabel)continue;let s=ro(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}f(an,"collectRealNodeBounds");function me(t){let e=[],n=[];for(let o of t){let s=ro(o);if(!s)continue;let r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}f(me,"collectNodeRectEntries");function ms(t,{includeEdgeLabels:e=!0}={}){let n=[];for(let o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;let s=o.x??0,r=o.y??0,i=o.width??0,u=o.height??0;n.push({nodeId:o.id,...Re(s,r,i,u)})}return n}f(ms,"collectLayoutNodeRects");function fo(t,e,n=_t){let o=t.start,s=t.end;if(!o||!s)return;let r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)<n,collinearY:Math.abs(r.cy-i.cy)<n}}f(fo,"getNodePairGeometry");function At(t,e,n,o=[],s=0){for(let r of n)if(!o.includes(r.id)&&cn(t,e,r.rect,-s))return!0;return!1}f(At,"segmentHitsAnyRect");function uo(t,e,n,o,s=_t,r=1e-6){let i=ht(t,e,s),u=dt(t,e,s),c=ht(n,o,s),l=dt(n,o,s);if(i&&c||u&&l||!(i||u)||!(c||l))return!1;let h=i?{a:t,b:e}:{a:n,b:o},y=u?{a:t,b:e}:{a:n,b:o},I=h.a.y,p=Math.min(h.a.x,h.b.x),g=Math.max(h.a.x,h.b.x),a=y.a.x,m=Math.min(y.a.y,y.b.y),v=Math.max(y.a.y,y.b.y);if(a<p||a>g||I<m||I>v)return!1;let M=Math.abs(a-h.a.x)<r&&Math.abs(I-h.a.y)<r||Math.abs(a-h.b.x)<r&&Math.abs(I-h.b.y)<r,L=Math.abs(a-y.a.x)<r&&Math.abs(I-y.a.y)<r||Math.abs(a-y.b.x)<r&&Math.abs(I-y.b.y)<r;return!(M&&L)}f(uo,"orthogonalSegmentsCross");function ys(t,e,n,o,s=_t){let r=ht(t,e,s),i=dt(t,e,s),u=ht(n,o,s),c=dt(n,o,s);return i&&c&&dt(t,n,s)?zt(t.y,e.y,n.y,o.y)>s:r&&u&&ht(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}f(ys,"sameAxisSegmentsOverlap");function Ze(t,e,n,o,{epsilon:s=_t,skipDegenerateOther:r=!1}={}){for(let i of n){if(i===o||i.isLayoutOnly)continue;let u=i.points;if(!(!u||u.length<2))for(let c=0;c<u.length-1;c++){let l=u[c],h=u[c+1];if(!(r&&oe(l,h,s))&&(uo(t,e,l,h,s)||ys(t,e,l,h,s)))return!0}}return!1}f(Ze,"segmentConflictsWithAnyEdge");function le(t,e,n,o,s=_t){let r=ht(t,e,s),i=dt(t,e,s),u=ht(n,o,s),c=dt(n,o,s);if(!(r&&c||i&&u))return!1;let l=r?{a:t,b:e}:{a:n,b:o},h=r?{a:n,b:o}:{a:t,b:e},y=l.a.y,I=Math.min(l.a.x,l.b.x),p=Math.max(l.a.x,l.b.x),g=h.a.x,a=Math.min(h.a.y,h.b.y),m=Math.max(h.a.y,h.b.y);return g>I+s&&g<p-s&&y>a+s&&y<m-s}f(le,"orthogonalSegmentsStrictlyCross");function An(t,e,n){let o=Math.min(e,n),s=Math.max(e,n);return t>o+_t&&t<s-_t}f(An,"strictlyBetween");function xs(t,e,n){return dt(t,e)&&dt(e,n)?An(e.y,t.y,n.y):ht(t,e)&&ht(e,n)?An(e.x,t.x,n.x):!1}f(xs,"isCollinearIntermediate");function bs(t){let e=!1,n=[];for(let o=0;o<t.length;o++){let s=n[n.length-1],r=t[o],i=o+1<t.length?t[o+1]:void 0;if(s&&i){if(oe(s,i)){o++,e=!0;continue}if(xs(s,r,i)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}f(bs,"simplifyPolylineOnce");function Qe(t){let e=[t[0]];for(let o=1;o<t.length;o++){let s=e[e.length-1],r=t[o];if(!dt(s,r)&&!ht(s,r)){let i=e.length>=2?e[e.length-2]:void 0,c=(i?dt(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(c)}e.push(r)}let n=[];for(let o of e){let s=n[n.length-1];(!s||!oe(s,o))&&n.push(o)}return n}f(Qe,"orthogonalizePolyline");function ae(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){let o=bs(e);if(e=o.points,!o.changed)break}return e}f(ae,"simplifyPolyline");var nt=.001,zr=.5,Uo=4;function ho(t,e,n){let o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;let s=o.start?e.get(o.start):void 0,r=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:s?qt(s):void 0,dstRect:r?qt(r):void 0}}f(ho,"endpointContextFor");function Ms(t,e,n){if(ht(t,e,nt))return{x:t.x<n.left?n.left:n.right,y:t.y};if(dt(t,e,nt)){let o=t.y<n.top?n.top:n.bottom;return{x:t.x,y:o}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}f(Ms,"segmentEnterPoint");function Rn(t,e,n){let o=n?1:-1,s=n?0:t.length-1;for(;s>=0&&s<t.length&&co(t[s],e,zr);)s+=o;if(s<0||s>=t.length)return t;let r=s-o;if(r<0||r>=t.length)return t;let i=Ms(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}f(Rn,"clipEndpoint");function Is(t,e){for(let n of t){let o=ho(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=Rn(s,o.srcRect,!0)),o.dstRect&&(s=Rn(s,o.dstRect,!1)),s=ae(Qe(s)),s=go(s,o.srcRect,o.dstRect),o.edge.points=ae(Qe(s))}}f(Is,"clipEdgeEndpointsToNodeBoundaries");function Nn(t,e,n,o=!1){if(ht(t,e,nt)){if(e.y<n.top-nt||e.y>n.bottom+nt)return e;if(o){if(t.x<n.left-nt)return{x:n.left,y:t.y};if(t.x>n.right+nt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(dt(t,e,nt)){if(e.x<n.left-nt||e.x>n.right+nt)return e;if(o){if(t.y<n.top-nt)return{x:t.x,y:n.top};if(t.y>n.bottom+nt)return{x:t.x,y:n.bottom}}let s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}f(Nn,"snapEndpointToBoundary");function tn(t,e,n){let o=t[e];for(let s=e+n;s>=0&&s<t.length;s+=n){let r=t[s];if(!oe(r,o,nt))return r}return t[e+n]}f(tn,"firstDistinctAdjacent");function en(t,e){let n=t+Uo,o=e-Uo;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}f(en,"cornerClearanceRange");function On(t,e,n){let{lo:o,hi:s}=en(e,n);return Math.min(s,Math.max(o,t))}f(On,"clampToCornerClearance");function Ss(t){let e=Math.max(...t.map(o=>o.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}f(Ss,"intersectRanges");function Bn(t,e){return e==="left"||e==="right"?en(t.top,t.bottom):en(t.left,t.right)}f(Bn,"clearanceRangeForSide");function nn(t,e,n){let o=t.y>=n.top-nt&&t.y<=n.bottom+nt,s=t.x>=n.left-nt&&t.x<=n.right+nt;if(ht(t,e,nt)&&o){if(Math.abs(t.x-n.left)<nt)return"left";if(Math.abs(t.x-n.right)<nt)return"right"}if(dt(t,e,nt)&&s){if(Math.abs(t.y-n.top)<nt)return"top";if(Math.abs(t.y-n.bottom)<nt)return"bottom"}}f(nn,"terminalSideForSegment");function Fe(t){return t==="left"||t==="right"}f(Fe,"isHorizontalSide");function Cs(t,e,n,o,s){let r=[],i=n?nn(t,e,n):void 0,u=o?nn(e,t,o):void 0;return n&&i&&Fe(i)===s&&r.push(Bn(n,i)),o&&u&&Fe(u)===s&&r.push(Bn(o,u)),r.length>0?Ss(r):void 0}f(Cs,"straightClearanceRange");function Pn(t,e,n,o,s){let r=Cs(t,e,n,o,s);if(!r)return;let i=s?t.y:t.x,u=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(u-i)<nt))return s?[{x:t.x,y:u},{x:e.x,y:u}]:[{x:u,y:t.y},{x:u,y:e.y}]}f(Pn,"clearStraightEndpointCornerAxis");function go(t,e,n){if(t.length!==2)return t;let[o,s]=t;return ht(o,s,nt)?Pn(o,s,e,n,!0)??t:dt(o,s,nt)?Pn(o,s,e,n,!1)??t:t}f(go,"clearStraightEndpointCornerConnections");function vs(t,e,n){return Fe(n)?{x:t.x,y:On(t.y,e.top,e.bottom)}:{x:On(t.x,e.left,e.right),y:t.y}}f(vs,"cornerClearedEndpoint");function Ls(t,e,n,o,s,r){let i=t.map(u=>({...u}));for(let u=e;u>=0&&u<t.length;u+=n){let c=t[u];if(r&&!ht(c,o,nt)||!r&&!dt(c,o,nt))break;r?i[u].y=s.y:i[u].x=s.x}return i}f(Ls,"moveCollinearEndpointRun");function Fn(t,e,n){if(t.length<2)return t;let o=n?0:t.length-1,s=n?1:-1,r=t[o],i=tn(t,o,s);if(!i)return t;let u=nn(r,i,e);if(!u)return t;let c=Fe(u),l=vs(r,e,u);return oe(r,l,nt)?t:Ls(t,o,s,r,l,c)}f(Fn,"clearEndpointCornerConnection");function kn(t,e,n){let o=Math.min(t.x,e.x)>=n.left-nt&&Math.max(t.x,e.x)<=n.right+nt,s=Math.min(t.y,e.y)>=n.top-nt&&Math.max(t.y,e.y)<=n.bottom+nt;if(Math.abs(t.y-n.top)<nt&&Math.abs(e.y-n.top)<nt&&o)return"top";if(Math.abs(t.y-n.bottom)<nt&&Math.abs(e.y-n.bottom)<nt&&o)return"bottom";if(Math.abs(t.x-n.left)<nt&&Math.abs(e.x-n.left)<nt&&s)return"left";if(Math.abs(t.x-n.right)<nt&&Math.abs(e.x-n.right)<nt&&s)return"right"}f(kn,"borderSideForSegment");function _n(t,e,n,o){switch(t){case"top":return dt(e,n,nt)&&n.y<o.top-nt;case"bottom":return dt(e,n,nt)&&n.y>o.bottom+nt;case"left":return ht(e,n,nt)&&n.x<o.left-nt;case"right":return ht(e,n,nt)&&n.x>o.right+nt}}f(_n,"leavesOutward");function Dn(t,e,n){if(t.length<3)return t;if(n){let r=kn(t[0],t[1],e);return r&&_n(r,t[1],t[2],e)?t.slice(1):t}let o=t.length-1,s=kn(t[o-1],t[o],e);return s&&_n(s,t[o-1],t[o-2],e)?t.slice(0,o):t}f(Dn,"collapseOwnBorderStub");function Es(t,e,n){let o=t;if(e){let r=tn(o,0,1);if(r){let i=Nn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Dn(o,e,!0)}if(n){let r=o.length-1,i=tn(o,r,-1);if(i){let u=Nn(i,o[r],n,!0);u!==o[r]&&(o=[...o.slice(0,r),u])}o=Dn(o,n,!1)}let s=go(o,e,n);return s!==o||o.length===2?s:(e&&(o=Fn(o,e,!0)),n&&(o=Fn(o,n,!1)),o)}f(Es,"snapAndCollapseEndpoints");function Hn(t,e){for(let n of t){let o=ho(n,e,2);if(!o)continue;let s=pt(o.points,nt),r=Es(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}let i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}f(Hn,"prepareEdgeEndpointsForRenderer");function po(t){return new Map(t.map(e=>[e.id,e]))}f(po,"buildNodeMap");function Ts(t,e){let n=t.parentId,o=null;for(;n;){let s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}f(Ts,"resolveTopLevelGroupId");function Xn(t,e){let n=0,o=t.parentId;for(;o;){let s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}f(Xn,"groupDepth");function mo(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(let r of t){let i=r.x,u=r.y;if(typeof i!="number"||typeof u!="number")continue;let c=r.width??0,l=r.height??0;e=Math.min(e,i-c/2),n=Math.max(n,i+c/2),o=Math.min(o,u-l/2),s=Math.max(s,u+l/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}f(mo,"boundsForChildren");function ws(t,e){let n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}f(ws,"applyGroupBounds");function As(t){let e=po(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Xn(s,e)-Xn(o,e));for(let o of n){let s=t.filter(i=>i.parentId===o.id),r=mo(s);r&&ws(o,r)}}f(As,"recomputeNestedGroupBounds");function on(t,e){let n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup),r=1/0,i=-1/0;for(let c of s){let l=c[e];typeof l=="number"&&(r=Math.min(r,l),i=Math.max(i,l))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;let u=f(c=>r+i-c,"mirror");for(let c of n){let l=c[e];typeof l=="number"&&(c[e]=u(l));let h=c.groupTitleRect;h&&(c.groupTitleRect=e==="x"?{...h,left:u(h.right),right:u(h.left)}:{...h,top:u(h.bottom),bottom:u(h.top)})}for(let c of o)for(let l of c.points??[])l[e]=u(l[e]);return!0}f(on,"mirrorAxis");function Rs(t){return(t.nodes??[]).some(n=>!n.isGroup)?on(t,"y"):!0}f(Rs,"applyBtDirectionTransform");function Ns(t,e="LR"){let n=t.nodes??[],o=t.edges??[],s=n.filter(B=>!B.isGroup),r=1/0,i=1/0;for(let B of s){let X=B.x??0,$=B.y??0;X<r&&(r=X),$<i&&(i=$)}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;let u=36,c=0,l=0;for(let B of s)c+=B.width??0,l+=B.height??0;let h=c/s.length,y=l/s.length,I=y>0?Math.max(1,h/y):1;for(let B of s){let X=B.x??0,K=((B.y??0)-i)*I+u,ct=X-r;B.x=K,B.y=ct}for(let B of o)if(B.points)for(let X of B.points){let $=X.x,ct=(X.y-i)*I+u,mt=$-r;X.x=ct,X.y=mt}As(n);let p=n.filter(B=>B.isGroup&&!B.parentId);if(p.length===0)return e==="RL"&&on(t,"x"),!0;let g=po(n),a=new Map;for(let B of n){if(B.isGroup)continue;let X=Ts(B,g);if(!X)continue;let $=a.get(X)??[];$.push(B),a.set(X,$)}let m=0;for(let B of p){let X=B.padding??0;X>m&&(m=X)}let v=[],M=1/0,L=-1/0;for(let B of p){let X=a.get(B.id)??[],$=mo(X);$&&(M=Math.min(M,$.minX),L=Math.max(L,$.maxX),v.push({lane:B,contentTop:$.minY,contentBottom:$.maxY,centerY:($.minY+$.maxY)/2}))}if(M===1/0||L===-1/0)return!0;let R=Math.max(0,L-M),S=Math.max(m,10),b=R+2*S,T=u+b,A=(M+L)/2-b/2-u,_=A+T/2,k=Math.max(m,u);v.sort((B,X)=>B.centerY-X.centerY);for(let B=0;B<v.length;B++){let X=v[B],$,K;if(B===0?$=X.contentTop-k:$=(v[B-1].contentBottom+X.contentTop)/2,B===v.length-1)K=X.contentBottom+k;else{let Rt=v[B+1];K=(X.contentBottom+Rt.contentTop)/2}let ct=Math.max(0,K-$),mt=($+K)/2;X.lane.x=_,X.lane.y=mt,X.lane.width=T,X.lane.height=ct,X.lane.swimlaneContentTop=X.contentTop,X.lane.groupTitleRect={left:A,right:A+u,top:$,bottom:K}}return e==="RL"&&on(t,"x"),!0}f(Ns,"applyLrDirectionTransform");var se=1e-6,Vr=8,Ve=Vr,jr=[0,Ve,-Ve,2*Ve,-2*Ve];function Os(t,e){let{nodeInfoById:n,realNodeRects:o}=an(e);for(let s of t){if(s.isLayoutOnly)continue;let r=s.points;if(!r||r.length<4)continue;let i=io(pt(r,se),se);if(!i)continue;let{p3:u}=i,c=i.kind==="HVH",l=fo(s,n,se);if(!l)continue;let{srcId:h,dstId:y,srcInfo:I,dstInfo:p,collinearX:g,collinearY:a}=l;if(g||a)continue;let m,v=I.rect;for(let M of jr){let L,R,S;if(c){let _=p.cy>I.cy?v.bottom:v.top,k=I.cx+M;if(k<=v.left+se||k>=v.right-se)continue;L={x:k,y:_},R={x:k,y:u.y},S={x:u.x,y:u.y}}else{let _=p.cx>I.cx?v.right:v.left,k=I.cy+M;if(k<=v.top+se||k>=v.bottom-se)continue;L={x:_,y:k},R={x:u.x,y:k},S={x:u.x,y:u.y}}let b=oe(L,R,se),T=oe(R,S,se);if(b&&T||!b&&At(L,R,o,[h],1)||!T&&At(R,S,o,[y],1))continue;let N=!b&&Ze(L,R,t,s,{epsilon:se,skipDegenerateOther:!0}),P=!T&&Ze(R,S,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(N||P)){b?m=[R,S]:T?m=[L,R]:m=[L,R,S];break}}m&&(s.points=m)}}f(Os,"portSwapToLShape");function Bs(t,e){let{realNodeRects:r,labelNodeRects:i}=me(e.values());for(let u of t){if(u.isLayoutOnly)continue;let c=u.points;if(!c||c.length<4)continue;let l=pt(c,.001);if(l.length<4)continue;let h=l.length-1,y=l[h],I=l[h-1],p=l[h-2],g=y.x-I.x,a=y.y-I.y,m=Math.hypot(g,a);if(m>=10||m<.001)continue;let v=I.x-p.x,M=I.y-p.y;if(Math.hypot(v,M)<.001)continue;let R=Tt(I,y,.001),S=wt(I,y,.001),b=Tt(p,I,.001),T=wt(p,I,.001);if(!(R&&T||S&&b))continue;let N=u.end,P=u.start,A=N?e.get(N):void 0;if(!A)continue;let _=A.x??0,k=A.y??0,B=qt(A);if(!B)continue;let X,$;if(T){let W=M<0;X={x:_,y:p.y},$={x:_,y:W?B.bottom:B.top}}else{let W=v>0;X={x:p.x,y:k},$={x:W?B.right:B.left,y:k}}if(At(X,$,r,N?[N]:[],-2)||At(X,$,i,[],-2))continue;if(P){let W=e.get(P),et=W?qt(W):void 0;if(et&&co(X,et,2))continue}let K=f((W,et)=>`${W.x.toFixed(3)},${W.y.toFixed(3)}|${et.x.toFixed(3)},${et.y.toFixed(3)}`,"ownSegmentKey"),ct=new Set;for(let W=0;W<l.length-1;W++)ct.add(K(l[W],l[W+1]));let mt=f((W,et)=>{for(let lt of t){if(lt===u||lt.isLayoutOnly)continue;let gt=lt.points;if(!(!gt||gt.length<2))for(let xt=0;xt<gt.length-1;xt++){let vt=gt[xt],Vt=gt[xt+1];if(!ct.has(K(vt,Vt))&&le(W,et,vt,Vt,.001))return!0}}return!1},"segmentCrossesOtherEdge");if(mt(X,$))continue;if(h-3>=0){let W=l[h-3],et=[P,N].filter(lt=>!!lt);if(At(W,X,r,et,-2)||mt(W,X))continue}let Pt=[...l.slice(0,h-2),X,$];u.points=Pt;let Q=u.labelNodeId;if(Q){let W=e.get(Q);if(W){let et=W.width??0,lt=W.height??0;if(et>0&<>0){let gt,xt,vt=-1;for(let Vt=0;Vt<Pt.length-1;Vt++){let jt=Pt[Vt],Ut=Pt[Vt+1],te=Math.hypot(Ut.x-jt.x,Ut.y-jt.y),Se=ht(jt,Ut,.001),de=dt(jt,Ut,.001);(Se&&te>=et+2||de&&te>=lt+2)&&te>vt&&(vt=te,gt=(jt.x+Ut.x)/2,xt=(jt.y+Ut.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}f(Bs,"collapseShortTerminalStub");var Z=.001,kt=8,it=Ne,Sn=f((t,e)=>dt(t,e,Z)||ht(t,e,Z),"orthogonallyAligned");function Ps(t,e){let s=f((p,g)=>{let a=p.x??0,m=p.y??0,v=g.x-a,M=g.y-m,L=(p.width??0)/2,R=(p.height??0)/2;return Math.abs(M)*L>Math.abs(v)*R?(M<0&&(R=-R),{x:a+(M===0?0:R*v/M),y:m+R}):(v<0&&(L=-L),{x:a+L,y:m+(v===0?0:L*M/v)})},"rectIntersect"),r=f((p,g)=>{let a=pt(p.points??[]);if(a.length<2)return;let m=g?p.start:p.end,v=m?e.get(m):void 0,M=v?qt(v):void 0;if(!v||!m||!M)return;let L=g?a[0]:a[a.length-1],R=g?a[1]:a[a.length-2],S=s(v,L),b=L;if(Sn(R,S)&&(b=R),dt(S,b,Z))return{edge:p,edgeId:String(p.id??""),nodeId:m,atStart:g,orientation:"V",coord:S.x,min:Math.min(S.y,b.y),max:Math.max(S.y,b.y),boundary:S,railEnd:b,rect:M};if(ht(S,b,Z))return{edge:p,edgeId:String(p.id??""),nodeId:m,atStart:g,orientation:"H",coord:S.y,min:Math.min(S.x,b.x),max:Math.max(S.x,b.x),boundary:S,railEnd:b,rect:M}},"terminalLaneFor"),i=f((p,g)=>Math.max(0,Math.min(p.max,g.max)-Math.max(p.min,g.min)),"projectedOverlapLength"),u=f((p,g)=>p.nodeId!==g.nodeId||p.orientation!==g.orientation?!1:p.orientation==="H"?(Math.abs(p.boundary.x-p.rect.left)<1||Math.abs(p.boundary.x-p.rect.right)<1)&&dt(p.boundary,g.boundary,1):(Math.abs(p.boundary.y-p.rect.top)<1||Math.abs(p.boundary.y-p.rect.bottom)<1)&&ht(p.boundary,g.boundary,1),"sameTerminalFace"),c=f((p,g)=>p.nodeId!==g.nodeId||p.orientation!==g.orientation?!1:i(p,g)>=kt&&Math.abs(p.coord-g.coord)<.5,"exactTerminalLaneConflict"),l=f((p,g)=>{if(p.nodeId!==g.nodeId||p.orientation!==g.orientation||p.orientation!=="H"||p.atStart===g.atStart)return!1;let a=i(p,g);if(a<kt)return!1;let m=p.rect.bottom-p.rect.top;return a<m||a>2*m?!1:u(p,g)&&Math.abs(p.coord-g.coord)<16},"nearTerminalLaneConflict"),h=f((p,g)=>{let a=pt(p.edge.points??[]);if(a.length<2)return;let m=p.orientation==="V"?{x:p.boundary.x+g,y:p.boundary.y}:{x:p.boundary.x,y:p.boundary.y+g},v=p.orientation==="V"?{x:p.railEnd.x+g,y:p.railEnd.y}:{x:p.railEnd.x,y:p.railEnd.y+g};if(!f(()=>Math.abs(p.boundary.y-p.rect.top)<1||Math.abs(p.boundary.y-p.rect.bottom)<1?ht(m,p.boundary,Z)&&m.x>=p.rect.left+1&&m.x<=p.rect.right-1:Math.abs(p.boundary.x-p.rect.left)<1||Math.abs(p.boundary.x-p.rect.right)<1?dt(m,p.boundary,Z)&&m.y>=p.rect.top+1&&m.y<=p.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(p.atStart){let b=a.length>1&&oe(a[1],p.railEnd,Z),T=a.slice(b?2:1),N=T[0];return N&&!Sn(N,v)?void 0:[m,v,...T]}let L=a.length>1&&oe(a[a.length-2],p.railEnd,Z),R=a.slice(0,L?-2:-1),S=R[R.length-1];if(!(S&&!Sn(S,v)))return[...R,v,m]},"shiftedCandidate"),y=f(p=>{let g=p.edge,a=pt(g.points??[]);if(a.length!==2)return!1;let m=g.start,v=g.end,M=m?e.get(m):void 0,L=v?e.get(v):void 0;if(!M||!L)return!1;let R=M.x??0,S=M.y??0,b=L.x??0,T=L.y??0,[N,P]=a;return ht(N,P,Z)&&Math.abs(S-T)<1&&Math.abs(R-b)>1||dt(N,P,Z)&&Math.abs(R-b)<1&&Math.abs(S-T)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let p=0;p<8;p++){let g=t.filter(m=>!m.isLayoutOnly).flatMap(m=>[r(m,!0),r(m,!1)]).filter(m=>!!m),a=!1;for(let m=0;m<g.length&&!a;m++)for(let v=m+1;v<g.length&&!a;v++){let M=g[m],L=g[v];if(M.edge===L.edge||!(c(M,L)||l(M,L)))continue;let R=!c(M,L),S=[M,L].sort((b,T)=>{let N=y(b),P=y(T);return N!==P?Number(N)-Number(P):+!T.atStart-+!b.atStart});for(let b of S){for(let T of I){let N=h(b,T);if(!N)continue;let P=r({...b.edge,points:N},b.atStart);if(!(!P||g.some(A=>A.edge!==b.edge&&(c(P,A)||R&&l(P,A))))){b.edge.points=N,a=!0;break}}if(a)break}}if(!a)return}}f(Ps,"separateSharedRenderedTerminalLanes");function Fs(t,e){let{realNodeRects:s,labelNodeRects:r}=me(e.values()),i=f((c,l)=>{let h=c.start,y=c.end,I=it(l);if(I.length!==l.length-1)return!1;let p=[h,y].filter(g=>!!g);for(let g of I)if(At(g.a,g.b,s,p,-2)||At(g.a,g.b,r,[],-2))return!1;for(let g of t){if(g===c||g.isLayoutOnly)continue;let a=g.points;if(!(!a||a.length<2)){for(let m of I)for(let v of it(pt(a)))if(ce(m,v,.5)>=kt||le(m.a,m.b,v.a,v.b,Z))return!1}}return!0},"candidateIsSafe"),u=f((c,l)=>{if(l+4>=c.length)return;let h=c[l],y=c[l+1],I=c[l+2],p=c[l+3],g=c[l+4],a=Tt(h,y)&&wt(y,I)&&Tt(I,p)&&wt(p,g)&&dt(h,p,Z)&&dt(h,g,Z)&&dt(y,I,Z)&&(y.x-h.x)*(p.x-I.x)<0,m=wt(h,y)&&Tt(y,I)&&wt(I,p)&&Tt(p,g)&&ht(h,p,Z)&&ht(h,g,Z)&&ht(y,I,Z)&&(y.y-h.y)*(p.y-I.y)<0;if(a||m)return pt([...c.slice(0,l+1),g,...c.slice(l+5)]);if(l+5>=c.length)return;let v=c[l+5],M=wt(h,y)&&Tt(y,I)&&wt(I,p)&&Tt(p,g)&&wt(g,v)&&dt(h,g,Z)&&dt(h,v,Z)&&dt(I,p,Z)&&(I.x-y.x)*(g.x-p.x)<0,L=Tt(h,y)&&wt(y,I)&&Tt(I,p)&&wt(p,g)&&Tt(g,v)&&ht(h,g,Z)&&ht(h,v,Z)&&ht(I,p,Z)&&(I.y-y.y)*(g.y-p.y)<0;if(!(!M&&!L))return pt([...c.slice(0,l+1),v,...c.slice(l+6)])},"withoutDogleg");for(let c=0;c<8;c++){let l=!1;for(let h of t){if(h.isLayoutOnly)continue;let y=pt(h.points??[]);for(let I=0;I<=y.length-5;I++){let p=u(y,I);if(!(!p||!i(h,p))){h.points=p,l=!0;break}}if(l)break}if(!l)return}}f(Fs,"collapseRedundantRectangularDoglegs");function Yn(t,e){let{realNodeRects:r,labelNodeRects:i}=me(e.values()),u=t.filter(g=>!g.isLayoutOnly),c=f((g,a,m)=>pt(g===a?m??[]:g.points??[]),"pointsFor"),l=f((g,a)=>{let m=0;for(let v=0;v<u.length;v++){let M=it(c(u[v],g,a));for(let L=v+1;L<u.length;L++){let R=it(c(u[L],g,a));for(let S of M)for(let b of R)le(S.a,S.b,b.a,b.b,Z)&&m++}}return m},"strictCrossingCount"),h=f(g=>{let a=it(g);if(a.length!==3)return;let m=a[1];if(!(a[0].horizontal===m.horizontal||a[2].horizontal===m.horizontal))return{index:m.index,horizontal:m.horizontal,vertical:m.vertical,segment:m}},"middleRail"),y=f((g,a)=>{let m=[g.start,g.end].filter(v=>!!v);return r.filter(v=>{if(m.includes(v.id))return!1;let M=v.rect;return a.horizontal?zt(a.a.x,a.b.x,M.left,M.right)>=kt&&a.a.y>=M.top-2&&a.a.y<=M.bottom+2:zt(a.a.y,a.b.y,M.top,M.bottom)>=kt&&a.a.x>=M.left-2&&a.a.x<=M.right+2})},"blockingRectsFor"),I=f((g,a,m)=>{let v=g.map(L=>({...L}));if(a.horizontal)v[a.index].y=m,v[a.index+1].y=m;else if(a.vertical)v[a.index].x=m,v[a.index+1].x=m;else return;let M=ae(pt(v));return it(M).length===M.length-1?M:void 0},"candidateByMovingRail"),p=f((g,a,m)=>{let v=[g.start,g.end].filter(L=>!!L),M=it(a);if(M.length!==a.length-1)return!1;for(let L of M)if(At(L.a,L.b,r,v,-2)||At(L.a,L.b,i,[],-2))return!1;for(let L of u)if(L!==g){for(let R of M)for(let S of it(c(L)))if(ce(R,S,.5)>=kt)return!1}return l(g,a)<=m},"candidateIsSafe");for(let g=0;g<8;g++){let a=l(),m=!1;for(let v of u){let M=c(v),L=h(M);if(!L)continue;let R=y(v,L.segment);if(R.length===0)continue;let S=L.horizontal?[Math.min(...R.map(b=>b.rect.top))-20,Math.max(...R.map(b=>b.rect.bottom))+20]:[Math.min(...R.map(b=>b.rect.left))-20,Math.max(...R.map(b=>b.rect.right))+20];for(let b of S){let T=I(M,L.segment,b);if(!(!T||!p(v,T,a))){v.points=T,m=!0;break}}if(m)break}if(!m)return}}f(Yn,"liftObstacleHuggingSameSideRails");function Gn(t,e){let o=f(c=>{let l=c.groupTitleRect;if(!(!l||typeof l.left!="number"||typeof l.right!="number"||typeof l.top!="number"||typeof l.bottom!="number"||!Number.isFinite(l.left)||!Number.isFinite(l.right)||!Number.isFinite(l.top)||!Number.isFinite(l.bottom)||l.right<=l.left||l.bottom<=l.top))return{left:l.left,right:l.right,top:l.top,bottom:l.bottom}},"validTitleRect"),s=f(c=>{if(!c.isGroup||c.parentId)return;let l=c.direction,h=typeof l=="string"?l.toUpperCase():"";if(h==="LR"||h==="RL"||h==="BT")return;let y=o(c),I=c.y,p=c.height;if(!y||typeof I!="number"||typeof p!="number"||!Number.isFinite(I)||!Number.isFinite(p)||p<=0)return;let g=y.right-y.left,a=y.bottom-y.top;if(!(a<=0||g<a))return{node:c,rect:y}},"topLaneTitleFor"),r=f((c,l)=>{if(!c.horizontal)return!1;let h=c.a.y;return h<=l.top+Z||h>=l.bottom-Z?!1:zt(c.a.x,c.b.x,l.left,l.right)>=kt},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(c=>!!c);if(i.length===0)return;let u=0;for(let c of t){if(c.isLayoutOnly)continue;let l=pt(c.points??[]);for(let h of it(l))for(let y of i)r(h,y.rect)&&(u=Math.max(u,y.rect.bottom-h.a.y+4))}if(!(u<=Z))for(let c of i){let l=c.node.y,h=c.node.height;typeof l!="number"||typeof h!="number"||!Number.isFinite(l)||!Number.isFinite(h)||h<=0||(c.node.y=l-u/2,c.node.height=h+u,c.node.groupTitleRect={...c.rect,top:c.rect.top-u,bottom:c.rect.bottom-u})}}f(Gn,"liftTopLaneTitleBandsAboveRails");function $n(t,e){let o=f(l=>{let h=l.groupTitleRect;if(!(!h||typeof h.left!="number"||typeof h.right!="number"||typeof h.top!="number"||typeof h.bottom!="number"||!Number.isFinite(h.left)||!Number.isFinite(h.right)||!Number.isFinite(h.top)||!Number.isFinite(h.bottom)||h.right<=h.left||h.bottom<=h.top))return{left:h.left,right:h.right,top:h.top,bottom:h.bottom}},"validTitleRect"),s=f(l=>{if(!l.isGroup||l.parentId||l.direction!=="LR")return;let y=o(l),I=l.x,p=l.width;if(!y||typeof I!="number"||typeof p!="number"||!Number.isFinite(I)||!Number.isFinite(p)||p<=0)return;let g=y.right-y.left,a=y.bottom-y.top;if(!(g<=0||a<g))return{node:l,rect:y}},"leftLaneTitleFor"),r=f((l,h)=>{if(!l.vertical)return!1;let y=l.a.x;return y<=h.left+Z||y>=h.right-Z?!1:zt(l.a.y,l.b.y,h.top,h.bottom)>=kt},"verticalSegmentIntersectsTitle"),i=f((l,h)=>{if(!l.horizontal)return!1;let y=l.a.y;return y<=h.top+Z||y>=h.bottom-Z?!1:zt(l.a.x,l.b.x,h.left,h.right)>=kt},"horizontalSegmentIntersectsTitle"),u=[...e.values()].map(s).filter(l=>!!l);if(u.length===0)return;let c=0;for(let l of t){if(l.isLayoutOnly)continue;let h=pt(l.points??[]);for(let y of it(h))for(let I of u)if(r(y,I.rect))c=Math.max(c,I.rect.right-y.a.x+4);else if(i(y,I.rect)){let p=Math.min(y.a.x,y.b.x);c=Math.max(c,I.rect.right-p+4)}}if(!(c<=Z))for(let l of u){let h=l.node.x,y=l.node.width;typeof h!="number"||typeof y!="number"||!Number.isFinite(h)||!Number.isFinite(y)||y<=0||(l.node.x=h-c/2,l.node.width=y+c,l.node.groupTitleRect={...l.rect,left:l.rect.left-c,right:l.rect.right-c})}}f($n,"shiftLeftLaneTitleBandsLeftOfRails");function ks(t,e){let{realNodeRects:s}=me(e.values()),r=t.filter(a=>!a.isLayoutOnly),i=f((a,m=new Map)=>pt(m.get(a)??a.points??[]),"replacementPointsFor"),u=f((a=new Map)=>{let m=0;for(let v=0;v<r.length;v++){let M=it(i(r[v],a));for(let L=v+1;L<r.length;L++){let R=it(i(r[L],a));for(let S of M)for(let b of R)le(S.a,S.b,b.a,b.b,Z)&&m++}}return m},"crossingCount"),c=f((a=new Map)=>r.reduce((m,v)=>m+Qt(i(v,a)),0),"totalBends"),l=f(a=>{let m=i(a);if(m.length<4)return;let v=m[m.length-2],M=m[m.length-1];if(!(!Tt(v,M,Z)&&!wt(v,M,Z)))return{tailStart:v,terminal:M}},"terminalTailFor"),h=f((a,m)=>{let v=i(a);if(v.length<3)return;let M=v[0],L=v[1],R;if(Tt(M,L,Z))R={x:L.x,y:m.tailStart.y};else if(wt(M,L,Z))R={x:m.tailStart.x,y:L.y};else return;let S=ae(pt([M,L,R,m.tailStart,m.terminal]));return it(S).length===S.length-1?S:void 0},"candidateWithDestinationTail"),y=f((a,m)=>{let v=[a.start,a.end].filter(M=>!!M);for(let M of it(m))if(At(M.a,M.b,s,v,-2))return!0;return!1},"pathHasNodeHit"),I=f((a,m,v)=>{for(let M of r)if(M!==a){for(let L of it(m))for(let R of it(i(M,v)))if(ce(L,R,.5)>=kt)return!0}return!1},"pathHasSharedTrack"),p=f((a,m,v)=>!y(a,m)&&!I(a,m,v),"candidateIsSafe"),g=f(()=>{let a=new Map;for(let m of r){let v=m.end;if(!v||!e.has(v)||i(m).length<4)continue;let L=a.get(v)??[];L.push(m),a.set(v,L)}return a},"edgesByDestination");for(let a=0;a<4;a++){let m=u();if(m===0)return;let v=c(),M,L=m,R=v;for(let S of g().values())for(let b=0;b<S.length;b++)for(let T=b+1;T<S.length;T++){let N=S[b],P=S[T],A=l(N),_=l(P);if(!A||!_)continue;let k=h(N,_),B=h(P,A);if(!k||!B)continue;let X=new Map([[N,k],[P,B]]);if(!p(N,k,X)||!p(P,B,X))continue;let $=u(X),K=c(X);$>=m||$>L||$===L&&K>=R||(M=X,L=$,R=K)}if(!M)return;for(let[S,b]of M)S.points=b}}f(ks,"swapDestinationTerminalTailsToReduceCrossings");function _s(t,e){let{realNodeRects:i,labelNodeRects:u}=me(e.values()),c=t.filter(S=>!S.isLayoutOnly),l=f((S,b=new Map)=>pt(b.get(S)??S.points??[]),"replacementPointsFor"),h=f((S=new Map)=>{let b=0;for(let T=0;T<c.length;T++){let N=it(l(c[T],S));for(let P=T+1;P<c.length;P++){let A=it(l(c[P],S));for(let _ of N)for(let k of A)le(_.a,_.b,k.a,k.b,Z)&&b++}}return b},"strictCrossingCount"),y=f((S=new Map)=>c.reduce((b,T)=>b+Qt(l(T,S)),0),"totalBends"),I=f(S=>{let b=S.start,T=S.end,N=b?e.get(b):void 0,P=T?e.get(T):void 0,A=N?qt(N):void 0,_=P?qt(P):void 0;return A&&_?{src:A,dst:_}:void 0},"endpointRectsFor"),p=f((S,b,T)=>{if(T.index<=0||T.index+1>=b.length-1)return;let N=I(S);if(N){if(T.vertical){let P=T.a.x,A=Math.min(N.src.left,N.dst.left),_=Math.max(N.src.right,N.dst.right),k=P<A-Z?"left":P>_+Z?"right":void 0;return k?{edge:S,points:b,segmentIndex:T.index,axis:"vertical",side:k,coord:P,min:Math.min(T.a.y,T.b.y),max:Math.max(T.a.y,T.b.y)}:void 0}if(T.horizontal){let P=T.a.y,A=Math.min(N.src.top,N.dst.top),_=Math.max(N.src.bottom,N.dst.bottom),k=P<A-Z?"top":P>_+Z?"bottom":void 0;return k?{edge:S,points:b,segmentIndex:T.index,axis:"horizontal",side:k,coord:P,min:Math.min(T.a.x,T.b.x),max:Math.max(T.a.x,T.b.x)}:void 0}}},"externalRailForSegment"),g=f(()=>{let S=[];for(let b of c){let T=l(b);for(let N of it(T)){let P=p(b,T,N);P&&S.push(P)}}return S},"collectExternalRails"),a=f((S,b)=>S.edge!==b.edge&&S.axis===b.axis&&S.side===b.side&&zt(S.min,S.max,b.min,b.max)>=kt,"railsInteract"),m=f(S=>{let b=[],T=new Set;for(let N of S){if(T.has(N))continue;let P=[N],A=[];for(T.add(N);P.length>0;){let _=P.pop();A.push(_);for(let k of S)!T.has(k)&&a(_,k)&&(T.add(k),P.push(k))}A.length>1&&b.push(A)}return b},"connectedComponents"),v=f(S=>{let b=[];for(let T of S)b.some(N=>Math.abs(N-T.coord)<Z)||b.push(T.coord);for(;b.length<S.length;){let T=Math.min(...b),N=Math.max(...b),P=S[0].side;b.push(P==="left"||P==="top"?T-12*(S.length-b.length):N+12*(S.length-b.length))}return b},"uniqueCoordsFor"),M=f(S=>{let b=S.map(P=>P.coord),T=v(S),N=[];if(S.length<=6){let P=new Array(T.length).fill(!1),A=[],_=f(()=>{if(A.length===S.length){A.some((k,B)=>Math.abs(k-b[B])>=Z)&&N.push([...A]);return}for(let[k,B]of T.entries())P[k]||(P[k]=!0,A.push(B),_(),A.pop(),P[k]=!1)},"visit");return _(),N}for(let P=0;P<b.length;P++)for(let A=P+1;A<b.length;A++){let _=[...b];[_[P],_[A]]=[_[A],_[P]],N.push(_)}return N},"coordinateAssignmentsFor"),L=f((S,b)=>{let T=new Map;for(let[P,A]of S.entries()){let _=b[P],k=T.get(A.edge)??A.points.map(B=>({x:B.x,y:B.y}));A.axis==="vertical"?(k[A.segmentIndex].x=_,k[A.segmentIndex+1].x=_):(k[A.segmentIndex].y=_,k[A.segmentIndex+1].y=_),T.set(A.edge,k)}let N=new Map;for(let[P,A]of T){let _=ae(pt(A));if(it(_).length!==_.length-1)return;N.set(P,_)}return N},"replacementsForAssignment"),R=f(S=>{for(let[b,T]of S){let N=[b.start,b.end].filter(P=>!!P);for(let P of it(T))if(At(P.a,P.b,i,N,-2)||At(P.a,P.b,u,[],-2))return!1}for(let b=0;b<c.length;b++){let T=c[b],N=S.has(T),P=it(l(T,S));for(let A=b+1;A<c.length;A++){let _=c[A];if(!N&&!S.has(_))continue;let k=it(l(_,S));for(let B of P)for(let X of k)if(ce(B,X,.5)>=kt)return!1}}return!0},"candidateIsSafe");for(let S=0;S<4;S++){let b=h();if(b===0)return;let T,N=b,P=y(),A=Number.POSITIVE_INFINITY;for(let _ of m(g()))for(let k of M(_)){let B=L(_,k);if(!B||!R(B))continue;let X=h(B);if(X>=b)continue;let $=y(B),K=_.reduce((ct,mt,Rt)=>ct+Math.abs(k[Rt]-mt.coord),0);X>N||X===N&&($>P||$===P&&K>=A)||(T=B,N=X,P=$,A=K)}if(!T)return;for(let[_,k]of T)_.points=k}}f(_s,"reassignCrossingExternalRailChannels");function Ds(t,e){let{realNodeRects:s,labelNodeRects:r}=me(e.values()),i=t.filter(g=>!g.isLayoutOnly),u=f((g,a,m)=>pt(g===a?m??[]:g.points??[]),"pointsFor"),c=f(g=>it(g).reduce((a,m)=>{let v=m.a.x-m.b.x,M=m.a.y-m.b.y;return a+Math.hypot(v,M)},0),"pathLength"),l=f((g,a)=>{let m=0;for(let v=0;v<i.length;v++){let M=it(u(i[v],g,a));for(let L=v+1;L<i.length;L++){let R=it(u(i[L],g,a));for(let S of M)for(let b of R)le(S.a,S.b,b.a,b.b,Z)&&m++}}return m},"strictCrossingCount"),h=f((g,a)=>{if(g.horizontal){let m=g.a.y;return(Math.abs(m-a.top)<1||Math.abs(m-a.bottom)<1)&&zt(g.a.x,g.b.x,a.left,a.right)>=kt}if(g.vertical){let m=g.a.x;return(Math.abs(m-a.left)<1||Math.abs(m-a.right)<1)&&zt(g.a.y,g.b.y,a.top,a.bottom)>=kt}return!1},"segmentRunsAlongRectBorder"),y=f(g=>{let a=[g.start,g.end].filter(v=>!!v),m=[];for(let v of a){let M=e.get(v),L=M?qt(M):void 0;L&&m.push(L)}return m},"endpointRectsFor"),I=f((g,a)=>{if(a+3>=g.length)return[];let m=g[a],v=g[a+1],M=g[a+2],L=g[a+3],R=Tt(m,v,Z)&&wt(v,M,Z)&&Tt(M,L,Z),S=wt(m,v,Z)&&Tt(v,M,Z)&&wt(M,L,Z);if(!R&&!S)return[];if(!(R?Math.sign(v.x-m.x)!==Math.sign(L.x-M.x):Math.sign(v.y-m.y)!==Math.sign(L.y-M.y)))return[];let T=dt(m,L,Z)||ht(m,L,Z)?[]:[{x:m.x,y:L.y},{x:L.x,y:m.y}],N=T.length===0?[[...g.slice(0,a+1),...g.slice(a+3)]]:T.map(A=>[...g.slice(0,a+1),A,...g.slice(a+3)]),P=new Set;return N.map(A=>ae(pt(A))).filter(A=>{if(it(A).length!==A.length-1||!A.some(k=>oe(k,L,Z)))return!1;let _=A.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return P.has(_)?!1:(P.add(_),!0)})},"shortcutCandidatesAt"),p=f((g,a,m)=>{let v=[g.start,g.end].filter(L=>!!L),M=y(g);for(let L of it(a))if(At(L.a,L.b,s,v,-2)||At(L.a,L.b,r,[],-2)||M.some(R=>h(L,R)))return!1;for(let L of i)if(L!==g){for(let R of it(a))for(let S of it(u(L)))if(ce(R,S,.5)>=kt)return!1}return l(g,a)<=m},"candidateIsSafe");for(let g=0;g<8;g++){let a=l(),m,v,M=a,L=Number.POSITIVE_INFINITY,R=Number.POSITIVE_INFINITY;for(let S of i){let b=u(S),T=Qt(b,Z),N=c(b);for(let P=0;P<=b.length-4;P++)for(let A of I(b,P)){let _=Qt(A,Z),k=c(A);if(!(_<T||_===T&&k<N-Z)||!p(S,A,a))continue;let X=l(S,A);X>M||X===M&&(_>L||_===L&&k>=R)||(m=S,v=A,M=X,L=_,R=k)}}if(!m||!v)return;m.points=v}}f(Ds,"shortcutRedundantOrthogonalJogs");function Hs(t,e){let i=[];for(let O of e.values()){if(O.isGroup||O.isEdgeLabel)continue;let D=O.x??0,H=O.y??0,j=qt(O);j&&i.push({id:String(O.id??""),cx:D,cy:H,rect:j})}if(i.length===0)return;let u=new Map(i.map(O=>[O.id,O])),c=i.map(O=>({id:O.id,rect:O.rect})),l=["top","bottom","left","right"],h={top:Math.min(...i.map(O=>O.rect.top))-20,bottom:Math.max(...i.map(O=>O.rect.bottom))+20,left:Math.min(...i.map(O=>O.rect.left))-20,right:Math.max(...i.map(O=>O.rect.right))+20},y=t.filter(O=>!O.isLayoutOnly),I=new Map(y.map((O,D)=>[O,D])),p=f(O=>{let D=O==="left"||O==="top"?-1:1,H=[];for(let j=0;j<=2;j++)H.push(h[O]+D*20*j);return H},"outwardTracksForSide"),g=f((O,D=new Map)=>pt(D.get(O)??O.points??[]),"replacementPointsFor"),a=f((O,D)=>{let H=0;for(let j of O)for(let d of D)le(j.a,j.b,d.a,d.b,Z)&&H++;return H},"crossingCountBetweenSegments"),m=f((O,D)=>a(it(O),it(D)),"crossingCountBetweenPaths"),v=f((O=new Map)=>{let D=0,H=[],j=new Set,d=[],x=f(C=>{j.has(C)||(j.add(C),d.push(C))},"addEdge");for(let C=0;C<y.length;C++){let E=y[C],w=g(E,O);for(let F=C+1;F<y.length;F++){let U=y[F],J=m(w,g(U,O));J>0&&(D+=J,H.push({first:E,second:U,count:J}),x(E),x(U))}}return d.sort((C,E)=>(I.get(C)??0)-(I.get(E)??0)),{count:D,pairs:H,edgeSet:j,edges:d}},"crossingSnapshot"),M=f((O,D)=>{let H=new Set(D.keys());if(H.size===0)return O.count;let j=0;for(let x of O.pairs)(H.has(x.first)||H.has(x.second))&&(j+=x.count);let d=0;for(let x=0;x<y.length;x++){let C=y[x],E=H.has(C),w=g(C,D);for(let F=x+1;F<y.length;F++){let U=y[F];!E&&!H.has(U)||(d+=m(w,g(U,D)))}}return O.count-j+d},"crossingCountWithReplacements"),L=f(O=>{let D=new Map;for(let d of O.pairs){let x=D.get(d.first)??new Set;x.add(d.second),D.set(d.first,x);let C=D.get(d.second)??new Set;C.add(d.first),D.set(d.second,C)}let H=[],j=new Set;for(let d of O.edges){if(j.has(d))continue;let x=[d],C=[];for(j.add(d);x.length>0;){let E=x.pop();C.push(E);for(let w of D.get(E)??[])j.has(w)||(j.add(w),x.push(w))}C.sort((E,w)=>(I.get(E)??0)-(I.get(w)??0)),C.length>1&&H.push(C)}return H},"crossingComponents"),R=f(O=>[O.start,O.end].filter(D=>!!D),"endpointIdsFor"),S=f(O=>{let D=[];for(let H of L(O)){let j=new Set(H),d=new Set(H.flatMap(C=>R(C))),x=[...H];for(let C of y)j.has(C)||R(C).some(E=>d.has(E))&&x.push(C);x.sort((C,E)=>(I.get(C)??0)-(I.get(E)??0)),D.push(x)}return D},"pairSearchGroups"),b=f((O,D,H)=>M(O,new Map([[D,H]])),"crossingCountWithSingleReplacement"),T=f(O=>{let D=new Map;for(let H of O.pairs)D.set(H.first,(D.get(H.first)??0)+H.count),D.set(H.second,(D.get(H.second)??0)+H.count);return D},"currentCrossingsByEdge"),N=f(O=>O.slice(1).reduce((D,H,j)=>{let d=O[j];return D+Math.abs(H.x-d.x)+Math.abs(H.y-d.y)},0),"pathLength"),P=f((O=new Map)=>y.reduce((D,H)=>D+Qt(g(H,O)),0),"totalBends"),A=f((O=new Map)=>y.reduce((D,H)=>D+N(g(H,O)),0),"totalLength"),_=f((O,D,H=new Map)=>{let j=it(D);for(let d of y)if(d!==O){for(let x of j)for(let C of it(g(d,H)))if(ce(x,C,.5)>=kt)return!0}return!1},"pathHasSegmentConflict"),k=f((O,D)=>{let H=[O.start,O.end].filter(j=>!!j);for(let j of it(D))if(At(j.a,j.b,c,H,-2))return!0;return!1},"pathHitsNode"),B=f((O,D)=>{let H=ae(pt(D));it(H).length===H.length-1&&O.push(H)},"pushOrthogonalCandidate"),X=f(O=>O==="left"||O==="right","sideIsHorizontal"),$=f((O,D,H)=>{switch(D){case"left":return Math.min(O.x,H.x)-20;case"right":return Math.max(O.x,H.x)+20;case"top":return Math.min(O.y,H.y)-20;case"bottom":return Math.max(O.y,H.y)+20}},"localTrackForSameSide"),K=f((O,D,H,j)=>{let d=H==="left"||H==="top"?-1:1,x=[$(D,H,j),h[H]];for(let C of x)for(let E=0;E<=2;E++)B(O,lo(D,H,j,C+d*20*E))},"addSameSideCandidates"),ct=f((O,D,H,j,d)=>{for(let x of p(H))for(let C of p(d))B(O,[D,{x,y:D.y},{x,y:C},{x:j.x,y:C},j])},"addHorizontalToVerticalCandidates"),mt=f((O,D,H,j,d)=>{for(let x of p(H))for(let C of p(d))B(O,[D,{x:D.x,y:x},{x:C,y:x},{x:C,y:j.y},j])},"addVerticalToHorizontalCandidates"),Rt=f((O,D,H,j,d)=>{let x=[...p("top"),...p("bottom")];for(let C of p(H))for(let E of p(d))for(let w of x)B(O,[D,{x:C,y:D.y},{x:C,y:w},{x:E,y:w},{x:E,y:j.y},j])},"addHorizontalPairCandidates"),Pt=f((O,D,H,j,d)=>{let x=[...p("left"),...p("right")];for(let C of p(H))for(let E of p(d))for(let w of x)B(O,[D,{x:D.x,y:C},{x:w,y:C},{x:w,y:E},{x:j.x,y:E},j])},"addVerticalPairCandidates"),Q=f(O=>{let D=new Set;return O.map(H=>pt(H)).filter(H=>{let j=H.map(d=>`${d.x.toFixed(3)},${d.y.toFixed(3)}`).join("|");return D.has(j)||H.length<2?!1:(D.add(j),!0)})},"dedupeCandidatePaths"),W=f((O,D,H,j)=>{let d=[],x=ao(O,D,H,j,20,Z);x&&B(d,x),D===j&&K(d,O,D,H);let C=X(D),E=X(j);return C&&!E?ct(d,O,D,H,j):!C&&E?mt(d,O,D,H,j):C?Rt(d,O,D,H,j):Pt(d,O,D,H,j),Q(d)},"buildCandidatesForSides"),et=f((O,D,H,j)=>{let d=[...p("left"),...p("right")],x=[...p("top"),...p("bottom")];for(let C of l){let E=Ie(j,C),w=C==="top"||C==="bottom"?p(C):x;for(let F of d){B(O,[D,H,{x:F,y:H.y},{x:F,y:E.y},E]);for(let U of w)B(O,[D,H,{x:F,y:H.y},{x:F,y:U},{x:E.x,y:U},E])}}},"addVerticalDepartureOuterTrackCandidates"),lt=f((O,D,H,j)=>{let d=[...p("left"),...p("right")],x=[...p("top"),...p("bottom")];for(let C of l){let E=Ie(j,C),w=C==="left"||C==="right"?p(C):d;for(let F of x){B(O,[D,H,{x:H.x,y:F},{x:E.x,y:F},E]);for(let U of w)B(O,[D,H,{x:H.x,y:F},{x:U,y:F},{x:U,y:E.y},E])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=f(O=>{let D=O.start,H=O.end,j=H?u.get(H):void 0;if(!D||!j)return[];let d=pt(O.points??[]);if(d.length<4)return[];let x=d[0],C=d[1],E=[];return wt(x,C,Z)?et(E,x,C,j):Tt(x,C,Z)&<(E,x,C,j),E},"terminalPreservingOuterTrackCandidates"),xt=f(O=>{let D=O.start,H=O.end,j=D?u.get(D):void 0,d=H?u.get(H):void 0;if(!j||!d)return[];let x=[];for(let C of l){let E=Ie(j,C);for(let w of l)x.push(...W(E,C,Ie(d,w),w))}return x.push(...gt(O)),x},"candidatePathsFor"),vt=f(()=>new Map(y.map(O=>[O,it(g(O))])),"currentSegmentsByEdge"),Vt=f((O,D,H)=>{let j=new Set;for(let d of y){if(d===O)continue;let x=H.get(d)??it(g(d));D.some(C=>x.some(E=>ce(C,E,.5)>=kt))&&j.add(d)}return j},"sharedTrackConflictsFor"),jt=f((O,D,H,j)=>{let d=new Set;return xt(O).map(C=>ae(pt(C))).filter(C=>{if(k(O,C))return!1;let E=C.map(w=>`${w.x.toFixed(3)},${w.y.toFixed(3)}`).join("|");return d.has(E)||C.length<2?!1:(d.add(E),!0)}).map(C=>{let E=it(C),w=0;for(let F of y)F!==O&&(w+=a(E,H.get(F)??it(g(F))));return{candidate:C,candidateSegments:E,crossings:D.count-(j.get(O)??0)+w,bends:Qt(C,Z),totalBends:Qt(C),length:N(C)}}).filter(({crossings:C})=>C<=D.count).sort((C,E)=>C.crossings-E.crossings||C.bends-E.bends||C.length-E.length).slice(0,48).map(C=>({path:C.candidate,segments:C.candidateSegments,sharedTrackConflicts:Vt(O,C.candidateSegments,H),totalBends:C.totalBends,length:C.length}))},"pairCandidatesFor"),Ut=f((O,D,H,j,d,x)=>{let C=0;for(let w of O.pairs)(w.first===D||w.second===D||w.first===j||w.second===j)&&(C+=w.count);let E=a(H.segments,d.segments);for(let w of y){if(w===D||w===j)continue;let F=x.get(w)??it(g(w));E+=a(H.segments,F)+a(d.segments,F)}return O.count-C+E},"pairCrossingCount"),te=f((O,D)=>{for(let H of O.sharedTrackConflicts)if(H!==D)return!1;return!0},"conflictsOnlyWith"),Se=f((O,D)=>O.segments.some(H=>D.segments.some(j=>ce(H,j,.5)>=kt)),"candidatesShareTrack"),de=f((O,D,H,j)=>te(D,H.edge)&&te(j,O.edge)&&!Se(D,j),"pairCandidatesAreCompatible"),Ce=f((O,D,H,j,d)=>{let x=Ut(O.current,D.edge,H,j.edge,d,O.baseSegments);if(!(x>=O.current.count))return{replacements:new Map([[D.edge,H.path],[j.edge,d.path]]),crossings:x,bends:O.currentBends-(O.baseBendsByEdge.get(D.edge)??0)-(O.baseBendsByEdge.get(j.edge)??0)+H.totalBends+d.totalBends,length:O.currentLength-(O.baseLengthByEdge.get(D.edge)??0)-(O.baseLengthByEdge.get(j.edge)??0)+H.length+d.length}},"scorePairReplacement"),dn=f((O,D)=>O.crossings<D.crossings||O.crossings===D.crossings&&(O.bends<D.bends||O.bends===D.bends&&O.length<D.length),"pairScoreIsBetter"),un=f((O,D,H,j)=>{let d=j;for(let x of D.candidates)for(let C of H.candidates){if(!de(D,x,H,C))continue;let E=Ce(O,D,x,H,C);E&&dn(E,d)&&(d=E)}return d},"bestScoreForOptionPair"),hn=f(O=>{let D=P(),H=A(),j=vt(),d=T(O),x=new Map(y.map(J=>[J,Qt(g(J))])),C=new Map(y.map(J=>[J,N(g(J))])),E=new Map,w=S(O);for(let J of w)for(let V of J){if(E.has(V))continue;let G=jt(V,O,j,d);G.length>0&&E.set(V,{edge:V,candidates:G})}let F={replacements:new Map,crossings:O.count,bends:D,length:H},U={current:O,currentBends:D,currentLength:H,baseBendsByEdge:x,baseLengthByEdge:C,baseSegments:j};for(let J of w){let V=new Set(J.filter(ot=>O.edgeSet.has(ot))),G=J.map(ot=>E.get(ot)).filter(ot=>!!ot);for(let ot=0;ot<G.length;ot++){let rt=G[ot];for(let st=ot+1;st<G.length;st++){let tt=G[st];!V.has(rt.edge)&&!V.has(tt.edge)||(F=un(U,rt,tt,F))}}}return F.replacements.size>0?F.replacements:void 0},"bestPairedReplacement");for(let O=0;O<4;O++){let D=v(),H=D.count;if(H===0)return;let j,d,x=H,C=Number.POSITIVE_INFINITY;for(let w of D.edges){let F=Qt(g(w),Z);for(let U of xt(w)){let J=k(w,U),V=!J&&_(w,U),G=b(D,w,U),ot=Qt(U,Z);J||V||!(G<H||G===H&&ot<F)||G>x||G===x&&ot>=C||(j=w,d=U,x=G,C=ot)}}if(j&&d){j.points=d;continue}let E=hn(D);if(!E)return;for(let[w,F]of E)w.points=F}}f(Hs,"resolveRenderedOrthogonalCrossings");var pe=.001,Ur=8;function Xs(t,e){let{nodeInfoById:n,realNodeRects:o}=an(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(a=>a.rect.top))-r,bottom:Math.max(...o.map(a=>a.rect.bottom))+r,left:Math.min(...o.map(a=>a.rect.left))-r,right:Math.max(...o.map(a=>a.rect.right))+r},u=f((a,m,v,M)=>{let L=[],R=ao(a,m,v,M,r,pe);return R&&L.push(R),m===M&&L.push(lo(a,m,v,i[m])),L},"buildOrthogonalPathCandidates"),c=f((a,m)=>{for(let v=0;v<a.length-1;v++){let M=a[v],L=a[v+1];if(At(M,L,o,m,1))return!0}return!1},"pathHitsNode"),l=f((a,m,v=!1)=>{let M=0,L=Ne(a,pe),R=m.start,S=m.end;for(let b of t){if(b===m||b.isLayoutOnly)continue;let T=b.start,N=b.end;if(!v&&R&&S&&(T===R||T===S||N===R||N===S))continue;let P=b.points;if(!(!P||P.length<2))for(let A of L)for(let _ of Ne(P,pe)){if(uo(A.a,A.b,_.a,_.b,pe,pe)){M++;continue}ce(A,_,pe)>=Ur&&M++}}return M},"pathConflictCount"),h=4,y=f((a,m)=>{let v=Math.abs(a.y-m.rect.top),M=Math.abs(a.y-m.rect.bottom),L=Math.abs(a.x-m.rect.left),R=Math.abs(a.x-m.rect.right),S="top",b=v;return M<b&&(S="bottom",b=M),L<b&&(S="left",b=L),R<b&&(S="right",b=R),S},"nearestSideOfRect"),I=new Map,p=f((a,m,v)=>{let M=I.get(a)??[];M.push({side:m,edgeId:v}),I.set(a,M)},"addFaceClaim");for(let a of t){if(a.isLayoutOnly)continue;let m=a.points??[];if(m.length<1)continue;let v=a.id??"",M=a.start,L=a.end;if(M){let R=n.get(M);R&&p(M,y(m[0],R),v)}if(L){let R=n.get(L);R&&p(L,y(m[m.length-1],R),v)}}let g=f((a,m,v)=>I.get(a)?.some(M=>M.edgeId!==v&&M.side===m)??!1,"faceIsClaimed");for(let a of t){if(a.isLayoutOnly)continue;let m=a.points;if(!m||m.length<2)continue;let v=Qt(m,pe);if(v<h)continue;let M=a.start,L=a.end;if(!M||!L)continue;let R=n.get(M),S=n.get(L);if(!R||!S)continue;let b=a.id??"",T=l(m,a,!0),N=l(m,a),P,A=T,_=v;for(let k of s){if(g(M,k,b))continue;let B=Ie(R,k);for(let X of s){if(g(L,X,b))continue;let $=Ie(S,X);for(let K of u(B,k,$,X)){if(c(K,[M,L]))continue;let ct=Qt(K,pe);if(T>0){let mt=l(K,a,!0);if(mt>A||mt===A&&ct>=_)continue;A=mt,_=ct,P=K;continue}l(K,a)>N||ct<_&&(_=ct,P=K)}}}if(P){a.points=P;let k=I.get(M);k&&I.set(M,k.filter(X=>X.edgeId!==b));let B=I.get(L);B&&I.set(L,B.filter(X=>X.edgeId!==b)),p(M,y(P[0],R),b),p(L,y(P[P.length-1],S),b)}}}f(Xs,"simplifyDetouredEdges");var Kt=.001,Wo=10,je=7;function zn(t,e){let n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;let i=r.x-s.x,u=r.y-s.y;if(!(Math.abs(i)+Math.abs(u)<Kt)){if(Math.abs(u)<=Kt){let l=s.x+Math.sign(i)*Wo;return{left:Math.min(s.x,l),right:Math.max(s.x,l),top:s.y-je,bottom:s.y+je}}if(Math.abs(i)<=Kt){let l=s.y+Math.sign(u)*Wo;return{left:s.x-je,right:s.x+je,top:Math.min(s.y,l),bottom:Math.max(s.y,l)}}return{left:Math.min(s.x,r.x),right:Math.max(s.x,r.x),top:Math.min(s.y,r.y),bottom:Math.max(s.y,r.y)}}}f(zn,"markerClearanceRectFor");function Ys(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}f(Ys,"normalizeRect");function Vn(t,e){let n=pt(e),o=zn(n,!0),s=zn(n,!1);return[o,s].some(r=>r&&Je(t,Ys(r)))}f(Vn,"labelOverlapsOwnMarker");function We(t,e){let n=[];for(let g of t){if(g.isLayoutOnly)continue;let a=g.points;if(!(!a||a.length<2))for(let m=0;m<a.length-1;m++)n.push({edgeId:g.id,p1:a[m],p2:a[m+1]})}let o=[],s=[];for(let g of e.values()){let a=g.isGroup,m=g.parentId;if(a&&!m){let M=qt(g);M&&s.push({id:g.id,rect:M});continue}if(a||g.isEdgeLabel)continue;let v=qt(g);v&&o.push({nodeId:g.id,rect:v})}let r=3,i=1,u=12,c=f((g,a)=>{let m=wn(a,r);for(let{nodeId:v,rect:M}of o)if(v!==g&&Je(m,M))return!0;return!1},"labelOverlapsForeignNode"),l=f((g,a)=>{let m=wn(a,r);for(let v of n)if(v.edgeId!==g&&cn(v.p1,v.p2,m))return!0;return!1},"labelOverlapsForeignEdge"),h=f((g,a,m)=>c(g,m)||l(a,m),"labelOverlapsAnything"),y=[],I=f(g=>{for(let{id:a,rect:m}of s)if(ps(m,g))return a},"findContainingLane"),p=f((g,a)=>y.some(m=>m.labelId!==g&&Je(a,m.rect)),"overlapsPlacedLabel");for(let g of t){if(g.isLayoutOnly)continue;let a=g.labelNodeId;if(!a)continue;let m=e.get(a);if(!m)continue;let v=g.points;if(!v||v.length<2)continue;let M=m.width??0,L=m.height??0;if(M<=0||L<=0)continue;let R=[];for(let Q=0;Q<v.length-1;Q++){let W=v[Q],et=v[Q+1],lt=Math.abs(W.x-et.x),gt=Math.abs(W.y-et.y);lt<Kt&><Kt||lt>=Kt&>>=Kt||R.push({idx:Q,length:lt+gt,orientation:lt>=Kt?"horizontal":"vertical",midX:(W.x+et.x)/2,midY:(W.y+et.y)/2})}if(R.length===0)continue;let S=R.length>=3?R.filter(Q=>Q.idx>0&&Q.idx<R.length-1):R,b=S.length>0?S:R,T=M>=L?"horizontal":"vertical",N=f(Q=>[...Q].sort((W,et)=>{let lt=W.orientation===T,gt=et.orientation===T;if(lt!==gt)return lt?-1:1;let xt=W.length>=(W.orientation==="horizontal"?M:L)+2,vt=et.length>=(et.orientation==="horizontal"?M:L)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),P=R[0],A=R[R.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],k=f((Q,W)=>{let et=v[Q.idx],lt=v[Q.idx+1];return{midX:et.x+(lt.x-et.x)*W,midY:et.y+(lt.y-et.y)*W}},"anchorAtT"),B=f((Q,W,et)=>Math.min(et,Math.max(W,Q)),"clamp"),X=f((Q,W)=>Q.midX>=W.left-Kt&&Q.midX<=W.right+Kt&&Q.midY>=W.top-Kt&&Q.midY<=W.bottom+Kt,"pointInsideRectInclusive"),$=f(Q=>{let W=Re(Q.midX,Q.midY,M,L),et=I(W);if(et)return{laneId:et,anchor:Q,rect:W};let lt=s.find(({rect:te})=>X(Q,te));if(!lt)return;let gt=lt.rect.left+M/2+i,xt=lt.rect.right-M/2-i,vt=lt.rect.top+L/2+i,Vt=lt.rect.bottom-L/2-i;if(gt>xt||vt>Vt)return;let jt={midX:B(Q.midX,gt,xt),midY:B(Q.midY,vt,Vt)},Ut=Re(jt.midX,jt.midY,M,L);return X(Q,Ut)?{laneId:lt.id,anchor:jt,rect:Ut}:void 0},"placementForAnchor"),K=f((Q,W,et)=>Q.orientation==="horizontal"?Math.abs(W.midX-et.x):Math.abs(W.midY-et.y),"distanceAlongSegment"),ct=f((Q,W)=>{let lt=(Q.orientation==="horizontal"?M/2:L/2)+u;if(Q===P){let gt=v[Q.idx];if(K(Q,W,gt)+Kt<lt)return!1}if(Q===A){let gt=v[Q.idx+1];if(K(Q,W,gt)+Kt<lt)return!1}return!0},"labelClearsTerminalEndpoints"),mt=f(Q=>{let W=N(Q);for(let et of W)for(let lt of _){let gt=k(et,lt);if(!ct(et,gt))continue;let xt=$(gt);if(xt&&!Vn(xt.rect,v)&&!p(a,xt.rect)&&!h(a,g.id,xt.rect))return{laneId:xt.laneId,anchor:xt.anchor}}},"tryPool"),Rt=f((Q,W,et=!1)=>{let lt=N(Q);for(let gt of lt){let xt={midX:gt.midX,midY:gt.midY};if(W&&!ct(gt,xt))continue;let vt=$(xt);if(vt&&!Vn(vt.rect,v)&&!p(a,vt.rect)&&!c(a,vt.rect)&&(et||!l(g.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Pt=mt(b)??(b.length<R.length?mt(R):void 0)??Rt(R,!0)??Rt(R,!1)??Rt(R,!1,!0);if(Pt){m.x=Pt.anchor.midX,m.y=Pt.anchor.midY,m.parentId=Pt.laneId;let Q=Re(Pt.anchor.midX,Pt.anchor.midY,M,L),W=y.findIndex(et=>et.labelId===a);W>=0?y[W]={labelId:a,rect:Q}:y.push({labelId:a,rect:Q})}}}f(We,"anchorLabelsToPolyline");var Cn=1e-6,Wr=8,Ko=Wr/2,Kr=3;function jn(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}f(jn,"pairKey");function Gs(t,e){let{nodeInfoById:n,realNodeRects:o}=an(e),s=new Map;for(let i of e){let u=i.id;if(!i.isGroup&&i.isEdgeLabel){s.set(u,{w:i.width??0,h:i.height??0});continue}}let r=f((i,u,c,l)=>{let h=jn(u,c),y=0,I=f(p=>{if(!p)return;let g=s.get(p);if(!g)return;let a=l==="x"?g.w/2:g.h/2;a>y&&(y=a)},"consider");I(i.labelNodeId);for(let p of t){if(p===i||p.isLayoutOnly)continue;let g=p.start,a=p.end;!g||!a||jn(g,a)===h&&I(p.labelNodeId)}return y>0?y+Kr:0},"labelClearanceFor");for(let i of t){if(i.isLayoutOnly)continue;let u=i.points;if(!io(u,Cn))continue;let c=fo(i,n,Cn);if(!c)continue;let{srcId:l,dstId:h,srcInfo:y,dstInfo:I,collinearX:p,collinearY:g}=c;if(p===g)continue;let a,m;if(p){let S=I.cy>y.cy;a={x:y.cx,y:S?y.rect.bottom:y.rect.top},m={x:I.cx,y:S?I.rect.top:I.rect.bottom}}else{let S=I.cx>y.cx;a={x:S?y.rect.right:y.rect.left,y:y.cy},m={x:S?I.rect.left:I.rect.right,y:I.cy}}if(At(a,m,o,[l,h],1))continue;let M=r(i,l,h,p?"x":"y"),L=M>Ko?M:Ko,R=[0,L,-L];for(let S of R){let b={...a},T={...m};if(p){if(b.x+=S,T.x+=S,b.x<=y.rect.left||b.x>=y.rect.right||T.x<=I.rect.left||T.x>=I.rect.right)continue}else if(b.y+=S,T.y+=S,b.y<=y.rect.top||b.y>=y.rect.bottom||T.y<=I.rect.top||T.y>=I.rect.bottom)continue;if(!At(b,T,o,[l,h],1)&&!Ze(b,T,t,i,{epsilon:Cn})){i.points=[b,T];break}}}}f(Gs,"straightenCollinearSiblingDetours");function Un(t,e){let{realNodeRects:l,labelNodeRects:h}=me(e.values()),y=f((b,T)=>Ne(T,.001).map(N=>({...N,edge:b,interior:N.index>=1&&N.index<=T.length-3})),"segmentsFor"),I=f(()=>{let b=[];for(let T of t){if(T.isLayoutOnly)continue;let N=T.points;!N||N.length<2||b.push(...y(T,pt(N)))}return b},"allSegments"),p=f((b,T)=>b.horizontal&&T.horizontal?zt(b.a.x,b.b.x,T.a.x,T.b.x)>=8&&Math.abs(b.a.y-T.a.y)<7:b.vertical&&T.vertical?zt(b.a.y,b.b.y,T.a.y,T.b.y)>=8&&Math.abs(b.a.x-T.a.x)<7:!1,"hasCrowdedParallelTrack"),g=f((b,T)=>{let N=b.start,P=b.end,A=y(b,T);if(A.length!==T.length-1)return!1;let _=[N,P].filter(B=>!!B),k=b.labelNodeId?[b.labelNodeId]:[];for(let B of A)if(At(B.a,B.b,l,_,-2)||At(B.a,B.b,h,k,-2))return!1;for(let B of t){if(B===b||B.isLayoutOnly)continue;let X=B.points;if(!(!X||X.length<2)){for(let $ of A)for(let K of y(B,pt(X)))if(p($,K)||le($.a,$.b,K.a,K.b,.001))return!1}}return!0},"candidateIsSafe"),a=f((b,T)=>{let N=pt(b.edge.points??[]);if(N.length<4||b.index>=N.length-1)return;let P=N.map(A=>({...A}));if(b.horizontal)P[b.index].y+=T,P[b.index+1].y+=T;else if(b.vertical)P[b.index].x+=T,P[b.index+1].x+=T;else return;return y(b.edge,P).length===P.length-1?P:void 0},"shiftedCandidate"),m=f((b,T)=>({x:b.x??(T.left+T.right)/2,y:b.y??(T.top+T.bottom)/2}),"nodeCenter"),v=f(b=>{let T=b.edge,N=pt(T.points??[]);if(N.length!==4||b.index!==1)return;let P=T.start?e.get(T.start):void 0,A=T.end?e.get(T.end):void 0,_=P?qt(P):void 0,k=A?qt(A):void 0,B=N.slice(b.index+2);if(!(!P||!A||!_||!k||B.length===0))return{sourceCenter:m(P,_),targetCenter:m(A,k),sourceRect:_,tail:B}},"sourceDetourContextFor"),M=f((b,T,N,P,A,_)=>{let k=P.y>=N.y,B=k?A.bottom:A.top,X=B+(k?20:-20);if(k&&b.b.y<=X+.001||!k&&b.b.y>=X-.001)return;let $=b.a.x+T;return pt([{x:N.x,y:B},{x:N.x,y:X},{x:$,y:X},{x:$,y:b.b.y},..._],.001)},"verticalSourceDetour"),L=f((b,T,N,P,A,_)=>{let k=P.x>=N.x,B=k?A.right:A.left,X=B+(k?20:-20);if(k&&b.b.x<=X+.001||!k&&b.b.x>=X-.001)return;let $=b.a.y+T;return pt([{x:B,y:N.y},{x:X,y:N.y},{x:X,y:$},{x:b.b.x,y:$},..._],.001)},"horizontalSourceDetour"),R=f((b,T)=>{let N=v(b);if(N){if(b.vertical)return M(b,T,N.sourceCenter,N.targetCenter,N.sourceRect,N.tail);if(b.horizontal)return L(b,T,N.sourceCenter,N.targetCenter,N.sourceRect,N.tail)}},"sourceDetourCandidate"),S=[-7,7,-14,14,-21,21];for(let b=0;b<12;b++){let T=I(),N=!1;for(let P=0;P<T.length&&!N;P++)for(let A=P+1;A<T.length&&!N;A++){let _=T[P],k=T[A];if(_.edge===k.edge||!p(_,k))continue;let B=[_,k].filter(X=>X.interior);for(let X of B){for(let $ of S){let K=a(X,$);if(K&&g(X.edge,K)){X.edge.points=K,N=!0;break}let ct=R(X,$);if(ct&&g(X.edge,ct)){X.edge.points=ct,N=!0;break}}if(N)break}}if(!N)return}}f(Un,"nudgeSharedInteriorSubpaths");function $s(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,u=o.y-n.y,c=s*u-r*i;if(Math.abs(c)<1e-10)return!1;let l=n.x-t.x,h=n.y-t.y,y=(l*u-h*i)/c,I=(l*r-h*s)/c,p=.01;return y>p&&y<1-p&&I>p&&I<1-p}f($s,"segmentsIntersect");function zs(t){let e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;let s=ms(e),r=1,i=[];for(let c of n){if(c.isLayoutOnly)continue;let l=c.points;if(!l||l.length<2)continue;let h=c.start,y=c.end,I=c.labelNodeId,p=c.id??`${h}->${y}`;for(let g of s)if(!(g.nodeId===h||g.nodeId===y)&&!(I&&g.nodeId===I)){for(let a=0;a<l.length-1;a++)if(cn(l[a],l[a+1],g,-r)){o.push({type:"edge-node-overlap",edgeId:p,targetId:g.nodeId,detail:`segment ${a} passes through node "${g.nodeId}"`});break}}for(let g=0;g<l.length-1;g++)i.push({edgeId:p,start:h,end:y,p1:l[g],p2:l[g+1]})}let u=new Set;for(let c=0;c<i.length;c++)for(let l=c+1;l<i.length;l++){let h=i[c],y=i[l];if(h.edgeId!==y.edgeId&&!(h.start===y.start||h.start===y.end||h.end===y.start||h.end===y.end)&&$s(h.p1,h.p2,y.p1,y.p2)){let I=h.edgeId<y.edgeId?`${h.edgeId}|${y.edgeId}`:`${y.edgeId}|${h.edgeId}`;u.has(I)||(u.add(I),o.push({type:"edge-edge-crossing",edgeId:h.edgeId,targetId:y.edgeId,detail:`edges "${h.edgeId}" and "${y.edgeId}" cross`}))}}if(o.length>0){let c=o.filter(h=>h.type==="edge-node-overlap").length,l=o.filter(h=>h.type==="edge-edge-crossing").length;Be.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${c} edge-node overlap(s), ${l} edge crossing(s)`);for(let h of o)Be.warn(`[SWIMLANE_VALIDATE] ${h.type}: ${h.detail}`)}return o}f(zs,"validateSwimlanesLayout");function Vs(t,e){let n=t.nodes??[],o=t.edges??[],s=n.filter(u=>!u.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!Ns(t,e)||e==="BT"&&s.length>0&&!Rs(t))return;for(let u of o){if(u.isLayoutOnly)continue;let c=u.points;!c||c.length<2||(u.points=ae(Qe(c)))}Xs(o,n),Gs(o,n),Os(o,n);let r=new Map;for(let u of n)r.set(String(u.id),u);We(o,r),Is(o,r),Bs(o,r),Un(o,r),Ps(o,r),Fs(o,r),Yn(o,r),ks(o,r);let i=f(()=>{Hs(o,r),_s(o,r),Ds(o,r),We(o,r),Hn(o,r),Yn(o,r),We(o,r),Hn(o,r)},"finalizeRenderedEdges");i(),Un(o,r),i(),Gn(o,r),$n(o,r),Gn(o,r),$n(o,r)}f(Vs,"postProcessSwimlaneLayout");function ye(t){let e=new Map(t.nodeById),n=new Set,o=[];for(let r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;let i=`${r.id}:${r.src}->${r.dst}`;n.has(i)||(n.add(i),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}f(ye,"normalizeGraph");function yo(t,e){return t.edges.filter(n=>n.dst===e)}f(yo,"incoming");function js(t){let e=new Map;for(let n of t.nodes)e.set(n,[]);for(let n of t.edges)e.get(n.src).push(n.dst);return e}f(js,"buildSuccessorMap");function xo(t){let e=js(t);for(let n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}f(xo,"buildSortedSuccessorMap");function bo(t){let e=new Map;for(let n of t.nodes)e.set(n,0);for(let n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}f(bo,"buildInDegreeMap");function Mo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}f(Mo,"sortedZeroInDegreeNodes");function ln(t,e=()=>!0){let n=new Map,o=new Map;for(let s of t.nodes)n.set(s,[]),o.set(s,[]);for(let s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}f(ln,"buildPredecessorSuccessorMaps");function Io(t,e,n,o){let s=0;for(let i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));let r=Array.from({length:s+1},()=>[]);for(let i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}f(Io,"buildLayersFromRanks");function ke(t){let e=bo(t),n=Mo(e),o=[],s=xo(t);for(;n.length;){let r=n.shift();o.push(r);for(let i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let u=0;for(;u<n.length&&n[u]<i;)u++;n.splice(u,0,i)}}return o.length===t.nodes.length?o:null}f(ke,"topoSortIfAcyclic");function Oe(t){let e=new Map,n=0;for(let o of t)e.set(o,n),n++;return e}f(Oe,"buildLayerIndex");function So(t){let e=new Array(t.length),n=f((o,s)=>{if(s-o<=1)return 0;let r=o+s>>1,i=n(o,r)+n(r,s),u=o,c=r,l=o;for(;u<r||c<s;)c>=s||u<r&&t[u]<=t[c]?e[l++]=t[u++]:(e[l++]=t[c++],i+=r-u);for(let h=o;h<s;h++)t[h]=e[h];return i},"count");return n(0,t.length)}f(So,"countInversions");function Us(t){let e=ye(t),n=new Map;for(let h of e.nodes)n.set(h,[]);for(let h of e.edges)n.get(h.src).push(h);for(let h of n.values())h.sort((y,I)=>y.dst===I.dst?y.id.localeCompare(I.id):y.dst.localeCompare(I.dst));let o=Object.create(null);for(let h of e.nodes)o[h]=0;let s=[],r=f(h=>{o[h]=1;for(let y of n.get(h)??[]){let I=y.dst;o[I]===0?r(I):o[I]===1&&s.push(y)}o[h]=2},"dfs"),i=[...e.nodes].sort((h,y)=>h.localeCompare(y));for(let h of i)o[h]===0&&r(h);let u=new Set(s.map(h=>`${h.id}:${h.src}->${h.dst}`)),c=e.edges.map(h=>u.has(`${h.id}:${h.src}->${h.dst}`)?{id:h.id,src:h.dst,dst:h.src,weight:h.weight,ref:h.ref}:h);return{acyclic:{nodes:[...e.nodes],edges:c,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}f(Us,"removeCycles_DFS");function Ws(t){let e=new Map,n=f(o=>{if(e.has(o))return e.get(o);let s=t.nodeById.get(o);if(!s)return e.set(o,null),null;let r=s.parentId;if(!r)return e.set(o,null),null;let u=n(r)??r;return e.set(o,u),u},"resolve");for(let o of t.nodes)n(o);return e}f(Ws,"buildTopLaneMap");function fe(t){let e=Ws(t);return n=>e.get(n)??null}f(fe,"createTopLaneResolver");function fn(t){let e=[];for(let n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}f(fn,"buildTopLaneOrder");function Co(t,e){let n=fn(t);if(!e||e.length===0)return n;let o=new Set(n),s=new Set,r=[];for(let i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(let i of n)s.has(i)||r.push(i);return r}f(Co,"resolveTopLaneOrder");var qr={EPSILON:1e-6},sn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},qo={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Ks(t,e){let n=ye(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=ln(n);for(let S of r.values())S.sort((b,T)=>b.localeCompare(T));let i=ke(n)??[...n.nodes].sort((S,b)=>S.localeCompare(b)),u=new Map;for(let[S,b]of i.entries())u.set(b,S);let c=new Map,l=new Map;for(let S of n.nodes)l.set(S,[]);for(let S of i){let b=(r.get(S)??[]).filter(T=>c.has(T));if(b.length>0){let T=qs(S,b,{laneOf:o,rankHint:s,topoIndex:u});c.set(S,T),l.get(T).push(S)}else c.has(S)||c.set(S,null)}for(let S of n.nodes)c.has(S)||c.set(S,null);let h=new Set;for(let S of n.nodes)(c.get(S)??null)===null&&h.add(S);let y=[...h].sort((S,b)=>{let T=u.get(S)??0,N=u.get(b)??0;return T===N?S.localeCompare(b):T-N}),I=Js(n),p=new Map;for(let[S,b]of I.entries())p.set(S,[...b].sort((T,N)=>T.localeCompare(N)));let g=Zs(p),a=Qs(p),m=new Map;for(let S of n.nodes)m.set(S,[]);for(let S of a)for(let b of S.nodes){let T=m.get(b);T?T.push(S.id):m.set(b,[S.id])}let v=[],M=[],L=new Set,R=f(S=>{if(!L.has(S)){L.add(S),v.push(S);for(let b of l.get(S)??[])R(b);M.push(S)}},"walk");for(let S of y)R(S);for(let S of i)R(S);return{parent:c,children:l,roots:y,componentOf:g,blocks:a,nodeBlocks:m,adjacency:p,preorder:v,postorder:M,topologicalOrder:i}}f(Ks,"buildDrivingTree");function qs(t,e,n){let o=n.laneOf(t);return[...e].sort((r,i)=>{let u=n.laneOf(r),c=n.laneOf(i),l=u!=null&&u===o,h=c!=null&&c===o;if(l!==h)return l?-1:1;let y=n.rankHint?.[r],I=n.rankHint?.[i];if(y!=null&&I!=null&&y!==I)return I-y;let p=n.topoIndex.get(r)??0,g=n.topoIndex.get(i)??0;return p!==g?p-g:r.localeCompare(i)})[0]}f(qs,"chooseParent");function Js(t){let e=new Map;for(let n of t.nodes)e.set(n,new Set);for(let n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}f(Js,"buildAdjacency");function Zs(t){let e=new Map,n=0;for(let o of t.keys()){if(e.has(o))continue;let s=[o];for(;s.length>0;){let r=s.pop();if(!e.has(r)){e.set(r,n);for(let i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}f(Zs,"assignComponents");function Qs(t){let e=new Map,n=new Map,o=[],s=[],r=0,i=f((u,c)=>{e.set(u,++r),n.set(u,r);for(let l of t.get(u)??[])l!==c&&(e.has(l)?(e.get(l)??0)<(e.get(u)??0)&&(o.push([u,l]),n.set(u,Math.min(n.get(u)??r,e.get(l)??r))):(o.push([u,l]),i(l,u),n.set(u,Math.min(n.get(u)??r,n.get(l)??r)),(n.get(l)??0)>=(e.get(u)??0)&&s.push(tr(u,l,o,s.length))))},"visit");for(let u of t.keys())e.has(u)||i(u,null);return s}f(Qs,"computeBlocks");function tr(t,e,n,o){let s=[],r=new Set;for(;n.length>0;){let i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}f(tr,"popBlock");function er(t,e,n){let o=[...t.nodes],s=new Map;for(let[M,L]of o.entries())s.set(L,M);let r=o.length,i=new Array(r).fill(-1),u=new Array(r).fill(0),c=[],l=new Set;for(let M of o){let L=n.parent.get(M)??null,R=s.get(M);R!=null&&L==null&&(i[R]=-1,u[R]=0,l.has(M)||(l.add(M),c.push(M)))}for(;c.length>0;){let M=c.shift(),L=s.get(M);if(L==null)continue;let R=n.children.get(M)??[];for(let S of R){if(l.has(S))continue;let b=s.get(S);b!=null&&(i[b]=L,u[b]=u[L]+1,l.add(S),c.push(S))}}for(let M of o){if(l.has(M))continue;let L=s.get(M);L!=null&&(i[L]=-1,u[L]=0,l.add(M))}let h=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),y=Array.from({length:h},()=>new Array(r).fill(-1));for(let M=0;M<r;M++)y[0][M]=i[M];for(let M=1;M<h;M++)for(let L=0;L<r;L++){let R=y[M-1][L];y[M][L]=R===-1?-1:y[M-1][R]}let I=f((M,L)=>{if(M===-1||L===-1)return-1;u[M]<u[L]&&([M,L]=[L,M]);let R=u[M]-u[L];for(let S=0;S<h;S++)if(R>>S&1&&(M=y[S][M],M===-1))return-1;if(M===L)return M;for(let S=h-1;S>=0;S--){let b=y[S][M],T=y[S][L];b===-1||T===-1||b!==T&&(M=b,L=T)}return y[0][M]},"lcaIndex"),p=Array.from({length:r},()=>new Map);for(let M of t.edges){let L=M.src,R=M.dst,S=e[L],b=e[R];if(S==null||b==null||(S>b&&([L,R]=[R,L],[S,b]=[b,S]),S==null||b==null||S===b))continue;let T=s.get(L),N=s.get(R);if(T==null||N==null)continue;let P=I(T,N);if(P===-1)continue;let A=p[P];for(let _=S;_<b;_++)A.set(_,(A.get(_)??0)+1)}let g=new Map,a=f((M,L)=>{if(L.size!==0)for(let[R,S]of L)M.set(R,(M.get(R)??0)+S)},"mergeInto"),m=new Set,v=f(M=>{let L=s.get(M);m.add(M);let R=L==null?void 0:p[L],S=R?new Map(R):new Map,b=n.children.get(M)??[];for(let T of b){let N=v(T),P=e[M];if(P!=null){let A=g.get(M);A||(A=new Map,g.set(M,A));let _=N.get(P)??0,k=e[T];k!=null&&k>P&&(_+=1),A.set(T,_)}a(S,N)}return S},"dfs");for(let M of n.roots)m.has(M)||v(M);for(let M of o)m.has(M)||v(M);return g}f(er,"computeSubtreeCrossCounts");function nr(t,e,n){let o=new Map,s=f(r=>{let i=n[r]??0,u=[...e.get(r)??[]];u.sort(vo(n));for(let c of u){s(c);let l=o.get(c);l!=null&&(i=Math.min(i,l))}o.set(r,i)},"annotate");for(let r of t)s(r);return o}f(nr,"annotateMinimumLayers");function vo(t){return(e,n)=>{let o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}f(vo,"compareByRankThenId");function or(t,e,n,o){let s=0;for(let c of e){let l=n[c]??0;l>s&&(s=l)}let r=Array.from({length:s+1},()=>[]),i=new Set,u=f(c=>{if(i.has(c))return;i.add(c);let l=n[c]??0;r[l]||(r[l]=[]),r[l].push(c);for(let h of o(c))u(h)},"emit");for(let c of t)u(c);for(let c of e)if(!i.has(c)){let l=n[c]??0;r[l]||(r[l]=[]),r[l].push(c),i.add(c)}return r}f(or,"emitNodesInTreeOrder");function sr(t){let e=[];for(let n of t){let o=new Set,s=[];for(let r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}f(sr,"deduplicateLayers");function rr(t,e,n,o){return s=>{let r=t.get(s)??[];if(r.length===0)return[];let i=e[s]??0,u=[],c=[],l=n.get(s);for(let h of r){let y=o.get(h)??i;y>i?u.push({child:h,min:y}):c.push(h)}return u.sort((h,y)=>h.min===y.min?h.child.localeCompare(y.child):h.min-y.min),c.sort((h,y)=>{let I=l?.get(h)??0,p=l?.get(y)??0;if(I!==p)return I-p;let g=o.get(h)??i,a=o.get(y)??i;return g!==a?g-a:h.localeCompare(y)}),[...u.map(h=>h.child),...c]}}f(rr,"createChildOrderer");function rn(t,e,n){let o=Ks(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(let y of t.nodes)s.has(y)||s.set(y,[]);let i=er(t,e,o),u=[...r].sort(vo(e)),c=nr(u,s,e),l=rr(s,e,i,c),h=or(u,t.nodes,e,l);return h=sr(h),h}f(rn,"buildMultitreeLayerOrder");function ir(t,e,n){let o=new Set(t),s=new Set(e),r=Oe(e),i=[];for(let u of n)o.has(u.src)&&s.has(u.dst)&&i.push(r.get(u.dst));return So(i)}f(ir,"countCrossingsBetweenAdjacent");function Wn(t,e,n){let o=[];for(let r of e){let i=n[r.src],u=n[r.dst];if(i==null||u==null||i===u)continue;let c=r.src,l=r.dst,h=i,y=u;i>u&&(c=r.dst,l=r.src,h=u,y=i);for(let I=h;I<y;I++)o.push({id:`${r.id}@${I}`,src:c,dst:l,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=ir(t[r],t[r+1],o);return s}f(Wn,"totalCrossings");function cr(t,e){let n={...e},{preds:o}=ln(t),s=fe(t),r=rn(t,n,s),i=Wn(r,t.edges,n),u=sn.MAX_CROSSING_OPTIMIZATION_PASSES;for(let c=0;c<u;c++){let l=!1,h=[...t.nodes].sort((y,I)=>(n[I]??0)-(n[y]??0));for(let y of h){let I=n[y]??0;if(I===0)continue;let p=0;for(let v of o.get(y)??[])p=Math.max(p,(n[v]??0)+1);if(p>=I)continue;let g=I;n[y]=p;let a=rn(t,n,s),m=Wn(a,t.edges,n);m<i?(i=m,l=!0):n[y]=g}if(!l)break}return n}f(cr,"optimizeRanksByCrossings");function ar(t,e){let n=fe(t),o=[...t.nodes].sort((s,r)=>(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(let s of o){let r=n(s);if(!r)continue;let i=t.edges.filter(a=>a.src===s);if(i.length===0)continue;let u=!1,c=0;for(let a of i){let m=n(a.dst);m==null||m===r?u=!0:c++}if(c===0||u)continue;let l=0,h=!1;for(let a of t.edges){if(a.dst!==s)continue;let m=n(a.src);m&&(m===r?h=!0:l++)}if(l>0||!h)continue;let y=e[s]??0,I=y+c,p=0;for(let a of t.edges)a.dst===s&&(p=Math.max(p,(e[a.src]??0)+1));let g=Math.max(y,p,I);g!==y&&(e[s]=g)}}f(ar,"adjustCrossLaneSources");function lr(t,e){let n=ye(t),o=ke(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=fe(n),i=Object.create(null);for(let c of o){let l=yo(n,c),h=e?.ignoreCrossLaneEdges?l.filter(y=>{let I=r(y.src),p=r(c);return!I||!p?!0:I===p}):l;if(h.length===0)i[c]=0;else if(s&&h.length===1){let y=h[0].src,I=r(y),p=r(c);I!==p?i[c]=i[y]??0:i[c]=(i[y]??0)+1}else{let y=-1/0;for(let I of h)y=Math.max(y,(i[I.src]??0)+1);i[c]=y===-1/0?0:y}}return(e?.optimizeRanksByCrossings??!1)&&(i=cr(n,i)),e?.ignoreCrossLaneEdges&&ar(n,i),{layers:rn(n,i,r),rankOf:i,dummy:new Set}}f(lr,"assignLayers_LongestPath");function fr(t,e){let n=ye(t),s={...lr(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=fe(n),{preds:i,succs:u}=ln(n,g=>{if(e?.ignoreCrossLaneEdges){let a=r(g.src),m=r(g.dst);if(a&&m&&a!==m)return!1}return!0}),c=ke(n)??[...n.nodes],l=[...c].reverse(),h=f((g,a)=>{let m=0;for(let L of i.get(g)??[])m=Math.max(m,(s[L]??0)+1);let v=Number.POSITIVE_INFINITY,M=u.get(g)??[];return M.length>0&&(v=Math.min(...M.map(L=>(s[L]??0)-1))),Number.isFinite(v)||(v=Math.max(m,a)),Math.min(Math.max(a,m),v)},"clampFeasible"),y=sn.GRAVITY_ITERATIONS,I=f(g=>{let a=!1;for(let m of g){let v=i.get(m)??[],M=u.get(m)??[];if(v.length===0&&M.length===0)continue;let L=v.length>0?v.reduce((T,N)=>T+(s[N]??0)+1,0)/v.length:s[m]??0,R=M.length>0?M.reduce((T,N)=>T+(s[N]??0)-1,0)/M.length:s[m]??0,S=Math.round((L+R)/2),b=h(m,S);b!==s[m]&&(s[m]=b,a=!0)}return a},"relaxOrder");for(let g=0;g<y;g++){let a=I(c),m=I(l);if(!a&&!m)break}for(let g of c){let a=0;for(let m of i.get(g)??[])a=Math.max(a,(s[m]??0)+1);(s[g]??0)<a&&(s[g]=a)}for(let g of l){let a=u.get(g)??[];if(a.length>0){let m=Math.min(...a.map(v=>(s[v]??0)-1));(s[g]??0)>m&&(s[g]=m)}}return{layers:Io(n,c,s),rankOf:s,dummy:new Set}}f(fr,"assignLayers_Gravity");function dr(t){let e=bo(t),n=xo(t),o=Mo(e),s=[];for(;o.length>0;){let r=[];for(let i of o){s.push(i);for(let u of n.get(i)??[])e.set(u,(e.get(u)??0)-1),(e.get(u)??0)===0&&r.push(u)}o=r.sort((i,u)=>i.localeCompare(u))}return s.length===t.nodes.length?s:null}f(dr,"topoSortByGenerationIfAcyclic");function ur(t,e){let n=ye(t),o=e?.direction==="LR"?dr(n)??[...n.nodes].sort():ke(n)??[...n.nodes].sort(),s=fe(n),r=f(h=>s(h)??h,"laneOf"),i=Object.create(null),u=new Map,c=f((h,y)=>e?.ignoreCrossLaneEdges??!0?r(h)===r(y)?1:0:1,"edgeWeight");for(let h of o){if(n.nodeById.get(h)?.isGroup)continue;let I=yo(n,h),p=0;if(I.length>0)for(let v of I){let M=v.src,L=i[M]??0;p=Math.max(p,L+c(M,h))}let g=r(h),a=u.get(g)??0,m=Math.max(p,a);i[h]=m,u.set(g,m+1)}return{layers:Io(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}f(ur,"assignLayers_LaneAwareCompact");function hr(t,e){let n=ye(e),{rankOf:o}=t,s=t.layers.map(p=>[...p]),r=new Set(t.dummy?[...t.dummy]:[]),i=0,u=new Map(n.nodeById),c=f(p=>{let g=`placeholder-${i++}`,a={id:g,isGroup:!1,isDummy:!0,width:0,height:0};for(u.set(g,a),r.add(g);s.length<=p;)s.push([]);return s[p].push(g),o[g]=p,g},"addDummyAt"),l=[...n.edges].sort((p,g)=>p.id===g.id?p.src===g.src?p.dst.localeCompare(g.dst):p.src.localeCompare(g.src):p.id.localeCompare(g.id)),h=[];for(let p of l){let g=o[p.src]??0,a=o[p.dst]??0;if(a-g<=1){h.push(p);continue}let m=p.src;for(let M=g+1,L=0;M<a;M++,L++){let R=c(M);h.push({id:`${p.id}#${L}`,src:m,dst:R,weight:p.weight,ref:p.ref}),m=R}let v=a-g-2;h.push({id:`${p.id}#${Math.max(v+1,0)}`,src:m,dst:p.dst,weight:p.weight,ref:p.ref})}let I={nodes:[...n.nodes,...[...r].filter(p=>!n.nodes.includes(p))],edges:h,layout:n.layout,nodeById:u};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}f(hr,"makeProperLayering");function Kn(t){let e=t.length;if(e===0)return Number.POSITIVE_INFINITY;let n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}f(Kn,"median");function qn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}f(qn,"barycenter");function gr(t,e,n,o){let s=new Map;for(let r of t)s.set(r,[]);for(let r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}f(gr,"neighborPositionsFor");function pr(t,e,n){let o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}f(pr,"currentOrderTieBreak");function Jn(t,e,n){let o=new Set(t),s=new Set(e),r=Oe(t),i=Oe(e),u=[];for(let l of n)o.has(l.src)&&s.has(l.dst)&&u.push({u:r.get(l.src),v:i.get(l.dst)});u.sort((l,h)=>l.u===h.u?l.v-h.v:l.u-h.u);let c=u.map(l=>l.v);return So(c)}f(Jn,"countCrossingsBetweenAdjacent");function Ke(t,e,n){return[...t].sort((o,s)=>{let r=Kn(e.get(o)??[]),i=Kn(e.get(s)??[]);return r===i?pr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}f(Ke,"sortByHeuristic");function Zn(t,e,n,o,s,r){let i=Oe(t),u=Oe(e),c=gr(e,i,n,o);if(!s||!r||r.length===0)return Ke(e,c,u);let l=new Map;for(let I of e){let p=s(I),g=l.get(p)??[];g.push(I),l.set(p,g)}let h=[];for(let I of r){let p=l.get(I);if(!p||p.length===0)continue;let g=Ke(p,c,u);h.push(...g)}let y=l.get(null);if(y&&y.length>0){let I=Ke(y,c,u);for(let p of I){let g=qn(c.get(p)??[]),a=h.length;if(isFinite(g))for(let[m,v]of h.entries()){let M=qn(c.get(v)??[]);if(g<M){a=m;break}}h.splice(a,0,p)}}return h}f(Zn,"reorderLayer");function Qn(t,e,n,o,s){let r=[...e],i=new Set(t),u=new Set(e),c=o?new Set(o):null,l=n.filter(a=>i.has(a.src)&&u.has(a.dst)),h=c?n.filter(a=>u.has(a.src)&&c.has(a.dst)):void 0,y=f(a=>{let m=Jn(t,a,l);return h&&o&&(m+=Jn(a,o,h)),m},"crossingScore"),I=s?new Map:null;if(s&&I)for(let a of e)I.set(a,s(a));let p=!0,g=y(r);for(;p;){p=!1;for(let a=0;a+1<r.length;a++){if(I){let M=I.get(r[a]),L=I.get(r[a+1]);if(M!==L)continue}let m=g;[r[a],r[a+1]]=[r[a+1],r[a]];let v=y(r);v<m?(g=v,p=!0):[r[a],r[a+1]]=[r[a+1],r[a]]}}return r}f(Qn,"transposeImprove");function mr(t,e,n){let o=t.layers.map(u=>[...u]),s=e.edges,r=fe(e),i=Co(e,n?.laneOrder);for(let u=0;u<3;u++){for(let c=1;c<o.length;c++)o[c]=Zn(o[c-1],o[c],s,"down",r,i),o[c]=Qn(o[c-1],o[c],s,o[c+1],r);for(let c=o.length-2;c>=0;c--)o[c]=Zn(o[c+1],o[c],s,"up",r,i),o[c]=Qn(o[c+1],o[c],s,o[c-1],r)}return{layers:o}}f(mr,"orderLayers");function yr(t,e,n){let o=n?.layerGap??qo.DEFAULT_LAYER_GAP,s=n?.nodeGap??qo.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",u=i==="LR"||i==="RL",c=t.layers,l=Object.create(null),h=Object.create(null),y=f(A=>e.nodeById.get(A),"getNode"),I=f(A=>y(A)?.width??0,"getWidth"),p=f(A=>y(A)?.height??0,"getHeight"),g=fe(e),a=Co(e,n?.laneOrder),m=c.map(A=>A.reduce((_,k)=>Math.max(_,p(k)),0)),v=[];if(u)for(let A=0;A+1<c.length;A++){let _=c[A].reduce((mt,Rt)=>Math.max(mt,I(Rt)),0),k=c[A+1].reduce((mt,Rt)=>Math.max(mt,I(Rt)),0),B=m[A],X=m[A+1],$=B/2+X/2,K=(_+k)/2,ct=Math.max(0,K-$-o);v.push(ct)}let M=new Set;for(let A of c)for(let _ of A)M.add(g(_));let L=M.has(null),R=a.filter(A=>M.has(A)),S=[...L?[null]:[],...R],b=Object.create(null);for(let A of R)b[A]=0;L&&(b.null=0);for(let A of c){let _=Object.create(null),k=[];for(let B of A){let X=g(B);X===null?k.push(B):(_[X]||=[]).push(B)}for(let[B,X]of Object.entries(_)){let $=X.reduce((K,ct)=>K+I(ct),0)+s*Math.max(0,X.length-1);b[B]=Math.max(b[B]??0,$)}if(L&&k.length){let B=k.reduce((X,$)=>X+I($),0)+s*Math.max(0,k.length-1);b.null=Math.max(b.null??0,B)}}let T=new Map;{let A=S.map(B=>(B===null?b.null:b[B])??0),k=-(A.reduce((B,X)=>B+X,0)+r*Math.max(0,S.length-1))/2;for(let B=0;B<S.length;B++){let X=S[B],$=A[B]??0,K=k+$/2;T.set(X,K),k+=$,B<S.length-1&&(k+=r)}}let N=0;for(let[A,_]of c.entries()){let k=m[A]??0,B=new Map;for(let $ of _){let K=g($),ct=B.get(K)??[];ct.push($),B.set(K,ct)}for(let $ of S){let K=B.get($)??[];if(K.length===0)continue;let ct=T.get($);if(K.length===1){let mt=K[0];l[mt]=ct,h[mt]=N+k/2}else{let mt=K.map(Q=>I(Q)),Rt=mt.reduce((Q,W)=>Q+W,0)+s*(K.length-1),Pt=ct-Rt/2;for(let[Q,W]of K.entries()){let et=mt[Q];l[W]=Pt+et/2,h[W]=N+k/2,Pt+=et+s}}}let X=v[A]??0;N+=k+o+X}let P=new Map;for(let A of e.edges){let _=A.ref.id;P.has(_)||P.set(_,[]),P.get(_).push(A)}for(let[,A]of P){if(A.length===0)continue;let _=A[0].ref,k=_.start,B=_.end;if(k==null||B==null)continue;let X=Math.round(((l[k]??0)+(l[B]??0))/2),$=new Set;for(let K of A)$.add(K.src),$.add(K.dst);for(let K of $){if(K===k||K===B)continue;e.nodeById.get(K)?.isDummy&&(l[K]=X)}}return{x:l,y:h}}f(yr,"assignCoordinates");var xr=8;function br(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}f(br,"hashString");function Mr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}f(Mr,"mulberry32");function Ir(t,e){let n=[...t],o=Mr(e);for(let s=n.length-1;s>0;s--){let r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}f(Ir,"deterministicShuffle");function Sr(t,e){let n=0;for(let[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}f(Sr,"sourceDistance");function to(t,e){let n=new Map;for(let[s,r]of t.entries())n.set(r,s);let o=0;for(let{a:s,b:r,weight:i}of e){let u=n.get(s),c=n.get(r);u==null||c==null||(o+=i*Math.abs(u-c))}return o}f(to,"laneArrangementCost");function Cr(t){let e=fn(t);if(e.length<2)return[];let n=new Map(e.map((r,i)=>[r,i])),o=fe(t),s=new Map;for(let r of t.layout.edges??[]){if(r.isLayoutOnly)continue;let i=typeof r.start=="string"?r.start:void 0,u=typeof r.end=="string"?r.end:void 0;if(!i||!u||!t.nodeById.has(i)||!t.nodeById.has(u))continue;let c=o(i),l=o(u);if(!c||!l||c===l)continue;let h=n.get(c),y=n.get(l);if(h==null||y==null)continue;let[I,p]=h<=y?[c,l]:[l,c],g=`${I}\0${p}`,a=s.get(g);a?a.weight++:s.set(g,{a:I,b:p,weight:1})}return[...s.values()]}f(Cr,"buildWeightedLaneEdges");function eo(t,e,n){let o=[...t],s=to(o,e),r=!0,i=0,u=Math.max(1,o.length);for(;r&&i<u;){r=!1,i++;for(let c=0;c+1<o.length;c++){[o[c],o[c+1]]=[o[c+1],o[c]];let l=to(o,e);l<s?(s=l,r=!0):[o[c],o[c+1]]=[o[c+1],o[c]]}}return{order:o,cost:s,sourceDistance:Sr(o,n)}}f(eo,"greedySwitch");function vr(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}f(vr,"isBetterCandidate");function Lr(t,e,n){let o=[...e].sort((s,r)=>s.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return br(`${t.join("|")}#${o}#${n}`)}f(Lr,"seedForRestart");function Er(t,e={}){let n=fn(t);if(n.length<2)return n;let o=Cr(t);if(o.length===0)return n;let s=new Map(n.map((u,c)=>[u,c])),r=eo(n,o,s),i=Math.max(0,e.restarts??xr);for(let u=0;u<i;u++){let c=Lr(n,o,u),l=Ir(n,c),h=eo(l,o,s);vr(h,r)&&(r=h)}return r.order}f(Er,"optimizeTopLaneOrder");function Tr(t,e){let n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,s=ye(t),r=e?.automaticLaneOrdering?Er(s,{restarts:xr}):void 0,i=Us(s),u=i.acyclic,c=n?ur(u,{compactSingleInput:e?.compactSingleInput??sn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):fr(u,{compactSingleInput:e?.compactSingleInput??sn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:l,graphWithDummies:h}=hr(c,u),y=mr(l,h,{laneOrder:r}),I=yr(y,h,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:r});return{acyclic:u,reversed:i.reversed,layering:l,ordered:y,coordinates:I}}f(Tr,"sugiyamaLayout");var at=qr.EPSILON,Jr=8,be=15,we=15,Ue=25,ne=20,vn=10;function no(t,e,n){let o=t.x??0,s=t.y??0,r=e.x-o,i=e.y-s,u=Math.abs(r),c=Math.abs(i);return u<at&&c<at?n:c>at&&c*3>=u?i>0?"bottom":"top":u>at?r>0?"right":"left":n}f(no,"chooseOrthogonalSide");function oo(t,e){return Math.abs(t.to-e.from)<at||Math.abs(t.to-e.to)<at?t.to:t.from}f(oo,"sharedLineEndpointCoord");function Me(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}f(Me,"pointOnLine");function wr(t,e){let n=t.nodes??[],o=t.edges??[],s=[];for(let d of o)d.isLayoutOnly||s.push({...d,__originalEdge:d});let r=new Map,i=new Map,u=[],c=e==="LR";for(let d of n)r.set(d.id,d);let l=n.filter(d=>d.isGroup&&!d.parentId);for(let d of l){let x={id:d.id},C=f(E=>{i.set(E.id,x),n.filter(w=>w.parentId===E.id).forEach(C)},"assignLane");C(d)}let h=n.filter(d=>!d.isGroup&&!d.isEdgeLabel).map(d=>{let x=d.width??10,C=d.height??10,E=d.x??0,w=d.y??0,F=Jr;return{nodeId:d.id,minX:E-x/2-F,maxX:E+x/2+F,minY:w-C/2-F,maxY:w+C/2+F,visualXHalfExtent:c?C/2+F:x/2+F}}),y=f((d,x,C,E)=>{let w=u.find(F=>F.orientation===d&&Math.abs(F.coord-x)<1);return w||(w={id:`pipe-${d}-${x.toFixed(0)}`,orientation:d,coord:x,spanMin:C,spanMax:E,tracks:[]},u.push(w)),w.spanMin=Math.min(w.spanMin,C),w.spanMax=Math.max(w.spanMax,E),w},"getOrAddPipe"),I=f((d,x)=>{let C=d.width??10,E=d.height??10,w=d.x??0,F=d.y??0;switch(x){case"top":return{x:w,y:F-E/2};case"bottom":return{x:w,y:F+E/2};case"left":return{x:w-C/2,y:F};case"right":return{x:w+C/2,y:F}}},"portForSide"),p=f((d,x,C)=>I(d,no(d,x,C?"bottom":"top")),"getOrthogonalPort"),g=[],a=[],m=new Set,v=1e3,M=f((d,x,C)=>{if(g.length===0)return 0;let E=Math.abs(x.y-C.y)<at,w=Math.abs(x.x-C.x)<at;if(!E&&!w)return 0;let F=0;if(E){let U=x.y,J=Math.min(x.x,C.x)-at,V=Math.max(x.x,C.x)+at;if(V<=J)return 0;for(let G of g)G.edgeIndex===d||G.orientation!=="vertical"||G.pipe.coord<J||G.pipe.coord>V||G.from-at<=U&&G.to+at>=U&&(F+=v)}else if(w){let U=x.x,J=Math.min(x.y,C.y)-at,V=Math.max(x.y,C.y)+at;if(V<=J)return 0;for(let G of g)G.edgeIndex===d||G.orientation!=="horizontal"||G.pipe.coord<J||G.pipe.coord>V||G.from-at<=U&&G.to+at>=U&&(F+=v)}return F},"crossingPenalty"),L=s.map((d,x)=>{if(!d.start||!d.end)return{idx:x,crossLane:0,dx:0,dy:0};let C=r.get(d.start),E=r.get(d.end),w=i.get(d.start),F=i.get(d.end),U=w&&F&&w.id!==F.id?1:0,J=C&&E?Math.abs((E.x??0)-(C.x??0)):0,V=C&&E?Math.abs((E.y??0)-(C.y??0)):0;return{idx:x,crossLane:U,dx:J,dy:V}}).sort((d,x)=>{if(d.crossLane!==x.crossLane)return x.crossLane-d.crossLane;let C=d.dx+d.dy,E=x.dx+x.dy;return Math.abs(C-E)>1?C-E:d.idx-x.idx}).map(d=>d.idx),R=f((d,x,C,E)=>{let w=Math.min(d.x,x.x),F=Math.max(d.x,x.x),U=Math.min(d.y,x.y),J=Math.max(d.y,x.y);return!!h.find(G=>C&&G.nodeId===C||E&&G.nodeId===E?!1:Math.abs(d.x-x.x)>at?G.minY<d.y&&G.maxY>d.y&&G.maxX>w&&G.minX<F:G.minX<d.x&&G.maxX>d.x&&G.maxY>U&&G.minY<J)},"isSegmentBlocked"),S=new Map,b=new Map;for(let d of s)!d.start||!d.end||d.start===d.end||(b.set(d.start,(b.get(d.start)??0)+1),b.set(d.end,(b.get(d.end)??0)+1));let T=f((d,x)=>no(d,x,"bottom"),"determineSide"),N=new Map;for(let[d,x]of s.entries()){if(!x.start||!x.end||x.start===x.end||x.points&&x.points.length>0)continue;let C=r.get(x.start),E=r.get(x.end);if(!C||!E)continue;let w=(E.x??0)-(C.x??0),F=(E.y??0)-(C.y??0);N.set(d,{edgeIdx:d,srcId:x.start,dstId:x.end,srcSide:T(C,{x:E.x??0,y:E.y??0}),dstSide:T(E,{x:C.x??0,y:C.y??0}),absDx:Math.abs(w),absDy:Math.abs(F),dxSign:Math.sign(w),dySign:Math.sign(F)})}let P=f(d=>d.srcSide==="top"||d.srcSide==="bottom"?d.absDx===0?1/0:d.absDy/d.absDx:d.absDy===0?1/0:d.absDx/d.absDy,"preferenceStrength"),A=f(d=>d.srcSide==="top"||d.srcSide==="bottom"?d.dxSign>=0?"right":"left":d.dySign>=0?"bottom":"top","secondarySide"),_=new Map;for(let d of N.values()){let x=`${d.srcId}:${d.srcSide}`;_.has(x)||_.set(x,[]),_.get(x).push(d)}let k=new Map,B=f((d,x)=>`${d}:${x}`,"loadKey");for(let d of N.values())k.set(B(d.srcId,d.srcSide),(k.get(B(d.srcId,d.srcSide))??0)+1),k.set(B(d.dstId,d.dstSide),(k.get(B(d.dstId,d.dstSide))??0)+1);for(let d of _.values())if(!(d.length<2)){d.sort((x,C)=>{let E=P(x),w=P(C);return Math.abs(E-w)>1e-9?w-E:x.edgeIdx-C.edgeIdx});for(let x=1;x<d.length;x++){let C=d[x],E=A(C),w=k.get(B(C.srcId,C.srcSide))??0,F=k.get(B(C.srcId,E))??0;F>=w||(k.set(B(C.srcId,C.srcSide),w-1),k.set(B(C.srcId,E),F+1),C.srcSide=E)}}let X=f(d=>{let x=d?.shape;return x==="question"||x==="diamond"},"isDiamondNode"),$=new Map;for(let d of N.values())$.has(d.dstId)||$.set(d.dstId,new Set),$.get(d.dstId).add(d.dstSide);for(let d of N.values()){if(!X(r.get(d.srcId)))continue;let x=$.get(d.srcId);if(!x?.has(d.srcSide))continue;let C=A(d);if(x.has(C)||(k.get(B(d.srcId,C))??0)>0)continue;let E=k.get(B(d.srcId,d.srcSide))??0;k.set(B(d.srcId,d.srcSide),Math.max(0,E-1)),k.set(B(d.srcId,C),1),d.srcSide=C}for(let d of N.values()){let{edgeIdx:x,srcId:C,dstId:E,srcSide:w,dstSide:F}=d,U=r.get(C),J=r.get(E),V=`${C}:${w}:src`,G=w==="top"||w==="bottom"?J.x??0:J.y??0;S.has(V)||S.set(V,[]),S.get(V).push({edgeIdx:x,oppositeCoord:G});let ot=`${E}:${F}:dst`,rt=F==="top"||F==="bottom"?U.x??0:U.y??0;S.has(ot)||S.set(ot,[]),S.get(ot).push({edgeIdx:x,oppositeCoord:rt})}let K=new Map,ct=8;for(let[d,x]of S){if(x.length<2)continue;x.sort((Lt,Dt)=>Lt.oppositeCoord-Dt.oppositeCoord);let C=d.split(":"),E=C.slice(0,-2).join(":"),w=C[C.length-2],F=C[C.length-1],U=r.get(E);if(!U)continue;let V=w==="left"||w==="right"?U.height??10:U.width??10,G=U.shape,rt=G==="question"||G==="diamond"?V*.3:V,tt=Math.min(20,Math.max(ct,rt/(x.length+1))),Nt=-(tt*(x.length-1))/2;for(let[Lt,Dt]of x.entries()){let Jt=Nt+Lt*tt,gn=`${Dt.edgeIdx}:${F}`;K.set(gn,Jt)}}let mt=f(d=>!!s[d]?.labelNodeId,"edgeHasLabelNode"),Rt=f((d,x)=>d?(S.get(`${d}:${x}:src`)??[]).some(({edgeIdx:C})=>mt(C))||(S.get(`${d}:${x}:dst`)??[]).some(({edgeIdx:C})=>mt(C)):!1,"faceHasLabelNode"),Pt=f((d,x,C)=>x==="top"||x==="bottom"?{x:d.x+C,y:d.y}:{x:d.x,y:d.y+C},"applyPortOffset"),Q=f((d,x,C)=>{let E=N.get(d),w={x:C.x??0,y:C.y??0},F={x:x.x??0,y:x.y??0},U=E?.srcSide??T(x,w),J=E?.dstSide??T(C,F),V=E?I(x,E.srcSide):p(x,w,!0),G=E?I(C,E.dstSide):p(C,F,!1),ot=K.get(`${d}:src`),rt=K.get(`${d}:dst`);return ot!==void 0&&(V=Pt(V,U,ot)),rt!==void 0&&(G=Pt(G,J,rt)),{pSrcPort:V,pDstPort:G,srcSide:U,dstSide:J}},"portsForEdge");for(let d of L){let x=s[d];if(a[d]=[],!x.start||!x.end||x.points&&x.points.length>0||x.start===x.end)continue;let C=r.get(x.start),E=r.get(x.end);if(!C||!E)continue;let{pSrcPort:w,pDstPort:F,srcSide:U,dstSide:J}=Q(d,C,E),V={...w},G={...F},ot=U==="top"||U==="bottom",rt=J==="top"||J==="bottom";if(ot){let Y=w.y>(C.y??0);V.y=Y?w.y+ne:w.y-ne}else{let Y=w.x>(C.x??0);V.x=Y?w.x+ne:w.x-ne}if(rt){let Y=F.y>(E.y??0);G.y=Y?F.y+ne:F.y-ne}else{let Y=F.x>(E.x??0);G.x=Y?F.x+ne:F.x-ne}let st=f((Y,z)=>{for(let q of h)if(!z.includes(q.nodeId)&&Y.x>q.minX&&Y.x<q.maxX&&Y.y>q.minY&&Y.y<q.maxY)return{inside:!0,obstacle:q};return{inside:!1}},"isPointInObstacle"),tt=f((Y,z,q,ft,Ct)=>{if(Ct){let Ot=Y.y>(z.y??0);return{x:(q.x??0)>=Y.x?ft.maxX+be:ft.minX-be,y:Ot?ft.maxY+we:ft.minY-we,leavesPositiveSide:Ot}}let bt=Y.x>(z.x??0),Et=(q.y??0)>=Y.y;return{x:bt?ft.maxX+be:ft.minX-be,y:Et?ft.maxY+we:ft.minY-we,leavesPositiveSide:bt}},"obstacleDetour"),yt=[],Nt=[x.start,x.end],Lt=st(V,Nt);if(Lt.inside&&Lt.obstacle){let Y=Lt.obstacle;if(ot){let z=tt(w,C,E,Y,!0);V.x=z.x,V.y=z.y;let q=z.leavesPositiveSide?Math.min(Y.minY-2,w.y+ne):Math.max(Y.maxY+2,w.y-ne);yt=[{x:w.x,y:q},{x:z.x,y:q},{x:z.x,y:z.y}]}else{let z=tt(w,C,E,Y,!1),q=z.leavesPositiveSide?Math.min(Y.minX-2,w.x+ne):Math.max(Y.maxX+2,w.x-ne);V.x=z.x,V.y=z.y,yt=[{x:q,y:w.y},{x:q,y:z.y},{x:z.x,y:z.y}]}}let Dt=[],Jt=st(G,Nt);if(Jt.inside&&Jt.obstacle){let Y=Jt.obstacle;if(rt){let z=tt(F,E,C,Y,!0);G.x=z.x,G.y=z.y,Dt=[{x:z.x,y:z.y},{x:F.x,y:z.y}]}else{let z=tt(F,E,C,Y,!1);G.x=z.x,G.y=z.y,Dt=[{x:z.x,y:z.y},{x:z.x,y:F.y}]}}if(yt.length===0&&Dt.length===0){let Y=be,z=Math.abs(V.x-G.x)<Y,q=Math.abs(V.y-G.y)<Y,ft=K.get(`${d}:src`)!==void 0||K.get(`${d}:dst`)!==void 0,Ct=(S.get(`${x.start??""}:${U}:src`)?.length??0)+(S.get(`${x.start??""}:${U}:dst`)?.length??0),bt=(S.get(`${x.end??""}:${J}:src`)?.length??0)+(S.get(`${x.end??""}:${J}:dst`)?.length??0),Et=Ct>1||bt>1,Ot=b.get(x.start??"")??0,ut=b.get(x.end??"")??0,Yt=Ct>1&&Rt(x.start,U)||bt>1&&Rt(x.end,J),ee=Ct<=1||Ot<=2,Ft=bt<=1||ut<=2;if((z||q)&&!ft&&(!Et||Et&&!Yt&&ee&&Ft)&&!R(w,F,x.start,x.end)){x.points=[{...w},{...V},{...G},{...F}],m.add(d);let Mt=q?"horizontal":"vertical",$t=q?w.y:w.x,It=q?Math.min(w.x,F.x):Math.min(w.y,F.y),St=q?Math.max(w.x,F.x):Math.max(w.y,F.y),Wt={id:`fast-path-${Mt}-${$t.toFixed(0)}-${d}`,orientation:Mt,coord:$t,spanMin:It,spanMax:St,tracks:[]};g.push({edgeIndex:d,segmentIndex:0,orientation:Mt,pipe:Wt,trackIndex:0,from:It,to:St});continue}}let gn=y("vertical",V.x,V.y,V.y);V.x=gn.coord;let Nr=y("vertical",G.x,G.y,G.y);G.x=Nr.coord;let ue=Math.min(V.x,G.x)-50,he=Math.max(V.x,G.x)+50,ve=Math.min(V.y,G.y)-50,Le=Math.max(V.y,G.y)+50;for(let Y of h){let z=Math.min(V.x,G.x),q=Math.max(V.x,G.x),ft=Math.min(V.y,G.y),Ct=Math.max(V.y,G.y);Y.minX<q&&Y.maxX>z&&Y.minY<Ct&&Y.maxY>ft&&(ue=Math.min(ue,Y.minX-Ue),he=Math.max(he,Y.maxX+Ue),ve=Math.min(ve,Y.minY-Ue),Le=Math.max(Le,Y.maxY+Ue))}for(let Y of h){if(Y.maxX<ue||Y.minX>he||Y.maxY<ve||Y.minY>Le)continue;let z=be;y("horizontal",Y.minY-z,ue,he),y("horizontal",Y.maxY+z,ue,he);let q=we;y("vertical",Y.minX-q,ve,Le),y("vertical",Y.maxX+q,ve,Le)}y("horizontal",V.y,ue,he),y("horizontal",G.y,ue,he);let Or=u.filter(Y=>Y.orientation==="horizontal"&&Y.coord>=ve&&Y.coord<=Le),Br=u.filter(Y=>Y.orientation==="vertical"&&Y.coord>=ue&&Y.coord<=he),_e=f((Y,z)=>`${Y.toFixed(1)},${z.toFixed(1)}`,"getKey"),De=_e(V.x,V.y),Lo=_e(G.x,G.y),He=new Map,pn=new Map,mn=new Map,Xe=new Set,xe=[];He.set(De,0),mn.set(De,"n"),xe.push({key:De,f:Math.hypot(G.x-V.x,G.y-V.y),pt:V}),Xe.add(De);let Ht=[],ge=f((Y,z)=>R(Y,z,x.start,x.end),"checkSegmentBlocked"),yn={x:G.x,y:V.y},Pr=ge(V,yn),Fr=ge(yn,G),kr=Pr||Fr,xn={x:V.x,y:G.y},_r=ge(V,xn),Dr=ge(xn,G);if(kr?_r||Dr||(Math.abs(V.x-G.x)<at?Ht=[V,G]:Ht=[V,xn,G]):Math.abs(V.y-G.y)<at||Math.abs(V.x-G.x)<at?Ht=[V,G]:Ht=[V,yn,G],Ht.length===0)for(;xe.length>0;){xe.sort((ut,Yt)=>ut.f-Yt.f);let Y=xe.shift();if(Xe.delete(Y.key),Y.key===Lo){let ut=Lo,Yt=G;for(Ht=[Yt];pn.has(ut);){let ee=pn.get(ut);Ht.unshift(ee),Yt=ee,ut=_e(ee.x,ee.y)}break}let z=Y.pt.x,q=Y.pt.y,ft=Br.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=ft.findIndex(ut=>Math.abs(ut.coord-z)<1),bt=Or.sort((ut,Yt)=>ut.coord-Yt.coord),Et=bt.findIndex(ut=>Math.abs(ut.coord-q)<1),Ot=[];Ct>0&&Ot.push({x:ft[Ct-1].coord,y:q}),Ct>=0&&Ct<ft.length-1&&Ot.push({x:ft[Ct+1].coord,y:q}),Et>0&&Ot.push({x:z,y:bt[Et-1].coord}),Et>=0&&Et<bt.length-1&&Ot.push({x:z,y:bt[Et+1].coord});for(let ut of Ot){let Yt=Math.min(z,ut.x),ee=Math.max(z,ut.x),Ft=Math.min(q,ut.y),Gt=Math.max(q,ut.y);if(h.some(Zt=>Zt.nodeId===x.start||Zt.nodeId===x.end?!1:Yt!==ee?Zt.minY<q&&Zt.maxY>q&&Zt.maxX>Yt&&Zt.minX<ee:Zt.minX<z&&Zt.maxX>z&&Zt.maxY>Ft&&Zt.minY<Gt))continue;let Mt=_e(ut.x,ut.y),$t=Math.abs(ut.x-z)+Math.abs(ut.y-q),It=M(d,Y.pt,ut),St=0,Wt=G.x-V.x,Ee=G.y-V.y,Ye=ut.x-z,bn=ut.y-q;(Ee>10&&bn<-5||Ee<-10&&bn>5)&&(St=Math.abs(bn)*100),(Wt>10&&Ye<-5||Wt<-10&&Ye>5)&&(St+=Math.abs(Ye)*50);let Eo=0,To=mn.get(Y.key)??"n",wo=Math.abs(Ye)>at?"h":"v";To!=="n"&&To!==wo&&(Eo=50);let Hr=$t+It+St+Eo,Ge=(He.get(Y.key)??1/0)+Hr,Ao=Math.abs(G.x-ut.x)+Math.abs(G.y-ut.y);if(Ge<(He.get(Mt)??1/0))if(pn.set(Mt,Y.pt),He.set(Mt,Ge),mn.set(Mt,wo),!Xe.has(Mt))xe.push({key:Mt,f:Ge+Ao,pt:ut}),Xe.add(Mt);else{let Zt=xe.findIndex(Xr=>Xr.key===Mt);Zt!==-1&&(xe[Zt].f=Ge+Ao)}}}if(Ht.length===0&&(Ht=[V,{x:V.x,y:G.y},G]),Ht.length>4){let Y=Ht[0],z=Ht[Ht.length-1],q=Math.min(Y.x,z.x),ft=Math.max(Y.x,z.x),Ct=Math.min(Y.y,z.y),bt=Math.max(Y.y,z.y);for(let Ft of Ht)q=Math.min(q,Ft.x),ft=Math.max(ft,Ft.x),Ct=Math.min(Ct,Ft.y),bt=Math.max(bt,Ft.y);let Et=ft>Math.max(Y.x,z.x),Ot=q<Math.min(Y.x,z.x);if(c){let Ft=we;if(Et){let Gt=Math.max(Y.x,z.x),Bt=Math.min(Y.y,z.y),Mt=Math.max(Y.y,z.y),$t=h.filter(It=>It.minX<Gt&&It.maxX>Gt&&It.minY<Mt&&It.maxY>Bt);if($t.length>0){let It=Math.max(Y.x,z.x);for(let St of $t){let Wt=(St.minX+St.maxX)/2;if(St.visualXHalfExtent===void 0||isNaN(St.visualXHalfExtent))continue;let Ee=Wt+St.visualXHalfExtent+Ft;It=Math.max(It,Ee)}isNaN(It)||(ft=It)}}if(Ot){let Gt=h.filter(Bt=>Bt.minX<Math.min(Y.x,z.x)+Ft&&Bt.minY<Math.max(Y.y,z.y)&&Bt.maxY>Math.min(Y.y,z.y));if(Gt.length>0){let Bt=Math.min(Y.x,z.x);for(let Mt of Gt){let It=(Mt.minX+Mt.maxX)/2-Mt.visualXHalfExtent-Ft;Bt=Math.min(Bt,It)}q=Bt}}}let ut=f(Ft=>{let Gt=z.y>Y.y,Bt=h.filter(It=>{let St=Math.min(Y.x,z.x)<It.maxX&&Math.max(Y.x,z.x)>It.minX,Wt=Math.min(Y.y,z.y)<It.maxY&&Math.max(Y.y,z.y)>It.minY;return St&&Wt}),Mt=Bt;if(c&&Bt.length>0){let It=Bt.filter(St=>St.minX<Ft&&St.maxX>Ft);It.length>0&&(Mt=It)}if(Mt.length===0)return z.y;let $t=be;if(Gt){let St=Math.max(...Mt.map(Wt=>Wt.maxY))+$t;if(St<z.y-at)return St}else{let St=Math.min(...Mt.map(Wt=>Wt.minY))-$t;if(St>z.y+at)return St}return z.y},"findBestReturnY"),Yt=f(Ft=>{let Gt=ut(Ft),Bt={x:Ft,y:Y.y},Mt={x:Ft,y:Gt},$t={x:z.x,y:Gt},It=ge(Y,Bt),St=ge(Bt,Mt),Wt=ge(Mt,$t),Ee=Gt!==z.y?ge($t,z):!1;return!It&&!St&&!Wt&&!Ee?Math.abs(Gt-z.y)<at?[Y,Bt,Mt,z]:[Y,Bt,Mt,$t,z]:null},"trySimplifyWithDetourX"),ee=Et&&!Ot?Yt(ft):Ot&&!Et?Yt(q):null;ee&&(Ht=ee)}let Xt=[w,...yt,...Ht,...Dt.reverse(),F];if(Xt.length>=3){let Y=Xt[Xt.length-1],z=Xt[Xt.length-2],q=Xt[Xt.length-3],ft=Math.abs(q.y-z.y)<at&&Math.abs(z.y-Y.y)<at,Ct=Math.abs(q.x-z.x)<at&&Math.abs(z.x-Y.x)<at;if(ft){let bt=Math.sign(z.x-q.x),Et=Math.sign(Y.x-q.x);bt!==0&&bt===Et&&Math.abs(z.x-q.x)>Math.abs(Y.x-q.x)&&Xt.splice(-2,1)}else if(Ct){let bt=Math.sign(z.y-q.y),Et=Math.sign(Y.y-q.y);bt!==0&&bt===Et&&Math.abs(z.y-q.y)>Math.abs(Y.y-q.y)&&Xt.splice(-2,1)}}let ie=[Xt[0]];for(let Y=1;Y<Xt.length-1;Y++){if(Y===1){ie.push(Xt[Y]);continue}let z=ie[ie.length-1],q=Xt[Y],ft=Xt[Y+1];if(Math.abs(z.y-q.y)<at&&Math.abs(q.y-ft.y)<at){let Ct=q.x>z.x,bt=ft.x>q.x;if(Ct!==bt){ie.push(q);continue}continue}if(Math.abs(z.x-q.x)<at&&Math.abs(q.x-ft.x)<at){let Ct=q.y>z.y,bt=ft.y>q.y;if(Ct!==bt){ie.push(q);continue}continue}ie.push(q)}ie.push(Xt[Xt.length-1]);for(let Y=0;Y<ie.length-1;Y++){let z=ie[Y],q=ie[Y+1],ft=Math.abs(z.x-q.x)<at?"vertical":"horizontal",Ct=ft==="vertical"?z.x:z.y,bt=ft==="vertical"?Math.min(z.y,q.y):Math.min(z.x,q.x),Et=ft==="vertical"?Math.max(z.y,q.y):Math.max(z.x,q.x),Ot=y(ft,Ct,bt,Et),ut={edgeIndex:d,segmentIndex:Y,orientation:ft,pipe:Ot,trackIndex:0,from:bt,to:Et};g.push(ut),a[d].push(g.length-1),Ot.tracks[0]||(Ot.tracks[0]={index:0,coord:Ot.coord,segments:[]}),Ot.tracks[0].segments.push({edgeIndex:d,segmentIndex:Y,from:bt,to:Et})}}let W=f((d,x)=>d.from<x.to&&x.from<d.to,"segmentsOverlap"),et=f((d,x,C,E)=>{let w=!E.segments.some(U=>(U.edgeIndex!==x.edgeIndex||U.segmentIndex!==x.segmentIndex)&&W(U,d)),F=!C.segments.some(U=>(U.edgeIndex!==d.edgeIndex||U.segmentIndex!==d.segmentIndex)&&W(U,x));return w&&F?(d.trackIndex=E.index,x.trackIndex=C.index,C.segments=[...C.segments.filter(U=>U.edgeIndex!==d.edgeIndex||U.segmentIndex!==d.segmentIndex),{edgeIndex:x.edgeIndex,segmentIndex:x.segmentIndex,from:x.from,to:x.to}],E.segments=[...E.segments.filter(U=>U.edgeIndex!==x.edgeIndex||U.segmentIndex!==x.segmentIndex),{edgeIndex:d.edgeIndex,segmentIndex:d.segmentIndex,from:d.from,to:d.to}],!0):!1},"trySwapSegmentsAcrossTracks"),lt=f(d=>{let x=d.tracks.length;return d.tracks[x]={index:x,coord:d.coord,segments:[]},x},"createNewTrack"),gt=f((d,x)=>{let C=d.pipe.tracks[d.trackIndex];C.segments=C.segments.filter(w=>w.edgeIndex!==d.edgeIndex||w.segmentIndex!==d.segmentIndex),d.trackIndex=x,d.pipe.tracks[x].segments.push({edgeIndex:d.edgeIndex,segmentIndex:d.segmentIndex,from:d.from,to:d.to})},"moveSegmentToTrack"),xt=f((d,x)=>{let C=a[d.edgeIndex];for(let E of C){let w=g[E];w.pipe===d.pipe&>(w,x)}},"moveSegmentChainToTrack"),vt=f(d=>{let x=a[d.edgeIndex],C=x.indexOf(g.indexOf(d)),E=[];return C>0&&E.push(g[x[C-1]]),C<x.length-1&&E.push(g[x[C+1]]),E},"getAdjacentSegmentsAlongEdge"),Vt=f((d,x)=>{if(d.orientation===x.orientation)return!1;let C=d.orientation==="horizontal"?d:x,E=d.orientation==="horizontal"?x:d;return E.pipe.coord>C.from&&E.pipe.coord<C.to&&C.pipe.coord>E.from&&C.pipe.coord<E.to},"haveAnyCrossing"),jt=f((d,x)=>{for(let C of d.tracks)if(!C.segments.some(w=>(w.edgeIndex!==x.edgeIndex||w.segmentIndex!==x.segmentIndex)&&W(w,x)))return C.index;return-1},"findAvailableTrack"),Ut=f((d,x)=>{if(d.trackIndex===x.trackIndex)return W(d,x);let C=vt(d),E=vt(x);return C.some(w=>E.some(F=>Vt(w,F)))},"segmentsConflict"),te=f((d,x,C)=>{if(et(d,x,d.pipe.tracks[d.trackIndex],x.pipe.tracks[x.trackIndex]))return;let E=jt(d.pipe,x);C(x,E!==-1?E:lt(d.pipe))},"resolveTrackConflict"),Se=f(d=>{let x=0;for(let C=0;C<d.length;C++)for(let E=C+1;E<d.length;E++){let w=d[C],F=d[E];w.pipe===F.pipe&&Ut(w,F)&&(x++,te(w,F,xt))}return x},"resolveHandleConflicts"),de=new Map,Ce=f(d=>{if(de.has(d))return de.get(d);let x=a[d];if(x.length===0){let J={dest:0,deviation:0,base:0,delta:0};return de.set(d,J),J}let E=g[x[0]].pipe.coord,w=E;for(let J=1;J<x.length;J++){let V=g[x[J]];if(V.orientation==="horizontal"){let G=V.from,ot=V.to;w=Math.abs(G-E)>Math.abs(ot-E)?G:ot;break}}let F=Math.abs(w-E),U={dest:w,deviation:F,base:E,delta:w-E};return de.set(d,U),U},"getDestInfo"),dn=f(()=>{let d=0,x=new Map;for(let[E,w]of s.entries())a[E].length!==0&&w.start&&(x.has(w.start)||x.set(w.start,[]),x.get(w.start).push(E));let C=f(E=>{let w=s[E];if(!w.start||!w.end)return 0;let F=r.get(w.start),U=r.get(w.end);if(!F||!U)return 0;let J=(U.x??0)-(F.x??0),V=(U.y??0)-(F.y??0);return Math.abs(J)+Math.abs(V)},"getEdgeDistance");for(let E of x.values()){E.sort((F,U)=>{let J=Ce(F),V=Ce(U);if(Math.abs(J.deviation-V.deviation)>1)return J.deviation-V.deviation;if(Math.abs(J.dest-V.dest)>1)return J.dest-V.dest;let G=C(F),ot=C(U);if(Math.abs(G-ot)>1)return ot-G;let rt=a[F].length,st=a[U].length;if(rt!==st)return rt-st;if(rt===1){let tt=a[F][0],yt=a[U][0];if(g[tt]&&g[yt]){let Nt=g[tt],Lt=g[yt],Dt=Math.abs(Nt.to-Nt.from),Jt=Math.abs(Lt.to-Lt.from);if(Math.abs(Dt-Jt)>1)return Dt-Jt}}return 0});let w=E.map(F=>g[a[F][0]]);d+=Se(w)}return d},"fixSourceHandleCrossings"),un=f(()=>{let d=0,x=new Map;for(let[C,E]of s.entries())a[C].length!==0&&E.end&&(x.has(E.end)||x.set(E.end,[]),x.get(E.end).push(C));for(let C of x.values()){C.sort((w,F)=>{let U=f(G=>{let ot=a[G];if(ot.length<2)return 0;let rt=g[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),J=U(w),V=U(F);return Math.abs(J-V)>.1?J-V:w-F});let E=C.map(w=>g[a[w][a[w].length-1]]);d+=Se(E)}return d},"fixTargetHandleCrossings"),hn=f(()=>{let d=0;for(let x of u){let C=[];for(let E of x.tracks)for(let w of E.segments){let F=a[w.edgeIndex].find(U=>g[U].segmentIndex===w.segmentIndex);F!==void 0&&C.push(g[F])}C.sort((E,w)=>E.edgeIndex-w.edgeIndex||E.segmentIndex-w.segmentIndex);for(let E=0;E<C.length;E++)for(let w=E+1;w<C.length;w++){let F=C[E],U=C[w];Ut(F,U)&&(d++,te(F,U,gt))}}return d},"fixPipeCrossings"),O=0,D=10;for(;O<D;){let d=0;if(d+=dn(),d+=un(),d+=hn(),d===0)break;O++}let H=new Map;for(let d of u){let x=[];d.tracks.forEach(E=>{E.segments.forEach(w=>{x.push({edgeIndex:w.edgeIndex,segmentIndex:w.segmentIndex,trackIndex:E.index,from:w.from,to:w.to})})}),x.sort((E,w)=>E.from-w.from);let C=[];if(x.length>0){let E=[x[0]],w=x[0].to;for(let F=1;F<x.length;F++){let U=x[F];U.from<w?(E.push(U),w=Math.max(w,U.to)):(C.push(E),E=[U],w=U.to)}C.push(E)}for(let E of C){let w=new Set;E.forEach(tt=>w.add(tt.trackIndex));let F=new Map;E.forEach(tt=>{let yt=Ce(tt.edgeIndex);F.set(tt.trackIndex,(F.get(tt.trackIndex)??0)+yt.delta)});let U=[...w].filter(tt=>(F.get(tt)??0)<-1),J=[...w].filter(tt=>(F.get(tt)??0)>1),V=[...w].filter(tt=>Math.abs(F.get(tt)??0)<=1);U.sort((tt,yt)=>(F.get(yt)??0)-(F.get(tt)??0)),J.sort((tt,yt)=>(F.get(tt)??0)-(F.get(yt)??0));let G=f((tt,yt)=>{E.filter(Nt=>Nt.trackIndex===tt).forEach(Nt=>{let Lt=m.has(Nt.edgeIndex)?d.coord:yt;H.set(`${Nt.edgeIndex}-${Nt.segmentIndex}`,Lt)})},"assignCoord"),ot=0;for(let tt of U)ot++,G(tt,d.coord-ot*vn);if(V.length===0&&w.size>0){let tt=[...w].sort((Lt,Dt)=>Math.abs(F.get(Lt)??0)-Math.abs(F.get(Dt)??0))[0],yt=U.indexOf(tt);yt!==-1&&U.splice(yt,1);let Nt=J.indexOf(tt);Nt!==-1&&J.splice(Nt,1),V.push(tt)}let rt=0;for(let tt of V){if(rt===0)G(tt,d.coord);else{let yt=rt%2===1?1:-1,Nt=Math.ceil(rt/2);G(tt,d.coord+yt*Nt*vn*.5)}rt++}let st=0;for(let tt of J)st++,G(tt,d.coord+st*vn)}}for(let[d,x]of s.entries()){let C=a[d]??[];if(C.length===0)continue;let E=[],w=r.get(x.start),F=r.get(x.end),{pSrcPort:U,pDstPort:J}=Q(d,w,F),V=C.map(rt=>{let st=g[rt],tt=H.get(`${st.edgeIndex}-${st.segmentIndex}`)??st.pipe.coord;return{orient:st.orientation,coord:tt,from:st.from,to:st.to}});E.push(U);for(let rt=0;rt<V.length;rt++){let st=V[rt],tt=E[E.length-1],yt=st.orient==="vertical"?tt.y:tt.x,Nt=st.orient==="vertical"?tt.x:tt.y,Lt=V[rt+1],Dt=rt<V.length-1;if(Math.abs(Nt-st.coord)>at&&E.push(Me(st,yt)),Dt&&Lt.orient===st.orient)if(Math.abs(st.coord-Lt.coord)>at){let Jt=st.orient==="vertical"?(yt+Lt.from)/2:oo(st,Lt);E.push(Me(st,Jt),Me(Lt,Jt))}else(rt===0||rt===V.length-2)&&E.push(Me(st,oo(st,Lt)));else if(Dt)E.push(Me(st,Lt.coord));else{let Jt=Math.abs(st.from-yt)<Math.abs(st.to-yt)?st.to:st.from;E.push(Me(st,Jt))}}let G=E[E.length-1];(Math.abs(G.x-J.x)>at||Math.abs(G.y-J.y)>at)&&E.push(J);let ot=[];E.length>0&&ot.push(E[0]);for(let rt=1;rt<E.length;rt++){let st=E[rt],tt=ot[ot.length-1];(Math.abs(st.x-tt.x)>at||Math.abs(st.y-tt.y)>at)&&ot.push(st)}x.points=ot}for(let d of s){let x=d.__originalEdge;x&&d.points&&(x.points=d.points)}t.edges=(t.edges??[]).filter(d=>!d.isLayoutOnly);let j=f((d,x)=>{let C=x.x??0,E=x.y??0,w=x.width??0,F=x.height??0;if(w<=0||F<=0)return d;let U=C-w/2,J=C+w/2,V=E-F/2,G=E+F/2;if(d.x<U||d.x>J||d.y<V||d.y>G)return d;let ot=d.x-U,rt=J-d.x,st=d.y-V,tt=G-d.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:U,y:d.y}:yt===rt?{x:J,y:d.y}:yt===st?{x:d.x,y:V}:{x:d.x,y:G}},"nodeBoundaryClamp");for(let d of t.edges){let x=d.points;if(!x||x.length<2)continue;let C=d.start,E=d.end,w=C?r.get(C):void 0,F=E?r.get(E):void 0;w&&(x[0]=j(x[0],w)),F&&(x[x.length-1]=j(x[x.length-1],F))}return t}f(wr,"routeEdgesOrthogonal");function Ar(t){return t.direction??"TB"}f(Ar,"getSwimlaneDirection");function Rr(t){let e=us(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,u=Ar(t),{ordered:c,coordinates:l}=Tr(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:u});hs(e,c,l,{nodeGap:n,layerGap:o});for(let h of t.edges??[])delete h.points;wr(t,u);for(let h of t.edges??[])(!h.curve||h.curve==="basis")&&(h.curve="rounded");return Vs(t,u),zs(t),u}f(Rr,"runSwimlaneLayoutCore");async function Zr(t,e){let n=e.select("g");Go(n,t.markers,t.type,t.diagramId),ko(),Ho(),Po(),zo(),ds(t);let o=gs(t);t.nodes=o.nodes,t.edges=o.edges;let{groups:s}=await Jo(n,t);Rr(t),await as(t,s)}f(Zr,"render");export{Zr as render};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as o,b as e}from"./chunk-GQM25EPP.js";import"./chunk-NBH7YOBD.js";import"./chunk-D3WOCELE.js";import"./chunk-2RQCUDTG.js";import"./chunk-XNXYDBKX.js";import"./chunk-34FHPXU4.js";import"./chunk-57XXJOQN.js";import"./chunk-MYMJLHQL.js";import"./chunk-YORIST7Z.js";import"./chunk-QBPQ7DPE.js";import"./chunk-XQUIO562.js";import"./chunk-GSOU4UTT.js";import"./chunk-IP56FOSI.js";import"./chunk-CBGUD2NP.js";import"./chunk-PLP5XUTJ.js";import"./chunk-6DCNDVBX.js";import"./chunk-22DRK7VS.js";import"./chunk-7CSIRG7W.js";import"./chunk-ERWOH47R.js";import{a as r}from"./chunk-EIBFAW37.js";import"./chunk-LGUG3SQB.js";import"./chunk-6DHFEWGX.js";var m=r(t=>`${o(t)}
|
|
2
|
+
.swimlane.cluster rect {
|
|
3
|
+
stroke: ${t.clusterBorder} !important;
|
|
4
|
+
}
|
|
5
|
+
[data-look="neo"].cluster rect {
|
|
6
|
+
filter: none;
|
|
7
|
+
}
|
|
8
|
+
`,"getStyles"),i=m,B=e({defaultLayout:"swimlane",styles:i});export{B as diagram};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import{a as bt}from"./chunk-VOCDYA3H.js";import{n as vt}from"./chunk-6DCNDVBX.js";import"./chunk-22DRK7VS.js";import{P as nt,S as xt,T as kt,_ as it,c as ft,d as yt,e as mt,u as rt}from"./chunk-7CSIRG7W.js";import{b as _}from"./chunk-ERWOH47R.js";import{a as o,b as gt}from"./chunk-EIBFAW37.js";import{I as st,e as K}from"./chunk-LGUG3SQB.js";import"./chunk-6DHFEWGX.js";var at=(function(){var e=o(function(k,i,d,l){for(d=d||{},l=k.length;l--;d[k[l]]=i);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],r=[1,12],s=[1,13],n=[1,14],h=[1,15],c=[1,16],a=[1,19],f=[1,20],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(i,d,l,p,m,u,w){var b=u.length-1;switch(m){case 1:return u[b-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[b-1].push(u[b]),this.$=u[b-1];break;case 7:case 8:this.$=u[b];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[b].substr(6)),this.$=u[b].substr(6);break;case 12:this.$=u[b].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[b].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[b].substr(8)),this.$=u[b].substr(8);break;case 18:p.addTask(u[b],0,""),this.$=u[b];break;case 19:p.addEvent(u[b].substr(2)),this.$=u[b];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:r,15:s,17:n,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:r,15:s,17:n,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(i,d){if(d.recoverable)this.trace(i);else{var l=new Error(i);throw l.hash=d,l}},"parseError"),parse:o(function(i){var d=this,l=[0],p=[],m=[null],u=[],w=this.table,b="",I=0,P=0,B=0,G=2,L=1,R=u.slice.call(arguments,1),E=Object.create(this.lexer),A={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(A.yy[V]=this.yy[V]);E.setInput(i,A.yy),A.yy.lexer=E,A.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var D=E.yylloc;u.push(D);var $=E.options&&E.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function v(W){l.length=l.length-2*W,m.length=m.length-W,u.length=u.length-W}o(v,"popStack");function T(){var W;return W=p.pop()||E.lex()||L,typeof W!="number"&&(W instanceof Array&&(p=W,W=p.pop()),W=d.symbols_[W]||W),W}o(T,"lex");for(var S,H,M,N,tt,Z,O={},j,F,pt,q;;){if(M=l[l.length-1],this.defaultActions[M]?N=this.defaultActions[M]:((S===null||typeof S>"u")&&(S=T()),N=w[M]&&w[M][S]),typeof N>"u"||!N.length||!N[0]){var et="";q=[];for(j in w[M])this.terminals_[j]&&j>G&&q.push("'"+this.terminals_[j]+"'");E.showPosition?et="Parse error on line "+(I+1)+`:
|
|
2
|
+
`+E.showPosition()+`
|
|
3
|
+
Expecting `+q.join(", ")+", got '"+(this.terminals_[S]||S)+"'":et="Parse error on line "+(I+1)+": Unexpected "+(S==L?"end of input":"'"+(this.terminals_[S]||S)+"'"),this.parseError(et,{text:E.match,token:this.terminals_[S]||S,line:E.yylineno,loc:D,expected:q})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+M+", token: "+S);switch(N[0]){case 1:l.push(S),m.push(E.yytext),u.push(E.yylloc),l.push(N[1]),S=null,H?(S=H,H=null):(P=E.yyleng,b=E.yytext,I=E.yylineno,D=E.yylloc,B>0&&B--);break;case 2:if(F=this.productions_[N[1]][1],O.$=m[m.length-F],O._$={first_line:u[u.length-(F||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(F||1)].first_column,last_column:u[u.length-1].last_column},$&&(O._$.range=[u[u.length-(F||1)].range[0],u[u.length-1].range[1]]),Z=this.performAction.apply(O,[b,P,I,A.yy,N[1],m,u].concat(R)),typeof Z<"u")return Z;F&&(l=l.slice(0,-1*F*2),m=m.slice(0,-1*F),u=u.slice(0,-1*F)),l.push(this.productions_[N[1]][0]),m.push(O.$),u.push(O._$),pt=w[l[l.length-2]][l[l.length-1]],l.push(pt);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:o(function(d,l){if(this.yy.parser)this.yy.parser.parseError(d,l);else throw new Error(d)},"parseError"),setInput:o(function(i,d){return this.yy=d||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var d=i.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:o(function(i){var d=i.length,l=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===p.length?this.yylloc.first_column:0)+p[p.length-l.length].length-l[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(i){this.unput(this.match.slice(i))},"less"),pastInput:o(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var i=this.pastInput(),d=new Array(i.length+1).join("-");return i+this.upcomingInput()+`
|
|
5
|
+
`+d+"^"},"showPosition"),test_match:o(function(i,d){var l,p,m;if(this.options.backtrack_lexer&&(m={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(m.yylloc.range=this.yylloc.range.slice(0))),p=i[0].match(/(?:\r\n?|\n).*/g),p&&(this.yylineno+=p.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:p?p[p.length-1].length-p[p.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],l=this.performAction.call(this,this.yy,this,d,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),l)return l;if(this._backtrack){for(var u in m)this[u]=m[u];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,d,l,p;this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),u=0;u<m.length;u++)if(l=this._input.match(this.rules[m[u]]),l&&(!d||l[0].length>d[0].length)){if(d=l,p=u,this.options.backtrack_lexer){if(i=this.test_match(l,m[u]),i!==!1)return i;if(this._backtrack){d=!1;continue}else return!1}else if(!this.options.flex)break}return d?(i=this.test_match(d,m[p]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var d=this.next();return d||this.lex()},"lex"),begin:o(function(d){this.conditionStack.push(d)},"begin"),popState:o(function(){var d=this.conditionStack.length-1;return d>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(d){return d=this.conditionStack.length-1-Math.abs(d||0),d>=0?this.conditionStack[d]:"INITIAL"},"topState"),pushState:o(function(d){this.begin(d)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(d,l,p,m){var u=m;switch(p){case 0:break;case 1:break;case 2:return 13;case 3:break;case 4:break;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;break;case 10:return this.popState(),"acc_title_value";break;case 11:return this.begin("acc_descr"),17;break;case 12:return this.popState(),"acc_descr_value";break;case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}};return k})();g.lexer=x;function y(){this.yy={}}return o(y,"Parser"),y.prototype=g,g.Parser=y,new y})();at.parser=at;var Kt=at,$t={};gt($t,{addEvent:()=>Pt,addSection:()=>At,addTask:()=>Wt,addTaskOrg:()=>Bt,clear:()=>Ht,default:()=>Ut,getCommonDb:()=>It,getDirection:()=>Mt,getSections:()=>Ct,getTasks:()=>Rt,setDirection:()=>Lt});var U="",Nt=0,ct="LR",lt=[],J=[],X=[],It=o(()=>xt,"getCommonDb"),Ht=o(function(){lt.length=0,J.length=0,U="",X.length=0,ct="LR",kt()},"clear"),Lt=o(function(e){ct=e},"setDirection"),Mt=o(function(){return ct},"getDirection"),At=o(function(e){U=e,lt.push(e)},"addSection"),Ct=o(function(){return lt},"getSections"),Rt=o(function(){let e=_t(),t=100,r=0;for(;!e&&r<t;)e=_t(),r++;return J.push(...X),J},"getTasks"),Wt=o(function(e,t,r){let s={id:Nt++,section:U,type:U,task:e,score:t||0,events:r?[r]:[]};X.push(s)},"addTask"),Pt=o(function(e){X.find(r=>r.id===Nt-1).events.push(e)},"addEvent"),Bt=o(function(e){let t={section:U,type:U,description:e,task:e,classes:[]};J.push(t)},"addTaskOrg"),_t=o(function(){let e=o(function(r){return X[r].processed},"compileTask"),t=!0;for(let[r,s]of X.entries())e(r),t=t&&s.processed;return t},"compileTasks"),Ut={clear:Ht,getCommonDb:It,getDirection:Mt,setDirection:Lt,addSection:At,getSections:Ct,getTasks:Rt,addTask:Wt,addTaskOrg:Bt,addEvent:Pt},Vt=0,Q=o(function(e,t){let r=e.append("rect");return r.attr("x",t.x),r.attr("y",t.y),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("width",t.width),r.attr("height",t.height),r.attr("rx",t.rx),r.attr("ry",t.ry),t.class!==void 0&&r.attr("class",t.class),r},"drawRect"),Xt=o(function(e,t){let s=e.append("circle").attr("cx",t.cx).attr("cy",t.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=e.append("g");n.append("circle").attr("cx",t.cx-15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",t.cx+15/3).attr("cy",t.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function h(f){let g=st().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);f.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+2)+")")}o(h,"smile");function c(f){let g=st().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);f.append("path").attr("class","mouth").attr("d",g).attr("transform","translate("+t.cx+","+(t.cy+7)+")")}o(c,"sad");function a(f){f.append("line").attr("class","mouth").attr("stroke",2).attr("x1",t.cx-5).attr("y1",t.cy+7).attr("x2",t.cx+5).attr("y2",t.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return o(a,"ambivalent"),t.score>3?h(n):t.score<3?c(n):a(n),s},"drawFace"),Zt=o(function(e,t){let r=e.append("circle");return r.attr("cx",t.cx),r.attr("cy",t.cy),r.attr("class","actor-"+t.pos),r.attr("fill",t.fill),r.attr("stroke",t.stroke),r.attr("r",t.r),r.class!==void 0&&r.attr("class",r.class),t.title!==void 0&&r.append("title").text(t.title),r},"drawCircle"),Ft=o(function(e,t){let r=t.text.replace(/<br\s*\/?>/gi," "),s=e.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class!==void 0&&s.attr("class",t.class);let n=s.append("tspan");return n.attr("x",t.x+t.textMargin*2),n.text(r),s},"drawText"),jt=o(function(e,t){function r(n,h,c,a,f){return n+","+h+" "+(n+c)+","+h+" "+(n+c)+","+(h+a-f)+" "+(n+c-f*1.2)+","+(h+a)+" "+n+","+(h+a)}o(r,"genPoints");let s=e.append("polygon");s.attr("points",r(t.x,t.y,50,20,7)),s.attr("class","labelBox"),t.y=t.y+t.labelMargin,t.x=t.x+.5*t.labelMargin,Ft(e,t)},"drawLabel"),qt=o(function(e,t,r){let s=e.append("g"),n=ht();n.x=t.x,n.y=t.y,n.fill=t.fill,n.width=r.width,n.height=r.height,n.class="journey-section section-type-"+t.num,n.rx=3,n.ry=3,Q(s,n),zt(r)(t.text,s,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+t.num},r,t.colour)},"drawSection"),ot=-1,Jt=o(function(e,t,r,s){let n=t.x+r.width/2,h=e.append("g");ot++,h.append("line").attr("id",s+"-task"+ot).attr("x1",n).attr("y1",t.y).attr("x2",n).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),Xt(h,{cx:n,cy:300+(5-t.score)*30,score:t.score});let a=ht();a.x=t.x,a.y=t.y,a.fill=t.fill,a.width=r.width,a.height=r.height,a.class="task task-type-"+t.num,a.rx=3,a.ry=3,Q(h,a),zt(r)(t.task,h,a.x,a.y,a.width,a.height,{class:"task"},r,t.colour)},"drawTask"),Qt=o(function(e,t){Q(e,{x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,class:"rect"}).lower()},"drawBackgroundRect"),Yt=o(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),ht=o(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),zt=(function(){function e(n,h,c,a,f,g,x,y){let k=h.append("text").attr("x",c+f/2).attr("y",a+g/2+5).style("font-color",y).style("text-anchor","middle").text(n);s(k,x)}o(e,"byText");function t(n,h,c,a,f,g,x,y,k){let{taskFontSize:i,taskFontFamily:d}=y,l=n.split(/<br\s*\/?>/gi);for(let p=0;p<l.length;p++){let m=p*i-i*(l.length-1)/2,u=h.append("text").attr("x",c+f/2).attr("y",a).attr("fill",k).style("text-anchor","middle").style("font-size",i).style("font-family",d);u.append("tspan").attr("x",c+f/2).attr("dy",m).text(l[p]),u.attr("y",a+g/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),s(u,x)}}o(t,"byTspan");function r(n,h,c,a,f,g,x,y){let k=h.append("switch"),d=k.append("foreignObject").attr("x",c).attr("y",a).attr("width",f).attr("height",g).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(n),t(n,k,c,a,f,g,x,y),s(d,x)}o(r,"byFo");function s(n,h){for(let c in h)c in h&&n.attr(c,h[c])}return o(s,"_setTextAttrs"),function(n){return n.textPlacement==="fo"?r:n.textPlacement==="old"?e:t}})(),te=o(function(e,t){Vt=0,ot=-1,e.append("defs").append("marker").attr("id",t+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function dt(e,t){e.each(function(){var r=K(this),s=r.text().split(/(\s+|<br>)/).reverse(),n,h=[],c=1.1,a=r.attr("y"),f=parseFloat(r.attr("dy")),g=r.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",f+"em");for(let x=0;x<s.length;x++)n=s[s.length-1-x],h.push(n),g.text(h.join(" ").trim()),(g.node().getComputedTextLength()>t||n==="<br>")&&(h.pop(),g.text(h.join(" ").trim()),n==="<br>"?h=[""]:h=[n],g=r.append("tspan").attr("x",0).attr("y",a).attr("dy",c+"em").text(n))})}o(dt,"wrap");var ee=o(function(e,t,r,s,n,h=!1){let{theme:c,look:a}=s,f=c?.includes("redux"),g=s?.themeVariables?.THEME_COLOR_LIMIT??12,x=r%g-1,y=e.append("g");t.section=x,y.attr("class",(t.class?t.class+" ":"")+"timeline-node "+("section-"+x));let k=y.append("g"),i=y.append("g"),l=i.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(dt,t.width).node().getBBox(),p=s.fontSize?.replace?s.fontSize.replace("px",""):s.fontSize;if(t.height=l.height+p*1.1*.5+t.padding,t.height=Math.max(t.height,t.maxHeight),t.width=t.width+2*t.padding,i.attr("transform","translate("+t.width/2+", "+t.padding/2+")"),f&&i.attr("transform",`translate(${t.width/2}, ${h?t.padding/2+3:t.padding})`),ne(k,t,x,n,s),a==="neo"&&(y.attr("data-look","neo"),f)){let m=c.includes("dark"),u=e.node()?.ownerSVGElement??e.node(),w=K(u),b=w.attr("id")??"",I=b?`${b}-drop-shadow`:"drop-shadow";if(w.select(`#${I}`).empty()){let P=w.select("defs");(P.empty()?w.append("defs"):P).append("filter").attr("id",I).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",m?"0.2":"0.06").attr("flood-color",m?"#FFFFFF":"#000000")}}return t},"drawNode"),re=o(function(e,t,r){let s=e.append("g"),h=s.append("text").text(t.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(dt,t.width).node().getBBox(),c=r.fontSize?.replace?r.fontSize.replace("px",""):r.fontSize;return s.remove(),h.height+c*1.1*.5+t.padding},"getVirtualNodeHeight"),ne=o(function(e,t,r,s,n){let{theme:h}=n,c=h?.includes("redux")?0:5,a=5,f=c>0?`M0 ${t.height-a} v${-t.height+2*a} q0,-${c},${c},-${c} h${t.width-2*a} q${c},0,${c},${c} v${t.height-a} H0 Z`:`M0 ${t.height-a} v${-(t.height-a)} h${t.width} v${t.height} H0 Z`;e.append("path").attr("id",s+"-node-"+Vt++).attr("class","node-bkg node-"+t.type).attr("d",f),h?.includes("redux")||e.append("line").attr("class","node-line-"+r).attr("x1",0).attr("y1",t.height).attr("x2",t.width).attr("y2",t.height)},"defaultBkg"),C={drawRect:Q,drawCircle:Zt,drawSection:qt,drawText:Ft,drawLabel:jt,drawTask:Jt,drawBackgroundRect:Qt,getTextObj:Yt,getNoteRect:ht,initGraphics:te,drawNode:ee,getVirtualNodeHeight:re},ie=o(function(e,t,r,s){let n=it(),{look:h,theme:c,themeVariables:a}=n,{useGradient:f,gradientStart:g,gradientStop:x}=a,y=n.timeline?.leftMargin??50;_.debug("timeline",s.db);let k=n.securityLevel,i;k==="sandbox"&&(i=K("#i"+t));let l=(k==="sandbox"?K(i.nodes()[0].contentDocument.body):K("body")).select("#"+t);l.append("g");let p=s.db.getTasks(),m=s.db.getCommonDb().getDiagramTitle();_.debug("task",p),C.initGraphics(l,t);let u=s.db.getSections();_.debug("sections",u);let w=0,b=0,I=0,P=0,B=50+y,G=50;P=50;let L=0,R=!0;u.forEach(function($){let v={number:L,descr:$,section:L,width:150,padding:20,maxHeight:w},T=C.getVirtualNodeHeight(l,v,n);_.debug("sectionHeight before draw",T),w=Math.max(w,T+20)});let E=0,A=0;_.debug("tasks.length",p.length);for(let[$,v]of p.entries()){let T={number:$,descr:v,section:v.section,width:150,padding:20,maxHeight:b},S=C.getVirtualNodeHeight(l,T,n);_.debug("taskHeight before draw",S),b=Math.max(b,S+20),E=Math.max(E,v.events.length);let H=0;for(let M of v.events){let N={descr:M,section:v.section,number:v.section,width:150,padding:20,maxHeight:50};H+=C.getVirtualNodeHeight(l,N,n)}v.events.length>0&&(H+=(v.events.length-1)*10),A=Math.max(A,H)}_.debug("maxSectionHeight before draw",w),_.debug("maxTaskHeight before draw",b),u&&u.length>0?u.forEach($=>{let v=p.filter(M=>M.section===$),T={number:L,descr:$,section:L,width:200*Math.max(v.length,1)-50,padding:20,maxHeight:w};_.debug("sectionNode",T);let S=l.append("g"),H=C.drawNode(S,T,L,n,t);_.debug("sectionNode output",H),S.attr("transform",`translate(${B}, ${P})`),G+=w+50,v.length>0&&wt(l,v,L,B,G,b,n,E,A,w,!1,t),B+=200*Math.max(v.length,1),G=P,L++}):(R=!1,wt(l,p,L,B,G,b,n,E,A,w,!0,t));let V=l.node().getBBox();if(_.debug("bounds",V),m&&l.append("text").text(m).attr("x",h==="neo"?V.x*2+y:V.width/2-y).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),I=R?w+b+150:b+100,l.append("g").attr("class","lineWrapper").append("line").attr("x1",y).attr("y1",I).attr("x2",V.width+3*y).attr("y2",I).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${t}-arrowhead)`),h==="neo"&&f&&c!=="neutral"){let $=l.select("defs"),T=($.empty()?l.append("defs"):$).append("linearGradient").attr("id",l.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");T.append("stop").attr("offset","0%").attr("stop-color",g).attr("stop-opacity",1),T.append("stop").attr("offset","100%").attr("stop-color",x).attr("stop-opacity",1)}nt(void 0,l,n.timeline?.padding??50,n.timeline?.useMaxWidth??!1)},"draw"),wt=o(function(e,t,r,s,n,h,c,a,f,g,x,y){for(let k of t){let i={descr:k.task,section:r,number:r,width:150,padding:20,maxHeight:h};_.debug("taskNode",i);let d=e.append("g").attr("class","taskWrapper"),p=C.drawNode(d,i,r,c,y).height;if(_.debug("taskHeight after draw",p),d.attr("transform",`translate(${s}, ${n})`),h=Math.max(h,p),k.events){let m=e.append("g").attr("class","lineWrapper"),u=h;n+=100,u=u+se(e,k.events,r,s,n,c,y),n-=100,m.append("line").attr("x1",s+190/2).attr("y1",n+h).attr("x2",s+190/2).attr("y2",n+h+100+f+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${y}-arrowhead)`).attr("stroke-dasharray","5,5")}s=s+200,x&&!c.timeline?.disableMulticolor&&r++}n=n-10},"drawTasks"),se=o(function(e,t,r,s,n,h,c){let a=0,f=n;n=n+100;for(let g of t){let x={descr:g,section:r,number:r,width:150,padding:20,maxHeight:50};_.debug("eventNode",x);let y=e.append("g").attr("class","eventWrapper"),i=C.drawNode(y,x,r,h,c,!0).height;a=a+i,y.attr("transform",`translate(${s}, ${n})`),n=n+10+i}return n=f,a},"drawEvents"),ae={setConf:o(()=>{},"setConf"),draw:ie},Y=200,z=5,oe=Y+z*2,ut=Y+100,ce=ut+z*2,Ot=10,le=0,St=20,Gt=20,Et=30,Dt=50,he=o(function(e,t,r,s){let n=it(),h=n.timeline?.leftMargin??50;_.debug("timeline",s.db);let c=bt(t);c.append("g");let a=s.db.getTasks(),f=s.db.getCommonDb().getDiagramTitle();_.debug("task",a),C.initGraphics(c);let g=s.db.getSections();_.debug("sections",g);let x=0,y=0,k=50+h,i=50,d=i,l=k,p=oe+Gt,m=ce+Dt,u=l+p,w=0,b=g&&g.length>0,I=b?u:k+p,P=Math.max(50,p+m-z*2);g.forEach(function($){let v={number:w,descr:$,section:w,width:P,padding:z,maxHeight:x},T=C.getVirtualNodeHeight(c,v,n);_.debug("sectionHeight before draw",T),x=Math.max(x,T)});let B=0;_.debug("tasks.length",a.length);for(let[$,v]of a.entries()){let T={number:$,descr:v,section:v.section,width:Y,padding:z,maxHeight:y},S=C.getVirtualNodeHeight(c,T,n);_.debug("taskHeight before draw",S),y=Math.max(y,S);let H=0;for(let M of v.events){let N={descr:M,section:v.section,number:v.section,width:ut,padding:z,maxHeight:50};H+=C.getVirtualNodeHeight(c,N,n)}v.events.length>0&&(H+=(v.events.length-1)*Ot),B=Math.max(B,H)+le}_.debug("maxSectionHeight before draw",x),_.debug("maxTaskHeight before draw",y);let L=Math.max(y,B)+Et;b?g.forEach($=>{let v=a.filter(O=>O.section===$),T={number:w,descr:$,section:w,width:P,padding:z,maxHeight:x};_.debug("sectionNode",T);let S=c.append("g"),H=C.drawNode(S,T,w,n);_.debug("sectionNode output",H);let M=I-p;S.attr("transform",`translate(${M}, ${i})`);let N=i+H.height+St;v.length>0&&Tt(c,v,w,I,N,y,n,L,!1);let tt=v.length,Z=H.height+St+L*Math.max(tt,1)-(tt>0?Et*2:0);i+=Z,w++}):Tt(c,a,w,I,i,y,n,L,!0);let R=c.node()?.getBBox();if(!R)throw new Error("bbox not found");if(_.debug("bounds",R),f){if(c.append("text").text(f).attr("x",R.width/2-h).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),R=c.node()?.getBBox(),!R)throw new Error("bbox not found");_.debug("bounds after title",R)}let[E]=vt(n.fontSize),A=(E??16)*2,V=(E??16)*.5+20,D=c.append("g").attr("class","lineWrapper");D.append("line").attr("x1",I).attr("y1",d-A).attr("x2",I).attr("y2",R.y+R.height+V).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),D.lower(),nt(void 0,c,n.timeline?.padding??50,n.timeline?.useMaxWidth??!1)},"draw"),Tt=o(function(e,t,r,s,n,h,c,a,f){for(let g of t){let x={descr:g.task,section:r,number:r,width:Y,padding:z,maxHeight:h};_.debug("taskNode",x);let y=e.append("g").attr("class","taskWrapper"),k=C.drawNode(y,x,r,c),i=k.height;_.debug("taskHeight after draw",i);let d=s-Gt-k.width;if(y.attr("transform",`translate(${d}, ${n})`),h=Math.max(h,i),g.events&&g.events.length>0){let l=n,p=s+Dt;de(e,g.events,r,s,p,l,c)}n=n+a,f&&!c.timeline?.disableMulticolor&&r++}},"drawTasks"),de=o(function(e,t,r,s,n,h,c){let a=h;for(let f of t){let g={descr:f,section:r,number:r,width:ut,padding:z,maxHeight:0};_.debug("eventNode",g);let x=e.append("g").attr("class","eventWrapper"),k=C.drawNode(x,g,r,c).height;x.attr("transform",`translate(${n}, ${a})`);let i=e.append("g").attr("class","lineWrapper"),d=a+k/2;i.append("line").attr("x1",s).attr("y1",d).attr("x2",n).attr("y2",d).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),a=a+k+Ot}return a-h},"drawEvents"),ue={setConf:o(()=>{},"setConf"),draw:he},pe=o(e=>{let{theme:t}=rt(),r=t?.includes("dark"),s=t?.includes("color"),n=e.svgId?.replace(/^#/,"")??"",h=n?`url(#${n}-drop-shadow)`:e.dropShadow??"none",c="";for(let a=0;a<e.THEME_COLOR_LIMIT;a++){let f=`${17-3*a}`,g=s?e.borderColorArray[a]:e.mainBkg,x=s?e.borderColorArray[a]:e.nodeBorder;c+=`
|
|
7
|
+
.section-${a-1} rect,
|
|
8
|
+
.section-${a-1} path,
|
|
9
|
+
.section-${a-1} circle {
|
|
10
|
+
fill: ${r&&s?e.mainBkg:g};
|
|
11
|
+
stroke: ${x};
|
|
12
|
+
stroke-width: ${e.strokeWidth};
|
|
13
|
+
filter: ${h};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.section-${a-1} text {
|
|
17
|
+
fill: ${e.nodeBorder};
|
|
18
|
+
font-weight: ${e.fontWeight}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.node-icon-${a-1} {
|
|
22
|
+
font-size: 40px;
|
|
23
|
+
color: ${e["cScaleLabel"+a]};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.section-edge-${a-1} {
|
|
27
|
+
stroke: ${e["cScale"+a]};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.edge-depth-${a-1} {
|
|
31
|
+
stroke-width: ${f};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.section-${a-1} line {
|
|
35
|
+
stroke: ${e["cScaleInv"+a]};
|
|
36
|
+
stroke-width: 3;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.lineWrapper line {
|
|
40
|
+
stroke: ${e.nodeBorder};
|
|
41
|
+
stroke-width:${e.strokeWidth}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.disabled,
|
|
45
|
+
.disabled circle,
|
|
46
|
+
.disabled text {
|
|
47
|
+
fill: ${e.tertiaryColor??"lightgray"};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.disabled text {
|
|
51
|
+
fill: ${e.clusterBorder??"#efefef"};
|
|
52
|
+
}
|
|
53
|
+
`}return c},"genReduxSections"),ge=o(e=>{let t="";for(let r=0;r<e.THEME_COLOR_LIMIT;r++)e["lineColor"+r]=e["lineColor"+r]||e["cScaleInv"+r],ft(e["lineColor"+r])?e["lineColor"+r]=yt(e["lineColor"+r],20):e["lineColor"+r]=mt(e["lineColor"+r],20);for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let s=""+(17-3*r);t+=`
|
|
54
|
+
.section-${r-1} rect, .section-${r-1} path, .section-${r-1} circle, .section-${r-1} path {
|
|
55
|
+
fill: ${e["cScale"+r]};
|
|
56
|
+
}
|
|
57
|
+
.section-${r-1} text {
|
|
58
|
+
fill: ${e["cScaleLabel"+r]};
|
|
59
|
+
}
|
|
60
|
+
.node-icon-${r-1} {
|
|
61
|
+
font-size: 40px;
|
|
62
|
+
color: ${e["cScaleLabel"+r]};
|
|
63
|
+
}
|
|
64
|
+
.section-edge-${r-1}{
|
|
65
|
+
stroke: ${e["cScale"+r]};
|
|
66
|
+
}
|
|
67
|
+
.edge-depth-${r-1}{
|
|
68
|
+
stroke-width: ${s};
|
|
69
|
+
}
|
|
70
|
+
.section-${r-1} line {
|
|
71
|
+
stroke: ${e["cScaleInv"+r]} ;
|
|
72
|
+
stroke-width: 3;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.lineWrapper line{
|
|
76
|
+
stroke: ${e["cScaleLabel"+r]} ;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.disabled, .disabled circle, .disabled text {
|
|
80
|
+
fill: ${e.tertiaryColor??"lightgray"};
|
|
81
|
+
}
|
|
82
|
+
.disabled text {
|
|
83
|
+
fill: ${e.clusterBorder??"#efefef"};
|
|
84
|
+
}
|
|
85
|
+
`}return t},"genSections"),fe=o(e=>{let{theme:t}=rt(),r=t?.includes("redux"),s=t==="neutral",n=e.svgId?.replace(/^#/,"")??"",h="";if(e.useGradient&&n&&e.THEME_COLOR_LIMIT&&!s)for(let c=0;c<e.THEME_COLOR_LIMIT;c++)h+=`
|
|
86
|
+
.section-${c-1}[data-look="neo"] rect,
|
|
87
|
+
.section-${c-1}[data-look="neo"] path,
|
|
88
|
+
.section-${c-1}[data-look="neo"] circle {
|
|
89
|
+
fill: ${e.mainBkg};
|
|
90
|
+
stroke: url(#${n}-gradient);
|
|
91
|
+
stroke-width: 2;
|
|
92
|
+
}
|
|
93
|
+
.section-${c-1}[data-look="neo"] line {
|
|
94
|
+
stroke: url(#${n}-gradient);
|
|
95
|
+
stroke-width: 2;
|
|
96
|
+
}`;return`
|
|
97
|
+
.edge {
|
|
98
|
+
stroke-width: 3;
|
|
99
|
+
}
|
|
100
|
+
${r?pe(e):ge(e)}
|
|
101
|
+
${h}
|
|
102
|
+
.section-root rect, .section-root path, .section-root circle {
|
|
103
|
+
fill: ${e.git0};
|
|
104
|
+
}
|
|
105
|
+
.section-root text {
|
|
106
|
+
fill: ${e.gitBranchLabel0};
|
|
107
|
+
}
|
|
108
|
+
.icon-container {
|
|
109
|
+
height:100%;
|
|
110
|
+
display: flex;
|
|
111
|
+
justify-content: center;
|
|
112
|
+
align-items: center;
|
|
113
|
+
}
|
|
114
|
+
.edge {
|
|
115
|
+
fill: none;
|
|
116
|
+
}
|
|
117
|
+
.eventWrapper {
|
|
118
|
+
filter: brightness(120%);
|
|
119
|
+
}
|
|
120
|
+
`},"getStyles"),ye=fe,me={setConf:o(()=>{},"setConf"),draw:o((e,t,r,s)=>(s?.db?.getDirection?.()??"LR")==="TD"?ue.draw(e,t,r,s):ae.draw(e,t,r,s),"draw")},Te={db:$t,renderer:me,parser:Kt,styles:ye};export{Te as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as r}from"./chunk-RWFFDL53.js";import"./chunk-VYZZPKGK.js";import"./chunk-6DHFEWGX.js";export{e as TreeViewModule,r as createTreeViewServices};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as r}from"./chunk-OE3NOVIH.js";import"./chunk-VYZZPKGK.js";import"./chunk-6DHFEWGX.js";export{e as TreemapModule,r as createTreemapServices};
|