@codingame/monaco-vscode-markdown-language-features-default-extension 36.2.7 → 37.1.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 (126) hide show
  1. package/index.js +237 -23
  2. package/package.json +2 -2
  3. package/resources/abnfDiagram-VCTEODGH-MFZBS7QV.js +1 -0
  4. package/resources/architecture-7GRP2DOG-KMESPJ5A.js +1 -0
  5. package/resources/architectureDiagram-5GKGNRK7-MTTZPDNG.js +36 -0
  6. package/resources/blockDiagram-NRAW4CY4-UDRMVB5I.js +129 -0
  7. package/resources/c4Diagram-UCG6FXSJ-CNUYFC6N.js +38 -0
  8. package/resources/chunk-2KBWIZHB.js +14 -0
  9. package/resources/chunk-3CEAP2V5.js +1 -0
  10. package/resources/chunk-43RBMH4Y.js +1 -0
  11. package/resources/chunk-4AUIAGYT.js +1 -0
  12. package/resources/chunk-4PRM3W7S.js +88 -0
  13. package/resources/chunk-5DJUZA4F.js +1 -0
  14. package/resources/chunk-6LQNQPBM.js +1 -0
  15. package/resources/chunk-A3DHMJKP.js +1 -0
  16. package/resources/chunk-ATDVZUJ2.js +231 -0
  17. package/resources/chunk-CBQW2LLN.js +1 -0
  18. package/resources/chunk-CCQNES6G.js +1 -0
  19. package/resources/chunk-CD5RYVNW.js +1 -0
  20. package/resources/chunk-CQFFNO72.js +1 -0
  21. package/resources/chunk-EWILYK3H.js +1 -0
  22. package/resources/chunk-EWVD6AUZ.js +15 -0
  23. package/resources/chunk-EXFMYL6U.js +1 -0
  24. package/resources/chunk-FH3BATM5.js +1 -0
  25. package/resources/chunk-FK4OKHO7.js +178 -0
  26. package/resources/chunk-FZLE27CN.js +1 -0
  27. package/resources/chunk-HRJ5UBVC.js +1 -0
  28. package/resources/chunk-IEMKBRIG.js +339 -0
  29. package/resources/chunk-IRNO36C3.js +1 -0
  30. package/resources/chunk-J4SQIVOP.js +1 -0
  31. package/resources/chunk-JAORNH2M.js +2 -0
  32. package/resources/chunk-JBQZ5UCE.js +1 -0
  33. package/resources/chunk-JFI5BOLY.js +1 -0
  34. package/resources/chunk-JXCTOEX6.js +1 -0
  35. package/resources/chunk-K2JFJOPP.js +1 -0
  36. package/resources/chunk-LK6KML2S.js +10 -0
  37. package/resources/chunk-MNHOAW4R.js +3 -0
  38. package/resources/chunk-NLCJ5AKJ.js +132 -0
  39. package/resources/chunk-OOJM4CTU.js +1 -0
  40. package/resources/chunk-R7CM4BQN.js +2 -0
  41. package/resources/chunk-RBL2QVA3.js +1 -0
  42. package/resources/chunk-SNGMH3JW.js +2 -0
  43. package/resources/chunk-TGD3YKTU.js +32 -0
  44. package/resources/chunk-TGYBLZFN.js +1 -0
  45. package/resources/chunk-U3E5RSXE.js +62 -0
  46. package/resources/chunk-U7TCJVVP.js +1 -0
  47. package/resources/chunk-WSHCWW4Q.js +2 -0
  48. package/resources/chunk-WVYKIHVG.js +1 -0
  49. package/resources/chunk-XCMS6RVA.js +1 -0
  50. package/resources/chunk-XM54GAH3.js +206 -0
  51. package/resources/chunk-YICKNY6Y.js +1 -0
  52. package/resources/chunk-YNKYB66X.js +257 -0
  53. package/resources/chunk-ZMBQGVIF.js +1 -0
  54. package/resources/chunk-ZNREFWKG.js +1 -0
  55. package/resources/chunk-ZU7JKVUR.js +168 -0
  56. package/resources/chunk-ZYRITDEB.js +72 -0
  57. package/resources/classDiagram-DTDB5LWJ-TBJLBGTZ.js +1 -0
  58. package/resources/codicon-R6HEZFPR.ttf +0 -0
  59. package/resources/cose-bilkent-JH36ORCC-7TCRTQWC.js +1 -0
  60. package/resources/cynefin-OW5HDTMX-QMEUXFXO.js +1 -0
  61. package/resources/cynefinDiagram-5FMLGOSQ-J745EYTI.js +62 -0
  62. package/resources/dagre-3AP2YEHR-CUFPL4A5.js +4 -0
  63. package/resources/diagram-S7CK7UJ4-SC5AFKXH.js +30 -0
  64. package/resources/diagram-UQ7AKVKN-3O7WQJXE.js +41 -0
  65. package/resources/diagram-VSXAHHWV-SN3VCCS5.js +3 -0
  66. package/resources/diagram-VX7I27RA-7PQJWMN5.js +24 -0
  67. package/resources/diagram-Z3DM3KII-QZ45TJFK.js +24 -0
  68. package/resources/ebnfDiagram-PWID7BFC-CBJPGG56.js +1 -0
  69. package/resources/editor.css.txt +1 -1
  70. package/resources/editor.js +137 -3431
  71. package/resources/editor.ts +587 -46
  72. package/resources/erDiagram-SSCWMZ5O-TUKYG42P.js +99 -0
  73. package/resources/eventmodeling-NTZA5JFV-MGOPW7BD.js +1 -0
  74. package/resources/extension.js +179 -172
  75. package/resources/extension.js.map +4 -4
  76. package/resources/flowDiagram-A5DVABFB-M6K5X26V.js +1 -0
  77. package/resources/ganttDiagram-EL5Y4UJY-JCSKUU2V.js +292 -0
  78. package/resources/gitGraph-4MIJSDKK-ITDCTFJT.js +1 -0
  79. package/resources/gitGraphDiagram-WWUBYQGX-RXRB5JA2.js +106 -0
  80. package/resources/index.js +3 -3
  81. package/resources/index2.js +17 -17
  82. package/resources/info-A6RAGUB7-VXIEHQAI.js +1 -0
  83. package/resources/infoDiagram-RXCK75RN-2T6V4JS2.js +2 -0
  84. package/resources/ishikawaDiagram-5VMMS53U-6WC4IGXZ.js +70 -0
  85. package/resources/journeyDiagram-EYS64GPL-PZQYT6UF.js +139 -0
  86. package/resources/kanban-definition-3QL26DDD-VYBV345J.js +89 -0
  87. package/resources/katex-QJ7O5CJ5.js +1 -0
  88. package/resources/linkPresentationProvider.ts +179 -0
  89. package/resources/markdown.css.txt +39 -0
  90. package/resources/markdownEditor.css.txt +13 -0
  91. package/resources/mermaid.core-S5KCHHL2.js +18 -0
  92. package/resources/mindmap-definition-FBJOCRG2-H3I5F4WB.js +96 -0
  93. package/resources/package.json +1 -1
  94. package/resources/package.nls.json +1 -1
  95. package/resources/package.schema.json +1 -1
  96. package/resources/packet-AYTQ26CC-WLFKOXIZ.js +1 -0
  97. package/resources/pegDiagram-XKGWAZYB-HUV4U5RU.js +1 -0
  98. package/resources/pie-WAS4IAKB-GZIMD664.js +1 -0
  99. package/resources/pieDiagram-E7YTZNPT-XOJEVCEO.js +39 -0
  100. package/resources/pre.js +1 -1
  101. package/resources/preview-dark.svg +1 -1
  102. package/resources/preview-light.svg +1 -1
  103. package/resources/quadrantDiagram-AXDQQJYC-YPPZYAGP.js +7 -0
  104. package/resources/radar-RG4KPBEZ-URG5LVGS.js +1 -0
  105. package/resources/railroad-74A4TZTK-3ZMXCKLP.js +1 -0
  106. package/resources/railroad-abnf-HS5TGJTU-LBR5MV33.js +1 -0
  107. package/resources/railroad-ebnf-LZEXJU2U-YEVF3EJR.js +1 -0
  108. package/resources/railroad-peg-WCYAUIDC-CV774YSK.js +1 -0
  109. package/resources/railroadDiagram-O6MQD6OU-YZF7JNDT.js +1 -0
  110. package/resources/requirementDiagram-EFPCY7ZU-PZ7BYTDZ.js +84 -0
  111. package/resources/sankeyDiagram-P5KCCOFB-3P5DWREA.js +40 -0
  112. package/resources/sequenceDiagram-WJ2MYXX4-O52K5NPU.js +162 -0
  113. package/resources/sizeCapture-X5ZJPWSS-PRFE7SKK.js +1 -0
  114. package/resources/stateDiagram-HBIQ2CUA-KDPYCQOT.js +1 -0
  115. package/resources/stateDiagram-v2-4QOOHH4V-QBQE56JB.js +1 -0
  116. package/resources/swimlanes-XN3QIQJK-YCLJ3KIH.js +1 -0
  117. package/resources/swimlanesDiagram-VK2B7HYN-RS7VRH6T.js +8 -0
  118. package/resources/syntaxHighlighter.ts +2 -2
  119. package/resources/timeline-definition-24CTP7MA-GQ3MCHCF.js +120 -0
  120. package/resources/treeView-Q6P3EWNA-UEXUSAGC.js +1 -0
  121. package/resources/treemap-WGGIJYW6-NFXJPDAT.js +1 -0
  122. package/resources/tsconfig.json +1 -1
  123. package/resources/vennDiagram-4TSXK5OY-PNMXQJF6.js +34 -0
  124. package/resources/wardley-WFR3VGLG-MQ6DEZYA.js +1 -0
  125. package/resources/wardleyDiagram-VM6X3IG4-46KJTB57.js +78 -0
  126. package/resources/xychartDiagram-S5SC5T6Z-NSN5W7VL.js +7 -0
