handmux 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/package.json +13 -13
  2. package/dist/public/assets/{abnfDiagram-O67JEVCF-BsRDIQEB.js → abnfDiagram-O67JEVCF-BCKquDNu.js} +1 -1
  3. package/dist/public/assets/{arc-DLtLfMnX.js → arc-DtKhfU4x.js} +1 -1
  4. package/dist/public/assets/{architectureDiagram-NJMV4G6O-DoIXhWqZ.js → architectureDiagram-NJMV4G6O-BH7DIQFO.js} +1 -1
  5. package/dist/public/assets/{blockDiagram-BEXU5L5S-W0HiOcVA.js → blockDiagram-BEXU5L5S-Cwgt6g6G.js} +1 -1
  6. package/dist/public/assets/{c4Diagram-YGBWAQC7-72uAUMvX.js → c4Diagram-YGBWAQC7-BOBjSHAt.js} +1 -1
  7. package/dist/public/assets/channel-_M8n0hcq.js +1 -0
  8. package/dist/public/assets/{chunk-2Q5K7J3B-B9wSRFQ0.js → chunk-2Q5K7J3B-BqwsWYtg.js} +1 -1
  9. package/dist/public/assets/{chunk-3FUC2YCW-ryphp4s0.js → chunk-3FUC2YCW-Mms2CMs9.js} +2 -2
  10. package/dist/public/assets/{chunk-5VM5RSS4-Cm4KeKby.js → chunk-5VM5RSS4-DmiubfkW.js} +1 -1
  11. package/dist/public/assets/{chunk-GTNCS2PH-Du4_i7r3.js → chunk-GTNCS2PH-CwNuMbey.js} +1 -1
  12. package/dist/public/assets/{chunk-GWA4HPMP-CL1biVIA.js → chunk-GWA4HPMP-TlU0Zdso.js} +1 -1
  13. package/dist/public/assets/{chunk-JWPE2WC7-B8eAVfuB.js → chunk-JWPE2WC7-CaXu9QwT.js} +1 -1
  14. package/dist/public/assets/{chunk-NETBCI7D-D273GzYg.js → chunk-NETBCI7D-Cprt0I9G.js} +1 -1
  15. package/dist/public/assets/{chunk-WEXAMYUT-DipTfRbc.js → chunk-WEXAMYUT-CtoG2QGf.js} +1 -1
  16. package/dist/public/assets/{chunk-XXDRQBXY-D4SqXrQ8.js → chunk-XXDRQBXY-lvHTV8V8.js} +1 -1
  17. package/dist/public/assets/{classDiagram-v2-NBCMYWYE-PrpnIXcA.js → classDiagram-v2-NBCMYWYE-CUxYNX6T.js} +1 -1
  18. package/dist/public/assets/{cose-bilkent-JH36ORCC-BfcYMYTa.js → cose-bilkent-JH36ORCC-Dfvx-2V8.js} +1 -1
  19. package/dist/public/assets/{cynefin-OW5HDTMX-Du659bmz.js → cynefin-OW5HDTMX-DkrT2FtY.js} +1 -1
  20. package/dist/public/assets/{cynefinDiagram-VND7K2PF-DR_2Copy.js → cynefinDiagram-VND7K2PF-Cgtw5VS5.js} +1 -1
  21. package/dist/public/assets/{dagre-6A5THRUB-COsChaV5.js → dagre-6A5THRUB-BY6RWfkD.js} +1 -1
  22. package/dist/public/assets/{diagram-22UHCM2B-Cx2T1HvL.js → diagram-22UHCM2B-xFVkNfwh.js} +1 -1
  23. package/dist/public/assets/{diagram-3UASUU5V-Cp04LOka.js → diagram-3UASUU5V-Da6uaoOZ.js} +1 -1
  24. package/dist/public/assets/{diagram-ATOU4E4O-DlqFSshY.js → diagram-ATOU4E4O-DM4iqavl.js} +1 -1
  25. package/dist/public/assets/{diagram-CDSNMT55-goq40ctA.js → diagram-CDSNMT55-CJAkkKxm.js} +1 -1
  26. package/dist/public/assets/{diagram-MLGK6HIB-Bdzjsy4r.js → diagram-MLGK6HIB-B07SCraz.js} +1 -1
  27. package/dist/public/assets/{diagram-MPIPVDR6-DtU7cM6P.js → diagram-MPIPVDR6-ChAMGrRu.js} +1 -1
  28. package/dist/public/assets/{ebnfDiagram-ZINNZB2B-XyVCfmED.js → ebnfDiagram-ZINNZB2B-Cj0Z4mET.js} +1 -1
  29. package/dist/public/assets/{elk-276RUBZZ-aHVIw-2x.js → elk-276RUBZZ-Ch-sSDZ3.js} +1 -1
  30. package/dist/public/assets/{erDiagram-OPXOYQCR-Bq_PhTIL.js → erDiagram-OPXOYQCR-5HduoZIk.js} +1 -1
  31. package/dist/public/assets/{flowDiagram-KWPJA3E3-WuqnDSiF.js → flowDiagram-KWPJA3E3-C1LUBOj_.js} +1 -1
  32. package/dist/public/assets/{ganttDiagram-FUAMR5RP-DZ4lXzkC.js → ganttDiagram-FUAMR5RP-CDb2fKwP.js} +1 -1
  33. package/dist/public/assets/{gitGraphDiagram-X574FWY7-t6l07b9g.js → gitGraphDiagram-X574FWY7-BYHRnVjj.js} +1 -1
  34. package/dist/public/assets/index-CTBVN_U1.css +32 -0
  35. package/dist/public/assets/index-tG8o31dK.js +203 -0
  36. package/dist/public/assets/{infoDiagram-VRGFBTTK-iUGqoOFp.js → infoDiagram-VRGFBTTK-BueKY1FL.js} +1 -1
  37. package/dist/public/assets/{ishikawaDiagram-OU5B5YK6-B0TmoUOK.js → ishikawaDiagram-OU5B5YK6-C1XwVDjo.js} +1 -1
  38. package/dist/public/assets/{journeyDiagram-ZHPQQLJL-CQE61MCu.js → journeyDiagram-ZHPQQLJL-DGpms5YK.js} +1 -1
  39. package/dist/public/assets/{kanban-definition-PNTS6WVX-D2MWCUyS.js → kanban-definition-PNTS6WVX-DWqIkIsF.js} +1 -1
  40. package/dist/public/assets/{linear-WKGxVNP1.js → linear-Ce7ei3Xt.js} +1 -1
  41. package/dist/public/assets/{mermaid.core-DPEwUsaj.js → mermaid.core-DyJzg3sN.js} +4 -4
  42. package/dist/public/assets/{mindmap-definition-NLK3R4M7-DsYEsBsI.js → mindmap-definition-NLK3R4M7-BiPf1mJA.js} +1 -1
  43. package/dist/public/assets/{pegDiagram-GJSIUBJH-BS52Fbxt.js → pegDiagram-GJSIUBJH-CspDGv2d.js} +1 -1
  44. package/dist/public/assets/{pieDiagram-5QR66LMP-D4o8g7nW.js → pieDiagram-5QR66LMP-BqUizf3h.js} +1 -1
  45. package/dist/public/assets/{quadrantDiagram-O4NWA36T-DnYUxWll.js → quadrantDiagram-O4NWA36T-DTBlxCEp.js} +1 -1
  46. package/dist/public/assets/{railroadDiagram-XR7U4H2S-BKy_7ULV.js → railroadDiagram-XR7U4H2S-CAbQa0jL.js} +1 -1
  47. package/dist/public/assets/{requirementDiagram-PLB6GJNP-Ce5F4u8K.js → requirementDiagram-PLB6GJNP-DZUIwY2L.js} +1 -1
  48. package/dist/public/assets/{sankeyDiagram-IPEJSGJF-CCJDrut_.js → sankeyDiagram-IPEJSGJF-BzfGSVpr.js} +1 -1
  49. package/dist/public/assets/{sequenceDiagram-PO4LG4MO-D5E8ISM1.js → sequenceDiagram-PO4LG4MO-Di6wW381.js} +1 -1
  50. package/dist/public/assets/{sizeCapture-INFHLROL-BW3KmxDN.js → sizeCapture-INFHLROL-C50w6FGA.js} +1 -1
  51. package/dist/public/assets/{stateDiagram-v2-GCMORJYK-Bw2ZzQOE.js → stateDiagram-v2-GCMORJYK-DqlnxHyC.js} +1 -1
  52. package/dist/public/assets/{swimlanes-2SLR337P-CLJ-6Ex_.js → swimlanes-2SLR337P-QkAITra0.js} +1 -1
  53. package/dist/public/assets/swimlanesDiagram-TC7HE7FX-K04ikjTT.js +8 -0
  54. package/dist/public/assets/{timeline-definition-EJHVYXUP-C_lFJ-4W.js → timeline-definition-EJHVYXUP-N9nJvUJp.js} +1 -1
  55. package/dist/public/assets/{usecaseDiagram-POWQR4AR-DWXawL2A.js → usecaseDiagram-POWQR4AR-CdeiY667.js} +1 -1
  56. package/dist/public/assets/{vennDiagram-UO4OBE2U-D4O5oZal.js → vennDiagram-UO4OBE2U-Bra5eMZz.js} +1 -1
  57. package/dist/public/assets/{wardleyDiagram-VNRHLVJA-B6HElk__.js → wardleyDiagram-VNRHLVJA-DQXOmiUx.js} +1 -1
  58. package/dist/public/assets/{xychartDiagram-PMCCYNJV-C5OAXnJy.js → xychartDiagram-PMCCYNJV-1o5Z4rpR.js} +1 -1
  59. package/dist/public/index.html +2 -2
  60. package/dist/src/agent-runtime/conversation.js +27 -49
  61. package/dist/src/agents/claudeConversation.js +31 -16
  62. package/dist/src/agents/claudePaneInput.js +13 -4
  63. package/dist/src/agents/codebuddyConversation.js +29 -18
  64. package/dist/src/agents/codebuddyPaneInput.js +10 -5
  65. package/dist/src/routes/sessions.js +32 -2
  66. package/dist/src/tmux/commands.js +3 -0
  67. package/package.json +4 -4
  68. package/dist/public/assets/channel-CzALSnb0.js +0 -1
  69. package/dist/public/assets/index-DiYff8oR.css +0 -32
  70. package/dist/public/assets/index-YZNK723o.js +0 -203
  71. package/dist/public/assets/swimlanesDiagram-TC7HE7FX-BD8rQfV7.js +0 -8
