@juki-team/base-ui 1.5.22 → 1.5.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/{BarChart-iS9A5dpq.js → BarChart-rnKCGMQd.js} +1 -1
- package/dist/esm/{CartesianChart-DRkVAUTl.js → CartesianChart-Dvjpj90J.js} +1 -1
- package/dist/esm/{ChangePasswordModal-DWcV41bD.js → ChangePasswordModal-Bh9Sghzd.js} +1 -1
- package/dist/esm/{CodeEditor-BIbu4VxL.js → CodeEditor-Duw5SfUT.js} +1 -1
- package/dist/esm/{CodeViewer-BUV-dalv.js → CodeViewer-3L1yBCiq.js} +1 -1
- package/dist/esm/{Collapse-paq7oWgG.js → Collapse--_LykD9C.js} +1 -1
- package/dist/esm/{DataViewer-CMI27AMZ.js → DataViewer-D1dHtA0t.js} +1 -1
- package/dist/esm/{DrawerView-WQzHX5l-.js → DrawerView-CwWfnWLi.js} +1 -1
- package/dist/esm/{ExcalidrawButton-Dkt-wFZK.js → ExcalidrawButton-C_0b7G1W.js} +1 -1
- package/dist/esm/{GraphvizViewer-CYGvah6j.js → GraphvizViewer-BfMacqRe.js} +1 -1
- package/dist/esm/{ImageLoaderCropper-DIEHTOiU.js → ImageLoaderCropper-DTUW7gfc.js} +1 -1
- package/dist/esm/{InputCellPhoneNumber-DgviNp4t.js → InputCellPhoneNumber-Clg8uE_f.js} +1 -1
- package/dist/esm/{InputColor-BSBlv1oE.js → InputColor-R-WCu1j6.js} +1 -1
- package/dist/esm/{LineChart-BdYnYefg.js → LineChart-Cis4BCPT.js} +1 -1
- package/dist/esm/{MdMath-KE8c-hVy.js → MdMath-DLeak1_N.js} +1 -1
- package/dist/esm/{MdMathEditor-DbH_jI7Y.js → MdMathEditor-BG6rI0DT.js} +1 -1
- package/dist/esm/{Popover-BLy0OI8L.js → Popover-CpOKnJkx.js} +1 -1
- package/dist/esm/{SlideDeck-o1krblz8.js → SlideDeck-uAy3WDbv.js} +1 -1
- package/dist/esm/{TableOfContents-DPsfG1VD.js → TableOfContents-C6yZSaSD.js} +1 -1
- package/dist/esm/{Tooltip-BI0Xe-XW.js → Tooltip-8kM3mqHL.js} +1 -1
- package/dist/esm/{UserCodeEditor-CcaAG5g_.js → UserCodeEditor-BhYAs-Az.js} +2 -2
- package/dist/esm/{VirtualizedRowsFixed-VrMhZ4XD.js → VirtualizedRowsFixed-DTqKnPfn.js} +1 -1
- package/dist/esm/{WorksheetAsSlides-kPK5Z2vF.js → WorksheetAsSlides-Cf2VDzyg.js} +1 -1
- package/dist/esm/{WorksheetBodies-CxDz0Rxa.js → WorksheetBodies-CwL6I1LR.js} +1 -1
- package/dist/esm/{WorksheetContents-Dxo5Xc3Y.js → WorksheetContents-AqcyoA6-.js} +1 -1
- package/dist/esm/{WorksheetEditor-CvFYzeZC.js → WorksheetEditor-BF8EQVw5.js} +1 -1
- package/dist/esm/{WorksheetNode-DgQD3PMR.js → WorksheetNode-vLI23gI5.js} +1 -1
- package/dist/esm/{WorksheetViewer-DR45PXUH.js → WorksheetViewer-Dj7ffrAT.js} +1 -1
- package/dist/esm/{abnfDiagram-WEYOIA3C-2vvvjt5F.js → abnfDiagram-WEYOIA3C-ZoMqWR68.js} +1 -1
- package/dist/esm/{arc-C-pwTbE4.js → arc-D1qQo7Rq.js} +1 -1
- package/dist/esm/{architectureDiagram-ZHVYKT53-Njrg16Bb.js → architectureDiagram-ZHVYKT53-DyQfRK7X.js} +1 -1
- package/dist/esm/{blockDiagram-RJAE7QA3-OuYPx21T.js → blockDiagram-RJAE7QA3-25yUZ_JH.js} +1 -1
- package/dist/esm/{c4Diagram-XDPPPE54-C4-sgPqw.js → c4Diagram-XDPPPE54-Tds8Ecy5.js} +1 -1
- package/dist/esm/channel-DYeSxlgx.js +1 -0
- package/dist/esm/{chunk-2E7WHVMD-BeozrAac.js → chunk-2E7WHVMD-CrEKxARX.js} +1 -1
- package/dist/esm/{chunk-2Q5K7J3B-4_3njuk_.js → chunk-2Q5K7J3B-xxqB63pM.js} +1 -1
- package/dist/esm/{chunk-4EMNKR2T-DwE6V67-.js → chunk-4EMNKR2T-DpATbGaG.js} +1 -1
- package/dist/esm/{chunk-55XCU76K-CpG64yyk.js → chunk-55XCU76K-B8gXqG-k.js} +1 -1
- package/dist/esm/{chunk-5VM5RSS4-CkeQhgn7.js → chunk-5VM5RSS4-ChaTLA5E.js} +1 -1
- package/dist/esm/{chunk-JWPE2WC7-CVtFylX6.js → chunk-JWPE2WC7-D8efNL_z.js} +1 -1
- package/dist/esm/{chunk-NQOKRVIF-CYlkwWmJ.js → chunk-NQOKRVIF-gVbLpTMV.js} +1 -1
- package/dist/esm/{chunk-VQ5W62QI-Be8I4VMn.js → chunk-VQ5W62QI-YnIRgGsh.js} +1 -1
- package/dist/esm/{chunk-XXDRQBXY-0jU-YNFU.js → chunk-XXDRQBXY-DyBSx2uJ.js} +1 -1
- package/dist/esm/{chunk-ZCHMQSOR-Cwl9AHIQ.js → chunk-ZCHMQSOR-UYQbyi-v.js} +1 -1
- package/dist/esm/{classDiagram-v2-4MYWR3UA-CgLXcYDZ.js → classDiagram-v2-4MYWR3UA-PaDxy7Bb.js} +1 -1
- package/dist/esm/{cose-bilkent-JH36ORCC-BUYPdwFO.js → cose-bilkent-JH36ORCC-BCLUFgmF.js} +1 -1
- package/dist/esm/{cynefinDiagram-WF24UDRP-DFlv0vTF.js → cynefinDiagram-WF24UDRP-Dw54Invm.js} +1 -1
- package/dist/esm/{dagre-NK4GIZVX-D3hfxWjC.js → dagre-NK4GIZVX-DszaMPSv.js} +1 -1
- package/dist/esm/{diagram-CBK3MWTC-Dz3S8vtv.js → diagram-CBK3MWTC-D3i6P0ln.js} +1 -1
- package/dist/esm/{diagram-I5XIIV2D-CWQZNyHk.js → diagram-I5XIIV2D-DEUcJjIJ.js} +1 -1
- package/dist/esm/{diagram-ODIL2UCW-RwcoAn2X.js → diagram-ODIL2UCW-DxLnEJOT.js} +1 -1
- package/dist/esm/{diagram-PFBEJUXE-BQ65i8Sl.js → diagram-PFBEJUXE-ByMV092C.js} +1 -1
- package/dist/esm/{diagram-RJA3I4VV-D3wAXEKx.js → diagram-RJA3I4VV-C84l8Azx.js} +1 -1
- package/dist/esm/{diagram-TYUNFSNR-CQpNNmke.js → diagram-TYUNFSNR-BtCvPXJ2.js} +1 -1
- package/dist/esm/{ebnfDiagram-V4P3TTPT-x6yeSo0p.js → ebnfDiagram-V4P3TTPT-C2vtqr71.js} +1 -1
- package/dist/esm/{elk-QONTBCTQ-BKyCSI5O.js → elk-QONTBCTQ-CJiLNhJN.js} +1 -1
- package/dist/esm/{erDiagram-KYQIGQAA-C9n_JA_w.js → erDiagram-KYQIGQAA-COiQX-A9.js} +1 -1
- package/dist/esm/{flowDiagram-IUGLLWBU-BS8vlVHT.js → flowDiagram-IUGLLWBU-Bboof2sT.js} +1 -1
- package/dist/esm/{ganttDiagram-R7GPNTJY-CKebGhU7.js → ganttDiagram-R7GPNTJY-DplmDkby.js} +1 -1
- package/dist/esm/{gitGraphDiagram-PDYL7XHY-Bvp1UcgM.js → gitGraphDiagram-PDYL7XHY-DTPYXyjC.js} +1 -1
- package/dist/esm/{index-C2_E6s4y.js → index-BdXh2wq-.js} +1 -1
- package/dist/esm/{index-BwpxQGdp.js → index-DjHFXv3v.js} +1 -1
- package/dist/esm/{infoDiagram-MVDRKAX5-DrROCapb.js → infoDiagram-MVDRKAX5-B4R01JSI.js} +1 -1
- package/dist/esm/{ishikawaDiagram-HPEHV2GE-BGSVKWhg.js → ishikawaDiagram-HPEHV2GE-Dv9Qg5NY.js} +1 -1
- package/dist/esm/{journeyDiagram-BOSHW7O7-ogVQbHp2.js → journeyDiagram-BOSHW7O7-Co3cxhxL.js} +1 -1
- package/dist/esm/{kanban-definition-FNSA4HC5-lQM4fHQE.js → kanban-definition-FNSA4HC5-q3pjKpqB.js} +1 -1
- package/dist/esm/main.js +1 -1
- package/dist/esm/{mermaid.core-CvFWfSA0.js → mermaid.core-DErPnTKR.js} +2 -2
- package/dist/esm/{mindmap-definition-6OY57UG3-D8l0C3RA.js → mindmap-definition-6OY57UG3-B_LUFop9.js} +1 -1
- package/dist/esm/{pegDiagram-ECIUJNBX-D8xo2dyF.js → pegDiagram-ECIUJNBX-DlVeoxxt.js} +1 -1
- package/dist/esm/{pieDiagram-GNMPY74T-gHG-R83G.js → pieDiagram-GNMPY74T-BOP-ezbh.js} +1 -1
- package/dist/esm/{quadrantDiagram-D57K4MC3-DDHGqMWG.js → quadrantDiagram-D57K4MC3-DMyyReF0.js} +1 -1
- package/dist/esm/{railroadDiagram-Y72NRBL7-BNcAWVzf.js → railroadDiagram-Y72NRBL7-Dtk4Z37c.js} +1 -1
- package/dist/esm/{requirementDiagram-EQYSW5RA-D0TQZTve.js → requirementDiagram-EQYSW5RA-CiUa5IeO.js} +1 -1
- package/dist/esm/{sankeyDiagram-SY24JHO5-BgXxfdaz.js → sankeyDiagram-SY24JHO5-CuTPSkWV.js} +1 -1
- package/dist/esm/{sequenceDiagram-BLEHNHQU-BoejQXUR.js → sequenceDiagram-BLEHNHQU-Do3-nvhd.js} +1 -1
- package/dist/esm/{sizeCapture-INFHLROL-sNhkxZSt.js → sizeCapture-INFHLROL-C423dcz5.js} +1 -1
- package/dist/esm/{stateDiagram-v2-A6IESKWZ-sy3VIzCQ.js → stateDiagram-v2-A6IESKWZ-c4ZBvhhc.js} +1 -1
- package/dist/esm/{swimlanes-B3ENRKFQ-BMvTnJVa.js → swimlanes-B3ENRKFQ-zszd6wqm.js} +1 -1
- package/dist/esm/{swimlanesDiagram-AYQRV4AK-CBA7l1Zm.js → swimlanesDiagram-AYQRV4AK-BlMvbjy2.js} +1 -1
- package/dist/esm/{timeline-definition-JXYKGLGB-B9uS-p90.js → timeline-definition-JXYKGLGB-C0ru0xk2.js} +1 -1
- package/dist/esm/{types-CdWZmDRI.js → types-Cb2rrWcY.js} +1 -1
- package/dist/esm/{usecaseDiagram-WPOLBNNX-55ERmenj.js → usecaseDiagram-WPOLBNNX-BgdkDQLR.js} +1 -1
- package/dist/esm/{vennDiagram-Q3Y3IDCW-M46hCRun.js → vennDiagram-Q3Y3IDCW-BqrOHtxN.js} +1 -1
- package/dist/esm/{wardleyDiagram-IVAIDKWA-DiF93Bmd.js → wardleyDiagram-IVAIDKWA-Ci0p6FBo.js} +1 -1
- package/dist/esm/{xychartDiagram-4URNHDU4-epgUCY99.js → xychartDiagram-4URNHDU4-zz1Z-rVz.js} +1 -1
- package/package.json +1 -1
- package/dist/esm/channel-3HQcLN5a.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b8 as t,s as e,g as n,x as s,v as i,a as r,b as o,_ as a,O as l,T as c,k as h,at as u,ah as f,ai as d,aj as y,d as p,C as g,Q as x,R as m}from"./mermaid.core-CvFWfSA0.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";const b=(e,n)=>t(e,"a",-n),v=1e-10;function I(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=_(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=>k(t,e)<e.radius+v)}(e,t));let i=0,r=0;const o=[];if(s.length>1){const e=S(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 e=0;e<s.length;++e){const a=s[e];r+=(n.x+a.x)*(a.y-n.y);const l={x:(a.x+n.x)/2,y:(a.y+n.y)/2};let c=null;for(let e=0;e<a.parentIndex.length;++e)if(n.parentIndex.includes(a.parentIndex[e])){const s=t[a.parentIndex[e]],i=Math.atan2(a.x-s.x,a.y-s.y),r=Math.atan2(n.x-s.x,n.y-s.y);let o=r-i;o<0&&(o+=2*Math.PI);const h=r-o/2;let u=k(l,{x:s.x+s.radius*Math.sin(h),y:s.y+s.radius*Math.cos(h)});u>2*s.radius&&(u=2*s.radius),(null==c||c.width>u)&&(c={circle:s,width:u,p1:a,p2:n,large:u>s.radius,sweep:!0})}null!=c&&(o.push(c),i+=M(c.circle.radius,c.width),n=a)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let s=0;s<t.length;++s)if(k(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-v,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 M(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function k(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function w(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 M(t,t-(n*n-e*e+t*t)/(2*n))+M(e,s)}function _(t,e){const n=k(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 S(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 E(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function T(t,e){return E(t).map(()=>E(e))}function z(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function A(t){return Math.sqrt(z(t,t))}function R(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function N(t,e,n,s,i){for(let r=0;r<t.length;++r)t[r]=e*n[r]+s*i[r]}function j(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 n=0;n<d;++n){const s=e.slice();s[n]=s[n]?s[n]*i:r,y[n+1]=s,y[n+1].fx=t(s),y[n+1].id=n+1}function p(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}const g=(t,e)=>t.fx-e.fx,x=e.slice(),m=e.slice(),b=e.slice(),v=e.slice();for(let e=0;e<s;++e){if(y.sort(g),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){x[t]=0;for(let e=0;e<d;++e)x[t]+=y[e][t];x[t]/=d}const e=y[d];if(N(m,1+l,x,-l,e),m.fx=t(m),m.fx<y[0].fx)N(v,1+c,x,-c,e),v.fx=t(v),v.fx<m.fx?p(v):p(m);else if(m.fx>=y[d-1].fx){let n=!1;if(m.fx>e.fx?(N(b,1+h,x,-h,e),b.fx=t(b),b.fx<e.fx?p(b):n=!0):(N(b,1-h*l,x,h*l,e),b.fx=t(b),b.fx<m.fx?p(b):n=!0),n){if(u>=1)break;for(let e=1;e<y.length;++e)N(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else p(m)}return y.sort(g),{fx:y[0].fx,x:y[0]}}function D(t,e,n,s,i,r,o){const a=n.fx,l=z(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,N(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=z(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(N(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=z(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(),R(o,s.fxprime,-1);for(let e=0;e<l;++e){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){N(r,1,i.fxprime,-1,s.fxprime);const t=z(s.fxprime,s.fxprime);N(o,Math.max(0,z(r,i.fxprime)/t),o,-1,i.fxprime),a=s,s=i,i=a}else R(o,s.fxprime,-1);if(A(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||P,s=e.lossFunction||L,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 t of s)if(1===t.sets.length)r.push(t.sets[0]);else if(2===t.sets.length){const e=t.sets[0],n=t.sets[1];o.add(i(t.sets)),o.add(i([n,e]))}r.sort((t,e)=>t===e?0:t<e?-1:1);for(let t=0;t<r.length;++t){const e=r[t];for(let n=t+1;n<r.length;++n){const t=r[n];o.has(i([e,t]))||s.push({sets:[e,t],size:0})}}return s}(t,e),r=n(i,e),o=Object.keys(r),a=[];for(const t of o)a.push(r[t].x),a.push(r[t].y);const l=j(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 t=0;t<o.length;++t){const e=o[t];r[e].x=l[2*t],r[e].y=l[2*t+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 n=0;n<i;++n){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=>w(t,e,s)-n,0,t+e)}function P(t,e={}){let n=function(t,e){const n=e&&e.lossFunction?e.lossFunction:L,s={},i={};for(const e of t)if(1===e.sets.length){const t=e.sets[0];s[t]={x:1e10,y:1e10,rowid:s.length,size:e.size,radius:Math.sqrt(e.size/Math.PI)},i[t]=[]}t=t.filter(t=>2===t.sets.length);for(const e of t){let t=null!=e.weight?e.weight:1;const n=e.sets[0],r=e.sets[1];e.size+F>=Math.min(s[n].size,s[r].size)&&(t=0),i[n].push({set:r,size:e.size,weight:t}),i[r].push({set:n,size:e.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 e=1;e<r.length;++e){const a=r[e].set,u=i[a].filter(l),f=s[a];if(u.sort(o),0===u.length)throw"ERROR: missing pairwise overlap information";const d=[];for(var h=0;h<u.length;++h){const t=s[u[h].set],e=$(f.radius,t.radius,u[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<u.length;++n){const i=s[u[n].set],r=$(f.radius,i.radius,u[n].size),o=_({x:t.x,y:t.y,radius:e},{x:i.x,y:i.y,radius:r});d.push(...o)}}let y=1e50,p=d[0];for(const e of d){s[a].x=e.x,s[a].y=e.y;const i=n(s,t);i<y&&(y=i,p=e)}c(p,a)}return s}(t,e);const s=e.lossFunction||L;if(t.length>=8){const i=function(t,e={}){const n=e.restarts||10,s=[],i={};for(const e of t)1===e.sets.length&&(i[e.sets[0]]=s.length,s.push(e));let{distances:r,constraints:o}=function(t,e,n){const s=T(e.length,e.length),i=T(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=A(r.map(A))/r.length;r=r.map(t=>t.map(t=>t/a));const l=(t,e)=>function(t,e,n,s){for(let t=0;t<e.length;++t)e[t]=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),p=d-u*u;f>0&&y<=u||f<0&&y>=u||(i+=2*p*p,e[2*r]+=4*p*(o-c),e[2*r+1]+=4*p*(a-h),e[2*l]+=4*p*(c-o),e[2*l+1]+=4*p*(h-a))}}return i}(t,e,r,o);let c=null;for(let t=0;t<n;++t){const t=O(l,E(2*r.length).map(Math.random),e);(!c||t.fx<c.fx)&&(c=t)}const h=c.x,u={};for(let t=0;t<s.length;++t){const e=s[t];u[e.sets[0]]={x:h[2*t]*a,y:h[2*t+1]*a,radius:Math.sqrt(e.size/Math.PI)}}if(e.history)for(const t of e.history)R(t.x,a);return u}(t,e);s(i,t)+1e-8<s(n,t)&&(n=i)}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=w(n.radius,i.radius,k(n,i))}else e=I(s.sets.map(e=>t[e]));n+=(null!=s.weight?s.weight:1)*(e-s.size)*(e-s.size)}return n}function q(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=w(n.radius,i.radius,k(n,i))}else e=I(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 U(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){k(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 B(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 G(t,e,n){null==e&&(e=Math.PI/2);let s=X(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 e=0;e<t.length;++e)for(let s=e+1;s<t.length;++s){const i=t[e].radius+t[s].radius;k(t[e],t[s])+1e-10<i&&n(t[s],t[e])}const s=new Map;for(let n=0;n<t.length;++n){const i=e(t[n]).parent.setid;s.has(i)||s.set(i,[]),s.get(i).push(t[n])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(s);for(const t of i){U(t,e,n);const s=B(t);t.size=(s.xRange.max-s.xRange.min)*(s.yRange.max-s.yRange.min),t.bounds=s}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 e of t)e.x+=a,e.y+=l,s.push(e)}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=B(s);return V(s)}function W(t,e,n,s,i){const r=X(t);e-=2*s,n-=2*s;const{xRange:o,yRange:a}=B(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 V(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 V(t){const e={};for(const n of t)e[n.setid]=n;return e}function X(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function Y(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,p=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,g={},x=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 g)return g[t];var e=g[t]=x[m];return m+=1,m>=x.length&&(m=0),e},v=C,I=L;function M(g){let x=g.datum();const m=new Set;x.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),x=x.filter(t=>!t.sets.some(t=>m.has(t)));let M={},k={};if(x.length>0){let t=v(x,{lossFunction:I,distinct:d});a&&(t=G(t,o,f)),M=W(t,n,s,i,l),k=Q(M,x,p)}const w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}x.forEach(t=>{t.label&&(w[t.sets]=t.label)}),g.selectAll("svg").data([M]).enter().append("svg");const S=g.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=>et(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(x,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"),j=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 D(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"),j.style("fill",e=>e.colour||e.color?"#FFF":t.textFill?t.textFill:1==e.sets.length?b(e.sets):"#444"));let O=g;T&&"function"==typeof O.transition?(O=D(g),O.selectAll("path").attrTween("d",z)):O.selectAll("path").attr("d",t=>et(t.sets.map(t=>M[t])),y);const C=O.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 C?C.on("end",K(M,_)):C.each("end",K(M,_)):C.each(K(M,_)));const F=D(A.exit()).remove();"function"==typeof A.transition&&F.selectAll("path").attrTween("d",z);const $=F.selectAll("text").attr("x",n/2).attr("y",s/2);return null!==u&&(j.style("font-size","0px"),C.style("font-size",u),$.style("font-size","0px")),{circles:M,textCentres:k,nodes:A,enter:R,update:O,exit:F}}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?L:"logRatio"===t?q:t,M):I},M}function K(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,p=s.getAttribute("x"),g=s.getAttribute("y");u.forEach((t,e)=>{t.setAttribute("x",p),t.setAttribute("y",g),t.setAttribute("dy",`${y+1.1*e}em`)})}}function Z(t,e,n){let s=e[0].radius-k(e[0],t);for(let n=1;n<e.length;++n){const i=e[n].radius-k(e[n],t);i<=s&&(s=i)}for(let e=0;e<n.length;++e){const i=k(n[e],t)-n[e].radius;i<=s&&(s=i)}return s}function H(t,e,n){const s=[];for(const e of t)s.push({x:e.x,y:e.y}),s.push({x:e.x+e.radius/2,y:e.y}),s.push({x:e.x-e.radius/2,y:e.y}),s.push({x:e.x,y:e.y+e.radius/2}),s.push({x:e.x,y:e.y-e.radius/2});let i=s[0],r=Z(s[0],t,e);for(let n=1;n<s.length;++n){const o=Z(s[n],t,e);o>=r&&(i=s[n],r=o)}const o=j(n=>-1*Z({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 e of t)if(k(a,e)>e.radius){l=!1;break}for(const t of e)if(k(a,t)<t.radius){l=!1;break}if(l)return a;if(1==t.length)return{x:t[0].x,y:t[0].y};const c={};return I(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?H(t,[]):S(c.arcs.map(t=>t.p1))}function Q(t,e,n){const s={},i=function(t){const e={},n=Object.keys(t);for(const t of n)e[t]=[];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=k(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=H(c,h,n);s[o]=u,u.disjoint&&e[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return s}function J(t){if(0===t.length)return[];const e={};return I(t,e),e.arcs}function tt(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 e of t){const t=s(e.circle.radius);i.push("\nA",t,t,0,e.large?1:0,e.sweep?1:0,s(e.p1.x),s(e.p1.y))}return i.join(" ")}function et(t,e){return tt(J(t),e)}var nt=function(){var t=a(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],o=[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],p=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:a(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:a(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:o}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:o},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:o},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(p,[2,34]),t(p,[2,36]),t(p,[2,37]),t(p,[2,38]),t(p,[2,39]),t(p,[2,40]),t(p,[2,35])],defaultActions:{6:[2,1]},parseError:a(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:a(function(t){var e=this,n=[0],s=[],i=[null],r=[],o=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 p=f.yylloc;r.push(p);var g=f.options&&f.options.ranges;function x(){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,a(function(t){n.length=n.length-2*t,i.length=i.length-t,r.length=r.length-t},"popStack"),a(x,"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=x()),v=o[b]&&o[b][m]),void 0===v||!v.length||!v[0]){var E="";for(M in _=[],o[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:p,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,p=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},g&&(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=o[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0},"parse")},x=function(){return{EOF:1,parseError:a(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:a(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:a(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:a(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:a(function(){return this._more=!0,this},"more"),reject:a(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:a(function(t){this.unput(this.match.slice(t))},"less"),pastInput:a(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:a(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:a(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:a(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:a(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:a(function(){var t=this.next();return t||this.lex()},"lex"),begin:a(function(t){this.conditionStack.push(t)},"begin"),popState:a(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:a(function(t){this.begin(t)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(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 g.lexer=x,a(m,"Parser"),m.prototype=g,g.Parser=m,new m}();nt.parser=nt;var st,it=nt,rt=[],ot=[],at=[],lt=new Set,ct=!1,ht=a((t,e,n)=>{const s=xt(t).sort(),i=n??10/Math.pow(t.length,2);st=s,1===s.length&<.add(s[0]),rt.push({sets:s,size:i,label:e?ft(e):void 0})},"addSubsetData"),ut=a(()=>rt,"getSubsetData"),ft=a(t=>{const e=t.trim();return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e},"normalizeText"),dt=a(t=>t?ft(t):t,"normalizeStyleValue"),yt=a((t,e,n)=>{const s=ft(e);ot.push({sets:xt(t).sort(),id:s,label:n?ft(n):void 0})},"addTextData"),pt=a((t,e)=>{const n=xt(t).sort(),s={};for(const[t,n]of e)s[t]=dt(n)??n;at.push({targets:n,styles:s})},"addStyleData"),gt=a(()=>at,"getStyleData"),xt=a(t=>t.map(t=>ft(t)),"normalizeIdentifierList"),mt=a(t=>{const e=xt(t).filter(t=>!lt.has(t));if(e.length>0)throw new Error(`unknown set identifier: ${e.join(", ")}`)},"validateUnionIdentifiers"),bt=a(()=>ot,"getTextData"),vt=a(()=>st,"getCurrentSets"),It=a(()=>ct,"getIndentMode"),Mt=a(t=>{ct=t},"setIndentMode"),kt=m.venn;function wt(){return x(kt,l().venn)}a(wt,"getConfig");var _t={getConfig:wt,clear:a(()=>{g(),rt.length=0,ot.length=0,at.length=0,lt.clear(),st=void 0,ct=!1},"customClear"),setAccTitle:o,getAccTitle:r,setDiagramTitle:i,getDiagramTitle:s,getAccDescription:n,setAccDescription:e,addSubsetData:ht,getSubsetData:ut,addTextData:yt,addStyleData:pt,validateUnionIdentifiers:mt,getTextData:bt,getStyleData:gt,getCurrentSets:vt,getIndentMode:It,setIndentMode:Mt},St=a(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 Et(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}a(Et,"buildStyleByKey");var Tt=a((t,e,n,s)=>{const i=s.db,r=i.getConfig?.(),{themeVariables:o,look:a,handDrawnSeed:g}=l(),x="handDrawn"===a,m=[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=Et(i.getStyleData()),w=Rt(I),_=r?.width??800,S=r?.height??450,E=_/1600,T=v?48*E:0,z=o.primaryTextColor??o.textColor,A=c(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=h(document.createElement("div")),N=Y().width(_).height(S-T);R.datum(w).call(N);const j=x?u.svg(R.select("svg").node()):void 0,D=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?q:n:L,distinct:f});i&&(y=G(y,r,o));const p=W(y,a,l,c,h),g=Q(p,t,u),x=new Map(Object.keys(p).map(t=>[t,{set:t,x:p[t].x,y:p[t].y,radius:p[t].radius}])),m=t.map(t=>{const e=t.sets.map(t=>x.get(t)),n=J(e);return{circles:e,arcs:n,path:tt(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:g[s.sets],circles:t,arcs:e,path:n,distinctPath:n+b(s.sets)}))}(w,{width:_,height:S-T,padding:r?.padding??15}),O=new Map;for(const t of D){const e=zt([...t.data.sets].sort());O.set(e,t)}M.length>0&&At(r,O,R,M,E,k);const F=f(o.background||"#f4f4f4");R.selectAll(".venn-circle").each(function(t,e){const n=h(this),s=zt([...t.sets].sort()),i=k.get(s),r=m.length>0?m[e%m.length]:void 0,a=i?.fill||r||o.primaryColor;n.classed("venn-set-"+e%8,!0);const l=i?.["fill-opacity"]??.1,c=i?.stroke||a,u=i?.["stroke-width"]||""+5*E;if(x&&j){const t=O.get(s);if(t&&t.circles.length>0){const s=t.circles[0],i=j.circle(s.x,s.y,2*s.radius,{roughness:.7,seed:g,fill:b(a,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:c,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",c).style("stroke-width",u).style("stroke-opacity",.95);const f=i?.color||(F?d(a,30):y(a,30));n.select("text").style("font-size",48*E+"px").style("fill",f)}),x&&j?R.selectAll(".venn-intersection").each(function(t){const e=h(this),n=zt([...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=j.path(n,{roughness:.7,seed:g,fill:b(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=zt([...t.sets].sort());return k.get(e)?.color??o.vennSetTextColor??z}),R.selectAll(".venn-intersection path").style("fill-opacity",t=>{const e=zt([...t.sets].sort());return k.get(e)?.fill?1:0}).style("fill",t=>{const e=zt([...t.sets].sort());return k.get(e)?.fill??"transparent"}));const $=A.append("g").attr("transform",`translate(0, ${T})`),P=R.select("svg").node();if(P&&"childNodes"in P)for(const t of[...P.childNodes])$.node()?.appendChild(t);p(A,S,_,r?.useMaxWidth??!0)},"draw");function zt(t){return t.join("|")}function At(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 t of s){const e=zt(t.sets),n=l.get(e);n?n.push(t):l.set(e,[t])}for(const[t,n]of l.entries()){const s=e.get(t);if(!s?.text)continue;const l=s.text.x,c=s.text.y,h=Math.min(...s.circles.map(t=>t.radius)),u=Math.min(...s.circles.map(t=>t.radius-Math.hypot(l-t.x,c-t.y)));let f=Number.isFinite(u)?Math.max(0,u):0;0===f&&Number.isFinite(h)&&(f=.6*h);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",l).attr("cy",c).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),p=Math.max(60*i,2*f*.95),g=(s.data.label&&s.data.label.length>0?Math.min(32*i,.25*f):0)+(n.length<=2?30*i:0),x=l-y/2,m=c-p/2+g,b=Math.max(1,Math.ceil(Math.sqrt(n.length))),v=y/b,I=p/Math.max(1,Math.ceil(n.length/b));for(const[t,e]of n.entries()){const n=t%b,s=Math.floor(t/b),a=x+v*(n+.5),l=m+I*(s+.5);o&&d.append("rect").attr("class","venn-text-debug-cell").attr("x",x+v*n).attr("y",m+I*s).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",a-c/2).attr("y",l-h/2).attr("overflow","visible"),f=r.get(e.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(e.label??e.id);f&&y.style("color",f)}}}function Rt(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}a(zt,"stableSetsKey"),a(At,"renderTextNodes"),a(Rt,"ensurePairwiseSubsets");var Nt={parser:it,db:_t,renderer:{draw:Tt},styles:St};export{Nt as diagram};
|
|
1
|
+
import{b8 as t,s as e,g as n,x as s,v as i,a as r,b as o,_ as a,O as l,T as c,k as h,at as u,ah as f,ai as d,aj as y,d as p,C as g,Q as x,R as m}from"./mermaid.core-DErPnTKR.js";import"./index-DjHFXv3v.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";const b=(e,n)=>t(e,"a",-n),v=1e-10;function I(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=_(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=>k(t,e)<e.radius+v)}(e,t));let i=0,r=0;const o=[];if(s.length>1){const e=S(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 e=0;e<s.length;++e){const a=s[e];r+=(n.x+a.x)*(a.y-n.y);const l={x:(a.x+n.x)/2,y:(a.y+n.y)/2};let c=null;for(let e=0;e<a.parentIndex.length;++e)if(n.parentIndex.includes(a.parentIndex[e])){const s=t[a.parentIndex[e]],i=Math.atan2(a.x-s.x,a.y-s.y),r=Math.atan2(n.x-s.x,n.y-s.y);let o=r-i;o<0&&(o+=2*Math.PI);const h=r-o/2;let u=k(l,{x:s.x+s.radius*Math.sin(h),y:s.y+s.radius*Math.cos(h)});u>2*s.radius&&(u=2*s.radius),(null==c||c.width>u)&&(c={circle:s,width:u,p1:a,p2:n,large:u>s.radius,sweep:!0})}null!=c&&(o.push(c),i+=M(c.circle.radius,c.width),n=a)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let s=0;s<t.length;++s)if(k(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-v,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 M(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function k(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function w(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 M(t,t-(n*n-e*e+t*t)/(2*n))+M(e,s)}function _(t,e){const n=k(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 S(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 E(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function T(t,e){return E(t).map(()=>E(e))}function z(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function A(t){return Math.sqrt(z(t,t))}function R(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function N(t,e,n,s,i){for(let r=0;r<t.length;++r)t[r]=e*n[r]+s*i[r]}function j(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 n=0;n<d;++n){const s=e.slice();s[n]=s[n]?s[n]*i:r,y[n+1]=s,y[n+1].fx=t(s),y[n+1].id=n+1}function p(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}const g=(t,e)=>t.fx-e.fx,x=e.slice(),m=e.slice(),b=e.slice(),v=e.slice();for(let e=0;e<s;++e){if(y.sort(g),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){x[t]=0;for(let e=0;e<d;++e)x[t]+=y[e][t];x[t]/=d}const e=y[d];if(N(m,1+l,x,-l,e),m.fx=t(m),m.fx<y[0].fx)N(v,1+c,x,-c,e),v.fx=t(v),v.fx<m.fx?p(v):p(m);else if(m.fx>=y[d-1].fx){let n=!1;if(m.fx>e.fx?(N(b,1+h,x,-h,e),b.fx=t(b),b.fx<e.fx?p(b):n=!0):(N(b,1-h*l,x,h*l,e),b.fx=t(b),b.fx<m.fx?p(b):n=!0),n){if(u>=1)break;for(let e=1;e<y.length;++e)N(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else p(m)}return y.sort(g),{fx:y[0].fx,x:y[0]}}function D(t,e,n,s,i,r,o){const a=n.fx,l=z(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,N(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=z(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(N(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=z(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(),R(o,s.fxprime,-1);for(let e=0;e<l;++e){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){N(r,1,i.fxprime,-1,s.fxprime);const t=z(s.fxprime,s.fxprime);N(o,Math.max(0,z(r,i.fxprime)/t),o,-1,i.fxprime),a=s,s=i,i=a}else R(o,s.fxprime,-1);if(A(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||P,s=e.lossFunction||L,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 t of s)if(1===t.sets.length)r.push(t.sets[0]);else if(2===t.sets.length){const e=t.sets[0],n=t.sets[1];o.add(i(t.sets)),o.add(i([n,e]))}r.sort((t,e)=>t===e?0:t<e?-1:1);for(let t=0;t<r.length;++t){const e=r[t];for(let n=t+1;n<r.length;++n){const t=r[n];o.has(i([e,t]))||s.push({sets:[e,t],size:0})}}return s}(t,e),r=n(i,e),o=Object.keys(r),a=[];for(const t of o)a.push(r[t].x),a.push(r[t].y);const l=j(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 t=0;t<o.length;++t){const e=o[t];r[e].x=l[2*t],r[e].y=l[2*t+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 n=0;n<i;++n){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=>w(t,e,s)-n,0,t+e)}function P(t,e={}){let n=function(t,e){const n=e&&e.lossFunction?e.lossFunction:L,s={},i={};for(const e of t)if(1===e.sets.length){const t=e.sets[0];s[t]={x:1e10,y:1e10,rowid:s.length,size:e.size,radius:Math.sqrt(e.size/Math.PI)},i[t]=[]}t=t.filter(t=>2===t.sets.length);for(const e of t){let t=null!=e.weight?e.weight:1;const n=e.sets[0],r=e.sets[1];e.size+F>=Math.min(s[n].size,s[r].size)&&(t=0),i[n].push({set:r,size:e.size,weight:t}),i[r].push({set:n,size:e.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 e=1;e<r.length;++e){const a=r[e].set,u=i[a].filter(l),f=s[a];if(u.sort(o),0===u.length)throw"ERROR: missing pairwise overlap information";const d=[];for(var h=0;h<u.length;++h){const t=s[u[h].set],e=$(f.radius,t.radius,u[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<u.length;++n){const i=s[u[n].set],r=$(f.radius,i.radius,u[n].size),o=_({x:t.x,y:t.y,radius:e},{x:i.x,y:i.y,radius:r});d.push(...o)}}let y=1e50,p=d[0];for(const e of d){s[a].x=e.x,s[a].y=e.y;const i=n(s,t);i<y&&(y=i,p=e)}c(p,a)}return s}(t,e);const s=e.lossFunction||L;if(t.length>=8){const i=function(t,e={}){const n=e.restarts||10,s=[],i={};for(const e of t)1===e.sets.length&&(i[e.sets[0]]=s.length,s.push(e));let{distances:r,constraints:o}=function(t,e,n){const s=T(e.length,e.length),i=T(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=A(r.map(A))/r.length;r=r.map(t=>t.map(t=>t/a));const l=(t,e)=>function(t,e,n,s){for(let t=0;t<e.length;++t)e[t]=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),p=d-u*u;f>0&&y<=u||f<0&&y>=u||(i+=2*p*p,e[2*r]+=4*p*(o-c),e[2*r+1]+=4*p*(a-h),e[2*l]+=4*p*(c-o),e[2*l+1]+=4*p*(h-a))}}return i}(t,e,r,o);let c=null;for(let t=0;t<n;++t){const t=O(l,E(2*r.length).map(Math.random),e);(!c||t.fx<c.fx)&&(c=t)}const h=c.x,u={};for(let t=0;t<s.length;++t){const e=s[t];u[e.sets[0]]={x:h[2*t]*a,y:h[2*t+1]*a,radius:Math.sqrt(e.size/Math.PI)}}if(e.history)for(const t of e.history)R(t.x,a);return u}(t,e);s(i,t)+1e-8<s(n,t)&&(n=i)}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=w(n.radius,i.radius,k(n,i))}else e=I(s.sets.map(e=>t[e]));n+=(null!=s.weight?s.weight:1)*(e-s.size)*(e-s.size)}return n}function q(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=w(n.radius,i.radius,k(n,i))}else e=I(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 U(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){k(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 B(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 G(t,e,n){null==e&&(e=Math.PI/2);let s=X(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 e=0;e<t.length;++e)for(let s=e+1;s<t.length;++s){const i=t[e].radius+t[s].radius;k(t[e],t[s])+1e-10<i&&n(t[s],t[e])}const s=new Map;for(let n=0;n<t.length;++n){const i=e(t[n]).parent.setid;s.has(i)||s.set(i,[]),s.get(i).push(t[n])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(s);for(const t of i){U(t,e,n);const s=B(t);t.size=(s.xRange.max-s.xRange.min)*(s.yRange.max-s.yRange.min),t.bounds=s}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 e of t)e.x+=a,e.y+=l,s.push(e)}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=B(s);return V(s)}function W(t,e,n,s,i){const r=X(t);e-=2*s,n-=2*s;const{xRange:o,yRange:a}=B(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 V(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 V(t){const e={};for(const n of t)e[n.setid]=n;return e}function X(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function Y(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,p=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,g={},x=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 g)return g[t];var e=g[t]=x[m];return m+=1,m>=x.length&&(m=0),e},v=C,I=L;function M(g){let x=g.datum();const m=new Set;x.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),x=x.filter(t=>!t.sets.some(t=>m.has(t)));let M={},k={};if(x.length>0){let t=v(x,{lossFunction:I,distinct:d});a&&(t=G(t,o,f)),M=W(t,n,s,i,l),k=Q(M,x,p)}const w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}x.forEach(t=>{t.label&&(w[t.sets]=t.label)}),g.selectAll("svg").data([M]).enter().append("svg");const S=g.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=>et(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(x,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"),j=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 D(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"),j.style("fill",e=>e.colour||e.color?"#FFF":t.textFill?t.textFill:1==e.sets.length?b(e.sets):"#444"));let O=g;T&&"function"==typeof O.transition?(O=D(g),O.selectAll("path").attrTween("d",z)):O.selectAll("path").attr("d",t=>et(t.sets.map(t=>M[t])),y);const C=O.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 C?C.on("end",K(M,_)):C.each("end",K(M,_)):C.each(K(M,_)));const F=D(A.exit()).remove();"function"==typeof A.transition&&F.selectAll("path").attrTween("d",z);const $=F.selectAll("text").attr("x",n/2).attr("y",s/2);return null!==u&&(j.style("font-size","0px"),C.style("font-size",u),$.style("font-size","0px")),{circles:M,textCentres:k,nodes:A,enter:R,update:O,exit:F}}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?L:"logRatio"===t?q:t,M):I},M}function K(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,p=s.getAttribute("x"),g=s.getAttribute("y");u.forEach((t,e)=>{t.setAttribute("x",p),t.setAttribute("y",g),t.setAttribute("dy",`${y+1.1*e}em`)})}}function Z(t,e,n){let s=e[0].radius-k(e[0],t);for(let n=1;n<e.length;++n){const i=e[n].radius-k(e[n],t);i<=s&&(s=i)}for(let e=0;e<n.length;++e){const i=k(n[e],t)-n[e].radius;i<=s&&(s=i)}return s}function H(t,e,n){const s=[];for(const e of t)s.push({x:e.x,y:e.y}),s.push({x:e.x+e.radius/2,y:e.y}),s.push({x:e.x-e.radius/2,y:e.y}),s.push({x:e.x,y:e.y+e.radius/2}),s.push({x:e.x,y:e.y-e.radius/2});let i=s[0],r=Z(s[0],t,e);for(let n=1;n<s.length;++n){const o=Z(s[n],t,e);o>=r&&(i=s[n],r=o)}const o=j(n=>-1*Z({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 e of t)if(k(a,e)>e.radius){l=!1;break}for(const t of e)if(k(a,t)<t.radius){l=!1;break}if(l)return a;if(1==t.length)return{x:t[0].x,y:t[0].y};const c={};return I(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?H(t,[]):S(c.arcs.map(t=>t.p1))}function Q(t,e,n){const s={},i=function(t){const e={},n=Object.keys(t);for(const t of n)e[t]=[];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=k(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=H(c,h,n);s[o]=u,u.disjoint&&e[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return s}function J(t){if(0===t.length)return[];const e={};return I(t,e),e.arcs}function tt(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 e of t){const t=s(e.circle.radius);i.push("\nA",t,t,0,e.large?1:0,e.sweep?1:0,s(e.p1.x),s(e.p1.y))}return i.join(" ")}function et(t,e){return tt(J(t),e)}var nt=function(){var t=a(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],o=[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],p=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:a(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:a(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:o}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:o},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:o},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(p,[2,34]),t(p,[2,36]),t(p,[2,37]),t(p,[2,38]),t(p,[2,39]),t(p,[2,40]),t(p,[2,35])],defaultActions:{6:[2,1]},parseError:a(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:a(function(t){var e=this,n=[0],s=[],i=[null],r=[],o=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 p=f.yylloc;r.push(p);var g=f.options&&f.options.ranges;function x(){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,a(function(t){n.length=n.length-2*t,i.length=i.length-t,r.length=r.length-t},"popStack"),a(x,"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=x()),v=o[b]&&o[b][m]),void 0===v||!v.length||!v[0]){var E="";for(M in _=[],o[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:p,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,p=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},g&&(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=o[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0},"parse")},x=function(){return{EOF:1,parseError:a(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:a(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:a(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:a(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:a(function(){return this._more=!0,this},"more"),reject:a(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:a(function(t){this.unput(this.match.slice(t))},"less"),pastInput:a(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:a(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:a(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:a(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:a(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:a(function(){var t=this.next();return t||this.lex()},"lex"),begin:a(function(t){this.conditionStack.push(t)},"begin"),popState:a(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:a(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:a(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:a(function(t){this.begin(t)},"pushState"),stateStackSize:a(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:a(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 g.lexer=x,a(m,"Parser"),m.prototype=g,g.Parser=m,new m}();nt.parser=nt;var st,it=nt,rt=[],ot=[],at=[],lt=new Set,ct=!1,ht=a((t,e,n)=>{const s=xt(t).sort(),i=n??10/Math.pow(t.length,2);st=s,1===s.length&<.add(s[0]),rt.push({sets:s,size:i,label:e?ft(e):void 0})},"addSubsetData"),ut=a(()=>rt,"getSubsetData"),ft=a(t=>{const e=t.trim();return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e},"normalizeText"),dt=a(t=>t?ft(t):t,"normalizeStyleValue"),yt=a((t,e,n)=>{const s=ft(e);ot.push({sets:xt(t).sort(),id:s,label:n?ft(n):void 0})},"addTextData"),pt=a((t,e)=>{const n=xt(t).sort(),s={};for(const[t,n]of e)s[t]=dt(n)??n;at.push({targets:n,styles:s})},"addStyleData"),gt=a(()=>at,"getStyleData"),xt=a(t=>t.map(t=>ft(t)),"normalizeIdentifierList"),mt=a(t=>{const e=xt(t).filter(t=>!lt.has(t));if(e.length>0)throw new Error(`unknown set identifier: ${e.join(", ")}`)},"validateUnionIdentifiers"),bt=a(()=>ot,"getTextData"),vt=a(()=>st,"getCurrentSets"),It=a(()=>ct,"getIndentMode"),Mt=a(t=>{ct=t},"setIndentMode"),kt=m.venn;function wt(){return x(kt,l().venn)}a(wt,"getConfig");var _t={getConfig:wt,clear:a(()=>{g(),rt.length=0,ot.length=0,at.length=0,lt.clear(),st=void 0,ct=!1},"customClear"),setAccTitle:o,getAccTitle:r,setDiagramTitle:i,getDiagramTitle:s,getAccDescription:n,setAccDescription:e,addSubsetData:ht,getSubsetData:ut,addTextData:yt,addStyleData:pt,validateUnionIdentifiers:mt,getTextData:bt,getStyleData:gt,getCurrentSets:vt,getIndentMode:It,setIndentMode:Mt},St=a(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 Et(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}a(Et,"buildStyleByKey");var Tt=a((t,e,n,s)=>{const i=s.db,r=i.getConfig?.(),{themeVariables:o,look:a,handDrawnSeed:g}=l(),x="handDrawn"===a,m=[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=Et(i.getStyleData()),w=Rt(I),_=r?.width??800,S=r?.height??450,E=_/1600,T=v?48*E:0,z=o.primaryTextColor??o.textColor,A=c(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=h(document.createElement("div")),N=Y().width(_).height(S-T);R.datum(w).call(N);const j=x?u.svg(R.select("svg").node()):void 0,D=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?q:n:L,distinct:f});i&&(y=G(y,r,o));const p=W(y,a,l,c,h),g=Q(p,t,u),x=new Map(Object.keys(p).map(t=>[t,{set:t,x:p[t].x,y:p[t].y,radius:p[t].radius}])),m=t.map(t=>{const e=t.sets.map(t=>x.get(t)),n=J(e);return{circles:e,arcs:n,path:tt(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:g[s.sets],circles:t,arcs:e,path:n,distinctPath:n+b(s.sets)}))}(w,{width:_,height:S-T,padding:r?.padding??15}),O=new Map;for(const t of D){const e=zt([...t.data.sets].sort());O.set(e,t)}M.length>0&&At(r,O,R,M,E,k);const F=f(o.background||"#f4f4f4");R.selectAll(".venn-circle").each(function(t,e){const n=h(this),s=zt([...t.sets].sort()),i=k.get(s),r=m.length>0?m[e%m.length]:void 0,a=i?.fill||r||o.primaryColor;n.classed("venn-set-"+e%8,!0);const l=i?.["fill-opacity"]??.1,c=i?.stroke||a,u=i?.["stroke-width"]||""+5*E;if(x&&j){const t=O.get(s);if(t&&t.circles.length>0){const s=t.circles[0],i=j.circle(s.x,s.y,2*s.radius,{roughness:.7,seed:g,fill:b(a,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:c,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",c).style("stroke-width",u).style("stroke-opacity",.95);const f=i?.color||(F?d(a,30):y(a,30));n.select("text").style("font-size",48*E+"px").style("fill",f)}),x&&j?R.selectAll(".venn-intersection").each(function(t){const e=h(this),n=zt([...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=j.path(n,{roughness:.7,seed:g,fill:b(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=zt([...t.sets].sort());return k.get(e)?.color??o.vennSetTextColor??z}),R.selectAll(".venn-intersection path").style("fill-opacity",t=>{const e=zt([...t.sets].sort());return k.get(e)?.fill?1:0}).style("fill",t=>{const e=zt([...t.sets].sort());return k.get(e)?.fill??"transparent"}));const $=A.append("g").attr("transform",`translate(0, ${T})`),P=R.select("svg").node();if(P&&"childNodes"in P)for(const t of[...P.childNodes])$.node()?.appendChild(t);p(A,S,_,r?.useMaxWidth??!0)},"draw");function zt(t){return t.join("|")}function At(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 t of s){const e=zt(t.sets),n=l.get(e);n?n.push(t):l.set(e,[t])}for(const[t,n]of l.entries()){const s=e.get(t);if(!s?.text)continue;const l=s.text.x,c=s.text.y,h=Math.min(...s.circles.map(t=>t.radius)),u=Math.min(...s.circles.map(t=>t.radius-Math.hypot(l-t.x,c-t.y)));let f=Number.isFinite(u)?Math.max(0,u):0;0===f&&Number.isFinite(h)&&(f=.6*h);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",l).attr("cy",c).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),p=Math.max(60*i,2*f*.95),g=(s.data.label&&s.data.label.length>0?Math.min(32*i,.25*f):0)+(n.length<=2?30*i:0),x=l-y/2,m=c-p/2+g,b=Math.max(1,Math.ceil(Math.sqrt(n.length))),v=y/b,I=p/Math.max(1,Math.ceil(n.length/b));for(const[t,e]of n.entries()){const n=t%b,s=Math.floor(t/b),a=x+v*(n+.5),l=m+I*(s+.5);o&&d.append("rect").attr("class","venn-text-debug-cell").attr("x",x+v*n).attr("y",m+I*s).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",a-c/2).attr("y",l-h/2).attr("overflow","visible"),f=r.get(e.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(e.label??e.id);f&&y.style("color",f)}}}function Rt(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}a(zt,"stableSetsKey"),a(At,"renderTextNodes"),a(Rt,"ensurePairwiseSubsets");var Nt={parser:it,db:_t,renderer:{draw:Tt},styles:St};export{Nt as diagram};
|
package/dist/esm/{wardleyDiagram-IVAIDKWA-DiF93Bmd.js → wardleyDiagram-IVAIDKWA-Ci0p6FBo.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t}from"./chunk-JWPE2WC7-CVtFylX6.js";import{s as e,g as a,x as r,v as n,a as o,b as i,_ as s,a7 as l,O as d,Q as c,l as p,T as x,d as h,C as y,c as g}from"./mermaid.core-CvFWfSA0.js";import{p as f}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import"./index-BwpxQGdp.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";var m=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"),u=s((t,e,a)=>({x:m(e,`${a} evolution`),y:m(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=u(t.visibility,t.evolution,`Anchor "${t.name}"`);a.addNode(t.name,t.name,e.x,e.y,"anchor")}),e.components.forEach(t=>{const e=u(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=u(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=m(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=m(t.target,`Evolve target for "${t.component}"`);a.addTrend(t.component,r,e.y)}}),e.annotations.length>0){const t=e.annotations[0],r=u(t.x,t.y,"Annotations box");a.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(t=>{const e=u(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=u(t.x,t.y,`Accelerator "${t.name}"`);a.addAccelerator(t.name,e.x,e.y)}),e.deaccelerators.forEach(t=>{const e=u(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 C(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 M(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 j(t){return v.resolveNodeId(t)}function O(){return v.build()}function X(){v.clear(),y()}s(S,"getConfig"),s(C,"addNode"),s(M,"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(j,"resolveNodeId"),s(O,"getWardleyData"),s(X,"clear");var Y={getConfig:S,addNode:C,addLink:M,addTrend:P,addAnnotation:N,addNote:z,addAccelerator:L,addDeaccelerator:T,setAnnotationsBox:A,setSize:E,startPipeline:I,addPipelineComponent:B,updateAxes:F,getNode:R,resolveNodeId:j,getWardleyData:O,clear:X,setAccTitle:i,getAccTitle:o,setDiagramTitle:n,getDiagramTitle:r,getAccDescription:a,setAccDescription:e},D=["Genesis","Custom Built","Product","Commodity"],W=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"),q=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:Y,renderer:{draw:s((t,e,a,r)=>{p.debug("Rendering Wardley map\n"+t);const n=q(),o=W(),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 m=f.append("g").attr("class","wardley-map"),u=f.append("defs");u.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"),u.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"),u.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"),m.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&&m.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=m.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",C=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(C);const M=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:D;if(M.length>0){const t=m.append("g").attr("class","wardley-stages"),e=d.axes.stageBoundaries,a=[];if(e&&e.length===M.length){let t=0;e.forEach(e=>{a.push({start:t,end:e}),t=e})}else{const t=1/M.length;M.forEach((e,r)=>{a.push({start:r*t,end:(r+1)*t})})}M.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=m.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=m.append("g").attr("class","wardley-pipelines"),e=m.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=m.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=m.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=m.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=m.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 e=0;e<a.length-1;e++)t.append("line").attr("class","wardley-annotation-line").attr("x1",a[e].x).attr("y1",a[e].y).attr("x2",a[e+1].x).attr("y2",a[e+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,m=n.padding,u=g-n.padding-x;e=Math.max(h,Math.min(e,f)),a=Math.max(m,Math.min(a,u)),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=m.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=m.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=m.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};
|
|
1
|
+
import{p as t}from"./chunk-JWPE2WC7-D8efNL_z.js";import{s as e,g as a,x as r,v as n,a as o,b as i,_ as s,a7 as l,O as d,Q as c,l as p,T as x,d as h,C as y,c as g}from"./mermaid.core-DErPnTKR.js";import{p as f}from"./cynefin-EF2NZ3EQ-CaJSaYBh.js";import"./index-DjHFXv3v.js";import"react/jsx-runtime";import"react";import"./enums.js";import"./commons-C-9EFvh4.js";import"./settings-DzQM72QE.js";import"./index-Zvckkvpn.js";import"./LoaderLayer-CWElgcGs.js";import"./websocket-KESFarc3.js";import"./index-DpobNvg5.js";import"motion/react";import"react-dom";import"swr";import"@ably/spaces";import"@ably/spaces/react";import"ably";import"ably/liveobjects";import"@ably/spaces/dist/mjs/react";import"./string-DPJhNSkw.js";var m=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"),u=s((t,e,a)=>({x:m(e,`${a} evolution`),y:m(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=u(t.visibility,t.evolution,`Anchor "${t.name}"`);a.addNode(t.name,t.name,e.x,e.y,"anchor")}),e.components.forEach(t=>{const e=u(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=u(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=m(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=m(t.target,`Evolve target for "${t.component}"`);a.addTrend(t.component,r,e.y)}}),e.annotations.length>0){const t=e.annotations[0],r=u(t.x,t.y,"Annotations box");a.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(t=>{const e=u(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=u(t.x,t.y,`Accelerator "${t.name}"`);a.addAccelerator(t.name,e.x,e.y)}),e.deaccelerators.forEach(t=>{const e=u(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 C(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 M(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 j(t){return v.resolveNodeId(t)}function O(){return v.build()}function X(){v.clear(),y()}s(S,"getConfig"),s(C,"addNode"),s(M,"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(j,"resolveNodeId"),s(O,"getWardleyData"),s(X,"clear");var Y={getConfig:S,addNode:C,addLink:M,addTrend:P,addAnnotation:N,addNote:z,addAccelerator:L,addDeaccelerator:T,setAnnotationsBox:A,setSize:E,startPipeline:I,addPipelineComponent:B,updateAxes:F,getNode:R,resolveNodeId:j,getWardleyData:O,clear:X,setAccTitle:i,getAccTitle:o,setDiagramTitle:n,getDiagramTitle:r,getAccDescription:a,setAccDescription:e},D=["Genesis","Custom Built","Product","Commodity"],W=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"),q=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:Y,renderer:{draw:s((t,e,a,r)=>{p.debug("Rendering Wardley map\n"+t);const n=q(),o=W(),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 m=f.append("g").attr("class","wardley-map"),u=f.append("defs");u.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"),u.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"),u.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"),m.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&&m.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=m.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",C=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(C);const M=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:D;if(M.length>0){const t=m.append("g").attr("class","wardley-stages"),e=d.axes.stageBoundaries,a=[];if(e&&e.length===M.length){let t=0;e.forEach(e=>{a.push({start:t,end:e}),t=e})}else{const t=1/M.length;M.forEach((e,r)=>{a.push({start:r*t,end:(r+1)*t})})}M.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=m.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=m.append("g").attr("class","wardley-pipelines"),e=m.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=m.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=m.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=m.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=m.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 e=0;e<a.length-1;e++)t.append("line").attr("class","wardley-annotation-line").attr("x1",a[e].x).attr("y1",a[e].y).attr("x2",a[e+1].x).attr("y2",a[e+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,m=n.padding,u=g-n.padding-x;e=Math.max(h,Math.min(e,f)),a=Math.max(m,Math.min(a,u)),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=m.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=m.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=m.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};
|