@lancc/cmark 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +21 -21
  3. package/README.md +47 -107
  4. package/assets/abnfDiagram-WEYOIA3C-CKV_7Upb.js +1 -0
  5. package/assets/architectureDiagram-ZHVYKT53-BvLudDvk.js +1 -0
  6. package/assets/blockDiagram-RJAE7QA3--gzkMGi2.js +1 -0
  7. package/assets/c4Diagram-XDPPPE54-ByfRiJGR.js +1 -0
  8. package/assets/chunk-2E7WHVMD-TfbC_dmh.js +1 -0
  9. package/assets/chunk-2Q5K7J3B-0YJgChVo.js +1 -0
  10. package/assets/chunk-4EMNKR2T-DHoYW7g5.js +1 -0
  11. package/assets/chunk-55XCU76K-Cq25Yw_G.js +1 -0
  12. package/assets/chunk-5VM5RSS4-CJaRXFHK.js +1 -0
  13. package/assets/chunk-JWPE2WC7-BP2iXBhe.js +1 -0
  14. package/assets/chunk-VQ5W62QI-B95zur4F.js +1 -0
  15. package/assets/chunk-XXDRQBXY-Ct0MhvQo.js +1 -0
  16. package/assets/chunk-ZCHMQSOR-C5VhW-wL.js +2 -0
  17. package/assets/classDiagram-v2-4MYWR3UA-C1G-Vkj0.js +1 -0
  18. package/assets/cose-bilkent-JH36ORCC-qIQoIBv0.js +1 -0
  19. package/assets/cynefin-EF2NZ3EQ-CR1E3YiZ.js +1 -0
  20. package/assets/cynefinDiagram-WF24UDRP-DaJFvZ3b.js +1 -0
  21. package/assets/cytoscape.esm-SjxgSg6I.js +9 -0
  22. package/assets/dagre-NK4GIZVX-BFRQhpii.js +1 -0
  23. package/assets/diagram-CBK3MWTC-DlueL6XZ.js +1 -0
  24. package/assets/diagram-I5XIIV2D-bITyafYX.js +1 -0
  25. package/assets/diagram-ODIL2UCW-Dlb4hg_-.js +1 -0
  26. package/assets/diagram-PFBEJUXE-CRfen0O7.js +1 -0
  27. package/assets/diagram-RJA3I4VV-CK-FlhGV.js +1 -0
  28. package/assets/diagram-TYUNFSNR-DmgVsxqa.js +1 -0
  29. package/assets/ebnfDiagram-V4P3TTPT-B9KGI9eQ.js +1 -0
  30. package/assets/echarts-CytsvCdp.js +25 -0
  31. package/assets/elk-QONTBCTQ-VgDftvsU.js +1 -0
  32. package/assets/erDiagram-KYQIGQAA-DkpP7sS4.js +1 -0
  33. package/assets/flowDiagram-IUGLLWBU-CRXa9Kxy.js +1 -0
  34. package/assets/ganttDiagram-R7GPNTJY-Cu2I55Wb.js +1 -0
  35. package/assets/gitGraphDiagram-PDYL7XHY-CwSo663I.js +1 -0
  36. package/assets/graph-Dz7AM1Q5.js +1 -0
  37. package/assets/index-BJ-NdQc4.js +100 -0
  38. package/assets/infoDiagram-MVDRKAX5-D3Qknzuo.js +1 -0
  39. package/assets/ishikawaDiagram-HPEHV2GE-9qYT75tk.js +1 -0
  40. package/assets/journeyDiagram-BOSHW7O7-DeSrJg9o.js +1 -0
  41. package/assets/kanban-definition-FNSA4HC5-DINkB6G7.js +1 -0
  42. package/assets/katex-DN8cTsI3.js +1 -0
  43. package/assets/markdown-S2mWvoE-.js +5 -0
  44. package/assets/mermaid-T_6Ze_cT.js +7 -0
  45. package/assets/mindmap-definition-6OY57UG3-DW5hqiAe.js +1 -0
  46. package/assets/pegDiagram-ECIUJNBX-BWy_tkzy.js +1 -0
  47. package/assets/pieDiagram-GNMPY74T-CniJbr6l.js +1 -0
  48. package/assets/quadrantDiagram-D57K4MC3-BVnDJkCv.js +1 -0
  49. package/assets/railroadDiagram-Y72NRBL7-BNKZpJJb.js +1 -0
  50. package/assets/requirementDiagram-EQYSW5RA-BETipHj0.js +1 -0
  51. package/assets/sankeyDiagram-SY24JHO5-ByEYqT7T.js +1 -0
  52. package/assets/sequenceDiagram-BLEHNHQU-BqCJ2tKG.js +1 -0
  53. package/assets/sizeCapture-INFHLROL-DlhrWFj-.js +1 -0
  54. package/assets/stateDiagram-v2-A6IESKWZ-DJUBWLTP.js +1 -0
  55. package/assets/swimlanes-B3ENRKFQ-D7k7tF5U.js +1 -0
  56. package/assets/swimlanesDiagram-AYQRV4AK-DoQBgB9o.js +1 -0
  57. package/assets/timeline-definition-JXYKGLGB-BCNhwnn6.js +1 -0
  58. package/assets/usecaseDiagram-WPOLBNNX-DRa_Rgl3.js +1 -0
  59. package/assets/vennDiagram-Q3Y3IDCW-Ba2eaO68.js +1 -0
  60. package/assets/wardleyDiagram-IVAIDKWA-W_i9vzY-.js +1 -0
  61. package/assets/xychartDiagram-4URNHDU4-ByfaGjvc.js +1 -0
  62. package/index.html +3 -3
  63. package/package.json +1 -1
  64. package/plugin.json +1 -1
  65. package/preload/git-panel.js +29 -5
  66. package/preload/git-service.js +48 -15
  67. package/preload/remote-setup.js +66 -33
  68. package/preload/remote-wizard.js +2 -0
  69. package/preload.js +30 -0
  70. package/assets/abnfDiagram-WEYOIA3C-BgXsTF7a.js +0 -1
  71. package/assets/architectureDiagram-ZHVYKT53-BsCWa_qC.js +0 -36
  72. package/assets/blockDiagram-RJAE7QA3-wbIxEiYN.js +0 -140
  73. package/assets/c4Diagram-XDPPPE54-5zdyxFvA.js +0 -38
  74. package/assets/chunk-2E7WHVMD-F85Lca-i.js +0 -88
  75. package/assets/chunk-2Q5K7J3B-CjpAZ0OI.js +0 -1
  76. package/assets/chunk-4EMNKR2T-C8Kbh83c.js +0 -1
  77. package/assets/chunk-55XCU76K-BINcFiLN.js +0 -1
  78. package/assets/chunk-5VM5RSS4-Diy5h2LS.js +0 -15
  79. package/assets/chunk-JWPE2WC7-BXnjDdh1.js +0 -1
  80. package/assets/chunk-VQ5W62QI-BM7ZZo1I.js +0 -1
  81. package/assets/chunk-XXDRQBXY-CW8CjB1w.js +0 -1
  82. package/assets/chunk-ZCHMQSOR-C7ATz1L1.js +0 -2
  83. package/assets/classDiagram-v2-4MYWR3UA-CMoqNk-b.js +0 -217
  84. package/assets/cose-bilkent-JH36ORCC-6rqR5iJk.js +0 -1
  85. package/assets/cynefin-EF2NZ3EQ-DypLIJxl.js +0 -141
  86. package/assets/cynefinDiagram-WF24UDRP-8b2CEBlR.js +0 -62
  87. package/assets/cytoscape.esm-CjX6Hyah.js +0 -331
  88. package/assets/dagre-NK4GIZVX-Dv6vuUbR.js +0 -4
  89. package/assets/diagram-CBK3MWTC-DJgMDeYd.js +0 -24
  90. package/assets/diagram-I5XIIV2D-BB9cMoRW.js +0 -24
  91. package/assets/diagram-ODIL2UCW-BVcRtsdy.js +0 -30
  92. package/assets/diagram-PFBEJUXE-BbGSOtJx.js +0 -3
  93. package/assets/diagram-RJA3I4VV-CzkY_8Fo.js +0 -41
  94. package/assets/diagram-TYUNFSNR-YTl5QdfL.js +0 -200
  95. package/assets/ebnfDiagram-V4P3TTPT-COVjPAjE.js +0 -1
  96. package/assets/echarts-BAPDkhe3.js +0 -61
  97. package/assets/elk-QONTBCTQ-DHsjY8Z_.js +0 -27
  98. package/assets/erDiagram-KYQIGQAA-CUAbTUl1.js +0 -99
  99. package/assets/flowDiagram-IUGLLWBU-CWsiqTQC.js +0 -213
  100. package/assets/ganttDiagram-R7GPNTJY-DetBW0Wm.js +0 -292
  101. package/assets/gitGraphDiagram-PDYL7XHY-ByrdgJmw.js +0 -106
  102. package/assets/graph-D8UmR1vK.js +0 -1
  103. package/assets/index-B17NCAw4.js +0 -758
  104. package/assets/infoDiagram-MVDRKAX5-BM48fjhU.js +0 -2
  105. package/assets/ishikawaDiagram-HPEHV2GE-DtHYywHZ.js +0 -70
  106. package/assets/journeyDiagram-BOSHW7O7-DJ1LiRh3.js +0 -139
  107. package/assets/kanban-definition-FNSA4HC5-DPPt8pwJ.js +0 -89
  108. package/assets/katex-CQL9J12G.js +0 -257
  109. package/assets/markdown-DVehI1Sg.js +0 -314
  110. package/assets/mermaid-C_q9pug0.js +0 -312
  111. package/assets/mindmap-definition-6OY57UG3-zbqYOEY6.js +0 -98
  112. package/assets/pegDiagram-ECIUJNBX-e7QG7TMq.js +0 -1
  113. package/assets/pieDiagram-GNMPY74T-Duf6YP0N.js +0 -39
  114. package/assets/quadrantDiagram-D57K4MC3-B2eYoUUy.js +0 -7
  115. package/assets/railroadDiagram-Y72NRBL7-BWCzPcI_.js +0 -1
  116. package/assets/requirementDiagram-EQYSW5RA-HhPMEqB1.js +0 -84
  117. package/assets/sankeyDiagram-SY24JHO5-CMUTwFBB.js +0 -40
  118. package/assets/sequenceDiagram-BLEHNHQU-C9wR2ll7.js +0 -169
  119. package/assets/sizeCapture-INFHLROL-DXfz37S6.js +0 -1
  120. package/assets/stateDiagram-v2-A6IESKWZ-D_gtonhE.js +0 -291
  121. package/assets/swimlanes-B3ENRKFQ-DdJOuuMV.js +0 -1
  122. package/assets/swimlanesDiagram-AYQRV4AK-BWt3HxHV.js +0 -8
  123. package/assets/timeline-definition-JXYKGLGB-DQsdwJe-.js +0 -120
  124. package/assets/usecaseDiagram-WPOLBNNX-DTRyFq7d.js +0 -370
  125. package/assets/vennDiagram-Q3Y3IDCW-dihYszm0.js +0 -34
  126. package/assets/wardleyDiagram-IVAIDKWA-BoPpgYfK.js +0 -78
  127. package/assets/xychartDiagram-4URNHDU4-DoLjYxeB.js +0 -7