@@ -1,4 +1,4 @@
1
- import{p as xt}from"./chunk-JWPE2WC7-B8eAVfuB.js";import{b9 as gt,a1 as $t,a5 as bt,bc as wt,a2 as Ct,ba as vt,c as s,aH as O,b8 as Dt,F as kt,u as Tt,t as U,a3 as Q,S as At,ac as ot}from"./mermaid.core-DPEwUsaj.js";import{p as Bt}from"./cynefin-OW5HDTMX-Du659bmz.js";import"./index-YZNK723o.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),E=rt(),St=s(()=>E.domains,"getDomains"),Mt=s(()=>E.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));E.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(E.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{Tt(),E=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function _(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(_,"seededRandom");function st(t){let e=0;for(let n=0;n<t.length;n++){const a=t.charCodeAt(n);e=(e<<5)-e+a,e|=0}return e}s(st,"hashString");function it(t,e){return typeof t=="number"&&Number.isFinite(t)&&t!==0?t:st(e)}s(it,"resolveSeed");function ct(t,e,n,a){const c=t/2,m=a??t*.015,v=7,W=e/v,d=[];for(let o=0;o<=v;o++){const p=_(n+o*17)*m*2-m;d.push({x:c+p,y:o*W})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.y+i.y)/2,b=o%2===0?1:-1,h=m*1.5*b*_(n+o*31+7),F=p.x+h,R=f,H=i.x-h;D+=` C${F},${R} ${H},${f} ${i.x},${i.y}`}return D}s(ct,"generateFoldPath");function lt(t,e,n,a){const c=e/2,m=a??e*.015,v=7,W=t/v,d=[];for(let o=0;o<=v;o++){const p=_(n+o*23)*m*2-m;d.push({x:o*W,y:c+p})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.x+i.x)/2,b=o%2===0?1:-1,h=m*1.5*b*_(n+o*37+11),F=f,R=p.y+h,H=f,z=i.y-h;D+=` C${F},${R} ${H},${z} ${i.x},${i.y}`}return D}s(lt,"generateHorizontalBoundary");function dt(t,e){const n=t/2,a=e*.5,c=e,m=t*.03;return[`M${n},${a}`,`C${n+m},${a+(c-a)*.2}`,`${n-m*1.5},${a+(c-a)*.55}`,`${n+m*.5},${a+(c-a)*.75}`,`C${n-m},${a+(c-a)*.85}`,`${n+m*.3},${a+(c-a)*.95}`,`${n},${c}`].join(" ")}s(dt,"generateCliffPath");function ft(t,e,n,a){return[`M${t-n},${e}`,`A${n},${a} 0 1,1 ${t+n},${e}`,`A${n},${a} 0 1,1 ${t-n},${e}`,"Z"].join(" ")}s(ft,"generateConfusionPath");var at={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Ft=s((t,e)=>{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Rt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Ht=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Rt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,F=o.boundaryAmplitude,R=i+b*2,H=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,H,R,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${R} ${H}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),V=Ft(i,f),Z=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=V[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,F)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,F)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=V[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=V[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=V[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,I=u.cx-C/2;M.attr("transform",`translate(${I}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=V[y.from],N=V[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),I=C*.15,G=-x/C,ht=$/C,et=M+G*I,nt=P+ht*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Vt={draw:Ht},_t=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Et=s(()=>{const t=_t();return`
1
+ import{p as xt}from"./chunk-JWPE2WC7-CaXu9QwT.js";import{b9 as gt,a1 as $t,a5 as bt,bc as wt,a2 as Ct,ba as vt,c as s,aH as O,b8 as Dt,F as kt,u as Tt,t as U,a3 as Q,S as At,ac as ot}from"./mermaid.core-DyJzg3sN.js";import{p as Bt}from"./cynefin-OW5HDTMX-DkrT2FtY.js";import"./index-tG8o31dK.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),E=rt(),St=s(()=>E.domains,"getDomains"),Mt=s(()=>E.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));E.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(E.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{Tt(),E=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},It=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),Wt={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),It(e)},"parse")};function _(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(_,"seededRandom");function st(t){let e=0;for(let n=0;n<t.length;n++){const a=t.charCodeAt(n);e=(e<<5)-e+a,e|=0}return e}s(st,"hashString");function it(t,e){return typeof t=="number"&&Number.isFinite(t)&&t!==0?t:st(e)}s(it,"resolveSeed");function ct(t,e,n,a){const c=t/2,m=a??t*.015,v=7,W=e/v,d=[];for(let o=0;o<=v;o++){const p=_(n+o*17)*m*2-m;d.push({x:c+p,y:o*W})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.y+i.y)/2,b=o%2===0?1:-1,h=m*1.5*b*_(n+o*31+7),F=p.x+h,R=f,H=i.x-h;D+=` C${F},${R} ${H},${f} ${i.x},${i.y}`}return D}s(ct,"generateFoldPath");function lt(t,e,n,a){const c=e/2,m=a??e*.015,v=7,W=t/v,d=[];for(let o=0;o<=v;o++){const p=_(n+o*23)*m*2-m;d.push({x:o*W,y:c+p})}let D=`M${d[0].x},${d[0].y}`;for(let o=0;o<d.length-1;o++){const p=d[o],i=d[o+1],f=(p.x+i.x)/2,b=o%2===0?1:-1,h=m*1.5*b*_(n+o*37+11),F=f,R=p.y+h,H=f,z=i.y-h;D+=` C${F},${R} ${H},${z} ${i.x},${i.y}`}return D}s(lt,"generateHorizontalBoundary");function dt(t,e){const n=t/2,a=e*.5,c=e,m=t*.03;return[`M${n},${a}`,`C${n+m},${a+(c-a)*.2}`,`${n-m*1.5},${a+(c-a)*.55}`,`${n+m*.5},${a+(c-a)*.75}`,`C${n-m},${a+(c-a)*.85}`,`${n+m*.3},${a+(c-a)*.95}`,`${n},${c}`].join(" ")}s(dt,"generateCliffPath");function ft(t,e,n,a){return[`M${t-n},${e}`,`A${n},${a} 0 1,1 ${t+n},${e}`,`A${n},${a} 0 1,1 ${t-n},${e}`,"Z"].join(" ")}s(ft,"generateConfusionPath");var at={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Ft=s((t,e)=>{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Rt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,Ht=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),W=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Rt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,F=o.boundaryAmplitude,R=i+b*2,H=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,H,R,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${R} ${H}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),V=Ft(i,f),Z=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=V[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,F)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,F)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=V[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=V[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=V[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,I=u.cx-C/2;M.attr("transform",`translate(${I}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const I=$.getBBox();I.width>0&&(P=I.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=V[y.from],N=V[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),I=C*.15,G=-x/C,ht=$/C,et=M+G*I,nt=P+ht*I;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}W&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(W)},"draw"),Vt={draw:Ht},_t=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Et=s(()=>{const t=_t();return`
2
2
  .cynefinDomain {
3
3
  stroke: none;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{s as ae,a as sn,b as dn,d as un,f as ge,c as k,i as fn}from"./chunk-3FUC2YCW-ryphp4s0.js";import{c as y,a4 as cn,aH as m,bv as ln,bd as hn,aa as pn,am as we,aY as be,ak as vn,al as gn,aX as wn}from"./mermaid.core-DPEwUsaj.js";import{G as N}from"./graph-jWsD5Ro-.js";import{a6 as bn,a3 as mn,W as yn,r as En,C as Ln,P as xn,Z as Nn,M as A,O as kn,L as me,V as Ie,R as On,n as De,a as Pn,y as Te,o as Xe,t as ie,Y as K,K as oe,g as W,p as Sn,v as Cn,I as Rn,u as _n,m as Mn,a9 as In,E as l,A as Dn,_ as x,D as X,aa as C,a4 as Y}from"./_baseUniq-DNOfPYVY.js";import{m as _,o as Tn,c as Xn,b as Be,i as Bn,s as se,h as jn,f as An,g as Fn,q as Gn,j as Yn,d as Vn,e as qn,r as Q,v as H,a as Wn,u as E,p as je,l as de,t as F,k as Hn}from"./_basePickBy-BzC0P9Wg.js";import"./index-YZNK723o.js";function $n(e){return bn(mn(e,void 0,_),e+"")}var zn="[object Object]",Jn=Function.prototype,Un=Object.prototype,Ae=Jn.toString,Zn=Un.hasOwnProperty,Kn=Ae.call(Object);function Qn(e){if(!yn(e)||En(e)!=zn)return!1;var n=Tn(e);if(n===null)return!0;var r=Zn.call(n,"constructor")&&n.constructor;return typeof r=="function"&&r instanceof r&&Ae.call(r)==Kn}var er=1,nr=4;function rr(e){return Xn(e,er|nr)}function ee(e,n,r){(r!==void 0&&!Ln(e[n],r)||r===void 0&&!(n in e))&&Be(e,n,r)}function ne(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}function tr(e){return Bn(e,se(e))}function ar(e,n,r,t,a,i,o){var s=ne(e,r),d=ne(n,r),u=o.get(d);if(u){ee(e,r,u);return}var f=i?i(s,d,r+"",e,n,o):void 0,c=f===void 0;if(c){var h=A(d),w=!h&&xn(d),p=!h&&!w&&Nn(d);f=d,h||w||p?A(s)?f=s:kn(s)?f=jn(s):w?(c=!1,f=An(d,!0)):p?(c=!1,f=Fn(d,!0)):f=[]:Qn(d)||me(d)?(f=s,me(s)?f=tr(s):(!Ie(s)||On(s))&&(f=Gn(d))):c=!1}c&&(o.set(d,f),a(f,d,t,i,o),o.delete(d)),ee(e,r,f)}function Fe(e,n,r,t,a){e!==n&&De(n,function(i,o){if(a||(a=new Pn),Ie(i))ar(e,n,o,r,Fe,t,a);else{var s=t?t(ne(e,o),i,o+"",e,n,a):void 0;s===void 0&&(s=i),ee(e,o,s)}},se)}function ir(e,n){return e==null?e:De(e,Te(n),se)}function or(e,n){return e&&Xe(e,Te(n))}function sr(e,n){return e>n}function Ge(e,n){return e<n}function V(e,n){var r={};return n=ie(n),Xe(e,function(t,a,i){Be(r,a,n(t,a,i))}),r}function ue(e,n,r){for(var t=-1,a=e.length;++t<a;){var i=e[t],o=n(i);if(o!=null&&(s===void 0?o===o&&!K(o):r(o,s)))var s=o,d=i}return d}function P(e){return e&&e.length?ue(e,oe,sr):void 0}var re=Yn(function(e,n,r){Fe(e,n,r)});function D(e){return e&&e.length?ue(e,oe,Ge):void 0}function fe(e,n){return e&&e.length?ue(e,ie(n),Ge):void 0}function dr(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function ur(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,i=K(e),o=n!==void 0,s=n===null,d=n===n,u=K(n);if(!s&&!u&&!i&&e>n||i&&o&&d&&!s&&!u||t&&o&&d||!r&&d||!a)return 1;if(!t&&!i&&!u&&e<n||u&&r&&a&&!t&&!i||s&&r&&a||!o&&a||!d)return-1}return 0}function fr(e,n,r){for(var t=-1,a=e.criteria,i=n.criteria,o=a.length,s=r.length;++t<o;){var d=ur(a[t],i[t]);if(d){if(t>=s)return d;var u=r[t];return d*(u=="desc"?-1:1)}}return e.index-n.index}function cr(e,n,r){n.length?n=W(n,function(i){return A(i)?function(o){return Sn(o,i.length===1?i[0]:i)}:i}):n=[oe];var t=-1;n=W(n,Cn(ie));var a=Vn(e,function(i,o,s){var d=W(n,function(u){return u(i)});return{criteria:d,index:++t,value:i}});return dr(a,function(i,o){return fr(i,o,r)})}function lr(e,n){return qn(e,n,function(r,t){return Rn(e,t)})}var G=$n(function(e,n){return e==null?{}:lr(e,n)}),hr=Math.ceil,pr=Math.max;function vr(e,n,r,t){for(var a=-1,i=pr(hr((n-e)/(r||1)),0),o=Array(i);i--;)o[++a]=e,e+=r;return o}function gr(e){return function(n,r,t){return t&&typeof t!="number"&&Q(n,r,t)&&(r=t=void 0),n=H(n),r===void 0?(r=n,n=0):r=H(r),t=t===void 0?n<r?1:-1:H(t),vr(n,r,t)}}var R=gr(),B=_n(function(e,n){if(e==null)return[];var r=n.length;return r>1&&Q(e,n[0],n[1])?n=[]:r>2&&Q(n[0],n[1],n[2])&&(n=[n[0]]),cr(e,Mn(n),[])}),wr=0;function ce(e){var n=++wr;return In(e)+n}function br(e,n,r){for(var t=-1,a=e.length,i=n.length,o={};++t<a;){var s=t<i?n[t]:void 0;r(o,e[t],s)}return o}function mr(e,n){return br(e||[],n||[],Wn)}class yr{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return ye(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&ye(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,Er)),t=t._prev;return"["+n.join(", ")+"]"}}function ye(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Er(e,n){if(e!=="_next"&&e!=="_prev")return n}var Lr=Dn(1);function xr(e,n){if(e.nodeCount()<=1)return[];var r=kr(e,n||Lr),t=Nr(r.graph,r.buckets,r.zeroIdx);return _(E(t,function(a){return e.outEdges(a.v,a.w)}))}function Nr(e,n,r){for(var t=[],a=n[n.length-1],i=n[0],o;e.nodeCount();){for(;o=i.dequeue();)$(e,n,r,o);for(;o=a.dequeue();)$(e,n,r,o);if(e.nodeCount()){for(var s=n.length-2;s>0;--s)if(o=n[s].dequeue(),o){t=t.concat($(e,n,r,o,!0));break}}}return t}function $(e,n,r,t,a){var i=a?[]:void 0;return l(e.inEdges(t.v),function(o){var s=e.edge(o),d=e.node(o.v);a&&i.push({v:o.v,w:o.w}),d.out-=s,te(n,r,d)}),l(e.outEdges(t.v),function(o){var s=e.edge(o),d=o.w,u=e.node(d);u.in-=s,te(n,r,u)}),e.removeNode(t.v),i}function kr(e,n){var r=new N,t=0,a=0;l(e.nodes(),function(s){r.setNode(s,{v:s,in:0,out:0})}),l(e.edges(),function(s){var d=r.edge(s.v,s.w)||0,u=n(s),f=d+u;r.setEdge(s.v,s.w,f),a=Math.max(a,r.node(s.v).out+=u),t=Math.max(t,r.node(s.w).in+=u)});var i=R(a+t+3).map(function(){return new yr}),o=t+1;return l(r.nodes(),function(s){te(i,o,r.node(s))}),{graph:r,buckets:i,zeroIdx:o}}function te(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Or(e){var n=e.graph().acyclicer==="greedy"?xr(e,r(e)):Pr(e);l(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,ce("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function Pr(e){var n=[],r={},t={};function a(i){Object.prototype.hasOwnProperty.call(t,i)||(t[i]=!0,r[i]=!0,l(e.outEdges(i),function(o){Object.prototype.hasOwnProperty.call(r,o.w)?n.push(o):a(o.w)}),delete r[i])}return l(e.nodes(),a),n}function Sr(e){l(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function M(e,n,r,t){var a;do a=ce(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function Cr(e){var n=new N().setGraph(e.graph());return l(e.nodes(),function(r){n.setNode(r,e.node(r))}),l(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function Ye(e){var n=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),l(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Ee(e,n){var r=e.x,t=e.y,a=n.x-r,i=n.y-t,o=e.width/2,s=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var d,u;return Math.abs(i)*o>Math.abs(a)*s?(i<0&&(s=-s),d=s*a/i,u=s):(a<0&&(o=-o),d=o,u=o*i/a),{x:r+d,y:t+u}}function q(e){var n=E(R(Ve(e)+1),function(){return[]});return l(e.nodes(),function(r){var t=e.node(r),a=t.rank;x(a)||(n[a][t.order]=r)}),n}function Rr(e){var n=D(E(e.nodes(),function(r){return e.node(r).rank}));l(e.nodes(),function(r){var t=e.node(r);je(t,"rank")&&(t.rank-=n)})}function _r(e){var n=D(E(e.nodes(),function(i){return e.node(i).rank})),r=[];l(e.nodes(),function(i){var o=e.node(i).rank-n;r[o]||(r[o]=[]),r[o].push(i)});var t=0,a=e.graph().nodeRankFactor;l(r,function(i,o){x(i)&&o%a!==0?--t:t&&l(i,function(s){e.node(s).rank+=t})})}function Le(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),M(e,"border",a,n)}function Ve(e){return P(E(e.nodes(),function(n){var r=e.node(n).rank;if(!x(r))return r}))}function Mr(e,n){var r={lhs:[],rhs:[]};return l(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Ir(e,n){return n()}function Dr(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&l(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,o=a.maxRank+1;i<o;++i)xe(e,"borderLeft","_bl",r,a,i),xe(e,"borderRight","_br",r,a,i)}}l(e.children(),n)}function xe(e,n,r,t,a,i){var o={width:0,height:0,rank:i,borderType:n},s=a[n][i-1],d=M(e,"border",o,r);a[n][i]=d,e.setParent(d,t),s&&e.setEdge(s,d,{weight:1})}function Tr(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&qe(e)}function Xr(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&Br(e),(n==="lr"||n==="rl")&&(jr(e),qe(e))}function qe(e){l(e.nodes(),function(n){Ne(e.node(n))}),l(e.edges(),function(n){Ne(e.edge(n))})}function Ne(e){var n=e.width;e.width=e.height,e.height=n}function Br(e){l(e.nodes(),function(n){z(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,z),Object.prototype.hasOwnProperty.call(r,"y")&&z(r)})}function z(e){e.y=-e.y}function jr(e){l(e.nodes(),function(n){J(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,J),Object.prototype.hasOwnProperty.call(r,"x")&&J(r)})}function J(e){var n=e.x;e.x=e.y,e.y=n}function Ar(e){e.graph().dummyChains=[],l(e.edges(),function(n){Fr(e,n)})}function Fr(e,n){var r=n.v,t=e.node(r).rank,a=n.w,i=e.node(a).rank,o=n.name,s=e.edge(n),d=s.labelRank;if(i!==t+1){e.removeEdge(n);var u=void 0,f,c;for(c=0,++t;t<i;++c,++t)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:n,rank:t},f=M(e,"edge",u,"_d"),t===d&&(u.width=s.width,u.height=s.height,u.dummy="edge-label",u.labelpos=s.labelpos),e.setEdge(r,f,{weight:s.weight},o),c===0&&e.graph().dummyChains.push(f),r=f;e.setEdge(r,a,{weight:s.weight},o)}}function Gr(e){l(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function le(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var i=D(E(e.outEdges(t),function(o){return r(o.w)-e.edge(o).minlen}));return(i===Number.POSITIVE_INFINITY||i===void 0||i===null)&&(i=0),a.rank=i}l(e.sources(),r)}function T(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function We(e){var n=new N({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,i;Yr(n,e)<t;)a=Vr(n,e),i=n.hasNode(a.v)?T(e,a):-T(e,a),qr(n,e,i);return n}function Yr(e,n){function r(t){l(n.nodeEdges(t),function(a){var i=a.v,o=t===i?a.w:i;!e.hasNode(o)&&!T(n,a)&&(e.setNode(o,{}),e.setEdge(t,o,{}),r(o))})}return l(e.nodes(),r),e.nodeCount()}function Vr(e,n){return fe(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return T(n,r)})}function qr(e,n,r){l(e.nodes(),function(t){n.node(t).rank+=r})}function Wr(){}Wr.prototype=new Error;function He(e,n,r){A(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],i={};return l(n,function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);$e(e,o,r==="post",i,t,a)}),a}function $e(e,n,r,t,a,i){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||i.push(n),l(a(n),function(o){$e(e,o,r,t,a,i)}),r&&i.push(n))}function Hr(e,n){return He(e,n,"post")}function $r(e,n){return He(e,n,"pre")}S.initLowLimValues=pe;S.initCutValues=he;S.calcCutValue=ze;S.leaveEdge=Ue;S.enterEdge=Ze;S.exchangeEdges=Ke;function S(e){e=Cr(e),le(e);var n=We(e);pe(n),he(n,e);for(var r,t;r=Ue(n);)t=Ze(n,e,r),Ke(n,e,r,t)}function he(e,n){var r=Hr(e,e.nodes());r=r.slice(0,r.length-1),l(r,function(t){zr(e,n,t)})}function zr(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=ze(e,n,r)}function ze(e,n,r){var t=e.node(r),a=t.parent,i=!0,o=n.edge(r,a),s=0;return o||(i=!1,o=n.edge(a,r)),s=o.weight,l(n.nodeEdges(r),function(d){var u=d.v===r,f=u?d.w:d.v;if(f!==a){var c=u===i,h=n.edge(d).weight;if(s+=c?h:-h,Ur(e,r,f)){var w=e.edge(r,f).cutvalue;s+=c?-w:w}}}),s}function pe(e,n){arguments.length<2&&(n=e.nodes()[0]),Je(e,{},1,n)}function Je(e,n,r,t,a){var i=r,o=e.node(t);return n[t]=!0,l(e.neighbors(t),function(s){Object.prototype.hasOwnProperty.call(n,s)||(r=Je(e,n,r,s,t))}),o.low=i,o.lim=r++,a?o.parent=a:delete o.parent,r}function Ue(e){return de(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Ze(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var i=e.node(t),o=e.node(a),s=i,d=!1;i.lim>o.lim&&(s=o,d=!0);var u=X(n.edges(),function(f){return d===ke(e,e.node(f.v),s)&&d!==ke(e,e.node(f.w),s)});return fe(u,function(f){return T(n,f)})}function Ke(e,n,r,t){var a=r.v,i=r.w;e.removeEdge(a,i),e.setEdge(t.v,t.w,{}),pe(e),he(e,n),Jr(e,n)}function Jr(e,n){var r=de(e.nodes(),function(a){return!n.node(a).parent}),t=$r(e,r);t=t.slice(1),l(t,function(a){var i=e.node(a).parent,o=n.edge(a,i),s=!1;o||(o=n.edge(i,a),s=!0),n.node(a).rank=n.node(i).rank+(s?o.minlen:-o.minlen)})}function Ur(e,n,r){return e.hasEdge(n,r)}function ke(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Zr(e){switch(e.graph().ranker){case"network-simplex":Oe(e);break;case"tight-tree":Qr(e);break;case"longest-path":Kr(e);break;default:Oe(e)}}var Kr=le;function Qr(e){le(e),We(e)}function Oe(e){S(e)}function et(e){var n=M(e,"root",{},"_root"),r=nt(e),t=P(C(r))-1,a=2*t+1;e.graph().nestingRoot=n,l(e.edges(),function(o){e.edge(o).minlen*=a});var i=rt(e)+1;l(e.children(),function(o){Qe(e,n,a,i,t,r,o)}),e.graph().nodeRankFactor=a}function Qe(e,n,r,t,a,i,o){var s=e.children(o);if(!s.length){o!==n&&e.setEdge(n,o,{weight:0,minlen:r});return}var d=Le(e,"_bt"),u=Le(e,"_bb"),f=e.node(o);e.setParent(d,o),f.borderTop=d,e.setParent(u,o),f.borderBottom=u,l(s,function(c){Qe(e,n,r,t,a,i,c);var h=e.node(c),w=h.borderTop?h.borderTop:c,p=h.borderBottom?h.borderBottom:c,g=h.borderTop?t:2*t,v=w!==p?1:a-i[o]+1;e.setEdge(d,w,{weight:g,minlen:v,nestingEdge:!0}),e.setEdge(p,u,{weight:g,minlen:v,nestingEdge:!0})}),e.parent(o)||e.setEdge(n,d,{weight:0,minlen:a+i[o]})}function nt(e){var n={};function r(t,a){var i=e.children(t);i&&i.length&&l(i,function(o){r(o,a+1)}),n[t]=a}return l(e.children(),function(t){r(t,1)}),n}function rt(e){return Y(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function tt(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,l(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function at(e,n,r){var t={},a;l(r,function(i){for(var o=e.parent(i),s,d;o;){if(s=e.parent(o),s?(d=t[s],t[s]=o):(d=a,a=o),d&&d!==o){n.setEdge(d,o);return}o=s}})}function it(e,n,r){var t=ot(e),a=new N({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(i){return e.node(i)});return l(e.nodes(),function(i){var o=e.node(i),s=e.parent(i);(o.rank===n||o.minRank<=n&&n<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||t),l(e[r](i),function(d){var u=d.v===i?d.w:d.v,f=a.edge(u,i),c=x(f)?0:f.weight;a.setEdge(u,i,{weight:e.edge(d).weight+c})}),Object.prototype.hasOwnProperty.call(o,"minRank")&&a.setNode(i,{borderLeft:o.borderLeft[n],borderRight:o.borderRight[n]}))}),a}function ot(e){for(var n;e.hasNode(n=ce("_root")););return n}function st(e,n){for(var r=0,t=1;t<n.length;++t)r+=dt(e,n[t-1],n[t]);return r}function dt(e,n,r){for(var t=mr(r,E(r,function(u,f){return f})),a=_(E(n,function(u){return B(E(e.outEdges(u),function(f){return{pos:t[f.w],weight:e.edge(f).weight}}),"pos")})),i=1;i<r.length;)i<<=1;var o=2*i-1;i-=1;var s=E(new Array(o),function(){return 0}),d=0;return l(a.forEach(function(u){var f=u.pos+i;s[f]+=u.weight;for(var c=0;f>0;)f%2&&(c+=s[f+1]),f=f-1>>1,s[f]+=u.weight;d+=u.weight*c})),d}function ut(e){var n={},r=X(e.nodes(),function(s){return!e.children(s).length}),t=P(E(r,function(s){return e.node(s).rank})),a=E(R(t+1),function(){return[]});function i(s){if(!je(n,s)){n[s]=!0;var d=e.node(s);a[d.rank].push(s),l(e.successors(s),i)}}var o=B(r,function(s){return e.node(s).rank});return l(o,i),a}function ft(e,n){return E(n,function(r){var t=e.inEdges(r);if(t.length){var a=Y(t,function(i,o){var s=e.edge(o),d=e.node(o.v);return{sum:i.sum+s.weight*d.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function ct(e,n){var r={};l(e,function(a,i){var o=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};x(a.barycenter)||(o.barycenter=a.barycenter,o.weight=a.weight)}),l(n.edges(),function(a){var i=r[a.v],o=r[a.w];!x(i)&&!x(o)&&(o.indegree++,i.out.push(r[a.w]))});var t=X(r,function(a){return!a.indegree});return lt(t)}function lt(e){var n=[];function r(i){return function(o){o.merged||(x(o.barycenter)||x(i.barycenter)||o.barycenter>=i.barycenter)&&ht(i,o)}}function t(i){return function(o){o.in.push(i),--o.indegree===0&&e.push(o)}}for(;e.length;){var a=e.pop();n.push(a),l(a.in.reverse(),r(a)),l(a.out,t(a))}return E(X(n,function(i){return!i.merged}),function(i){return G(i,["vs","i","barycenter","weight"])})}function ht(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function pt(e,n){var r=Mr(e,function(f){return Object.prototype.hasOwnProperty.call(f,"barycenter")}),t=r.lhs,a=B(r.rhs,function(f){return-f.i}),i=[],o=0,s=0,d=0;t.sort(vt(!!n)),d=Pe(i,a,d),l(t,function(f){d+=f.vs.length,i.push(f.vs),o+=f.barycenter*f.weight,s+=f.weight,d=Pe(i,a,d)});var u={vs:_(i)};return s&&(u.barycenter=o/s,u.weight=s),u}function Pe(e,n,r){for(var t;n.length&&(t=F(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function vt(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function en(e,n,r,t){var a=e.children(n),i=e.node(n),o=i?i.borderLeft:void 0,s=i?i.borderRight:void 0,d={};o&&(a=X(a,function(p){return p!==o&&p!==s}));var u=ft(e,a);l(u,function(p){if(e.children(p.v).length){var g=en(e,p.v,r,t);d[p.v]=g,Object.prototype.hasOwnProperty.call(g,"barycenter")&&wt(p,g)}});var f=ct(u,r);gt(f,d);var c=pt(f,t);if(o&&(c.vs=_([o,c.vs,s]),e.predecessors(o).length)){var h=e.node(e.predecessors(o)[0]),w=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+h.order+w.order)/(c.weight+2),c.weight+=2}return c}function gt(e,n){l(e,function(r){r.vs=_(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function wt(e,n){x(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function bt(e){var n=Ve(e),r=Se(e,R(1,n+1),"inEdges"),t=Se(e,R(n-1,-1,-1),"outEdges"),a=ut(e);Ce(e,a);for(var i=Number.POSITIVE_INFINITY,o,s=0,d=0;d<4;++s,++d){mt(s%2?r:t,s%4>=2),a=q(e);var u=st(e,a);u<i&&(d=0,o=rr(a),i=u)}Ce(e,o)}function Se(e,n,r){return E(n,function(t){return it(e,t,r)})}function mt(e,n){var r=new N;l(e,function(t){var a=t.graph().root,i=en(t,a,r,n);l(i.vs,function(o,s){t.node(o).order=s}),at(t,r,i.vs)})}function Ce(e,n){l(n,function(r){l(r,function(t,a){e.node(t).order=a})})}function yt(e){var n=Lt(e);l(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,i=Et(e,n,a.v,a.w),o=i.path,s=i.lca,d=0,u=o[d],f=!0;r!==a.w;){if(t=e.node(r),f){for(;(u=o[d])!==s&&e.node(u).maxRank<t.rank;)d++;u===s&&(f=!1)}if(!f){for(;d<o.length-1&&e.node(u=o[d+1]).minRank<=t.rank;)d++;u=o[d]}e.setParent(r,u),r=e.successors(r)[0]}})}function Et(e,n,r,t){var a=[],i=[],o=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim),d,u;d=r;do d=e.parent(d),a.push(d);while(d&&(n[d].low>o||s>n[d].lim));for(u=d,d=t;(d=e.parent(d))!==u;)i.push(d);return{path:a.concat(i.reverse()),lca:u}}function Lt(e){var n={},r=0;function t(a){var i=r;l(e.children(a),t),n[a]={low:i,lim:r++}}return l(e.children(),t),n}function xt(e,n){var r={};function t(a,i){var o=0,s=0,d=a.length,u=F(i);return l(i,function(f,c){var h=kt(e,f),w=h?e.node(h).order:d;(h||f===u)&&(l(i.slice(s,c+1),function(p){l(e.predecessors(p),function(g){var v=e.node(g),b=v.order;(b<o||w<b)&&!(v.dummy&&e.node(p).dummy)&&nn(r,g,p)})}),s=c+1,o=w)}),i}return Y(n,t),r}function Nt(e,n){var r={};function t(i,o,s,d,u){var f;l(R(o,s),function(c){f=i[c],e.node(f).dummy&&l(e.predecessors(f),function(h){var w=e.node(h);w.dummy&&(w.order<d||w.order>u)&&nn(r,h,f)})})}function a(i,o){var s=-1,d,u=0;return l(o,function(f,c){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(d=e.node(h[0]).order,t(o,u,c,s,d),u=c,s=d)}t(o,u,o.length,d,i.length)}),o}return Y(n,a),r}function kt(e,n){if(e.node(n).dummy)return de(e.predecessors(n),function(r){return e.node(r).dummy})}function nn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ot(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function Pt(e,n,r,t){var a={},i={},o={};return l(n,function(s){l(s,function(d,u){a[d]=d,i[d]=d,o[d]=u})}),l(n,function(s){var d=-1;l(s,function(u){var f=t(u);if(f.length){f=B(f,function(g){return o[g]});for(var c=(f.length-1)/2,h=Math.floor(c),w=Math.ceil(c);h<=w;++h){var p=f[h];i[u]===u&&d<o[p]&&!Ot(r,u,p)&&(i[p]=u,i[u]=a[u]=a[p],d=o[p])}}})}),{root:a,align:i}}function St(e,n,r,t,a){var i={},o=Ct(e,n,r,a),s=a?"borderLeft":"borderRight";function d(c,h){for(var w=o.nodes(),p=w.pop(),g={};p;)g[p]?c(p):(g[p]=!0,w.push(p),w=w.concat(h(p))),p=w.pop()}function u(c){i[c]=o.inEdges(c).reduce(function(h,w){return Math.max(h,i[w.v]+o.edge(w))},0)}function f(c){var h=o.outEdges(c).reduce(function(p,g){return Math.min(p,i[g.w]-o.edge(g))},Number.POSITIVE_INFINITY),w=e.node(c);h!==Number.POSITIVE_INFINITY&&w.borderType!==s&&(i[c]=Math.max(i[c],h))}return d(u,o.predecessors.bind(o)),d(f,o.successors.bind(o)),l(t,function(c){i[c]=i[r[c]]}),i}function Ct(e,n,r,t){var a=new N,i=e.graph(),o=Dt(i.nodesep,i.edgesep,t);return l(n,function(s){var d;l(s,function(u){var f=r[u];if(a.setNode(f),d){var c=r[d],h=a.edge(c,f);a.setEdge(c,f,Math.max(o(e,u,d),h||0))}d=u})}),a}function Rt(e,n){return fe(C(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return ir(r,function(i,o){var s=Tt(e,o)/2;t=Math.max(i+s,t),a=Math.min(i-s,a)}),t-a})}function _t(e,n){var r=C(n),t=D(r),a=P(r);l(["u","d"],function(i){l(["l","r"],function(o){var s=i+o,d=e[s],u;if(d!==n){var f=C(d);u=o==="l"?t-D(f):a-P(f),u&&(e[s]=V(d,function(c){return c+u}))}})})}function Mt(e,n){return V(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=B(E(e,t));return(a[1]+a[2])/2})}function It(e){var n=q(e),r=re(xt(e,n),Nt(e,n)),t={},a;l(["u","d"],function(o){a=o==="u"?n:C(n).reverse(),l(["l","r"],function(s){s==="r"&&(a=E(a,function(c){return C(c).reverse()}));var d=(o==="u"?e.predecessors:e.successors).bind(e),u=Pt(e,a,r,d),f=St(e,a,u.root,u.align,s==="r");s==="r"&&(f=V(f,function(c){return-c})),t[o+s]=f})});var i=Rt(e,t);return _t(t,i),Mt(t,e.graph().align)}function Dt(e,n,r){return function(t,a,i){var o=t.node(a),s=t.node(i),d=0,u;if(d+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=-o.width/2;break;case"r":u=o.width/2;break}if(u&&(d+=r?u:-u),u=0,d+=(o.dummy?n:e)/2,d+=(s.dummy?n:e)/2,d+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(d+=r?u:-u),u=0,d}}function Tt(e,n){return e.node(n).width}function Xt(e){e=Ye(e),Bt(e),or(It(e),function(n,r){e.node(r).x=n})}function Bt(e){var n=q(e),r=e.graph().ranksep,t=0;l(n,function(a){var i=P(E(a,function(o){return e.node(o).height}));l(a,function(o){e.node(o).y=t+i/2}),t+=i+r})}function jt(e,n){var r=Ir;r("layout",()=>{var t=r(" buildLayoutGraph",()=>Jt(e));r(" runLayout",()=>At(t,r)),r(" updateInputGraph",()=>Ft(e,t))})}function At(e,n){n(" makeSpaceForEdgeLabels",()=>Ut(e)),n(" removeSelfEdges",()=>ia(e)),n(" acyclic",()=>Or(e)),n(" nestingGraph.run",()=>et(e)),n(" rank",()=>Zr(Ye(e))),n(" injectEdgeLabelProxies",()=>Zt(e)),n(" removeEmptyRanks",()=>_r(e)),n(" nestingGraph.cleanup",()=>tt(e)),n(" normalizeRanks",()=>Rr(e)),n(" assignRankMinMax",()=>Kt(e)),n(" removeEdgeLabelProxies",()=>Qt(e)),n(" normalize.run",()=>Ar(e)),n(" parentDummyChains",()=>yt(e)),n(" addBorderSegments",()=>Dr(e)),n(" order",()=>bt(e)),n(" insertSelfEdges",()=>oa(e)),n(" adjustCoordinateSystem",()=>Tr(e)),n(" position",()=>Xt(e)),n(" positionSelfEdges",()=>sa(e)),n(" removeBorderNodes",()=>aa(e)),n(" normalize.undo",()=>Gr(e)),n(" fixupEdgeLabelCoords",()=>ra(e)),n(" undoCoordinateSystem",()=>Xr(e)),n(" translateGraph",()=>ea(e)),n(" assignNodeIntersects",()=>na(e)),n(" reversePoints",()=>ta(e)),n(" acyclic.undo",()=>Sr(e))}function Ft(e,n){l(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),l(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Gt=["nodesep","edgesep","ranksep","marginx","marginy"],Yt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Vt=["acyclicer","ranker","rankdir","align"],qt=["width","height"],Wt={width:0,height:0},Ht=["minlen","weight","width","height","labeloffset"],$t={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},zt=["labelpos"];function Jt(e){var n=new N({multigraph:!0,compound:!0}),r=Z(e.graph());return n.setGraph(re({},Yt,U(r,Gt),G(r,Vt))),l(e.nodes(),function(t){var a=Z(e.node(t));n.setNode(t,Hn(U(a,qt),Wt)),n.setParent(t,e.parent(t))}),l(e.edges(),function(t){var a=Z(e.edge(t));n.setEdge(t,re({},$t,U(a,Ht),G(a,zt)))}),n}function Ut(e){var n=e.graph();n.ranksep/=2,l(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function Zt(e){l(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),i={rank:(a.rank-t.rank)/2+t.rank,e:n};M(e,"edge-proxy",i,"_ep")}})}function Kt(e){var n=0;l(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=P(n,t.maxRank))}),e.graph().maxRank=n}function Qt(e){l(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function ea(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,i=e.graph(),o=i.marginx||0,s=i.marginy||0;function d(u){var f=u.x,c=u.y,h=u.width,w=u.height;n=Math.min(n,f-h/2),r=Math.max(r,f+h/2),t=Math.min(t,c-w/2),a=Math.max(a,c+w/2)}l(e.nodes(),function(u){d(e.node(u))}),l(e.edges(),function(u){var f=e.edge(u);Object.prototype.hasOwnProperty.call(f,"x")&&d(f)}),n-=o,t-=s,l(e.nodes(),function(u){var f=e.node(u);f.x-=n,f.y-=t}),l(e.edges(),function(u){var f=e.edge(u);l(f.points,function(c){c.x-=n,c.y-=t}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=n),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=t)}),i.width=r-n+o,i.height=a-t+s}function na(e){l(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),i,o;r.points?(i=r.points[0],o=r.points[r.points.length-1]):(r.points=[],i=a,o=t),r.points.unshift(Ee(t,i)),r.points.push(Ee(a,o))})}function ra(e){l(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function ta(e){l(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function aa(e){l(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),i=e.node(F(r.borderLeft)),o=e.node(F(r.borderRight));r.width=Math.abs(o.x-i.x),r.height=Math.abs(a.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}}),l(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function ia(e){l(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function oa(e){var n=q(e);l(n,function(r){var t=0;l(r,function(a,i){var o=e.node(a);o.order=i+t,l(o.selfEdges,function(s){M(e,"selfedge",{width:s.label.width,height:s.label.height,rank:o.rank,order:i+ ++t,e:s.e,label:s.label},"_se")}),delete o.selfEdges})})}function sa(e){l(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,i=t.y,o=r.x-a,s=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*o/3,y:i-s},{x:a+5*o/6,y:i-s},{x:a+o,y:i},{x:a+5*o/6,y:i+s},{x:a+2*o/3,y:i+s}],r.label.x=r.x,r.label.y=r.y}})}function U(e,n){return V(G(e,n),Number)}function Z(e){var n={};return l(e,function(r,t){n[t.toLowerCase()]=r}),n}var Re=y((e,n,r)=>Math.max(n,Math.min(r,e)),"clamp"),_e=y((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),da=y(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram"||e==="er"||e==="classDiagram","shouldMergeSelfLoopSegments"),ua=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],fa=y((e,n,r,t,a)=>{const i=[],o=new Set;if(r.forEach(({start:f,end:c})=>{f!==t&&o.add(f),c!==t&&o.add(c)}),o.forEach(f=>{const c=e.node(f);typeof(c==null?void 0:c.x)=="number"&&typeof(c==null?void 0:c.y)=="number"&&i.push(c)}),i.length===0&&r.forEach(({edge:f})=>{(f.points??[]).forEach(c=>{typeof(c==null?void 0:c.x)=="number"&&typeof(c==null?void 0:c.y)=="number"&&i.push(c)})}),i.length===0)return _e(a);const s=i.reduce((f,c)=>({x:f.x+c.x/i.length,y:f.y+c.y/i.length}),{x:0,y:0}),d=s.x-n.x,u=s.y-n.y;return Math.abs(d)>Math.abs(u)?d>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":_e(a)},"getSelfLoopSide"),ca=y((e,n="top",r=0,t=0)=>{const a=e.x,i=e.y-r,o=e.width/2,s=e.height/2,d=Math.max(36,Math.min(100,e.width*.8)),u=Re(Math.max(t,e.width*.35),36,d),f=Re(Math.min(e.width,e.height)*.45,24,48);switch(n){case"bottom":{const c=i+s;return[{x:a-u/2,y:c},{x:a-u/2,y:c+f},{x:a+u/2,y:c+f},{x:a+u/2,y:c}]}case"right":{const c=a+o;return[{x:c,y:i-u/2},{x:c+f,y:i-u/2},{x:c+f,y:i+u/2},{x:c,y:i+u/2}]}case"left":{const c=a-o;return[{x:c,y:i-u/2},{x:c-f,y:i-u/2},{x:c-f,y:i+u/2},{x:c,y:i+u/2}]}case"top":default:{const c=i-s;return[{x:a-u/2,y:c},{x:a-u/2,y:c-f},{x:a+u/2,y:c-f},{x:a+u/2,y:c}]}}},"getSelfLoopPoints"),la=y((e,n,r="top",t=0,a={})=>{const o=e.x,s=e.y-t,d=a.width??0,u=a.height??0;switch(r){case"bottom":return{x:o,y:Math.max(...n.map(f=>f.y))+u/2+4};case"right":return{x:Math.max(...n.map(f=>f.x))+d/2+4,y:s};case"left":return{x:Math.min(...n.map(f=>f.x))-d/2-4,y:s};case"top":default:return{x:o,y:Math.min(...n.map(f=>f.y))-u/2-4}}},"getSelfLoopLabelPosition"),rn=y((e,n=0,{mergeSelfLoops:r=!0}={})=>{var o;const t=new Map,a=[],i=(o=e.graph())==null?void 0:o.rankdir;return e.edges().forEach(s=>{const d=e.edge(s);if(r&&d.selfLoop){const u=d.selfLoop.id;t.has(u)||t.set(u,[]),t.get(u).push({edge:d,start:s.v,end:s.w})}else a.push({edge:d,start:s.v,end:s.w})}),t.forEach(s=>{if(s.length!==3){s.forEach(L=>a.push(L));return}s.sort((L,O)=>L.edge.selfLoop.order-O.edge.selfLoop.order);const[d,u,f]=s,c=d.edge.originalEdge??u.edge.originalEdge??f.edge.originalEdge??u.edge,h=e.node(c.start);if(!h){s.forEach(L=>a.push(L));return}const w={width:u.edge.width,height:u.edge.height},p=fa(e,h,s,c.start,i),g=ca(h,p,n,w.width??0),v=la(h,g,p,n,w),b={...u.edge,...c,id:c.id,points:g,start:c.start,end:c.end,x:v.x,y:v.y,width:w.width,height:w.height,labelStyle:u.edge.labelStyle,fromCluster:d.edge.fromCluster??u.edge.fromCluster??f.edge.fromCluster,toCluster:d.edge.toCluster??u.edge.toCluster??f.edge.toCluster};delete b.selfLoop,delete b.originalEdge,a.push({edge:b,start:b.start,end:b.end})}),a},"getEdgesToRender"),tn=y(async({element:e,graph:n,diagramType:r,id:t,parentCluster:a,siteConfig:i})=>{const o=n.graph().rankdir;m.trace("Dir in recursive render - dir:",o);const{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c}=un(e,{edgePathsClass:"edgePaths"});n.nodes()?m.info("Recursive render XXX",n.nodes()):m.info("No nodes found for",n),n.edges().length>0&&m.info("Recursive edges",n.edge(n.edges()[0]));const h=da(r);await Promise.all(n.nodes().map(async function(g){const v=n.node(g);if(a!==void 0){const b=JSON.parse(JSON.stringify(a.clusterData));m.trace(`Setting data for parent cluster XXX
1
+ import{s as ae,a as sn,b as dn,d as un,f as ge,c as k,i as fn}from"./chunk-3FUC2YCW-Mms2CMs9.js";import{c as y,a4 as cn,aH as m,bv as ln,bd as hn,aa as pn,am as we,aY as be,ak as vn,al as gn,aX as wn}from"./mermaid.core-DyJzg3sN.js";import{G as N}from"./graph-jWsD5Ro-.js";import{a6 as bn,a3 as mn,W as yn,r as En,C as Ln,P as xn,Z as Nn,M as A,O as kn,L as me,V as Ie,R as On,n as De,a as Pn,y as Te,o as Xe,t as ie,Y as K,K as oe,g as W,p as Sn,v as Cn,I as Rn,u as _n,m as Mn,a9 as In,E as l,A as Dn,_ as x,D as X,aa as C,a4 as Y}from"./_baseUniq-DNOfPYVY.js";import{m as _,o as Tn,c as Xn,b as Be,i as Bn,s as se,h as jn,f as An,g as Fn,q as Gn,j as Yn,d as Vn,e as qn,r as Q,v as H,a as Wn,u as E,p as je,l as de,t as F,k as Hn}from"./_basePickBy-BzC0P9Wg.js";import"./index-tG8o31dK.js";function $n(e){return bn(mn(e,void 0,_),e+"")}var zn="[object Object]",Jn=Function.prototype,Un=Object.prototype,Ae=Jn.toString,Zn=Un.hasOwnProperty,Kn=Ae.call(Object);function Qn(e){if(!yn(e)||En(e)!=zn)return!1;var n=Tn(e);if(n===null)return!0;var r=Zn.call(n,"constructor")&&n.constructor;return typeof r=="function"&&r instanceof r&&Ae.call(r)==Kn}var er=1,nr=4;function rr(e){return Xn(e,er|nr)}function ee(e,n,r){(r!==void 0&&!Ln(e[n],r)||r===void 0&&!(n in e))&&Be(e,n,r)}function ne(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}function tr(e){return Bn(e,se(e))}function ar(e,n,r,t,a,i,o){var s=ne(e,r),d=ne(n,r),u=o.get(d);if(u){ee(e,r,u);return}var f=i?i(s,d,r+"",e,n,o):void 0,c=f===void 0;if(c){var h=A(d),w=!h&&xn(d),p=!h&&!w&&Nn(d);f=d,h||w||p?A(s)?f=s:kn(s)?f=jn(s):w?(c=!1,f=An(d,!0)):p?(c=!1,f=Fn(d,!0)):f=[]:Qn(d)||me(d)?(f=s,me(s)?f=tr(s):(!Ie(s)||On(s))&&(f=Gn(d))):c=!1}c&&(o.set(d,f),a(f,d,t,i,o),o.delete(d)),ee(e,r,f)}function Fe(e,n,r,t,a){e!==n&&De(n,function(i,o){if(a||(a=new Pn),Ie(i))ar(e,n,o,r,Fe,t,a);else{var s=t?t(ne(e,o),i,o+"",e,n,a):void 0;s===void 0&&(s=i),ee(e,o,s)}},se)}function ir(e,n){return e==null?e:De(e,Te(n),se)}function or(e,n){return e&&Xe(e,Te(n))}function sr(e,n){return e>n}function Ge(e,n){return e<n}function V(e,n){var r={};return n=ie(n),Xe(e,function(t,a,i){Be(r,a,n(t,a,i))}),r}function ue(e,n,r){for(var t=-1,a=e.length;++t<a;){var i=e[t],o=n(i);if(o!=null&&(s===void 0?o===o&&!K(o):r(o,s)))var s=o,d=i}return d}function P(e){return e&&e.length?ue(e,oe,sr):void 0}var re=Yn(function(e,n,r){Fe(e,n,r)});function D(e){return e&&e.length?ue(e,oe,Ge):void 0}function fe(e,n){return e&&e.length?ue(e,ie(n),Ge):void 0}function dr(e,n){var r=e.length;for(e.sort(n);r--;)e[r]=e[r].value;return e}function ur(e,n){if(e!==n){var r=e!==void 0,t=e===null,a=e===e,i=K(e),o=n!==void 0,s=n===null,d=n===n,u=K(n);if(!s&&!u&&!i&&e>n||i&&o&&d&&!s&&!u||t&&o&&d||!r&&d||!a)return 1;if(!t&&!i&&!u&&e<n||u&&r&&a&&!t&&!i||s&&r&&a||!o&&a||!d)return-1}return 0}function fr(e,n,r){for(var t=-1,a=e.criteria,i=n.criteria,o=a.length,s=r.length;++t<o;){var d=ur(a[t],i[t]);if(d){if(t>=s)return d;var u=r[t];return d*(u=="desc"?-1:1)}}return e.index-n.index}function cr(e,n,r){n.length?n=W(n,function(i){return A(i)?function(o){return Sn(o,i.length===1?i[0]:i)}:i}):n=[oe];var t=-1;n=W(n,Cn(ie));var a=Vn(e,function(i,o,s){var d=W(n,function(u){return u(i)});return{criteria:d,index:++t,value:i}});return dr(a,function(i,o){return fr(i,o,r)})}function lr(e,n){return qn(e,n,function(r,t){return Rn(e,t)})}var G=$n(function(e,n){return e==null?{}:lr(e,n)}),hr=Math.ceil,pr=Math.max;function vr(e,n,r,t){for(var a=-1,i=pr(hr((n-e)/(r||1)),0),o=Array(i);i--;)o[++a]=e,e+=r;return o}function gr(e){return function(n,r,t){return t&&typeof t!="number"&&Q(n,r,t)&&(r=t=void 0),n=H(n),r===void 0?(r=n,n=0):r=H(r),t=t===void 0?n<r?1:-1:H(t),vr(n,r,t)}}var R=gr(),B=_n(function(e,n){if(e==null)return[];var r=n.length;return r>1&&Q(e,n[0],n[1])?n=[]:r>2&&Q(n[0],n[1],n[2])&&(n=[n[0]]),cr(e,Mn(n),[])}),wr=0;function ce(e){var n=++wr;return In(e)+n}function br(e,n,r){for(var t=-1,a=e.length,i=n.length,o={};++t<a;){var s=t<i?n[t]:void 0;r(o,e[t],s)}return o}function mr(e,n){return br(e||[],n||[],Wn)}class yr{constructor(){var n={};n._next=n._prev=n,this._sentinel=n}dequeue(){var n=this._sentinel,r=n._prev;if(r!==n)return ye(r),r}enqueue(n){var r=this._sentinel;n._prev&&n._next&&ye(n),n._next=r._next,r._next._prev=n,r._next=n,n._prev=r}toString(){for(var n=[],r=this._sentinel,t=r._prev;t!==r;)n.push(JSON.stringify(t,Er)),t=t._prev;return"["+n.join(", ")+"]"}}function ye(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Er(e,n){if(e!=="_next"&&e!=="_prev")return n}var Lr=Dn(1);function xr(e,n){if(e.nodeCount()<=1)return[];var r=kr(e,n||Lr),t=Nr(r.graph,r.buckets,r.zeroIdx);return _(E(t,function(a){return e.outEdges(a.v,a.w)}))}function Nr(e,n,r){for(var t=[],a=n[n.length-1],i=n[0],o;e.nodeCount();){for(;o=i.dequeue();)$(e,n,r,o);for(;o=a.dequeue();)$(e,n,r,o);if(e.nodeCount()){for(var s=n.length-2;s>0;--s)if(o=n[s].dequeue(),o){t=t.concat($(e,n,r,o,!0));break}}}return t}function $(e,n,r,t,a){var i=a?[]:void 0;return l(e.inEdges(t.v),function(o){var s=e.edge(o),d=e.node(o.v);a&&i.push({v:o.v,w:o.w}),d.out-=s,te(n,r,d)}),l(e.outEdges(t.v),function(o){var s=e.edge(o),d=o.w,u=e.node(d);u.in-=s,te(n,r,u)}),e.removeNode(t.v),i}function kr(e,n){var r=new N,t=0,a=0;l(e.nodes(),function(s){r.setNode(s,{v:s,in:0,out:0})}),l(e.edges(),function(s){var d=r.edge(s.v,s.w)||0,u=n(s),f=d+u;r.setEdge(s.v,s.w,f),a=Math.max(a,r.node(s.v).out+=u),t=Math.max(t,r.node(s.w).in+=u)});var i=R(a+t+3).map(function(){return new yr}),o=t+1;return l(r.nodes(),function(s){te(i,o,r.node(s))}),{graph:r,buckets:i,zeroIdx:o}}function te(e,n,r){r.out?r.in?e[r.out-r.in+n].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}function Or(e){var n=e.graph().acyclicer==="greedy"?xr(e,r(e)):Pr(e);l(n,function(t){var a=e.edge(t);e.removeEdge(t),a.forwardName=t.name,a.reversed=!0,e.setEdge(t.w,t.v,a,ce("rev"))});function r(t){return function(a){return t.edge(a).weight}}}function Pr(e){var n=[],r={},t={};function a(i){Object.prototype.hasOwnProperty.call(t,i)||(t[i]=!0,r[i]=!0,l(e.outEdges(i),function(o){Object.prototype.hasOwnProperty.call(r,o.w)?n.push(o):a(o.w)}),delete r[i])}return l(e.nodes(),a),n}function Sr(e){l(e.edges(),function(n){var r=e.edge(n);if(r.reversed){e.removeEdge(n);var t=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(n.w,n.v,r,t)}})}function M(e,n,r,t){var a;do a=ce(t);while(e.hasNode(a));return r.dummy=n,e.setNode(a,r),a}function Cr(e){var n=new N().setGraph(e.graph());return l(e.nodes(),function(r){n.setNode(r,e.node(r))}),l(e.edges(),function(r){var t=n.edge(r.v,r.w)||{weight:0,minlen:1},a=e.edge(r);n.setEdge(r.v,r.w,{weight:t.weight+a.weight,minlen:Math.max(t.minlen,a.minlen)})}),n}function Ye(e){var n=new N({multigraph:e.isMultigraph()}).setGraph(e.graph());return l(e.nodes(),function(r){e.children(r).length||n.setNode(r,e.node(r))}),l(e.edges(),function(r){n.setEdge(r,e.edge(r))}),n}function Ee(e,n){var r=e.x,t=e.y,a=n.x-r,i=n.y-t,o=e.width/2,s=e.height/2;if(!a&&!i)throw new Error("Not possible to find intersection inside of the rectangle");var d,u;return Math.abs(i)*o>Math.abs(a)*s?(i<0&&(s=-s),d=s*a/i,u=s):(a<0&&(o=-o),d=o,u=o*i/a),{x:r+d,y:t+u}}function q(e){var n=E(R(Ve(e)+1),function(){return[]});return l(e.nodes(),function(r){var t=e.node(r),a=t.rank;x(a)||(n[a][t.order]=r)}),n}function Rr(e){var n=D(E(e.nodes(),function(r){return e.node(r).rank}));l(e.nodes(),function(r){var t=e.node(r);je(t,"rank")&&(t.rank-=n)})}function _r(e){var n=D(E(e.nodes(),function(i){return e.node(i).rank})),r=[];l(e.nodes(),function(i){var o=e.node(i).rank-n;r[o]||(r[o]=[]),r[o].push(i)});var t=0,a=e.graph().nodeRankFactor;l(r,function(i,o){x(i)&&o%a!==0?--t:t&&l(i,function(s){e.node(s).rank+=t})})}function Le(e,n,r,t){var a={width:0,height:0};return arguments.length>=4&&(a.rank=r,a.order=t),M(e,"border",a,n)}function Ve(e){return P(E(e.nodes(),function(n){var r=e.node(n).rank;if(!x(r))return r}))}function Mr(e,n){var r={lhs:[],rhs:[]};return l(e,function(t){n(t)?r.lhs.push(t):r.rhs.push(t)}),r}function Ir(e,n){return n()}function Dr(e){function n(r){var t=e.children(r),a=e.node(r);if(t.length&&l(t,n),Object.prototype.hasOwnProperty.call(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var i=a.minRank,o=a.maxRank+1;i<o;++i)xe(e,"borderLeft","_bl",r,a,i),xe(e,"borderRight","_br",r,a,i)}}l(e.children(),n)}function xe(e,n,r,t,a,i){var o={width:0,height:0,rank:i,borderType:n},s=a[n][i-1],d=M(e,"border",o,r);a[n][i]=d,e.setParent(d,t),s&&e.setEdge(s,d,{weight:1})}function Tr(e){var n=e.graph().rankdir.toLowerCase();(n==="lr"||n==="rl")&&qe(e)}function Xr(e){var n=e.graph().rankdir.toLowerCase();(n==="bt"||n==="rl")&&Br(e),(n==="lr"||n==="rl")&&(jr(e),qe(e))}function qe(e){l(e.nodes(),function(n){Ne(e.node(n))}),l(e.edges(),function(n){Ne(e.edge(n))})}function Ne(e){var n=e.width;e.width=e.height,e.height=n}function Br(e){l(e.nodes(),function(n){z(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,z),Object.prototype.hasOwnProperty.call(r,"y")&&z(r)})}function z(e){e.y=-e.y}function jr(e){l(e.nodes(),function(n){J(e.node(n))}),l(e.edges(),function(n){var r=e.edge(n);l(r.points,J),Object.prototype.hasOwnProperty.call(r,"x")&&J(r)})}function J(e){var n=e.x;e.x=e.y,e.y=n}function Ar(e){e.graph().dummyChains=[],l(e.edges(),function(n){Fr(e,n)})}function Fr(e,n){var r=n.v,t=e.node(r).rank,a=n.w,i=e.node(a).rank,o=n.name,s=e.edge(n),d=s.labelRank;if(i!==t+1){e.removeEdge(n);var u=void 0,f,c;for(c=0,++t;t<i;++c,++t)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:n,rank:t},f=M(e,"edge",u,"_d"),t===d&&(u.width=s.width,u.height=s.height,u.dummy="edge-label",u.labelpos=s.labelpos),e.setEdge(r,f,{weight:s.weight},o),c===0&&e.graph().dummyChains.push(f),r=f;e.setEdge(r,a,{weight:s.weight},o)}}function Gr(e){l(e.graph().dummyChains,function(n){var r=e.node(n),t=r.edgeLabel,a;for(e.setEdge(r.edgeObj,t);r.dummy;)a=e.successors(n)[0],e.removeNode(n),t.points.push({x:r.x,y:r.y}),r.dummy==="edge-label"&&(t.x=r.x,t.y=r.y,t.width=r.width,t.height=r.height),n=a,r=e.node(n)})}function le(e){var n={};function r(t){var a=e.node(t);if(Object.prototype.hasOwnProperty.call(n,t))return a.rank;n[t]=!0;var i=D(E(e.outEdges(t),function(o){return r(o.w)-e.edge(o).minlen}));return(i===Number.POSITIVE_INFINITY||i===void 0||i===null)&&(i=0),a.rank=i}l(e.sources(),r)}function T(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen}function We(e){var n=new N({directed:!1}),r=e.nodes()[0],t=e.nodeCount();n.setNode(r,{});for(var a,i;Yr(n,e)<t;)a=Vr(n,e),i=n.hasNode(a.v)?T(e,a):-T(e,a),qr(n,e,i);return n}function Yr(e,n){function r(t){l(n.nodeEdges(t),function(a){var i=a.v,o=t===i?a.w:i;!e.hasNode(o)&&!T(n,a)&&(e.setNode(o,{}),e.setEdge(t,o,{}),r(o))})}return l(e.nodes(),r),e.nodeCount()}function Vr(e,n){return fe(n.edges(),function(r){if(e.hasNode(r.v)!==e.hasNode(r.w))return T(n,r)})}function qr(e,n,r){l(e.nodes(),function(t){n.node(t).rank+=r})}function Wr(){}Wr.prototype=new Error;function He(e,n,r){A(n)||(n=[n]);var t=(e.isDirected()?e.successors:e.neighbors).bind(e),a=[],i={};return l(n,function(o){if(!e.hasNode(o))throw new Error("Graph does not have node: "+o);$e(e,o,r==="post",i,t,a)}),a}function $e(e,n,r,t,a,i){Object.prototype.hasOwnProperty.call(t,n)||(t[n]=!0,r||i.push(n),l(a(n),function(o){$e(e,o,r,t,a,i)}),r&&i.push(n))}function Hr(e,n){return He(e,n,"post")}function $r(e,n){return He(e,n,"pre")}S.initLowLimValues=pe;S.initCutValues=he;S.calcCutValue=ze;S.leaveEdge=Ue;S.enterEdge=Ze;S.exchangeEdges=Ke;function S(e){e=Cr(e),le(e);var n=We(e);pe(n),he(n,e);for(var r,t;r=Ue(n);)t=Ze(n,e,r),Ke(n,e,r,t)}function he(e,n){var r=Hr(e,e.nodes());r=r.slice(0,r.length-1),l(r,function(t){zr(e,n,t)})}function zr(e,n,r){var t=e.node(r),a=t.parent;e.edge(r,a).cutvalue=ze(e,n,r)}function ze(e,n,r){var t=e.node(r),a=t.parent,i=!0,o=n.edge(r,a),s=0;return o||(i=!1,o=n.edge(a,r)),s=o.weight,l(n.nodeEdges(r),function(d){var u=d.v===r,f=u?d.w:d.v;if(f!==a){var c=u===i,h=n.edge(d).weight;if(s+=c?h:-h,Ur(e,r,f)){var w=e.edge(r,f).cutvalue;s+=c?-w:w}}}),s}function pe(e,n){arguments.length<2&&(n=e.nodes()[0]),Je(e,{},1,n)}function Je(e,n,r,t,a){var i=r,o=e.node(t);return n[t]=!0,l(e.neighbors(t),function(s){Object.prototype.hasOwnProperty.call(n,s)||(r=Je(e,n,r,s,t))}),o.low=i,o.lim=r++,a?o.parent=a:delete o.parent,r}function Ue(e){return de(e.edges(),function(n){return e.edge(n).cutvalue<0})}function Ze(e,n,r){var t=r.v,a=r.w;n.hasEdge(t,a)||(t=r.w,a=r.v);var i=e.node(t),o=e.node(a),s=i,d=!1;i.lim>o.lim&&(s=o,d=!0);var u=X(n.edges(),function(f){return d===ke(e,e.node(f.v),s)&&d!==ke(e,e.node(f.w),s)});return fe(u,function(f){return T(n,f)})}function Ke(e,n,r,t){var a=r.v,i=r.w;e.removeEdge(a,i),e.setEdge(t.v,t.w,{}),pe(e),he(e,n),Jr(e,n)}function Jr(e,n){var r=de(e.nodes(),function(a){return!n.node(a).parent}),t=$r(e,r);t=t.slice(1),l(t,function(a){var i=e.node(a).parent,o=n.edge(a,i),s=!1;o||(o=n.edge(i,a),s=!0),n.node(a).rank=n.node(i).rank+(s?o.minlen:-o.minlen)})}function Ur(e,n,r){return e.hasEdge(n,r)}function ke(e,n,r){return r.low<=n.lim&&n.lim<=r.lim}function Zr(e){switch(e.graph().ranker){case"network-simplex":Oe(e);break;case"tight-tree":Qr(e);break;case"longest-path":Kr(e);break;default:Oe(e)}}var Kr=le;function Qr(e){le(e),We(e)}function Oe(e){S(e)}function et(e){var n=M(e,"root",{},"_root"),r=nt(e),t=P(C(r))-1,a=2*t+1;e.graph().nestingRoot=n,l(e.edges(),function(o){e.edge(o).minlen*=a});var i=rt(e)+1;l(e.children(),function(o){Qe(e,n,a,i,t,r,o)}),e.graph().nodeRankFactor=a}function Qe(e,n,r,t,a,i,o){var s=e.children(o);if(!s.length){o!==n&&e.setEdge(n,o,{weight:0,minlen:r});return}var d=Le(e,"_bt"),u=Le(e,"_bb"),f=e.node(o);e.setParent(d,o),f.borderTop=d,e.setParent(u,o),f.borderBottom=u,l(s,function(c){Qe(e,n,r,t,a,i,c);var h=e.node(c),w=h.borderTop?h.borderTop:c,p=h.borderBottom?h.borderBottom:c,g=h.borderTop?t:2*t,v=w!==p?1:a-i[o]+1;e.setEdge(d,w,{weight:g,minlen:v,nestingEdge:!0}),e.setEdge(p,u,{weight:g,minlen:v,nestingEdge:!0})}),e.parent(o)||e.setEdge(n,d,{weight:0,minlen:a+i[o]})}function nt(e){var n={};function r(t,a){var i=e.children(t);i&&i.length&&l(i,function(o){r(o,a+1)}),n[t]=a}return l(e.children(),function(t){r(t,1)}),n}function rt(e){return Y(e.edges(),function(n,r){return n+e.edge(r).weight},0)}function tt(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,l(e.edges(),function(r){var t=e.edge(r);t.nestingEdge&&e.removeEdge(r)})}function at(e,n,r){var t={},a;l(r,function(i){for(var o=e.parent(i),s,d;o;){if(s=e.parent(o),s?(d=t[s],t[s]=o):(d=a,a=o),d&&d!==o){n.setEdge(d,o);return}o=s}})}function it(e,n,r){var t=ot(e),a=new N({compound:!0}).setGraph({root:t}).setDefaultNodeLabel(function(i){return e.node(i)});return l(e.nodes(),function(i){var o=e.node(i),s=e.parent(i);(o.rank===n||o.minRank<=n&&n<=o.maxRank)&&(a.setNode(i),a.setParent(i,s||t),l(e[r](i),function(d){var u=d.v===i?d.w:d.v,f=a.edge(u,i),c=x(f)?0:f.weight;a.setEdge(u,i,{weight:e.edge(d).weight+c})}),Object.prototype.hasOwnProperty.call(o,"minRank")&&a.setNode(i,{borderLeft:o.borderLeft[n],borderRight:o.borderRight[n]}))}),a}function ot(e){for(var n;e.hasNode(n=ce("_root")););return n}function st(e,n){for(var r=0,t=1;t<n.length;++t)r+=dt(e,n[t-1],n[t]);return r}function dt(e,n,r){for(var t=mr(r,E(r,function(u,f){return f})),a=_(E(n,function(u){return B(E(e.outEdges(u),function(f){return{pos:t[f.w],weight:e.edge(f).weight}}),"pos")})),i=1;i<r.length;)i<<=1;var o=2*i-1;i-=1;var s=E(new Array(o),function(){return 0}),d=0;return l(a.forEach(function(u){var f=u.pos+i;s[f]+=u.weight;for(var c=0;f>0;)f%2&&(c+=s[f+1]),f=f-1>>1,s[f]+=u.weight;d+=u.weight*c})),d}function ut(e){var n={},r=X(e.nodes(),function(s){return!e.children(s).length}),t=P(E(r,function(s){return e.node(s).rank})),a=E(R(t+1),function(){return[]});function i(s){if(!je(n,s)){n[s]=!0;var d=e.node(s);a[d.rank].push(s),l(e.successors(s),i)}}var o=B(r,function(s){return e.node(s).rank});return l(o,i),a}function ft(e,n){return E(n,function(r){var t=e.inEdges(r);if(t.length){var a=Y(t,function(i,o){var s=e.edge(o),d=e.node(o.v);return{sum:i.sum+s.weight*d.order,weight:i.weight+s.weight}},{sum:0,weight:0});return{v:r,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:r}})}function ct(e,n){var r={};l(e,function(a,i){var o=r[a.v]={indegree:0,in:[],out:[],vs:[a.v],i};x(a.barycenter)||(o.barycenter=a.barycenter,o.weight=a.weight)}),l(n.edges(),function(a){var i=r[a.v],o=r[a.w];!x(i)&&!x(o)&&(o.indegree++,i.out.push(r[a.w]))});var t=X(r,function(a){return!a.indegree});return lt(t)}function lt(e){var n=[];function r(i){return function(o){o.merged||(x(o.barycenter)||x(i.barycenter)||o.barycenter>=i.barycenter)&&ht(i,o)}}function t(i){return function(o){o.in.push(i),--o.indegree===0&&e.push(o)}}for(;e.length;){var a=e.pop();n.push(a),l(a.in.reverse(),r(a)),l(a.out,t(a))}return E(X(n,function(i){return!i.merged}),function(i){return G(i,["vs","i","barycenter","weight"])})}function ht(e,n){var r=0,t=0;e.weight&&(r+=e.barycenter*e.weight,t+=e.weight),n.weight&&(r+=n.barycenter*n.weight,t+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=r/t,e.weight=t,e.i=Math.min(n.i,e.i),n.merged=!0}function pt(e,n){var r=Mr(e,function(f){return Object.prototype.hasOwnProperty.call(f,"barycenter")}),t=r.lhs,a=B(r.rhs,function(f){return-f.i}),i=[],o=0,s=0,d=0;t.sort(vt(!!n)),d=Pe(i,a,d),l(t,function(f){d+=f.vs.length,i.push(f.vs),o+=f.barycenter*f.weight,s+=f.weight,d=Pe(i,a,d)});var u={vs:_(i)};return s&&(u.barycenter=o/s,u.weight=s),u}function Pe(e,n,r){for(var t;n.length&&(t=F(n)).i<=r;)n.pop(),e.push(t.vs),r++;return r}function vt(e){return function(n,r){return n.barycenter<r.barycenter?-1:n.barycenter>r.barycenter?1:e?r.i-n.i:n.i-r.i}}function en(e,n,r,t){var a=e.children(n),i=e.node(n),o=i?i.borderLeft:void 0,s=i?i.borderRight:void 0,d={};o&&(a=X(a,function(p){return p!==o&&p!==s}));var u=ft(e,a);l(u,function(p){if(e.children(p.v).length){var g=en(e,p.v,r,t);d[p.v]=g,Object.prototype.hasOwnProperty.call(g,"barycenter")&&wt(p,g)}});var f=ct(u,r);gt(f,d);var c=pt(f,t);if(o&&(c.vs=_([o,c.vs,s]),e.predecessors(o).length)){var h=e.node(e.predecessors(o)[0]),w=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(c,"barycenter")||(c.barycenter=0,c.weight=0),c.barycenter=(c.barycenter*c.weight+h.order+w.order)/(c.weight+2),c.weight+=2}return c}function gt(e,n){l(e,function(r){r.vs=_(r.vs.map(function(t){return n[t]?n[t].vs:t}))})}function wt(e,n){x(e.barycenter)?(e.barycenter=n.barycenter,e.weight=n.weight):(e.barycenter=(e.barycenter*e.weight+n.barycenter*n.weight)/(e.weight+n.weight),e.weight+=n.weight)}function bt(e){var n=Ve(e),r=Se(e,R(1,n+1),"inEdges"),t=Se(e,R(n-1,-1,-1),"outEdges"),a=ut(e);Ce(e,a);for(var i=Number.POSITIVE_INFINITY,o,s=0,d=0;d<4;++s,++d){mt(s%2?r:t,s%4>=2),a=q(e);var u=st(e,a);u<i&&(d=0,o=rr(a),i=u)}Ce(e,o)}function Se(e,n,r){return E(n,function(t){return it(e,t,r)})}function mt(e,n){var r=new N;l(e,function(t){var a=t.graph().root,i=en(t,a,r,n);l(i.vs,function(o,s){t.node(o).order=s}),at(t,r,i.vs)})}function Ce(e,n){l(n,function(r){l(r,function(t,a){e.node(t).order=a})})}function yt(e){var n=Lt(e);l(e.graph().dummyChains,function(r){for(var t=e.node(r),a=t.edgeObj,i=Et(e,n,a.v,a.w),o=i.path,s=i.lca,d=0,u=o[d],f=!0;r!==a.w;){if(t=e.node(r),f){for(;(u=o[d])!==s&&e.node(u).maxRank<t.rank;)d++;u===s&&(f=!1)}if(!f){for(;d<o.length-1&&e.node(u=o[d+1]).minRank<=t.rank;)d++;u=o[d]}e.setParent(r,u),r=e.successors(r)[0]}})}function Et(e,n,r,t){var a=[],i=[],o=Math.min(n[r].low,n[t].low),s=Math.max(n[r].lim,n[t].lim),d,u;d=r;do d=e.parent(d),a.push(d);while(d&&(n[d].low>o||s>n[d].lim));for(u=d,d=t;(d=e.parent(d))!==u;)i.push(d);return{path:a.concat(i.reverse()),lca:u}}function Lt(e){var n={},r=0;function t(a){var i=r;l(e.children(a),t),n[a]={low:i,lim:r++}}return l(e.children(),t),n}function xt(e,n){var r={};function t(a,i){var o=0,s=0,d=a.length,u=F(i);return l(i,function(f,c){var h=kt(e,f),w=h?e.node(h).order:d;(h||f===u)&&(l(i.slice(s,c+1),function(p){l(e.predecessors(p),function(g){var v=e.node(g),b=v.order;(b<o||w<b)&&!(v.dummy&&e.node(p).dummy)&&nn(r,g,p)})}),s=c+1,o=w)}),i}return Y(n,t),r}function Nt(e,n){var r={};function t(i,o,s,d,u){var f;l(R(o,s),function(c){f=i[c],e.node(f).dummy&&l(e.predecessors(f),function(h){var w=e.node(h);w.dummy&&(w.order<d||w.order>u)&&nn(r,h,f)})})}function a(i,o){var s=-1,d,u=0;return l(o,function(f,c){if(e.node(f).dummy==="border"){var h=e.predecessors(f);h.length&&(d=e.node(h[0]).order,t(o,u,c,s,d),u=c,s=d)}t(o,u,o.length,d,i.length)}),o}return Y(n,a),r}function kt(e,n){if(e.node(n).dummy)return de(e.predecessors(n),function(r){return e.node(r).dummy})}function nn(e,n,r){if(n>r){var t=n;n=r,r=t}Object.prototype.hasOwnProperty.call(e,n)||Object.defineProperty(e,n,{enumerable:!0,configurable:!0,value:{},writable:!0});var a=e[n];Object.defineProperty(a,r,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ot(e,n,r){if(n>r){var t=n;n=r,r=t}return!!e[n]&&Object.prototype.hasOwnProperty.call(e[n],r)}function Pt(e,n,r,t){var a={},i={},o={};return l(n,function(s){l(s,function(d,u){a[d]=d,i[d]=d,o[d]=u})}),l(n,function(s){var d=-1;l(s,function(u){var f=t(u);if(f.length){f=B(f,function(g){return o[g]});for(var c=(f.length-1)/2,h=Math.floor(c),w=Math.ceil(c);h<=w;++h){var p=f[h];i[u]===u&&d<o[p]&&!Ot(r,u,p)&&(i[p]=u,i[u]=a[u]=a[p],d=o[p])}}})}),{root:a,align:i}}function St(e,n,r,t,a){var i={},o=Ct(e,n,r,a),s=a?"borderLeft":"borderRight";function d(c,h){for(var w=o.nodes(),p=w.pop(),g={};p;)g[p]?c(p):(g[p]=!0,w.push(p),w=w.concat(h(p))),p=w.pop()}function u(c){i[c]=o.inEdges(c).reduce(function(h,w){return Math.max(h,i[w.v]+o.edge(w))},0)}function f(c){var h=o.outEdges(c).reduce(function(p,g){return Math.min(p,i[g.w]-o.edge(g))},Number.POSITIVE_INFINITY),w=e.node(c);h!==Number.POSITIVE_INFINITY&&w.borderType!==s&&(i[c]=Math.max(i[c],h))}return d(u,o.predecessors.bind(o)),d(f,o.successors.bind(o)),l(t,function(c){i[c]=i[r[c]]}),i}function Ct(e,n,r,t){var a=new N,i=e.graph(),o=Dt(i.nodesep,i.edgesep,t);return l(n,function(s){var d;l(s,function(u){var f=r[u];if(a.setNode(f),d){var c=r[d],h=a.edge(c,f);a.setEdge(c,f,Math.max(o(e,u,d),h||0))}d=u})}),a}function Rt(e,n){return fe(C(n),function(r){var t=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return ir(r,function(i,o){var s=Tt(e,o)/2;t=Math.max(i+s,t),a=Math.min(i-s,a)}),t-a})}function _t(e,n){var r=C(n),t=D(r),a=P(r);l(["u","d"],function(i){l(["l","r"],function(o){var s=i+o,d=e[s],u;if(d!==n){var f=C(d);u=o==="l"?t-D(f):a-P(f),u&&(e[s]=V(d,function(c){return c+u}))}})})}function Mt(e,n){return V(e.ul,function(r,t){if(n)return e[n.toLowerCase()][t];var a=B(E(e,t));return(a[1]+a[2])/2})}function It(e){var n=q(e),r=re(xt(e,n),Nt(e,n)),t={},a;l(["u","d"],function(o){a=o==="u"?n:C(n).reverse(),l(["l","r"],function(s){s==="r"&&(a=E(a,function(c){return C(c).reverse()}));var d=(o==="u"?e.predecessors:e.successors).bind(e),u=Pt(e,a,r,d),f=St(e,a,u.root,u.align,s==="r");s==="r"&&(f=V(f,function(c){return-c})),t[o+s]=f})});var i=Rt(e,t);return _t(t,i),Mt(t,e.graph().align)}function Dt(e,n,r){return function(t,a,i){var o=t.node(a),s=t.node(i),d=0,u;if(d+=o.width/2,Object.prototype.hasOwnProperty.call(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":u=-o.width/2;break;case"r":u=o.width/2;break}if(u&&(d+=r?u:-u),u=0,d+=(o.dummy?n:e)/2,d+=(s.dummy?n:e)/2,d+=s.width/2,Object.prototype.hasOwnProperty.call(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=s.width/2;break;case"r":u=-s.width/2;break}return u&&(d+=r?u:-u),u=0,d}}function Tt(e,n){return e.node(n).width}function Xt(e){e=Ye(e),Bt(e),or(It(e),function(n,r){e.node(r).x=n})}function Bt(e){var n=q(e),r=e.graph().ranksep,t=0;l(n,function(a){var i=P(E(a,function(o){return e.node(o).height}));l(a,function(o){e.node(o).y=t+i/2}),t+=i+r})}function jt(e,n){var r=Ir;r("layout",()=>{var t=r(" buildLayoutGraph",()=>Jt(e));r(" runLayout",()=>At(t,r)),r(" updateInputGraph",()=>Ft(e,t))})}function At(e,n){n(" makeSpaceForEdgeLabels",()=>Ut(e)),n(" removeSelfEdges",()=>ia(e)),n(" acyclic",()=>Or(e)),n(" nestingGraph.run",()=>et(e)),n(" rank",()=>Zr(Ye(e))),n(" injectEdgeLabelProxies",()=>Zt(e)),n(" removeEmptyRanks",()=>_r(e)),n(" nestingGraph.cleanup",()=>tt(e)),n(" normalizeRanks",()=>Rr(e)),n(" assignRankMinMax",()=>Kt(e)),n(" removeEdgeLabelProxies",()=>Qt(e)),n(" normalize.run",()=>Ar(e)),n(" parentDummyChains",()=>yt(e)),n(" addBorderSegments",()=>Dr(e)),n(" order",()=>bt(e)),n(" insertSelfEdges",()=>oa(e)),n(" adjustCoordinateSystem",()=>Tr(e)),n(" position",()=>Xt(e)),n(" positionSelfEdges",()=>sa(e)),n(" removeBorderNodes",()=>aa(e)),n(" normalize.undo",()=>Gr(e)),n(" fixupEdgeLabelCoords",()=>ra(e)),n(" undoCoordinateSystem",()=>Xr(e)),n(" translateGraph",()=>ea(e)),n(" assignNodeIntersects",()=>na(e)),n(" reversePoints",()=>ta(e)),n(" acyclic.undo",()=>Sr(e))}function Ft(e,n){l(e.nodes(),function(r){var t=e.node(r),a=n.node(r);t&&(t.x=a.x,t.y=a.y,n.children(r).length&&(t.width=a.width,t.height=a.height))}),l(e.edges(),function(r){var t=e.edge(r),a=n.edge(r);t.points=a.points,Object.prototype.hasOwnProperty.call(a,"x")&&(t.x=a.x,t.y=a.y)}),e.graph().width=n.graph().width,e.graph().height=n.graph().height}var Gt=["nodesep","edgesep","ranksep","marginx","marginy"],Yt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Vt=["acyclicer","ranker","rankdir","align"],qt=["width","height"],Wt={width:0,height:0},Ht=["minlen","weight","width","height","labeloffset"],$t={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},zt=["labelpos"];function Jt(e){var n=new N({multigraph:!0,compound:!0}),r=Z(e.graph());return n.setGraph(re({},Yt,U(r,Gt),G(r,Vt))),l(e.nodes(),function(t){var a=Z(e.node(t));n.setNode(t,Hn(U(a,qt),Wt)),n.setParent(t,e.parent(t))}),l(e.edges(),function(t){var a=Z(e.edge(t));n.setEdge(t,re({},$t,U(a,Ht),G(a,zt)))}),n}function Ut(e){var n=e.graph();n.ranksep/=2,l(e.edges(),function(r){var t=e.edge(r);t.minlen*=2,t.labelpos.toLowerCase()!=="c"&&(n.rankdir==="TB"||n.rankdir==="BT"?t.width+=t.labeloffset:t.height+=t.labeloffset)})}function Zt(e){l(e.edges(),function(n){var r=e.edge(n);if(r.width&&r.height){var t=e.node(n.v),a=e.node(n.w),i={rank:(a.rank-t.rank)/2+t.rank,e:n};M(e,"edge-proxy",i,"_ep")}})}function Kt(e){var n=0;l(e.nodes(),function(r){var t=e.node(r);t.borderTop&&(t.minRank=e.node(t.borderTop).rank,t.maxRank=e.node(t.borderBottom).rank,n=P(n,t.maxRank))}),e.graph().maxRank=n}function Qt(e){l(e.nodes(),function(n){var r=e.node(n);r.dummy==="edge-proxy"&&(e.edge(r.e).labelRank=r.rank,e.removeNode(n))})}function ea(e){var n=Number.POSITIVE_INFINITY,r=0,t=Number.POSITIVE_INFINITY,a=0,i=e.graph(),o=i.marginx||0,s=i.marginy||0;function d(u){var f=u.x,c=u.y,h=u.width,w=u.height;n=Math.min(n,f-h/2),r=Math.max(r,f+h/2),t=Math.min(t,c-w/2),a=Math.max(a,c+w/2)}l(e.nodes(),function(u){d(e.node(u))}),l(e.edges(),function(u){var f=e.edge(u);Object.prototype.hasOwnProperty.call(f,"x")&&d(f)}),n-=o,t-=s,l(e.nodes(),function(u){var f=e.node(u);f.x-=n,f.y-=t}),l(e.edges(),function(u){var f=e.edge(u);l(f.points,function(c){c.x-=n,c.y-=t}),Object.prototype.hasOwnProperty.call(f,"x")&&(f.x-=n),Object.prototype.hasOwnProperty.call(f,"y")&&(f.y-=t)}),i.width=r-n+o,i.height=a-t+s}function na(e){l(e.edges(),function(n){var r=e.edge(n),t=e.node(n.v),a=e.node(n.w),i,o;r.points?(i=r.points[0],o=r.points[r.points.length-1]):(r.points=[],i=a,o=t),r.points.unshift(Ee(t,i)),r.points.push(Ee(a,o))})}function ra(e){l(e.edges(),function(n){var r=e.edge(n);if(Object.prototype.hasOwnProperty.call(r,"x"))switch((r.labelpos==="l"||r.labelpos==="r")&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset;break}})}function ta(e){l(e.edges(),function(n){var r=e.edge(n);r.reversed&&r.points.reverse()})}function aa(e){l(e.nodes(),function(n){if(e.children(n).length){var r=e.node(n),t=e.node(r.borderTop),a=e.node(r.borderBottom),i=e.node(F(r.borderLeft)),o=e.node(F(r.borderRight));r.width=Math.abs(o.x-i.x),r.height=Math.abs(a.y-t.y),r.x=i.x+r.width/2,r.y=t.y+r.height/2}}),l(e.nodes(),function(n){e.node(n).dummy==="border"&&e.removeNode(n)})}function ia(e){l(e.edges(),function(n){if(n.v===n.w){var r=e.node(n.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}})}function oa(e){var n=q(e);l(n,function(r){var t=0;l(r,function(a,i){var o=e.node(a);o.order=i+t,l(o.selfEdges,function(s){M(e,"selfedge",{width:s.label.width,height:s.label.height,rank:o.rank,order:i+ ++t,e:s.e,label:s.label},"_se")}),delete o.selfEdges})})}function sa(e){l(e.nodes(),function(n){var r=e.node(n);if(r.dummy==="selfedge"){var t=e.node(r.e.v),a=t.x+t.width/2,i=t.y,o=r.x-a,s=t.height/2;e.setEdge(r.e,r.label),e.removeNode(n),r.label.points=[{x:a+2*o/3,y:i-s},{x:a+5*o/6,y:i-s},{x:a+o,y:i},{x:a+5*o/6,y:i+s},{x:a+2*o/3,y:i+s}],r.label.x=r.x,r.label.y=r.y}})}function U(e,n){return V(G(e,n),Number)}function Z(e){var n={};return l(e,function(r,t){n[t.toLowerCase()]=r}),n}var Re=y((e,n,r)=>Math.max(n,Math.min(r,e)),"clamp"),_e=y((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),da=y(e=>e==="flowchart"||e==="flowchart-v2"||e==="stateDiagram"||e==="er"||e==="classDiagram","shouldMergeSelfLoopSegments"),ua=["x","y","width","height","labelBBox","intersect","calcIntersect","diff","clusterNode"],fa=y((e,n,r,t,a)=>{const i=[],o=new Set;if(r.forEach(({start:f,end:c})=>{f!==t&&o.add(f),c!==t&&o.add(c)}),o.forEach(f=>{const c=e.node(f);typeof(c==null?void 0:c.x)=="number"&&typeof(c==null?void 0:c.y)=="number"&&i.push(c)}),i.length===0&&r.forEach(({edge:f})=>{(f.points??[]).forEach(c=>{typeof(c==null?void 0:c.x)=="number"&&typeof(c==null?void 0:c.y)=="number"&&i.push(c)})}),i.length===0)return _e(a);const s=i.reduce((f,c)=>({x:f.x+c.x/i.length,y:f.y+c.y/i.length}),{x:0,y:0}),d=s.x-n.x,u=s.y-n.y;return Math.abs(d)>Math.abs(u)?d>0?"right":"left":Math.abs(u)>0?u>0?"bottom":"top":_e(a)},"getSelfLoopSide"),ca=y((e,n="top",r=0,t=0)=>{const a=e.x,i=e.y-r,o=e.width/2,s=e.height/2,d=Math.max(36,Math.min(100,e.width*.8)),u=Re(Math.max(t,e.width*.35),36,d),f=Re(Math.min(e.width,e.height)*.45,24,48);switch(n){case"bottom":{const c=i+s;return[{x:a-u/2,y:c},{x:a-u/2,y:c+f},{x:a+u/2,y:c+f},{x:a+u/2,y:c}]}case"right":{const c=a+o;return[{x:c,y:i-u/2},{x:c+f,y:i-u/2},{x:c+f,y:i+u/2},{x:c,y:i+u/2}]}case"left":{const c=a-o;return[{x:c,y:i-u/2},{x:c-f,y:i-u/2},{x:c-f,y:i+u/2},{x:c,y:i+u/2}]}case"top":default:{const c=i-s;return[{x:a-u/2,y:c},{x:a-u/2,y:c-f},{x:a+u/2,y:c-f},{x:a+u/2,y:c}]}}},"getSelfLoopPoints"),la=y((e,n,r="top",t=0,a={})=>{const o=e.x,s=e.y-t,d=a.width??0,u=a.height??0;switch(r){case"bottom":return{x:o,y:Math.max(...n.map(f=>f.y))+u/2+4};case"right":return{x:Math.max(...n.map(f=>f.x))+d/2+4,y:s};case"left":return{x:Math.min(...n.map(f=>f.x))-d/2-4,y:s};case"top":default:return{x:o,y:Math.min(...n.map(f=>f.y))-u/2-4}}},"getSelfLoopLabelPosition"),rn=y((e,n=0,{mergeSelfLoops:r=!0}={})=>{var o;const t=new Map,a=[],i=(o=e.graph())==null?void 0:o.rankdir;return e.edges().forEach(s=>{const d=e.edge(s);if(r&&d.selfLoop){const u=d.selfLoop.id;t.has(u)||t.set(u,[]),t.get(u).push({edge:d,start:s.v,end:s.w})}else a.push({edge:d,start:s.v,end:s.w})}),t.forEach(s=>{if(s.length!==3){s.forEach(L=>a.push(L));return}s.sort((L,O)=>L.edge.selfLoop.order-O.edge.selfLoop.order);const[d,u,f]=s,c=d.edge.originalEdge??u.edge.originalEdge??f.edge.originalEdge??u.edge,h=e.node(c.start);if(!h){s.forEach(L=>a.push(L));return}const w={width:u.edge.width,height:u.edge.height},p=fa(e,h,s,c.start,i),g=ca(h,p,n,w.width??0),v=la(h,g,p,n,w),b={...u.edge,...c,id:c.id,points:g,start:c.start,end:c.end,x:v.x,y:v.y,width:w.width,height:w.height,labelStyle:u.edge.labelStyle,fromCluster:d.edge.fromCluster??u.edge.fromCluster??f.edge.fromCluster,toCluster:d.edge.toCluster??u.edge.toCluster??f.edge.toCluster};delete b.selfLoop,delete b.originalEdge,a.push({edge:b,start:b.start,end:b.end})}),a},"getEdgesToRender"),tn=y(async({element:e,graph:n,diagramType:r,id:t,parentCluster:a,siteConfig:i})=>{const o=n.graph().rankdir;m.trace("Dir in recursive render - dir:",o);const{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c}=un(e,{edgePathsClass:"edgePaths"});n.nodes()?m.info("Recursive render XXX",n.nodes()):m.info("No nodes found for",n),n.edges().length>0&&m.info("Recursive edges",n.edge(n.edges()[0]));const h=da(r);await Promise.all(n.nodes().map(async function(g){const v=n.node(g);if(a!==void 0){const b=JSON.parse(JSON.stringify(a.clusterData));m.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,g,`
3
3
  data=`,b.height,`
4
4
  Parent cluster`,a.height),n.setNode(a.id,b),n.parent(g)||(m.trace("Setting parent",g,a.id),n.setParent(g,a.id,b))}if(m.info("(Insert) Node XXX"+g+": "+JSON.stringify(n.node(g))),v!=null&&v.clusterNode){m.info("Cluster identified XBX",g,v.width,n.node(g));const{ranksep:b,nodesep:L}=n.graph();v.graph.setGraph({...v.graph.graph(),ranksep:b+25,nodesep:L});const O=await wa({element:f,graph:v.graph,diagramType:r,id:t,parentCluster:n.node(g),siteConfig:i}),I=O.elem;ln(v,I),v.diff=O.diff||0,m.info("New compound node after recursive render XAX",g,"width",v.width,"height",v.height),hn(I,v)}else n.children(g).length>0?(m.trace("Cluster - the non recursive path XBX",g,v.id,v,v.width,"Graph:",n),m.trace(ge(v.id,n)),k.set(v.id,{id:ge(v.id,n),node:v})):(m.trace("Node - the non recursive path XAX",g,f,n.node(g),o),await fn(f,n.node(g),{config:i,dir:o}))})),await y(async()=>{const g=n.edges().map(async function(v){var L,O,I,ve;const b=n.edge(v.v,v.w,v.name);if(m.info("Edge "+v.v+" -> "+v.w+": "+JSON.stringify(v)),m.info("Edge "+v.v+" -> "+v.w+": ",v," ",JSON.stringify(n.edge(v))),m.info("Fix",k,"ids:",v.v,v.w,"Translating: ",k.get(v.v),k.get(v.w)),h&&b.selfLoop){if(b.selfLoop.order!==1)return;const j={...b.originalEdge,...b,id:b.selfLoop.id,startLabelLeft:((L=b.originalEdge)==null?void 0:L.startLabelLeft)??b.startLabelLeft,startLabelRight:((O=b.originalEdge)==null?void 0:O.startLabelRight)??b.startLabelRight,endLabelLeft:((I=b.originalEdge)==null?void 0:I.endLabelLeft)??b.endLabelLeft,endLabelRight:((ve=b.originalEdge)==null?void 0:ve.endLabelRight)??b.endLabelRight};await we(u,j),b.width=j.width,b.height=j.height,b.labelStyle=j.labelStyle;return}await we(u,b)});await Promise.all(g)},"processEdges")();const{subGraphTitleTotalMargin:p}=pn(i);return{elem:c,graph:n,groups:{clusters:s,edgePaths:d,edgeLabels:u,nodes:f,rootGroups:c},diagramType:r,id:t,mergeSelfLoops:h,subGraphTitleTotalMargin:p}},"measureDagreGraph"),an=y(e=>{m.info("############################################# XXX"),m.info("### Layout ### XXX"),m.info("############################################# XXX"),jt(e)},"runDagreGraphLayout"),ha=y((e,n,r)=>{const t=e.node(n);if(!t)return;const a={...t};return t!=null&&t.clusterNode?a.y=(t.y??0)+r:e.children(n).length>0?a.height=(t.height??0)+r:a.y=(t.y??0)+r/2,a},"normalizeDagreNode"),Me=y((e,n)=>{ua.forEach(r=>{n[r]!==void 0&&(e[r]=n[r])})},"applyDagreNodeLayout"),pa=y((e,n,r,t)=>({...e,start:e.start??n,end:e.end??r,points:(e.points??[]).map(a=>({...a,y:typeof a.y=="number"?a.y+t:a.y}))}),"normalizeDagreEdge"),va=y((e,n)=>{const{graph:r,mergeSelfLoops:t,subGraphTitleTotalMargin:a=0}=n,i=new Map(e.nodes.map(s=>[s.id,s]));ae(r).forEach(s=>{const d=ha(r,s,a);if(!d)return;Me(r.node(s),d);const u=i.get(s);u&&Me(u,d)});const o=a/2;return e.edges=rn(r,o,{mergeSelfLoops:t}).map(({edge:s,start:d,end:u})=>pa(s,d,u,o)),e},"applyDagreLayoutResult"),ga=y(async({elem:e,graph:n,groups:{clusters:r,edgePaths:t},diagramType:a,id:i,mergeSelfLoops:o,subGraphTitleTotalMargin:s})=>{let d=0;await Promise.all(ae(n).map(async function(c){var w;const h=n.node(c);if(m.info("Position XBX => "+c+": ("+h.x,","+h.y,") width: ",h.width," height: ",h.height),h!=null&&h.clusterNode)h.y+=s,m.info("A tainted cluster node XBX1",c,h.id,h.width,h.height,h.x,h.y,n.parent(c)),k.get(h.id).node=h,be(h);else if(n.children(c).length>0){m.info("A pure cluster node XBX1",c,h.id,h.x,h.y,h.width,h.height,n.parent(c)),h.height+=s,n.node(h.parentId);const p=(h==null?void 0:h.padding)/2||0,g=((w=h==null?void 0:h.labelBBox)==null?void 0:w.height)||0,v=g-p||0;m.debug("OffsetY",v,"labelHeight",g,"halfPadding",p),await vn(r,h),k.get(h.id).node=h}else{const p=n.node(h.parentId);h.y+=s/2,m.info("A regular node XBX1 - using the padding",h.id,"parent",h.parentId,h.width,h.height,h.x,h.y,"offsetY",h.offsetY,"parent",p,p==null?void 0:p.offsetY,h),be(h)}}));const u=s/2;return rn(n,u,{mergeSelfLoops:o}).forEach(function({edge:c,start:h,end:w}){m.info("Edge "+h+" -> "+w+": "+JSON.stringify(c),c),c.points.forEach(b=>b.y+=u);const p=n.node(h),g=n.node(w),v=gn(t,c,k,a,p,g,i);wn(c,v)}),n.nodes().forEach(function(c){const h=n.node(c);m.info(c,h.type,h.diff),h.isGroup&&(d=h.diff)}),m.warn("Returning from recursive render XAX",e,d),{elem:e,diff:d}},"paintDagreLayoutCore"),wa=y(async e=>{const n=await tn(e);return an(n.graph),await ga(n)},"renderDagreSubgraph"),on=y(e=>{var r,t,a,i,o,s;const n=new N({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:((r=e.config)==null?void 0:r.nodeSpacing)||e.nodeSpacing||((a=(t=e.config)==null?void 0:t.flowchart)==null?void 0:a.nodeSpacing),ranksep:((i=e.config)==null?void 0:i.rankSpacing)||e.rankSpacing||((s=(o=e.config)==null?void 0:o.flowchart)==null?void 0:s.rankSpacing),marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(d=>{n.setNode(d.id,{...d}),d.parentId&&n.setParent(d.id,d.parentId)}),m.debug("Edges:",e.edges),e.edges.forEach(d=>{if(d.start===d.end){const u=d.start,f=u+"---"+u+"---1",c=u+"---"+u+"---2",h=n.node(u);n.setNode(f,{domId:f,id:f,parentId:h.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(f,h.parentId),n.setNode(c,{domId:c,id:c,parentId:h.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(c,h.parentId);const w=structuredClone(d),p=structuredClone(d),g=structuredClone(d),v=structuredClone(d);p.originalEdge=w,p.selfLoop={id:w.id,order:0},g.originalEdge=w,g.selfLoop={id:w.id,order:1},v.originalEdge=w,v.selfLoop={id:w.id,order:2},p.label="",p.arrowTypeEnd="none",p.endLabelLeft="",p.endLabelRight="",p.startLabelLeft="",p.id=u+"-cyclic-special-1",g.startLabelRight="",g.startLabelLeft="",g.endLabelLeft="",g.endLabelRight="",g.arrowTypeStart="none",g.arrowTypeEnd="none",g.id=u+"-cyclic-special-mid",v.label="",v.startLabelRight="",v.startLabelLeft="",v.arrowTypeStart="none",h.isGroup&&(p.fromCluster=u,v.toCluster=u),v.id=u+"-cyclic-special-2",v.arrowTypeStart="none",n.setEdge(u,f,p,u+"-cyclic-special-0"),n.setEdge(f,c,g,u+"-cyclic-special-1"),n.setEdge(c,u,v,u+"-cyclic-special-2")}else n.setEdge(d.start,d.end,{...d},d.id)}),sn(n),{graph:n}},"prepareLayoutForDagre"),ba=y(async(e,{element:n,preparedLayout:r})=>{const t=r??on(e),a=cn(),i=await tn({element:n,graph:t.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return t.measuredLayout=i,i},"measureDagreLayout"),ma=y((e,n)=>{var t;const r=(t=n.preparedLayout)==null?void 0:t.measuredLayout;if(!r)throw new Error("runDagreLayoutCore requires measureDagreLayout to run first");return an(r.graph),va(e,r),r},"runDagreLayoutCore"),ya=y((e,{measure:n})=>ae(n.graph).map(r=>n.graph.node(r)).filter(Boolean),"getDagrePaintNodes"),Ea=y((e,n,{measure:r})=>e?r.graph.node(e):void 0,"getDagreEdgeNode"),Sa=dn({prepareLayout:on,measureLayout:ba,runLayoutCore:ma,paintOptions:{clusterDb:k,getNodes:ya,getEdgeNode:Ea,skipNode:y((e,{measure:n})=>!n.graph.hasNode(e.id),"skipNode"),isCluster:y((e,{measure:n})=>n.graph.hasNode(e.id)&&(n.graph.children(e.id)??[]).length>0,"isCluster")}});export{va as applyDagreLayoutResult,rn as getEdgesToRender,ba as measureDagreLayout,on as prepareLayoutForDagre,Sa as render,ma as runDagreLayoutCore};
@@ -1,4 +1,4 @@
1
- import{g as k1}from"./chunk-5VM5RSS4-Cm4KeKby.js";import{g as E1}from"./chunk-XXDRQBXY-D4SqXrQ8.js";import{s as C1}from"./chunk-WEXAMYUT-DipTfRbc.js";import{c as k,bb as t1,aH as le,a4 as Ce,a8 as S1,b0 as x1,bw as Gt,ba as T1,b9 as D1,bc as v1,a2 as _1,a1 as F1,a5 as V1,D as I1,aG as s1,J as i1,aB as L1,a6 as Rt,b7 as Ot,u as B1,Q as M1,aw as y1,b4 as N1,ai as w1,A as R1,b3 as O1}from"./mermaid.core-DPEwUsaj.js";import{c as P1}from"./chunk-GWA4HPMP-CL1biVIA.js";import{p as G1}from"./index-YZNK723o.js";import{c as U1}from"./channel-CzALSnb0.js";var tt={SHAPE_UNSUPPORTED:"SHAPE_UNSUPPORTED",SHAPE_REMOVED:"SHAPE_REMOVED",EDGE_OPERATOR_UNSUPPORTED:"EDGE_OPERATOR_UNSUPPORTED",REFERENCE_EDGE_LABEL_REJECTED:"REFERENCE_EDGE_LABEL_REJECTED",CONNECTOR_REF_UNRESOLVED:"CONNECTOR_REF_UNRESOLVED",CONNECTOR_REF_NOT_A_CONNECTOR:"CONNECTOR_REF_NOT_A_CONNECTOR",METADATA_KEY_MISAPPLIED:"METADATA_KEY_MISAPPLIED",DUPLICATE_ID_NODE:"DUPLICATE_ID_NODE",RESERVED_SYNTHETIC_ID:"RESERVED_SYNTHETIC_ID",CONTAINMENT_VIOLATION:"CONTAINMENT_VIOLATION",EDGE_SEMANTIC_CONTRADICTION:"EDGE_SEMANTIC_CONTRADICTION",FLOW_NO_INPUT:"FLOW_NO_INPUT"},z1=new Set([tt.SHAPE_UNSUPPORTED,tt.SHAPE_REMOVED,tt.CONTAINMENT_VIOLATION]);new Set(Object.values(tt).filter(s=>!z1.has(s)));var W1=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),K1=new Set(["doc","stadium","terminal","circle","trapezoid","inv_trapezoid","inv-trapezoid","doublecircle","double-circle","typeDeclaration","procs","lean_left","lean-left","in-out","cylinder","ellipse","odd","tag-rect","tagged-rectangle","delay","half-rounded-rectangle","lin-rect","lined-rectangle","win-pane","window-pane","curv-trap","curved-trapezoid"]),H1=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),$e="roundedRect";function et(s){return s&&(W1.get(s)??s)}k(et,"resolveShapeAlias");function r1(s,i){for(const n of s)if(!n.isGroup){if((!n.shape||n.shape==="squareRect"||n.shape==="rect")&&(n.shape=$e),K1.has(n.shape)){const r=`shape "${n.shape}" was removed in v0.8.1, using "${$e}"`;i!=null&&i.emitError?i.emitError("SHAPE_REMOVED",r,{nodeId:n.id}):le.warn(`agentflow: ${r}`),n.shape=$e;continue}if(!H1.has(n.shape)){const r=`shape "${n.shape}" is not supported, using "${$e}"`;i!=null&&i.emitWarning?i.emitWarning("SHAPE_UNSUPPORTED",r,{nodeId:n.id}):le.warn(`agentflow: ${r}`),n.shape=$e}}}k(r1,"normaliseNodeShapes");var Lt=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),a1=Lt.size,o1=k(s=>`af-kind-${s}`,"kindClass"),Y1=[...Lt.keys()],u1=k(s=>Math.max(1,s-a1),"containerSlotCount"),l1=k((s,i)=>{const n=a1+s%u1(i);return i>0?n%i:n},"containerSlot");function c1(s,i,n){var c;const r=(c=Ce().themeVariables)==null?void 0:c.borderColorArray,o=Array.isArray(r)?r.length:0;let u=n.size;for(const a of s??[]){if(a.isGroup||a.shape==="collapsedGroup"){const f=n.get(String(a.id))??u++;a.colorIndex=l1(f,o);continue}const d=i(String(a.id));d&&Lt.has(d)&&(a.cssClasses=`${a.cssClasses??""} ${o1(d)}`.replace(/\s+/g," ").trim())}}k(c1,"assignColorSlots");var n1="agentflow-",Pt=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),j1=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]),q1={flow:"flowGroup"};function It(s){if(Array.isArray(s))return s.map(n=>It(n));if(s===null||typeof s!="object")return s;const i={};for(const n of Object.keys(s))n==="__proto__"||n==="constructor"||n==="prototype"||(i[n]=It(s[n]));return i}k(It,"stripPrototypeKeys");function d1(s){let i=!1,n=!1,r=0,o;const u=[];for(const c of s.split(`
1
+ import{g as k1}from"./chunk-5VM5RSS4-DmiubfkW.js";import{g as E1}from"./chunk-XXDRQBXY-lvHTV8V8.js";import{s as C1}from"./chunk-WEXAMYUT-CtoG2QGf.js";import{c as k,bb as t1,aH as le,a4 as Ce,a8 as S1,b0 as x1,bw as Gt,ba as T1,b9 as D1,bc as v1,a2 as _1,a1 as F1,a5 as V1,D as I1,aG as s1,J as i1,aB as L1,a6 as Rt,b7 as Ot,u as B1,Q as M1,aw as y1,b4 as N1,ai as w1,A as R1,b3 as O1}from"./mermaid.core-DyJzg3sN.js";import{c as P1}from"./chunk-GWA4HPMP-TlU0Zdso.js";import{p as G1}from"./index-tG8o31dK.js";import{c as U1}from"./channel-_M8n0hcq.js";var tt={SHAPE_UNSUPPORTED:"SHAPE_UNSUPPORTED",SHAPE_REMOVED:"SHAPE_REMOVED",EDGE_OPERATOR_UNSUPPORTED:"EDGE_OPERATOR_UNSUPPORTED",REFERENCE_EDGE_LABEL_REJECTED:"REFERENCE_EDGE_LABEL_REJECTED",CONNECTOR_REF_UNRESOLVED:"CONNECTOR_REF_UNRESOLVED",CONNECTOR_REF_NOT_A_CONNECTOR:"CONNECTOR_REF_NOT_A_CONNECTOR",METADATA_KEY_MISAPPLIED:"METADATA_KEY_MISAPPLIED",DUPLICATE_ID_NODE:"DUPLICATE_ID_NODE",RESERVED_SYNTHETIC_ID:"RESERVED_SYNTHETIC_ID",CONTAINMENT_VIOLATION:"CONTAINMENT_VIOLATION",EDGE_SEMANTIC_CONTRADICTION:"EDGE_SEMANTIC_CONTRADICTION",FLOW_NO_INPUT:"FLOW_NO_INPUT"},z1=new Set([tt.SHAPE_UNSUPPORTED,tt.SHAPE_REMOVED,tt.CONTAINMENT_VIOLATION]);new Set(Object.values(tt).filter(s=>!z1.has(s)));var W1=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),K1=new Set(["doc","stadium","terminal","circle","trapezoid","inv_trapezoid","inv-trapezoid","doublecircle","double-circle","typeDeclaration","procs","lean_left","lean-left","in-out","cylinder","ellipse","odd","tag-rect","tagged-rectangle","delay","half-rounded-rectangle","lin-rect","lined-rectangle","win-pane","window-pane","curv-trap","curved-trapezoid"]),H1=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),$e="roundedRect";function et(s){return s&&(W1.get(s)??s)}k(et,"resolveShapeAlias");function r1(s,i){for(const n of s)if(!n.isGroup){if((!n.shape||n.shape==="squareRect"||n.shape==="rect")&&(n.shape=$e),K1.has(n.shape)){const r=`shape "${n.shape}" was removed in v0.8.1, using "${$e}"`;i!=null&&i.emitError?i.emitError("SHAPE_REMOVED",r,{nodeId:n.id}):le.warn(`agentflow: ${r}`),n.shape=$e;continue}if(!H1.has(n.shape)){const r=`shape "${n.shape}" is not supported, using "${$e}"`;i!=null&&i.emitWarning?i.emitWarning("SHAPE_UNSUPPORTED",r,{nodeId:n.id}):le.warn(`agentflow: ${r}`),n.shape=$e}}}k(r1,"normaliseNodeShapes");var Lt=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),a1=Lt.size,o1=k(s=>`af-kind-${s}`,"kindClass"),Y1=[...Lt.keys()],u1=k(s=>Math.max(1,s-a1),"containerSlotCount"),l1=k((s,i)=>{const n=a1+s%u1(i);return i>0?n%i:n},"containerSlot");function c1(s,i,n){var c;const r=(c=Ce().themeVariables)==null?void 0:c.borderColorArray,o=Array.isArray(r)?r.length:0;let u=n.size;for(const a of s??[]){if(a.isGroup||a.shape==="collapsedGroup"){const f=n.get(String(a.id))??u++;a.colorIndex=l1(f,o);continue}const d=i(String(a.id));d&&Lt.has(d)&&(a.cssClasses=`${a.cssClasses??""} ${o1(d)}`.replace(/\s+/g," ").trim())}}k(c1,"assignColorSlots");var n1="agentflow-",Pt=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),j1=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]),q1={flow:"flowGroup"};function It(s){if(Array.isArray(s))return s.map(n=>It(n));if(s===null||typeof s!="object")return s;const i={};for(const n of Object.keys(s))n==="__proto__"||n==="constructor"||n==="prototype"||(i[n]=It(s[n]));return i}k(It,"stripPrototypeKeys");function d1(s){let i=!1,n=!1,r=0,o;const u=[];for(const c of s.split(`
2
2
  `)){if(o!==void 0){const h=c.length-c.trimStart().length;if(c.trim()===""||h>o){u.push(c);continue}o=void 0}let a=-1;for(let h=0;h<c.length;h++){const b=c[h];if(n)b==="\\"?h++:b==='"'&&(n=!1);else if(i)b==="'"&&(i=!1);else if(b==='"')n=!0;else if(b==="'")i=!0;else if(b==="#"&&(h===0||c[h-1]===" "||c[h-1]===" ")){a=h;break}else b==="["||b==="{"?r++:(b==="]"||b==="}")&&(r=Math.max(0,r-1))}if(i||n||r>0){u.push(c);continue}const d=a>=0?c.slice(0,a):c,f=a>=0?c.slice(a):"";if(/:\s*[>|][\d+-]*\s*$/.test(d)){o=c.length-c.trimStart().length,u.push(c);continue}u.push(d.replace(/,([\t ]*)$/,"$1")+f)}return u.join(`
3
3
  `)}k(d1,"stripLineTrailingCommas");var Ze,X1=(Ze=class{constructor(){this.vertexCounter=0,this.config=Ce(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.diagramId="",this.preserveCommentsWhenParsing=!0,this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,this.funs=[],this.setAccTitle=T1,this.setAccDescription=D1,this.setDiagramTitle=v1,this.getAccTitle=_1,this.getAccDescription=F1,this.getDiagramTitle=V1,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addGlobal=this.addGlobal.bind(this),this.addConnector=this.addConnector.bind(this),this.addConnectorMapping=this.addConnectorMapping.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.setFrontmatterLineOffset=this.setFrontmatterLineOffset.bind(this),this.addVertexMapping=this.addVertexMapping.bind(this),this.extendVertexMapping=this.extendVertexMapping.bind(this),this.addEdgeMapping=this.addEdgeMapping.bind(this),this.addSubgraphMapping=this.addSubgraphMapping.bind(this),this.emitWarning=this.emitWarning.bind(this),this.emitError=this.emitError.bind(this),this.getDiagnostics=this.getDiagnostics.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}sanitizeText(i){return I1.sanitizeText(i,this.config)}sanitizeNodeLabelType(i){switch(i){case"markdown":case"string":case"text":return i;default:return"markdown"}}setDiagramId(i){this.diagramId=i}lookUpDomId(i){for(const n of this.vertices.values())if(n.id===i)return this.diagramId?`${this.diagramId}-${n.domId}`:n.domId;return this.diagramId?`${this.diagramId}-${i}`:i}addVertex(i,n,r,o,u,c,a={},d,f){if(!i||i.trim().length===0)return;let h;if(d!==void 0){let g;d.includes(`
4
4
  `)?g=d+`
@@ -1,4 +1,4 @@
1
- import{p as ge}from"./chunk-JWPE2WC7-B8eAVfuB.js";import{c as w,ac as ye,a3 as ae,t as ee,b8 as Se,F as ve,aH as te,bm as B,b7 as U,ba as xe,a2 as be,bc as we,a5 as Ce,a1 as Te,b9 as Le,S as $e,ay as Ae,u as Fe}from"./mermaid.core-DPEwUsaj.js";import{s as Ne}from"./chunk-WEXAMYUT-DipTfRbc.js";import{p as Me}from"./cynefin-OW5HDTMX-Du659bmz.js";import{f as O}from"./defaultLocale-CrowFXzY.js";import{o as Q}from"./ordinal-Cboi1Yqb.js";import"./index-YZNK723o.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h<d;++h)n.push(s[h]);for(;l=r.pop();)t.call(a,l,++g,this);return this}function Pe(t,a){let l=-1;for(const n of this)if(t.call(a,n,++l,this))return n}function Be(t){return this.eachAfter(function(a){for(var l=+t(a.data)||0,n=a.children,r=n&&n.length;--r>=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r<s;++r)l.push(n[r]);while(l.length)}function ne(t,a){t instanceof Map?(t=[void 0,t],a===void 0&&(a=je)):a===void 0&&(a=Ye);for(var l=new Z(t),n,r=[l],s,h,d,g;n=r.pop();)if((h=a(n.data))&&(g=(h=Array.from(h)).length))for(n.children=h,d=g-1;d>=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++d<g;)h=s[d],h.y0=l,h.y1=r,h.x0=a,h.x1=a+=h.value*c}function et(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(r-l)/t.value;++d<g;)h=s[d],h.x0=a,h.x1=n,h.y0=l,h.y1=l+=h.value*c}var tt=(1+Math.sqrt(5))/2;function at(t,a,l,n,r,s){for(var h=[],d=a.children,g,c,u=0,b=0,i=d.length,x,S,v=a.value,p,y,M,A,V,W,_;u<i;){x=r-l,S=s-n;do p=d[b++].value;while(!p&&b<i);for(y=M=p,W=Math.max(S/x,x/S)/(v*t),_=p*p*W,V=Math.max(M/_,_/y);b<i;++b){if(p+=c=d[b].value,c<y&&(y=c),c>M&&(M=c),_=p*p*W,A=Math.max(M/_,_/y),A>V){p-=c;break}V=A}h.push(g={value:p,dice:x<S,children:d.slice(u,b)}),g.dice?Qe(g,l,n,r,v?n+=S*p/v:s):et(g,l,n,v?l+=x*p/v:r,s),v-=p,u=b}return h}const nt=function t(a){function l(n,r,s,h,d){at(a,n,r,s,h,d)}return l.ratio=function(n){return t((n=+n)>1?n:1)},l}(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p<S&&(S=p=(S+p)/2),y<v&&(v=y=(v+y)/2),i.x0=S,i.y0=v,i.x1=p,i.y1=y,i.children&&(x=r[i.depth+1]=s(i)/2,S+=c(i)-x,v+=h(i)-x,p-=d(i)-x,y-=g(i)-x,p<S&&(S=p=(S+p)/2),y<v&&(v=y=(v+y)/2),t(i,S,v,p,y))}return u.round=function(i){return arguments.length?(a=!!i,u):a},u.size=function(i){return arguments.length?(l=+i[0],n=+i[1],u):[l,n]},u.tile=function(i){return arguments.length?(t=Je(i),u):t},u.padding=function(i){return arguments.length?u.paddingInner(i).paddingOuter(i):u.paddingInner()},u.paddingInner=function(i){return arguments.length?(s=typeof i=="function"?i:q(+i),u):s},u.paddingOuter=function(i){return arguments.length?u.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i):u.paddingTop()},u.paddingTop=function(i){return arguments.length?(h=typeof i=="function"?i:q(+i),u):h},u.paddingRight=function(i){return arguments.length?(d=typeof i=="function"?i:q(+i),u):d},u.paddingBottom=function(i){return arguments.length?(g=typeof i=="function"?i:q(+i),u):g},u.paddingLeft=function(i){return arguments.length?(c=typeof i=="function"?i:q(+i),u):c},u}var R,oe=(R=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=xe,this.getAccTitle=be,this.setDiagramTitle=we,this.getDiagramTitle=Ce,this.getAccDescription=Te,this.setAccDescription=Le}getNodes(){return this.nodes}getConfig(){const a=$e,l=ae();return ee({...a.treemap,...l.treemap??{}})}addNode(a,l){this.nodes.push(a),this.levels.set(a,l),l===0&&(this.outerNodes.push(a),this.root??(this.root=a))}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,l){const n=this.classes.get(a)??{id:a,styles:[],textStyles:[]},r=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");r&&r.forEach(s=>{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),M=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),A=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>M(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+A(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),k=o.node();if(k.getComputedTextLength()>m){const $="...";let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text($),k.getComputedTextLength()>m&&o.text("");break}if(o.text(z+$),k.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+A(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),F=re.length>20,ue=F?16:38,Y=F?14:28,D=F?4:8,I=F?4:6,J=F?2:4,se=F?8:10,K=F?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+A(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(T<se||P<se){o.style("display","none");return}let m=parseInt(o.style("font-size"),10);const k=.6;for(;L.getComputedTextLength()>T&&m>D;)m--,o.style("font-size",`${m}px`);let N=Math.max(I,Math.min(Y,Math.round(m*k))),$=m+K+N;for(;$>P&&m>D&&(m--,N=Math.max(I,Math.min(Y,Math.round(m*k))),!(N<I&&m===D));)o.style("font-size",`${m}px`),$=m+K+N;o.style("font-size",`${m}px`),F?(m<D||P<D)&&o.style("display","none"):(L.getComputedTextLength()>T||m<D||P<m)&&o.style("display","none")}),s.showValues!==!1&&j.append("text").attr("class","treemapValue").attr("x",o=>(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+A(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const N=(o.y1-o.y0)/2+T/2+K;f.attr("y",N);const $=o.x1-o.x0,ie=o.y1-o.y0-4,me=$-2*J;f.node().getComputedTextLength()>me||N+m>ie||m<I?f.style("display","none"):f.style("display",null)});const pe=s.diagramPadding??8;Ne(b,pe,"flowchart",(s==null?void 0:s.useMaxWidth)||!1)},"draw"),ct=w(function(t,a){return a.db.getClasses()},"getClasses"),ht={draw:ot,getClasses:ct},dt={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},ut=w(({treemap:t}={})=>{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return`
1
+ import{p as ge}from"./chunk-JWPE2WC7-CaXu9QwT.js";import{c as w,ac as ye,a3 as ae,t as ee,b8 as Se,F as ve,aH as te,bm as B,b7 as U,ba as xe,a2 as be,bc as we,a5 as Ce,a1 as Te,b9 as Le,S as $e,ay as Ae,u as Fe}from"./mermaid.core-DyJzg3sN.js";import{s as Ne}from"./chunk-WEXAMYUT-CtoG2QGf.js";import{p as Me}from"./cynefin-OW5HDTMX-DkrT2FtY.js";import{f as O}from"./defaultLocale-CrowFXzY.js";import{o as Q}from"./ordinal-Cboi1Yqb.js";import"./index-tG8o31dK.js";import"./init-Gi6I4Gst.js";function _e(t){var a=0,l=t.children,n=l&&l.length;if(!n)a=1;else for(;--n>=0;)a+=l[n].value;t.value=a}function ke(){return this.eachAfter(_e)}function ze(t,a){let l=-1;for(const n of this)t.call(a,n,++l,this);return this}function Ve(t,a){for(var l=this,n=[l],r,s,h=-1;l=n.pop();)if(t.call(a,l,++h,this),r=l.children)for(s=r.length-1;s>=0;--s)n.push(r[s]);return this}function De(t,a){for(var l=this,n=[l],r=[],s,h,d,g=-1;l=n.pop();)if(r.push(l),s=l.children)for(h=0,d=s.length;h<d;++h)n.push(s[h]);for(;l=r.pop();)t.call(a,l,++g,this);return this}function Pe(t,a){let l=-1;for(const n of this)if(t.call(a,n,++l,this))return n}function Be(t){return this.eachAfter(function(a){for(var l=+t(a.data)||0,n=a.children,r=n&&n.length;--r>=0;)l+=n[r].value;a.value=l})}function Ee(t){return this.eachBefore(function(a){a.children&&a.children.sort(t)})}function Re(t){for(var a=this,l=We(a,t),n=[a];a!==l;)a=a.parent,n.push(a);for(var r=n.length;t!==l;)n.splice(r,0,t),t=t.parent;return n}function We(t,a){if(t===a)return t;var l=t.ancestors(),n=a.ancestors(),r=null;for(t=l.pop(),a=n.pop();t===a;)r=t,t=l.pop(),a=n.pop();return r}function He(){for(var t=this,a=[t];t=t.parent;)a.push(t);return a}function Ie(){return Array.from(this)}function Oe(){var t=[];return this.eachBefore(function(a){a.children||t.push(a)}),t}function Ge(){var t=this,a=[];return t.each(function(l){l!==t&&a.push({source:l.parent,target:l})}),a}function*qe(){var t=this,a,l=[t],n,r,s;do for(a=l.reverse(),l=[];t=a.pop();)if(yield t,n=t.children)for(r=0,s=n.length;r<s;++r)l.push(n[r]);while(l.length)}function ne(t,a){t instanceof Map?(t=[void 0,t],a===void 0&&(a=je)):a===void 0&&(a=Ye);for(var l=new Z(t),n,r=[l],s,h,d,g;n=r.pop();)if((h=a(n.data))&&(g=(h=Array.from(h)).length))for(n.children=h,d=g-1;d>=0;--d)r.push(s=h[d]=new Z(h[d])),s.parent=n,s.depth=n.depth+1;return l.eachBefore(Ze)}function Xe(){return ne(this).eachBefore(Ue)}function Ye(t){return t.children}function je(t){return Array.isArray(t)?t[1]:null}function Ue(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Ze(t){var a=0;do t.height=a;while((t=t.parent)&&t.height<++a)}function Z(t){this.data=t,this.depth=this.height=0,this.parent=null}Z.prototype=ne.prototype={constructor:Z,count:ke,each:ze,eachAfter:De,eachBefore:Ve,find:Pe,sum:Be,sort:Ee,path:Re,ancestors:He,descendants:Ie,leaves:Oe,links:Ge,copy:Xe,[Symbol.iterator]:qe};function Je(t){if(typeof t!="function")throw new Error;return t}function G(){return 0}function q(t){return function(){return t}}function Ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Qe(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(n-a)/t.value;++d<g;)h=s[d],h.y0=l,h.y1=r,h.x0=a,h.x1=a+=h.value*c}function et(t,a,l,n,r){for(var s=t.children,h,d=-1,g=s.length,c=t.value&&(r-l)/t.value;++d<g;)h=s[d],h.x0=a,h.x1=n,h.y0=l,h.y1=l+=h.value*c}var tt=(1+Math.sqrt(5))/2;function at(t,a,l,n,r,s){for(var h=[],d=a.children,g,c,u=0,b=0,i=d.length,x,S,v=a.value,p,y,M,A,V,W,_;u<i;){x=r-l,S=s-n;do p=d[b++].value;while(!p&&b<i);for(y=M=p,W=Math.max(S/x,x/S)/(v*t),_=p*p*W,V=Math.max(M/_,_/y);b<i;++b){if(p+=c=d[b].value,c<y&&(y=c),c>M&&(M=c),_=p*p*W,A=Math.max(M/_,_/y),A>V){p-=c;break}V=A}h.push(g={value:p,dice:x<S,children:d.slice(u,b)}),g.dice?Qe(g,l,n,r,v?n+=S*p/v:s):et(g,l,n,v?l+=x*p/v:r,s),v-=p,u=b}return h}const nt=function t(a){function l(n,r,s,h,d){at(a,n,r,s,h,d)}return l.ratio=function(n){return t((n=+n)>1?n:1)},l}(tt);function lt(){var t=nt,a=!1,l=1,n=1,r=[0],s=G,h=G,d=G,g=G,c=G;function u(i){return i.x0=i.y0=0,i.x1=l,i.y1=n,i.eachBefore(b),r=[0],a&&i.eachBefore(Ke),i}function b(i){var x=r[i.depth],S=i.x0+x,v=i.y0+x,p=i.x1-x,y=i.y1-x;p<S&&(S=p=(S+p)/2),y<v&&(v=y=(v+y)/2),i.x0=S,i.y0=v,i.x1=p,i.y1=y,i.children&&(x=r[i.depth+1]=s(i)/2,S+=c(i)-x,v+=h(i)-x,p-=d(i)-x,y-=g(i)-x,p<S&&(S=p=(S+p)/2),y<v&&(v=y=(v+y)/2),t(i,S,v,p,y))}return u.round=function(i){return arguments.length?(a=!!i,u):a},u.size=function(i){return arguments.length?(l=+i[0],n=+i[1],u):[l,n]},u.tile=function(i){return arguments.length?(t=Je(i),u):t},u.padding=function(i){return arguments.length?u.paddingInner(i).paddingOuter(i):u.paddingInner()},u.paddingInner=function(i){return arguments.length?(s=typeof i=="function"?i:q(+i),u):s},u.paddingOuter=function(i){return arguments.length?u.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i):u.paddingTop()},u.paddingTop=function(i){return arguments.length?(h=typeof i=="function"?i:q(+i),u):h},u.paddingRight=function(i){return arguments.length?(d=typeof i=="function"?i:q(+i),u):d},u.paddingBottom=function(i){return arguments.length?(g=typeof i=="function"?i:q(+i),u):g},u.paddingLeft=function(i){return arguments.length?(c=typeof i=="function"?i:q(+i),u):c},u}var R,oe=(R=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=xe,this.getAccTitle=be,this.setDiagramTitle=we,this.getDiagramTitle=Ce,this.getAccDescription=Te,this.setAccDescription=Le}getNodes(){return this.nodes}getConfig(){const a=$e,l=ae();return ee({...a.treemap,...l.treemap??{}})}addNode(a,l){this.nodes.push(a),this.levels.set(a,l),l===0&&(this.outerNodes.push(a),this.root??(this.root=a))}getRoot(){return{name:"",children:this.outerNodes}}addClass(a,l){const n=this.classes.get(a)??{id:a,styles:[],textStyles:[]},r=l.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");r&&r.forEach(s=>{Ae(s)&&(n!=null&&n.textStyles?n.textStyles.push(s):n.textStyles=[s]),n!=null&&n.styles?n.styles.push(s):n.styles=[s]}),this.classes.set(a,n)}getClasses(){return this.classes}getStylesForClass(a){var l;return((l=this.classes.get(a))==null?void 0:l.styles)??[]}clear(){Fe(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}},w(R,"TreeMapDB"),R);function ce(t){if(!t.length)return[];const a=[],l=[];return t.forEach(n=>{const r={name:n.name,children:n.type==="Leaf"?void 0:[]};for(r.classSelector=n==null?void 0:n.classSelector,n!=null&&n.cssCompiledStyles&&(r.cssCompiledStyles=n.cssCompiledStyles),n.type==="Leaf"&&n.value!==void 0&&(r.value=n.value);l.length>0&&l[l.length-1].level>=n.level;)l.pop();if(l.length===0)a.push(r);else{const s=l[l.length-1].node;s.children?s.children.push(r):s.children=[r]}n.type!=="Leaf"&&l.push({node:r,level:n.level})}),a}w(ce,"buildHierarchy");var rt=w((t,a)=>{ge(t,a);const l=[];for(const s of t.TreemapRows??[])s.$type==="ClassDefStatement"&&a.addClass(s.className??"",s.styleText??"");for(const s of t.TreemapRows??[]){const h=s.item;if(!h)continue;const d=s.indent?parseInt(s.indent):0,g=st(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],u=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:u};l.push(b)}const n=ce(l),r=w((s,h)=>{for(const d of s)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(n,0)},"populate"),st=w(t=>t.name?String(t.name):"","getItemName"),he={parser:{yy:void 0},parse:w(async t=>{var a;try{const n=await Me("treemap",t);te.debug("Treemap AST:",n);const r=(a=he.parser)==null?void 0:a.yy;if(!(r instanceof oe))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(n,r)}catch(l){throw te.error("Error parsing treemap:",l),l}},"parse")},it=10,E=10,X=25,ot=w((t,a,l,n)=>{const r=n.db,s=r.getConfig(),h=s.padding??it,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=ae();if(!g)return;const u=d?30:0,b=Se(a),i=s.nodeWidth?s.nodeWidth*E:960,x=s.nodeHeight?s.nodeHeight*E:500,S=i,v=x+u;b.attr("viewBox",`0 0 ${S} ${v}`),ve(b,v,S,s.useMaxWidth);let p;try{const e=s.valueFormat||",";if(e==="$0,0")p=w(o=>"$"+O(",")(o),"valueFormat");else if(e.startsWith("$")&&e.includes(",")){const o=/\.\d+/.exec(e),f=o?o[0]:"";p=w(C=>"$"+O(","+f)(C),"valueFormat")}else if(e.startsWith("$")){const o=e.substring(1);p=w(f=>"$"+O(o||"")(f),"valueFormat")}else p=O(e)}catch(e){te.error("Error creating format function:",e),p=O(",")}const y=Q().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),M=Q().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),A=Q().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",u/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${u})`).attr("class","treemapContainer"),W=ne(g).sum(e=>e.value??0).sort((e,o)=>(o.value??0)-(e.value??0)),le=lt().size([i,x]).paddingTop(e=>e.children&&e.children.length>0?X+E:0).paddingInner(h).paddingLeft(e=>e.children&&e.children.length>0?E:0).paddingRight(e=>e.children&&e.children.length>0?E:0).paddingBottom(e=>e.children&&e.children.length>0?E:0).round(!0)(W),de=le.descendants().filter(e=>e.children&&e.children.length>0),H=V.selectAll(".treemapSection").data(de).enter().append("g").attr("class","treemapSection").attr("transform",e=>`translate(${e.x0},${e.y0})`);H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",X).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",e=>e.depth===0?"display: none;":""),H.append("clipPath").attr("id",(e,o)=>`clip-section-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-12)).attr("height",X),H.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class",(e,o)=>`treemapSection section${o}`).attr("fill",e=>y(e.data.name)).attr("fill-opacity",.6).attr("stroke",e=>M(e.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",e=>{if(e.depth===0)return"display: none;";const o=B({cssCompiledStyles:e.data.cssCompiledStyles});return o.nodeStyles+";"+o.borderStyles.join(";")}),H.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",X/2).attr("dominant-baseline","middle").text(e=>e.depth===0?"":e.data.name).attr("font-weight","bold").attr("clip-path",(e,o)=>`url(#clip-section-${a}-${o})`).attr("style",e=>{if(e.depth===0)return"display: none;";const o="dominant-baseline: middle; font-size: 12px; fill:"+A(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).each(function(e){if(e.depth===0)return;const o=U(this),f=e.data.name;o.text(f);const C=e.x1-e.x0,L=6;let T;s.showValues!==!1&&e.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),k=o.node();if(k.getComputedTextLength()>m){const $="...";let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){o.text($),k.getComputedTextLength()>m&&o.text("");break}if(o.text(z+$),k.getComputedTextLength()<=m)break}}}),s.showValues!==!1&&H.append("text").attr("class","treemapSectionValue").attr("x",e=>e.x1-e.x0-10).attr("y",X/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(e=>e.value?p(e.value):"").attr("font-style","italic").attr("style",e=>{if(e.depth===0)return"display: none;";const o="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+A(e.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")});const re=le.leaves(),F=re.length>20,ue=F?16:38,Y=F?14:28,D=F?4:8,I=F?4:6,J=F?2:4,se=F?8:10,K=F?1:2,j=V.selectAll(".treemapLeafGroup").data(re).enter().append("g").attr("class",(e,o)=>`treemapNode treemapLeafGroup leaf${o}${e.data.classSelector?` ${e.data.classSelector}`:""}x`).attr("transform",e=>`translate(${e.x0},${e.y0})`);j.append("rect").attr("width",e=>e.x1-e.x0).attr("height",e=>e.y1-e.y0).attr("class","treemapLeaf").attr("fill",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("style",e=>B({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",e=>e.parent?y(e.parent.data.name):y(e.data.name)).attr("stroke-width",3),j.append("clipPath").attr("id",(e,o)=>`clip-${a}-${o}`).append("rect").attr("width",e=>Math.max(0,e.x1-e.x0-4)).attr("height",e=>Math.max(0,e.y1-e.y0-4)),j.append("text").attr("class","treemapLabel").attr("x",e=>(e.x1-e.x0)/2).attr("y",e=>(e.y1-e.y0)/2).attr("style",e=>{const o=`text-anchor: middle; dominant-baseline: middle; font-size: ${ue}px;fill:`+A(e.data.name)+";",f=B({cssCompiledStyles:e.data.cssCompiledStyles});return o+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(e,o)=>`url(#clip-${a}-${o})`).text(e=>e.data.name).each(function(e){const o=U(this),f=e.x1-e.x0,C=e.y1-e.y0,L=o.node(),T=f-2*J,P=C-2*J;if(T<se||P<se){o.style("display","none");return}let m=parseInt(o.style("font-size"),10);const k=.6;for(;L.getComputedTextLength()>T&&m>D;)m--,o.style("font-size",`${m}px`);let N=Math.max(I,Math.min(Y,Math.round(m*k))),$=m+K+N;for(;$>P&&m>D&&(m--,N=Math.max(I,Math.min(Y,Math.round(m*k))),!(N<I&&m===D));)o.style("font-size",`${m}px`),$=m+K+N;o.style("font-size",`${m}px`),F?(m<D||P<D)&&o.style("display","none"):(L.getComputedTextLength()>T||m<D||P<m)&&o.style("display","none")}),s.showValues!==!1&&j.append("text").attr("class","treemapValue").attr("x",o=>(o.x1-o.x0)/2).attr("y",function(o){return(o.y1-o.y0)/2}).attr("style",o=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${Y}px;fill:`+A(o.data.name)+";",C=B({cssCompiledStyles:o.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(o,f)=>`url(#clip-${a}-${f})`).text(o=>o.value?p(o.value):"").each(function(o){const f=U(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=U(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(I,Math.min(Y,Math.round(T*.6)));f.style("font-size",`${m}px`);const N=(o.y1-o.y0)/2+T/2+K;f.attr("y",N);const $=o.x1-o.x0,ie=o.y1-o.y0-4,me=$-2*J;f.node().getComputedTextLength()>me||N+m>ie||m<I?f.style("display","none"):f.style("display",null)});const pe=s.diagramPadding??8;Ne(b,pe,"flowchart",(s==null?void 0:s.useMaxWidth)||!1)},"draw"),ct=w(function(t,a){return a.db.getClasses()},"getClasses"),ht={draw:ot,getClasses:ct},dt={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},ut=w(({treemap:t}={})=>{const a=ye(),l=ae(),n=ee(a,l.themeVariables),r=ee(dt,t),s=r.titleColor??n.titleColor,h=r.labelColor??n.textColor,d=r.valueColor??n.textColor;return`
2
2
  .treemapNode.section {
3
3
  stroke: ${r.sectionStrokeColor};
4
4
  stroke-width: ${r.sectionStrokeWidth};
@@ -1,3 +1,3 @@
1
- import{p as oe}from"./chunk-JWPE2WC7-B8eAVfuB.js";import{a5 as se,bc as de,b9 as le,a1 as ce,a2 as me,ba as ue,c as o,aH as g,a4 as T,b7 as xe,bg as fe,u as ge,t as he,a3 as E,S as be,b5 as P,by as S,q as pe}from"./mermaid.core-DPEwUsaj.js";import{p as ve,i as we}from"./cynefin-OW5HDTMX-Du659bmz.js";import"./index-YZNK723o.js";var D="position frame",N="frame positioned",M="position relation",C="relation positioned",ye=o(function(e){g.debug("options str",e)},"setOptions"),Pe=o(function(){return{}},"getOptions"),Se=o(function(){O(),ge()},"clear");function O(){R={}}o(O,"reset");var ke=be.eventmodeling,Me=o(()=>he({...ke,...E().eventmodeling}),"getConfig"),R={};function W(){let e=Be;const{ast:n}=R,t=A();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){R.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:450-2*10,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function A(){return s}o(A,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function V(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(V,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&a<t}).map(i=>Number.parseInt(i)))+1}o(v,"findNextAvailableIndex");function _(e,n){const t=H(e.entityIdentifier),i=V(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(_,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"};let c=`<b>${S(a,t.textMaxWidth,d)}</b>`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" ","&nbsp;")),e.dataReference){const b=n.find(y=>{var p;return y.name===((p=e.dataReference)==null?void 0:p.$refText)});b&&(r=b.dataBlockValue,r=r.substring(r.indexOf(`{
1
+ import{p as oe}from"./chunk-JWPE2WC7-CaXu9QwT.js";import{a5 as se,bc as de,b9 as le,a1 as ce,a2 as me,ba as ue,c as o,aH as g,a4 as T,b7 as xe,bg as fe,u as ge,t as he,a3 as E,S as be,b5 as P,by as S,q as pe}from"./mermaid.core-DyJzg3sN.js";import{p as ve,i as we}from"./cynefin-OW5HDTMX-DkrT2FtY.js";import"./index-tG8o31dK.js";var D="position frame",N="frame positioned",M="position relation",C="relation positioned",ye=o(function(e){g.debug("options str",e)},"setOptions"),Pe=o(function(){return{}},"getOptions"),Se=o(function(){O(),ge()},"clear");function O(){R={}}o(O,"reset");var ke=be.eventmodeling,Me=o(()=>he({...ke,...E().eventmodeling}),"getConfig"),R={};function W(){let e=Be;const{ast:n}=R,t=A();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=X(i,n.dataEntities,t);e=w(e,{$kind:D,index:a,frame:i,textProps:r});let d;q(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=w(e,{$kind:M,index:a,frame:i,sourceFrame:l})})):e=w(e,{$kind:M,index:a,frame:i})}),e={...e,sortedSwimlanesArray:$(e.swimlanes)},e}o(W,"getState");function I(e){R.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:450-2*10,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function A(){return s}o(A,"getDiagramProps");var Be={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function H(e){const n=e.split(".");if(n.length===2)return n[0]}o(H,"extractNamespace");function U(e){const n=e.split(".");return n.length===2?n[1]:e}o(U,"extractName");function V(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(V,"findSwimlaneByNamespace");function v(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&a<t}).map(i=>Number.parseInt(i)))+1}o(v,"findNextAvailableIndex");function _(e,n){const t=H(e.entityIdentifier),i=V(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:v(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:v(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:v(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(_,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=E();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function X(e,n,t){const i=E(),a=P(U(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"<br/>"};let c=`<b>${S(a,t.textMaxWidth,d)}</b>`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" ","&nbsp;")),e.dataReference){const b=n.find(y=>{var p;return y.name===((p=e.dataReference)==null?void 0:p.$refText)});b&&(r=b.dataBlockValue,r=r.substring(r.indexOf(`{
2
2
  `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=P(r,i),r=S(r,t.textMaxWidth,d),r=r.replaceAll(" ","&nbsp;"),r+="<br/>")}const m=r!==void 0;m&&(c+=`<br/><br/><code style="text-align: left; display: block;max-width:${t.textMaxWidth}px">${r}</code>`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=pe(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(X,"calculateTextProps");function G(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:N,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(G,"decidePositionFrame");function j(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(j,"calculateX");function Y(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(Y,"calculateMaxRight");function $(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o($,"sortedSwimlanesArray");function z(e,n){const t=n,i=_(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=j(a,d,r),m=c+l.width+s.boxPadding,x=Y(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=$(h.swimlanes);f.length>0&&(f[0].y=0);for(let b=1;b<f.length;b++){const y=f[b],p=f[b-1];y.y=p.y+p.height+s.swimlaneGap}return h}o(z,"evolveFramePositioned");function K(e,n){return e===0&&n.sourceFrames.length===0}o(K,"isFirstFrame");function q(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}o(q,"hasSourceFrame");function B(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(B,"findBoxByFrame");function J(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(J,"findBoxByLineIndex");function Q(e,n){const t=n;if(we(t.frame)||K(t.index,t.frame))return[];const i=B(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=B(e.boxes,t.sourceFrame):a=J(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:C,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(Q,"decidePositionRelation");function Z(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Z,"evolveRelationPositioned");var Fe={[D]:G,[M]:Q},Ee={[N]:z,[C]:Z};function ee(e,n){const t=Fe[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(ee,"decide");function te(e,n){const t=n.reduce((i,a)=>{const r=Ee[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(te,"evolve");function w(e,n){const t=ee(e,n);return te(e,t)}o(w,"dispatch");var F={getConfig:Me,setOptions:ye,getOptions:Pe,clear:Se,setAccTitle:ue,getAccTitle:me,getAccDescription:ce,setAccDescription:le,setDiagramTitle:de,getDiagramTitle:se,setAst:I,getDiagramProps:A,getState:W},Re={parse:o(async e=>{const n=await ve("eventmodeling",e);g.debug(n),F.setAst(n),oe(n,F)},"parse")},k=T(),Ae=k==null?void 0:k.eventmodeling;function ne(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(ne,"renderD3Box");function ie(e,n){return e>n}o(ie,"dirUpwards");function ae(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ie(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(x=r,u=d+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=d);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ae,"renderD3Relation");function re(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),d=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(re,"renderD3Swimlane");var $e=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+`
3
3
  `,"id:",n,t),!Ae)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=T(),l=xe(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(re(l,m.maxR,c,r)),m.boxes.forEach(ne(l,c)),m.relations.forEach(ae(l,c,x,r)),l.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),fe(void 0,l,(d==null?void 0:d.padding)??30,d==null?void 0:d.useMaxWidth)},"draw"),Te={draw:$e},De=o(e=>"","getStyles"),Ne=De,He={parser:Re,db:F,renderer:Te,styles:Ne};export{He as diagram};
@@ -1,4 +1,4 @@
1
- import{I as X}from"./chunk-2Q5K7J3B-B9wSRFQ0.js";import{p as z}from"./chunk-JWPE2WC7-B8eAVfuB.js";import{bc as O,ba as G,b9 as Y,a5 as F,a1 as P,a2 as Z,c as g,t as A,aH as E,b8 as q,F as U,a3 as L,u as j,b5 as J,a7 as K,S as Q,a$ as ee}from"./mermaid.core-DPEwUsaj.js";import{p as te}from"./cynefin-OW5HDTMX-Du659bmz.js";import"./index-YZNK723o.js";var D=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,T=/^[\s│┃]+$/,V=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function _(r){return r.some(t=>D.test(t))}g(_,"isBoxDrawingFormat");function M(r){for(const t of r){const e=S.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(`
1
+ import{I as X}from"./chunk-2Q5K7J3B-BqwsWYtg.js";import{p as z}from"./chunk-JWPE2WC7-CaXu9QwT.js";import{bc as O,ba as G,b9 as Y,a5 as F,a1 as P,a2 as Z,c as g,t as A,aH as E,b8 as q,F as U,a3 as L,u as j,b5 as J,a7 as K,S as Q,a$ as ee}from"./mermaid.core-DyJzg3sN.js";import{p as te}from"./cynefin-OW5HDTMX-DkrT2FtY.js";import"./index-tG8o31dK.js";var D=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,T=/^[\s│┃]+$/,V=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ne=" ";function _(r){return r.some(t=>D.test(t))}g(_,"isBoxDrawingFormat");function M(r){for(const t of r){const e=S.exec(t);if(e!=null&&e.index&&e.index>0)return e.index}return 4}g(M,"inferSegmentWidth");function R(r,t){return r.replace(/\bline\s+(\d+)\b/gi,(e,i)=>{const s=parseInt(i,10),o=t.get(s);return o?`line ${o}`:e})}g(R,"remapErrorLines");function H(r){const t=r.split(`
2
2
  `),e=new Map;let i=-1;for(const[d,l]of t.entries())if(l.trim()==="treeView-beta"){i=d;break}if(i===-1)return{text:r,lineMap:e};const s=[];for(let d=i+1;d<t.length;d++){const l=t[d];l.trim()===""||k.test(l)||V.test(l)||T.test(l)||s.push(l.replace(/\t/g," "))}if(!_(s))return{text:r,lineMap:e};const o=M(s),n=[];let c=0;for(let d=0;d<=i;d++)n.push(t[d]),c++,e.set(c,d+1);for(let d=i+1;d<t.length;d++){const l=t[d],u=l.trim(),a=d+1;if(u===""){n.push(l),c++,e.set(c,a);continue}if(k.test(l)){n.push(l),c++,e.set(c,a);continue}if(V.test(l)){n.push(l),c++,e.set(c,a);continue}if(T.test(l))continue;const p=l.replace(/\t/g," "),h=S.exec(p);if((h==null?void 0:h.index)!==void 0){const m=h.index,w=Math.round(m/o)+1;let f=m+1;for(;f<p.length&&re.test(p[f]);)f++;for(;f<p.length&&p[f]===" ";)f++;const v=p.slice(f).trimEnd();if(!v)throw new Error(`Line ${a}: Empty node — expected a filename or directory name after the box-drawing prefix`);const b=ne.repeat(w);n.push(b+v),c++,e.set(c,a)}else{if(/^[\s─━│┃└┗├┣]+$/.test(p))continue;if(D.test(p))n.push(l),c++,e.set(c,a);else{if(/^\s+/.test(p))throw new Error(`Line ${a}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`);n.push(l),c++,e.set(c,a)}}}return{text:n.join(`
3
3
  `),lineMap:e}}g(H,"preprocessBoxDrawing");var x=new X(()=>({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),ie=g(()=>{x.reset(),j()},"clear"),oe=g(()=>x.records.stack[0],"getRoot"),se=g(()=>x.records.cnt,"getCount"),ae=Q.treeView,ce=g(()=>A(ae,L().treeView),"getConfig"),le=g((r,t,e,i,s,o)=>{for(;r<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const n={id:x.records.cnt++,level:r,name:t,nodeType:e,icon:s,cssClass:i,description:o,children:[]};x.records.stack[x.records.stack.length-1].children.push(n),x.records.stack.push(n)},"addNode"),de={clear:ie,addNode:le,getRoot:oe,getCount:se,getConfig:ce,getAccTitle:Z,getAccDescription:P,getDiagramTitle:F,setAccDescription:Y,setAccTitle:G,setDiagramTitle:O},I=de,he=g(r=>{z(r,I);for(const t of r.nodes){const e=typeof t.indent=="number"?t.indent:0;let i=t.name;const s=i.endsWith("/");s&&(i=i.slice(0,-1));const o=s?"directory":"file",n=t.classAnnotation||void 0,c=t.iconAnnotation,d=c!==void 0?c||"none":void 0,l=t.descAnnotation||void 0,u=l?J(l,L()):void 0;I.addNode(e,i,o,n,d,u)}},"populate"),pe={parse:g(async r=>{const{text:t,lineMap:e}=H(r);try{const i=await te("treeView",t);E.debug(i),he(i)}catch(i){throw e.size>0&&i instanceof Error&&(i.message=R(i.message,e)),i}},"parse")},C={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:'<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'},file:{body:'<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'}}};function W(r,t){var s;const e=(s=t==null?void 0:t.filenameIcons)==null?void 0:s[r];if(e)return e;const i=r.lastIndexOf(".");if(i>0){const o=r.substring(i).toLowerCase(),n=t==null?void 0:t.extensionIcons;return(n==null?void 0:n[o])??(n==null?void 0:n[o.slice(1)])}}g(W,"detectIcon");function y(r,t){return r.includes(":")?r:r in C.icons||!t?`${C.prefix}:${r}`:`${t}:${r}`}g(y,"qualifyIcon");function $(r,t){if(r.icon!=="none"){if(r.icon)return y(r.icon,t.defaultIconPack);if(t.showIcons){if(r.nodeType==="file"){const e=W(r.name,t);if(e==="none")return;if(e)return y(e,t.defaultIconPack)}return`${C.prefix}:${r.nodeType==="directory"?"folder":"file"}`}}}g($,"getNodeIcon");ee([{name:C.prefix,icons:C}]);var B=14,ge=4,fe=16,ue=g(async(r,t)=>{const e=[],i=g(o=>{const n=$(o,t);n&&e.push({icon:n,node:o}),o.children.forEach(i)},"collect");i(r);const s=await Promise.all(e.map(async({icon:o,node:n})=>({id:n.id,svg:await K(o,{height:B,width:B})})));return new Map(s.map(({id:o,svg:n})=>[o,n]))},"resolveNodeIcons"),we=g((r,t,e,i,s,o)=>{var b;const n=i.append("g");let c="treeView-node-label";e.nodeType==="directory"&&(c+=" treeView-node-dir"),e.cssClass&&(c+=` ${e.cssClass}`);const d=B+ge,l=$(e,s),u=l!==void 0;l&&n.append("g").attr("class","treeView-node-icon").attr("transform",`translate(${r+s.paddingX}, ${t+s.paddingY})`).html(o.get(e.id)??"");const a=n.append("text").text(e.name).attr("dominant-baseline","middle").attr("class",c),{height:p,width:h}=a.node().getBBox(),m=p+s.paddingY*2,w=r+s.paddingX+(u?d:0);a.attr("x",w),a.attr("y",t+m/2);const f=w+h,v=h+s.paddingX*2+(u?d:0);return e.BBox={x:r,y:t,width:v,height:m},(b=e.cssClass)!=null&&b.split(/\s+/).includes("highlight")&&n.insert("rect",":first-child").attr("x",r).attr("y",t+1).attr("width",0).attr("height",m-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:e,nodeGroup:n,labelRightEdge:f,centerY:t+m/2}},"positionLabel"),N=g((r,t,e,i,s,o)=>r.append("line").attr("x1",t).attr("y1",e).attr("x2",i).attr("y2",s).attr("stroke-width",o).attr("class","treeView-node-line"),"positionLine"),me=g((r,t,e,i)=>{var u;let s=0,o=0;const n=[],c=g((a,p,h,m)=>{const w=m*(h.rowIndent+h.paddingX),f=we(w,s,p,a,h,i);n.push(f);const{height:v,width:b}=p.BBox;N(a,w-h.rowIndent,s+v/2,w,s+v/2,h.lineThickness),o=Math.max(o,w+b),s+=v},"drawNode"),d=g((a,p=0)=>{c(r,a,e,p),a.children.forEach(f=>{d(f,p+1)});const{x:h,y:m,height:w}=a.BBox;if(a.children.length){const{y:f,height:v}=a.children[a.children.length-1].BBox;N(r,h+e.paddingX,m+w,h+e.paddingX,f+v/2+e.lineThickness/2,e.lineThickness)}},"processNode");d(t);const l=n.filter(a=>a.node.description);if(l.length>0){const p=Math.max(...n.map(h=>h.labelRightEdge))+fe;for(const h of l){const w=h.nodeGroup.append("text").text(h.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",h.centerY).node().getBBox();o=Math.max(o,p+w.width+e.paddingX)}}for(const a of n)if((u=a.node.cssClass)!=null&&u.split(/\s+/).includes("highlight")){const p=a.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const h=o-a.node.BBox.x+8;p.attr("width",h),o=Math.max(o,a.node.BBox.x+h+2)}}return{totalHeight:s,totalWidth:o}},"drawTree"),ve=g(async(r,t,e,i)=>{E.debug(`Rendering treeView diagram
4
4
  `+r);const s=i.db,o=s.getRoot(),n=s.getConfig(),c=q(t),d=c.append("g");d.attr("class","tree-view");const l=await ue(o,n),{totalHeight:u,totalWidth:a}=me(d,o,n,l);c.attr("viewBox",`-${n.lineThickness/2} 0 ${a} ${u}`),U(c,u,a,n.useMaxWidth)},"draw"),xe={draw:ve},be=xe,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},Ie=g(({treeView:r})=>{const{labelFontSize:t,labelColor:e,lineColor:i,iconColor:s,descriptionColor:o,highlightBg:n,highlightStroke:c}=A(Ce,r);return`
@@ -1,4 +1,4 @@
1
- import{p as B}from"./chunk-JWPE2WC7-B8eAVfuB.js";import{c as b,t as m,b8 as C,F as S,aH as w,ba as D,a2 as T,bc as F,a5 as P,a1 as z,b9 as E,a3 as A,S as W,u as _}from"./mermaid.core-DPEwUsaj.js";import{p as N}from"./cynefin-OW5HDTMX-Du659bmz.js";import"./index-YZNK723o.js";var L=W.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=F,this.getDiagramTitle=P,this.getAccDescription=z,this.setAccDescription=E}getConfig(){const t=m({...L,...A().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,Y=b((e,t)=>{B(e,t);let s=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??(a=s+1),a!==s+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${s+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??(i=a+(d??1)-1),d??(d=i-a+1),s=i,w.debug(`Packet block ${a} - ${s} with label ${c}`);r.length<=l+1&&t.getPacket().length<M;){const[p,o]=H({start:a,end:i,bits:d,label:c},n,l);if(r.push(p),p.end+1===n*l&&(t.pushWord(r),r=[],n++),!o)break;({start:a,end:i,bits:d,label:c}=o)}}t.pushWord(r)},"populate"),H=b((e,t,s)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*s)return[e,void 0];const r=t*s-1,n=t*s;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),s=(r=x.parser)==null?void 0:r.yy;if(!(s instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,s)},"parse")},I=b((e,t,s,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),o=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(o?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())O(f,$,y,l);f.append("text").text(o).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((e,t,s,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=s*(r+l)+l;for(const o of t){const h=o.start%i*a+1,g=(o.end-o.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(o.label),!d)continue;const k=o.end===o.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(o.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(o.end)}},"drawWord"),j={draw:I},G={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=m(G,e);return`
1
+ import{p as B}from"./chunk-JWPE2WC7-CaXu9QwT.js";import{c as b,t as m,b8 as C,F as S,aH as w,ba as D,a2 as T,bc as F,a5 as P,a1 as z,b9 as E,a3 as A,S as W,u as _}from"./mermaid.core-DyJzg3sN.js";import{p as N}from"./cynefin-OW5HDTMX-DkrT2FtY.js";import"./index-tG8o31dK.js";var L=W.packet,u,v=(u=class{constructor(){this.packet=[],this.setAccTitle=D,this.getAccTitle=T,this.setDiagramTitle=F,this.getDiagramTitle=P,this.getAccDescription=z,this.setAccDescription=E}getConfig(){const t=m({...L,...A().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){_(),this.packet=[]}},b(u,"PacketDB"),u),M=1e4,Y=b((e,t)=>{B(e,t);let s=-1,r=[],n=1;const{bitsPerRow:l}=t.getConfig();for(let{start:a,end:i,bits:d,label:c}of e.blocks){if(a!==void 0&&i!==void 0&&i<a)throw new Error(`Packet block ${a} - ${i} is invalid. End must be greater than start.`);if(a??(a=s+1),a!==s+1)throw new Error(`Packet block ${a} - ${i??a} is not contiguous. It should start from ${s+1}.`);if(d===0)throw new Error(`Packet block ${a} is invalid. Cannot have a zero bit field.`);for(i??(i=a+(d??1)-1),d??(d=i-a+1),s=i,w.debug(`Packet block ${a} - ${s} with label ${c}`);r.length<=l+1&&t.getPacket().length<M;){const[p,o]=H({start:a,end:i,bits:d,label:c},n,l);if(r.push(p),p.end+1===n*l&&(t.pushWord(r),r=[],n++),!o)break;({start:a,end:i,bits:d,label:c}=o)}}t.pushWord(r)},"populate"),H=b((e,t,s)=>{if(e.start===void 0)throw new Error("start should have been set during first phase");if(e.end===void 0)throw new Error("end should have been set during first phase");if(e.start>e.end)throw new Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*s)return[e,void 0];const r=t*s-1,n=t*s;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:n,end:e.end,label:e.label,bits:e.end-n}]},"getNextFittingBlock"),x={parser:{yy:void 0},parse:b(async e=>{var r;const t=await N("packet",e),s=(r=x.parser)==null?void 0:r.yy;if(!(s instanceof v))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");w.debug(t),Y(t,s)},"parse")},I=b((e,t,s,r)=>{const n=r.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),o=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(o?0:a),k=d*c+2,f=C(t);f.attr("viewBox",`0 0 ${k} ${g}`),S(f,g,k,l.useMaxWidth);for(const[y,$]of p.entries())O(f,$,y,l);f.append("text").text(o).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((e,t,s,{rowHeight:r,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=e.append("g"),p=s*(r+l)+l;for(const o of t){const h=o.start%i*a+1,g=(o.end-o.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",r).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+r/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(o.label),!d)continue;const k=o.end===o.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(o.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(o.end)}},"drawWord"),j={draw:I},G={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},K=b(({packet:e}={})=>{const t=m(G,e);return`
2
2
  .packetByte {
3
3
  font-size: ${t.byteFontSize};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{p as I}from"./chunk-JWPE2WC7-B8eAVfuB.js";import{b9 as F,a1 as _,a5 as E,bc as D,a2 as P,ba as z,c,b8 as G,u as B,t as b,a3 as w,S as W,aH as C,ac as H,F as V}from"./mermaid.core-DPEwUsaj.js";import{p as j}from"./cynefin-OW5HDTMX-Du659bmz.js";import"./index-YZNK723o.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),U=W.radar,X=c(()=>b({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(C.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:z,getAccTitle:P,setDiagramTitle:D,getDiagramTitle:E,getAccDescription:_,setAccDescription:F},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);C.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),p=G(t),u=rt(p,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(u,n,v,o.ticks,o.graticule),nt(u,n,v,i),L(u,n,l,h,g,o.graticule,i),k(u,l,o.showLegend,i),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n<r;n++){const l=e*(n+1)/r;a.append("circle").attr("r",l).attr("class","radarGraticule")}else if(s==="polygon"){const n=t.length;for(let l=0;l<r;l++){const o=e*(l+1)/r,i=t.map((d,p)=>{const u=2*p*Math.PI/n-Math.PI/2,g=o*Math.cos(u),h=o*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n<s;n++){const l=t[n].label,o=2*n*Math.PI/s-Math.PI/2,i=Math.cos(o),d=Math.sin(o);a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*i).attr("y2",e*r.axisScaleFactor*d).attr("class","radarAxisLine");const p=i>.01?"start":i<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(u,l.curveTension)).attr("class",`radarCurve-${p}`):n==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s<e;s++){const n=a[(s-1+e)%e],l=a[s],o=a[(s+1)%e],i=a[(s+2)%e],d={x:l.x+(o.x-n.x)*t,y:l.y+(o.y-n.y)*t},p={x:o.x-(i.x-l.x)*t,y:o.y-(i.y-l.y)*t};r+=` C${d.x},${d.y} ${p.x},${p.y} ${o.x},${o.y}`}return`${r} Z`}c(S,"closedRoundCurve");function k(a,t,e,r){if(!e)return;const s=(r.width/2+r.marginRight)*3/4,n=-(r.height/2+r.marginTop)*3/4,l=20;t.forEach((o,i)=>{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const s=a[`cScale${r}`];e+=`
1
+ import{p as I}from"./chunk-JWPE2WC7-CaXu9QwT.js";import{b9 as F,a1 as _,a5 as E,bc as D,a2 as P,ba as z,c,b8 as G,u as B,t as b,a3 as w,S as W,aH as C,ac as H,F as V}from"./mermaid.core-DyJzg3sN.js";import{p as j}from"./cynefin-OW5HDTMX-DkrT2FtY.js";import"./index-tG8o31dK.js";var x={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},y=32,A={axes:[],curves:[],options:x},m=structuredClone(A),U=W.radar,X=c(()=>b({...U,...w().radar}),"getConfig"),M=c(()=>m.axes,"getAxes"),K=c(()=>m.curves,"getCurves"),N=c(()=>m.options,"getOptions"),Y=c(a=>{m.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Z=c(a=>{m.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:q(t.entries)}))},"setCurves"),q=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=M();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>{var n;return((n=s.axis)==null?void 0:n.$refText)===e.name});if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{var e,r,s,n,l;const t=a.reduce((o,i)=>(o[i.name]=i,o),{});m.options={showLegend:((e=t.showLegend)==null?void 0:e.value)??x.showLegend,ticks:((r=t.ticks)==null?void 0:r.value)??x.ticks,max:((s=t.max)==null?void 0:s.value)??x.max,min:((n=t.min)==null?void 0:n.value)??x.min,graticule:((l=t.graticule)==null?void 0:l.value)??x.graticule},m.options.ticks>y&&(C.warn(`Radar diagram ticks (${m.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`),m.options.ticks=y)},"setOptions"),Q=c(()=>{B(),m=structuredClone(A)},"clear"),$={getAxes:M,getCurves:K,getOptions:N,setAxes:Y,setCurves:Z,setOptions:J,getConfig:X,clear:Q,setAccTitle:z,getAccTitle:P,setDiagramTitle:D,getDiagramTitle:E,getAccDescription:_,setAccDescription:F},tt=c(a=>{I(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),et={parse:c(async a=>{const t=await j("radar",a);C.debug(t),tt(t)},"parse")},at=c((a,t,e,r)=>{const s=r.db,n=s.getAxes(),l=s.getCurves(),o=s.getOptions(),i=s.getConfig(),d=s.getDiagramTitle(),p=G(t),u=rt(p,i),g=o.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=o.min,v=Math.min(i.width,i.height)/2;st(u,n,v,o.ticks,o.graticule),nt(u,n,v,i),L(u,n,l,h,g,o.graticule,i),k(u,l,o.showLegend,i),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-i.height/2-i.marginTop)},"draw"),rt=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),st=c((a,t,e,r,s)=>{if(s==="circle")for(let n=0;n<r;n++){const l=e*(n+1)/r;a.append("circle").attr("r",l).attr("class","radarGraticule")}else if(s==="polygon"){const n=t.length;for(let l=0;l<r;l++){const o=e*(l+1)/r,i=t.map((d,p)=>{const u=2*p*Math.PI/n-Math.PI/2,g=o*Math.cos(u),h=o*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",i).attr("class","radarGraticule")}}},"drawGraticule"),nt=c((a,t,e,r)=>{const s=t.length;for(let n=0;n<s;n++){const l=t[n].label,o=2*n*Math.PI/s-Math.PI/2,i=Math.cos(o),d=Math.sin(o);a.append("line").attr("x1",0).attr("y1",0).attr("x2",e*r.axisScaleFactor*i).attr("y2",e*r.axisScaleFactor*d).attr("class","radarAxisLine");const p=i>.01?"start":i<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*i+g*i).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function L(a,t,e,r,s,n,l){const o=t.length,i=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==o)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/o-Math.PI/2,f=T(g,r,s,i),O=f*Math.cos(v),R=f*Math.sin(v);return{x:O,y:R}});n==="circle"?a.append("path").attr("d",S(u,l.curveTension)).attr("class",`radarCurve-${p}`):n==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(L,"drawCurves");function T(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(T,"relativeRadius");function S(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s<e;s++){const n=a[(s-1+e)%e],l=a[s],o=a[(s+1)%e],i=a[(s+2)%e],d={x:l.x+(o.x-n.x)*t,y:l.y+(o.y-n.y)*t},p={x:o.x-(i.x-l.x)*t,y:o.y-(i.y-l.y)*t};r+=` C${d.x},${d.y} ${p.x},${p.y} ${o.x},${o.y}`}return`${r} Z`}c(S,"closedRoundCurve");function k(a,t,e,r){if(!e)return;const s=(r.width/2+r.marginRight)*3/4,n=-(r.height/2+r.marginTop)*3/4,l=20;t.forEach((o,i)=>{const d=a.append("g").attr("transform",`translate(${s}, ${n+i*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${i}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(o.label)})}c(k,"drawLegend");var ot={draw:at},it=c((a,t)=>{let e="";for(let r=0;r<a.THEME_COLOR_LIMIT;r++){const s=a[`cScale${r}`];e+=`
2
2
  .radarCurve-${r} {
3
3
  color: ${s};
4
4
  fill: ${s};
@@ -1 +1 @@
1
- import{g as l,r as m,d as n}from"./chunk-GTNCS2PH-Du4_i7r3.js";import{p}from"./chunk-JWPE2WC7-B8eAVfuB.js";import{c as t,aH as o}from"./mermaid.core-DPEwUsaj.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-Du659bmz.js";import"./index-YZNK723o.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},R={parser:g,db:n,renderer:m,styles:l};export{R as diagram};
1
+ import{g as l,r as m,d as n}from"./chunk-GTNCS2PH-CwNuMbey.js";import{p}from"./chunk-JWPE2WC7-CaXu9QwT.js";import{c as t,aH as o}from"./mermaid.core-DyJzg3sN.js";import{M as u,a as f}from"./cynefin-OW5HDTMX-DkrT2FtY.js";import"./index-tG8o31dK.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},R={parser:g,db:n,renderer:m,styles:l};export{R as diagram};