@@ -0,0 +1,34 @@
1
+ import{a as Pt}from"./chunk-WVYKIHVG.js";import{a as Bt}from"./chunk-EWILYK3H.js";import{o as Vt}from"./chunk-JAORNH2M.js";import"./chunk-JBQZ5UCE.js";import{O as Dt,T as Rt,U as Ct,V as Nt,W as Ot,X as Lt,Y as Ft,Z as jt,c as Et,d as Tt,e as zt,f as lt,k as At,u as ct}from"./chunk-NLCJ5AKJ.js";import{h as it}from"./chunk-3CEAP2V5.js";import{a as w}from"./chunk-6LQNQPBM.js";import"./chunk-OOJM4CTU.js";function rt(t,n){let s=fe(t),e=s.filter(l=>ue(l,t)),i=0,r=0,o=[];if(e.length>1){let l=Wt(e);for(let u=0;u<e.length;++u){let a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){let a=e[u];r+=(f.x+a.x)*(a.y-f.y);let y={x:(a.x+f.x)/2,y:(a.y+f.y)/2},d=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){let p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),T=Math.atan2(f.x-p.x,f.y-p.y),_=T-M;_<0&&(_+=2*Math.PI);let S=T-_/2,g=U(y,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(d==null||d.width>g)&&(d={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}d!=null&&(o.push(d),i+=ht(d.circle.radius,d.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(U(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-1e-10,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ue(t,n){return n.every(s=>U(t,s)<s.radius+1e-10)}function fe(t){let n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){let i=Gt(t[s],t[e]);for(let r of i)r.parentIndex=[s,e],n.push(r)}return n}function ht(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function U(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function mt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);let e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return ht(t,e)+ht(n,i)}function Gt(t,n){let s=U(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];let r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,f=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Wt(t){let n={x:0,y:0};for(let s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function he(t,n,s,e){e=e||{};let i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s),f=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;let a=n+f,y=t(a);if(y*o>=0&&(n=a),Math.abs(f)<r||y===0)return a}return n+f}function dt(t){let n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function qt(t,n){return dt(t).map(()=>dt(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function gt(t){return Math.sqrt($(t,t))}function xt(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function Kt(t,n,s){s=s||{};let e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,y=s.sigma!==void 0?s.sigma:.5,d,b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let v=0;v<b;++v){let c=n.slice();c[v]=c[v]?c[v]*i:r,p[v+1]=c,p[v+1].fx=t(c),p[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)p[b][c]=v[c];p[b].fx=v.fx}let T=(v,c)=>v.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v<e;++v){if(p.sort(T),s.history){let x=p.map(h=>{let D=h.slice();return D.fx=h.fx,D.id=h.id,D});x.sort((h,D)=>h.id-D.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}d=0;for(let x=0;x<b;++x)d=Math.max(d,Math.abs(p[0][x]-p[1][x]));if(Math.abs(p[0].fx-p[b].fx)<o&&d<l)break;for(let x=0;x<b;++x){_[x]=0;for(let h=0;h<b;++h)_[x]+=p[h][x];_[x]/=b}let c=p[b];if(J(S,1+f,_,-f,c),S.fx=t(S),S.fx<p[0].fx)J(m,1+u,_,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let x=!1;if(S.fx>c.fx?(J(g,1+a,_,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(J(g,1-a*f,_,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):x=!0),x){if(y>=1)break;for(let h=1;h<p.length;++h)J(p[h],1-y,p[0],y,p[h]),p[h].fx=t(p[h])}}else M(S)}return p.sort(T),{fx:p[0].fx,x:p[0]}}function de(t,n,s,e,i,r,o){let l=s.fx,f=$(s.fxprime,n),u=l,a=l,y=f,d=0;i=i||1,r=r||1e-6,o=o||.1;function b(p,M,T){for(let _=0;_<16;++_)if(i=(p+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+r*i*f||u>=T)M=i;else{if(Math.abs(y)<=-o*f)return i;y*(M-p)>=0&&(M=p),p=i,T=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+r*i*f||p&&u>=a)return b(d,i,a);if(Math.abs(y)<=-o*f)return i;if(y>=0)return b(i,d,u);a=u,d=i,i*=2}return i}function ge(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()},r=n.slice(),o,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),xt(o,e.fxprime,-1);for(let a=0;a<u;++a){if(f=de(t,o,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)xt(o,e.fxprime,-1);else{J(r,1,i.fxprime,-1,e.fxprime);let y=$(e.fxprime,e.fxprime),d=Math.max(0,$(r,i.fxprime)/y);J(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(gt(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function Ht(t,n={}){n.maxIterations=n.maxIterations||500;let s=n.initialLayout||me,e=n.lossFunction||tt,i=xe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(let a of o)l.push(r[a].x),l.push(r[a].y);let u=Kt(a=>{let y={};for(let d=0;d<o.length;++d){let b=o[d];y[b]={x:a[2*d],y:a[2*d+1],radius:r[b].radius}}return e(y,i)},l,n).x;for(let a=0;a<o.length;++a){let y=o[a];r[y].x=u[2*a],r[y].y=u[2*a+1]}return r}var Yt=1e-10;function yt(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Yt?Math.abs(t-n):he(e=>mt(t,n,e)-s,0,t+n)}function xe(t,n={}){let s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){let l=new Map;for(let f of e)for(let u=0;u<f.sets.length;u++){let a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let y=u+1;y<f.sets.length;y++){let d=String(f.sets[y]),b=`${a};${d}`,p=`${d};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(let f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}let r=[],o=new Set;for(let l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){let f=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,f]))}r.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<r.length;++l){let f=r[l];for(let u=l+1;u<r.length;++u){let a=r[u];o.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function ye(t,n,s){let e=qt(n.length,n.length),i=qt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{let o=s[r.sets[0]],l=s[r.sets[1]],f=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=yt(f,u,r.size);e[o][l]=e[l][o]=a;let y=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?y=1:r.size<=1e-10&&(y=-1),i[o][l]=i[l][o]=y}),{distances:e,constraints:i}}function pe(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){let o=t[2*r],l=t[2*r+1];for(let f=r+1;f<s.length;++f){let u=t[2*f],a=t[2*f+1],y=s[r][f],d=e[r][f],b=(u-o)*(u-o)+(a-l)*(a-l),p=Math.sqrt(b),M=b-y*y;d>0&&p<=y||d<0&&p>=y||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*f]+=4*M*(u-o),n[2*f+1]+=4*M*(a-l))}}return i}function me(t,n={}){let s=ve(t,n),e=n.lossFunction||tt;if(t.length>=8){let i=be(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function be(t,n={}){let s=n.restarts||10,e=[],i={};for(let d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=ye(t,e,i),l=gt(r.map(gt))/r.length;r=r.map(d=>d.map(b=>b/l));let f=(d,b)=>pe(d,b,r,o),u=null;for(let d=0;d<s;++d){let b=dt(r.length*2).map(Math.random),p=ge(f,b,n);(!u||p.fx<u.fx)&&(u=p)}let a=u.x,y={};for(let d=0;d<e.length;++d){let b=e[d];y[b.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(let d of n.history)xt(d.x,l);return y}function ve(t,n){let s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(let y of t)if(y.sets.length===1){let d=y.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:y.size,radius:Math.sqrt(y.size/Math.PI)},i[d]=[]}t=t.filter(y=>y.sets.length===2);for(let y of t){let d=y.weight!=null?y.weight:1,b=y.sets[0],p=y.sets[1];y.size+Yt>=Math.min(e[b].size,e[p].size)&&(d=0),i[b].push({set:p,size:y.size,weight:d}),i[p].push({set:b,size:y.size,weight:d})}let r=[];Object.keys(i).forEach(y=>{let d=0;for(let b=0;b<i[y].length;++b)d+=i[y][b].size*i[y][b].weight;r.push({set:y,size:d})});function o(y,d){return d.size-y.size}r.sort(o);let l={};function f(y){return y.set in l}function u(y,d){e[d].x=y.x,e[d].y=y.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let y=1;y<r.length;++y){let d=r[y].set,b=i[d].filter(f),p=e[d];if(b.sort(o),b.length===0)throw"ERROR: missing pairwise overlap information";let M=[];for(var a=0;a<b.length;++a){let S=e[b[a].set],g=yt(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){let v=e[b[m].set],c=yt(p.radius,v.radius,b[m].size),x=Gt({x:S.x,y:S.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let T=1e50,_=M[0];for(let S of M){e[d].x=S.x,e[d].y=S.y;let g=s(e,t);g<T&&(T=g,_=S)}u(_,d)}return e}function tt(t,n){let s=0;for(let e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){let o=t[e.sets[0]],l=t[e.sets[1]];i=mt(o.radius,l.radius,U(o,l))}else i=rt(e.sets.map(o=>t[o]));let r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Xt(t,n){let s=0;for(let e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){let l=t[e.sets[0]],f=t[e.sets[1]];i=mt(l.radius,f.radius,U(l,f))}else i=rt(e.sets.map(l=>t[l]));let r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function ke(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){let i=t[0].x,r=t[0].y;for(let o of t)o.x-=i,o.y-=r}if(t.length===2&&U(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){let i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(let l of t){let f=l.x,u=l.y;l.x=r*f-o*u,l.y=o*f+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){let r=t[1].y/(1e-10+t[1].x);for(let o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function Ie(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){let o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){let o=t[i].radius+t[r].radius;U(t[i],t[r])+1e-10<o&&s(t[r],t[i])}let e=new Map;for(let i=0;i<t.length;++i){let r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function pt(t){let n=s=>{let e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Zt(t,n,s){n==null&&(n=Math.PI/2);let e=$t(t).map(u=>Object.assign({},u)),i=Ie(e);for(let u of i){ke(u,n,s);let a=pt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds,o=(r.xRange.max-r.xRange.min)/50;function l(u,a,y){if(!u)return;let d=u.bounds,b,p;if(a)b=r.xRange.max-d.xRange.min+o;else{b=r.xRange.max-d.xRange.max;let M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(b+=M)}if(y)p=r.yRange.max-d.yRange.min+o;else{p=r.yRange.max-d.yRange.max;let M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(p+=M)}for(let M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,r=pt(e);return Qt(e)}function Jt(t,n,s,e,i){let r=$t(t);n-=2*e,s-=2*e;let{xRange:o,yRange:l}=pt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){let b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(o.max-o.min),u=s/(l.max-l.min);let a=Math.min(u,f),y=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Qt(r.map(b=>({radius:a*b.radius,x:e+y+(b.x-o.min)*a,y:e+d+(b.y-l.min)*a,setid:b.setid})))}function Qt(t){let n={};for(let s of t)n[s.setid]=s;return n}function $t(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function te(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,d=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,T={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in T)return T[x];var h=T[x]=_[S];return S+=1,S>=_.length&&(S=0),h},m=Ht,v=tt;function c(x){let h=x.datum(),D=new Set;h.forEach(k=>{k.size==0&&k.sets.length==1&&D.add(k.sets[0])}),h=h.filter(k=>!k.sets.some(P=>D.has(P)));let I={},R={};if(h.length>0){let k=m(h,{lossFunction:v,distinct:b});l&&(k=Zt(k,o,d)),I=Jt(k,s,e,i,f),R=ne(I,h,M)}let G={};h.forEach(k=>{k.label&&(G[k.sets]=k.label)});function V(k){if(k.sets in G)return G[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");let N=x.select("svg");n?N.attr("viewBox",`0 0 ${s} ${e}`):N.attr("width",s).attr("height",e);let A={},C=!1;N.selectAll(".venn-area path").each(function(k){let P=this.getAttribute("d");k.sets.length==1&&P&&!b&&(C=!0,A[k.sets[0]]=we(P))});function E(k){return P=>{let et=k.sets.map(Z=>{let Y=A[Z],q=I[Z];return Y||(Y={x:s/2,y:e/2,radius:1}),q||(q={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-P)+q.x*P,y:Y.y*(1-P)+q.y*P,radius:Y.radius*(1-P)+q.radius*P}});return Ut(et,p)}}let O=N.selectAll(".venn-area").data(h,k=>k.sets),B=O.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),L=B.append("path"),F=B.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(L.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),F.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function H(k){return typeof k.transition=="function"?k.transition("venn").duration(r):k}let j=x;C&&typeof j.transition=="function"?(j=H(x),j.selectAll("path").attrTween("d",E)):j.selectAll("path").attr("d",k=>Ut(k.sets.map(P=>I[P])),p);let z=j.selectAll("text").filter(k=>k.sets in R).text(k=>V(k)).attr("x",k=>Math.floor(R[k.sets].x)).attr("y",k=>Math.floor(R[k.sets].y));u&&(C?"on"in z?z.on("end",ut(I,V)):z.each("end",ut(I,V)):z.each(ut(I,V)));let X=H(O.exit()).remove();typeof O.transition=="function"&&X.selectAll("path").attrTween("d",E);let W=X.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(F.style("font-size","0px"),z.style("font-size",y),W.style("font-size","0px")),{circles:I,textCentres:R,nodes:O,enter:B,update:j,exit:X}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Xt:x,c):v},c}function ut(t,n){return function(s){let e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),f=(r.length+o.length)/3,u=o.pop(),a=[u],y=0,d=1.1;e.textContent=null;let b=[];function p(g){let m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=o.pop(),!!u;){a.push(u);let g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}let T=.35-y*d/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${T+m*d}em`)})}}function ft(t,n,s){let e=n[0].radius-U(n[0],t);for(let i=1;i<n.length;++i){let r=n[i].radius-U(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){let r=U(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function ee(t,n,s){let e=[];for(let a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=ft(e[0],t,n);for(let a=1;a<e.length;++a){let y=ft(e[a],t,n);y>=r&&(i=e[a],r=y)}let o=Kt(a=>-1*ft({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]},f=!0;for(let a of t)if(U(l,a)>a.radius){f=!1;break}for(let a of n)if(U(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};let u={};return rt(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?ee(t,[]):Wt(u.arcs.map(a=>a.p1))}function Me(t){let n={},s=Object.keys(t);for(let e of s)n[e]=[];for(let e=0;e<s.length;e++){let i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){let l=s[o],f=t[l],u=U(r,f);u+f.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function ne(t,n,s){let e={},i=Me(t);for(let r=0;r<n.length;++r){let o=n[r].sets,l={},f={};for(let d=0;d<o.length;++d){l[o[d]]=!0;let b=i[o[d]];for(let p=0;p<b.length;++p)f[b[p]]=!0}let u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in f||a.push(t[d]);let y=ee(u,a,s);e[o]=y,y.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function Se(t,n,s){let e=[];return e.push(`
2
+ M`,t,n),e.push(`
3
+ m`,-s,0),e.push(`
4
+ a`,s,s,0,1,0,s*2,0),e.push(`
5
+ a`,s,s,0,1,0,-s*2,0),e.join(" ")}function we(t){let n=t.split(" ");return{x:Number.parseFloat(n[1]),y:Number.parseFloat(n[2]),radius:-Number.parseFloat(n[4])}}function se(t){if(t.length===0)return[];let n={};return rt(t,n),n.arcs}function ie(t,n){if(t.length===0)return"M 0 0";let s=Math.pow(10,n||0),e=n!=null?r=>Math.round(r*s)/s:r=>r;if(t.length==1){let r=t[0].circle;return Se(e(r.x),e(r.y),e(r.radius))}let i=[`
6
+ M`,e(t[0].p2.x),e(t[0].p2.y)];for(let r of t){let o=e(r.circle.radius);i.push(`
7
+ A`,o,o,0,r.large?1:0,r.sweep?1:0,e(r.p1.x),e(r.p1.y))}return i.join(" ")}function Ut(t,n){return ie(se(t),n)}function re(t,n={}){let{lossFunction:s,layoutFunction:e=Ht,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:l=600,height:f=350,padding:u=15,scaleToFit:a=!1,symmetricalTextCentre:y=!1,distinct:d,round:b=2}=n,p=e(t,{lossFunction:s==="default"||!s?tt:s==="logRatio"?Xt:s,distinct:d});i&&(p=Zt(p,r,o));let M=Jt(p,l,f,u,a),T=ne(M,t,y),_=new Map(Object.keys(M).map(m=>[m,{set:m,x:M[m].x,y:M[m].y,radius:M[m].radius}])),S=t.map(m=>{let v=m.sets.map(h=>_.get(h)),c=se(v),x=ie(c,b);return{circles:v,arcs:c,path:x,area:m,has:new Set(m.sets)}});function g(m){let v="";for(let c of S)c.has.size>m.length&&m.every(x=>c.has.has(x))&&(v+=" "+c.path);return v}return S.map(({circles:m,arcs:v,path:c,area:x})=>({data:x,text:T[x.sets],circles:m,arcs:v,path:c,distinctPath:c+g(x.sets)}))}var bt=(function(){var t=w(function(S,g,m,v){for(m=m||{},v=S.length;v--;m[S[v]]=g);return m},"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],e=[1,17],i=[1,18],r=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],o=[1,31],l=[1,39],f=[7,8,11,12,17,19,22,24,27],u=[1,57],a=[1,56],y=[1,58],d=[1,59],b=[1,60],p=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],M={trace:w(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:w(function(g,m,v,c,x,h,D){var I=h.length-1;switch(x){case 1:return h[I-1];case 2:case 3:case 4:this.$=[];break;case 5:h[I-1].push(h[I]),this.$=h[I-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=h[I];break;case 8:c.setDiagramTitle(h[I].substr(6)),this.$=h[I].substr(6);break;case 9:c.addSubsetData([h[I]],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 10:c.addSubsetData([h[I-1]],h[I],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 11:c.addSubsetData([h[I-2]],void 0,parseFloat(h[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 12:c.addSubsetData([h[I-3]],h[I-2],parseFloat(h[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 13:if(h[I].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(h[I]),c.addSubsetData(h[I],void 0,void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 14:if(h[I-1].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(h[I-1]),c.addSubsetData(h[I-1],h[I],void 0),c.setIndentMode&&c.setIndentMode(!0);break;case 15:if(h[I-2].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(h[I-2]),c.addSubsetData(h[I-2],void 0,parseFloat(h[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 16:if(h[I-3].length<2)throw new Error("union requires multiple identifiers");c.validateUnionIdentifiers&&c.validateUnionIdentifiers(h[I-3]),c.addSubsetData(h[I-3],h[I-2],parseFloat(h[I])),c.setIndentMode&&c.setIndentMode(!0);break;case 17:case 18:case 19:c.addTextData(h[I-1],h[I],void 0);break;case 20:case 21:c.addTextData(h[I-2],h[I-1],h[I]);break;case 23:c.addStyleData(h[I-1],h[I]);break;case 24:case 25:case 26:var R=c.getCurrentSets();if(!R)throw new Error("text requires set");c.addTextData(R,h[I],void 0);break;case 27:case 28:var R=c.getCurrentSets();if(!R)throw new Error("text requires set");c.addTextData(R,h[I-1],h[I]);break;case 29:case 41:this.$=[h[I]];break;case 30:case 42:this.$=[...h[I-2],h[I]];break;case 31:this.$=[h[I-2],h[I]];break;case 33:this.$=h[I].join(" ");break;case 34:this.$=[h[I]];break;case 35:h[I-1].push(h[I]),this.$=h[I-1];break;case 43:case 44:this.$=h[I];break}},"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,[2,4],{6:5}),t(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(s,[2,5]),t(s,[2,6]),t(s,[2,7]),t(s,[2,8]),{13:16,20:e,21:i},{13:20,18:19,20:e,21:i},{13:20,18:21,20:e,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:e,21:i},t(s,[2,9],{14:[1,27],15:[1,28]}),t(r,[2,43]),t(r,[2,44]),t(s,[2,13],{14:[1,29],15:[1,30],27:o}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:o},t(s,[2,22]),t(s,[2,24],{14:[1,35]}),t(s,[2,25],{14:[1,36]}),t(s,[2,26]),{20:l,25:37,26:38,27:o},t(s,[2,10],{15:[1,40]}),{16:[1,41]},t(s,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:e,21:i},t(s,[2,17],{14:[1,45]}),t(s,[2,18],{14:[1,46]}),t(s,[2,19]),t(s,[2,27]),t(s,[2,28]),t(s,[2,23],{27:[1,47]}),t(f,[2,29]),{15:[1,48]},{16:[1,49]},t(s,[2,11]),{16:[1,50]},t(s,[2,15]),t(r,[2,42]),t(s,[2,20]),t(s,[2,21]),{20:l,26:51},{16:u,20:a,21:[1,53],28:52,29:54,30:55,31:y,32:d,33:b},t(s,[2,12]),t(s,[2,16]),t(f,[2,30]),t(f,[2,31]),t(f,[2,32]),t(f,[2,33],{30:61,16:u,20:a,31:y,32:d,33:b}),t(p,[2,34]),t(p,[2,36]),t(p,[2,37]),t(p,[2,38]),t(p,[2,39]),t(p,[2,40]),t(p,[2,35])],defaultActions:{6:[2,1]},parseError:w(function(g,m){if(m.recoverable)this.trace(g);else{var v=new Error(g);throw v.hash=m,v}},"parseError"),parse:w(function(g){var m=this,v=[0],c=[],x=[null],h=[],D=this.table,I="",R=0,G=0,V=0,N=2,A=1,C=h.slice.call(arguments,1),E=Object.create(this.lexer),O={yy:{}};for(var B in this.yy)Object.prototype.hasOwnProperty.call(this.yy,B)&&(O.yy[B]=this.yy[B]);E.setInput(g,O.yy),O.yy.lexer=E,O.yy.parser=this,typeof E.yylloc>"u"&&(E.yylloc={});var L=E.yylloc;h.push(L);var F=E.options&&E.options.ranges;typeof O.yy.parseError=="function"?this.parseError=O.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function H(K){v.length=v.length-2*K,x.length=x.length-K,h.length=h.length-K}w(H,"popStack");function j(){var K;return K=c.pop()||E.lex()||A,typeof K!="number"&&(K instanceof Array&&(c=K,K=c.pop()),K=m.symbols_[K]||K),K}w(j,"lex");for(var z,X,W,k,P,et,Z={},Y,q,_t,st;;){if(W=v[v.length-1],this.defaultActions[W]?k=this.defaultActions[W]:((z===null||typeof z>"u")&&(z=j()),k=D[W]&&D[W][z]),typeof k>"u"||!k.length||!k[0]){var at="";st=[];for(Y in D[W])this.terminals_[Y]&&Y>N&&st.push("'"+this.terminals_[Y]+"'");E.showPosition?at="Parse error on line "+(R+1)+`:
8
+ `+E.showPosition()+`
9
+ Expecting `+st.join(", ")+", got '"+(this.terminals_[z]||z)+"'":at="Parse error on line "+(R+1)+": Unexpected "+(z==A?"end of input":"'"+(this.terminals_[z]||z)+"'"),this.parseError(at,{text:E.match,token:this.terminals_[z]||z,line:E.yylineno,loc:L,expected:st})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+z);switch(k[0]){case 1:v.push(z),x.push(E.yytext),h.push(E.yylloc),v.push(k[1]),z=null,X?(z=X,X=null):(G=E.yyleng,I=E.yytext,R=E.yylineno,L=E.yylloc,V>0&&V--);break;case 2:if(q=this.productions_[k[1]][1],Z.$=x[x.length-q],Z._$={first_line:h[h.length-(q||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(q||1)].first_column,last_column:h[h.length-1].last_column},F&&(Z._$.range=[h[h.length-(q||1)].range[0],h[h.length-1].range[1]]),et=this.performAction.apply(Z,[I,G,R,O.yy,k[1],x,h].concat(C)),typeof et<"u")return et;q&&(v=v.slice(0,-1*q*2),x=x.slice(0,-1*q),h=h.slice(0,-1*q)),v.push(this.productions_[k[1]][0]),x.push(Z.$),h.push(Z._$),_t=D[v[v.length-2]][v[v.length-1]],v.push(_t);break;case 3:return!0}}return!0},"parse")},T=(function(){var S={EOF:1,parseError:w(function(m,v){if(this.yy.parser)this.yy.parser.parseError(m,v);else throw new Error(m)},"parseError"),setInput:w(function(g,m){return this.yy=m||this.yy||{},this._input=g,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:w(function(){var g=this._input[0];this.yytext+=g,this.yyleng++,this.offset++,this.match+=g,this.matched+=g;var m=g.match(/(?:\r\n?|\n).*/g);return m?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),g},"input"),unput:w(function(g){var m=g.length,v=g.split(/(?:\r\n?|\n)/g);this._input=g+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-m),this.offset-=m;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),v.length-1&&(this.yylineno-=v.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:v?(v.length===c.length?this.yylloc.first_column:0)+c[c.length-v.length].length-v[0].length:this.yylloc.first_column-m},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-m]),this.yyleng=this.yytext.length,this},"unput"),more:w(function(){return this._more=!0,this},"more"),reject:w(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
10
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:w(function(g){this.unput(this.match.slice(g))},"less"),pastInput:w(function(){var g=this.matched.substr(0,this.matched.length-this.match.length);return(g.length>20?"...":"")+g.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:w(function(){var g=this.match;return g.length<20&&(g+=this._input.substr(0,20-g.length)),(g.substr(0,20)+(g.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:w(function(){var g=this.pastInput(),m=new Array(g.length+1).join("-");return g+this.upcomingInput()+`
11
+ `+m+"^"},"showPosition"),test_match:w(function(g,m){var v,c,x;if(this.options.backtrack_lexer&&(x={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(x.yylloc.range=this.yylloc.range.slice(0))),c=g[0].match(/(?:\r\n?|\n).*/g),c&&(this.yylineno+=c.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+g[0].length},this.yytext+=g[0],this.match+=g[0],this.matches=g,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(g[0].length),this.matched+=g[0],v=this.performAction.call(this,this.yy,this,m,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),v)return v;if(this._backtrack){for(var h in x)this[h]=x[h];return!1}return!1},"test_match"),next:w(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var g,m,v,c;this._more||(this.yytext="",this.match="");for(var x=this._currentRules(),h=0;h<x.length;h++)if(v=this._input.match(this.rules[x[h]]),v&&(!m||v[0].length>m[0].length)){if(m=v,c=h,this.options.backtrack_lexer){if(g=this.test_match(v,x[h]),g!==!1)return g;if(this._backtrack){m=!1;continue}else return!1}else if(!this.options.flex)break}return m?(g=this.test_match(m,x[c]),g!==!1?g:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
12
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:w(function(){var m=this.next();return m||this.lex()},"lex"),begin:w(function(m){this.conditionStack.push(m)},"begin"),popState:w(function(){var m=this.conditionStack.length-1;return m>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:w(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:w(function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},"topState"),pushState:w(function(m){this.begin(m)},"pushState"),stateStackSize:w(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:w(function(m,v,c,x){var h=x;switch(c){case 0:break;case 1:break;case 2:break;case 3:if(m.getIndentMode&&m.getIndentMode())return m.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:m.setIndentMode&&m.setIndentMode(!1),this.begin("INITIAL"),this.unput(v.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(m.consumeIndentText)m.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return v.yytext=v.yytext.slice(2,-2),14;break;case 17:return v.yytext=v.yytext.slice(1,-1).trim(),14;break;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};return S})();M.lexer=T;function _(){this.yy={}}return w(_,"Parser"),_.prototype=M,M.Parser=_,new _})();bt.parser=bt;var Ee=bt,vt=[],kt=[],It=[],Mt=new Set,St,wt=!1,Te=w((t,n,s)=>{let e=ot(t).sort(),i=s??10/Math.pow(t.length,2);St=e,e.length===1&&Mt.add(e[0]),vt.push({sets:e,size:i,label:n?nt(n):void 0})},"addSubsetData"),ze=w(()=>vt,"getSubsetData"),nt=w(t=>{let n=t.trim();return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n},"normalizeText"),Ae=w(t=>t&&nt(t),"normalizeStyleValue"),De=w((t,n,s)=>{let e=nt(n);kt.push({sets:ot(t).sort(),id:e,label:s?nt(s):void 0})},"addTextData"),Re=w((t,n)=>{let s=ot(t).sort(),e={};for(let[i,r]of n)e[i]=Ae(r)??r;It.push({targets:s,styles:e})},"addStyleData"),Ce=w(()=>It,"getStyleData"),ot=w(t=>t.map(n=>nt(n)),"normalizeIdentifierList"),Ne=w(t=>{let s=ot(t).filter(e=>!Mt.has(e));if(s.length>0)throw new Error(`unknown set identifier: ${s.join(", ")}`)},"validateUnionIdentifiers"),Oe=w(()=>kt,"getTextData"),Le=w(()=>St,"getCurrentSets"),Fe=w(()=>wt,"getIndentMode"),je=w(t=>{wt=t},"setIndentMode"),Pe=At.venn;function oe(){return Vt(Pe,ct().venn)}w(oe,"getConfig");var Ve=w(()=>{Rt(),vt.length=0,kt.length=0,It.length=0,Mt.clear(),St=void 0,wt=!1},"customClear"),Be={getConfig:oe,clear:Ve,setAccTitle:Ct,getAccTitle:Nt,setDiagramTitle:Ft,getDiagramTitle:jt,getAccDescription:Lt,setAccDescription:Ot,addSubsetData:Te,getSubsetData:ze,addTextData:De,addStyleData:Re,validateUnionIdentifiers:Ne,getTextData:Oe,getStyleData:Ce,getCurrentSets:Le,getIndentMode:Fe,setIndentMode:je},qe=w(t=>`
13
+ .venn-title {
14
+ font-size: 32px;
15
+ fill: ${t.vennTitleTextColor};
16
+ font-family: ${t.fontFamily};
17
+ }
18
+
19
+ .venn-circle text {
20
+ font-size: 48px;
21
+ font-family: ${t.fontFamily};
22
+ }
23
+
24
+ .venn-intersection text {
25
+ font-size: 48px;
26
+ fill: ${t.vennSetTextColor};
27
+ font-family: ${t.fontFamily};
28
+ }
29
+
30
+ .venn-text-node {
31
+ font-family: ${t.fontFamily};
32
+ color: ${t.vennSetTextColor};
33
+ }
34
+ `,"getStyles"),Ue=qe;function ae(t){let n=new Map;for(let s of t){let e=s.targets.join("|"),i=n.get(e);i?Object.assign(i,s.styles):n.set(e,{...s.styles})}return n}w(ae,"buildStyleByKey");var Ge=w((t,n,s,e)=>{let i=e.db,r=i.getConfig?.(),{themeVariables:o,look:l,handDrawnSeed:f}=ct(),u=l==="handDrawn",a=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),y=i.getDiagramTitle?.(),d=i.getSubsetData(),b=i.getTextData(),p=ae(i.getStyleData()),M=ce(d),T=r?.width??800,_=r?.height??450,g=T/1600,m=y?48*g:0,v=o.primaryTextColor??o.textColor,c=Pt(n);c.attr("viewBox",`0 0 ${T} ${_}`),y&&c.append("text").text(y).attr("class","venn-title").attr("font-size",`${32*g}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*g).style("fill",o.vennTitleTextColor||o.titleColor);let x=it(document.createElement("div")),h=te().width(T).height(_-m);x.datum(M).call(h);let D=u?Bt.svg(x.select("svg").node()):void 0,I=re(M,{width:T,height:_-m,padding:r?.padding??15}),R=new Map;for(let A of I){let C=Q([...A.data.sets].sort());R.set(C,A)}b.length>0&&le(r,R,x,b,g,p);let G=Et(o.background||"#f4f4f4");x.selectAll(".venn-circle").each(function(A,C){let E=it(this),B=Q([...A.sets].sort()),L=p.get(B),F=L?.fill||a[C%a.length]||o.primaryColor;E.classed(`venn-set-${C%8}`,!0);let H=L?.["fill-opacity"]??.1,j=L?.stroke||F,z=L?.["stroke-width"]||`${5*g}`;if(u&&D){let W=R.get(B);if(W&&W.circles.length>0){let k=W.circles[0],P=D.circle(k.x,k.y,k.radius*2,{roughness:.7,seed:f,fill:lt(F,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+C*60,stroke:j,strokeWidth:parseFloat(String(z))});E.select("path").remove(),E.node()?.insertBefore(P,E.select("text").node())}}else E.select("path").style("fill",F).style("fill-opacity",H).style("stroke",j).style("stroke-width",z).style("stroke-opacity",.95);let X=L?.color||(G?Tt(F,30):zt(F,30));E.select("text").style("font-size",`${48*g}px`).style("fill",X)}),u&&D?x.selectAll(".venn-intersection").each(function(A){let C=it(this),O=Q([...A.sets].sort()),B=p.get(O),L=B?.fill;if(L){let F=C.select("path"),H=F.attr("d");if(H){let j=D.path(H,{roughness:.7,seed:f,fill:lt(L,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),z=F.node();z?.parentNode?.insertBefore(j,z),F.remove()}}else C.select("path").style("fill-opacity",0);C.select("text").style("font-size",`${48*g}px`).style("fill",B?.color??o.vennSetTextColor??v)}):(x.selectAll(".venn-intersection text").style("font-size",`${48*g}px`).style("fill",A=>{let E=Q([...A.sets].sort());return p.get(E)?.color??o.vennSetTextColor??v}),x.selectAll(".venn-intersection path").style("fill-opacity",A=>{let E=Q([...A.sets].sort());return p.get(E)?.fill?1:0}).style("fill",A=>{let E=Q([...A.sets].sort());return p.get(E)?.fill??"transparent"}));let V=c.append("g").attr("transform",`translate(0, ${m})`),N=x.select("svg").node();if(N&&"childNodes"in N)for(let A of[...N.childNodes])V.node()?.appendChild(A);Dt(c,_,T,r?.useMaxWidth??!0)},"draw");function Q(t){return t.join("|")}w(Q,"stableSetsKey");function le(t,n,s,e,i,r){let o=t?.useDebugLayout??!1,f=s.select("svg").append("g").attr("class","venn-text-nodes"),u=new Map;for(let a of e){let y=Q(a.sets),d=u.get(y);d?d.push(a):u.set(y,[a])}for(let[a,y]of u.entries()){let d=n.get(a);if(!d?.text)continue;let b=d.text.x,p=d.text.y,M=Math.min(...d.circles.map(N=>N.radius)),T=Math.min(...d.circles.map(N=>N.radius-Math.hypot(b-N.x,p-N.y))),_=Number.isFinite(T)?Math.max(0,T):0;_===0&&Number.isFinite(M)&&(_=M*.6);let S=f.append("g").attr("class","venn-text-area").attr("font-size",`${40*i}px`);o&&S.append("circle").attr("class","venn-text-debug-circle").attr("cx",b).attr("cy",p).attr("r",_).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);let g=Math.max(80*i,_*2*.95),m=Math.max(60*i,_*2*.95),x=(d.data.label&&d.data.label.length>0?Math.min(32*i,_*.25):0)+(y.length<=2?30*i:0),h=b-g/2,D=p-m/2+x,I=Math.max(1,Math.ceil(Math.sqrt(y.length))),R=Math.max(1,Math.ceil(y.length/I)),G=g/I,V=m/R;for(let[N,A]of y.entries()){let C=N%I,E=Math.floor(N/I),O=h+G*(C+.5),B=D+V*(E+.5);o&&S.append("rect").attr("class","venn-text-debug-cell").attr("x",h+G*C).attr("y",D+V*E).attr("width",G).attr("height",V).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);let L=G*.9,F=V*.9,H=S.append("foreignObject").attr("class","venn-text-node-fo").attr("width",L).attr("height",F).attr("x",O-L/2).attr("y",B-F/2).attr("overflow","visible"),j=r.get(A.id)?.color,z=H.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(A.label??A.id);j&&z.style("color",j)}}}w(le,"renderTextNodes");function ce(t){let n=new Set(t.map(i=>[...i.sets].sort().join("|"))),s=new Map(t.filter(i=>i.sets.length===1&&i.size!==void 0).map(i=>[i.sets[0],i.size])),e=[];for(let i of t){if(i.sets.length<3)continue;let r=[...i.sets].sort();for(let o=0;o<r.length-1;o++)for(let l=o+1;l<r.length;l++){let f=[r[o],r[l]],u=f.join("|");if(!n.has(u)){n.add(u);let a=s.get(f[0]),y=s.get(f[1]),d=a!==void 0&&y!==void 0?Math.min(a,y)/4:2.5;e.push({sets:f,size:d,label:""})}}}return e.length>0?[...t,...e]:t}w(ce,"ensurePairwiseSubsets");var We={draw:Ge},tn={parser:Ee,db:Be,renderer:We,styles:Ue};export{tn as diagram};
@@ -0,0 +1 @@
1
+ import{a as e,b as r}from"./chunk-FZLE27CN.js";import"./chunk-FK4OKHO7.js";import"./chunk-OOJM4CTU.js";export{e as WardleyModule,r as createWardleyServices};
@@ -0,0 +1,78 @@
1
+ import{a as lt}from"./chunk-J4SQIVOP.js";import{a as ct}from"./chunk-MNHOAW4R.js";import"./chunk-ZMBQGVIF.js";import{a as dt}from"./chunk-WVYKIHVG.js";import"./chunk-5DJUZA4F.js";import"./chunk-YICKNY6Y.js";import"./chunk-R7CM4BQN.js";import"./chunk-SNGMH3JW.js";import"./chunk-EXFMYL6U.js";import"./chunk-WSHCWW4Q.js";import"./chunk-ZNREFWKG.js";import"./chunk-FZLE27CN.js";import"./chunk-CD5RYVNW.js";import"./chunk-JFI5BOLY.js";import"./chunk-IRNO36C3.js";import"./chunk-43RBMH4Y.js";import"./chunk-K2JFJOPP.js";import"./chunk-CCQNES6G.js";import"./chunk-FK4OKHO7.js";import{o as _}from"./chunk-JAORNH2M.js";import"./chunk-JBQZ5UCE.js";import{O as tt,T as et,U as at,V as rt,W as ot,X as nt,Y as st,Z as it,_ as D,i as K,u as Q}from"./chunk-NLCJ5AKJ.js";import{b as V}from"./chunk-3CEAP2V5.js";import{a as u}from"./chunk-6LQNQPBM.js";import"./chunk-OOJM4CTU.js";var G=u((e,n)=>{let r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${n} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),A=u((e,n,r)=>({x:G(n,`${r} evolution`),y:G(e,`${r} visibility`)}),"toCoordinates"),pt=u(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),Rt=u(e=>{if(!e?.startsWith("+"))return{};let r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),Ot=u((e,n)=>{if(lt(e,n),e.size&&n.setSize(e.size.width,e.size.height),e.evolution){let r=e.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),x=e.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);n.updateAxes({stages:r,stageBoundaries:x})}if(e.anchors.forEach(r=>{let x=A(r.visibility,r.evolution,`Anchor "${r.name}"`);n.addNode(r.name,r.name,x.x,x.y,"anchor")}),e.components.forEach(r=>{let x=A(r.visibility,r.evolution,`Component "${r.name}"`),a=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,d=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,m=r.decorator?.strategy;n.addNode(r.name,r.name,x.x,x.y,"component",a,d,r.inertia,m)}),e.notes.forEach(r=>{let x=A(r.visibility,r.evolution,`Note "${r.text}"`);n.addNote(r.text,x.x,x.y)}),e.pipelines.forEach(r=>{let x=n.getNode(r.parent);if(!x||typeof x.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);let a=x.y;n.startPipeline(r.parent),r.components.forEach(d=>{let m=`${r.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,F=G(d.evolution,`Pipeline component "${d.name}" evolution`);n.addNode(m,d.name,F,a,"pipeline-component",C,g),n.addPipelineComponent(r.parent,m)})}),e.links.forEach(r=>{let x=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-.")),a=pt(r.fromPort)??pt(r.toPort),{flow:d,label:m}=Rt(r.arrow);!a&&d&&(a=d);let C=r.linkLabel,g=m??C;n.addLink(n.resolveNodeId(r.from),n.resolveNodeId(r.to),x,g,a)}),e.evolves.forEach(r=>{let x=n.getNode(r.component);if(x?.y!==void 0){let a=G(r.target,`Evolve target for "${r.component}"`);n.addTrend(r.component,a,x.y)}}),e.annotations.length>0){let r=e.annotations[0],x=A(r.x,r.y,"Annotations box");n.setAnnotationsBox(x.x,x.y)}e.annotation.forEach(r=>{let x=A(r.x,r.y,`Annotation ${r.number}`);n.addAnnotation(r.number,[{x:x.x,y:x.y}],r.text)}),e.accelerators.forEach(r=>{let x=A(r.x,r.y,`Accelerator "${r.name}"`);n.addAccelerator(r.name,x.x,x.y)}),e.deaccelerators.forEach(r=>{let x=A(r.x,r.y,`Deaccelerator "${r.name}"`);n.addDeaccelerator(r.name,x.x,x.y)})},"populateDb"),ft={parser:{yy:void 0},parse:u(async e=>{let n=await ct("wardley",e);V.debug(n);let r=ft.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ot(n,r)},"parse")},Wt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{u(this,"WardleyBuilder")}addNode(e){let n=this.nodes.get(e.id)??{id:e.id,label:e.label},r={...n,...e,className:e.className??n.className,labelOffsetX:e.labelOffsetX??n.labelOffsetX,labelOffsetY:e.labelOffsetY??n.labelOffsetY};this.nodes.set(e.id,r)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let n=this.nodes.get(e);n&&(n.isPipelineParent=!0)}addPipelineComponent(e,n){let r=this.pipelines.get(e);r&&r.componentIds.push(n);let x=this.nodes.get(n);x&&(x.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,n){this.annotationsBox={x:e,y:n}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,n){this.size={width:e,height:n}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[n,r]of this.nodes)if(r.label===e)return n;return e}build(){let e=[];for(let n of this.nodes.values()){if(typeof n.x!="number"||typeof n.y!="number")throw new Error(`Node "${n.label}" is missing coordinates`);e.push(n)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},k=new Wt;function ht(){return D()["wardley-beta"]}u(ht,"getConfig");function xt(e,n,r,x,a,d,m,C,g){k.addNode({id:e,label:n,x:r,y:x,className:a,labelOffsetX:d,labelOffsetY:m,inertia:C,sourceStrategy:g})}u(xt,"addNode");function gt(e,n,r=!1,x,a){k.addLink({source:e,target:n,dashed:r,label:x,flow:a})}u(gt,"addLink");function yt(e,n,r){k.addTrend({nodeId:e,targetX:n,targetY:r})}u(yt,"addTrend");function ut(e,n,r){k.addAnnotation({number:e,coordinates:n,text:r})}u(ut,"addAnnotation");function mt(e,n,r){k.addNote({text:e,x:n,y:r})}u(mt,"addNote");function wt(e,n,r){k.addAccelerator({name:e,x:n,y:r})}u(wt,"addAccelerator");function kt(e,n,r){k.addDeaccelerator({name:e,x:n,y:r})}u(kt,"addDeaccelerator");function bt(e,n){k.setAnnotationsBox(e,n)}u(bt,"setAnnotationsBox");function $t(e,n){k.setSize(e,n)}u($t,"setSize");function vt(e){k.startPipeline(e)}u(vt,"startPipeline");function Pt(e,n){k.addPipelineComponent(e,n)}u(Pt,"addPipelineComponent");function Ct(e){k.setAxes(e)}u(Ct,"updateAxes");function St(e){return k.getNode(e)}u(St,"getNode");function Mt(e){return k.resolveNodeId(e)}u(Mt,"resolveNodeId");function Nt(){return k.build()}u(Nt,"getWardleyData");function zt(){k.clear(),et()}u(zt,"clear");var Dt={getConfig:ht,addNode:xt,addLink:gt,addTrend:yt,addAnnotation:ut,addNote:mt,addAccelerator:wt,addDeaccelerator:kt,setAnnotationsBox:bt,setSize:$t,startPipeline:vt,addPipelineComponent:Pt,updateAxes:Ct,getNode:St,resolveNodeId:Mt,getWardleyData:Nt,clear:zt,setAccTitle:at,getAccTitle:rt,setDiagramTitle:st,getDiagramTitle:it,getAccDescription:nt,setAccDescription:ot},Gt=["Genesis","Custom Built","Product","Commodity"],qt=u(()=>{let{themeVariables:e}=D();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),Ht=u(()=>{let e=D()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),jt=u((e,n,r,x)=>{V.debug(`Rendering Wardley map
2
+ `+e);let a=Ht(),d=qt(),m=a.nodeRadius*1.6,C=x.db,g=C.getWardleyData(),F=C.getDiagramTitle(),S=g.size?.width??a.width,b=g.size?.height??a.height,E=dt(n);E.selectAll("*").remove(),tt(E,b,S,a.useMaxWidth),E.attr("viewBox",`0 0 ${S} ${b}`);let v=E.append("g").attr("class","wardley-map"),q=E.append("defs");q.append("marker").attr("id",`arrow-${n}`).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("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${n}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${n}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);let Y=S-a.padding*2,I=b-a.padding*2;F&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(F);let z=u(t=>a.padding+t/100*Y,"projectX"),L=u(t=>b-a.padding-t/100*I,"projectY"),R=v.append("g").attr("class","wardley-axes");R.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),R.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);let Lt=g.axes.xLabel??"Evolution",Tt=g.axes.yLabel??"Visibility";R.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+Y/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Lt),R.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+I/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+I/2})`).text(Tt);let B=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:Gt;if(B.length>0){let t=v.append("g").attr("class","wardley-stages"),s=g.axes.stageBoundaries,o=[];if(s&&s.length===B.length){let i=0;s.forEach(p=>{o.push({start:i,end:p}),i=p})}else{let i=1/B.length;B.forEach((p,l)=>{o.push({start:l*i,end:(l+1)*i})})}B.forEach((i,p)=>{let l=o[p],f=a.padding+l.start*Y,h=a.padding+l.end*Y,y=(f+h)/2;p>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){let t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){let o=s/4,i=a.padding+Y*o;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-I*o).attr("y2",b-a.padding-I*o).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}let c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:z(t.x),y:L(t.y),node:t})}),g.pipelines.length>0){let t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(o=>{if(o.componentIds.length===0)return;let i=o.componentIds.map(h=>({id:h,pos:c.get(h),node:g.nodes.find(y=>y.id===h)})).filter(h=>h.pos&&h.node).sort((h,y)=>h.node.x-y.node.x);for(let h=0;h<i.length-1;h++){let y=i[h],w=i[h+1];s.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",y.pos.x).attr("y1",y.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let p=1/0,l=-1/0,f=0;if(o.componentIds.forEach(h=>{let y=c.get(h);y&&(p=Math.min(p,y.x),l=Math.max(l,y.x),f=y.y)}),p!==1/0&&l!==-1/0){let y=a.nodeRadius*4,w=f-y/2,P=c.get(o.nodeId);if(P){let N=(p+l)/2;P.x=N,P.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",w).attr("width",l-p+30).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let Z=v.append("g").attr("class","wardley-links"),U=new Map;g.pipelines.forEach(t=>{U.set(t.nodeId,new Set(t.componentIds))});let J=g.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||U.get(t.target)?.has(t.source)));Z.selectAll("line").data(J).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{let s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f);return s.x+l/h*p}).attr("y1",t=>{let s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f);return s.y+f/h*p}).attr("x2",t=>{let s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=s.x-o.x,f=s.y-o.y,h=Math.sqrt(l*l+f*f);return o.x+l/h*p}).attr("y2",t=>{let s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=s.x-o.x,f=s.y-o.y,h=Math.sqrt(l*l+f*f);return o.y+f/h*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${n})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${n})`:null),Z.selectAll("text").data(J.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{let s=c.get(t.source),o=c.get(t.target),i=(s.x+o.x)/2,p=o.y-s.y,l=o.x-s.x,f=Math.sqrt(l*l+p*p),h=8,y=p/f;return i+y*h}).attr("y",t=>{let s=c.get(t.source),o=c.get(t.target),i=(s.y+o.y)/2,p=o.x-s.x,l=o.y-s.y,f=Math.sqrt(p*p+l*l),h=8,y=-p/f;return i+y*h}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{let s=c.get(t.source),o=c.get(t.target),i=(s.x+o.x)/2,p=(s.y+o.y)/2,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f),y=8,w=f/h,P=-l/h,N=i+w*y,O=p+P*y,X=Math.atan2(f,l)*180/Math.PI;return(X>90||X<-90)&&(X+=180),`rotate(${X} ${N} ${O})`}).text(t=>t.label);let At=v.append("g").attr("class","wardley-trends"),Xt=g.trends.map(t=>{let s=c.get(t.nodeId);if(!s)return null;let o=z(t.targetX),i=L(t.targetY),p=o-s.x,l=i-s.y,f=Math.sqrt(p*p+l*l),h=a.nodeRadius+2,y=f>h?o-p/f*h:o,w=f>h?i-l/f*h:i;return{origin:s,targetX:o,targetY:i,adjustedX2:y,adjustedY2:w}}).filter(t=>t!==null);At.selectAll("line").data(Xt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${n})`);let M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let T=M.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);let H=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{let s=c.get(t.id),o=t.isPipelineParent?m/2+15:a.nodeRadius+15;return t.sourceStrategy&&(o+=a.nodeRadius+10),s.x+o}).attr("y1",t=>{let s=c.get(t.id),o=t.isPipelineParent?m:a.nodeRadius*2;return s.y-o/2}).attr("x2",t=>{let s=c.get(t.id),o=t.isPipelineParent?m/2+15:a.nodeRadius+15;return t.sourceStrategy&&(o+=a.nodeRadius+10),s.x+o}).attr("y2",t=>{let s=c.get(t.id),o=t.isPipelineParent?m:a.nodeRadius*2;return s.y+o/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{let s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let o=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(o+=10);let i=t.labelOffsetX??o;return s.x+i}).attr("y",t=>{let s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let o=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(o-=10);let i=t.labelOffsetY??o;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){let t=v.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(s=>{let o=s.coordinates.map(i=>({x:z(i.x),y:L(i.y)}));if(o.length>1)for(let i=0;i<o.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",o[i].x).attr("y1",o[i].y).attr("x2",o[i+1].x).attr("y2",o[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");o.forEach(i=>{let p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),g.annotationsBox){let s=z(g.annotationsBox.x),o=L(g.annotationsBox.y),i=10,p=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),h=[...g.annotations].filter(w=>w.text).sort((w,P)=>w.number-P.number),y=[];if(h.forEach((w,P)=>{let N=f.append("text").attr("x",s+i).attr("y",o+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);y.push(N)}),y.length>0){let w=0,P=0;y.forEach(j=>{let W=j.node(),Bt=W.getComputedTextLength();w=Math.max(w,Bt);let Ft=W.getBBox();P=Math.max(P,Ft.height)});let N=w+i*2+105,O=h.length*p+i*2+P/2,X=a.padding,Et=S-a.padding-N,Yt=a.padding,It=b-a.padding-O;s=Math.max(X,Math.min(s,Et)),o=Math.max(Yt,Math.min(o,It)),y.forEach((j,W)=>{j.attr("x",s+i).attr("y",o+i+(W+1)*p)}),f.insert("rect","text").attr("x",s).attr("y",o).attr("width",N).attr("height",O).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){let t=v.append("g").attr("class","wardley-notes");g.notes.forEach(s=>{let o=z(s.x),i=L(s.y);t.append("text").attr("x",o).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(g.accelerators.length>0){let t=v.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(s=>{let o=z(s.x),i=L(s.y),p=60,l=30,f=20,h=`
3
+ M ${o} ${i-l/2}
4
+ L ${o+p-f} ${i-l/2}
5
+ L ${o+p-f} ${i-l/2-8}
6
+ L ${o+p} ${i}
7
+ L ${o+p-f} ${i+l/2+8}
8
+ L ${o+p-f} ${i+l/2}
9
+ L ${o} ${i+l/2}
10
+ Z
11
+ `;t.append("path").attr("d",h).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),t.append("text").attr("x",o+p/2).attr("y",i+l/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.name)})}if(g.deaccelerators.length>0){let t=v.append("g").attr("class","wardley-deaccelerators");g.deaccelerators.forEach(s=>{let o=z(s.x),i=L(s.y),p=60,l=30,f=20,h=`
12
+ M ${o+p} ${i-l/2}
13
+ L ${o+f} ${i-l/2}
14
+ L ${o+f} ${i-l/2-8}
15
+ L ${o} ${i}
16
+ L ${o+f} ${i+l/2+8}
17
+ L ${o+f} ${i+l/2}
18
+ L ${o+p} ${i+l/2}
19
+ Z
20
+ `;t.append("path").attr("d",h).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),t.append("text").attr("x",o+p/2).attr("y",i+l/2+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.name)})}},"draw"),Vt={draw:jt},_t=u(({wardley:e}={})=>{let n=K(),r=Q(),x=_(n,r.themeVariables),a=_(x.wardley,e);return`
21
+ .wardley-background {
22
+ fill: ${a.backgroundColor};
23
+ }
24
+ .wardley-axes line, .wardley-axes path {
25
+ stroke: ${a.axisColor};
26
+ }
27
+ .wardley-axis-label {
28
+ fill: ${a.axisTextColor};
29
+ }
30
+ .wardley-stage-label {
31
+ fill: ${a.axisTextColor};
32
+ }
33
+ .wardley-grid line {
34
+ stroke: ${a.gridColor};
35
+ }
36
+ .wardley-node circle {
37
+ fill: ${a.componentFill};
38
+ stroke: ${a.componentStroke};
39
+ }
40
+ .wardley-node-label {
41
+ fill: ${a.componentLabelColor};
42
+ }
43
+ .wardley-link {
44
+ stroke: ${a.linkStroke};
45
+ }
46
+ .wardley-link--dashed {
47
+ stroke-dasharray: 4 4;
48
+ }
49
+ .wardley-link-label {
50
+ fill: ${a.axisTextColor};
51
+ }
52
+ .wardley-trend line {
53
+ stroke: ${a.evolutionStroke};
54
+ }
55
+ .wardley-annotation-line {
56
+ stroke: ${a.annotationStroke};
57
+ }
58
+ .wardley-annotation circle {
59
+ fill: ${a.annotationFill};
60
+ stroke: ${a.annotationStroke};
61
+ }
62
+ .wardley-annotation text {
63
+ fill: ${a.annotationTextColor};
64
+ }
65
+ .wardley-annotations-box rect {
66
+ fill: ${a.annotationFill};
67
+ stroke: ${a.annotationStroke};
68
+ }
69
+ .wardley-annotations-box text {
70
+ fill: ${a.annotationTextColor};
71
+ }
72
+ .wardley-pipeline-box {
73
+ stroke: ${a.componentStroke};
74
+ }
75
+ .wardley-notes text {
76
+ fill: ${a.axisTextColor};
77
+ }
78
+ `},"styles"),re={parser:ft,db:Dt,renderer:Vt,styles:_t};export{re as diagram};
@@ -0,0 +1,7 @@
1
+ import{a as Gt}from"./chunk-WVYKIHVG.js";import{c as qt}from"./chunk-ZYRITDEB.js";import"./chunk-4AUIAGYT.js";import{o as yt}from"./chunk-JAORNH2M.js";import"./chunk-JBQZ5UCE.js";import{H as Ft,O as Wt,T as Xt,U as Nt,V as Yt,W as Ht,X as $t,Y as Ut,Z as ft,i as Ot,k as Vt,u as nt}from"./chunk-NLCJ5AKJ.js";import{H as bt,b as dt,n as pt,o as mt}from"./chunk-3CEAP2V5.js";import{a}from"./chunk-6LQNQPBM.js";import"./chunk-OOJM4CTU.js";var At=(function(){var t=a(function(z,r,h,g){for(h=h||{},g=z.length;g--;h[z[g]]=r);return h},"o"),e=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],u=[1,6],l=[1,7],d=[1,5,10,12,14,16,18,19,21,23,36,37,38],p=[1,25],S=[1,26],R=[1,28],T=[1,29],B=[1,30],W=[1,31],X=[1,32],v=[1,33],V=[1,34],N=[1,35],Y=[1,36],b=[1,37],E=[1,43],c=[1,42],L=[1,47],I=[1,50],A=[1,10,12,14,16,18,19,21,23,36,37,38],$=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],D=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],Q=[1,65],C=[26,28],y={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:a(function(r,h,g,x,k,o,U){var f=o.length-1;switch(k){case 5:x.setOrientation(o[f]);break;case 9:x.setDiagramTitle(o[f].text.trim());break;case 12:x.setLineData({text:"",type:"text"},o[f]);break;case 13:x.setLineData(o[f-1],o[f]);break;case 14:x.setBarData({text:"",type:"text"},o[f]);break;case 15:x.setBarData(o[f-1],o[f]);break;case 16:this.$=o[f].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=o[f].trim(),x.setAccDescription(this.$);break;case 19:this.$=o[f-1];break;case 20:case 30:this.$=[o[f-2],...o[f]];break;case 21:case 31:this.$=[o[f]];break;case 22:this.$={value:Number(o[f-1]),label:o[f]};break;case 23:this.$={value:Number(o[f]),label:""};break;case 24:x.setXAxisTitle(o[f]);break;case 25:x.setXAxisTitle(o[f-1]);break;case 26:x.setXAxisTitle({type:"text",text:""});break;case 27:x.setXAxisBand(o[f]);break;case 28:x.setXAxisRangeData(Number(o[f-2]),Number(o[f]));break;case 29:this.$=o[f-1];break;case 32:x.setYAxisTitle(o[f]);break;case 33:x.setYAxisTitle(o[f-1]);break;case 34:x.setYAxisTitle({type:"text",text:""});break;case 35:x.setYAxisRangeData(Number(o[f-2]),Number(o[f]));break;case 39:this.$={text:o[f],type:"text"};break;case 40:this.$={text:o[f],type:"text"};break;case 41:this.$={text:o[f],type:"markdown"};break;case 42:this.$=o[f];break;case 43:this.$=o[f-1]+""+o[f];break}},"anonymous"),table:[t(e,i,{3:1,4:2,7:4,5:s,36:n,37:u,38:l}),{1:[3]},t(e,i,{4:2,7:4,3:8,5:s,36:n,37:u,38:l}),t(e,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:n,37:u,38:l}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(d,[2,36]),t(d,[2,37]),t(d,[2,38]),{1:[2,1]},t(e,i,{4:2,7:4,3:21,5:s,36:n,37:u,38:l}),{1:[2,3]},t(d,[2,5]),t(e,[2,7],{4:22,36:n,37:u,38:l}),{11:23,30:p,39:24,40:S,41:27,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b},{11:39,13:38,24:E,29:c,30:p,31:40,32:41,39:24,40:S,41:27,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b},{11:45,15:44,29:L,30:p,35:46,39:24,40:S,41:27,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b},{11:49,17:48,24:I,30:p,39:24,40:S,41:27,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b},{11:52,17:51,24:I,30:p,39:24,40:S,41:27,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b},{20:[1,53]},{22:[1,54]},t(A,[2,18]),{1:[2,2]},t(A,[2,8]),t(A,[2,9]),t($,[2,39],{41:55,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b}),t($,[2,40]),t($,[2,41]),t(D,[2,42]),t(D,[2,44]),t(D,[2,45]),t(D,[2,46]),t(D,[2,47]),t(D,[2,48]),t(D,[2,49]),t(D,[2,50]),t(D,[2,51]),t(D,[2,52]),t(D,[2,53]),t(A,[2,10]),t(A,[2,24],{32:41,31:56,24:E,29:c}),t(A,[2,26]),t(A,[2,27]),{33:[1,57]},{11:59,30:p,34:58,39:24,40:S,41:27,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b},t(A,[2,11]),t(A,[2,32],{35:60,29:L}),t(A,[2,34]),{33:[1,61]},t(A,[2,12]),{17:62,24:I},{25:63,27:64,29:Q},t(A,[2,14]),{17:66,24:I},t(A,[2,16]),t(A,[2,17]),t(D,[2,43]),t(A,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},t(A,[2,33]),{29:[1,70]},t(A,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},t(C,[2,23],{30:[1,73]}),t(A,[2,15]),t(A,[2,28]),t(A,[2,29]),{11:59,30:p,34:74,39:24,40:S,41:27,42:R,43:T,44:B,45:W,46:X,47:v,48:V,49:N,50:Y,51:b},t(A,[2,35]),t(A,[2,19]),{25:75,27:64,29:Q},t(C,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:a(function(r,h){if(h.recoverable)this.trace(r);else{var g=new Error(r);throw g.hash=h,g}},"parseError"),parse:a(function(r){var h=this,g=[0],x=[],k=[null],o=[],U=this.table,f="",it=0,Et=0,It=0,fe=2,Mt=1,pe=o.slice.call(arguments,1),_=Object.create(this.lexer),G={yy:{}};for(var lt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,lt)&&(G.yy[lt]=this.yy[lt]);_.setInput(r,G.yy),G.yy.lexer=_,G.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var ct=_.yylloc;o.push(ct);var me=_.options&&_.options.ranges;typeof G.yy.parseError=="function"?this.parseError=G.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function be(M){g.length=g.length-2*M,k.length=k.length-M,o.length=o.length-M}a(be,"popStack");function Bt(){var M;return M=x.pop()||_.lex()||Mt,typeof M!="number"&&(M instanceof Array&&(x=M,M=x.pop()),M=h.symbols_[M]||M),M}a(Bt,"lex");for(var P,gt,q,O,ze,ut,K={},st,H,zt,at;;){if(q=g[g.length-1],this.defaultActions[q]?O=this.defaultActions[q]:((P===null||typeof P>"u")&&(P=Bt()),O=U[q]&&U[q][P]),typeof O>"u"||!O.length||!O[0]){var xt="";at=[];for(st in U[q])this.terminals_[st]&&st>fe&&at.push("'"+this.terminals_[st]+"'");_.showPosition?xt="Parse error on line "+(it+1)+`:
2
+ `+_.showPosition()+`
3
+ Expecting `+at.join(", ")+", got '"+(this.terminals_[P]||P)+"'":xt="Parse error on line "+(it+1)+": Unexpected "+(P==Mt?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(xt,{text:_.match,token:this.terminals_[P]||P,line:_.yylineno,loc:ct,expected:at})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+P);switch(O[0]){case 1:g.push(P),k.push(_.yytext),o.push(_.yylloc),g.push(O[1]),P=null,gt?(P=gt,gt=null):(Et=_.yyleng,f=_.yytext,it=_.yylineno,ct=_.yylloc,It>0&&It--);break;case 2:if(H=this.productions_[O[1]][1],K.$=k[k.length-H],K._$={first_line:o[o.length-(H||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(H||1)].first_column,last_column:o[o.length-1].last_column},me&&(K._$.range=[o[o.length-(H||1)].range[0],o[o.length-1].range[1]]),ut=this.performAction.apply(K,[f,Et,it,G.yy,O[1],k,o].concat(pe)),typeof ut<"u")return ut;H&&(g=g.slice(0,-1*H*2),k=k.slice(0,-1*H),o=o.slice(0,-1*H)),g.push(this.productions_[O[1]][0]),k.push(K.$),o.push(K._$),zt=U[g[g.length-2]][g[g.length-1]],g.push(zt);break;case 3:return!0}}return!0},"parse")},F=(function(){var z={EOF:1,parseError:a(function(h,g){if(this.yy.parser)this.yy.parser.parseError(h,g);else throw new Error(h)},"parseError"),setInput:a(function(r,h){return this.yy=h||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var h=r.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:a(function(r){var h=r.length,g=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var k=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[k[0],k[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(r){this.unput(this.match.slice(r))},"less"),pastInput:a(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var r=this.pastInput(),h=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
5
+ `+h+"^"},"showPosition"),test_match:a(function(r,h){var g,x,k;if(this.options.backtrack_lexer&&(k={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(k.yylloc.range=this.yylloc.range.slice(0))),x=r[0].match(/(?:\r\n?|\n).*/g),x&&(this.yylineno+=x.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:x?x[x.length-1].length-x[x.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+r[0].length},this.yytext+=r[0],this.match+=r[0],this.matches=r,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(r[0].length),this.matched+=r[0],g=this.performAction.call(this,this.yy,this,h,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),g)return g;if(this._backtrack){for(var o in k)this[o]=k[o];return!1}return!1},"test_match"),next:a(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var r,h,g,x;this._more||(this.yytext="",this.match="");for(var k=this._currentRules(),o=0;o<k.length;o++)if(g=this._input.match(this.rules[k[o]]),g&&(!h||g[0].length>h[0].length)){if(h=g,x=o,this.options.backtrack_lexer){if(r=this.test_match(g,k[o]),r!==!1)return r;if(this._backtrack){h=!1;continue}else return!1}else if(!this.options.flex)break}return h?(r=this.test_match(h,k[x]),r!==!1?r:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
6
+ `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:a(function(){var h=this.next();return h||this.lex()},"lex"),begin:a(function(h){this.conditionStack.push(h)},"begin"),popState:a(function(){var h=this.conditionStack.length-1;return h>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(h){return h=this.conditionStack.length-1-Math.abs(h||0),h>=0?this.conditionStack[h]:"INITIAL"},"topState"),pushState:a(function(h){this.begin(h)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(function(h,g,x,k){var o=k;switch(x){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return z})();y.lexer=F;function w(){this.yy={}}return a(w,"Parser"),w.prototype=y,y.Parser=w,new w})();At.parser=At;var ye=At;function ot(t){return t.type==="bar"}a(ot,"isBarPlot");function rt(t){return t.type==="band"}a(rt,"isBandAxisData");function Z(t){return t.type==="linear"}a(Z,"isLinearAxisData");var St=class{constructor(t){this.parentGroup=t}static{a(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,e){if(!this.parentGroup)return{width:t.reduce((n,u)=>Math.max(u.length,n),0)*e,height:e};let i={width:0,height:0},s=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",e);for(let n of t){let u=qt(s,1,n),l=u?u.width:n.length*e,d=u?u.height:e;i.width=Math.max(i.width,l),i.height=Math.max(i.height,d)}return s.remove(),i}},jt=.7,Qt=.2,Kt=class{constructor(t,e,i,s){this.axisConfig=t,this.title=e,this.textDimensionCalculator=i,this.axisThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{a(this,"BaseAxis")}setRange(t){this.range=t,this.axisPosition==="left"||this.axisPosition==="right"?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){let t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){jt*this.getTickDistance()>this.outerPadding*2&&(this.outerPadding=Math.floor(jt*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let e=t.height;if(this.axisConfig.showAxisLine&&e>this.axisConfig.axisLineWidth&&(e-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let i=this.getLabelDimension(),s=Qt*t.width;this.outerPadding=Math.min(i.width/2,s);let n=i.height;this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0&&(n=Math.max(n,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*i.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*i.height))),n+=this.axisConfig.labelPadding*2,this.labelTextHeight=i.height,n<=e&&(e-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&e>=this.axisConfig.tickLength&&(this.showTick=!0,e-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let i=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),s=i.height+this.axisConfig.titlePadding*2;this.titleTextHeight=i.height,s<=e&&(e-=s,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-e}calculateSpaceIfDrawnVertical(t){let e=t.width;if(this.axisConfig.showAxisLine&&e>this.axisConfig.axisLineWidth&&(e-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let i=this.getLabelDimension(),s=Qt*t.height;this.outerPadding=Math.min(i.height/2,s);let n=i.width+this.axisConfig.labelPadding*2;n<=e&&(e-=n,this.showLabel=!0)}if(this.axisConfig.showTick&&e>=this.axisConfig.tickLength&&(this.showTick=!0,e-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let i=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),s=i.height+this.axisConfig.titlePadding*2;this.titleTextHeight=i.height,s<=e&&(e-=s,this.showTitle=!0)}this.boundingRect.width=t.width-e,this.boundingRect.height=t.height}calculateSpace(t){return this.axisPosition==="left"||this.axisPosition==="right"?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateOffsetByRotation(t){let e=this.normalizedLabelRotationInRad;return e===0?0:Math.sin(e)*this.getLabelDimension()[t]/2}getDrawableElementsForLeftAxis(){let t=[];if(this.showAxisLine){let e=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${e},${this.boundingRect.y} L ${e},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(e=>({text:e.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(e),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let e=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(i=>({path:`M ${e},${this.getScaleValue(i)} L ${e-this.axisConfig.tickLength},${this.getScaleValue(i)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){let t=[];if(this.showAxisLine){let e=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${e} L ${this.boundingRect.x+this.boundingRect.width},${e}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let e=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(i=>({path:`M ${this.getScaleValue(i)},${e} L ${this.getScaleValue(i)},${e+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){let t=[];if(this.showAxisLine){let e=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${e} L ${this.boundingRect.x+this.boundingRect.width},${e}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(e=>({text:e.toString(),x:this.getScaleValue(e),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let e=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(i=>({path:`M ${this.getScaleValue(i)},${e+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(i)},${e+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");return this.axisPosition==="bottom"?this.getDrawableElementsForBottomAxis():this.axisPosition==="top"?this.getDrawableElementsForTopAxis():[]}},Ae=class extends Kt{static{a(this,"BandAxis")}constructor(t,e,i,s,n){super(t,s,n,e),this.categories=i,this.scale=pt().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=pt().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),dt.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},ke=class extends Kt{static{a(this,"LinearAxis")}constructor(t,e,i,s,n){super(t,s,n,e),this.domain=i,this.scale=mt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];this.axisPosition==="left"&&t.reverse(),this.scale=mt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}};function kt(t,e,i,s){let n=new St(s);return rt(t)?new Ae(e,i,t.categories,t.title,n):new ke(e,i,[t.min,t.max],t.title,n)}a(kt,"getAxis");var we=class{constructor(t,e,i,s){this.textDimensionCalculator=t,this.chartConfig=e,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{a(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){let e=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),i=Math.max(e.width,t.width),s=e.height+2*this.chartConfig.titlePadding;return e.width<=i&&e.height<=s&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=i,this.boundingRect.height=s,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}};function Zt(t,e,i,s){let n=new St(s);return new we(n,t,e,i)}a(Zt,"getChartTitleComponent");var Ce=.75,Se=.5,Re=.35;function wt(t){return{fontSize:t,markerSize:t*Ce,markerSpacing:t*Re,itemSpacing:t*Se}}a(wt,"getLegendLayout");var _e=class{constructor(t,e,i,s){this.textDimensionCalculator=t,this.chartConfig=e,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{a(this,"ChartLegend")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter(p=>p.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};let{fontSize:e,markerSize:i,markerSpacing:s,itemSpacing:n}=wt(this.chartConfig.legendFontSize),u=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map(p=>p.title),e),l=this.chartConfig.legendPadding*2+i+s+u.width,d=this.chartConfig.legendPadding*2+this.visiblePlots.length*e+(this.visiblePlots.length-1)*n;return l<=t.width&&d<=t.height?(this.boundingRect.width=l,this.boundingRect.height=d):(this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];let{fontSize:t,markerSize:e,markerSpacing:i,itemSpacing:s}=wt(this.chartConfig.legendFontSize),n=t+s,u=this.boundingRect.x+this.chartConfig.legendPadding,l=this.boundingRect.y+this.chartConfig.legendPadding,d=[],p=[];for(let[S,R]of this.visiblePlots.entries())if(ot(R))d.push({x:u,y:l+S*n,width:e,height:e,fill:R.fill,strokeFill:R.fill,strokeWidth:0});else{let T=l+S*n+e/2;p.push({path:`M ${u},${T} L ${u+e},${T}`,strokeFill:R.strokeFill,strokeWidth:R.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:d},{groupTexts:["legend","markers"],type:"path",data:p},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((S,R)=>({text:S.title,x:u+e+i,y:l+R*n+e/2,fill:this.chartThemeConfig.legendTextColor,fontSize:t,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function Jt(t,e,i,s){let n=new St(s);return new _e(n,t,e,i)}a(Jt,"getChartLegendComponent");var Te=class{constructor(t,e,i,s,n){this.plotData=t,this.xAxis=e,this.yAxis=i,this.orientation=s,this.plotIndex=n}static{a(this,"LinePlot")}getDrawableElement(){let t=this.plotData.data.map(s=>[this.xAxis.getScaleValue(s[0]),this.yAxis.getScaleValue(s[1])]),e;if(this.orientation==="horizontal"?e=bt().y(s=>s[0]).x(s=>s[1])(t):e=bt().x(s=>s[0]).y(s=>s[1])(t),!e)return[];let i=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:e,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let u=[];for(let[l,[d,p]]of t.entries()){let S=this.plotData.pointLabels[l];S&&(this.orientation==="horizontal"?u.push({x:p+10,y:d,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0}):u.push({x:d,y:p-10,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0}))}u.length>0&&i.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:u})}return i}},De=class{constructor(t,e,i,s,n,u){this.barData=t,this.boundingRect=e,this.xAxis=i,this.yAxis=s,this.orientation=n,this.plotIndex=u}static{a(this,"BarPlot")}getDrawableElement(){let t=this.barData.data.map(n=>[this.xAxis.getScaleValue(n[0]),this.yAxis.getScaleValue(n[1])]),i=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*(1-.05),s=i/2;return this.orientation==="horizontal"?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:this.boundingRect.x,y:n[0]-s,height:i,width:n[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(n=>({x:n[0]-s,y:n[1],width:i,height:this.boundingRect.y+this.boundingRect.height-n[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},Pe=class{constructor(t,e,i){this.chartConfig=t,this.chartData=e,this.chartThemeConfig=i,this.boundingRect={x:0,y:0,width:0,height:0}}static{a(this,"BasePlot")}setAxes(t,e){this.xAxis=t,this.yAxis=e}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let t=[];for(let[e,i]of this.chartData.plots.entries())switch(i.type){case"line":{let s=new Te(i,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,e);t.push(...s.getDrawableElement())}break;case"bar":{let s=new De(i,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,e);t.push(...s.getDrawableElement())}break}return t}};function te(t,e,i){return new Pe(t,e,i)}a(te,"getPlotComponent");var Le=class{constructor(t,e,i,s){this.chartConfig=t,this.chartData=e,this.componentStore={title:Zt(t,e,i,s),plot:te(t,e,i),legend:Jt(t,e,i,s),xAxis:kt(e.xAxis,t.xAxis,{titleColor:i.xAxisTitleColor,labelColor:i.xAxisLabelColor,tickColor:i.xAxisTickColor,axisLineColor:i.xAxisLineColor},s),yAxis:kt(e.yAxis,t.yAxis,{titleColor:i.yAxisTitleColor,labelColor:i.yAxisLabelColor,tickColor:i.yAxisTickColor,axisLineColor:i.yAxisLineColor},s)}}static{a(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,e=this.chartConfig.height,i=0,s=0,n={width:0,height:0},u=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),l=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),d=this.componentStore.plot.calculateSpace({width:u,height:l});t-=d.width,e-=d.height,d=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:e}),s=d.height,e-=d.height,this.componentStore.xAxis.setAxisPosition("bottom"),d=this.componentStore.xAxis.calculateSpace({width:t,height:e}),e-=d.height,this.componentStore.yAxis.setAxisPosition("left"),d=this.componentStore.yAxis.calculateSpace({width:t,height:e}),i=d.width,t-=d.width,n=this.componentStore.legend.calculateSpace({width:t,height:l}),t-=n.width,t>0&&(u+=t,t=0),e>0&&(l+=e,e=0),this.componentStore.plot.calculateSpace({width:u,height:l}),this.componentStore.plot.setBoundingBoxXY({x:i,y:s}),this.componentStore.legend.setBoundingBoxXY({x:i+u,y:s+Math.max((l-n.height)/2,0)}),this.componentStore.xAxis.setRange([i,i+u]),this.componentStore.xAxis.setBoundingBoxXY({x:i,y:s+l}),this.componentStore.yAxis.setRange([s,s+l]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:s}),this.chartData.plots.some(p=>ot(p))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,e=this.chartConfig.height,i=0,s=0,n=0,u={width:0,height:0},l=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),d=Math.floor(e*this.chartConfig.plotReservedSpacePercent/100),p=this.componentStore.plot.calculateSpace({width:l,height:d});t-=p.width,e-=p.height,p=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:e}),i=p.height,e-=p.height,this.componentStore.xAxis.setAxisPosition("left"),p=this.componentStore.xAxis.calculateSpace({width:t,height:e}),t-=p.width,s=p.width,this.componentStore.yAxis.setAxisPosition("top"),p=this.componentStore.yAxis.calculateSpace({width:t,height:e}),e-=p.height,n=i+p.height,u=this.componentStore.legend.calculateSpace({width:t,height:d}),t-=u.width,t>0&&(l+=t,t=0),e>0&&(d+=e,e=0),this.componentStore.plot.calculateSpace({width:l,height:d}),this.componentStore.plot.setBoundingBoxXY({x:s,y:n}),this.componentStore.legend.setBoundingBoxXY({x:s+l,y:n+Math.max((d-u.height)/2,0)}),this.componentStore.yAxis.setRange([s,s+l]),this.componentStore.yAxis.setBoundingBoxXY({x:s,y:i}),this.componentStore.xAxis.setRange([n,n+d]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:n}),this.chartData.plots.some(S=>ot(S))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){this.chartConfig.chartOrientation==="horizontal"?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let e of Object.values(this.componentStore))t.push(...e.getDrawableElements());return t}},ve=class{static{a(this,"XYChartBuilder")}static build(t,e,i,s){return new Le(t,e,i,s).getDrawableElement()}},J=0,ee,tt=Tt(),et=_t(),m=Dt(),Ct=et.plotColorPalette.split(",").map(t=>t.trim()),ht=!1,Rt=!1;function _t(){let t=Ot(),e=nt();return yt(t.xyChart,e.themeVariables.xyChart)}a(_t,"getChartDefaultThemeConfig");function Tt(){let t=nt();return yt(Vt.xyChart,t.xyChart)}a(Tt,"getChartDefaultConfig");function Dt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}a(Dt,"getChartDefaultData");function j(t){let e=nt();return Ft(t.trim(),e)}a(j,"textSanitizer");function ie(t){ee=t}a(ie,"setTmpSVGG");function se(t){t==="horizontal"?tt.chartOrientation="horizontal":tt.chartOrientation="vertical"}a(se,"setOrientation");function ae(t){m.xAxis.title=j(t.text)}a(ae,"setXAxisTitle");function Pt(t,e){m.xAxis={type:"linear",title:m.xAxis.title,min:t,max:e},ht=!0}a(Pt,"setXAxisRangeData");function ne(t){m.xAxis={type:"band",title:m.xAxis.title,categories:t.map(e=>j(e.text))},ht=!0}a(ne,"setXAxisBand");function oe(t){m.yAxis.title=j(t.text)}a(oe,"setYAxisTitle");function re(t,e){m.yAxis={type:"linear",title:m.yAxis.title,min:t,max:e},Rt=!0}a(re,"setYAxisRangeData");function he(t){let e=Math.min(...t),i=Math.max(...t),s=Z(m.yAxis)?m.yAxis.min:1/0,n=Z(m.yAxis)?m.yAxis.max:-1/0;m.yAxis={type:"linear",title:m.yAxis.title,min:Math.min(s,e),max:Math.max(n,i)}}a(he,"setYAxisRangeFromPlotData");function Lt(t){let e=[];if(t.length===0)return e;if(!ht){let i=Z(m.xAxis)?m.xAxis.min:1/0,s=Z(m.xAxis)?m.xAxis.max:-1/0;Pt(Math.min(i,1),Math.max(s,t.length))}if(rt(m.xAxis)&&t.length>m.xAxis.categories.length&&(t=t.slice(0,m.xAxis.categories.length)),Rt||he(t),rt(m.xAxis)&&(e=m.xAxis.categories.map((i,s)=>[i,t[s]])),Z(m.xAxis)){let i=m.xAxis.min,s=m.xAxis.max;if(t.length===1)e=[[`${i}`,t[0]]];else{let n=(s-i)/(t.length-1);e=t.map((u,l)=>[`${i+l*n}`,u])}}return e}a(Lt,"transformDataWithoutCategory");function vt(t){return Ct[t===0?0:t%Ct.length]}a(vt,"getPlotColorFromPalette");function le(t,e){let i=e.map(l=>l.value),s=e.map(l=>l.label?j(l.label):""),n=Lt(i),u=s.some(l=>l!=="");m.plots.push({type:"line",title:j(t.text),strokeFill:vt(J),strokeWidth:2,data:n,...u?{pointLabels:s}:{}}),J++}a(le,"setLineData");function ce(t,e){let i=e.map(n=>n.value),s=Lt(i);m.plots.push({type:"bar",title:j(t.text),fill:vt(J),data:s}),J++}a(ce,"setBarData");function ge(){if(m.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return m.title=ft(),ve.build(tt,m,et,ee)}a(ge,"getDrawableElem");function ue(){return et}a(ue,"getChartThemeConfig");function xe(){return tt}a(xe,"getChartConfig");function de(){return m}a(de,"getXYChartData");var Ee=a(function(){Xt(),J=0,tt=Tt(),m=Dt(),et=_t(),Ct=et.plotColorPalette.split(",").map(t=>t.trim()),ht=!1,Rt=!1},"clear"),Ie={getDrawableElem:ge,clear:Ee,setAccTitle:Nt,getAccTitle:Yt,setDiagramTitle:Ut,getDiagramTitle:ft,getAccDescription:$t,setAccDescription:Ht,setOrientation:se,setXAxisTitle:ae,setXAxisRangeData:Pt,setXAxisBand:ne,setYAxisTitle:oe,setYAxisRangeData:re,setLineData:le,setBarData:ce,setTmpSVGG:ie,getChartThemeConfig:ue,getChartConfig:xe,getXYChartData:de},Me=a((t,e,i,s)=>{let n=s.db,u=n.getChartThemeConfig(),l=n.getChartConfig(),d=n.getXYChartData().plots[0].data.map(b=>b[1]);function p(b){return b==="top"?"text-before-edge":"middle"}a(p,"getDominantBaseLine");function S(b){return b==="left"?"start":b==="right"?"end":"middle"}a(S,"getTextAnchor");function R(b){return`translate(${b.x}, ${b.y}) rotate(${b.rotation||0})`}a(R,"getTextTransformation"),dt.debug(`Rendering xychart chart
7
+ `+t);let T=Gt(e),B=T.append("g").attr("class","main"),W=B.append("rect").attr("width",l.width).attr("height",l.height).attr("class","background");Wt(T,l.height,l.width,!0),T.attr("viewBox",`0 0 ${l.width} ${l.height}`),W.attr("fill",u.backgroundColor),n.setTmpSVGG(T.append("g").attr("class","mermaid-tmp-group"));let X=n.getDrawableElem(),v={};function V(b){let E=B,c="";for(let[L]of b.entries()){let I=B;L>0&&v[c]&&(I=v[c]),c+=b[L],E=v[c],E||(E=v[c]=I.append("g").attr("class",b[L]))}return E}a(V,"getGroup");for(let b of X){if(b.data.length===0)continue;let E=V(b.groupTexts);switch(b.type){case"rect":if(E.selectAll("rect").data(b.data).enter().append("rect").attr("x",c=>c.x).attr("y",c=>c.y).attr("width",c=>c.width).attr("height",c=>c.height).attr("fill",c=>c.fill).attr("stroke",c=>c.strokeFill).attr("stroke-width",c=>c.strokeWidth),l.showDataLabel){let c=l.showDataLabelOutsideBar;if(l.chartOrientation==="horizontal"){let L=function(y,F){let{data:w,label:z}=y;return F*z.length*I<=w.width-A};var N=L;a(L,"fitsHorizontally");let I=.7,A=10,$=b.data.map((y,F)=>({data:y,label:d[F].toString()})).filter(y=>y.data.width>0&&y.data.height>0),D=$.map(y=>{let{data:F}=y,w=F.height*.7;for(;!L(y,w)&&w>0;)w-=1;return w}),Q=Math.floor(Math.min(...D)),C=a(y=>c?y.data.x+y.data.width+A:y.data.x+y.data.width-A,"determineLabelXPosition");E.selectAll("text").data($).enter().append("text").attr("x",C).attr("y",y=>y.data.y+y.data.height/2).attr("text-anchor",c?"start":"end").attr("dominant-baseline","middle").attr("fill",u.dataLabelColor).attr("font-size",`${Q}px`).text(y=>y.label)}else{let L=function(C,y,F){let{data:w,label:z}=C,h=y*z.length*.7,g=w.x+w.width/2,x=g-h/2,k=g+h/2,o=x>=w.x&&k<=w.x+w.width,U=w.y+F+y<=w.y+w.height;return o&&U};var Y=L;a(L,"fitsInBar");let I=10,A=b.data.map((C,y)=>({data:C,label:d[y].toString()})).filter(C=>C.data.width>0&&C.data.height>0),$=A.map(C=>{let{data:y,label:F}=C,w=y.width/(F.length*.7);for(;!L(C,w,I)&&w>0;)w-=1;return w}),D=Math.floor(Math.min(...$)),Q=a(C=>c?C.data.y-I:C.data.y+I,"determineLabelYPosition");E.selectAll("text").data(A).enter().append("text").attr("x",C=>C.data.x+C.data.width/2).attr("y",Q).attr("text-anchor","middle").attr("dominant-baseline",c?"auto":"hanging").attr("fill",u.dataLabelColor).attr("font-size",`${D}px`).text(C=>C.label)}}break;case"text":E.selectAll("text").data(b.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",c=>c.fill).attr("font-size",c=>c.fontSize).attr("dominant-baseline",c=>p(c.verticalPos)).attr("text-anchor",c=>S(c.horizontalPos)).attr("transform",c=>R(c)).text(c=>c.text);break;case"path":E.selectAll("path").data(b.data).enter().append("path").attr("d",c=>c.path).attr("fill",c=>c.fill?c.fill:"none").attr("stroke",c=>c.strokeFill).attr("stroke-width",c=>c.strokeWidth);break}}},"draw"),Be={draw:Me},Ge={parser:ye,db:Ie,renderer:Be};export{Ge as diagram};