@codingame/monaco-vscode-markdown-language-features-default-extension 36.2.6 → 37.0.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.
- package/index.js +237 -23
- package/package.json +2 -2
- package/resources/abnfDiagram-VCTEODGH-MFZBS7QV.js +1 -0
- package/resources/architecture-7GRP2DOG-KMESPJ5A.js +1 -0
- package/resources/architectureDiagram-5GKGNRK7-MTTZPDNG.js +36 -0
- package/resources/blockDiagram-NRAW4CY4-UDRMVB5I.js +129 -0
- package/resources/c4Diagram-UCG6FXSJ-CNUYFC6N.js +38 -0
- package/resources/chunk-2KBWIZHB.js +14 -0
- package/resources/chunk-3CEAP2V5.js +1 -0
- package/resources/chunk-43RBMH4Y.js +1 -0
- package/resources/chunk-4AUIAGYT.js +1 -0
- package/resources/chunk-4PRM3W7S.js +88 -0
- package/resources/chunk-5DJUZA4F.js +1 -0
- package/resources/chunk-6LQNQPBM.js +1 -0
- package/resources/chunk-A3DHMJKP.js +1 -0
- package/resources/chunk-ATDVZUJ2.js +231 -0
- package/resources/chunk-CBQW2LLN.js +1 -0
- package/resources/chunk-CCQNES6G.js +1 -0
- package/resources/chunk-CD5RYVNW.js +1 -0
- package/resources/chunk-CQFFNO72.js +1 -0
- package/resources/chunk-EWILYK3H.js +1 -0
- package/resources/chunk-EWVD6AUZ.js +15 -0
- package/resources/chunk-EXFMYL6U.js +1 -0
- package/resources/chunk-FH3BATM5.js +1 -0
- package/resources/chunk-FK4OKHO7.js +178 -0
- package/resources/chunk-FZLE27CN.js +1 -0
- package/resources/chunk-HRJ5UBVC.js +1 -0
- package/resources/chunk-IEMKBRIG.js +339 -0
- package/resources/chunk-IRNO36C3.js +1 -0
- package/resources/chunk-J4SQIVOP.js +1 -0
- package/resources/chunk-JAORNH2M.js +2 -0
- package/resources/chunk-JBQZ5UCE.js +1 -0
- package/resources/chunk-JFI5BOLY.js +1 -0
- package/resources/chunk-JXCTOEX6.js +1 -0
- package/resources/chunk-K2JFJOPP.js +1 -0
- package/resources/chunk-LK6KML2S.js +10 -0
- package/resources/chunk-MNHOAW4R.js +3 -0
- package/resources/chunk-NLCJ5AKJ.js +132 -0
- package/resources/chunk-OOJM4CTU.js +1 -0
- package/resources/chunk-R7CM4BQN.js +2 -0
- package/resources/chunk-RBL2QVA3.js +1 -0
- package/resources/chunk-SNGMH3JW.js +2 -0
- package/resources/chunk-TGD3YKTU.js +32 -0
- package/resources/chunk-TGYBLZFN.js +1 -0
- package/resources/chunk-U3E5RSXE.js +62 -0
- package/resources/chunk-U7TCJVVP.js +1 -0
- package/resources/chunk-WSHCWW4Q.js +2 -0
- package/resources/chunk-WVYKIHVG.js +1 -0
- package/resources/chunk-XCMS6RVA.js +1 -0
- package/resources/chunk-XM54GAH3.js +206 -0
- package/resources/chunk-YICKNY6Y.js +1 -0
- package/resources/chunk-YNKYB66X.js +257 -0
- package/resources/chunk-ZMBQGVIF.js +1 -0
- package/resources/chunk-ZNREFWKG.js +1 -0
- package/resources/chunk-ZU7JKVUR.js +168 -0
- package/resources/chunk-ZYRITDEB.js +72 -0
- package/resources/classDiagram-DTDB5LWJ-TBJLBGTZ.js +1 -0
- package/resources/codicon-R6HEZFPR.ttf +0 -0
- package/resources/cose-bilkent-JH36ORCC-7TCRTQWC.js +1 -0
- package/resources/cynefin-OW5HDTMX-QMEUXFXO.js +1 -0
- package/resources/cynefinDiagram-5FMLGOSQ-J745EYTI.js +62 -0
- package/resources/dagre-3AP2YEHR-CUFPL4A5.js +4 -0
- package/resources/diagram-S7CK7UJ4-SC5AFKXH.js +30 -0
- package/resources/diagram-UQ7AKVKN-3O7WQJXE.js +41 -0
- package/resources/diagram-VSXAHHWV-SN3VCCS5.js +3 -0
- package/resources/diagram-VX7I27RA-7PQJWMN5.js +24 -0
- package/resources/diagram-Z3DM3KII-QZ45TJFK.js +24 -0
- package/resources/ebnfDiagram-PWID7BFC-CBJPGG56.js +1 -0
- package/resources/editor.css.txt +1 -1
- package/resources/editor.js +137 -3431
- package/resources/editor.ts +587 -46
- package/resources/erDiagram-SSCWMZ5O-TUKYG42P.js +99 -0
- package/resources/eventmodeling-NTZA5JFV-MGOPW7BD.js +1 -0
- package/resources/extension.js +179 -172
- package/resources/extension.js.map +4 -4
- package/resources/flowDiagram-A5DVABFB-M6K5X26V.js +1 -0
- package/resources/ganttDiagram-EL5Y4UJY-JCSKUU2V.js +292 -0
- package/resources/gitGraph-4MIJSDKK-ITDCTFJT.js +1 -0
- package/resources/gitGraphDiagram-WWUBYQGX-RXRB5JA2.js +106 -0
- package/resources/index.js +3 -3
- package/resources/index2.js +17 -17
- package/resources/info-A6RAGUB7-VXIEHQAI.js +1 -0
- package/resources/infoDiagram-RXCK75RN-2T6V4JS2.js +2 -0
- package/resources/ishikawaDiagram-5VMMS53U-6WC4IGXZ.js +70 -0
- package/resources/journeyDiagram-EYS64GPL-PZQYT6UF.js +139 -0
- package/resources/kanban-definition-3QL26DDD-VYBV345J.js +89 -0
- package/resources/katex-QJ7O5CJ5.js +1 -0
- package/resources/linkPresentationProvider.ts +179 -0
- package/resources/markdown.css.txt +39 -0
- package/resources/markdownEditor.css.txt +13 -0
- package/resources/mermaid.core-S5KCHHL2.js +18 -0
- package/resources/mindmap-definition-FBJOCRG2-H3I5F4WB.js +96 -0
- package/resources/package.json +1 -1
- package/resources/package.nls.json +1 -1
- package/resources/package.schema.json +1 -1
- package/resources/packet-AYTQ26CC-WLFKOXIZ.js +1 -0
- package/resources/pegDiagram-XKGWAZYB-HUV4U5RU.js +1 -0
- package/resources/pie-WAS4IAKB-GZIMD664.js +1 -0
- package/resources/pieDiagram-E7YTZNPT-XOJEVCEO.js +39 -0
- package/resources/pre.js +1 -1
- package/resources/preview-dark.svg +1 -1
- package/resources/preview-light.svg +1 -1
- package/resources/quadrantDiagram-AXDQQJYC-YPPZYAGP.js +7 -0
- package/resources/radar-RG4KPBEZ-URG5LVGS.js +1 -0
- package/resources/railroad-74A4TZTK-3ZMXCKLP.js +1 -0
- package/resources/railroad-abnf-HS5TGJTU-LBR5MV33.js +1 -0
- package/resources/railroad-ebnf-LZEXJU2U-YEVF3EJR.js +1 -0
- package/resources/railroad-peg-WCYAUIDC-CV774YSK.js +1 -0
- package/resources/railroadDiagram-O6MQD6OU-YZF7JNDT.js +1 -0
- package/resources/requirementDiagram-EFPCY7ZU-PZ7BYTDZ.js +84 -0
- package/resources/sankeyDiagram-P5KCCOFB-3P5DWREA.js +40 -0
- package/resources/sequenceDiagram-WJ2MYXX4-O52K5NPU.js +162 -0
- package/resources/sizeCapture-X5ZJPWSS-PRFE7SKK.js +1 -0
- package/resources/stateDiagram-HBIQ2CUA-KDPYCQOT.js +1 -0
- package/resources/stateDiagram-v2-4QOOHH4V-QBQE56JB.js +1 -0
- package/resources/swimlanes-XN3QIQJK-YCLJ3KIH.js +1 -0
- package/resources/swimlanesDiagram-VK2B7HYN-RS7VRH6T.js +8 -0
- package/resources/syntaxHighlighter.ts +2 -2
- package/resources/timeline-definition-24CTP7MA-GQ3MCHCF.js +120 -0
- package/resources/treeView-Q6P3EWNA-UEXUSAGC.js +1 -0
- package/resources/treemap-WGGIJYW6-NFXJPDAT.js +1 -0
- package/resources/tsconfig.json +1 -1
- package/resources/vennDiagram-4TSXK5OY-PNMXQJF6.js +34 -0
- package/resources/wardley-WFR3VGLG-MQ6DEZYA.js +1 -0
- package/resources/wardleyDiagram-VM6X3IG4-46KJTB57.js +78 -0
- package/resources/xychartDiagram-S5SC5T6Z-NSN5W7VL.js +7 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as Ao}from"./chunk-A3DHMJKP.js";import"./chunk-2KBWIZHB.js";import"./chunk-RBL2QVA3.js";import{a as xn}from"./chunk-LK6KML2S.js";import"./chunk-CBQW2LLN.js";import"./chunk-U3E5RSXE.js";import"./chunk-EWILYK3H.js";import"./chunk-XCMS6RVA.js";import"./chunk-ZYRITDEB.js";import"./chunk-4AUIAGYT.js";import"./chunk-JAORNH2M.js";import"./chunk-JBQZ5UCE.js";import"./chunk-NLCJ5AKJ.js";import{b as Xe}from"./chunk-3CEAP2V5.js";import{a as f}from"./chunk-6LQNQPBM.js";import"./chunk-OOJM4CTU.js";var wo=5,Ye=1e-5,Ge=1e-6;function We(t){let e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}f(We,"buildSegmentList");function Po(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,g=o.y-n.y,l=s*g-r*i;if(l===0)return null;let a=n.x-t.x,u=n.y-t.y,y=(a*g-u*i)/l,L=(a*r-u*s)/l;return y<=Ge||y>=1-Ge||L<=Ge||L>=1-Ge?null:{point:{x:t.x+y*s,y:t.y+y*r},tA:y,tB:L}}f(Po,"segmentIntersection");function Cn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}f(Cn,"isHorizontalSeg");function ko(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n],s=We(o.points);for(let r=n+1;r<t.length;r++){let i=t[r],g=We(i.points);for(let[l,a]of s.entries())for(let[u,y]of g.entries()){let L=Po(a.a,a.b,y.a,y.b);if(!L)continue;let m=Cn(a),h=Cn(y);(m!==h?m:!1)?e.push({jumpEdgeId:o.id,otherEdgeId:i.id,segIndex:l,t:L.tA,point:L.point}):e.push({jumpEdgeId:i.id,otherEdgeId:o.id,segIndex:u,t:L.tB,point:L.point})}}}return e}f(ko,"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 _o(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(_o,"getArcSweepFlag");var vr=.001;function Do(t,e){if(t.length<2)return t.map(r=>({...r}));let n=t.map(r=>({...r})),o=e.arrowTypeStart&&xn[e.arrowTypeStart];if(o){let r=t[0],i=t[1],g=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(g),n[0].y=r.y+o*Math.sin(g)}let s=e.arrowTypeEnd&&xn[e.arrowTypeEnd];if(s){let r=t.length,i=t[r-2],g=t[r-1],l=Math.atan2(g.y-i.y,g.x-i.x);n[r-1].x=g.x-s*Math.cos(l),n[r-1].y=g.y-s*Math.sin(l)}return n}f(Do,"applyMarkerOffsets");function Ho(t,e,n,o,s){let r=t.point.x,i=t.point.y,g={x:r-e*t.r,y:i-n*t.r},l={x:r+e*t.r,y:i+n*t.r},a=[`L${Ae(g)}`];return s==="arc"?a.push(`A${re(t.r)},${re(t.r)} 0 0 ${o} ${Ae(l)}`):a.push(`M${Ae(l)}`),a}f(Ho,"emitJump");function vn(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,g=n.y-e.y,l=Math.hypot(s,r),a=Math.hypot(i,g);if(l<Ye||a<Ye)return null;let u=s/l,y=r/l,L=i/a,m=g/a,h=u*L+y*m,c=Math.max(-1,Math.min(1,h)),p=Math.acos(c);if(p<Ye||Math.abs(Math.PI-p)<Ye)return null;let C=Math.min(o/Math.sin(p/2),l/2,a/2);return{startX:e.x-u*C,startY:e.y-y*C,endX:e.x+L*C,endY:e.y+m*C,ctrlX:e.x,ctrlY:e.y,cutLen:C}}f(vn,"computeRoundedCorner");function Xo(t,e,n){let o=t.points;if(o.length<2)return"";let s=Do(o,t),r=t.curve==="rounded",i=We(s),g=new Map;for(let a of e){let u=i[a.segIndex];if(!u)continue;let y=Math.hypot(u.b.x-u.a.x,u.b.y-u.a.y),L=g.get(a.segIndex)??[];L.push({t:a.t,point:a.point,d:a.t*y,r:n.jumpRadius}),g.set(a.segIndex,L)}let l=[`M${Ae(s[0])}`];for(let a=0;a<i.length;a++){let u=i[a],y=Math.hypot(u.b.x-u.a.x,u.b.y-u.a.y),L=y===0?0:(u.b.x-u.a.x)/y,m=y===0?0:(u.b.y-u.a.y)/y,h=_o(u),c=0;if(r&&a>0){let v=vn(s[a-1],s[a],s[a+1]??s[a],wo);v&&(c=v.cutLen)}let p=y,C=null;r&&a<i.length-1&&(C=vn(s[a],s[a+1],s[a+2]??s[a+1],wo),C&&(p=y-C.cutLen));let M=[...g.get(a)??[]].sort((v,R)=>v.t-R.t);for(let v of M)v.r=Math.min(v.r,v.d-c,p-v.d);for(let v=0;v<M.length-1;v++){let R=M[v+1].d-M[v].d;if(M[v].r+M[v+1].r>R){let I=R/2;M[v].r=Math.min(M[v].r,I),M[v+1].r=Math.min(M[v+1].r,I)}}for(let v of M)v.r<vr||l.push(...Ho(v,L,m,h,n.jumpStyle));r&&C?(l.push(`L${re(C.startX)},${re(C.startY)}`),l.push(`Q${re(C.ctrlX)},${re(C.ctrlY)} ${re(C.endX)},${re(C.endY)}`)):l.push(`L${Ae(u.b)}`)}return l.join(" ")}f(Xo,"rewriteEdgePath");function Yo(t){return/^[\d\s+,.LMelm-]*$/.test(t)}f(Yo,"isStraightPath");function Go(t){return t?t==="linear"||t==="rounded"||t==="step"||t==="stepBefore"||t==="stepAfter":!0}f(Go,"curveSupportsLineHops");function $o(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($o,"decodeDataPoints");function zo(t,e,n){if(!n.enabled)return;let o=t.node();if(!o)return;let s=new Map;for(let a of e)s.set(a.id,a);let r=[],i=new Map;for(let a of e){let u=typeof CSS<"u"&&CSS.escape?CSS.escape(a.id):a.id,y=o.querySelector(`path[data-id="${u}"]`);if(!y)continue;i.set(a.id,y);let m=$o(y.getAttribute("data-points"))??a.points;r.push({...a,points:m})}let g=ko(r);if(g.length===0)return;let l=new Map;for(let a of g){let u=l.get(a.jumpEdgeId)??[];u.push(a),l.set(a.jumpEdgeId,u)}for(let a of r){let u=l.get(a.id);if(!u||u.length===0)continue;let L=s.get(a.id)?.curve;if(L!==void 0&&!Go(L))continue;let m=i.get(a.id);if(!m)continue;if(L===void 0){let v=m.getAttribute("d")??"";if(!Yo(v))continue}let h=m.getAttribute("style")??"",c=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(h),p=c?Number.parseFloat(c[1]):null,C=c?Number.parseFloat(c[2]):null,M=Xo(a,u,n);if(m.setAttribute("d",M),p!==null&&C!==null&&typeof m.getTotalLength=="function"){let v=m.getTotalLength(),R=Math.max(0,v-p-C),I=`0 ${p} ${R} ${C}`,b=h.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${I};`).replace(/;\s*;+/g,";");m.setAttribute("style",b)}}}f(zo,"applyLineJumpsToSvg");function Vo(t,{measure:e}){let n=t.config?.swimlane?.lineHops;if(n===!1)return;let o=n==="gap"?"gap":"arc",s=t.edges.filter(r=>Array.isArray(r.points)&&r.points.length>=2).map(r=>({id:r.id,points:r.points,curve:r.curve,arrowTypeStart:r.arrowTypeStart,arrowTypeEnd:r.arrowTypeEnd}));zo(e.groups.edgePaths,s,{enabled:!0,jumpRadius:6,jumpStyle:o})}f(Vo,"applySwimlaneLineJumps");var bn="__swimlane_default__",Lr=21,Ro=20;function Ln(t){return Math.max(t.padding??Ro,Ro)}f(Ln,"topLaneHorizontalPadding");function Uo(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,g=Math.min(r,n+s/2),l=Math.min(Lr,Math.max(0,g-i)),a=i+l;if(a<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:a}}f(Uo,"assignTopLaneTitleRect");function jo(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===bn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:bn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(let r of o)r.parentId=bn}f(jo,"prepareLayoutForSwimlanes");function Wo(t){let e=new Map;for(let l of t.nodes??[])e.set(l.id,l);let n=[];for(let l of t.edges??[]){let a=typeof l.start=="string"?l.start:void 0,u=typeof l.end=="string"?l.end:void 0;!a||!u||l.labelNodeId||n.push({id:l.id,src:a,dst:u,ref:l})}let o=t.nodes??[],s=o.filter(l=>l.isGroup),r=o.filter(l=>!l.isGroup);return{nodes:[...[...s].reverse(),...r].map(l=>l.id),edges:n,layout:t,nodeById:e}}f(Wo,"toGraphView");function Ko(t,e,n,o){let{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,g=o?.nodeGap??40,l=0;for(let L of e.layers){let m=0;for(let h of L){let c=r.get(h);if(!c){m++;continue}c.layer=l,c.order=m;let p=n.x[h]??m*g,C=n.y[h]??l*i;c.x=p,c.y=C,m++}l++}let a=s.nodes??[],u=new Map,y=[];for(let L of a){if(!L?.isGroup)continue;L.parentId||y.push(L);let m=a.filter(M=>M.parentId===L.id),h=1/0,c=-1/0,p=1/0,C=-1/0;for(let M of m){let v=M.x??n.x[M.id],R=M.y??n.y[M.id],I=M.width??0,b=M.height??0;v!=null&&R!=null&&(h=Math.min(h,v-I/2),c=Math.max(c,v+I/2),p=Math.min(p,R-b/2),C=Math.max(C,R+b/2))}if(h===1/0||p===1/0)L.x=L.x??0,L.y=L.y??0,L.width=L.width??0,L.height=L.height??0;else{let M=L.padding??20,v=L.parentId?M:2*Ln(L),R=M,I=Math.max(0,c-h)+v,b=Math.max(0,C-p)+R,T=(h+c)/2,N=(p+C)/2;L.x=T,L.y=N,L.width=I,L.height=b,u.set(L.id,{minX:h,maxX:c,minY:p,maxY:C})}}if(y.length>0&&u.size>0){let L=1/0,m=-1/0,h=0;for(let c of y){let p=c.padding??20;p>h&&(h=p);let C=u.get(c.id);C&&(L=Math.min(L,C.minY),m=Math.max(m,C.maxY))}if(L!==1/0&&m!==-1/0){let c=Math.max(0,m-L),C=Math.max(h,36),M=c+2*C,v=(L+m)/2;for(let F of y)F.y=v,F.height=M,F.swimlaneContentTop=L;let R=[...y].sort((F,w)=>{let _=F.x??0,k=w.x??0;return _-k}),I=[],b=[],T=[];for(let F of R){let w=u.get(F.id);if(!w)continue;let _=Math.max(0,w.maxX-w.minX)+2*Ln(F),k=(w.minX+w.maxX)/2;I.push(F.id),b.push(k),T.push(_)}let N=I.length;if(N>0){let F=new Map;if(N===1)F.set(I[0],T[0]);else{let w=[];for(let $=0;$<N-1;$++)w.push(b[$+1]-b[$]);let _=new Array(N);_[0]=0;for(let $=0;$<N-1;$++)_[$+1]=2*w[$]-_[$];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);F.set(I[$],ct)}}for(let w of y){let _=F.get(w.id);_!=null&&(w.width=_),Uo(w)}}}}}f(Ko,"writeBackToLayoutData");var Er="[EdgeLabelNodes]";function qo(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 g=i.start?o.get(i.start):void 0,l=i.end?o.get(i.end):void 0;if(!g||!l){Xe.warn(Er,`Edge ${i.id} has missing source or target node`);continue}let a=`edge-label-${i.start}-${i.end}-${i.id}`,y=g.parentId!==l.parentId?l.parentId:g.parentId,L={id:a,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??"",...g.dir?{dir:g.dir}:{}};e.push(L),i.labelNodeId=a,i.label=void 0,i.text=void 0;let m={id:`${i.id}-to-label`,start:i.start,end:a,type:"normal",isLayoutOnly:!0},h={id:`${i.id}-from-label`,start:a,end:i.end,type:"normal",isLayoutOnly:!0};n.push(m,h)}let s=[...t.nodes,...e],r=[...t.edges,...n];return{...t,nodes:s,edges:r}}f(qo,"createEdgeLabelNodes");var _t=.001;function no(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:we(e,n,o,s)}:void 0}f(no,"measuredNodeRect");function oo(t){if(t.isGroup)return;let e=no(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}f(oo,"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 At(t,e,n=_t){return dt(t,e,n)&&Math.abs(t.y-e.y)>n}f(At,"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 Re(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),g=At(s,r,e);(i||g)&&n.push({index:o,a:s,b:r,horizontal:i,vertical:g})}return n}f(Re,"orthogonalSegmentsForPoints");function Qt(t,e=_t){let n=Re(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 so(t,e=_t){if(!t||t.length!==4)return;let[n,o,s,r]=t;return Tt(n,o,e)&&At(o,s,e)&&Tt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:At(n,o,e)&&Tt(o,s,e)&&At(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}f(so,"classifyThreeSegmentRoute");function sn(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),g=Math.max(t.y,e.y);return r>n.left-o&&s<n.right+o&&g>n.top-o&&i<n.bottom+o}f(sn,"segmentBoundsOverlapRect");function ro(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(ro,"pointInsideRect");function Jo(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}f(Jo,"rectContainsRect");function Ke(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}f(Ke,"rectsOverlap");function En(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}f(En,"inflateRect");function we(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}f(we,"rectFromCenterSize");function qt(t){return no(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 io(t,e,n,o,s,r=_t){let i=e==="left"||e==="right",g=o==="left"||o==="right";if(i&&g){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&&!g){if(e===o){if(dt(t,n,r))return;let L=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:L},{x:n.x,y:L},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&&!g){let u=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 u&&y?[t,{x:n.x,y:t.y},n]:void 0}let l=e==="bottom"&&n.y>t.y||e==="top"&&n.y<t.y,a=o==="left"&&t.x<n.x||o==="right"&&t.x>n.x;return l&&a?[t,{x:t.x,y:n.y},n]:void 0}f(io,"buildOrthogonalPortPath");function co(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(co,"buildSameSideTrackPath");function rn(t){let e=new Map,n=[];for(let o of t){if(o.isEdgeLabel)continue;let s=oo(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}f(rn,"collectRealNodeBounds");function me(t){let e=[],n=[];for(let o of t){let s=oo(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 Zo(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,g=o.height??0;n.push({nodeId:o.id,...we(s,r,i,g)})}return n}f(Zo,"collectLayoutNodeRects");function ao(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(ao,"getNodePairGeometry");function wt(t,e,n,o=[],s=0){for(let r of n)if(!o.includes(r.id)&&sn(t,e,r.rect,-s))return!0;return!1}f(wt,"segmentHitsAnyRect");function lo(t,e,n,o,s=_t,r=1e-6){let i=ht(t,e,s),g=dt(t,e,s),l=ht(n,o,s),a=dt(n,o,s);if(i&&l||g&&a||!(i||g)||!(l||a))return!1;let u=i?{a:t,b:e}:{a:n,b:o},y=g?{a:t,b:e}:{a:n,b:o},L=u.a.y,m=Math.min(u.a.x,u.b.x),h=Math.max(u.a.x,u.b.x),c=y.a.x,p=Math.min(y.a.y,y.b.y),C=Math.max(y.a.y,y.b.y);if(c<m||c>h||L<p||L>C)return!1;let M=Math.abs(c-u.a.x)<r&&Math.abs(L-u.a.y)<r||Math.abs(c-u.b.x)<r&&Math.abs(L-u.b.y)<r,v=Math.abs(c-y.a.x)<r&&Math.abs(L-y.a.y)<r||Math.abs(c-y.b.x)<r&&Math.abs(L-y.b.y)<r;return!(M&&v)}f(lo,"orthogonalSegmentsCross");function Qo(t,e,n,o,s=_t){let r=ht(t,e,s),i=dt(t,e,s),g=ht(n,o,s),l=dt(n,o,s);return i&&l&&dt(t,n,s)?zt(t.y,e.y,n.y,o.y)>s:r&&g&&ht(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}f(Qo,"sameAxisSegmentsOverlap");function qe(t,e,n,o,{epsilon:s=_t,skipDegenerateOther:r=!1}={}){for(let i of n){if(i===o||i.isLayoutOnly)continue;let g=i.points;if(!(!g||g.length<2))for(let l=0;l<g.length-1;l++){let a=g[l],u=g[l+1];if(!(r&&oe(a,u,s))&&(lo(t,e,a,u,s)||Qo(t,e,a,u,s)))return!0}}return!1}f(qe,"segmentConflictsWithAnyEdge");function le(t,e,n,o,s=_t){let r=ht(t,e,s),i=dt(t,e,s),g=ht(n,o,s),l=dt(n,o,s);if(!(r&&l||i&&g))return!1;let a=r?{a:t,b:e}:{a:n,b:o},u=r?{a:n,b:o}:{a:t,b:e},y=a.a.y,L=Math.min(a.a.x,a.b.x),m=Math.max(a.a.x,a.b.x),h=u.a.x,c=Math.min(u.a.y,u.b.y),p=Math.max(u.a.y,u.b.y);return h>L+s&&h<m-s&&y>c+s&&y<p-s}f(le,"orthogonalSegmentsStrictlyCross");function Tn(t,e,n){let o=Math.min(e,n),s=Math.max(e,n);return t>o+_t&&t<s-_t}f(Tn,"strictlyBetween");function ts(t,e,n){return dt(t,e)&&dt(e,n)?Tn(e.y,t.y,n.y):ht(t,e)&&ht(e,n)?Tn(e.x,t.x,n.x):!1}f(ts,"isCollinearIntermediate");function es(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(ts(s,r,i)){e=!0;continue}}n.push(r)}return{points:n,changed:e}}f(es,"simplifyPolylineOnce");function Je(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,l=(i?dt(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(l)}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(Je,"orthogonalizePolyline");function ae(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){let o=es(e);if(e=o.points,!o.changed)break}return e}f(ae,"simplifyPolyline");var nt=.001,Tr=.5,No=4;function fo(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(fo,"endpointContextFor");function ns(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(ns,"segmentEnterPoint");function An(t,e,n){let o=n?1:-1,s=n?0:t.length-1;for(;s>=0&&s<t.length&&ro(t[s],e,Tr);)s+=o;if(s<0||s>=t.length)return t;let r=s-o;if(r<0||r>=t.length)return t;let i=ns(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}f(An,"clipEndpoint");function os(t,e){for(let n of t){let o=fo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=An(s,o.srcRect,!0)),o.dstRect&&(s=An(s,o.dstRect,!1)),s=ae(Je(s)),s=uo(s,o.srcRect,o.dstRect),o.edge.points=ae(Je(s))}}f(os,"clipEdgeEndpointsToNodeBoundaries");function wn(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(wn,"snapEndpointToBoundary");function Ze(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(Ze,"firstDistinctAdjacent");function Qe(t,e){let n=t+No,o=e-No;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}f(Qe,"cornerClearanceRange");function Rn(t,e,n){let{lo:o,hi:s}=Qe(e,n);return Math.min(s,Math.max(o,t))}f(Rn,"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 Nn(t,e){return e==="left"||e==="right"?Qe(t.top,t.bottom):Qe(t.left,t.right)}f(Nn,"clearanceRangeForSide");function tn(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(tn,"terminalSideForSegment");function Oe(t){return t==="left"||t==="right"}f(Oe,"isHorizontalSide");function rs(t,e,n,o,s){let r=[],i=n?tn(t,e,n):void 0,g=o?tn(e,t,o):void 0;return n&&i&&Oe(i)===s&&r.push(Nn(n,i)),o&&g&&Oe(g)===s&&r.push(Nn(o,g)),r.length>0?ss(r):void 0}f(rs,"straightClearanceRange");function On(t,e,n,o,s){let r=rs(t,e,n,o,s);if(!r)return;let i=s?t.y:t.x,g=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(g-i)<nt))return s?[{x:t.x,y:g},{x:e.x,y:g}]:[{x:g,y:t.y},{x:g,y:e.y}]}f(On,"clearStraightEndpointCornerAxis");function uo(t,e,n){if(t.length!==2)return t;let[o,s]=t;return ht(o,s,nt)?On(o,s,e,n,!0)??t:dt(o,s,nt)?On(o,s,e,n,!1)??t:t}f(uo,"clearStraightEndpointCornerConnections");function is(t,e,n){return Oe(n)?{x:t.x,y:Rn(t.y,e.top,e.bottom)}:{x:Rn(t.x,e.left,e.right),y:t.y}}f(is,"cornerClearedEndpoint");function cs(t,e,n,o,s,r){let i=t.map(g=>({...g}));for(let g=e;g>=0&&g<t.length;g+=n){let l=t[g];if(r&&!ht(l,o,nt)||!r&&!dt(l,o,nt))break;r?i[g].y=s.y:i[g].x=s.x}return i}f(cs,"moveCollinearEndpointRun");function Bn(t,e,n){if(t.length<2)return t;let o=n?0:t.length-1,s=n?1:-1,r=t[o],i=Ze(t,o,s);if(!i)return t;let g=tn(r,i,e);if(!g)return t;let l=Oe(g),a=is(r,e,g);return oe(r,a,nt)?t:cs(t,o,s,r,a,l)}f(Bn,"clearEndpointCornerConnection");function Fn(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(Fn,"borderSideForSegment");function Pn(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(Pn,"leavesOutward");function kn(t,e,n){if(t.length<3)return t;if(n){let r=Fn(t[0],t[1],e);return r&&Pn(r,t[1],t[2],e)?t.slice(1):t}let o=t.length-1,s=Fn(t[o-1],t[o],e);return s&&Pn(s,t[o-1],t[o-2],e)?t.slice(0,o):t}f(kn,"collapseOwnBorderStub");function as(t,e,n){let o=t;if(e){let r=Ze(o,0,1);if(r){let i=wn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=kn(o,e,!0)}if(n){let r=o.length-1,i=Ze(o,r,-1);if(i){let g=wn(i,o[r],n,!0);g!==o[r]&&(o=[...o.slice(0,r),g])}o=kn(o,n,!1)}let s=uo(o,e,n);return s!==o||o.length===2?s:(e&&(o=Bn(o,e,!0)),n&&(o=Bn(o,n,!1)),o)}f(as,"snapAndCollapseEndpoints");function _n(t,e){for(let n of t){let o=fo(n,e,2);if(!o)continue;let s=pt(o.points,nt),r=as(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(_n,"prepareEdgeEndpointsForRenderer");function ho(t){return new Map(t.map(e=>[e.id,e]))}f(ho,"buildNodeMap");function ls(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(ls,"resolveTopLevelGroupId");function Dn(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(Dn,"groupDepth");function go(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(let r of t){let i=r.x,g=r.y;if(typeof i!="number"||typeof g!="number")continue;let l=r.width??0,a=r.height??0;e=Math.min(e,i-l/2),n=Math.max(n,i+l/2),o=Math.min(o,g-a/2),s=Math.max(s,g+a/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}f(go,"boundsForChildren");function fs(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(fs,"applyGroupBounds");function ds(t){let e=ho(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Dn(s,e)-Dn(o,e));for(let o of n){let s=t.filter(i=>i.parentId===o.id),r=go(s);r&&fs(o,r)}}f(ds,"recomputeNestedGroupBounds");function en(t,e){let n=t.nodes??[],o=t.edges??[],s=n.filter(l=>!l.isGroup),r=1/0,i=-1/0;for(let l of s){let a=l[e];typeof a=="number"&&(r=Math.min(r,a),i=Math.max(i,a))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;let g=f(l=>r+i-l,"mirror");for(let l of n){let a=l[e];typeof a=="number"&&(l[e]=g(a));let u=l.groupTitleRect;u&&(l.groupTitleRect=e==="x"?{...u,left:g(u.right),right:g(u.left)}:{...u,top:g(u.bottom),bottom:g(u.top)})}for(let l of o)for(let a of l.points??[])a[e]=g(a[e]);return!0}f(en,"mirrorAxis");function us(t){return(t.nodes??[]).some(n=>!n.isGroup)?en(t,"y"):!0}f(us,"applyBtDirectionTransform");function hs(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 g=36,l=0,a=0;for(let B of s)l+=B.width??0,a+=B.height??0;let u=l/s.length,y=a/s.length,L=y>0?Math.max(1,u/y):1;for(let B of s){let X=B.x??0,K=((B.y??0)-i)*L+g,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)*L+g,mt=$-r;X.x=ct,X.y=mt}ds(n);let m=n.filter(B=>B.isGroup&&!B.parentId);if(m.length===0)return e==="RL"&&en(t,"x"),!0;let h=ho(n),c=new Map;for(let B of n){if(B.isGroup)continue;let X=ls(B,h);if(!X)continue;let $=c.get(X)??[];$.push(B),c.set(X,$)}let p=0;for(let B of m){let X=B.padding??0;X>p&&(p=X)}let C=[],M=1/0,v=-1/0;for(let B of m){let X=c.get(B.id)??[],$=go(X);$&&(M=Math.min(M,$.minX),v=Math.max(v,$.maxX),C.push({lane:B,contentTop:$.minY,contentBottom:$.maxY,centerY:($.minY+$.maxY)/2}))}if(M===1/0||v===-1/0)return!0;let R=Math.max(0,v-M),I=Math.max(p,10),b=R+2*I,T=g+b,w=(M+v)/2-b/2-g,_=w+T/2,k=Math.max(p,g);C.sort((B,X)=>B.centerY-X.centerY);for(let B=0;B<C.length;B++){let X=C[B],$,K;if(B===0?$=X.contentTop-k:$=(C[B-1].contentBottom+X.contentTop)/2,B===C.length-1)K=X.contentBottom+k;else{let Rt=C[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:w,right:w+g,top:$,bottom:K}}return e==="RL"&&en(t,"x"),!0}f(hs,"applyLrDirectionTransform");var se=1e-6,Ar=8,$e=Ar,wr=[0,$e,-$e,2*$e,-2*$e];function gs(t,e){let{nodeInfoById:n,realNodeRects:o}=rn(e);for(let s of t){if(s.isLayoutOnly)continue;let r=s.points;if(!r||r.length<4)continue;let i=so(pt(r,se),se);if(!i)continue;let{p3:g}=i,l=i.kind==="HVH",a=ao(s,n,se);if(!a)continue;let{srcId:u,dstId:y,srcInfo:L,dstInfo:m,collinearX:h,collinearY:c}=a;if(h||c)continue;let p,C=L.rect;for(let M of wr){let v,R,I;if(l){let _=m.cy>L.cy?C.bottom:C.top,k=L.cx+M;if(k<=C.left+se||k>=C.right-se)continue;v={x:k,y:_},R={x:k,y:g.y},I={x:g.x,y:g.y}}else{let _=m.cx>L.cx?C.right:C.left,k=L.cy+M;if(k<=C.top+se||k>=C.bottom-se)continue;v={x:_,y:k},R={x:g.x,y:k},I={x:g.x,y:g.y}}let b=oe(v,R,se),T=oe(R,I,se);if(b&&T||!b&&wt(v,R,o,[u],1)||!T&&wt(R,I,o,[y],1))continue;let N=!b&&qe(v,R,t,s,{epsilon:se,skipDegenerateOther:!0}),F=!T&&qe(R,I,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(N||F)){b?p=[R,I]:T?p=[v,R]:p=[v,R,I];break}}p&&(s.points=p)}}f(gs,"portSwapToLShape");function ps(t,e){let{realNodeRects:r,labelNodeRects:i}=me(e.values());for(let g of t){if(g.isLayoutOnly)continue;let l=g.points;if(!l||l.length<4)continue;let a=pt(l,.001);if(a.length<4)continue;let u=a.length-1,y=a[u],L=a[u-1],m=a[u-2],h=y.x-L.x,c=y.y-L.y,p=Math.hypot(h,c);if(p>=10||p<.001)continue;let C=L.x-m.x,M=L.y-m.y;if(Math.hypot(C,M)<.001)continue;let R=Tt(L,y,.001),I=At(L,y,.001),b=Tt(m,L,.001),T=At(m,L,.001);if(!(R&&T||I&&b))continue;let N=g.end,F=g.start,w=N?e.get(N):void 0;if(!w)continue;let _=w.x??0,k=w.y??0,B=qt(w);if(!B)continue;let X,$;if(T){let W=M<0;X={x:_,y:m.y},$={x:_,y:W?B.bottom:B.top}}else{let W=C>0;X={x:m.x,y:k},$={x:W?B.right:B.left,y:k}}if(wt(X,$,r,N?[N]:[],-2)||wt(X,$,i,[],-2))continue;if(F){let W=e.get(F),et=W?qt(W):void 0;if(et&&ro(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<a.length-1;W++)ct.add(K(a[W],a[W+1]));let mt=f((W,et)=>{for(let lt of t){if(lt===g||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(u-3>=0){let W=a[u-3],et=[F,N].filter(lt=>!!lt);if(wt(W,X,r,et,-2)||mt(W,X))continue}let Ft=[...a.slice(0,u-2),X,$];g.points=Ft;let Q=g.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<Ft.length-1;Vt++){let Ut=Ft[Vt],jt=Ft[Vt+1],te=Math.hypot(jt.x-Ut.x,jt.y-Ut.y),Se=ht(Ut,jt,.001),de=dt(Ut,jt,.001);(Se&&te>=et+2||de&&te>=lt+2)&&te>vt&&(vt=te,gt=(Ut.x+jt.x)/2,xt=(Ut.y+jt.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}f(ps,"collapseShortTerminalStub");var Z=.001,kt=8,it=Re,Mn=f((t,e)=>dt(t,e,Z)||ht(t,e,Z),"orthogonallyAligned");function ms(t,e){let s=f((m,h)=>{let c=m.x??0,p=m.y??0,C=h.x-c,M=h.y-p,v=(m.width??0)/2,R=(m.height??0)/2;return Math.abs(M)*v>Math.abs(C)*R?(M<0&&(R=-R),{x:c+(M===0?0:R*C/M),y:p+R}):(C<0&&(v=-v),{x:c+v,y:p+(C===0?0:v*M/C)})},"rectIntersect"),r=f((m,h)=>{let c=pt(m.points??[]);if(c.length<2)return;let p=h?m.start:m.end,C=p?e.get(p):void 0,M=C?qt(C):void 0;if(!C||!p||!M)return;let v=h?c[0]:c[c.length-1],R=h?c[1]:c[c.length-2],I=s(C,v),b=v;if(Mn(R,I)&&(b=R),dt(I,b,Z))return{edge:m,edgeId:String(m.id??""),nodeId:p,atStart:h,orientation:"V",coord:I.x,min:Math.min(I.y,b.y),max:Math.max(I.y,b.y),boundary:I,railEnd:b,rect:M};if(ht(I,b,Z))return{edge:m,edgeId:String(m.id??""),nodeId:p,atStart:h,orientation:"H",coord:I.y,min:Math.min(I.x,b.x),max:Math.max(I.x,b.x),boundary:I,railEnd:b,rect:M}},"terminalLaneFor"),i=f((m,h)=>Math.max(0,Math.min(m.max,h.max)-Math.max(m.min,h.min)),"projectedOverlapLength"),g=f((m,h)=>m.nodeId!==h.nodeId||m.orientation!==h.orientation?!1:m.orientation==="H"?(Math.abs(m.boundary.x-m.rect.left)<1||Math.abs(m.boundary.x-m.rect.right)<1)&&dt(m.boundary,h.boundary,1):(Math.abs(m.boundary.y-m.rect.top)<1||Math.abs(m.boundary.y-m.rect.bottom)<1)&&ht(m.boundary,h.boundary,1),"sameTerminalFace"),l=f((m,h)=>m.nodeId!==h.nodeId||m.orientation!==h.orientation?!1:i(m,h)>=kt&&Math.abs(m.coord-h.coord)<.5,"exactTerminalLaneConflict"),a=f((m,h)=>{if(m.nodeId!==h.nodeId||m.orientation!==h.orientation||m.orientation!=="H"||m.atStart===h.atStart)return!1;let c=i(m,h);if(c<kt)return!1;let p=m.rect.bottom-m.rect.top;return c<p||c>2*p?!1:g(m,h)&&Math.abs(m.coord-h.coord)<16},"nearTerminalLaneConflict"),u=f((m,h)=>{let c=pt(m.edge.points??[]);if(c.length<2)return;let p=m.orientation==="V"?{x:m.boundary.x+h,y:m.boundary.y}:{x:m.boundary.x,y:m.boundary.y+h},C=m.orientation==="V"?{x:m.railEnd.x+h,y:m.railEnd.y}:{x:m.railEnd.x,y:m.railEnd.y+h};if(!f(()=>Math.abs(m.boundary.y-m.rect.top)<1||Math.abs(m.boundary.y-m.rect.bottom)<1?ht(p,m.boundary,Z)&&p.x>=m.rect.left+1&&p.x<=m.rect.right-1:Math.abs(m.boundary.x-m.rect.left)<1||Math.abs(m.boundary.x-m.rect.right)<1?dt(p,m.boundary,Z)&&p.y>=m.rect.top+1&&p.y<=m.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(m.atStart){let b=c.length>1&&oe(c[1],m.railEnd,Z),T=c.slice(b?2:1),N=T[0];return N&&!Mn(N,C)?void 0:[p,C,...T]}let v=c.length>1&&oe(c[c.length-2],m.railEnd,Z),R=c.slice(0,v?-2:-1),I=R[R.length-1];if(!(I&&!Mn(I,C)))return[...R,C,p]},"shiftedCandidate"),y=f(m=>{let h=m.edge,c=pt(h.points??[]);if(c.length!==2)return!1;let p=h.start,C=h.end,M=p?e.get(p):void 0,v=C?e.get(C):void 0;if(!M||!v)return!1;let R=M.x??0,I=M.y??0,b=v.x??0,T=v.y??0,[N,F]=c;return ht(N,F,Z)&&Math.abs(I-T)<1&&Math.abs(R-b)>1||dt(N,F,Z)&&Math.abs(R-b)<1&&Math.abs(I-T)>1},"laneIsStraightCollinearConnector"),L=[-7,7,-14,14,-21,21];for(let m=0;m<8;m++){let h=t.filter(p=>!p.isLayoutOnly).flatMap(p=>[r(p,!0),r(p,!1)]).filter(p=>!!p),c=!1;for(let p=0;p<h.length&&!c;p++)for(let C=p+1;C<h.length&&!c;C++){let M=h[p],v=h[C];if(M.edge===v.edge||!(l(M,v)||a(M,v)))continue;let R=!l(M,v),I=[M,v].sort((b,T)=>{let N=y(b),F=y(T);return N!==F?Number(N)-Number(F):+!T.atStart-+!b.atStart});for(let b of I){for(let T of L){let N=u(b,T);if(!N)continue;let F=r({...b.edge,points:N},b.atStart);if(!(!F||h.some(w=>w.edge!==b.edge&&(l(F,w)||R&&a(F,w))))){b.edge.points=N,c=!0;break}}if(c)break}}if(!c)return}}f(ms,"separateSharedRenderedTerminalLanes");function ys(t,e){let{realNodeRects:s,labelNodeRects:r}=me(e.values()),i=f((l,a)=>{let u=l.start,y=l.end,L=it(a);if(L.length!==a.length-1)return!1;let m=[u,y].filter(h=>!!h);for(let h of L)if(wt(h.a,h.b,s,m,-2)||wt(h.a,h.b,r,[],-2))return!1;for(let h of t){if(h===l||h.isLayoutOnly)continue;let c=h.points;if(!(!c||c.length<2)){for(let p of L)for(let C of it(pt(c)))if(ce(p,C,.5)>=kt||le(p.a,p.b,C.a,C.b,Z))return!1}}return!0},"candidateIsSafe"),g=f((l,a)=>{if(a+4>=l.length)return;let u=l[a],y=l[a+1],L=l[a+2],m=l[a+3],h=l[a+4],c=Tt(u,y)&&At(y,L)&&Tt(L,m)&&At(m,h)&&dt(u,m,Z)&&dt(u,h,Z)&&dt(y,L,Z)&&(y.x-u.x)*(m.x-L.x)<0,p=At(u,y)&&Tt(y,L)&&At(L,m)&&Tt(m,h)&&ht(u,m,Z)&&ht(u,h,Z)&&ht(y,L,Z)&&(y.y-u.y)*(m.y-L.y)<0;if(c||p)return pt([...l.slice(0,a+1),h,...l.slice(a+5)]);if(a+5>=l.length)return;let C=l[a+5],M=At(u,y)&&Tt(y,L)&&At(L,m)&&Tt(m,h)&&At(h,C)&&dt(u,h,Z)&&dt(u,C,Z)&&dt(L,m,Z)&&(L.x-y.x)*(h.x-m.x)<0,v=Tt(u,y)&&At(y,L)&&Tt(L,m)&&At(m,h)&&Tt(h,C)&&ht(u,h,Z)&&ht(u,C,Z)&&ht(L,m,Z)&&(L.y-y.y)*(h.y-m.y)<0;if(!(!M&&!v))return pt([...l.slice(0,a+1),C,...l.slice(a+6)])},"withoutDogleg");for(let l=0;l<8;l++){let a=!1;for(let u of t){if(u.isLayoutOnly)continue;let y=pt(u.points??[]);for(let L=0;L<=y.length-5;L++){let m=g(y,L);if(!(!m||!i(u,m))){u.points=m,a=!0;break}}if(a)break}if(!a)return}}f(ys,"collapseRedundantRectangularDoglegs");function Hn(t,e){let{realNodeRects:r,labelNodeRects:i}=me(e.values()),g=t.filter(h=>!h.isLayoutOnly),l=f((h,c,p)=>pt(h===c?p??[]:h.points??[]),"pointsFor"),a=f((h,c)=>{let p=0;for(let C=0;C<g.length;C++){let M=it(l(g[C],h,c));for(let v=C+1;v<g.length;v++){let R=it(l(g[v],h,c));for(let I of M)for(let b of R)le(I.a,I.b,b.a,b.b,Z)&&p++}}return p},"strictCrossingCount"),u=f(h=>{let c=it(h);if(c.length!==3)return;let p=c[1];if(!(c[0].horizontal===p.horizontal||c[2].horizontal===p.horizontal))return{index:p.index,horizontal:p.horizontal,vertical:p.vertical,segment:p}},"middleRail"),y=f((h,c)=>{let p=[h.start,h.end].filter(C=>!!C);return r.filter(C=>{if(p.includes(C.id))return!1;let M=C.rect;return c.horizontal?zt(c.a.x,c.b.x,M.left,M.right)>=kt&&c.a.y>=M.top-2&&c.a.y<=M.bottom+2:zt(c.a.y,c.b.y,M.top,M.bottom)>=kt&&c.a.x>=M.left-2&&c.a.x<=M.right+2})},"blockingRectsFor"),L=f((h,c,p)=>{let C=h.map(v=>({...v}));if(c.horizontal)C[c.index].y=p,C[c.index+1].y=p;else if(c.vertical)C[c.index].x=p,C[c.index+1].x=p;else return;let M=ae(pt(C));return it(M).length===M.length-1?M:void 0},"candidateByMovingRail"),m=f((h,c,p)=>{let C=[h.start,h.end].filter(v=>!!v),M=it(c);if(M.length!==c.length-1)return!1;for(let v of M)if(wt(v.a,v.b,r,C,-2)||wt(v.a,v.b,i,[],-2))return!1;for(let v of g)if(v!==h){for(let R of M)for(let I of it(l(v)))if(ce(R,I,.5)>=kt)return!1}return a(h,c)<=p},"candidateIsSafe");for(let h=0;h<8;h++){let c=a(),p=!1;for(let C of g){let M=l(C),v=u(M);if(!v)continue;let R=y(C,v.segment);if(R.length===0)continue;let I=v.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 I){let T=L(M,v.segment,b);if(!(!T||!m(C,T,c))){C.points=T,p=!0;break}}if(p)break}if(!p)return}}f(Hn,"liftObstacleHuggingSameSideRails");function Xn(t,e){let o=f(l=>{let a=l.groupTitleRect;if(!(!a||typeof a.left!="number"||typeof a.right!="number"||typeof a.top!="number"||typeof a.bottom!="number"||!Number.isFinite(a.left)||!Number.isFinite(a.right)||!Number.isFinite(a.top)||!Number.isFinite(a.bottom)||a.right<=a.left||a.bottom<=a.top))return{left:a.left,right:a.right,top:a.top,bottom:a.bottom}},"validTitleRect"),s=f(l=>{if(!l.isGroup||l.parentId)return;let a=l.direction,u=typeof a=="string"?a.toUpperCase():"";if(u==="LR"||u==="RL"||u==="BT")return;let y=o(l),L=l.y,m=l.height;if(!y||typeof L!="number"||typeof m!="number"||!Number.isFinite(L)||!Number.isFinite(m)||m<=0)return;let h=y.right-y.left,c=y.bottom-y.top;if(!(c<=0||h<c))return{node:l,rect:y}},"topLaneTitleFor"),r=f((l,a)=>{if(!l.horizontal)return!1;let u=l.a.y;return u<=a.top+Z||u>=a.bottom-Z?!1:zt(l.a.x,l.b.x,a.left,a.right)>=kt},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(l=>!!l);if(i.length===0)return;let g=0;for(let l of t){if(l.isLayoutOnly)continue;let a=pt(l.points??[]);for(let u of it(a))for(let y of i)r(u,y.rect)&&(g=Math.max(g,y.rect.bottom-u.a.y+4))}if(!(g<=Z))for(let l of i){let a=l.node.y,u=l.node.height;typeof a!="number"||typeof u!="number"||!Number.isFinite(a)||!Number.isFinite(u)||u<=0||(l.node.y=a-g/2,l.node.height=u+g,l.node.groupTitleRect={...l.rect,top:l.rect.top-g,bottom:l.rect.bottom-g})}}f(Xn,"liftTopLaneTitleBandsAboveRails");function Yn(t,e){let o=f(a=>{let u=a.groupTitleRect;if(!(!u||typeof u.left!="number"||typeof u.right!="number"||typeof u.top!="number"||typeof u.bottom!="number"||!Number.isFinite(u.left)||!Number.isFinite(u.right)||!Number.isFinite(u.top)||!Number.isFinite(u.bottom)||u.right<=u.left||u.bottom<=u.top))return{left:u.left,right:u.right,top:u.top,bottom:u.bottom}},"validTitleRect"),s=f(a=>{if(!a.isGroup||a.parentId||a.direction!=="LR")return;let y=o(a),L=a.x,m=a.width;if(!y||typeof L!="number"||typeof m!="number"||!Number.isFinite(L)||!Number.isFinite(m)||m<=0)return;let h=y.right-y.left,c=y.bottom-y.top;if(!(h<=0||c<h))return{node:a,rect:y}},"leftLaneTitleFor"),r=f((a,u)=>{if(!a.vertical)return!1;let y=a.a.x;return y<=u.left+Z||y>=u.right-Z?!1:zt(a.a.y,a.b.y,u.top,u.bottom)>=kt},"verticalSegmentIntersectsTitle"),i=f((a,u)=>{if(!a.horizontal)return!1;let y=a.a.y;return y<=u.top+Z||y>=u.bottom-Z?!1:zt(a.a.x,a.b.x,u.left,u.right)>=kt},"horizontalSegmentIntersectsTitle"),g=[...e.values()].map(s).filter(a=>!!a);if(g.length===0)return;let l=0;for(let a of t){if(a.isLayoutOnly)continue;let u=pt(a.points??[]);for(let y of it(u))for(let L of g)if(r(y,L.rect))l=Math.max(l,L.rect.right-y.a.x+4);else if(i(y,L.rect)){let m=Math.min(y.a.x,y.b.x);l=Math.max(l,L.rect.right-m+4)}}if(!(l<=Z))for(let a of g){let u=a.node.x,y=a.node.width;typeof u!="number"||typeof y!="number"||!Number.isFinite(u)||!Number.isFinite(y)||y<=0||(a.node.x=u-l/2,a.node.width=y+l,a.node.groupTitleRect={...a.rect,left:a.rect.left-l,right:a.rect.right-l})}}f(Yn,"shiftLeftLaneTitleBandsLeftOfRails");function xs(t,e){let{realNodeRects:s}=me(e.values()),r=t.filter(c=>!c.isLayoutOnly),i=f((c,p=new Map)=>pt(p.get(c)??c.points??[]),"replacementPointsFor"),g=f((c=new Map)=>{let p=0;for(let C=0;C<r.length;C++){let M=it(i(r[C],c));for(let v=C+1;v<r.length;v++){let R=it(i(r[v],c));for(let I of M)for(let b of R)le(I.a,I.b,b.a,b.b,Z)&&p++}}return p},"crossingCount"),l=f((c=new Map)=>r.reduce((p,C)=>p+Qt(i(C,c)),0),"totalBends"),a=f(c=>{let p=i(c);if(p.length<4)return;let C=p[p.length-2],M=p[p.length-1];if(!(!Tt(C,M,Z)&&!At(C,M,Z)))return{tailStart:C,terminal:M}},"terminalTailFor"),u=f((c,p)=>{let C=i(c);if(C.length<3)return;let M=C[0],v=C[1],R;if(Tt(M,v,Z))R={x:v.x,y:p.tailStart.y};else if(At(M,v,Z))R={x:p.tailStart.x,y:v.y};else return;let I=ae(pt([M,v,R,p.tailStart,p.terminal]));return it(I).length===I.length-1?I:void 0},"candidateWithDestinationTail"),y=f((c,p)=>{let C=[c.start,c.end].filter(M=>!!M);for(let M of it(p))if(wt(M.a,M.b,s,C,-2))return!0;return!1},"pathHasNodeHit"),L=f((c,p,C)=>{for(let M of r)if(M!==c){for(let v of it(p))for(let R of it(i(M,C)))if(ce(v,R,.5)>=kt)return!0}return!1},"pathHasSharedTrack"),m=f((c,p,C)=>!y(c,p)&&!L(c,p,C),"candidateIsSafe"),h=f(()=>{let c=new Map;for(let p of r){let C=p.end;if(!C||!e.has(C)||i(p).length<4)continue;let v=c.get(C)??[];v.push(p),c.set(C,v)}return c},"edgesByDestination");for(let c=0;c<4;c++){let p=g();if(p===0)return;let C=l(),M,v=p,R=C;for(let I of h().values())for(let b=0;b<I.length;b++)for(let T=b+1;T<I.length;T++){let N=I[b],F=I[T],w=a(N),_=a(F);if(!w||!_)continue;let k=u(N,_),B=u(F,w);if(!k||!B)continue;let X=new Map([[N,k],[F,B]]);if(!m(N,k,X)||!m(F,B,X))continue;let $=g(X),K=l(X);$>=p||$>v||$===v&&K>=R||(M=X,v=$,R=K)}if(!M)return;for(let[I,b]of M)I.points=b}}f(xs,"swapDestinationTerminalTailsToReduceCrossings");function bs(t,e){let{realNodeRects:i,labelNodeRects:g}=me(e.values()),l=t.filter(I=>!I.isLayoutOnly),a=f((I,b=new Map)=>pt(b.get(I)??I.points??[]),"replacementPointsFor"),u=f((I=new Map)=>{let b=0;for(let T=0;T<l.length;T++){let N=it(a(l[T],I));for(let F=T+1;F<l.length;F++){let w=it(a(l[F],I));for(let _ of N)for(let k of w)le(_.a,_.b,k.a,k.b,Z)&&b++}}return b},"strictCrossingCount"),y=f((I=new Map)=>l.reduce((b,T)=>b+Qt(a(T,I)),0),"totalBends"),L=f(I=>{let b=I.start,T=I.end,N=b?e.get(b):void 0,F=T?e.get(T):void 0,w=N?qt(N):void 0,_=F?qt(F):void 0;return w&&_?{src:w,dst:_}:void 0},"endpointRectsFor"),m=f((I,b,T)=>{if(T.index<=0||T.index+1>=b.length-1)return;let N=L(I);if(N){if(T.vertical){let F=T.a.x,w=Math.min(N.src.left,N.dst.left),_=Math.max(N.src.right,N.dst.right),k=F<w-Z?"left":F>_+Z?"right":void 0;return k?{edge:I,points:b,segmentIndex:T.index,axis:"vertical",side:k,coord:F,min:Math.min(T.a.y,T.b.y),max:Math.max(T.a.y,T.b.y)}:void 0}if(T.horizontal){let F=T.a.y,w=Math.min(N.src.top,N.dst.top),_=Math.max(N.src.bottom,N.dst.bottom),k=F<w-Z?"top":F>_+Z?"bottom":void 0;return k?{edge:I,points:b,segmentIndex:T.index,axis:"horizontal",side:k,coord:F,min:Math.min(T.a.x,T.b.x),max:Math.max(T.a.x,T.b.x)}:void 0}}},"externalRailForSegment"),h=f(()=>{let I=[];for(let b of l){let T=a(b);for(let N of it(T)){let F=m(b,T,N);F&&I.push(F)}}return I},"collectExternalRails"),c=f((I,b)=>I.edge!==b.edge&&I.axis===b.axis&&I.side===b.side&&zt(I.min,I.max,b.min,b.max)>=kt,"railsInteract"),p=f(I=>{let b=[],T=new Set;for(let N of I){if(T.has(N))continue;let F=[N],w=[];for(T.add(N);F.length>0;){let _=F.pop();w.push(_);for(let k of I)!T.has(k)&&c(_,k)&&(T.add(k),F.push(k))}w.length>1&&b.push(w)}return b},"connectedComponents"),C=f(I=>{let b=[];for(let T of I)b.some(N=>Math.abs(N-T.coord)<Z)||b.push(T.coord);for(;b.length<I.length;){let T=Math.min(...b),N=Math.max(...b),F=I[0].side;b.push(F==="left"||F==="top"?T-12*(I.length-b.length):N+12*(I.length-b.length))}return b},"uniqueCoordsFor"),M=f(I=>{let b=I.map(F=>F.coord),T=C(I),N=[];if(I.length<=6){let F=new Array(T.length).fill(!1),w=[],_=f(()=>{if(w.length===I.length){w.some((k,B)=>Math.abs(k-b[B])>=Z)&&N.push([...w]);return}for(let[k,B]of T.entries())F[k]||(F[k]=!0,w.push(B),_(),w.pop(),F[k]=!1)},"visit");return _(),N}for(let F=0;F<b.length;F++)for(let w=F+1;w<b.length;w++){let _=[...b];[_[F],_[w]]=[_[w],_[F]],N.push(_)}return N},"coordinateAssignmentsFor"),v=f((I,b)=>{let T=new Map;for(let[F,w]of I.entries()){let _=b[F],k=T.get(w.edge)??w.points.map(B=>({x:B.x,y:B.y}));w.axis==="vertical"?(k[w.segmentIndex].x=_,k[w.segmentIndex+1].x=_):(k[w.segmentIndex].y=_,k[w.segmentIndex+1].y=_),T.set(w.edge,k)}let N=new Map;for(let[F,w]of T){let _=ae(pt(w));if(it(_).length!==_.length-1)return;N.set(F,_)}return N},"replacementsForAssignment"),R=f(I=>{for(let[b,T]of I){let N=[b.start,b.end].filter(F=>!!F);for(let F of it(T))if(wt(F.a,F.b,i,N,-2)||wt(F.a,F.b,g,[],-2))return!1}for(let b=0;b<l.length;b++){let T=l[b],N=I.has(T),F=it(a(T,I));for(let w=b+1;w<l.length;w++){let _=l[w];if(!N&&!I.has(_))continue;let k=it(a(_,I));for(let B of F)for(let X of k)if(ce(B,X,.5)>=kt)return!1}}return!0},"candidateIsSafe");for(let I=0;I<4;I++){let b=u();if(b===0)return;let T,N=b,F=y(),w=Number.POSITIVE_INFINITY;for(let _ of p(h()))for(let k of M(_)){let B=v(_,k);if(!B||!R(B))continue;let X=u(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&&($>F||$===F&&K>=w)||(T=B,N=X,F=$,w=K)}if(!T)return;for(let[_,k]of T)_.points=k}}f(bs,"reassignCrossingExternalRailChannels");function Ms(t,e){let{realNodeRects:s,labelNodeRects:r}=me(e.values()),i=t.filter(h=>!h.isLayoutOnly),g=f((h,c,p)=>pt(h===c?p??[]:h.points??[]),"pointsFor"),l=f(h=>it(h).reduce((c,p)=>{let C=p.a.x-p.b.x,M=p.a.y-p.b.y;return c+Math.hypot(C,M)},0),"pathLength"),a=f((h,c)=>{let p=0;for(let C=0;C<i.length;C++){let M=it(g(i[C],h,c));for(let v=C+1;v<i.length;v++){let R=it(g(i[v],h,c));for(let I of M)for(let b of R)le(I.a,I.b,b.a,b.b,Z)&&p++}}return p},"strictCrossingCount"),u=f((h,c)=>{if(h.horizontal){let p=h.a.y;return(Math.abs(p-c.top)<1||Math.abs(p-c.bottom)<1)&&zt(h.a.x,h.b.x,c.left,c.right)>=kt}if(h.vertical){let p=h.a.x;return(Math.abs(p-c.left)<1||Math.abs(p-c.right)<1)&&zt(h.a.y,h.b.y,c.top,c.bottom)>=kt}return!1},"segmentRunsAlongRectBorder"),y=f(h=>{let c=[h.start,h.end].filter(C=>!!C),p=[];for(let C of c){let M=e.get(C),v=M?qt(M):void 0;v&&p.push(v)}return p},"endpointRectsFor"),L=f((h,c)=>{if(c+3>=h.length)return[];let p=h[c],C=h[c+1],M=h[c+2],v=h[c+3],R=Tt(p,C,Z)&&At(C,M,Z)&&Tt(M,v,Z),I=At(p,C,Z)&&Tt(C,M,Z)&&At(M,v,Z);if(!R&&!I)return[];if(!(R?Math.sign(C.x-p.x)!==Math.sign(v.x-M.x):Math.sign(C.y-p.y)!==Math.sign(v.y-M.y)))return[];let T=dt(p,v,Z)||ht(p,v,Z)?[]:[{x:p.x,y:v.y},{x:v.x,y:p.y}],N=T.length===0?[[...h.slice(0,c+1),...h.slice(c+3)]]:T.map(w=>[...h.slice(0,c+1),w,...h.slice(c+3)]),F=new Set;return N.map(w=>ae(pt(w))).filter(w=>{if(it(w).length!==w.length-1||!w.some(k=>oe(k,v,Z)))return!1;let _=w.map(k=>`${k.x.toFixed(3)},${k.y.toFixed(3)}`).join("|");return F.has(_)?!1:(F.add(_),!0)})},"shortcutCandidatesAt"),m=f((h,c,p)=>{let C=[h.start,h.end].filter(v=>!!v),M=y(h);for(let v of it(c))if(wt(v.a,v.b,s,C,-2)||wt(v.a,v.b,r,[],-2)||M.some(R=>u(v,R)))return!1;for(let v of i)if(v!==h){for(let R of it(c))for(let I of it(g(v)))if(ce(R,I,.5)>=kt)return!1}return a(h,c)<=p},"candidateIsSafe");for(let h=0;h<8;h++){let c=a(),p,C,M=c,v=Number.POSITIVE_INFINITY,R=Number.POSITIVE_INFINITY;for(let I of i){let b=g(I),T=Qt(b,Z),N=l(b);for(let F=0;F<=b.length-4;F++)for(let w of L(b,F)){let _=Qt(w,Z),k=l(w);if(!(_<T||_===T&&k<N-Z)||!m(I,w,c))continue;let X=a(I,w);X>M||X===M&&(_>v||_===v&&k>=R)||(p=I,C=w,M=X,v=_,R=k)}}if(!p||!C)return;p.points=C}}f(Ms,"shortcutRedundantOrthogonalJogs");function Is(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,U=qt(O);U&&i.push({id:String(O.id??""),cx:D,cy:H,rect:U})}if(i.length===0)return;let g=new Map(i.map(O=>[O.id,O])),l=i.map(O=>({id:O.id,rect:O.rect})),a=["top","bottom","left","right"],u={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),L=new Map(y.map((O,D)=>[O,D])),m=f(O=>{let D=O==="left"||O==="top"?-1:1,H=[];for(let U=0;U<=2;U++)H.push(u[O]+D*20*U);return H},"outwardTracksForSide"),h=f((O,D=new Map)=>pt(D.get(O)??O.points??[]),"replacementPointsFor"),c=f((O,D)=>{let H=0;for(let U of O)for(let d of D)le(U.a,U.b,d.a,d.b,Z)&&H++;return H},"crossingCountBetweenSegments"),p=f((O,D)=>c(it(O),it(D)),"crossingCountBetweenPaths"),C=f((O=new Map)=>{let D=0,H=[],U=new Set,d=[],x=f(S=>{U.has(S)||(U.add(S),d.push(S))},"addEdge");for(let S=0;S<y.length;S++){let E=y[S],A=h(E,O);for(let P=S+1;P<y.length;P++){let j=y[P],J=p(A,h(j,O));J>0&&(D+=J,H.push({first:E,second:j,count:J}),x(E),x(j))}}return d.sort((S,E)=>(L.get(S)??0)-(L.get(E)??0)),{count:D,pairs:H,edgeSet:U,edges:d}},"crossingSnapshot"),M=f((O,D)=>{let H=new Set(D.keys());if(H.size===0)return O.count;let U=0;for(let x of O.pairs)(H.has(x.first)||H.has(x.second))&&(U+=x.count);let d=0;for(let x=0;x<y.length;x++){let S=y[x],E=H.has(S),A=h(S,D);for(let P=x+1;P<y.length;P++){let j=y[P];!E&&!H.has(j)||(d+=p(A,h(j,D)))}}return O.count-U+d},"crossingCountWithReplacements"),v=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 S=D.get(d.second)??new Set;S.add(d.first),D.set(d.second,S)}let H=[],U=new Set;for(let d of O.edges){if(U.has(d))continue;let x=[d],S=[];for(U.add(d);x.length>0;){let E=x.pop();S.push(E);for(let A of D.get(E)??[])U.has(A)||(U.add(A),x.push(A))}S.sort((E,A)=>(L.get(E)??0)-(L.get(A)??0)),S.length>1&&H.push(S)}return H},"crossingComponents"),R=f(O=>[O.start,O.end].filter(D=>!!D),"endpointIdsFor"),I=f(O=>{let D=[];for(let H of v(O)){let U=new Set(H),d=new Set(H.flatMap(S=>R(S))),x=[...H];for(let S of y)U.has(S)||R(S).some(E=>d.has(E))&&x.push(S);x.sort((S,E)=>(L.get(S)??0)-(L.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,U)=>{let d=O[U];return D+Math.abs(H.x-d.x)+Math.abs(H.y-d.y)},0),"pathLength"),F=f((O=new Map)=>y.reduce((D,H)=>D+Qt(h(H,O)),0),"totalBends"),w=f((O=new Map)=>y.reduce((D,H)=>D+N(h(H,O)),0),"totalLength"),_=f((O,D,H=new Map)=>{let U=it(D);for(let d of y)if(d!==O){for(let x of U)for(let S of it(h(d,H)))if(ce(x,S,.5)>=kt)return!0}return!1},"pathHasSegmentConflict"),k=f((O,D)=>{let H=[O.start,O.end].filter(U=>!!U);for(let U of it(D))if(wt(U.a,U.b,l,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,U)=>{let d=H==="left"||H==="top"?-1:1,x=[$(D,H,U),u[H]];for(let S of x)for(let E=0;E<=2;E++)B(O,co(D,H,U,S+d*20*E))},"addSameSideCandidates"),ct=f((O,D,H,U,d)=>{for(let x of m(H))for(let S of m(d))B(O,[D,{x,y:D.y},{x,y:S},{x:U.x,y:S},U])},"addHorizontalToVerticalCandidates"),mt=f((O,D,H,U,d)=>{for(let x of m(H))for(let S of m(d))B(O,[D,{x:D.x,y:x},{x:S,y:x},{x:S,y:U.y},U])},"addVerticalToHorizontalCandidates"),Rt=f((O,D,H,U,d)=>{let x=[...m("top"),...m("bottom")];for(let S of m(H))for(let E of m(d))for(let A of x)B(O,[D,{x:S,y:D.y},{x:S,y:A},{x:E,y:A},{x:E,y:U.y},U])},"addHorizontalPairCandidates"),Ft=f((O,D,H,U,d)=>{let x=[...m("left"),...m("right")];for(let S of m(H))for(let E of m(d))for(let A of x)B(O,[D,{x:D.x,y:S},{x:A,y:S},{x:A,y:E},{x:U.x,y:E},U])},"addVerticalPairCandidates"),Q=f(O=>{let D=new Set;return O.map(H=>pt(H)).filter(H=>{let U=H.map(d=>`${d.x.toFixed(3)},${d.y.toFixed(3)}`).join("|");return D.has(U)||H.length<2?!1:(D.add(U),!0)})},"dedupeCandidatePaths"),W=f((O,D,H,U)=>{let d=[],x=io(O,D,H,U,20,Z);x&&B(d,x),D===U&&K(d,O,D,H);let S=X(D),E=X(U);return S&&!E?ct(d,O,D,H,U):!S&&E?mt(d,O,D,H,U):S?Rt(d,O,D,H,U):Ft(d,O,D,H,U),Q(d)},"buildCandidatesForSides"),et=f((O,D,H,U)=>{let d=[...m("left"),...m("right")],x=[...m("top"),...m("bottom")];for(let S of a){let E=Ie(U,S),A=S==="top"||S==="bottom"?m(S):x;for(let P of d){B(O,[D,H,{x:P,y:H.y},{x:P,y:E.y},E]);for(let j of A)B(O,[D,H,{x:P,y:H.y},{x:P,y:j},{x:E.x,y:j},E])}}},"addVerticalDepartureOuterTrackCandidates"),lt=f((O,D,H,U)=>{let d=[...m("left"),...m("right")],x=[...m("top"),...m("bottom")];for(let S of a){let E=Ie(U,S),A=S==="left"||S==="right"?m(S):d;for(let P of x){B(O,[D,H,{x:H.x,y:P},{x:E.x,y:P},E]);for(let j of A)B(O,[D,H,{x:H.x,y:P},{x:j,y:P},{x:j,y:E.y},E])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=f(O=>{let D=O.start,H=O.end,U=H?g.get(H):void 0;if(!D||!U)return[];let d=pt(O.points??[]);if(d.length<4)return[];let x=d[0],S=d[1],E=[];return At(x,S,Z)?et(E,x,S,U):Tt(x,S,Z)&<(E,x,S,U),E},"terminalPreservingOuterTrackCandidates"),xt=f(O=>{let D=O.start,H=O.end,U=D?g.get(D):void 0,d=H?g.get(H):void 0;if(!U||!d)return[];let x=[];for(let S of a){let E=Ie(U,S);for(let A of a)x.push(...W(E,S,Ie(d,A),A))}return x.push(...gt(O)),x},"candidatePathsFor"),vt=f(()=>new Map(y.map(O=>[O,it(h(O))])),"currentSegmentsByEdge"),Vt=f((O,D,H)=>{let U=new Set;for(let d of y){if(d===O)continue;let x=H.get(d)??it(h(d));D.some(S=>x.some(E=>ce(S,E,.5)>=kt))&&U.add(d)}return U},"sharedTrackConflictsFor"),Ut=f((O,D,H,U)=>{let d=new Set;return xt(O).map(S=>ae(pt(S))).filter(S=>{if(k(O,S))return!1;let E=S.map(A=>`${A.x.toFixed(3)},${A.y.toFixed(3)}`).join("|");return d.has(E)||S.length<2?!1:(d.add(E),!0)}).map(S=>{let E=it(S),A=0;for(let P of y)P!==O&&(A+=c(E,H.get(P)??it(h(P))));return{candidate:S,candidateSegments:E,crossings:D.count-(U.get(O)??0)+A,bends:Qt(S,Z),totalBends:Qt(S),length:N(S)}}).filter(({crossings:S})=>S<=D.count).sort((S,E)=>S.crossings-E.crossings||S.bends-E.bends||S.length-E.length).slice(0,48).map(S=>({path:S.candidate,segments:S.candidateSegments,sharedTrackConflicts:Vt(O,S.candidateSegments,H),totalBends:S.totalBends,length:S.length}))},"pairCandidatesFor"),jt=f((O,D,H,U,d,x)=>{let S=0;for(let A of O.pairs)(A.first===D||A.second===D||A.first===U||A.second===U)&&(S+=A.count);let E=c(H.segments,d.segments);for(let A of y){if(A===D||A===U)continue;let P=x.get(A)??it(h(A));E+=c(H.segments,P)+c(d.segments,P)}return O.count-S+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(U=>ce(H,U,.5)>=kt)),"candidatesShareTrack"),de=f((O,D,H,U)=>te(D,H.edge)&&te(U,O.edge)&&!Se(D,U),"pairCandidatesAreCompatible"),Ce=f((O,D,H,U,d)=>{let x=jt(O.current,D.edge,H,U.edge,d,O.baseSegments);if(!(x>=O.current.count))return{replacements:new Map([[D.edge,H.path],[U.edge,d.path]]),crossings:x,bends:O.currentBends-(O.baseBendsByEdge.get(D.edge)??0)-(O.baseBendsByEdge.get(U.edge)??0)+H.totalBends+d.totalBends,length:O.currentLength-(O.baseLengthByEdge.get(D.edge)??0)-(O.baseLengthByEdge.get(U.edge)??0)+H.length+d.length}},"scorePairReplacement"),ln=f((O,D)=>O.crossings<D.crossings||O.crossings===D.crossings&&(O.bends<D.bends||O.bends===D.bends&&O.length<D.length),"pairScoreIsBetter"),fn=f((O,D,H,U)=>{let d=U;for(let x of D.candidates)for(let S of H.candidates){if(!de(D,x,H,S))continue;let E=Ce(O,D,x,H,S);E&&ln(E,d)&&(d=E)}return d},"bestScoreForOptionPair"),dn=f(O=>{let D=F(),H=w(),U=vt(),d=T(O),x=new Map(y.map(J=>[J,Qt(h(J))])),S=new Map(y.map(J=>[J,N(h(J))])),E=new Map,A=I(O);for(let J of A)for(let V of J){if(E.has(V))continue;let G=Ut(V,O,U,d);G.length>0&&E.set(V,{edge:V,candidates:G})}let P={replacements:new Map,crossings:O.count,bends:D,length:H},j={current:O,currentBends:D,currentLength:H,baseBendsByEdge:x,baseLengthByEdge:S,baseSegments:U};for(let J of A){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)||(P=fn(j,rt,tt,P))}}}return P.replacements.size>0?P.replacements:void 0},"bestPairedReplacement");for(let O=0;O<4;O++){let D=C(),H=D.count;if(H===0)return;let U,d,x=H,S=Number.POSITIVE_INFINITY;for(let A of D.edges){let P=Qt(h(A),Z);for(let j of xt(A)){let J=k(A,j),V=!J&&_(A,j),G=b(D,A,j),ot=Qt(j,Z);J||V||!(G<H||G===H&&ot<P)||G>x||G===x&&ot>=S||(U=A,d=j,x=G,S=ot)}}if(U&&d){U.points=d;continue}let E=dn(D);if(!E)return;for(let[A,P]of E)A.points=P}}f(Is,"resolveRenderedOrthogonalCrossings");var pe=.001,Rr=8;function Ss(t,e){let{nodeInfoById:n,realNodeRects:o}=rn(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(c=>c.rect.top))-r,bottom:Math.max(...o.map(c=>c.rect.bottom))+r,left:Math.min(...o.map(c=>c.rect.left))-r,right:Math.max(...o.map(c=>c.rect.right))+r},g=f((c,p,C,M)=>{let v=[],R=io(c,p,C,M,r,pe);return R&&v.push(R),p===M&&v.push(co(c,p,C,i[p])),v},"buildOrthogonalPathCandidates"),l=f((c,p)=>{for(let C=0;C<c.length-1;C++){let M=c[C],v=c[C+1];if(wt(M,v,o,p,1))return!0}return!1},"pathHitsNode"),a=f((c,p,C=!1)=>{let M=0,v=Re(c,pe),R=p.start,I=p.end;for(let b of t){if(b===p||b.isLayoutOnly)continue;let T=b.start,N=b.end;if(!C&&R&&I&&(T===R||T===I||N===R||N===I))continue;let F=b.points;if(!(!F||F.length<2))for(let w of v)for(let _ of Re(F,pe)){if(lo(w.a,w.b,_.a,_.b,pe,pe)){M++;continue}ce(w,_,pe)>=Rr&&M++}}return M},"pathConflictCount"),u=4,y=f((c,p)=>{let C=Math.abs(c.y-p.rect.top),M=Math.abs(c.y-p.rect.bottom),v=Math.abs(c.x-p.rect.left),R=Math.abs(c.x-p.rect.right),I="top",b=C;return M<b&&(I="bottom",b=M),v<b&&(I="left",b=v),R<b&&(I="right",b=R),I},"nearestSideOfRect"),L=new Map,m=f((c,p,C)=>{let M=L.get(c)??[];M.push({side:p,edgeId:C}),L.set(c,M)},"addFaceClaim");for(let c of t){if(c.isLayoutOnly)continue;let p=c.points??[];if(p.length<1)continue;let C=c.id??"",M=c.start,v=c.end;if(M){let R=n.get(M);R&&m(M,y(p[0],R),C)}if(v){let R=n.get(v);R&&m(v,y(p[p.length-1],R),C)}}let h=f((c,p,C)=>L.get(c)?.some(M=>M.edgeId!==C&&M.side===p)??!1,"faceIsClaimed");for(let c of t){if(c.isLayoutOnly)continue;let p=c.points;if(!p||p.length<2)continue;let C=Qt(p,pe);if(C<u)continue;let M=c.start,v=c.end;if(!M||!v)continue;let R=n.get(M),I=n.get(v);if(!R||!I)continue;let b=c.id??"",T=a(p,c,!0),N=a(p,c),F,w=T,_=C;for(let k of s){if(h(M,k,b))continue;let B=Ie(R,k);for(let X of s){if(h(v,X,b))continue;let $=Ie(I,X);for(let K of g(B,k,$,X)){if(l(K,[M,v]))continue;let ct=Qt(K,pe);if(T>0){let mt=a(K,c,!0);if(mt>w||mt===w&&ct>=_)continue;w=mt,_=ct,F=K;continue}a(K,c)>N||ct<_&&(_=ct,F=K)}}}if(F){c.points=F;let k=L.get(M);k&&L.set(M,k.filter(X=>X.edgeId!==b));let B=L.get(v);B&&L.set(v,B.filter(X=>X.edgeId!==b)),m(M,y(F[0],R),b),m(v,y(F[F.length-1],I),b)}}}f(Ss,"simplifyDetouredEdges");var Kt=.001,Oo=10,ze=7;function Gn(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,g=r.y-s.y;if(!(Math.abs(i)+Math.abs(g)<Kt)){if(Math.abs(g)<=Kt){let a=s.x+Math.sign(i)*Oo;return{left:Math.min(s.x,a),right:Math.max(s.x,a),top:s.y-ze,bottom:s.y+ze}}if(Math.abs(i)<=Kt){let a=s.y+Math.sign(g)*Oo;return{left:s.x-ze,right:s.x+ze,top:Math.min(s.y,a),bottom:Math.max(s.y,a)}}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(Gn,"markerClearanceRectFor");function Cs(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(Cs,"normalizeRect");function $n(t,e){let n=pt(e),o=Gn(n,!0),s=Gn(n,!1);return[o,s].some(r=>r&&Ke(t,Cs(r)))}f($n,"labelOverlapsOwnMarker");function Ue(t,e){let n=[];for(let h of t){if(h.isLayoutOnly)continue;let c=h.points;if(!(!c||c.length<2))for(let p=0;p<c.length-1;p++)n.push({edgeId:h.id,p1:c[p],p2:c[p+1]})}let o=[],s=[];for(let h of e.values()){let c=h.isGroup,p=h.parentId;if(c&&!p){let M=qt(h);M&&s.push({id:h.id,rect:M});continue}if(c||h.isEdgeLabel)continue;let C=qt(h);C&&o.push({nodeId:h.id,rect:C})}let r=3,i=1,g=12,l=f((h,c)=>{let p=En(c,r);for(let{nodeId:C,rect:M}of o)if(C!==h&&Ke(p,M))return!0;return!1},"labelOverlapsForeignNode"),a=f((h,c)=>{let p=En(c,r);for(let C of n)if(C.edgeId!==h&&sn(C.p1,C.p2,p))return!0;return!1},"labelOverlapsForeignEdge"),u=f((h,c,p)=>l(h,p)||a(c,p),"labelOverlapsAnything"),y=[],L=f(h=>{for(let{id:c,rect:p}of s)if(Jo(p,h))return c},"findContainingLane"),m=f((h,c)=>y.some(p=>p.labelId!==h&&Ke(c,p.rect)),"overlapsPlacedLabel");for(let h of t){if(h.isLayoutOnly)continue;let c=h.labelNodeId;if(!c)continue;let p=e.get(c);if(!p)continue;let C=h.points;if(!C||C.length<2)continue;let M=p.width??0,v=p.height??0;if(M<=0||v<=0)continue;let R=[];for(let Q=0;Q<C.length-1;Q++){let W=C[Q],et=C[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 I=R.length>=3?R.filter(Q=>Q.idx>0&&Q.idx<R.length-1):R,b=I.length>0?I:R,T=M>=v?"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:v)+2,vt=et.length>=(et.orientation==="horizontal"?M:v)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),F=R[0],w=R[R.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],k=f((Q,W)=>{let et=C[Q.idx],lt=C[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=we(Q.midX,Q.midY,M,v),et=L(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+v/2+i,Vt=lt.rect.bottom-v/2-i;if(gt>xt||vt>Vt)return;let Ut={midX:B(Q.midX,gt,xt),midY:B(Q.midY,vt,Vt)},jt=we(Ut.midX,Ut.midY,M,v);return X(Q,jt)?{laneId:lt.id,anchor:Ut,rect:jt}: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:v/2)+g;if(Q===F){let gt=C[Q.idx];if(K(Q,W,gt)+Kt<lt)return!1}if(Q===w){let gt=C[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&&!$n(xt.rect,C)&&!m(c,xt.rect)&&!u(c,h.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&&!$n(vt.rect,C)&&!m(c,vt.rect)&&!l(c,vt.rect)&&(et||!a(h.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Ft=mt(b)??(b.length<R.length?mt(R):void 0)??Rt(R,!0)??Rt(R,!1)??Rt(R,!1,!0);if(Ft){p.x=Ft.anchor.midX,p.y=Ft.anchor.midY,p.parentId=Ft.laneId;let Q=we(Ft.anchor.midX,Ft.anchor.midY,M,v),W=y.findIndex(et=>et.labelId===c);W>=0?y[W]={labelId:c,rect:Q}:y.push({labelId:c,rect:Q})}}}f(Ue,"anchorLabelsToPolyline");var In=1e-6,Nr=8,Bo=Nr/2,Or=3;function zn(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}f(zn,"pairKey");function vs(t,e){let{nodeInfoById:n,realNodeRects:o}=rn(e),s=new Map;for(let i of e){let g=i.id;if(!i.isGroup&&i.isEdgeLabel){s.set(g,{w:i.width??0,h:i.height??0});continue}}let r=f((i,g,l,a)=>{let u=zn(g,l),y=0,L=f(m=>{if(!m)return;let h=s.get(m);if(!h)return;let c=a==="x"?h.w/2:h.h/2;c>y&&(y=c)},"consider");L(i.labelNodeId);for(let m of t){if(m===i||m.isLayoutOnly)continue;let h=m.start,c=m.end;!h||!c||zn(h,c)===u&&L(m.labelNodeId)}return y>0?y+Or:0},"labelClearanceFor");for(let i of t){if(i.isLayoutOnly)continue;let g=i.points;if(!so(g,In))continue;let l=ao(i,n,In);if(!l)continue;let{srcId:a,dstId:u,srcInfo:y,dstInfo:L,collinearX:m,collinearY:h}=l;if(m===h)continue;let c,p;if(m){let I=L.cy>y.cy;c={x:y.cx,y:I?y.rect.bottom:y.rect.top},p={x:L.cx,y:I?L.rect.top:L.rect.bottom}}else{let I=L.cx>y.cx;c={x:I?y.rect.right:y.rect.left,y:y.cy},p={x:I?L.rect.left:L.rect.right,y:L.cy}}if(wt(c,p,o,[a,u],1))continue;let M=r(i,a,u,m?"x":"y"),v=M>Bo?M:Bo,R=[0,v,-v];for(let I of R){let b={...c},T={...p};if(m){if(b.x+=I,T.x+=I,b.x<=y.rect.left||b.x>=y.rect.right||T.x<=L.rect.left||T.x>=L.rect.right)continue}else if(b.y+=I,T.y+=I,b.y<=y.rect.top||b.y>=y.rect.bottom||T.y<=L.rect.top||T.y>=L.rect.bottom)continue;if(!wt(b,T,o,[a,u],1)&&!qe(b,T,t,i,{epsilon:In})){i.points=[b,T];break}}}}f(vs,"straightenCollinearSiblingDetours");function Vn(t,e){let{realNodeRects:a,labelNodeRects:u}=me(e.values()),y=f((b,T)=>Re(T,.001).map(N=>({...N,edge:b,interior:N.index>=1&&N.index<=T.length-3})),"segmentsFor"),L=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"),m=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"),h=f((b,T)=>{let N=b.start,F=b.end,w=y(b,T);if(w.length!==T.length-1)return!1;let _=[N,F].filter(B=>!!B),k=b.labelNodeId?[b.labelNodeId]:[];for(let B of w)if(wt(B.a,B.b,a,_,-2)||wt(B.a,B.b,u,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 w)for(let K of y(B,pt(X)))if(m($,K)||le($.a,$.b,K.a,K.b,.001))return!1}}return!0},"candidateIsSafe"),c=f((b,T)=>{let N=pt(b.edge.points??[]);if(N.length<4||b.index>=N.length-1)return;let F=N.map(w=>({...w}));if(b.horizontal)F[b.index].y+=T,F[b.index+1].y+=T;else if(b.vertical)F[b.index].x+=T,F[b.index+1].x+=T;else return;return y(b.edge,F).length===F.length-1?F:void 0},"shiftedCandidate"),p=f((b,T)=>({x:b.x??(T.left+T.right)/2,y:b.y??(T.top+T.bottom)/2}),"nodeCenter"),C=f(b=>{let T=b.edge,N=pt(T.points??[]);if(N.length!==4||b.index!==1)return;let F=T.start?e.get(T.start):void 0,w=T.end?e.get(T.end):void 0,_=F?qt(F):void 0,k=w?qt(w):void 0,B=N.slice(b.index+2);if(!(!F||!w||!_||!k||B.length===0))return{sourceCenter:p(F,_),targetCenter:p(w,k),sourceRect:_,tail:B}},"sourceDetourContextFor"),M=f((b,T,N,F,w,_)=>{let k=F.y>=N.y,B=k?w.bottom:w.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"),v=f((b,T,N,F,w,_)=>{let k=F.x>=N.x,B=k?w.right:w.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=C(b);if(N){if(b.vertical)return M(b,T,N.sourceCenter,N.targetCenter,N.sourceRect,N.tail);if(b.horizontal)return v(b,T,N.sourceCenter,N.targetCenter,N.sourceRect,N.tail)}},"sourceDetourCandidate"),I=[-7,7,-14,14,-21,21];for(let b=0;b<12;b++){let T=L(),N=!1;for(let F=0;F<T.length&&!N;F++)for(let w=F+1;w<T.length&&!N;w++){let _=T[F],k=T[w];if(_.edge===k.edge||!m(_,k))continue;let B=[_,k].filter(X=>X.interior);for(let X of B){for(let $ of I){let K=c(X,$);if(K&&h(X.edge,K)){X.edge.points=K,N=!0;break}let ct=R(X,$);if(ct&&h(X.edge,ct)){X.edge.points=ct,N=!0;break}}if(N)break}}if(!N)return}}f(Vn,"nudgeSharedInteriorSubpaths");function Ls(t,e,n,o){let s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,g=o.y-n.y,l=s*g-r*i;if(Math.abs(l)<1e-10)return!1;let a=n.x-t.x,u=n.y-t.y,y=(a*g-u*i)/l,L=(a*r-u*s)/l,m=.01;return y>m&&y<1-m&&L>m&&L<1-m}f(Ls,"segmentsIntersect");function Es(t){let e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;let s=Zo(e),r=1,i=[];for(let l of n){if(l.isLayoutOnly)continue;let a=l.points;if(!a||a.length<2)continue;let u=l.start,y=l.end,L=l.labelNodeId,m=l.id??`${u}->${y}`;for(let h of s)if(!(h.nodeId===u||h.nodeId===y)&&!(L&&h.nodeId===L)){for(let c=0;c<a.length-1;c++)if(sn(a[c],a[c+1],h,-r)){o.push({type:"edge-node-overlap",edgeId:m,targetId:h.nodeId,detail:`segment ${c} passes through node "${h.nodeId}"`});break}}for(let h=0;h<a.length-1;h++)i.push({edgeId:m,start:u,end:y,p1:a[h],p2:a[h+1]})}let g=new Set;for(let l=0;l<i.length;l++)for(let a=l+1;a<i.length;a++){let u=i[l],y=i[a];if(u.edgeId!==y.edgeId&&!(u.start===y.start||u.start===y.end||u.end===y.start||u.end===y.end)&&Ls(u.p1,u.p2,y.p1,y.p2)){let L=u.edgeId<y.edgeId?`${u.edgeId}|${y.edgeId}`:`${y.edgeId}|${u.edgeId}`;g.has(L)||(g.add(L),o.push({type:"edge-edge-crossing",edgeId:u.edgeId,targetId:y.edgeId,detail:`edges "${u.edgeId}" and "${y.edgeId}" cross`}))}}if(o.length>0){let l=o.filter(u=>u.type==="edge-node-overlap").length,a=o.filter(u=>u.type==="edge-edge-crossing").length;Xe.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${l} edge-node overlap(s), ${a} edge crossing(s)`);for(let u of o)Xe.warn(`[SWIMLANE_VALIDATE] ${u.type}: ${u.detail}`)}return o}f(Es,"validateSwimlanesLayout");function Ts(t,e){let n=t.nodes??[],o=t.edges??[],s=n.filter(g=>!g.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!hs(t,e)||e==="BT"&&s.length>0&&!us(t))return;for(let g of o){if(g.isLayoutOnly)continue;let l=g.points;!l||l.length<2||(g.points=ae(Je(l)))}Ss(o,n),vs(o,n),gs(o,n);let r=new Map;for(let g of n)r.set(String(g.id),g);Ue(o,r),os(o,r),ps(o,r),Vn(o,r),ms(o,r),ys(o,r),Hn(o,r),xs(o,r);let i=f(()=>{Is(o,r),bs(o,r),Ms(o,r),Ue(o,r),_n(o,r),Hn(o,r),Ue(o,r),_n(o,r)},"finalizeRenderedEdges");i(),Vn(o,r),i(),Xn(o,r),Yn(o,r),Xn(o,r),Yn(o,r)}f(Ts,"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 po(t,e){return t.edges.filter(n=>n.dst===e)}f(po,"incoming");function As(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(As,"buildSuccessorMap");function mo(t){let e=As(t);for(let n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}f(mo,"buildSortedSuccessorMap");function yo(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(yo,"buildInDegreeMap");function xo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}f(xo,"sortedZeroInDegreeNodes");function cn(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(cn,"buildPredecessorSuccessorMaps");function bo(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(bo,"buildLayersFromRanks");function Be(t){let e=yo(t),n=xo(e),o=[],s=mo(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 g=0;for(;g<n.length&&n[g]<i;)g++;n.splice(g,0,i)}}return o.length===t.nodes.length?o:null}f(Be,"topoSortIfAcyclic");function Ne(t){let e=new Map,n=0;for(let o of t)e.set(o,n),n++;return e}f(Ne,"buildLayerIndex");function Mo(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),g=o,l=r,a=o;for(;g<r||l<s;)l>=s||g<r&&t[g]<=t[l]?e[a++]=t[g++]:(e[a++]=t[l++],i+=r-g);for(let u=o;u<s;u++)t[u]=e[u];return i},"count");return n(0,t.length)}f(Mo,"countInversions");function ws(t){let e=ye(t),n=new Map;for(let u of e.nodes)n.set(u,[]);for(let u of e.edges)n.get(u.src).push(u);for(let u of n.values())u.sort((y,L)=>y.dst===L.dst?y.id.localeCompare(L.id):y.dst.localeCompare(L.dst));let o=Object.create(null);for(let u of e.nodes)o[u]=0;let s=[],r=f(u=>{o[u]=1;for(let y of n.get(u)??[]){let L=y.dst;o[L]===0?r(L):o[L]===1&&s.push(y)}o[u]=2},"dfs"),i=[...e.nodes].sort((u,y)=>u.localeCompare(y));for(let u of i)o[u]===0&&r(u);let g=new Set(s.map(u=>`${u.id}:${u.src}->${u.dst}`)),l=e.edges.map(u=>g.has(`${u.id}:${u.src}->${u.dst}`)?{id:u.id,src:u.dst,dst:u.src,weight:u.weight,ref:u.ref}:u);return{acyclic:{nodes:[...e.nodes],edges:l,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}f(ws,"removeCycles_DFS");function Rs(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 g=n(r)??r;return e.set(o,g),g},"resolve");for(let o of t.nodes)n(o);return e}f(Rs,"buildTopLaneMap");function fe(t){let e=Rs(t);return n=>e.get(n)??null}f(fe,"createTopLaneResolver");function an(t){let e=[];for(let n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}f(an,"buildTopLaneOrder");function Io(t,e){let n=an(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(Io,"resolveTopLaneOrder");var Br={EPSILON:1e-6},nn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},Fo={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Ns(t,e){let n=ye(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=cn(n);for(let I of r.values())I.sort((b,T)=>b.localeCompare(T));let i=Be(n)??[...n.nodes].sort((I,b)=>I.localeCompare(b)),g=new Map;for(let[I,b]of i.entries())g.set(b,I);let l=new Map,a=new Map;for(let I of n.nodes)a.set(I,[]);for(let I of i){let b=(r.get(I)??[]).filter(T=>l.has(T));if(b.length>0){let T=Os(I,b,{laneOf:o,rankHint:s,topoIndex:g});l.set(I,T),a.get(T).push(I)}else l.has(I)||l.set(I,null)}for(let I of n.nodes)l.has(I)||l.set(I,null);let u=new Set;for(let I of n.nodes)(l.get(I)??null)===null&&u.add(I);let y=[...u].sort((I,b)=>{let T=g.get(I)??0,N=g.get(b)??0;return T===N?I.localeCompare(b):T-N}),L=Bs(n),m=new Map;for(let[I,b]of L.entries())m.set(I,[...b].sort((T,N)=>T.localeCompare(N)));let h=Fs(m),c=Ps(m),p=new Map;for(let I of n.nodes)p.set(I,[]);for(let I of c)for(let b of I.nodes){let T=p.get(b);T?T.push(I.id):p.set(b,[I.id])}let C=[],M=[],v=new Set,R=f(I=>{if(!v.has(I)){v.add(I),C.push(I);for(let b of a.get(I)??[])R(b);M.push(I)}},"walk");for(let I of y)R(I);for(let I of i)R(I);return{parent:l,children:a,roots:y,componentOf:h,blocks:c,nodeBlocks:p,adjacency:m,preorder:C,postorder:M,topologicalOrder:i}}f(Ns,"buildDrivingTree");function Os(t,e,n){let o=n.laneOf(t);return[...e].sort((r,i)=>{let g=n.laneOf(r),l=n.laneOf(i),a=g!=null&&g===o,u=l!=null&&l===o;if(a!==u)return a?-1:1;let y=n.rankHint?.[r],L=n.rankHint?.[i];if(y!=null&&L!=null&&y!==L)return L-y;let m=n.topoIndex.get(r)??0,h=n.topoIndex.get(i)??0;return m!==h?m-h:r.localeCompare(i)})[0]}f(Os,"chooseParent");function Bs(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(Bs,"buildAdjacency");function Fs(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(Fs,"assignComponents");function Ps(t){let e=new Map,n=new Map,o=[],s=[],r=0,i=f((g,l)=>{e.set(g,++r),n.set(g,r);for(let a of t.get(g)??[])a!==l&&(e.has(a)?(e.get(a)??0)<(e.get(g)??0)&&(o.push([g,a]),n.set(g,Math.min(n.get(g)??r,e.get(a)??r))):(o.push([g,a]),i(a,g),n.set(g,Math.min(n.get(g)??r,n.get(a)??r)),(n.get(a)??0)>=(e.get(g)??0)&&s.push(ks(g,a,o,s.length))))},"visit");for(let g of t.keys())e.has(g)||i(g,null);return s}f(Ps,"computeBlocks");function ks(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(ks,"popBlock");function _s(t,e,n){let o=[...t.nodes],s=new Map;for(let[M,v]of o.entries())s.set(v,M);let r=o.length,i=new Array(r).fill(-1),g=new Array(r).fill(0),l=[],a=new Set;for(let M of o){let v=n.parent.get(M)??null,R=s.get(M);R!=null&&v==null&&(i[R]=-1,g[R]=0,a.has(M)||(a.add(M),l.push(M)))}for(;l.length>0;){let M=l.shift(),v=s.get(M);if(v==null)continue;let R=n.children.get(M)??[];for(let I of R){if(a.has(I))continue;let b=s.get(I);b!=null&&(i[b]=v,g[b]=g[v]+1,a.add(I),l.push(I))}}for(let M of o){if(a.has(M))continue;let v=s.get(M);v!=null&&(i[v]=-1,g[v]=0,a.add(M))}let u=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),y=Array.from({length:u},()=>new Array(r).fill(-1));for(let M=0;M<r;M++)y[0][M]=i[M];for(let M=1;M<u;M++)for(let v=0;v<r;v++){let R=y[M-1][v];y[M][v]=R===-1?-1:y[M-1][R]}let L=f((M,v)=>{if(M===-1||v===-1)return-1;g[M]<g[v]&&([M,v]=[v,M]);let R=g[M]-g[v];for(let I=0;I<u;I++)if(R>>I&1&&(M=y[I][M],M===-1))return-1;if(M===v)return M;for(let I=u-1;I>=0;I--){let b=y[I][M],T=y[I][v];b===-1||T===-1||b!==T&&(M=b,v=T)}return y[0][M]},"lcaIndex"),m=Array.from({length:r},()=>new Map);for(let M of t.edges){let v=M.src,R=M.dst,I=e[v],b=e[R];if(I==null||b==null||(I>b&&([v,R]=[R,v],[I,b]=[b,I]),I==null||b==null||I===b))continue;let T=s.get(v),N=s.get(R);if(T==null||N==null)continue;let F=L(T,N);if(F===-1)continue;let w=m[F];for(let _=I;_<b;_++)w.set(_,(w.get(_)??0)+1)}let h=new Map,c=f((M,v)=>{if(v.size!==0)for(let[R,I]of v)M.set(R,(M.get(R)??0)+I)},"mergeInto"),p=new Set,C=f(M=>{let v=s.get(M);p.add(M);let R=v==null?void 0:m[v],I=R?new Map(R):new Map,b=n.children.get(M)??[];for(let T of b){let N=C(T),F=e[M];if(F!=null){let w=h.get(M);w||(w=new Map,h.set(M,w));let _=N.get(F)??0,k=e[T];k!=null&&k>F&&(_+=1),w.set(T,_)}c(I,N)}return I},"dfs");for(let M of n.roots)p.has(M)||C(M);for(let M of o)p.has(M)||C(M);return h}f(_s,"computeSubtreeCrossCounts");function Ds(t,e,n){let o=new Map,s=f(r=>{let i=n[r]??0,g=[...e.get(r)??[]];g.sort(So(n));for(let l of g){s(l);let a=o.get(l);a!=null&&(i=Math.min(i,a))}o.set(r,i)},"annotate");for(let r of t)s(r);return o}f(Ds,"annotateMinimumLayers");function So(t){return(e,n)=>{let o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}f(So,"compareByRankThenId");function Hs(t,e,n,o){let s=0;for(let l of e){let a=n[l]??0;a>s&&(s=a)}let r=Array.from({length:s+1},()=>[]),i=new Set,g=f(l=>{if(i.has(l))return;i.add(l);let a=n[l]??0;r[a]||(r[a]=[]),r[a].push(l);for(let u of o(l))g(u)},"emit");for(let l of t)g(l);for(let l of e)if(!i.has(l)){let a=n[l]??0;r[a]||(r[a]=[]),r[a].push(l),i.add(l)}return r}f(Hs,"emitNodesInTreeOrder");function Xs(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(Xs,"deduplicateLayers");function Ys(t,e,n,o){return s=>{let r=t.get(s)??[];if(r.length===0)return[];let i=e[s]??0,g=[],l=[],a=n.get(s);for(let u of r){let y=o.get(u)??i;y>i?g.push({child:u,min:y}):l.push(u)}return g.sort((u,y)=>u.min===y.min?u.child.localeCompare(y.child):u.min-y.min),l.sort((u,y)=>{let L=a?.get(u)??0,m=a?.get(y)??0;if(L!==m)return L-m;let h=o.get(u)??i,c=o.get(y)??i;return h!==c?h-c:u.localeCompare(y)}),[...g.map(u=>u.child),...l]}}f(Ys,"createChildOrderer");function on(t,e,n){let o=Ns(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(let y of t.nodes)s.has(y)||s.set(y,[]);let i=_s(t,e,o),g=[...r].sort(So(e)),l=Ds(g,s,e),a=Ys(s,e,i,l),u=Hs(g,t.nodes,e,a);return u=Xs(u),u}f(on,"buildMultitreeLayerOrder");function Gs(t,e,n){let o=new Set(t),s=new Set(e),r=Ne(e),i=[];for(let g of n)o.has(g.src)&&s.has(g.dst)&&i.push(r.get(g.dst));return Mo(i)}f(Gs,"countCrossingsBetweenAdjacent");function Un(t,e,n){let o=[];for(let r of e){let i=n[r.src],g=n[r.dst];if(i==null||g==null||i===g)continue;let l=r.src,a=r.dst,u=i,y=g;i>g&&(l=r.dst,a=r.src,u=g,y=i);for(let L=u;L<y;L++)o.push({id:`${r.id}@${L}`,src:l,dst:a,ref:r.ref})}let s=0;for(let r=0;r+1<t.length;r++)s+=Gs(t[r],t[r+1],o);return s}f(Un,"totalCrossings");function $s(t,e){let n={...e},{preds:o}=cn(t),s=fe(t),r=on(t,n,s),i=Un(r,t.edges,n),g=nn.MAX_CROSSING_OPTIMIZATION_PASSES;for(let l=0;l<g;l++){let a=!1,u=[...t.nodes].sort((y,L)=>(n[L]??0)-(n[y]??0));for(let y of u){let L=n[y]??0;if(L===0)continue;let m=0;for(let C of o.get(y)??[])m=Math.max(m,(n[C]??0)+1);if(m>=L)continue;let h=L;n[y]=m;let c=on(t,n,s),p=Un(c,t.edges,n);p<i?(i=p,a=!0):n[y]=h}if(!a)break}return n}f($s,"optimizeRanksByCrossings");function zs(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(c=>c.src===s);if(i.length===0)continue;let g=!1,l=0;for(let c of i){let p=n(c.dst);p==null||p===r?g=!0:l++}if(l===0||g)continue;let a=0,u=!1;for(let c of t.edges){if(c.dst!==s)continue;let p=n(c.src);p&&(p===r?u=!0:a++)}if(a>0||!u)continue;let y=e[s]??0,L=y+l,m=0;for(let c of t.edges)c.dst===s&&(m=Math.max(m,(e[c.src]??0)+1));let h=Math.max(y,m,L);h!==y&&(e[s]=h)}}f(zs,"adjustCrossLaneSources");function Vs(t,e){let n=ye(t),o=Be(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=fe(n),i=Object.create(null);for(let l of o){let a=po(n,l),u=e?.ignoreCrossLaneEdges?a.filter(y=>{let L=r(y.src),m=r(l);return!L||!m?!0:L===m}):a;if(u.length===0)i[l]=0;else if(s&&u.length===1){let y=u[0].src,L=r(y),m=r(l);L!==m?i[l]=i[y]??0:i[l]=(i[y]??0)+1}else{let y=-1/0;for(let L of u)y=Math.max(y,(i[L.src]??0)+1);i[l]=y===-1/0?0:y}}return(e?.optimizeRanksByCrossings??!1)&&(i=$s(n,i)),e?.ignoreCrossLaneEdges&&zs(n,i),{layers:on(n,i,r),rankOf:i,dummy:new Set}}f(Vs,"assignLayers_LongestPath");function Us(t,e){let n=ye(t),s={...Vs(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=fe(n),{preds:i,succs:g}=cn(n,h=>{if(e?.ignoreCrossLaneEdges){let c=r(h.src),p=r(h.dst);if(c&&p&&c!==p)return!1}return!0}),l=Be(n)??[...n.nodes],a=[...l].reverse(),u=f((h,c)=>{let p=0;for(let v of i.get(h)??[])p=Math.max(p,(s[v]??0)+1);let C=Number.POSITIVE_INFINITY,M=g.get(h)??[];return M.length>0&&(C=Math.min(...M.map(v=>(s[v]??0)-1))),Number.isFinite(C)||(C=Math.max(p,c)),Math.min(Math.max(c,p),C)},"clampFeasible"),y=nn.GRAVITY_ITERATIONS,L=f(h=>{let c=!1;for(let p of h){let C=i.get(p)??[],M=g.get(p)??[];if(C.length===0&&M.length===0)continue;let v=C.length>0?C.reduce((T,N)=>T+(s[N]??0)+1,0)/C.length:s[p]??0,R=M.length>0?M.reduce((T,N)=>T+(s[N]??0)-1,0)/M.length:s[p]??0,I=Math.round((v+R)/2),b=u(p,I);b!==s[p]&&(s[p]=b,c=!0)}return c},"relaxOrder");for(let h=0;h<y;h++){let c=L(l),p=L(a);if(!c&&!p)break}for(let h of l){let c=0;for(let p of i.get(h)??[])c=Math.max(c,(s[p]??0)+1);(s[h]??0)<c&&(s[h]=c)}for(let h of a){let c=g.get(h)??[];if(c.length>0){let p=Math.min(...c.map(C=>(s[C]??0)-1));(s[h]??0)>p&&(s[h]=p)}}return{layers:bo(n,l,s),rankOf:s,dummy:new Set}}f(Us,"assignLayers_Gravity");function js(t){let e=yo(t),n=mo(t),o=xo(e),s=[];for(;o.length>0;){let r=[];for(let i of o){s.push(i);for(let g of n.get(i)??[])e.set(g,(e.get(g)??0)-1),(e.get(g)??0)===0&&r.push(g)}o=r.sort((i,g)=>i.localeCompare(g))}return s.length===t.nodes.length?s:null}f(js,"topoSortByGenerationIfAcyclic");function Ws(t,e){let n=ye(t),o=e?.direction==="LR"?js(n)??[...n.nodes].sort():Be(n)??[...n.nodes].sort(),s=fe(n),r=f(u=>s(u)??u,"laneOf"),i=Object.create(null),g=new Map,l=f((u,y)=>e?.ignoreCrossLaneEdges??!0?r(u)===r(y)?1:0:1,"edgeWeight");for(let u of o){if(n.nodeById.get(u)?.isGroup)continue;let L=po(n,u),m=0;if(L.length>0)for(let C of L){let M=C.src,v=i[M]??0;m=Math.max(m,v+l(M,u))}let h=r(u),c=g.get(h)??0,p=Math.max(m,c);i[u]=p,g.set(h,p+1)}return{layers:bo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}f(Ws,"assignLayers_LaneAwareCompact");function Ks(t,e){let n=ye(e),{rankOf:o}=t,s=t.layers.map(m=>[...m]),r=new Set(t.dummy?[...t.dummy]:[]),i=0,g=new Map(n.nodeById),l=f(m=>{let h=`placeholder-${i++}`,c={id:h,isGroup:!1,isDummy:!0,width:0,height:0};for(g.set(h,c),r.add(h);s.length<=m;)s.push([]);return s[m].push(h),o[h]=m,h},"addDummyAt"),a=[...n.edges].sort((m,h)=>m.id===h.id?m.src===h.src?m.dst.localeCompare(h.dst):m.src.localeCompare(h.src):m.id.localeCompare(h.id)),u=[];for(let m of a){let h=o[m.src]??0,c=o[m.dst]??0;if(c-h<=1){u.push(m);continue}let p=m.src;for(let M=h+1,v=0;M<c;M++,v++){let R=l(M);u.push({id:`${m.id}#${v}`,src:p,dst:R,weight:m.weight,ref:m.ref}),p=R}let C=c-h-2;u.push({id:`${m.id}#${Math.max(C+1,0)}`,src:p,dst:m.dst,weight:m.weight,ref:m.ref})}let L={nodes:[...n.nodes,...[...r].filter(m=>!n.nodes.includes(m))],edges:u,layout:n.layout,nodeById:g};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:L}}f(Ks,"makeProperLayering");function jn(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(jn,"median");function Wn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}f(Wn,"barycenter");function qs(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(qs,"neighborPositionsFor");function Js(t,e,n){let o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}f(Js,"currentOrderTieBreak");function Kn(t,e,n){let o=new Set(t),s=new Set(e),r=Ne(t),i=Ne(e),g=[];for(let a of n)o.has(a.src)&&s.has(a.dst)&&g.push({u:r.get(a.src),v:i.get(a.dst)});g.sort((a,u)=>a.u===u.u?a.v-u.v:a.u-u.u);let l=g.map(a=>a.v);return Mo(l)}f(Kn,"countCrossingsBetweenAdjacent");function je(t,e,n){return[...t].sort((o,s)=>{let r=jn(e.get(o)??[]),i=jn(e.get(s)??[]);return r===i?Js(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}f(je,"sortByHeuristic");function qn(t,e,n,o,s,r){let i=Ne(t),g=Ne(e),l=qs(e,i,n,o);if(!s||!r||r.length===0)return je(e,l,g);let a=new Map;for(let L of e){let m=s(L),h=a.get(m)??[];h.push(L),a.set(m,h)}let u=[];for(let L of r){let m=a.get(L);if(!m||m.length===0)continue;let h=je(m,l,g);u.push(...h)}let y=a.get(null);if(y&&y.length>0){let L=je(y,l,g);for(let m of L){let h=Wn(l.get(m)??[]),c=u.length;if(isFinite(h))for(let[p,C]of u.entries()){let M=Wn(l.get(C)??[]);if(h<M){c=p;break}}u.splice(c,0,m)}}return u}f(qn,"reorderLayer");function Jn(t,e,n,o,s){let r=[...e],i=new Set(t),g=new Set(e),l=o?new Set(o):null,a=n.filter(c=>i.has(c.src)&&g.has(c.dst)),u=l?n.filter(c=>g.has(c.src)&&l.has(c.dst)):void 0,y=f(c=>{let p=Kn(t,c,a);return u&&o&&(p+=Kn(c,o,u)),p},"crossingScore"),L=s?new Map:null;if(s&&L)for(let c of e)L.set(c,s(c));let m=!0,h=y(r);for(;m;){m=!1;for(let c=0;c+1<r.length;c++){if(L){let M=L.get(r[c]),v=L.get(r[c+1]);if(M!==v)continue}let p=h;[r[c],r[c+1]]=[r[c+1],r[c]];let C=y(r);C<p?(h=C,m=!0):[r[c],r[c+1]]=[r[c+1],r[c]]}}return r}f(Jn,"transposeImprove");function Zs(t,e,n){let o=t.layers.map(g=>[...g]),s=e.edges,r=fe(e),i=Io(e,n?.laneOrder);for(let g=0;g<3;g++){for(let l=1;l<o.length;l++)o[l]=qn(o[l-1],o[l],s,"down",r,i),o[l]=Jn(o[l-1],o[l],s,o[l+1],r);for(let l=o.length-2;l>=0;l--)o[l]=qn(o[l+1],o[l],s,"up",r,i),o[l]=Jn(o[l+1],o[l],s,o[l-1],r)}return{layers:o}}f(Zs,"orderLayers");function Qs(t,e,n){let o=n?.layerGap??Fo.DEFAULT_LAYER_GAP,s=n?.nodeGap??Fo.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",g=i==="LR"||i==="RL",l=t.layers,a=Object.create(null),u=Object.create(null),y=f(w=>e.nodeById.get(w),"getNode"),L=f(w=>y(w)?.width??0,"getWidth"),m=f(w=>y(w)?.height??0,"getHeight"),h=fe(e),c=Io(e,n?.laneOrder),p=l.map(w=>w.reduce((_,k)=>Math.max(_,m(k)),0)),C=[];if(g)for(let w=0;w+1<l.length;w++){let _=l[w].reduce((mt,Rt)=>Math.max(mt,L(Rt)),0),k=l[w+1].reduce((mt,Rt)=>Math.max(mt,L(Rt)),0),B=p[w],X=p[w+1],$=B/2+X/2,K=(_+k)/2,ct=Math.max(0,K-$-o);C.push(ct)}let M=new Set;for(let w of l)for(let _ of w)M.add(h(_));let v=M.has(null),R=c.filter(w=>M.has(w)),I=[...v?[null]:[],...R],b=Object.create(null);for(let w of R)b[w]=0;v&&(b.null=0);for(let w of l){let _=Object.create(null),k=[];for(let B of w){let X=h(B);X===null?k.push(B):(_[X]||=[]).push(B)}for(let[B,X]of Object.entries(_)){let $=X.reduce((K,ct)=>K+L(ct),0)+s*Math.max(0,X.length-1);b[B]=Math.max(b[B]??0,$)}if(v&&k.length){let B=k.reduce((X,$)=>X+L($),0)+s*Math.max(0,k.length-1);b.null=Math.max(b.null??0,B)}}let T=new Map;{let w=I.map(B=>(B===null?b.null:b[B])??0),k=-(w.reduce((B,X)=>B+X,0)+r*Math.max(0,I.length-1))/2;for(let B=0;B<I.length;B++){let X=I[B],$=w[B]??0,K=k+$/2;T.set(X,K),k+=$,B<I.length-1&&(k+=r)}}let N=0;for(let[w,_]of l.entries()){let k=p[w]??0,B=new Map;for(let $ of _){let K=h($),ct=B.get(K)??[];ct.push($),B.set(K,ct)}for(let $ of I){let K=B.get($)??[];if(K.length===0)continue;let ct=T.get($);if(K.length===1){let mt=K[0];a[mt]=ct,u[mt]=N+k/2}else{let mt=K.map(Q=>L(Q)),Rt=mt.reduce((Q,W)=>Q+W,0)+s*(K.length-1),Ft=ct-Rt/2;for(let[Q,W]of K.entries()){let et=mt[Q];a[W]=Ft+et/2,u[W]=N+k/2,Ft+=et+s}}}let X=C[w]??0;N+=k+o+X}let F=new Map;for(let w of e.edges){let _=w.ref.id;F.has(_)||F.set(_,[]),F.get(_).push(w)}for(let[,w]of F){if(w.length===0)continue;let _=w[0].ref,k=_.start,B=_.end;if(k==null||B==null)continue;let X=Math.round(((a[k]??0)+(a[B]??0))/2),$=new Set;for(let K of w)$.add(K.src),$.add(K.dst);for(let K of $){if(K===k||K===B)continue;e.nodeById.get(K)?.isDummy&&(a[K]=X)}}return{x:a,y:u}}f(Qs,"assignCoordinates");var tr=8;function er(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(er,"hashString");function nr(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(nr,"mulberry32");function or(t,e){let n=[...t],o=nr(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(or,"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 Zn(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 g=n.get(s),l=n.get(r);g==null||l==null||(o+=i*Math.abs(g-l))}return o}f(Zn,"laneArrangementCost");function rr(t){let e=an(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,g=typeof r.end=="string"?r.end:void 0;if(!i||!g||!t.nodeById.has(i)||!t.nodeById.has(g))continue;let l=o(i),a=o(g);if(!l||!a||l===a)continue;let u=n.get(l),y=n.get(a);if(u==null||y==null)continue;let[L,m]=u<=y?[l,a]:[a,l],h=`${L}\0${m}`,c=s.get(h);c?c.weight++:s.set(h,{a:L,b:m,weight:1})}return[...s.values()]}f(rr,"buildWeightedLaneEdges");function Qn(t,e,n){let o=[...t],s=Zn(o,e),r=!0,i=0,g=Math.max(1,o.length);for(;r&&i<g;){r=!1,i++;for(let l=0;l+1<o.length;l++){[o[l],o[l+1]]=[o[l+1],o[l]];let a=Zn(o,e);a<s?(s=a,r=!0):[o[l],o[l+1]]=[o[l+1],o[l]]}}return{order:o,cost:s,sourceDistance:sr(o,n)}}f(Qn,"greedySwitch");function ir(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}f(ir,"isBetterCandidate");function cr(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 er(`${t.join("|")}#${o}#${n}`)}f(cr,"seedForRestart");function ar(t,e={}){let n=an(t);if(n.length<2)return n;let o=rr(t);if(o.length===0)return n;let s=new Map(n.map((g,l)=>[g,l])),r=Qn(n,o,s),i=Math.max(0,e.restarts??tr);for(let g=0;g<i;g++){let l=cr(n,o,g),a=or(n,l),u=Qn(a,o,s);ir(u,r)&&(r=u)}return r.order}f(ar,"optimizeTopLaneOrder");function lr(t,e){let n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,s=ye(t),r=e?.automaticLaneOrdering?ar(s,{restarts:tr}):void 0,i=ws(s),g=i.acyclic,l=n?Ws(g,{compactSingleInput:e?.compactSingleInput??nn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!0,direction:e?.direction}):Us(g,{compactSingleInput:e?.compactSingleInput??nn.DEFAULT_COMPACT_SINGLE_INPUT,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:a,graphWithDummies:u}=Ks(l,g),y=Zs(a,u,{laneOrder:r}),L=Qs(y,u,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:r});return{acyclic:g,reversed:i.reversed,layering:a,ordered:y,coordinates:L}}f(lr,"sugiyamaLayout");var at=Br.EPSILON,Fr=8,be=15,Te=15,Ve=25,ne=20,Sn=10;function to(t,e,n){let o=t.x??0,s=t.y??0,r=e.x-o,i=e.y-s,g=Math.abs(r),l=Math.abs(i);return g<at&&l<at?n:l>at&&l*3>=g?i>0?"bottom":"top":g>at?r>0?"right":"left":n}f(to,"chooseOrthogonalSide");function eo(t,e){return Math.abs(t.to-e.from)<at||Math.abs(t.to-e.to)<at?t.to:t.from}f(eo,"sharedLineEndpointCoord");function Me(t,e){return t.orient==="vertical"?{x:t.coord,y:e}:{x:e,y:t.coord}}f(Me,"pointOnLine");function fr(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,g=[],l=e==="LR";for(let d of n)r.set(d.id,d);let a=n.filter(d=>d.isGroup&&!d.parentId);for(let d of a){let x={id:d.id},S=f(E=>{i.set(E.id,x),n.filter(A=>A.parentId===E.id).forEach(S)},"assignLane");S(d)}let u=n.filter(d=>!d.isGroup&&!d.isEdgeLabel).map(d=>{let x=d.width??10,S=d.height??10,E=d.x??0,A=d.y??0,P=Fr;return{nodeId:d.id,minX:E-x/2-P,maxX:E+x/2+P,minY:A-S/2-P,maxY:A+S/2+P,visualXHalfExtent:l?S/2+P:x/2+P}}),y=f((d,x,S,E)=>{let A=g.find(P=>P.orientation===d&&Math.abs(P.coord-x)<1);return A||(A={id:`pipe-${d}-${x.toFixed(0)}`,orientation:d,coord:x,spanMin:S,spanMax:E,tracks:[]},g.push(A)),A.spanMin=Math.min(A.spanMin,S),A.spanMax=Math.max(A.spanMax,E),A},"getOrAddPipe"),L=f((d,x)=>{let S=d.width??10,E=d.height??10,A=d.x??0,P=d.y??0;switch(x){case"top":return{x:A,y:P-E/2};case"bottom":return{x:A,y:P+E/2};case"left":return{x:A-S/2,y:P};case"right":return{x:A+S/2,y:P}}},"portForSide"),m=f((d,x,S)=>L(d,to(d,x,S?"bottom":"top")),"getOrthogonalPort"),h=[],c=[],p=new Set,C=1e3,M=f((d,x,S)=>{if(h.length===0)return 0;let E=Math.abs(x.y-S.y)<at,A=Math.abs(x.x-S.x)<at;if(!E&&!A)return 0;let P=0;if(E){let j=x.y,J=Math.min(x.x,S.x)-at,V=Math.max(x.x,S.x)+at;if(V<=J)return 0;for(let G of h)G.edgeIndex===d||G.orientation!=="vertical"||G.pipe.coord<J||G.pipe.coord>V||G.from-at<=j&&G.to+at>=j&&(P+=C)}else if(A){let j=x.x,J=Math.min(x.y,S.y)-at,V=Math.max(x.y,S.y)+at;if(V<=J)return 0;for(let G of h)G.edgeIndex===d||G.orientation!=="horizontal"||G.pipe.coord<J||G.pipe.coord>V||G.from-at<=j&&G.to+at>=j&&(P+=C)}return P},"crossingPenalty"),v=s.map((d,x)=>{if(!d.start||!d.end)return{idx:x,crossLane:0,dx:0,dy:0};let S=r.get(d.start),E=r.get(d.end),A=i.get(d.start),P=i.get(d.end),j=A&&P&&A.id!==P.id?1:0,J=S&&E?Math.abs((E.x??0)-(S.x??0)):0,V=S&&E?Math.abs((E.y??0)-(S.y??0)):0;return{idx:x,crossLane:j,dx:J,dy:V}}).sort((d,x)=>{if(d.crossLane!==x.crossLane)return x.crossLane-d.crossLane;let S=d.dx+d.dy,E=x.dx+x.dy;return Math.abs(S-E)>1?S-E:d.idx-x.idx}).map(d=>d.idx),R=f((d,x,S,E)=>{let A=Math.min(d.x,x.x),P=Math.max(d.x,x.x),j=Math.min(d.y,x.y),J=Math.max(d.y,x.y);return!!u.find(G=>S&&G.nodeId===S||E&&G.nodeId===E?!1:Math.abs(d.x-x.x)>at?G.minY<d.y&&G.maxY>d.y&&G.maxX>A&&G.minX<P:G.minX<d.x&&G.maxX>d.x&&G.maxY>j&&G.minY<J)},"isSegmentBlocked"),I=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)=>to(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 S=r.get(x.start),E=r.get(x.end);if(!S||!E)continue;let A=(E.x??0)-(S.x??0),P=(E.y??0)-(S.y??0);N.set(d,{edgeIdx:d,srcId:x.start,dstId:x.end,srcSide:T(S,{x:E.x??0,y:E.y??0}),dstSide:T(E,{x:S.x??0,y:S.y??0}),absDx:Math.abs(A),absDy:Math.abs(P),dxSign:Math.sign(A),dySign:Math.sign(P)})}let F=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"),w=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,S)=>{let E=F(x),A=F(S);return Math.abs(E-A)>1e-9?A-E:x.edgeIdx-S.edgeIdx});for(let x=1;x<d.length;x++){let S=d[x],E=w(S),A=k.get(B(S.srcId,S.srcSide))??0,P=k.get(B(S.srcId,E))??0;P>=A||(k.set(B(S.srcId,S.srcSide),A-1),k.set(B(S.srcId,E),P+1),S.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 S=w(d);if(x.has(S)||(k.get(B(d.srcId,S))??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,S),1),d.srcSide=S}for(let d of N.values()){let{edgeIdx:x,srcId:S,dstId:E,srcSide:A,dstSide:P}=d,j=r.get(S),J=r.get(E),V=`${S}:${A}:src`,G=A==="top"||A==="bottom"?J.x??0:J.y??0;I.has(V)||I.set(V,[]),I.get(V).push({edgeIdx:x,oppositeCoord:G});let ot=`${E}:${P}:dst`,rt=P==="top"||P==="bottom"?j.x??0:j.y??0;I.has(ot)||I.set(ot,[]),I.get(ot).push({edgeIdx:x,oppositeCoord:rt})}let K=new Map,ct=8;for(let[d,x]of I){if(x.length<2)continue;x.sort((Lt,Dt)=>Lt.oppositeCoord-Dt.oppositeCoord);let S=d.split(":"),E=S.slice(0,-2).join(":"),A=S[S.length-2],P=S[S.length-1],j=r.get(E);if(!j)continue;let V=A==="left"||A==="right"?j.height??10:j.width??10,G=j.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,un=`${Dt.edgeIdx}:${P}`;K.set(un,Jt)}}let mt=f(d=>!!s[d]?.labelNodeId,"edgeHasLabelNode"),Rt=f((d,x)=>d?(I.get(`${d}:${x}:src`)??[]).some(({edgeIdx:S})=>mt(S))||(I.get(`${d}:${x}:dst`)??[]).some(({edgeIdx:S})=>mt(S)):!1,"faceHasLabelNode"),Ft=f((d,x,S)=>x==="top"||x==="bottom"?{x:d.x+S,y:d.y}:{x:d.x,y:d.y+S},"applyPortOffset"),Q=f((d,x,S)=>{let E=N.get(d),A={x:S.x??0,y:S.y??0},P={x:x.x??0,y:x.y??0},j=E?.srcSide??T(x,A),J=E?.dstSide??T(S,P),V=E?L(x,E.srcSide):m(x,A,!0),G=E?L(S,E.dstSide):m(S,P,!1),ot=K.get(`${d}:src`),rt=K.get(`${d}:dst`);return ot!==void 0&&(V=Ft(V,j,ot)),rt!==void 0&&(G=Ft(G,J,rt)),{pSrcPort:V,pDstPort:G,srcSide:j,dstSide:J}},"portsForEdge");for(let d of v){let x=s[d];if(c[d]=[],!x.start||!x.end||x.points&&x.points.length>0||x.start===x.end)continue;let S=r.get(x.start),E=r.get(x.end);if(!S||!E)continue;let{pSrcPort:A,pDstPort:P,srcSide:j,dstSide:J}=Q(d,S,E),V={...A},G={...P},ot=j==="top"||j==="bottom",rt=J==="top"||J==="bottom";if(ot){let Y=A.y>(S.y??0);V.y=Y?A.y+ne:A.y-ne}else{let Y=A.x>(S.x??0);V.x=Y?A.x+ne:A.x-ne}if(rt){let Y=P.y>(E.y??0);G.y=Y?P.y+ne:P.y-ne}else{let Y=P.x>(E.x??0);G.x=Y?P.x+ne:P.x-ne}let st=f((Y,z)=>{for(let q of u)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+Te:ft.minY-Te,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+Te:ft.minY-Te,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(A,S,E,Y,!0);V.x=z.x,V.y=z.y;let q=z.leavesPositiveSide?Math.min(Y.minY-2,A.y+ne):Math.max(Y.maxY+2,A.y-ne);yt=[{x:A.x,y:q},{x:z.x,y:q},{x:z.x,y:z.y}]}else{let z=tt(A,S,E,Y,!1),q=z.leavesPositiveSide?Math.min(Y.minX-2,A.x+ne):Math.max(Y.maxX+2,A.x-ne);V.x=z.x,V.y=z.y,yt=[{x:q,y:A.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(P,E,S,Y,!0);G.x=z.x,G.y=z.y,Dt=[{x:z.x,y:z.y},{x:P.x,y:z.y}]}else{let z=tt(P,E,S,Y,!1);G.x=z.x,G.y=z.y,Dt=[{x:z.x,y:z.y},{x:z.x,y:P.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=(I.get(`${x.start??""}:${j}:src`)?.length??0)+(I.get(`${x.start??""}:${j}:dst`)?.length??0),bt=(I.get(`${x.end??""}:${J}:src`)?.length??0)+(I.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,j)||bt>1&&Rt(x.end,J),ee=Ct<=1||Ot<=2,Pt=bt<=1||ut<=2;if((z||q)&&!ft&&(!Et||Et&&!Yt&&ee&&Pt)&&!R(A,P,x.start,x.end)){x.points=[{...A},{...V},{...G},{...P}],p.add(d);let Mt=q?"horizontal":"vertical",$t=q?A.y:A.x,It=q?Math.min(A.x,P.x):Math.min(A.y,P.y),St=q?Math.max(A.x,P.x):Math.max(A.y,P.y),Wt={id:`fast-path-${Mt}-${$t.toFixed(0)}-${d}`,orientation:Mt,coord:$t,spanMin:It,spanMax:St,tracks:[]};h.push({edgeIndex:d,segmentIndex:0,orientation:Mt,pipe:Wt,trackIndex:0,from:It,to:St});continue}}let un=y("vertical",V.x,V.y,V.y);V.x=un.coord;let gr=y("vertical",G.x,G.y,G.y);G.x=gr.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 u){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-Ve),he=Math.max(he,Y.maxX+Ve),ve=Math.min(ve,Y.minY-Ve),Le=Math.max(Le,Y.maxY+Ve))}for(let Y of u){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=Te;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 pr=g.filter(Y=>Y.orientation==="horizontal"&&Y.coord>=ve&&Y.coord<=Le),mr=g.filter(Y=>Y.orientation==="vertical"&&Y.coord>=ue&&Y.coord<=he),Fe=f((Y,z)=>`${Y.toFixed(1)},${z.toFixed(1)}`,"getKey"),Pe=Fe(V.x,V.y),Co=Fe(G.x,G.y),ke=new Map,hn=new Map,gn=new Map,_e=new Set,xe=[];ke.set(Pe,0),gn.set(Pe,"n"),xe.push({key:Pe,f:Math.hypot(G.x-V.x,G.y-V.y),pt:V}),_e.add(Pe);let Ht=[],ge=f((Y,z)=>R(Y,z,x.start,x.end),"checkSegmentBlocked"),pn={x:G.x,y:V.y},yr=ge(V,pn),xr=ge(pn,G),br=yr||xr,mn={x:V.x,y:G.y},Mr=ge(V,mn),Ir=ge(mn,G);if(br?Mr||Ir||(Math.abs(V.x-G.x)<at?Ht=[V,G]:Ht=[V,mn,G]):Math.abs(V.y-G.y)<at||Math.abs(V.x-G.x)<at?Ht=[V,G]:Ht=[V,pn,G],Ht.length===0)for(;xe.length>0;){xe.sort((ut,Yt)=>ut.f-Yt.f);let Y=xe.shift();if(_e.delete(Y.key),Y.key===Co){let ut=Co,Yt=G;for(Ht=[Yt];hn.has(ut);){let ee=hn.get(ut);Ht.unshift(ee),Yt=ee,ut=Fe(ee.x,ee.y)}break}let z=Y.pt.x,q=Y.pt.y,ft=mr.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=ft.findIndex(ut=>Math.abs(ut.coord-z)<1),bt=pr.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),Pt=Math.min(q,ut.y),Gt=Math.max(q,ut.y);if(u.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>Pt&&Zt.minY<Gt))continue;let Mt=Fe(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,De=ut.x-z,yn=ut.y-q;(Ee>10&&yn<-5||Ee<-10&&yn>5)&&(St=Math.abs(yn)*100),(Wt>10&&De<-5||Wt<-10&&De>5)&&(St+=Math.abs(De)*50);let vo=0,Lo=gn.get(Y.key)??"n",Eo=Math.abs(De)>at?"h":"v";Lo!=="n"&&Lo!==Eo&&(vo=50);let Sr=$t+It+St+vo,He=(ke.get(Y.key)??1/0)+Sr,To=Math.abs(G.x-ut.x)+Math.abs(G.y-ut.y);if(He<(ke.get(Mt)??1/0))if(hn.set(Mt,Y.pt),ke.set(Mt,He),gn.set(Mt,Eo),!_e.has(Mt))xe.push({key:Mt,f:He+To,pt:ut}),_e.add(Mt);else{let Zt=xe.findIndex(Cr=>Cr.key===Mt);Zt!==-1&&(xe[Zt].f=He+To)}}}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 Pt of Ht)q=Math.min(q,Pt.x),ft=Math.max(ft,Pt.x),Ct=Math.min(Ct,Pt.y),bt=Math.max(bt,Pt.y);let Et=ft>Math.max(Y.x,z.x),Ot=q<Math.min(Y.x,z.x);if(l){let Pt=Te;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=u.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+Pt;It=Math.max(It,Ee)}isNaN(It)||(ft=It)}}if(Ot){let Gt=u.filter(Bt=>Bt.minX<Math.min(Y.x,z.x)+Pt&&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-Pt;Bt=Math.min(Bt,It)}q=Bt}}}let ut=f(Pt=>{let Gt=z.y>Y.y,Bt=u.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(l&&Bt.length>0){let It=Bt.filter(St=>St.minX<Pt&&St.maxX>Pt);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(Pt=>{let Gt=ut(Pt),Bt={x:Pt,y:Y.y},Mt={x:Pt,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=[A,...yt,...Ht,...Dt.reverse(),P];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};h.push(ut),c[d].push(h.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,S,E)=>{let A=!E.segments.some(j=>(j.edgeIndex!==x.edgeIndex||j.segmentIndex!==x.segmentIndex)&&W(j,d)),P=!S.segments.some(j=>(j.edgeIndex!==d.edgeIndex||j.segmentIndex!==d.segmentIndex)&&W(j,x));return A&&P?(d.trackIndex=E.index,x.trackIndex=S.index,S.segments=[...S.segments.filter(j=>j.edgeIndex!==d.edgeIndex||j.segmentIndex!==d.segmentIndex),{edgeIndex:x.edgeIndex,segmentIndex:x.segmentIndex,from:x.from,to:x.to}],E.segments=[...E.segments.filter(j=>j.edgeIndex!==x.edgeIndex||j.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 S=d.pipe.tracks[d.trackIndex];S.segments=S.segments.filter(A=>A.edgeIndex!==d.edgeIndex||A.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 S=c[d.edgeIndex];for(let E of S){let A=h[E];A.pipe===d.pipe&>(A,x)}},"moveSegmentChainToTrack"),vt=f(d=>{let x=c[d.edgeIndex],S=x.indexOf(h.indexOf(d)),E=[];return S>0&&E.push(h[x[S-1]]),S<x.length-1&&E.push(h[x[S+1]]),E},"getAdjacentSegmentsAlongEdge"),Vt=f((d,x)=>{if(d.orientation===x.orientation)return!1;let S=d.orientation==="horizontal"?d:x,E=d.orientation==="horizontal"?x:d;return E.pipe.coord>S.from&&E.pipe.coord<S.to&&S.pipe.coord>E.from&&S.pipe.coord<E.to},"haveAnyCrossing"),Ut=f((d,x)=>{for(let S of d.tracks)if(!S.segments.some(A=>(A.edgeIndex!==x.edgeIndex||A.segmentIndex!==x.segmentIndex)&&W(A,x)))return S.index;return-1},"findAvailableTrack"),jt=f((d,x)=>{if(d.trackIndex===x.trackIndex)return W(d,x);let S=vt(d),E=vt(x);return S.some(A=>E.some(P=>Vt(A,P)))},"segmentsConflict"),te=f((d,x,S)=>{if(et(d,x,d.pipe.tracks[d.trackIndex],x.pipe.tracks[x.trackIndex]))return;let E=Ut(d.pipe,x);S(x,E!==-1?E:lt(d.pipe))},"resolveTrackConflict"),Se=f(d=>{let x=0;for(let S=0;S<d.length;S++)for(let E=S+1;E<d.length;E++){let A=d[S],P=d[E];A.pipe===P.pipe&&jt(A,P)&&(x++,te(A,P,xt))}return x},"resolveHandleConflicts"),de=new Map,Ce=f(d=>{if(de.has(d))return de.get(d);let x=c[d];if(x.length===0){let J={dest:0,deviation:0,base:0,delta:0};return de.set(d,J),J}let E=h[x[0]].pipe.coord,A=E;for(let J=1;J<x.length;J++){let V=h[x[J]];if(V.orientation==="horizontal"){let G=V.from,ot=V.to;A=Math.abs(G-E)>Math.abs(ot-E)?G:ot;break}}let P=Math.abs(A-E),j={dest:A,deviation:P,base:E,delta:A-E};return de.set(d,j),j},"getDestInfo"),ln=f(()=>{let d=0,x=new Map;for(let[E,A]of s.entries())c[E].length!==0&&A.start&&(x.has(A.start)||x.set(A.start,[]),x.get(A.start).push(E));let S=f(E=>{let A=s[E];if(!A.start||!A.end)return 0;let P=r.get(A.start),j=r.get(A.end);if(!P||!j)return 0;let J=(j.x??0)-(P.x??0),V=(j.y??0)-(P.y??0);return Math.abs(J)+Math.abs(V)},"getEdgeDistance");for(let E of x.values()){E.sort((P,j)=>{let J=Ce(P),V=Ce(j);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=S(P),ot=S(j);if(Math.abs(G-ot)>1)return ot-G;let rt=c[P].length,st=c[j].length;if(rt!==st)return rt-st;if(rt===1){let tt=c[P][0],yt=c[j][0];if(h[tt]&&h[yt]){let Nt=h[tt],Lt=h[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 A=E.map(P=>h[c[P][0]]);d+=Se(A)}return d},"fixSourceHandleCrossings"),fn=f(()=>{let d=0,x=new Map;for(let[S,E]of s.entries())c[S].length!==0&&E.end&&(x.has(E.end)||x.set(E.end,[]),x.get(E.end).push(S));for(let S of x.values()){S.sort((A,P)=>{let j=f(G=>{let ot=c[G];if(ot.length<2)return 0;let rt=h[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),J=j(A),V=j(P);return Math.abs(J-V)>.1?J-V:A-P});let E=S.map(A=>h[c[A][c[A].length-1]]);d+=Se(E)}return d},"fixTargetHandleCrossings"),dn=f(()=>{let d=0;for(let x of g){let S=[];for(let E of x.tracks)for(let A of E.segments){let P=c[A.edgeIndex].find(j=>h[j].segmentIndex===A.segmentIndex);P!==void 0&&S.push(h[P])}S.sort((E,A)=>E.edgeIndex-A.edgeIndex||E.segmentIndex-A.segmentIndex);for(let E=0;E<S.length;E++)for(let A=E+1;A<S.length;A++){let P=S[E],j=S[A];jt(P,j)&&(d++,te(P,j,gt))}}return d},"fixPipeCrossings"),O=0,D=10;for(;O<D;){let d=0;if(d+=ln(),d+=fn(),d+=dn(),d===0)break;O++}let H=new Map;for(let d of g){let x=[];d.tracks.forEach(E=>{E.segments.forEach(A=>{x.push({edgeIndex:A.edgeIndex,segmentIndex:A.segmentIndex,trackIndex:E.index,from:A.from,to:A.to})})}),x.sort((E,A)=>E.from-A.from);let S=[];if(x.length>0){let E=[x[0]],A=x[0].to;for(let P=1;P<x.length;P++){let j=x[P];j.from<A?(E.push(j),A=Math.max(A,j.to)):(S.push(E),E=[j],A=j.to)}S.push(E)}for(let E of S){let A=new Set;E.forEach(tt=>A.add(tt.trackIndex));let P=new Map;E.forEach(tt=>{let yt=Ce(tt.edgeIndex);P.set(tt.trackIndex,(P.get(tt.trackIndex)??0)+yt.delta)});let j=[...A].filter(tt=>(P.get(tt)??0)<-1),J=[...A].filter(tt=>(P.get(tt)??0)>1),V=[...A].filter(tt=>Math.abs(P.get(tt)??0)<=1);j.sort((tt,yt)=>(P.get(yt)??0)-(P.get(tt)??0)),J.sort((tt,yt)=>(P.get(tt)??0)-(P.get(yt)??0));let G=f((tt,yt)=>{E.filter(Nt=>Nt.trackIndex===tt).forEach(Nt=>{let Lt=p.has(Nt.edgeIndex)?d.coord:yt;H.set(`${Nt.edgeIndex}-${Nt.segmentIndex}`,Lt)})},"assignCoord"),ot=0;for(let tt of j)ot++,G(tt,d.coord-ot*Sn);if(V.length===0&&A.size>0){let tt=[...A].sort((Lt,Dt)=>Math.abs(P.get(Lt)??0)-Math.abs(P.get(Dt)??0))[0],yt=j.indexOf(tt);yt!==-1&&j.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*Sn*.5)}rt++}let st=0;for(let tt of J)st++,G(tt,d.coord+st*Sn)}}for(let[d,x]of s.entries()){let S=c[d]??[];if(S.length===0)continue;let E=[],A=r.get(x.start),P=r.get(x.end),{pSrcPort:j,pDstPort:J}=Q(d,A,P),V=S.map(rt=>{let st=h[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(j);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:eo(st,Lt);E.push(Me(st,Jt),Me(Lt,Jt))}else(rt===0||rt===V.length-2)&&E.push(Me(st,eo(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 U=f((d,x)=>{let S=x.x??0,E=x.y??0,A=x.width??0,P=x.height??0;if(A<=0||P<=0)return d;let j=S-A/2,J=S+A/2,V=E-P/2,G=E+P/2;if(d.x<j||d.x>J||d.y<V||d.y>G)return d;let ot=d.x-j,rt=J-d.x,st=d.y-V,tt=G-d.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:j,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 S=d.start,E=d.end,A=S?r.get(S):void 0,P=E?r.get(E):void 0;A&&(x[0]=U(x[0],A)),P&&(x[x.length-1]=U(x[x.length-1],P))}return t}f(fr,"routeEdgesOrthogonal");function dr(t){return t.direction??"TB"}f(dr,"getSwimlaneDirection");function ur(t){let e=Wo(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,g=dr(t),{ordered:l,coordinates:a}=lr(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:g});Ko(e,l,a,{nodeGap:n,layerGap:o});for(let u of t.edges??[])delete u.points;fr(t,g);for(let u of t.edges??[])(!u.curve||u.curve==="basis")&&(u.curve="rounded");return Ts(t,g),Es(t),g}f(ur,"runSwimlaneLayoutCore");function hr(t){jo(t);let e=qo(t);t.nodes=e.nodes,t.edges=e.edges}f(hr,"prepareSwimlaneLayout");var Wr=Ao({prepareLayout:hr,runLayoutCore:ur,afterPaint:Vo});export{Wr as render};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{a as o,b as e}from"./chunk-ZU7JKVUR.js";import"./chunk-TGD3YKTU.js";import"./chunk-EWVD6AUZ.js";import"./chunk-FH3BATM5.js";import"./chunk-CQFFNO72.js";import"./chunk-TGYBLZFN.js";import"./chunk-RBL2QVA3.js";import"./chunk-LK6KML2S.js";import"./chunk-CBQW2LLN.js";import"./chunk-U7TCJVVP.js";import"./chunk-U3E5RSXE.js";import"./chunk-EWILYK3H.js";import"./chunk-XCMS6RVA.js";import"./chunk-ZYRITDEB.js";import"./chunk-4AUIAGYT.js";import"./chunk-JAORNH2M.js";import"./chunk-JBQZ5UCE.js";import"./chunk-NLCJ5AKJ.js";import"./chunk-3CEAP2V5.js";import{a as r}from"./chunk-6LQNQPBM.js";import"./chunk-OOJM4CTU.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};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
import { LengthEdit, OffsetRange, StringEdit } from '@vscode/markdown-editor';
|
|
7
|
-
import { ISettableObservable, ITransaction
|
|
7
|
+
import { observableValue, type ISettableObservable, type ITransaction } from '@vscode/observables';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A single coloured run as returned by the `documentSyntaxHighlighting`
|
|
@@ -118,7 +118,7 @@ class HighlighterDocument {
|
|
|
118
118
|
this.#request(initialText);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
update(edit: StringEdit, tx: ITransaction
|
|
121
|
+
update(edit: StringEdit, tx: ITransaction): void {
|
|
122
122
|
const newText = edit.apply(this.#text);
|
|
123
123
|
const previousLength = this.#text.length;
|
|
124
124
|
this.#tokens = adjustTokens(this.#tokens, previousLength, newText.length);
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import{a as bt}from"./chunk-WVYKIHVG.js";import{n as vt}from"./chunk-JAORNH2M.js";import"./chunk-JBQZ5UCE.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-NLCJ5AKJ.js";import{F as st,b as _,h as K}from"./chunk-3CEAP2V5.js";import{a as o,b as gt}from"./chunk-6LQNQPBM.js";import"./chunk-OOJM4CTU.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-43RBMH4Y.js";import"./chunk-FK4OKHO7.js";import"./chunk-OOJM4CTU.js";export{e as TreeViewModule,r as createTreeViewServices};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,b as r}from"./chunk-ZNREFWKG.js";import"./chunk-FK4OKHO7.js";import"./chunk-OOJM4CTU.js";export{e as TreemapModule,r as createTreemapServices};
|
package/resources/tsconfig.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"extends":"../../tsconfig.base.json","compilerOptions":{"rootDir":".","outDir":"./dist/","module":"esnext","moduleResolution":"bundler","lib":["es2024","DOM","DOM.Iterable"],"types":["vscode-webview"],"typeRoots":["../node_modules/@types"],"skipLibCheck":true,"noEmit":true},"include":["./**/*.ts"]}
|
|
1
|
+
{"extends":"../../tsconfig.base.json","compilerOptions":{"rootDir":".","outDir":"./dist/","module":"esnext","moduleResolution":"bundler","lib":["es2024","DOM","DOM.Iterable"],"types":["vscode-webview"],"typeRoots":["../node_modules/@types"],"preserveSymlinks":true,"paths":{"@vscode/markdown-editor":["../node_modules/@vscode/markdown-editor/dist/index.d.ts"],"@vscode/observables":["../node_modules/@vscode/observables/dist/index.d.ts"]},"skipLibCheck":true,"noEmit":true},"include":["./**/*.ts"]}
|