@@ -0,0 +1 @@
1
+ import{s as t,g as e,t as n,q as s,a as i,b as r,_ as o,L as a,Q as l,k as c,ar as h,a8 as u,aI as f,a9 as d,aa as y,d as g,z as x,N as p,O as m}from"./mermaid-T_6Ze_cT.js";import"./markdown-S2mWvoE-.js";const b=1e-10;function v(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let s=n+1;s<t.length;++s){const i=w(t[n],t[s]);for(const t of i)t.parentIndex=[n,s],e.push(t)}return e}(t),s=n.filter(e=>function(t,e){return e.every(e=>M(t,e)<e.radius+b)}(e,t));let i=0,r=0;const o=[];if(s.length>1){const e=_(s);for(let t=0;t<s.length;++t){const n=s[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}s.sort((t,e)=>e.angle-t.angle);let n=s[s.length-1];for(let a=0;a<s.length;++a){const e=s[a];r+=(n.x+e.x)*(e.y-n.y);const l={x:(e.x+n.x)/2,y:(e.y+n.y)/2};let c=null;for(let s=0;s<e.parentIndex.length;++s)if(n.parentIndex.includes(e.parentIndex[s])){const i=t[e.parentIndex[s]],r=Math.atan2(e.x-i.x,e.y-i.y),o=Math.atan2(n.x-i.x,n.y-i.y);let a=o-r;a<0&&(a+=2*Math.PI);const h=o-a/2;let u=M(l,{x:i.x+i.radius*Math.sin(h),y:i.y+i.radius*Math.cos(h)});u>2*i.radius&&(u=2*i.radius),(null==c||c.width>u)&&(c={circle:i,width:u,p1:e,p2:n,large:u>i.radius,sweep:!0})}null!=c&&(o.push(c),i+=I(c.circle.radius,c.width),n=e)}}else{let e=t[0];for(let s=1;s<t.length;++s)t[s].radius<e.radius&&(e=t[s]);let n=!1;for(let s=0;s<t.length;++s)if(M(t[s],e)>Math.abs(e.radius-t[s].radius)){n=!0;break}n?i=r=0:(i=e.radius*e.radius*Math.PI,o.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-b,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return r/=2,e&&(e.area=i+r,e.arcArea=i,e.polygonArea=r,e.arcs=o,e.innerPoints=s,e.intersectionPoints=n),i+r}function I(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function M(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function k(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(n*n-t*t+e*e)/(2*n);return I(t,t-(n*n-e*e+t*t)/(2*n))+I(e,s)}function w(t,e){const n=M(t,e),s=t.radius,i=e.radius;if(n>=s+i||n<=Math.abs(s-i))return[];const r=(s*s-i*i+n*n)/(2*n),o=Math.sqrt(s*s-r*r),a=t.x+r*(e.x-t.x)/n,l=t.y+r*(e.y-t.y)/n,c=-(e.y-t.y)*(o/n),h=-(e.x-t.x)*(o/n);return[{x:a+c,y:l-h},{x:a-c,y:l+h}]}function _(t){const e={x:0,y:0};for(const n of t)e.x+=n.x,e.y+=n.y;return e.x/=t.length,e.y/=t.length,e}function S(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function E(t,e){return S(t).map(()=>S(e))}function T(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function z(t){return Math.sqrt(T(t,t))}function A(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function R(t,e,n,s,i){for(let r=0;r<t.length;++r)t[r]=e*n[r]+s*i[r]}function N(t,e,n){const s=(n=n||{}).maxIterations||200*e.length,i=n.nonZeroDelta||1.05,r=n.zeroDelta||.001,o=n.minErrorDelta||1e-6,a=n.minErrorDelta||1e-5,l=void 0!==n.rho?n.rho:1,c=void 0!==n.chi?n.chi:2,h=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f;const d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e),y[0].id=0;for(let I=0;I<d;++I){const n=e.slice();n[I]=n[I]?n[I]*i:r,y[I+1]=n,y[I+1].fx=t(n),y[I+1].id=I+1}function g(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}const x=(t,e)=>t.fx-e.fx,p=e.slice(),m=e.slice(),b=e.slice(),v=e.slice();for(let I=0;I<s;++I){if(y.sort(x),n.history){const t=y.map(t=>{const e=t.slice();return e.fx=t.fx,e.id=t.id,e});t.sort((t,e)=>t.id-e.id),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:t})}f=0;for(let t=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<o&&f<a)break;for(let t=0;t<d;++t){p[t]=0;for(let e=0;e<d;++e)p[t]+=y[e][t];p[t]/=d}const e=y[d];if(R(m,1+l,p,-l,e),m.fx=t(m),m.fx<y[0].fx)R(v,1+c,p,-c,e),v.fx=t(v),v.fx<m.fx?g(v):g(m);else if(m.fx>=y[d-1].fx){let n=!1;if(m.fx>e.fx?(R(b,1+h,p,-h,e),b.fx=t(b),b.fx<e.fx?g(b):n=!0):(R(b,1-h*l,p,h*l,e),b.fx=t(b),b.fx<m.fx?g(b):n=!0),n){if(u>=1)break;for(let e=1;e<y.length;++e)R(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else g(m)}return y.sort(x),{fx:y[0].fx,x:y[0]}}function D(t,e,n,s,i,r,o){const a=n.fx,l=T(n.fxprime,e);let c=a,h=a,u=l,f=0;function d(h,f,d){for(let y=0;y<16;++y)if(i=(h+f)/2,R(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=T(s.fxprime,e),c>a+r*i*l||c>=d)f=i;else{if(Math.abs(u)<=-o*l)return i;u*(f-h)>=0&&(f=h),h=i,d=c}return 0}i=i||1,r=r||1e-6,o=o||.1;for(let y=0;y<10;++y){if(R(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=T(s.fxprime,e),c>a+r*i*l||y&&c>=h)return d(f,i,h);if(Math.abs(u)<=-o*l)return i;if(u>=0)return d(i,f,c);h=c,f=i,i*=2}return i}function O(t,e,n){let s={x:e.slice(),fx:0,fxprime:e.slice()},i={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let o,a,l,c=1;l=(n=n||{}).maxIterations||20*e.length,s.fx=t(s.x,s.fxprime),o=s.fxprime.slice(),A(o,s.fxprime,-1);for(let h=0;h<l;++h){if(c=D(t,o,s,i,c),n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),c){R(r,1,i.fxprime,-1,s.fxprime);const t=T(s.fxprime,s.fxprime);R(o,Math.max(0,T(r,i.fxprime)/t),o,-1,i.fxprime),a=s,s=i,i=a}else A(o,s.fxprime,-1);if(z(s.fxprime)<=1e-5)break}return n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),s}function C(t,e={}){e.maxIterations=e.maxIterations||500;const n=e.initialLayout||j,s=e.lossFunction||P,i=function(t,e={}){const n=e.distinct,s=t.map(t=>Object.assign({},t));function i(t){return t.join(";")}if(n){const t=new Map;for(const e of s)for(let n=0;n<e.sets.length;n++){const s=String(e.sets[n]);t.set(s,e.size+(t.get(s)||0));for(let i=n+1;i<e.sets.length;i++){const n=String(e.sets[i]),r=`${s};${n}`,o=`${n};${s}`;t.set(r,e.size+(t.get(r)||0)),t.set(o,e.size+(t.get(o)||0))}}for(const e of s)e.sets.length<3&&(e.size=t.get(i(e.sets)))}const r=[],o=new Set;for(const a of s)if(1===a.sets.length)r.push(a.sets[0]);else if(2===a.sets.length){const t=a.sets[0],e=a.sets[1];o.add(i(a.sets)),o.add(i([e,t]))}r.sort((t,e)=>t===e?0:t<e?-1:1);for(let a=0;a<r.length;++a){const t=r[a];for(let e=a+1;e<r.length;++e){const n=r[e];o.has(i([t,n]))||s.push({sets:[t,n],size:0})}}return s}(t,e),r=n(i,e),o=Object.keys(r),a=[];for(const c of o)a.push(r[c].x),a.push(r[c].y);const l=N(t=>{const e={};for(let n=0;n<o.length;++n){const s=o[n];e[s]={x:t[2*n],y:t[2*n+1],radius:r[s].radius}}return s(e,i)},a,e).x;for(let c=0;c<o.length;++c){const t=o[c];r[t].x=l[2*c],r[t].y=l[2*c+1]}return r}const F=1e-10;function $(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+F?Math.abs(t-e):function(t,e,n,s){const i=(s=s||{}).maxIterations||100,r=s.tolerance||1e-10,o=t(e),a=t(n);let l=n-e;if(o*a>0)throw"Initial bisect points must have opposite signs";if(0===o)return e;if(0===a)return n;for(let c=0;c<i;++c){l/=2;const n=e+l,s=t(n);if(s*o>=0&&(e=n),Math.abs(l)<r||0===s)return n}return e+l}(s=>k(t,e,s)-n,0,t+e)}function j(t,e={}){let n=function(t,e){const n=e&&e.lossFunction?e.lossFunction:P,s={},i={};for(const u of t)if(1===u.sets.length){const t=u.sets[0];s[t]={x:1e10,y:1e10,rowid:s.length,size:u.size,radius:Math.sqrt(u.size/Math.PI)},i[t]=[]}t=t.filter(t=>2===t.sets.length);for(const u of t){let t=null!=u.weight?u.weight:1;const e=u.sets[0],n=u.sets[1];u.size+F>=Math.min(s[e].size,s[n].size)&&(t=0),i[e].push({set:n,size:u.size,weight:t}),i[n].push({set:e,size:u.size,weight:t})}const r=[];function o(t,e){return e.size-t.size}Object.keys(i).forEach(t=>{let e=0;for(let n=0;n<i[t].length;++n)e+=i[t][n].size*i[t][n].weight;r.push({set:t,size:e})}),r.sort(o);const a={};function l(t){return t.set in a}function c(t,e){s[e].x=t.x,s[e].y=t.y,a[e]=!0}c({x:0,y:0},r[0].set);for(let u=1;u<r.length;++u){const e=r[u].set,a=i[e].filter(l),f=s[e];if(a.sort(o),0===a.length)throw"ERROR: missing pairwise overlap information";const d=[];for(var h=0;h<a.length;++h){const t=s[a[h].set],e=$(f.radius,t.radius,a[h].size);d.push({x:t.x+e,y:t.y}),d.push({x:t.x-e,y:t.y}),d.push({y:t.y+e,x:t.x}),d.push({y:t.y-e,x:t.x});for(let n=h+1;n<a.length;++n){const i=s[a[n].set],r=$(f.radius,i.radius,a[n].size),o=w({x:t.x,y:t.y,radius:e},{x:i.x,y:i.y,radius:r});d.push(...o)}}let y=1e50,g=d[0];for(const i of d){s[e].x=i.x,s[e].y=i.y;const r=n(s,t);r<y&&(y=r,g=i)}c(g,e)}return s}(t,e);const s=e.lossFunction||P;if(t.length>=8){const i=function(t,e={}){const n=e.restarts||10,s=[],i={};for(const f of t)1===f.sets.length&&(i[f.sets[0]]=s.length,s.push(f));let{distances:r,constraints:o}=function(t,e,n){const s=E(e.length,e.length),i=E(e.length,e.length);return t.filter(t=>2===t.sets.length).forEach(t=>{const r=n[t.sets[0]],o=n[t.sets[1]],a=$(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[o].size/Math.PI),t.size);s[r][o]=s[o][r]=a;let l=0;t.size+1e-10>=Math.min(e[r].size,e[o].size)?l=1:t.size<=1e-10&&(l=-1),i[r][o]=i[o][r]=l}),{distances:s,constraints:i}}(t,s,i);const a=z(r.map(z))/r.length;r=r.map(t=>t.map(t=>t/a));const l=(t,e)=>function(t,e,n,s){for(let r=0;r<e.length;++r)e[r]=0;let i=0;for(let r=0;r<n.length;++r){const o=t[2*r],a=t[2*r+1];for(let l=r+1;l<n.length;++l){const c=t[2*l],h=t[2*l+1],u=n[r][l],f=s[r][l],d=(c-o)*(c-o)+(h-a)*(h-a),y=Math.sqrt(d),g=d-u*u;f>0&&y<=u||f<0&&y>=u||(i+=2*g*g,e[2*r]+=4*g*(o-c),e[2*r+1]+=4*g*(a-h),e[2*l]+=4*g*(c-o),e[2*l+1]+=4*g*(h-a))}}return i}(t,e,r,o);let c=null;for(let f=0;f<n;++f){const t=O(l,S(2*r.length).map(Math.random),e);(!c||t.fx<c.fx)&&(c=t)}const h=c.x,u={};for(let f=0;f<s.length;++f){const t=s[f];u[t.sets[0]]={x:h[2*f]*a,y:h[2*f+1]*a,radius:Math.sqrt(t.size/Math.PI)}}if(e.history)for(const f of e.history)A(f.x,a);return u}(t,e);s(i,t)+1e-8<s(n,t)&&(n=i)}return n}function P(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=k(n.radius,i.radius,M(n,i))}else e=v(s.sets.map(e=>t[e]));n+=(null!=s.weight?s.weight:1)*(e-s.size)*(e-s.size)}return n}function L(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=k(n.radius,i.radius,M(n,i))}else e=v(s.sets.map(e=>t[e]));const i=null!=s.weight?s.weight:1,r=Math.log((e+1)/(s.size+1));n+=i*r*r}return n}function q(t,e,n){if(null==n?t.sort((t,e)=>e.radius-t.radius):t.sort(n),t.length>0){const e=t[0].x,n=t[0].y;for(const s of t)s.x-=e,s.y-=n}if(2===t.length){M(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)}if(t.length>1){const n=Math.atan2(t[1].x,t[1].y)-e,s=Math.cos(n),i=Math.sin(n);for(const e of t){const t=e.x,n=e.y;e.x=s*t-i*n,e.y=i*t+s*n}}if(t.length>2){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(const n of t){var s=(n.x+e*n.y)/(1+e*e);n.x=2*s-n.x,n.y=2*s*e-n.y}}}}function U(t){const e=e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),Number.NEGATIVE_INFINITY),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function B(t,e,n){null==e&&(e=Math.PI/2);let s=V(t).map(t=>Object.assign({},t));const i=function(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}function n(t,n){const s=e(t),i=e(n);s.parent=i}t.forEach(t=>{t.parent=t});for(let i=0;i<t.length;++i)for(let e=i+1;e<t.length;++e){const s=t[i].radius+t[e].radius;M(t[i],t[e])+1e-10<s&&n(t[e],t[i])}const s=new Map;for(let i=0;i<t.length;++i){const n=e(t[i]).parent.setid;s.has(n)||s.set(n,[]),s.get(n).push(t[i])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(s);for(const c of i){q(c,e,n);const t=U(c);c.size=(t.xRange.max-t.xRange.min)*(t.yRange.max-t.yRange.min),c.bounds=t}i.sort((t,e)=>e.size-t.size),s=i[0];let r=s.bounds;const o=(r.xRange.max-r.xRange.min)/50;function a(t,e,n){if(!t)return;const i=t.bounds;let a,l;if(e)a=r.xRange.max-i.xRange.min+o;else{a=r.xRange.max-i.xRange.max;const t=(i.xRange.max-i.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;t<0&&(a+=t)}if(n)l=r.yRange.max-i.yRange.min+o;else{l=r.yRange.max-i.yRange.max;const t=(i.yRange.max-i.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;t<0&&(l+=t)}for(const r of t)r.x+=a,r.y+=l,s.push(r)}let l=1;for(;l<i.length;)a(i[l],!0,!1),a(i[l+1],!1,!0),a(i[l+2],!0,!0),l+=3,r=U(s);return W(s)}function G(t,e,n,s,i){const r=V(t);e-=2*s,n-=2*s;const{xRange:o,yRange:a}=U(r);if(o.max===o.min||a.max===a.min)return console.log("not scaling solution: zero size detected"),t;let l,c;if(i){const t=2*Math.sqrt(i/Math.PI);l=e/t,c=n/t}else l=e/(o.max-o.min),c=n/(a.max-a.min);const h=Math.min(c,l),u=(e-(o.max-o.min)*h)/2,f=(n-(a.max-a.min)*h)/2;return W(r.map(t=>({radius:h*t.radius,x:s+u+(t.x-o.min)*h,y:s+f+(t.y-a.min)*h,setid:t.setid})))}function W(t){const e={};for(const n of t)e[n.setid]=n;return e}function V(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function X(t={}){let e=!1,n=600,s=350,i=15,r=1e3,o=Math.PI/2,a=!0,l=null,c=!0,h=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,x={},p=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,b=function(t){if(t in x)return x[t];var e=x[t]=p[m];return m+=1,m>=p.length&&(m=0),e},v=C,I=P;function M(x){let p=x.datum();const m=new Set;p.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),p=p.filter(t=>!t.sets.some(t=>m.has(t)));let M={},k={};if(p.length>0){let t=v(p,{lossFunction:I,distinct:d});a&&(t=B(t,o,f)),M=G(t,n,s,i,l),k=H(M,p,g)}const w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}p.forEach(t=>{t.label&&(w[t.sets]=t.label)}),x.selectAll("svg").data([M]).enter().append("svg");const S=x.select("svg");e?S.attr("viewBox",`0 0 ${n} ${s}`):S.attr("width",n).attr("height",s);const E={};let T=!1;function z(t){return e=>tt(t.sets.map(t=>{let i=E[t],r=M[t];return i||(i={x:n/2,y:s/2,radius:1}),r||(r={x:n/2,y:s/2,radius:1}),{x:i.x*(1-e)+r.x*e,y:i.y*(1-e)+r.y*e,radius:i.radius*(1-e)+r.radius*e}}),y)}S.selectAll(".venn-area path").each(function(t){const e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=function(t){const e=t.split(" ");return{x:Number.parseFloat(e[1]),y:Number.parseFloat(e[2]),radius:-Number.parseFloat(e[4])}}(e))});const A=S.selectAll(".venn-area").data(p,t=>t.sets),R=A.enter().append("g").attr("class",t=>`venn-area venn-${1==t.sets.length?"circle":"intersection"}${t.colour||t.color?" venn-coloured":""}`).attr("data-venn-sets",t=>t.sets.join("_")),N=R.append("path"),D=R.append("text").attr("class","label").text(t=>_(t)).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",s/2);function O(t){return"function"==typeof t.transition?t.transition("venn").duration(r):t}h&&(N.style("fill-opacity","0").filter(t=>1==t.sets.length).style("fill",t=>t.colour?t.colour:t.color?t.color:b(t.sets)).style("fill-opacity",".25"),D.style("fill",e=>e.colour||e.color?"#FFF":t.textFill?t.textFill:1==e.sets.length?b(e.sets):"#444"));let C=x;T&&"function"==typeof C.transition?(C=O(x),C.selectAll("path").attrTween("d",z)):C.selectAll("path").attr("d",t=>tt(t.sets.map(t=>M[t])),y);const F=C.selectAll("text").filter(t=>t.sets in k).text(t=>_(t)).attr("x",t=>Math.floor(k[t.sets].x)).attr("y",t=>Math.floor(k[t.sets].y));c&&(T?"on"in F?F.on("end",Y(M,_)):F.each("end",Y(M,_)):F.each(Y(M,_)));const $=O(A.exit()).remove();"function"==typeof A.transition&&$.selectAll("path").attrTween("d",z);const j=$.selectAll("text").attr("x",n/2).attr("y",s/2);return null!==u&&(D.style("font-size","0px"),F.style("font-size",u),j.style("font-size","0px")),{circles:M,textCentres:k,nodes:A,enter:R,update:C,exit:$}}return M.wrap=function(t){return arguments.length?(c=t,M):c},M.useViewBox=function(){return e=!0,M},M.width=function(t){return arguments.length?(n=t,M):n},M.height=function(t){return arguments.length?(s=t,M):s},M.padding=function(t){return arguments.length?(i=t,M):i},M.distinct=function(t){return arguments.length?(d=t,M):d},M.colours=function(t){return arguments.length?(b=t,M):b},M.colors=function(t){return arguments.length?(b=t,M):b},M.fontSize=function(t){return arguments.length?(u=t,M):u},M.round=function(t){return arguments.length?(y=t,M):y},M.duration=function(t){return arguments.length?(r=t,M):r},M.layoutFunction=function(t){return arguments.length?(v=t,M):v},M.normalize=function(t){return arguments.length?(a=t,M):a},M.scaleToFit=function(t){return arguments.length?(l=t,M):l},M.styled=function(t){return arguments.length?(h=t,M):h},M.orientation=function(t){return arguments.length?(o=t,M):o},M.orientationOrder=function(t){return arguments.length?(f=t,M):f},M.lossFunction=function(t){return arguments.length?(I="default"===t?P:"logRatio"===t?L:t,M):I},M}function Y(t,e){return function(n){const s=this,i=t[n.sets[0]].radius||50,r=e(n)||"",o=r.split(/\s+/).reverse(),a=(r.length+o.length)/3;let l=o.pop(),c=[l],h=0;s.textContent=null;const u=[];function f(t){const e=s.ownerDocument.createElementNS(s.namespaceURI,"tspan");return e.textContent=t,u.push(e),s.append(e),e}let d=f(l);for(;l=o.pop(),l;){c.push(l);const t=c.join(" ");d.textContent=t,t.length>a&&d.getComputedTextLength()>i&&(c.pop(),d.textContent=c.join(" "),c=[l],d=f(l),h++)}const y=.35-1.1*h/2,g=s.getAttribute("x"),x=s.getAttribute("y");u.forEach((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",x),t.setAttribute("dy",`${y+1.1*e}em`)})}}function K(t,e,n){let s=e[0].radius-M(e[0],t);for(let i=1;i<e.length;++i){const n=e[i].radius-M(e[i],t);n<=s&&(s=n)}for(let i=0;i<n.length;++i){const e=M(n[i],t)-n[i].radius;e<=s&&(s=e)}return s}function Z(t,e,n){const s=[];for(const h of t)s.push({x:h.x,y:h.y}),s.push({x:h.x+h.radius/2,y:h.y}),s.push({x:h.x-h.radius/2,y:h.y}),s.push({x:h.x,y:h.y+h.radius/2}),s.push({x:h.x,y:h.y-h.radius/2});let i=s[0],r=K(s[0],t,e);for(let h=1;h<s.length;++h){const n=K(s[h],t,e);n>=r&&(i=s[h],r=n)}const o=N(n=>-1*K({x:n[0],y:n[1]},t,e),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,a={x:n?0:o[0],y:o[1]};let l=!0;for(const h of t)if(M(a,h)>h.radius){l=!1;break}for(const h of e)if(M(a,h)<h.radius){l=!1;break}if(l)return a;if(1==t.length)return{x:t[0].x,y:t[0].y};const c={};return v(t,c),0===c.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==c.arcs.length?{x:c.arcs[0].circle.x,y:c.arcs[0].circle.y}:e.length?Z(t,[]):_(c.arcs.map(t=>t.p1))}function H(t,e,n){const s={},i=function(t){const e={},n=Object.keys(t);for(const s of n)e[s]=[];for(let s=0;s<n.length;s++){const i=n[s],r=t[i];for(let o=s+1;o<n.length;++o){const s=n[o],a=t[s],l=M(r,a);l+a.radius<=r.radius+1e-10?e[s].push(i):l+r.radius<=a.radius+1e-10&&e[i].push(s)}}return e}(t);for(let r=0;r<e.length;++r){const o=e[r].sets,a={},l={};for(let t=0;t<o.length;++t){a[o[t]]=!0;const e=i[o[t]];for(let t=0;t<e.length;++t)l[e[t]]=!0}const c=[],h=[];for(let e in t)e in a?c.push(t[e]):e in l||h.push(t[e]);const u=Z(c,h,n);s[o]=u,u.disjoint&&e[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return s}function Q(t){if(0===t.length)return[];const e={};return v(t,e),e.arcs}function J(t,e){if(0===t.length)return"M 0 0";const n=Math.pow(10,e||0),s=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length){const e=t[0].circle;return function(t,e,n){const s=[];return s.push("\nM",t,e),s.push("\nm",-n,0),s.push("\na",n,n,0,1,0,2*n,0),s.push("\na",n,n,0,1,0,2*-n,0),s.join(" ")}(s(e.x),s(e.y),s(e.radius))}const i=["\nM",s(t[0].p2.x),s(t[0].p2.y)];for(const r of t){const t=s(r.circle.radius);i.push("\nA",t,t,0,r.large?1:0,r.sweep?1:0,s(r.p1.x),s(r.p1.y))}return i.join(" ")}function tt(t,e){return J(Q(t),e)}var et=function(){var t=o(function(t,e,n,s){for(n=n||{},s=t.length;s--;n[t[s]]=e);return n},"o"),e=[5,8],n=[7,8,11,12,17,19,22,24],s=[1,17],i=[1,18],r=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],l=[1,39],c=[7,8,11,12,17,19,22,24,27],h=[1,57],u=[1,56],f=[1,58],d=[1,59],y=[1,60],g=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],x={trace:o(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:o(function(t,e,n,s,i,r,o){var a=r.length-1;switch(i){case 1:return r[a-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:r[a-1].push(r[a]),this.$=r[a-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=r[a];break;case 8:s.setDiagramTitle(r[a].substr(6)),this.$=r[a].substr(6);break;case 9:s.addSubsetData([r[a]],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 10:s.addSubsetData([r[a-1]],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 11:s.addSubsetData([r[a-2]],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 12:s.addSubsetData([r[a-3]],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 13:if(r[a].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a]),s.addSubsetData(r[a],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 14:if(r[a-1].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-1]),s.addSubsetData(r[a-1],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 15:if(r[a-2].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-2]),s.addSubsetData(r[a-2],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 16:if(r[a-3].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-3]),s.addSubsetData(r[a-3],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 17:case 18:case 19:s.addTextData(r[a-1],r[a],void 0);break;case 20:case 21:s.addTextData(r[a-2],r[a-1],r[a]);break;case 23:s.addStyleData(r[a-1],r[a]);break;case 24:case 25:case 26:if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a],void 0);break;case 27:case 28:var l;if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a-1],r[a]);break;case 29:case 41:case 34:this.$=[r[a]];break;case 30:case 42:this.$=[...r[a-2],r[a]];break;case 31:this.$=[r[a-2],r[a]];break;case 33:this.$=r[a].join(" ")}},"anonymous"),table:[t(e,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(n,[2,4],{6:5}),t(e,[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(n,[2,5]),t(n,[2,6]),t(n,[2,7]),t(n,[2,8]),{13:16,20:s,21:i},{13:20,18:19,20:s,21:i},{13:20,18:21,20:s,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:s,21:i},t(n,[2,9],{14:[1,27],15:[1,28]}),t(r,[2,43]),t(r,[2,44]),t(n,[2,13],{14:[1,29],15:[1,30],27:a}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},t(n,[2,22]),t(n,[2,24],{14:[1,35]}),t(n,[2,25],{14:[1,36]}),t(n,[2,26]),{20:l,25:37,26:38,27:a},t(n,[2,10],{15:[1,40]}),{16:[1,41]},t(n,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:s,21:i},t(n,[2,17],{14:[1,45]}),t(n,[2,18],{14:[1,46]}),t(n,[2,19]),t(n,[2,27]),t(n,[2,28]),t(n,[2,23],{27:[1,47]}),t(c,[2,29]),{15:[1,48]},{16:[1,49]},t(n,[2,11]),{16:[1,50]},t(n,[2,15]),t(r,[2,42]),t(n,[2,20]),t(n,[2,21]),{20:l,26:51},{16:h,20:u,21:[1,53],28:52,29:54,30:55,31:f,32:d,33:y},t(n,[2,12]),t(n,[2,16]),t(c,[2,30]),t(c,[2,31]),t(c,[2,32]),t(c,[2,33],{30:61,16:h,20:u,31:f,32:d,33:y}),t(g,[2,34]),t(g,[2,36]),t(g,[2,37]),t(g,[2,38]),t(g,[2,39]),t(g,[2,40]),t(g,[2,35])],defaultActions:{6:[2,1]},parseError:o(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:o(function(t){var e=this,n=[0],s=[],i=[null],r=[],a=this.table,l="",c=0,h=0,u=r.slice.call(arguments,1),f=Object.create(this.lexer),d={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(d.yy[y]=this.yy[y]);f.setInput(t,d.yy),d.yy.lexer=f,d.yy.parser=this,void 0===f.yylloc&&(f.yylloc={});var g=f.yylloc;r.push(g);var x=f.options&&f.options.ranges;function p(){var t;return"number"!=typeof(t=s.pop()||f.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,o(function(t){n.length=n.length-2*t,i.length=i.length-t,r.length=r.length-t},"popStack"),o(p,"lex");for(var m,b,v,I,M,k,w,_,S={};;){if(b=n[n.length-1],this.defaultActions[b]?v=this.defaultActions[b]:(null==m&&(m=p()),v=a[b]&&a[b][m]),void 0===v||!v.length||!v[0]){var E="";for(M in _=[],a[b])this.terminals_[M]&&M>2&&_.push("'"+this.terminals_[M]+"'");E=f.showPosition?"Parse error on line "+(c+1)+":\n"+f.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(E,{text:f.match,token:this.terminals_[m]||m,line:f.yylineno,loc:g,expected:_})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(v[0]){case 1:n.push(m),i.push(f.yytext),r.push(f.yylloc),n.push(v[1]),m=null,h=f.yyleng,l=f.yytext,c=f.yylineno,g=f.yylloc;break;case 2:if(k=this.productions_[v[1]][1],S.$=i[i.length-k],S._$={first_line:r[r.length-(k||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(k||1)].first_column,last_column:r[r.length-1].last_column},x&&(S._$.range=[r[r.length-(k||1)].range[0],r[r.length-1].range[1]]),void 0!==(I=this.performAction.apply(S,[l,h,c,d.yy,v[1],i,r].concat(u))))return I;k&&(n=n.slice(0,-1*k*2),i=i.slice(0,-1*k),r=r.slice(0,-1*k)),n.push(this.productions_[v[1]][0]),i.push(S.$),r.push(S._$),w=a[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0},"parse")},p=function(){return{EOF:1,parseError:o(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:o(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=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),n.length-1&&(this.yylineno-=n.length-1);var i=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:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:o(function(t,e){var n,s,i;if(this.options.backtrack_lexer&&(i={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&&(i.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in i)this[r]=i[r];return!1}return!1},"test_match"),next:o(function(){if(this.done)return this.EOF;var t,e,n,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),r=0;r<i.length;r++)if((n=this._input.match(this.rules[i[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:o(function(){var t=this.next();return t||this.lex()},"lex"),begin:o(function(t){this.conditionStack.push(t)},"begin"),popState:o(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:o(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:o(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:o(function(t){this.begin(t)},"pushState"),stateStackSize:o(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:o(function(t,e,n,s){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;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}}}}();function m(){this.yy={}}return x.lexer=p,o(m,"Parser"),m.prototype=x,x.Parser=m,new m}();et.parser=et;var nt,st=et,it=[],rt=[],ot=[],at=new Set,lt=!1,ct=o((t,e,n)=>{const s=xt(t).sort(),i=n??10/Math.pow(t.length,2);nt=s,1===s.length&&at.add(s[0]),it.push({sets:s,size:i,label:e?ut(e):void 0})},"addSubsetData"),ht=o(()=>it,"getSubsetData"),ut=o(t=>{const e=t.trim();return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e},"normalizeText"),ft=o(t=>t?ut(t):t,"normalizeStyleValue"),dt=o((t,e,n)=>{const s=ut(e);rt.push({sets:xt(t).sort(),id:s,label:n?ut(n):void 0})},"addTextData"),yt=o((t,e)=>{const n=xt(t).sort(),s={};for(const[i,r]of e)s[i]=ft(r)??r;ot.push({targets:n,styles:s})},"addStyleData"),gt=o(()=>ot,"getStyleData"),xt=o(t=>t.map(t=>ut(t)),"normalizeIdentifierList"),pt=o(t=>{const e=xt(t).filter(t=>!at.has(t));if(e.length>0)throw new Error(`unknown set identifier: ${e.join(", ")}`)},"validateUnionIdentifiers"),mt=o(()=>rt,"getTextData"),bt=o(()=>nt,"getCurrentSets"),vt=o(()=>lt,"getIndentMode"),It=o(t=>{lt=t},"setIndentMode"),Mt=m.venn;function kt(){return p(Mt,a().venn)}o(kt,"getConfig");var wt={getConfig:kt,clear:o(()=>{x(),it.length=0,rt.length=0,ot.length=0,at.clear(),nt=void 0,lt=!1},"customClear"),setAccTitle:r,getAccTitle:i,setDiagramTitle:s,getDiagramTitle:n,getAccDescription:e,setAccDescription:t,addSubsetData:ct,getSubsetData:ht,addTextData:dt,addStyleData:yt,validateUnionIdentifiers:pt,getTextData:mt,getStyleData:gt,getCurrentSets:bt,getIndentMode:vt,setIndentMode:It},_t=o(t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`,"getStyles");function St(t){const e=new Map;for(const n of t){const t=n.targets.join("|"),s=e.get(t);s?Object.assign(s,n.styles):e.set(t,{...n.styles})}return e}o(St,"buildStyleByKey");var Et=o((t,e,n,s)=>{const i=s.db,r=i.getConfig?.(),{themeVariables:o,look:x,handDrawnSeed:p}=a(),m="handDrawn"===x,b=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),v=i.getDiagramTitle?.(),I=i.getSubsetData(),M=i.getTextData(),k=St(i.getStyleData()),w=At(I),_=r?.width??800,S=r?.height??450,E=_/1600,T=v?48*E:0,z=o.primaryTextColor??o.textColor,A=l(e);A.attr("viewBox",`0 0 ${_} ${S}`),v&&A.append("text").text(v).attr("class","venn-title").attr("font-size",32*E+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*E).style("fill",o.vennTitleTextColor||o.titleColor);const R=c(document.createElement("div")),N=X().width(_).height(S-T);R.datum(w).call(N);const D=m?h.svg(R.select("svg").node()):void 0,O=function(t,e={}){const{lossFunction:n,layoutFunction:s=C,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:a=600,height:l=350,padding:c=15,scaleToFit:h=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e;let y=s(t,{lossFunction:"default"!==n&&n?"logRatio"===n?L:n:P,distinct:f});i&&(y=B(y,r,o));const g=G(y,a,l,c,h),x=H(g,t,u),p=new Map(Object.keys(g).map(t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}])),m=t.map(t=>{const e=t.sets.map(t=>p.get(t)),n=Q(e);return{circles:e,arcs:n,path:J(n,d),area:t,has:new Set(t.sets)}});function b(t){let e="";for(const n of m)n.has.size>t.length&&t.every(t=>n.has.has(t))&&(e+=" "+n.path);return e}return m.map(({circles:t,arcs:e,path:n,area:s})=>({data:s,text:x[s.sets],circles:t,arcs:e,path:n,distinctPath:n+b(s.sets)}))}(w,{width:_,height:S-T,padding:r?.padding??15}),F=new Map;for(const a of O){const t=Tt([...a.data.sets].sort());F.set(t,a)}M.length>0&&zt(r,F,R,M,E,k);const $=u(o.background||"#f4f4f4");R.selectAll(".venn-circle").each(function(t,e){const n=c(this),s=Tt([...t.sets].sort()),i=k.get(s),r=b.length>0?b[e%b.length]:void 0,a=i?.fill||r||o.primaryColor;n.classed("venn-set-"+e%8,!0);const l=i?.["fill-opacity"]??.1,h=i?.stroke||a,u=i?.["stroke-width"]||""+5*E;if(m&&D){const t=F.get(s);if(t&&t.circles.length>0){const s=t.circles[0],i=D.circle(s.x,s.y,2*s.radius,{roughness:.7,seed:p,fill:f(a,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:h,strokeWidth:parseFloat(String(u))});n.select("path").remove(),n.node()?.insertBefore(i,n.select("text").node())}}else n.select("path").style("fill",a).style("fill-opacity",l).style("stroke",h).style("stroke-width",u).style("stroke-opacity",.95);const g=i?.color||($?d(a,30):y(a,30));n.select("text").style("font-size",48*E+"px").style("fill",g)}),m&&D?R.selectAll(".venn-intersection").each(function(t){const e=c(this),n=Tt([...t.sets].sort()),s=k.get(n),i=s?.fill;if(i){const t=e.select("path"),n=t.attr("d");if(n){const e=D.path(n,{roughness:.7,seed:p,fill:f(i,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),s=t.node();s?.parentNode?.insertBefore(e,s),t.remove()}}else e.select("path").style("fill-opacity",0);e.select("text").style("font-size",48*E+"px").style("fill",s?.color??o.vennSetTextColor??z)}):(R.selectAll(".venn-intersection text").style("font-size",48*E+"px").style("fill",t=>{const e=Tt([...t.sets].sort());return k.get(e)?.color??o.vennSetTextColor??z}),R.selectAll(".venn-intersection path").style("fill-opacity",t=>{const e=Tt([...t.sets].sort());return k.get(e)?.fill?1:0}).style("fill",t=>{const e=Tt([...t.sets].sort());return k.get(e)?.fill??"transparent"}));const j=A.append("g").attr("transform",`translate(0, ${T})`),q=R.select("svg").node();if(q&&"childNodes"in q)for(const a of[...q.childNodes])j.node()?.appendChild(a);g(A,S,_,r?.useMaxWidth??!0)},"draw");function Tt(t){return t.join("|")}function zt(t,e,n,s,i,r){const o=t?.useDebugLayout??!1,a=n.select("svg").append("g").attr("class","venn-text-nodes"),l=new Map;for(const c of s){const t=Tt(c.sets),e=l.get(t);e?e.push(c):l.set(t,[c])}for(const[c,h]of l.entries()){const t=e.get(c);if(!t?.text)continue;const n=t.text.x,s=t.text.y,l=Math.min(...t.circles.map(t=>t.radius)),u=Math.min(...t.circles.map(t=>t.radius-Math.hypot(n-t.x,s-t.y)));let f=Number.isFinite(u)?Math.max(0,u):0;0===f&&Number.isFinite(l)&&(f=.6*l);const d=a.append("g").attr("class","venn-text-area").attr("font-size",40*i+"px");o&&d.append("circle").attr("class","venn-text-debug-circle").attr("cx",n).attr("cy",s).attr("r",f).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const y=Math.max(80*i,2*f*.95),g=Math.max(60*i,2*f*.95),x=(t.data.label&&t.data.label.length>0?Math.min(32*i,.25*f):0)+(h.length<=2?30*i:0),p=n-y/2,m=s-g/2+x,b=Math.max(1,Math.ceil(Math.sqrt(h.length))),v=y/b,I=g/Math.max(1,Math.ceil(h.length/b));for(const[e,a]of h.entries()){const t=e%b,n=Math.floor(e/b),s=p+v*(t+.5),l=m+I*(n+.5);o&&d.append("rect").attr("class","venn-text-debug-cell").attr("x",p+v*t).attr("y",m+I*n).attr("width",v).attr("height",I).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const c=.9*v,h=.9*I,u=d.append("foreignObject").attr("class","venn-text-node-fo").attr("width",c).attr("height",h).attr("x",s-c/2).attr("y",l-h/2).attr("overflow","visible"),f=r.get(a.id)?.color,y=u.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);f&&y.style("color",f)}}}function At(t){const e=new Set(t.map(t=>[...t.sets].sort().join("|"))),n=new Map(t.filter(t=>1===t.sets.length&&void 0!==t.size).map(t=>[t.sets[0],t.size])),s=[];for(const i of t){if(i.sets.length<3)continue;const t=[...i.sets].sort();for(let i=0;i<t.length-1;i++)for(let r=i+1;r<t.length;r++){const o=[t[i],t[r]],a=o.join("|");if(!e.has(a)){e.add(a);const t=n.get(o[0]),i=n.get(o[1]),r=void 0!==t&&void 0!==i?Math.min(t,i)/4:2.5;s.push({sets:o,size:r,label:""})}}}return s.length>0?[...t,...s]:t}o(Tt,"stableSetsKey"),o(zt,"renderTextNodes"),o(At,"ensurePairwiseSubsets");var Rt={parser:st,db:wt,renderer:{draw:Et},styles:_t};export{Rt as diagram};
@@ -0,0 +1 @@
1
+ import{p as t}from"./chunk-JWPE2WC7-BP2iXBhe.js";import{s as e,g as a,t as r,q as n,a as o,b as i,_ as s,W as l,L as d,N as c,l as p,Q as x,d as h,z as y,c as g}from"./mermaid-T_6Ze_cT.js";import{p as f}from"./cynefin-EF2NZ3EQ-CR1E3YiZ.js";import"./markdown-S2mWvoE-.js";var u=s((t,e)=>{const a=t<=1?100*t:t;if(a<0||a>100)throw new Error(`${e} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${t}`);return a},"toPercent"),m=s((t,e,a)=>({x:u(e,`${a} evolution`),y:u(t,`${a} visibility`)}),"toCoordinates"),w=s(t=>{if(t)return"+<>"===t?"bidirectional":"+<"===t?"backward":"+>"===t?"forward":void 0},"getFlowFromPort"),k=s(t=>{if(!t?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(t),a=e?.[1];return t.includes("<>")?{flow:"bidirectional",label:a}:t.includes("<")?{flow:"backward",label:a}:t.includes(">")?{flow:"forward",label:a}:{label:a}},"extractFlowFromArrow"),b=s((e,a)=>{if(t(e,a),e.size&&a.setSize(e.size.width,e.size.height),e.evolution){const t=e.evolution.stages.map(t=>t.secondName?`${t.name.trim()} / ${t.secondName.trim()}`:t.name.trim()),r=e.evolution.stages.filter(t=>void 0!==t.boundary).map(t=>t.boundary);a.updateAxes({stages:t,stageBoundaries:r})}if(e.anchors.forEach(t=>{const e=m(t.visibility,t.evolution,`Anchor "${t.name}"`);a.addNode(t.name,t.name,e.x,e.y,"anchor")}),e.components.forEach(t=>{const e=m(t.visibility,t.evolution,`Component "${t.name}"`),r=t.label?(t.label.negX?-1:1)*t.label.offsetX:void 0,n=t.label?(t.label.negY?-1:1)*t.label.offsetY:void 0,o=t.decorator?.strategy;a.addNode(t.name,t.name,e.x,e.y,"component",r,n,t.inertia,o)}),e.notes.forEach(t=>{const e=m(t.visibility,t.evolution,`Note "${t.text}"`);a.addNote(t.text,e.x,e.y)}),e.pipelines.forEach(t=>{const e=a.getNode(t.parent);if(!e||"number"!=typeof e.y)throw new Error(`Pipeline "${t.parent}" must reference an existing component with coordinates.`);const r=e.y;a.startPipeline(t.parent),t.components.forEach(e=>{const n=`${t.parent}_${e.name}`,o=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,s=u(e.evolution,`Pipeline component "${e.name}" evolution`);a.addNode(n,e.name,s,r,"pipeline-component",o,i),a.addPipelineComponent(t.parent,n)})}),e.links.forEach(t=>{const e=!!t.arrow&&(t.arrow.includes("-.->")||t.arrow.includes(".-."));let r=w(t.fromPort)??w(t.toPort);const{flow:n,label:o}=k(t.arrow);!r&&n&&(r=n);const i=t.linkLabel,s=o??i;a.addLink(a.resolveNodeId(t.from),a.resolveNodeId(t.to),e,s,r)}),e.evolves.forEach(t=>{const e=a.getNode(t.component);if(void 0!==e?.y){const r=u(t.target,`Evolve target for "${t.component}"`);a.addTrend(t.component,r,e.y)}}),e.annotations.length>0){const t=e.annotations[0],r=m(t.x,t.y,"Annotations box");a.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(t=>{const e=m(t.x,t.y,`Annotation ${t.number}`);a.addAnnotation(t.number,[{x:e.x,y:e.y}],t.text)}),e.accelerators.forEach(t=>{const e=m(t.x,t.y,`Accelerator "${t.name}"`);a.addAccelerator(t.name,e.x,e.y)}),e.deaccelerators.forEach(t=>{const e=m(t.x,t.y,`Deaccelerator "${t.name}"`);a.addDeaccelerator(t.name,e.x,e.y)})},"populateDb"),$={parser:{yy:void 0},parse:s(async t=>{const e=await f("wardley",t);p.debug(e);const a=$.parser?.yy;if(!a||"function"!=typeof a.addNode)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.");b(e,a)},"parse")},v=new 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{s(this,"WardleyBuilder")}addNode(t){const e=this.nodes.get(t.id)??{id:t.id,label:t.label},a={...e,...t,className:t.className??e.className,labelOffsetX:t.labelOffsetX??e.labelOffsetX,labelOffsetY:t.labelOffsetY??e.labelOffsetY};this.nodes.set(t.id,a)}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]});const e=this.nodes.get(t);e&&(e.isPipelineParent=!0)}addPipelineComponent(t,e){const a=this.pipelines.get(t);a&&a.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,e){this.annotationsBox={x:t,y:e}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,e){this.size={width:t,height:e}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(this.nodes.has(t))return t;for(const[e,a]of this.nodes)if(a.label===t)return e;return t}build(){const t=[];for(const e of this.nodes.values()){if("number"!=typeof e.x||"number"!=typeof e.y)throw new Error(`Node "${e.label}" is missing coordinates`);t.push(e)}return{nodes:t,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}};function S(){return g()["wardley-beta"]}function M(t,e,a,r,n,o,i,s,l){v.addNode({id:t,label:e,x:a,y:r,className:n,labelOffsetX:o,labelOffsetY:i,inertia:s,sourceStrategy:l})}function C(t,e,a=!1,r,n){v.addLink({source:t,target:e,dashed:a,label:r,flow:n})}function P(t,e,a){v.addTrend({nodeId:t,targetX:e,targetY:a})}function N(t,e,a){v.addAnnotation({number:t,coordinates:e,text:a})}function z(t,e,a){v.addNote({text:t,x:e,y:a})}function L(t,e,a){v.addAccelerator({name:t,x:e,y:a})}function T(t,e,a){v.addDeaccelerator({name:t,x:e,y:a})}function A(t,e){v.setAnnotationsBox(t,e)}function E(t,e){v.setSize(t,e)}function I(t){v.startPipeline(t)}function B(t,e){v.addPipelineComponent(t,e)}function F(t){v.setAxes(t)}function R(t){return v.getNode(t)}function X(t){return v.resolveNodeId(t)}function Y(){return v.build()}function O(){v.clear(),y()}s(S,"getConfig"),s(M,"addNode"),s(C,"addLink"),s(P,"addTrend"),s(N,"addAnnotation"),s(z,"addNote"),s(L,"addAccelerator"),s(T,"addDeaccelerator"),s(A,"setAnnotationsBox"),s(E,"setSize"),s(I,"startPipeline"),s(B,"addPipelineComponent"),s(F,"updateAxes"),s(R,"getNode"),s(X,"resolveNodeId"),s(Y,"getWardleyData"),s(O,"clear");var D={getConfig:S,addNode:M,addLink:C,addTrend:P,addAnnotation:N,addNote:z,addAccelerator:L,addDeaccelerator:T,setAnnotationsBox:A,setSize:E,startPipeline:I,addPipelineComponent:B,updateAxes:F,getNode:R,resolveNodeId:X,getWardleyData:Y,clear:O,setAccTitle:i,getAccTitle:o,setDiagramTitle:n,getDiagramTitle:r,getAccDescription:a,setAccDescription:e},W=["Genesis","Custom Built","Product","Commodity"],q=s(()=>{const{themeVariables:t}=g();return{backgroundColor:t.wardley?.backgroundColor??t.background??"#fff",axisColor:t.wardley?.axisColor??"#000",axisTextColor:t.wardley?.axisTextColor??t.primaryTextColor??"#222",gridColor:t.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:t.wardley?.componentFill??"#fff",componentStroke:t.wardley?.componentStroke??"#000",componentLabelColor:t.wardley?.componentLabelColor??t.primaryTextColor??"#222",linkStroke:t.wardley?.linkStroke??"#000",evolutionStroke:t.wardley?.evolutionStroke??"#dc3545",annotationStroke:t.wardley?.annotationStroke??"#000",annotationTextColor:t.wardley?.annotationTextColor??t.primaryTextColor??"#222",annotationFill:t.wardley?.annotationFill??t.background??"#fff"}},"getTheme"),j=s(()=>{const t=g()["wardley-beta"];return{width:t?.width??900,height:t?.height??600,padding:t?.padding??48,nodeRadius:t?.nodeRadius??6,nodeLabelOffset:t?.nodeLabelOffset??8,axisFontSize:t?.axisFontSize??12,labelFontSize:t?.labelFontSize??10,showGrid:t?.showGrid??!1,useMaxWidth:t?.useMaxWidth??!0}},"getConfigValues"),G={parser:$,db:D,renderer:{draw:s((t,e,a,r)=>{p.debug("Rendering Wardley map\n"+t);const n=j(),o=q(),i=1.6*n.nodeRadius,l=r.db,d=l.getWardleyData(),c=l.getDiagramTitle(),y=d.size?.width??n.width,g=d.size?.height??n.height,f=x(e);f.selectAll("*").remove(),h(f,g,y,n.useMaxWidth),f.attr("viewBox",`0 0 ${y} ${g}`);const u=f.append("g").attr("class","wardley-map"),m=f.append("defs");m.append("marker").attr("id",`arrow-${e}`).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",o.evolutionStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-end-${e}`).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",o.linkStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-start-${e}`).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",o.linkStroke).attr("stroke","none"),u.append("rect").attr("class","wardley-background").attr("width",y).attr("height",g).attr("fill",o.backgroundColor);const w=y-2*n.padding,k=g-2*n.padding;c&&u.append("text").attr("class","wardley-title").attr("x",y/2).attr("y",n.padding/2).attr("fill",o.axisTextColor).attr("font-size",1.05*n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(c);const b=s(t=>n.padding+t/100*w,"projectX"),$=s(t=>g-n.padding-t/100*k,"projectY"),v=u.append("g").attr("class","wardley-axes");v.append("line").attr("x1",n.padding).attr("x2",y-n.padding).attr("y1",g-n.padding).attr("y2",g-n.padding).attr("stroke",o.axisColor).attr("stroke-width",1),v.append("line").attr("x1",n.padding).attr("x2",n.padding).attr("y1",n.padding).attr("y2",g-n.padding).attr("stroke",o.axisColor).attr("stroke-width",1);const S=d.axes.xLabel??"Evolution",M=d.axes.yLabel??"Visibility";v.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",n.padding+w/2).attr("y",g-n.padding/4).attr("fill",o.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(S),v.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",n.padding/3).attr("y",n.padding+k/2).attr("fill",o.axisTextColor).attr("font-size",n.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${n.padding/3} ${n.padding+k/2})`).text(M);const C=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:W;if(C.length>0){const t=u.append("g").attr("class","wardley-stages"),e=d.axes.stageBoundaries,a=[];if(e&&e.length===C.length){let t=0;e.forEach(e=>{a.push({start:t,end:e}),t=e})}else{const t=1/C.length;C.forEach((e,r)=>{a.push({start:r*t,end:(r+1)*t})})}C.forEach((e,r)=>{const i=a[r],s=n.padding+i.start*w,l=(s+(n.padding+i.end*w))/2;r>0&&t.append("line").attr("x1",s).attr("x2",s).attr("y1",n.padding).attr("y2",g-n.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",l).attr("y",g-n.padding/1.5).attr("fill",o.axisTextColor).attr("font-size",n.axisFontSize-2).attr("text-anchor","middle").text(e)})}if(n.showGrid){const t=u.append("g").attr("class","wardley-grid");for(let e=1;e<4;e++){const a=e/4,r=n.padding+w*a;t.append("line").attr("x1",r).attr("x2",r).attr("y1",n.padding).attr("y2",g-n.padding).attr("stroke",o.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",n.padding).attr("x2",y-n.padding).attr("y1",g-n.padding-k*a).attr("y2",g-n.padding-k*a).attr("stroke",o.gridColor).attr("stroke-dasharray","2 6")}}const P=new Map;if(d.nodes.forEach(t=>{P.set(t.id,{x:b(t.x),y:$(t.y),node:t})}),d.pipelines.length>0){const t=u.append("g").attr("class","wardley-pipelines"),e=u.append("g").attr("class","wardley-pipeline-links");d.pipelines.forEach(a=>{if(0===a.componentIds.length)return;const r=a.componentIds.map(t=>({id:t,pos:P.get(t),node:d.nodes.find(e=>e.id===t)})).filter(t=>t.pos&&t.node).sort((t,e)=>t.node.x-e.node.x);for(let t=0;t<r.length-1;t++){const a=r[t],n=r[t+1];e.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",a.pos.x).attr("y1",a.pos.y).attr("x2",n.pos.x).attr("y2",n.pos.y).attr("stroke",o.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let s=1/0,l=-1/0,c=0;if(a.componentIds.forEach(t=>{const e=P.get(t);e&&(s=Math.min(s,e.x),l=Math.max(l,e.x),c=e.y)}),s!==1/0&&l!==-1/0){const e=15,r=4*n.nodeRadius,d=c-r/2,p=P.get(a.nodeId);if(p){const t=(s+l)/2;p.x=t,p.y=d-i/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",s-e).attr("y",d).attr("width",l-s+2*e).attr("height",r).attr("fill","none").attr("stroke",o.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const N=u.append("g").attr("class","wardley-links"),z=new Map;d.pipelines.forEach(t=>{z.set(t.nodeId,new Set(t.componentIds))});const L=d.links.filter(t=>{if(!P.has(t.source)||!P.has(t.target))return!1;const e=z.get(t.target);return!e?.has(t.source)});N.selectAll("line").data(L).enter().append("line").attr("class",t=>"wardley-link"+(t.dashed?" wardley-link--dashed":"")).attr("x1",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?i/Math.sqrt(2):n.nodeRadius,o=a.x-e.x,s=a.y-e.y,l=Math.sqrt(o*o+s*s);return e.x+o/l*r}).attr("y1",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?i/Math.sqrt(2):n.nodeRadius,o=a.x-e.x,s=a.y-e.y,l=Math.sqrt(o*o+s*s);return e.y+s/l*r}).attr("x2",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?i/Math.sqrt(2):n.nodeRadius,o=e.x-a.x,s=e.y-a.y,l=Math.sqrt(o*o+s*s);return a.x+o/l*r}).attr("y2",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?i/Math.sqrt(2):n.nodeRadius,o=e.x-a.x,s=e.y-a.y,l=Math.sqrt(o*o+s*s);return a.y+s/l*r}).attr("stroke",o.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>"forward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-end-${e})`:null).attr("marker-start",t=>"backward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-start-${e})`:null),N.selectAll("text").data(L.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.x+a.x)/2,n=a.y-e.y,o=a.x-e.x;return r+8*(n/Math.sqrt(o*o+n*n))}).attr("y",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.y+a.y)/2,n=a.x-e.x,o=a.y-e.y;return r+8*(-n/Math.sqrt(n*n+o*o))}).attr("fill",o.axisTextColor).attr("font-size",n.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.x+a.x)/2,n=(e.y+a.y)/2,o=a.x-e.x,i=a.y-e.y,s=Math.sqrt(o*o+i*i),l=r+8*(i/s),d=n+8*(-o/s);let c=180*Math.atan2(i,o)/Math.PI;return(c>90||c<-90)&&(c+=180),`rotate(${c} ${l} ${d})`}).text(t=>t.label);const T=u.append("g").attr("class","wardley-trends"),A=d.trends.map(t=>{const e=P.get(t.nodeId);if(!e)return null;const a=b(t.targetX),r=$(t.targetY),o=a-e.x,i=r-e.y,s=Math.sqrt(o*o+i*i),l=n.nodeRadius+2;return{origin:e,targetX:a,targetY:r,adjustedX2:s>l?a-o/s*l:a,adjustedY2:s>l?r-i/s*l:r}}).filter(t=>null!==t);T.selectAll("line").data(A).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",o.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${e})`);const E=u.append("g").attr("class","wardley-nodes").selectAll("g").data(d.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));E.filter(t=>"outsource"===t.sourceStrategy).append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*n.nodeRadius).attr("fill","#666").attr("stroke",o.componentStroke).attr("stroke-width",1),E.filter(t=>"buy"===t.sourceStrategy).append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*n.nodeRadius).attr("fill","#ccc").attr("stroke",o.componentStroke).attr("stroke-width",1),E.filter(t=>"build"===t.sourceStrategy).append("circle").attr("class","wardley-build-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*n.nodeRadius).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const I=E.filter(t=>"market"===t.sourceStrategy);I.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*n.nodeRadius).attr("fill","white").attr("stroke",o.componentStroke).attr("stroke-width",1),E.filter(t=>!t.isPipelineParent&&"market"!==t.sourceStrategy&&"anchor"!==t.className).append("circle").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",n.nodeRadius).attr("fill",o.componentFill).attr("stroke",o.componentStroke).attr("stroke-width",1);const B=.7*n.nodeRadius,F=1.2*n.nodeRadius;if(I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x).attr("y1",t=>P.get(t.id).y-F).attr("x2",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("y2",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("stroke",o.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("y1",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("x2",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("y2",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("stroke",o.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("y1",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("x2",t=>P.get(t.id).x).attr("y2",t=>P.get(t.id).y-F).attr("stroke",o.componentStroke).attr("stroke-width",1),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y-F).attr("r",B).attr("fill","white").attr("stroke",o.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("cy",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("r",B).attr("fill","white").attr("stroke",o.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("cy",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("r",B).attr("fill","white").attr("stroke",o.componentStroke).attr("stroke-width",2),E.filter(t=>!0===t.isPipelineParent).append("rect").attr("x",t=>P.get(t.id).x-i/2).attr("y",t=>P.get(t.id).y-i/2).attr("width",i).attr("height",i).attr("fill",o.componentFill).attr("stroke",o.componentStroke).attr("stroke-width",1),E.filter(t=>!0===t.inertia).append("line").attr("class","wardley-inertia").attr("x1",t=>{const e=P.get(t.id);let a=t.isPipelineParent?i/2+15:n.nodeRadius+15;return t.sourceStrategy&&(a+=n.nodeRadius+10),e.x+a}).attr("y1",t=>{const e=P.get(t.id),a=t.isPipelineParent?i:2*n.nodeRadius;return e.y-a/2}).attr("x2",t=>{const e=P.get(t.id);let a=t.isPipelineParent?i/2+15:n.nodeRadius+15;return t.sourceStrategy&&(a+=n.nodeRadius+10),e.x+a}).attr("y2",t=>{const e=P.get(t.id),a=t.isPipelineParent?i:2*n.nodeRadius;return e.y+a/2}).attr("stroke",o.componentStroke).attr("stroke-width",6),E.append("text").attr("x",t=>{const e=P.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetX?e.x+t.labelOffsetX:e.x;let a=n.nodeLabelOffset;t.sourceStrategy&&void 0===t.labelOffsetX&&(a+=10);const r=t.labelOffsetX??a;return e.x+r}).attr("y",t=>{const e=P.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetY?e.y+t.labelOffsetY:e.y-3;let a=-n.nodeLabelOffset;t.sourceStrategy&&void 0===t.labelOffsetY&&(a-=10);const r=t.labelOffsetY??a;return e.y+r}).attr("class","wardley-node-label").attr("fill",t=>"evolved"===t.className?o.evolutionStroke:"anchor"===t.className?"#000":o.componentLabelColor).attr("font-size",n.labelFontSize).attr("font-weight",t=>"anchor"===t.className?"bold":"normal").attr("text-anchor",t=>"anchor"===t.className?"middle":"start").attr("dominant-baseline",t=>"anchor"===t.className?"middle":"auto").text(t=>t.label),d.annotations.length>0){const t=u.append("g").attr("class","wardley-annotations");if(d.annotations.forEach(e=>{const a=e.coordinates.map(t=>({x:b(t.x),y:$(t.y)}));if(a.length>1)for(let r=0;r<a.length-1;r++)t.append("line").attr("class","wardley-annotation-line").attr("x1",a[r].x).attr("y1",a[r].y).attr("x2",a[r+1].x).attr("y2",a[r+1].y).attr("stroke",o.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");a.forEach(a=>{const r=t.append("g").attr("class","wardley-annotation");r.append("circle").attr("cx",a.x).attr("cy",a.y).attr("r",10).attr("fill","white").attr("stroke",o.axisColor).attr("stroke-width",1.5),r.append("text").attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",o.axisTextColor).attr("font-weight","bold").text(e.number)})}),d.annotationsBox){let e=b(d.annotationsBox.x),a=$(d.annotationsBox.y);const r=10,i=16,s=11,l=t.append("g").attr("class","wardley-annotations-box"),c=[...d.annotations].filter(t=>t.text).sort((t,e)=>t.number-e.number),p=[];if(c.forEach((t,n)=>{const d=l.append("text").attr("x",e+r).attr("y",a+r+(n+1)*i).attr("font-size",s).attr("fill",o.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${t.number}. ${t.text}`);p.push(d)}),p.length>0){let t=0,s=0;p.forEach(e=>{const a=e.node(),r=a.getComputedTextLength();t=Math.max(t,r);const n=a.getBBox();s=Math.max(s,n.height)});const d=t+2*r+105,x=c.length*i+2*r+s/2,h=n.padding,f=y-n.padding-d,u=n.padding,m=g-n.padding-x;e=Math.max(h,Math.min(e,f)),a=Math.max(u,Math.min(a,m)),p.forEach((t,n)=>{t.attr("x",e+r).attr("y",a+r+(n+1)*i)}),l.insert("rect","text").attr("x",e).attr("y",a).attr("width",d).attr("height",x).attr("fill","white").attr("stroke",o.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(d.notes.length>0){const t=u.append("g").attr("class","wardley-notes");d.notes.forEach(e=>{const a=b(e.x),r=$(e.y);t.append("text").attr("x",a).attr("y",r).attr("text-anchor","start").attr("font-size",11).attr("fill",o.axisTextColor).attr("font-weight","bold").text(e.text)})}if(d.accelerators.length>0){const t=u.append("g").attr("class","wardley-accelerators");d.accelerators.forEach(e=>{const a=b(e.x),r=$(e.y),n=60,i=`\n M ${a} ${r-15}\n L ${a+n-20} ${r-15}\n L ${a+n-20} ${r-15-8}\n L ${a+n} ${r}\n L ${a+n-20} ${r+15+8}\n L ${a+n-20} ${r+15}\n L ${a} ${r+15}\n Z\n `;t.append("path").attr("d",i).attr("fill","white").attr("stroke",o.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",o.axisTextColor).attr("font-weight","bold").text(e.name)})}if(d.deaccelerators.length>0){const t=u.append("g").attr("class","wardley-deaccelerators");d.deaccelerators.forEach(e=>{const a=b(e.x),r=$(e.y),n=`\n M ${a+60} ${r-15}\n L ${a+20} ${r-15}\n L ${a+20} ${r-15-8}\n L ${a} ${r}\n L ${a+20} ${r+15+8}\n L ${a+20} ${r+15}\n L ${a+60} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",o.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",o.axisTextColor).attr("font-weight","bold").text(e.name)})}},"draw")},styles:s(({wardley:t}={})=>{const e=l(),a=d(),r=c(e,a.themeVariables),n=c(r.wardley,t);return`\n .wardley-background {\n fill: ${n.backgroundColor};\n }\n .wardley-axes line, .wardley-axes path {\n stroke: ${n.axisColor};\n }\n .wardley-axis-label {\n fill: ${n.axisTextColor};\n }\n .wardley-stage-label {\n fill: ${n.axisTextColor};\n }\n .wardley-grid line {\n stroke: ${n.gridColor};\n }\n .wardley-node circle {\n fill: ${n.componentFill};\n stroke: ${n.componentStroke};\n }\n .wardley-node-label {\n fill: ${n.componentLabelColor};\n }\n .wardley-link {\n stroke: ${n.linkStroke};\n }\n .wardley-link--dashed {\n stroke-dasharray: 4 4;\n }\n .wardley-link-label {\n fill: ${n.axisTextColor};\n }\n .wardley-trend line {\n stroke: ${n.evolutionStroke};\n }\n .wardley-annotation-line {\n stroke: ${n.annotationStroke};\n }\n .wardley-annotation circle {\n fill: ${n.annotationFill};\n stroke: ${n.annotationStroke};\n }\n .wardley-annotation text {\n fill: ${n.annotationTextColor};\n }\n .wardley-annotations-box rect {\n fill: ${n.annotationFill};\n stroke: ${n.annotationStroke};\n }\n .wardley-annotations-box text {\n fill: ${n.annotationTextColor};\n }\n .wardley-pipeline-box {\n stroke: ${n.componentStroke};\n }\n .wardley-notes text {\n fill: ${n.axisTextColor};\n }\n `},"styles")};export{G as diagram};
@@ -0,0 +1 @@
1
+ import{s as t,g as i,t as e,q as s,a,b as n,_ as h,l as o,Q as r,d as l,z as c,L as g,j as u,N as x,O as d,W as p,X as f,Y as m,V as y,Z as b}from"./mermaid-T_6Ze_cT.js";import"./markdown-S2mWvoE-.js";var w=function(){var t=h(function(t,i,e,s){for(e=e||{},s=t.length;s--;e[t[s]]=i);return e},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],a=[1,5],n=[1,6],o=[1,7],r=[1,5,10,12,14,16,18,19,21,23,36,37,38],l=[1,25],c=[1,26],g=[1,28],u=[1,29],x=[1,30],d=[1,31],p=[1,32],f=[1,33],m=[1,34],y=[1,35],b=[1,36],w=[1,37],S=[1,43],A=[1,42],C=[1,47],k=[1,50],R=[1,10,12,14,16,18,19,21,23,36,37,38],T=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],_=[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],D=[1,65],L=[26,28],P={trace:h(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:h(function(t,i,e,s,a,n,h){var o=n.length-1;switch(a){case 5:s.setOrientation(n[o]);break;case 9:s.setDiagramTitle(n[o].text.trim());break;case 12:s.setLineData({text:"",type:"text"},n[o]);break;case 13:s.setLineData(n[o-1],n[o]);break;case 14:s.setBarData({text:"",type:"text"},n[o]);break;case 15:s.setBarData(n[o-1],n[o]);break;case 16:this.$=n[o].trim(),s.setAccTitle(this.$);break;case 17:case 18:this.$=n[o].trim(),s.setAccDescription(this.$);break;case 19:case 29:this.$=n[o-1];break;case 20:case 30:this.$=[n[o-2],...n[o]];break;case 21:case 31:this.$=[n[o]];break;case 22:this.$={value:Number(n[o-1]),label:n[o]};break;case 23:this.$={value:Number(n[o]),label:""};break;case 24:s.setXAxisTitle(n[o]);break;case 25:s.setXAxisTitle(n[o-1]);break;case 26:s.setXAxisTitle({type:"text",text:""});break;case 27:s.setXAxisBand(n[o]);break;case 28:s.setXAxisRangeData(Number(n[o-2]),Number(n[o]));break;case 32:s.setYAxisTitle(n[o]);break;case 33:s.setYAxisTitle(n[o-1]);break;case 34:s.setYAxisTitle({type:"text",text:""});break;case 35:s.setYAxisRangeData(Number(n[o-2]),Number(n[o]));break;case 39:case 40:this.$={text:n[o],type:"text"};break;case 41:this.$={text:n[o],type:"markdown"};break;case 42:this.$=n[o];break;case 43:this.$=n[o-1]+""+n[o]}},"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,36:a,37:n,38:o}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,36:a,37:n,38:o}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:a,37:n,38:o}),{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(r,[2,36]),t(r,[2,37]),t(r,[2,38]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,36:a,37:n,38:o}),{1:[2,3]},t(r,[2,5]),t(i,[2,7],{4:22,36:a,37:n,38:o}),{11:23,30:l,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:39,13:38,24:S,29:A,30:l,31:40,32:41,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:45,15:44,29:C,30:l,35:46,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:49,17:48,24:k,30:l,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{11:52,17:51,24:k,30:l,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},{20:[1,53]},{22:[1,54]},t(R,[2,18]),{1:[2,2]},t(R,[2,8]),t(R,[2,9]),t(T,[2,39],{41:55,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w}),t(T,[2,40]),t(T,[2,41]),t(_,[2,42]),t(_,[2,44]),t(_,[2,45]),t(_,[2,46]),t(_,[2,47]),t(_,[2,48]),t(_,[2,49]),t(_,[2,50]),t(_,[2,51]),t(_,[2,52]),t(_,[2,53]),t(R,[2,10]),t(R,[2,24],{32:41,31:56,24:S,29:A}),t(R,[2,26]),t(R,[2,27]),{33:[1,57]},{11:59,30:l,34:58,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},t(R,[2,11]),t(R,[2,32],{35:60,29:C}),t(R,[2,34]),{33:[1,61]},t(R,[2,12]),{17:62,24:k},{25:63,27:64,29:D},t(R,[2,14]),{17:66,24:k},t(R,[2,16]),t(R,[2,17]),t(_,[2,43]),t(R,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},t(R,[2,33]),{29:[1,70]},t(R,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},t(L,[2,23],{30:[1,73]}),t(R,[2,15]),t(R,[2,28]),t(R,[2,29]),{11:59,30:l,34:74,39:24,40:c,41:27,42:g,43:u,44:x,45:d,46:p,47:f,48:m,49:y,50:b,51:w},t(R,[2,35]),t(R,[2,19]),{25:75,27:64,29:D},t(L,[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:h(function(t,i){if(!i.recoverable){var e=new Error(t);throw e.hash=i,e}this.trace(t)},"parseError"),parse:h(function(t){var i=this,e=[0],s=[],a=[null],n=[],o=this.table,r="",l=0,c=0,g=n.slice.call(arguments,1),u=Object.create(this.lexer),x={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(x.yy[d]=this.yy[d]);u.setInput(t,x.yy),x.yy.lexer=u,x.yy.parser=this,void 0===u.yylloc&&(u.yylloc={});var p=u.yylloc;n.push(p);var f=u.options&&u.options.ranges;function m(){var t;return"number"!=typeof(t=s.pop()||u.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=i.symbols_[t]||t),t}"function"==typeof x.yy.parseError?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,h(function(t){e.length=e.length-2*t,a.length=a.length-t,n.length=n.length-t},"popStack"),h(m,"lex");for(var y,b,w,S,A,C,k,R,T={};;){if(b=e[e.length-1],this.defaultActions[b]?w=this.defaultActions[b]:(null==y&&(y=m()),w=o[b]&&o[b][y]),void 0===w||!w.length||!w[0]){var _="";for(A in R=[],o[b])this.terminals_[A]&&A>2&&R.push("'"+this.terminals_[A]+"'");_=u.showPosition?"Parse error on line "+(l+1)+":\n"+u.showPosition()+"\nExpecting "+R.join(", ")+", got '"+(this.terminals_[y]||y)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==y?"end of input":"'"+(this.terminals_[y]||y)+"'"),this.parseError(_,{text:u.match,token:this.terminals_[y]||y,line:u.yylineno,loc:p,expected:R})}if(w[0]instanceof Array&&w.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+y);switch(w[0]){case 1:e.push(y),a.push(u.yytext),n.push(u.yylloc),e.push(w[1]),y=null,c=u.yyleng,r=u.yytext,l=u.yylineno,p=u.yylloc;break;case 2:if(C=this.productions_[w[1]][1],T.$=a[a.length-C],T._$={first_line:n[n.length-(C||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(C||1)].first_column,last_column:n[n.length-1].last_column},f&&(T._$.range=[n[n.length-(C||1)].range[0],n[n.length-1].range[1]]),void 0!==(S=this.performAction.apply(T,[r,c,l,x.yy,w[1],a,n].concat(g))))return S;C&&(e=e.slice(0,-1*C*2),a=a.slice(0,-1*C),n=n.slice(0,-1*C)),e.push(this.productions_[w[1]][0]),a.push(T.$),n.push(T._$),k=o[e[e.length-2]][e[e.length-1]],e.push(k);break;case 3:return!0}}return!0},"parse")},v=function(){return{EOF:1,parseError:h(function(t,i){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,i)},"parseError"),setInput:h(function(t,i){return this.yy=i||this.yy||{},this._input=t,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:h(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:h(function(t){var i=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var s=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),e.length-1&&(this.yylineno-=e.length-1);var a=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:e?(e.length===s.length?this.yylloc.first_column:0)+s[s.length-e.length].length-e[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:h(function(t){this.unput(this.match.slice(t))},"less"),pastInput:h(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var t=this.pastInput(),i=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+i+"^"},"showPosition"),test_match:h(function(t,i){var e,s,a;if(this.options.backtrack_lexer&&(a={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&&(a.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack){for(var n in a)this[n]=a[n];return!1}return!1},"test_match"),next:h(function(){if(this.done)return this.EOF;var t,i,e,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var a=this._currentRules(),n=0;n<a.length;n++)if((e=this._input.match(this.rules[a[n]]))&&(!i||e[0].length>i[0].length)){if(i=e,s=n,this.options.backtrack_lexer){if(!1!==(t=this.test_match(e,a[n])))return t;if(this._backtrack){i=!1;continue}return!1}if(!this.options.flex)break}return i?!1!==(t=this.test_match(i,a[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:h(function(){var t=this.next();return t||this.lex()},"lex"),begin:h(function(t){this.conditionStack.push(t)},"begin"),popState:h(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:h(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:h(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:h(function(t){this.begin(t)},"pushState"),stateStackSize:h(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:h(function(t,i,e,s){switch(e){case 0:case 1:case 5:case 44:break;case 2:case 3:return this.popState(),36;case 4:return 36;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:case 26:case 28:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 33;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 29;case 25:return this.popState(),26;case 27:this.pushState("string");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 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}}}}();function E(){this.yy={}}return P.lexer=v,h(E,"Parser"),E.prototype=P,P.Parser=E,new E}();w.parser=w;var S=w;function A(t){return"bar"===t.type}function C(t){return"band"===t.type}function k(t){return"linear"===t.type}h(A,"isBarPlot"),h(C,"isBandAxisData"),h(k,"isLinearAxisData");var R=class{constructor(t){this.parentGroup=t}static{h(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((t,i)=>Math.max(i.length,t),0)*i,height:i};const e={width:0,height:0},s=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i),a=s.node()?.getScreenCTM?.(),n=h(t=>t&&t>0?t:1,"toScale"),o=n(a?.a),r=n(a?.d);for(const h of t){const t=m(s,1,h),a=t?t.width/o:h.length*i,n=t?t.height/r:i;e.width=Math.max(e.width,a),e.height=Math.max(e.height,n)}return s.remove(),e}},T=class{constructor(t,i,e,s){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,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{h(this,"BaseAxis")}setRange(t){this.range=t,"left"===this.axisPosition||"right"===this.axisPosition?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(){const 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(){.7*this.getTickDistance()>2*this.outerPadding&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.width;this.outerPadding=Math.min(e.width/2,s);let a=e.height;"bottom"===this.axisPosition&&0!==this.normalizedLabelRotationInRad&&(a=Math.max(a,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*e.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*e.height))),a+=2*this.axisConfig.labelPadding,this.labelTextHeight=e.height,a<=i&&(i-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){const e=this.getLabelDimension(),s=.2*t.height;this.outerPadding=Math.min(e.height/2,s);const a=e.width+2*this.axisConfig.labelPadding;a<=i&&(i-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){const t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return"left"===this.axisPosition||"right"===this.axisPosition?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){const i=this.normalizedLabelRotationInRad;return 0===i?0:Math.sin(i)*this.getLabelDimension()[t]/2}getDrawableElementsForLeftAxis(){const t=[];if(this.showAxisLine){const i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${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(t=>({text:t.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(t),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){const i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${i},${this.getScaleValue(t)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(t)}`,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(){const t=[];if(this.showAxisLine){const i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t)+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:180*this.normalizedLabelRotationInRad/Math.PI,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${this.getScaleValue(t)},${i} L ${this.getScaleValue(t)},${i+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(){const t=[];if(this.showAxisLine){const i=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},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+2*this.axisConfig.titlePadding:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){const i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${this.getScaleValue(t)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(t)},${i+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("left"===this.axisPosition)return this.getDrawableElementsForLeftAxis();if("right"===this.axisPosition)throw Error("Drawing of right axis is not implemented");return"bottom"===this.axisPosition?this.getDrawableElementsForBottomAxis():"top"===this.axisPosition?this.getDrawableElementsForTopAxis():[]}},_=class extends T{static{h(this,"BandAxis")}constructor(t,i,e,s,a){super(t,s,a,i),this.categories=e,this.scale=f().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=f().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),o.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},D=class extends T{static{h(this,"LinearAxis")}constructor(t,i,e,s,a){super(t,s,a,i),this.domain=e,this.scale=y().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){const t=[...this.domain];"left"===this.axisPosition&&t.reverse(),this.scale=y().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}};function L(t,i,e,s){const a=new R(s);return C(t)?new _(i,e,t.categories,t.title,a):new D(i,e,[t.min,t.max],t.title,a)}h(L,"getAxis");var P=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.titleWidth=0,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{h(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){const i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),s=i.height+2*this.chartConfig.titlePadding;return s<=t.height&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=s,this.titleWidth=i.width,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}alignTo(t,i){const e=Math.min(this.titleWidth,this.chartConfig.width)/2,s=Math.min(Math.max((t+i)/2,e),this.chartConfig.width-e);this.boundingRect.x=s-e,this.boundingRect.width=2*e}getDrawableElements(){const 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 v(t,i,e,s){const a=new R(s);return new P(a,t,i,e)}h(v,"getChartTitleComponent");function E(t){return{fontSize:t,markerSize:.75*t,markerSpacing:.35*t,itemSpacing:.5*t}}h(E,"getLegendLayout");var M=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{h(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(t=>t.title):[],0===this.visiblePlots.length)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};const{fontSize:i,markerSize:e,markerSpacing:s,itemSpacing:a}=E(this.chartConfig.legendFontSize),n=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map(t=>t.title),i),h=2*this.chartConfig.legendPadding+e+s+n.width,o=2*this.chartConfig.legendPadding+this.visiblePlots.length*i+(this.visiblePlots.length-1)*a;return h<=t.width&&o<=t.height?(this.boundingRect.width=h,this.boundingRect.height=o):(this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(0===this.visiblePlots.length)return[];const{fontSize:t,markerSize:i,markerSpacing:e,itemSpacing:s}=E(this.chartConfig.legendFontSize),a=t+s,n=this.boundingRect.x+this.chartConfig.legendPadding,h=this.boundingRect.y+this.chartConfig.legendPadding,o=[],r=[];for(const[l,c]of this.visiblePlots.entries())if(A(c))o.push({x:n,y:h+l*a,width:i,height:i,fill:c.fill,strokeFill:c.fill,strokeWidth:0});else{const t=h+l*a+i/2;r.push({path:`M ${n},${t} L ${n+i},${t}`,strokeFill:c.strokeFill,strokeWidth:c.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:o},{groupTexts:["legend","markers"],type:"path",data:r},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((s,o)=>({text:s.title,x:n+i+e,y:h+o*a+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:t,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function z(t,i,e,s){const a=new R(s);return new M(a,t,i,e)}h(z,"getChartLegendComponent");var I=class{constructor(t,i,e,s,a){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=s,this.plotIndex=a}static{h(this,"LinePlot")}getDrawableElement(){const t=this.plotData.data.map(t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]);let i;if(i="horizontal"===this.orientation?b().y(t=>t[0]).x(t=>t[1])(t):b().x(t=>t[0]).y(t=>t[1])(t),!i)return[];const e=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){const i=10,s=12,a=[];for(const[e,[n,h]]of t.entries()){const t=this.plotData.pointLabels[e];t&&("horizontal"===this.orientation?a.push({x:h+i,y:n,text:t,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:s,rotation:0}):a.push({x:n,y:h-i,text:t,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:s,rotation:0}))}a.length>0&&e.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:a})}return e}},$=class{constructor(t,i,e,s,a,n){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=s,this.orientation=a,this.plotIndex=n}static{h(this,"BarPlot")}getDrawableElement(){const t=this.barData.data.map(t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]),i=.95*Math.min(2*this.xAxis.getAxisOuterPadding(),this.xAxis.getTickDistance()),e=i/2;return"horizontal"===this.orientation?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(t=>({x:this.boundingRect.x,y:t[0]-e,height:i,width:t[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(t=>({x:t[0]-e,y:t[1],width:i,height:this.boundingRect.y+this.boundingRect.height-t[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},B=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}static{h(this,"BasePlot")}setAxes(t,i){this.xAxis=t,this.yAxis=i}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");const t=[];for(const[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{const s=new I(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}break;case"bar":{const s=new $(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}}return t}};function W(t,i,e){return new B(t,i,e)}h(W,"getPlotComponent");var F,O=class{constructor(t,i,e,s){this.chartConfig=t,this.chartData=i,this.componentStore={title:v(t,i,e,s),plot:W(t,i,e),legend:z(t,i,e,s),xAxis:L(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},s),yAxis:L(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},s)}}static{h(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,a={width:0,height:0},n=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),h=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:n,height:h});t-=o.width,i-=o.height,o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=o.height,i-=o.height,this.componentStore.xAxis.setAxisPosition("bottom"),o=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=o.height,this.componentStore.yAxis.setAxisPosition("left"),o=this.componentStore.yAxis.calculateSpace({width:t,height:i}),e=o.width,t-=o.width,a=this.componentStore.legend.calculateSpace({width:t,height:h}),t-=a.width,t>0&&(n+=t,t=0),i>0&&(h+=i,i=0),this.componentStore.plot.calculateSpace({width:n,height:h}),this.componentStore.plot.setBoundingBoxXY({x:e,y:s}),this.componentStore.title.alignTo(e,e+n),this.componentStore.legend.setBoundingBoxXY({x:e+n,y:s+Math.max((h-a.height)/2,0)}),this.componentStore.xAxis.setRange([e,e+n]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:s+h}),this.componentStore.yAxis.setRange([s,s+h]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:s}),this.chartData.plots.some(t=>A(t))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,a=0,n={width:0,height:0},h=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),o=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),r=this.componentStore.plot.calculateSpace({width:h,height:o});t-=r.width,i-=r.height,r=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),e=r.height,i-=r.height,this.componentStore.xAxis.setAxisPosition("left"),r=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=r.width,s=r.width,this.componentStore.yAxis.setAxisPosition("top"),r=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=r.height,a=e+r.height,n=this.componentStore.legend.calculateSpace({width:t,height:o}),t-=n.width,t>0&&(h+=t,t=0),i>0&&(o+=i,i=0),this.componentStore.plot.calculateSpace({width:h,height:o}),this.componentStore.plot.setBoundingBoxXY({x:s,y:a}),this.componentStore.title.alignTo(s,s+h),this.componentStore.legend.setBoundingBoxXY({x:s+h,y:a+Math.max((o-n.height)/2,0)}),this.componentStore.yAxis.setRange([s,s+h]),this.componentStore.yAxis.setBoundingBoxXY({x:s,y:e}),this.componentStore.xAxis.setRange([a,a+o]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some(t=>A(t))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){"horizontal"===this.chartConfig.chartOrientation?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();const t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(const i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},X=class{static{h(this,"XYChartBuilder")}static build(t,i,e,s){return new O(t,i,e,s).getDrawableElement()}},N=0,V=K(),Y=Q(),H=Z(),U=Y.plotColorPalette.split(",").map(t=>t.trim()),j=!1,G=!1;function Q(){const t=p(),i=g();return x(t.xyChart,i.themeVariables.xyChart)}function K(){const t=g();return x(d.xyChart,t.xyChart)}function Z(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function q(t){const i=g();return u(t.trim(),i)}function J(t){F=t}function tt(t){V.chartOrientation="horizontal"===t?"horizontal":"vertical"}function it(t){H.xAxis.title=q(t.text)}function et(t,i){H.xAxis={type:"linear",title:H.xAxis.title,min:t,max:i},j=!0}function st(t){H.xAxis={type:"band",title:H.xAxis.title,categories:t.map(t=>q(t.text))},j=!0}function at(t){H.yAxis.title=q(t.text)}function nt(t,i){H.yAxis={type:"linear",title:H.yAxis.title,min:t,max:i},G=!0}function ht(t){const i=Math.min(...t),e=Math.max(...t),s=k(H.yAxis)?H.yAxis.min:1/0,a=k(H.yAxis)?H.yAxis.max:-1/0;H.yAxis={type:"linear",title:H.yAxis.title,min:Math.min(s,i),max:Math.max(a,e)}}function ot(t){let i=[];if(0===t.length)return i;if(!j){const i=k(H.xAxis)?H.xAxis.min:1/0,e=k(H.xAxis)?H.xAxis.max:-1/0;et(Math.min(i,1),Math.max(e,t.length))}if(C(H.xAxis)&&t.length>H.xAxis.categories.length&&(t=t.slice(0,H.xAxis.categories.length)),G||ht(t),C(H.xAxis)&&(i=H.xAxis.categories.map((i,e)=>[i,t[e]])),k(H.xAxis)){const e=H.xAxis.min,s=H.xAxis.max;if(1===t.length)i=[[`${e}`,t[0]]];else{const a=(s-e)/(t.length-1);i=t.map((t,i)=>[`${e+i*a}`,t])}}return i}function rt(t){return U[0===t?0:t%U.length]}function lt(t,i){const e=i.map(t=>t.value),s=i.map(t=>t.label?q(t.label):""),a=ot(e),n=s.some(t=>""!==t);H.plots.push({type:"line",title:q(t.text),strokeFill:rt(N),strokeWidth:2,data:a,...n?{pointLabels:s}:{}}),N++}function ct(t,i){const e=ot(i.map(t=>t.value));H.plots.push({type:"bar",title:q(t.text),fill:rt(N),data:e}),N++}function gt(){if(0===H.plots.length)throw Error("No Plot to render, please provide a plot with some data");return H.title=e(),X.build(V,H,Y,F)}function ut(){return Y}function xt(){return V}function dt(){return H}h(Q,"getChartDefaultThemeConfig"),h(K,"getChartDefaultConfig"),h(Z,"getChartDefaultData"),h(q,"textSanitizer"),h(J,"setTmpSVGG"),h(tt,"setOrientation"),h(it,"setXAxisTitle"),h(et,"setXAxisRangeData"),h(st,"setXAxisBand"),h(at,"setYAxisTitle"),h(nt,"setYAxisRangeData"),h(ht,"setYAxisRangeFromPlotData"),h(ot,"transformDataWithoutCategory"),h(rt,"getPlotColorFromPalette"),h(lt,"setLineData"),h(ct,"setBarData"),h(gt,"getDrawableElem"),h(ut,"getChartThemeConfig"),h(xt,"getChartConfig"),h(dt,"getXYChartData");var pt={parser:S,db:{getDrawableElem:gt,clear:h(function(){c(),N=0,V=K(),H={yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]},Y=Q(),U=Y.plotColorPalette.split(",").map(t=>t.trim()),j=!1,G=!1},"clear"),setAccTitle:n,getAccTitle:a,setDiagramTitle:s,getDiagramTitle:e,getAccDescription:i,setAccDescription:t,setOrientation:tt,setXAxisTitle:it,setXAxisRangeData:et,setXAxisBand:st,setYAxisTitle:at,setYAxisRangeData:nt,setLineData:lt,setBarData:ct,setTmpSVGG:J,getChartThemeConfig:ut,getChartConfig:xt,getXYChartData:dt},renderer:{draw:h((t,i,e,s)=>{const a=s.db,n=a.getChartThemeConfig(),c=a.getChartConfig(),g=a.getXYChartData().plots[0].data.map(t=>t[1]);function u(t){return"top"===t?"text-before-edge":"middle"}function x(t){return"left"===t?"start":"right"===t?"end":"middle"}function d(t){return`translate(${t.x}, ${t.y}) rotate(${t.rotation||0})`}h(u,"getDominantBaseLine"),h(x,"getTextAnchor"),h(d,"getTextTransformation"),o.debug("Rendering xychart chart\n"+t);const p=r(i),f=p.append("g").attr("class","main"),m=f.append("rect").attr("width",c.width).attr("height",c.height).attr("class","background");l(p,c.height,c.width,!0),p.attr("viewBox",`0 0 ${c.width} ${c.height}`),m.attr("fill",n.backgroundColor),a.setTmpSVGG(p.append("g").attr("class","mermaid-tmp-group"));const y=a.getDrawableElem(),b={};function w(t){let i=f,e="";for(const[s]of t.entries()){let a=f;s>0&&b[e]&&(a=b[e]),e+=t[s],i=b[e],i||(i=b[e]=a.append("g").attr("class",t[s]))}return i}h(w,"getGroup");for(const o of y){if(0===o.data.length)continue;const t=w(o.groupTexts);switch(o.type){case"rect":if(t.selectAll("rect").data(o.data).enter().append("rect").attr("x",t=>t.x).attr("y",t=>t.y).attr("width",t=>t.width).attr("height",t=>t.height).attr("fill",t=>t.fill).attr("stroke",t=>t.strokeFill).attr("stroke-width",t=>t.strokeWidth),c.showDataLabel){const i=c.showDataLabelOutsideBar;if("horizontal"===c.chartOrientation){let e=function(t,i){const{data:e,label:n}=t;return i*n.length*s<=e.width-a};h(e,"fitsHorizontally");const s=.7,a=10,r=o.data.map((t,i)=>({data:t,label:g[i].toString()})).filter(t=>t.data.width>0&&t.data.height>0),l=r.map(t=>{const{data:i}=t;let s=.7*i.height;for(;!e(t,s)&&s>0;)s-=1;return s}),c=Math.floor(Math.min(...l)),u=h(t=>i?t.data.x+t.data.width+a:t.data.x+t.data.width-a,"determineLabelXPosition");t.selectAll("text").data(r).enter().append("text").attr("x",u).attr("y",t=>t.data.y+t.data.height/2).attr("text-anchor",i?"start":"end").attr("dominant-baseline","middle").attr("fill",n.dataLabelColor).attr("font-size",`${c}px`).text(t=>t.label)}else{let e=function(t,i,e){const{data:s,label:a}=t,n=i*a.length*.7,h=s.x+s.width/2,o=h+n/2,r=h-n/2>=s.x&&o<=s.x+s.width,l=s.y+e+i<=s.y+s.height;return r&&l};h(e,"fitsInBar");const s=10,a=o.data.map((t,i)=>({data:t,label:g[i].toString()})).filter(t=>t.data.width>0&&t.data.height>0),r=a.map(t=>{const{data:i,label:a}=t;let n=i.width/(.7*a.length);for(;!e(t,n,s)&&n>0;)n-=1;return n}),l=Math.floor(Math.min(...r)),c=h(t=>i?t.data.y-s:t.data.y+s,"determineLabelYPosition");t.selectAll("text").data(a).enter().append("text").attr("x",t=>t.data.x+t.data.width/2).attr("y",c).attr("text-anchor","middle").attr("dominant-baseline",i?"auto":"hanging").attr("fill",n.dataLabelColor).attr("font-size",`${l}px`).text(t=>t.label)}}break;case"text":t.selectAll("text").data(o.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",t=>t.fill).attr("font-size",t=>t.fontSize).attr("dominant-baseline",t=>u(t.verticalPos)).attr("text-anchor",t=>x(t.horizontalPos)).attr("transform",t=>d(t)).text(t=>t.text);break;case"path":t.selectAll("path").data(o.data).enter().append("path").attr("d",t=>t.path).attr("fill",t=>t.fill?t.fill:"none").attr("stroke",t=>t.strokeFill).attr("stroke-width",t=>t.strokeWidth)}}},"draw")}};export{pt as diagram};
package/index.html CHANGED
@@ -4,9 +4,9 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>CMark</title>
7
- <script type="module" crossorigin src="./assets/index-B17NCAw4.js"></script>
8
- <link rel="modulepreload" crossorigin href="./assets/markdown-DVehI1Sg.js">
9
- <link rel="modulepreload" crossorigin href="./assets/mermaid-C_q9pug0.js">
7
+ <script type="module" crossorigin src="./assets/index-BJ-NdQc4.js"></script>
8
+ <link rel="modulepreload" crossorigin href="./assets/markdown-S2mWvoE-.js">
9
+ <link rel="modulepreload" crossorigin href="./assets/mermaid-T_6Ze_cT.js">
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-eB_q_VA3.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancc/cmark",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "CMark —— 本地 Markdown 笔记,用 git 同步",
5
5
  "keywords": [
6
6
  "markdown",
package/plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "cmark",
3
3
  "pluginName": "CMark",
4
4
  "title": "CMark",
5
- "version": "1.2.0",
5
+ "version": "1.2.1",
6
6
  "description": "本地 Markdown 笔记,用 Git 管理版本、同步多端",
7
7
  "author": "Lancc",
8
8
  "homepage": "https://github.com/LanccBy2016/cmark",
@@ -567,7 +567,12 @@ module.exports = function installGitPanel(win, WS) {
567
567
  ensureStatusContainers()
568
568
  const box = $('zgp-status')
569
569
  if (!st || !st.isRepo) {
570
- box.innerHTML = '<span class="zgp-chip warn">尚未初始化 git 仓库</span>'
570
+ // 只换 chips 的内容,绝不整体覆盖 .zgp-status:
571
+ // 整体覆盖会把 chips/acts/fileact 三个容器一起删掉,之后自愈重建时
572
+ // 散落在状态条里的旧节点会留下来,表现为「工作区变更记录」里混着
573
+ // 单个文档的 chip(两套状态条叠在一起)
574
+ const chipsBox0 = box.querySelector('#zgp-chips')
575
+ if (chipsBox0) chipsBox0.innerHTML = '<span class="zgp-chip warn">尚未初始化 git 仓库</span>'
571
576
  const foot0 = doc.querySelector('.zgp-acts')
572
577
  const oldE = doc.getElementById('zgp-foot-extra')
573
578
  if (oldE) oldE.remove()
@@ -700,7 +705,7 @@ module.exports = function installGitPanel(win, WS) {
700
705
  if (!rel) {
701
706
  const chips0 = box.querySelector('#zgp-chips')
702
707
  if (chips0) chips0.innerHTML = '<span class="zgp-chip warn">没有打开的笔记</span>'
703
- else box.innerHTML = '<span class="zgp-chip warn">没有打开的笔记</span>'
708
+ else ensureStatusContainers()
704
709
  const pane = $('zgp-pane-changes')
705
710
  if (pane) pane.innerHTML = '<div class="zgp-empty"><b>没有打开的笔记</b>打开一篇笔记后,这里显示它的改动与历史</div>'
706
711
  const hp = $('zgp-pane-history')
@@ -713,10 +718,11 @@ module.exports = function installGitPanel(win, WS) {
713
718
  const chipsHtml = '<span class="zgp-chip acc">' + esc(displayPath(rel)) + '</span>'
714
719
  + (file ? '<span class="zgp-chip warn">有未提交改动</span>' : '<span class="zgp-chip ok">与最近提交一致</span>')
715
720
  + (readErr ? '<span class="zgp-chip err">' + esc(readErr.slice(0, 40)) + '</span>' : '')
716
- // 只更新 chips,不要覆盖整个状态条(否则会删掉右侧操作区与容器)
721
+ // 只更新 chips,不要覆盖整个状态条(否则会删掉右侧操作区与容器)。
722
+ // 容器缺失时先自愈重建,而不是退回「直接写 .zgp-status」那种会留残骸的兜底。
723
+ ensureStatusContainers()
717
724
  const chipsBoxF = box.querySelector('#zgp-chips')
718
725
  if (chipsBoxF) chipsBoxF.innerHTML = chipsHtml
719
- else box.innerHTML = chipsHtml
720
726
  renderFileChanges(rel, file)
721
727
  if (activeTab === 'history') renderHistory(true)
722
728
  }
@@ -1186,6 +1192,10 @@ module.exports = function installGitPanel(win, WS) {
1186
1192
  const fAct = root.querySelector('#zgp-fileact')
1187
1193
  if (fAct) fAct.style.display = isFile ? 'flex' : 'none'
1188
1194
  if (!isFile && fAct) fAct.innerHTML = ''
1195
+ // 切模式时先清一遍 chips:refresh 有签名去重,命中时会直接 return,
1196
+ // 上一模式的 chip(全局的「分支 main/工作区干净」或单文件的「路径」)就会留在新面板里
1197
+ const chipsEl = doc.getElementById('zgp-chips')
1198
+ if (chipsEl) chipsEl.innerHTML = ''
1189
1199
  }
1190
1200
 
1191
1201
  doc.querySelectorAll('.zgp-tab').forEach((t) => {
@@ -1296,6 +1306,15 @@ module.exports = function installGitPanel(win, WS) {
1296
1306
  const status = $('zgp-status')
1297
1307
  if (!status) return
1298
1308
  let changed = false
1309
+ // 先清掉不属于三个容器的散落节点:历史上 renderStatus/renderFileMode 都走过
1310
+ // 「直接给 .zgp-status 写 innerHTML」的兜底,留下的裸 chip 会和重建的容器
1311
+ // 并排显示(全局 chip + 单文件 chip 同时出现),必须一次性清干净
1312
+ const kids = Array.prototype.slice.call(status.children)
1313
+ for (const el of kids) {
1314
+ if (el.id === 'zgp-chips' || el.id === 'zgp-fileact') continue
1315
+ if (el.classList && el.classList.contains('zgp-acts')) continue
1316
+ try { status.removeChild(el); changed = true } catch (e) {}
1317
+ }
1299
1318
  if (!$('zgp-chips')) {
1300
1319
  const d = doc.createElement('div')
1301
1320
  d.className = 'zgp-chips'
@@ -1352,7 +1371,12 @@ module.exports = function installGitPanel(win, WS) {
1352
1371
  refresh()
1353
1372
  }
1354
1373
  }
1355
- win.__zgpOpen = function (mode) { if (!root.classList.contains('open')) win.__zgpToggle(mode || 'global') }
1374
+ win.__zgpOpen = function (mode) {
1375
+ const m = mode === 'file' ? 'file' : 'global'
1376
+ // 面板已经打开时也要切模式:否则从「文档变更记录」再点侧边栏的
1377
+ // 「工作区变更记录」会被静默忽略,标题与内容停在上一层,看起来就是错乱
1378
+ if (!root.classList.contains('open') || m !== panelMode) win.__zgpToggle(m)
1379
+ }
1356
1380
  win.__zgpIsOpen = function () { return root.classList.contains('open') }
1357
1381
 
1358
1382
  // 面板打开时定时刷新(3 秒);历史页不做轮询,避免反复重绘导致闪烁
@@ -203,7 +203,7 @@ module.exports = function installGitService(win, argvPath) {
203
203
  { kind: 'detached', re: /detached HEAD|not currently on a branch/i },
204
204
  { kind: 'norepo', re: /not a git repository/i },
205
205
  { kind: 'noUpstream', re: /no upstream configured|has no upstream branch|couldn't find remote ref/i },
206
- { kind: 'auth', re: /(Authentication failed|Permission denied \(publickey|invalid username or password|could not read Username|could not read Password|No such identity)/i },
206
+ { kind: 'auth', re: /(Authentication failed|Permission denied \(publickey|invalid username or password|could not read Username|could not read Password|No such identity|token username invalid|Incorrect username or password|returned error:\s*40[13]|HTTP 40[13])/i },
207
207
  { kind: 'network', re: /could not resolve host|Unable to access|Connection (refused|reset|timed out)|Failed to connect|network is unreachable|Operation timed out/i },
208
208
  { kind: 'perm', re: /Permission denied|EACCES|Read-only file system|No space left/i },
209
209
  { kind: 'dirty', re: /local changes would be lost|Your local changes|uncommitted changes/i }
@@ -211,7 +211,7 @@ module.exports = function installGitService(win, argvPath) {
211
211
 
212
212
  const ERR_TEXT = {
213
213
  network: '网络不通或远端不可达',
214
- auth: '认证失败(检查 SSH key 或凭据)',
214
+ auth: '认证失败:令牌无效或用户名不匹配(Gitee/自建服务重新授权一次即可)',
215
215
  conflict: '存在冲突,需要先解决',
216
216
  lock: 'git 被其他进程占用(index.lock)',
217
217
  detached: 'HEAD 处于游离状态,请先切回分支',
@@ -258,24 +258,55 @@ module.exports = function installGitService(win, argvPath) {
258
258
  } catch (e) { return null }
259
259
  }
260
260
  const NET_CMDS = { push: 1, pull: 1, fetch: 1, 'ls-remote': 1, clone: 1 }
261
- function netToken (args) {
261
+
262
+ // Gitee 对 HTTPS 的用户名是**强校验**的:用户名必须与令牌所有者一致,否则直接回
263
+ // 403「The token username invalid」(实测:用 x-access-token 当用户名,Gitee 连
264
+ // 假令牌都明确回 username 相关错误)。x-access-token 这种占位用户名只有 GitHub 认。
265
+ // 所以按远端决定用户名:
266
+ // https://gitee.com/<owner>/<repo>.git → owner(个人仓库的 owner 就是令牌所有者)
267
+ // 其它(GitHub 等接受任意用户名) → x-access-token
268
+ const SAFE_USER = /^[A-Za-z0-9._-]{1,64}$/
269
+ function userForUrl (url) {
270
+ const m = /^https?:\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/([^/]+)\//.exec(String(url || ''))
271
+ if (m && /(^|\.)gitee\.com$/i.test(m[1]) && SAFE_USER.test(m[2])) return m[2]
272
+ return 'x-access-token'
273
+ }
274
+ // 从 .git/config 里同步取 origin 的地址(exec 是同步拼参数的场合,不能等 git 命令)
275
+ function originUrl () {
276
+ try {
277
+ const txt = fs.readFileSync(path.join(repoRoot || WS, '.git', 'config'), 'utf8')
278
+ const tail = txt.split(/\[remote "origin"\]/)[1] || ''
279
+ const m = /^[ \t]*url[ \t]*=[ \t]*(.+)$/m.exec(tail)
280
+ return m ? m[1].trim() : ''
281
+ } catch (e) { return '' }
282
+ }
283
+ function tokenHelper (username) {
284
+ const u = SAFE_USER.test(String(username || '')) ? String(username) : 'x-access-token'
285
+ return '!f() { echo username=' + u + '; echo password=$CMARK_GIT_TOKEN; }; f'
286
+ }
287
+ function netCred (args) {
262
288
  if (!args.some(function (a) { return NET_CMDS[a] })) return null
263
289
  // 先取本工作区的凭据,再回退到旧版全局配置(迁移兼容)
264
- try {
265
- const p = wsPrefs.read(WS)
266
- if (p.remoteToken && p.remoteToken.token) return p.remoteToken.token
267
- } catch (e) {}
268
- const c = readNetCfg()
269
- const t = c && c.remoteToken
270
- return t && t.token ? t.token : null
290
+ let rec = null
291
+ try { rec = wsPrefs.read(WS).remoteToken || null } catch (e) {}
292
+ if (!(rec && rec.token)) {
293
+ const c = readNetCfg()
294
+ rec = (c && c.remoteToken) || null
295
+ }
296
+ if (!rec || !rec.token) return null
297
+ // 用户名以配置为准;老配置没有 username 字段就用远端地址推断,
298
+ // 这样已经用旧版本绑过 Gitee 的用户升级后不用重新授权
299
+ return { token: rec.token, username: rec.username || userForUrl(rec.url || originUrl()) }
271
300
  }
272
- const TOKEN_HELPER = '!f() { echo username=x-access-token; echo password=$CMARK_GIT_TOKEN; }; f'
273
301
 
274
302
  function exec(args, opt) {
275
303
  const o = opt || {}
276
- const token = o.token || netToken(args)
304
+ const cred = o.token
305
+ ? { token: o.token, username: o.username || userForUrl(o.url || originUrl()) }
306
+ : netCred(args)
307
+ const token = cred && cred.token
277
308
  const pre = token
278
- ? ['-c', 'core.quotepath=false', '-c', 'credential.helper=', '-c', 'credential.helper=' + TOKEN_HELPER]
309
+ ? ['-c', 'core.quotepath=false', '-c', 'credential.helper=', '-c', 'credential.helper=' + tokenHelper(cred.username)]
279
310
  : BASE_ARGS
280
311
  return new Promise((resolve) => {
281
312
  execFile('git', pre.concat(args), {
@@ -1325,7 +1356,7 @@ module.exports = function installGitService(win, argvPath) {
1325
1356
  if (!/^(https?:\/\/|git@|ssh:\/\/|file:\/\/|[A-Za-z]:[\\/]|\\\\|\/)/.test(u)) {
1326
1357
  return { ok: false, kind: 'badrev', message: '远程地址格式不正确:' + u }
1327
1358
  }
1328
- const r = await runGit(['ls-remote', '--heads', u], { label: 'probe', timeout: 60000, token: token || undefined })
1359
+ const r = await runGit(['ls-remote', '--heads', u], { label: 'probe', timeout: 60000, token: token || undefined, url: u })
1329
1360
  if (r.ok) return { ok: true, data: { hasRefs: !!String(r.data || '').trim() } }
1330
1361
  return { ok: false, kind: r.kind, message: r.message }
1331
1362
  }
@@ -1334,7 +1365,9 @@ module.exports = function installGitService(win, argvPath) {
1334
1365
  function setRemoteToken (token, url) {
1335
1366
  const t = String(token || '').trim()
1336
1367
  if (!t) return { ok: false, message: '令牌为空' }
1337
- const res = wsPrefs.patch(WS, { remoteToken: { provider: 'custom', token: t, url: String(url || '').trim() } })
1368
+ const u = String(url || '').trim()
1369
+ // 记下按远端推断出的用户名:Gitee 要求它与令牌所有者一致,见 userForUrl
1370
+ const res = wsPrefs.patch(WS, { remoteToken: { provider: 'custom', token: t, url: u, username: userForUrl(u) } })
1338
1371
  if (res && res.ok === false) return res
1339
1372
  return { ok: true }
1340
1373
  }