@aiquants/markdown 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -2
- package/dist/{abnfDiagram-VRR7QNED-CxQnFjoJ.js → abnfDiagram-VRR7QNED-C4Jxgx13.js} +3 -3
- package/dist/{abnfDiagram-VRR7QNED-npWEsqYc.cjs → abnfDiagram-VRR7QNED-WjiOMH07.cjs} +1 -1
- package/dist/{arc-CUfL06Yf.cjs → arc-BASi8Hqx.cjs} +1 -1
- package/dist/{arc-8h1FB6uq.js → arc-C7CH7xqM.js} +20 -20
- package/dist/{architectureDiagram-ZJ3FMSHR-B3AN9LVb.js → architectureDiagram-ZJ3FMSHR-ClwidIel.js} +2 -2
- package/dist/{architectureDiagram-ZJ3FMSHR-B20pDRbn.cjs → architectureDiagram-ZJ3FMSHR-QlFmKjZ2.cjs} +1 -1
- package/dist/{blockDiagram-677ZJIJ3-BpyvdB6a.cjs → blockDiagram-677ZJIJ3-B5QDrNQV.cjs} +1 -1
- package/dist/{blockDiagram-677ZJIJ3-Cyl2Lsxi.js → blockDiagram-677ZJIJ3-BUrX_zhT.js} +3 -3
- package/dist/{c4Diagram-LMCZKHZV-B1v06ANz.js → c4Diagram-LMCZKHZV-B2hi-Wi5.js} +2 -2
- package/dist/{c4Diagram-LMCZKHZV-C9aMoZww.cjs → c4Diagram-LMCZKHZV-DYZO523e.cjs} +1 -1
- package/dist/{channel-BFKA8ne6.cjs → channel-Cg3Vm619.cjs} +1 -1
- package/dist/{channel-DHWInoX5.js → channel-Cr1ANV4j.js} +1 -1
- package/dist/{chunk-2Q5K7J3B-Hkei_N8G.js → chunk-2Q5K7J3B-Bxo9slkI.js} +1 -1
- package/dist/{chunk-2Q5K7J3B-CKQJDnvh.cjs → chunk-2Q5K7J3B-ZmtWeAKF.cjs} +1 -1
- package/dist/{chunk-32BRIVSS-BegSeeKc.cjs → chunk-32BRIVSS-8tw0VC1F.cjs} +1 -1
- package/dist/{chunk-32BRIVSS-BVjoQVFd.js → chunk-32BRIVSS-YISd1c8J.js} +1 -1
- package/dist/{chunk-5VM5RSS4-Bwvu3ZQn.js → chunk-5VM5RSS4-CqNTCifm.js} +1 -1
- package/dist/{chunk-5VM5RSS4-BQ9OvvVm.cjs → chunk-5VM5RSS4-g88YAKYU.cjs} +1 -1
- package/dist/{chunk-EX3LRPZG-Bj_q1v7R.cjs → chunk-EX3LRPZG-DP6g1uoN.cjs} +1 -1
- package/dist/{chunk-EX3LRPZG-Bz5BV4Fn.js → chunk-EX3LRPZG-WwLq86XG.js} +4 -4
- package/dist/{chunk-JWPE2WC7-CZGO5NQs.cjs → chunk-JWPE2WC7-Bqw3GN0H.cjs} +1 -1
- package/dist/{chunk-JWPE2WC7-C01naS5D.js → chunk-JWPE2WC7-COh8RdRz.js} +1 -1
- package/dist/{chunk-MOJQB5TN-DFFX8TKc.cjs → chunk-MOJQB5TN-BVAWgplu.cjs} +1 -1
- package/dist/{chunk-MOJQB5TN-C3Hq75Zv.js → chunk-MOJQB5TN-C1dao40o.js} +10 -10
- package/dist/{chunk-PUDLZKDR-2MWL0ZoW.cjs → chunk-PUDLZKDR-CC_D9ix1.cjs} +1 -1
- package/dist/{chunk-PUDLZKDR-Sz0OB5IT.js → chunk-PUDLZKDR-Cmc1XT5M.js} +6 -6
- package/dist/{chunk-RYQCIY6F-CSDblZx6.cjs → chunk-RYQCIY6F-C19BL3Ws.cjs} +1 -1
- package/dist/{chunk-RYQCIY6F-CBI5EYhC.js → chunk-RYQCIY6F-CjUwK4va.js} +12 -12
- package/dist/{chunk-V7JOEXUC-Br5K_lDL.js → chunk-V7JOEXUC-CypP8KXk.js} +15 -15
- package/dist/{chunk-V7JOEXUC-D3Y19ZhK.cjs → chunk-V7JOEXUC-iaB-PSjI.cjs} +1 -1
- package/dist/{chunk-VR4S4FIN-CQXol07w.js → chunk-VR4S4FIN-CC2Up04Z.js} +3 -3
- package/dist/{chunk-VR4S4FIN-DjxDq6sN.cjs → chunk-VR4S4FIN-CVdDLZPH.cjs} +1 -1
- package/dist/{chunk-XXDRQBXY--FT3CTeH.js → chunk-XXDRQBXY-D7hud77X.js} +1 -1
- package/dist/{chunk-XXDRQBXY-DwP8HH5V.cjs → chunk-XXDRQBXY-V6DQOxAN.cjs} +1 -1
- package/dist/{classDiagram-OUVF2IWQ-WUNGB5FC.cjs → classDiagram-OUVF2IWQ-BFfnrPra.cjs} +1 -1
- package/dist/{classDiagram-v2-EOCWNBFH-HKTI1J11.js → classDiagram-OUVF2IWQ-CgyfPPk6.js} +2 -2
- package/dist/{classDiagram-v2-EOCWNBFH-WUNGB5FC.cjs → classDiagram-v2-EOCWNBFH-BFfnrPra.cjs} +1 -1
- package/dist/{classDiagram-OUVF2IWQ-HKTI1J11.js → classDiagram-v2-EOCWNBFH-CgyfPPk6.js} +2 -2
- package/dist/components/BlockBoundary.d.ts +19 -0
- package/dist/components/MarkdownRenderer.d.ts +6 -1
- package/dist/components/MarkdownViewer.d.ts +3 -1
- package/dist/components/SvgImageBlock.d.ts +25 -0
- package/dist/components/blockFailureLabels.d.ts +2 -0
- package/dist/components/mdastNodes/CodeNode.d.ts +1 -0
- package/dist/components/rawHtml.d.ts +1 -0
- package/dist/components/svgImageLabels.d.ts +16 -0
- package/dist/components/viewerLabels.d.ts +7 -1
- package/dist/converter.wasm +0 -0
- package/dist/{cose-bilkent-JH36ORCC-X2Leg8js.cjs → cose-bilkent-JH36ORCC-BQZprRVI.cjs} +1 -1
- package/dist/{cose-bilkent-JH36ORCC-BYqXiffa.js → cose-bilkent-JH36ORCC-DmxSHNLU.js} +5 -5
- package/dist/{cynefinDiagram-TSTJHNR4-DYAvR3E8.cjs → cynefinDiagram-TSTJHNR4-KM35ULZr.cjs} +1 -1
- package/dist/{cynefinDiagram-TSTJHNR4-YATbGDfo.js → cynefinDiagram-TSTJHNR4-ku5HNgfN.js} +47 -47
- package/dist/{dagre-VKFMJZFB-Co2RmhO1.js → dagre-VKFMJZFB-57k1u_99.js} +20 -20
- package/dist/{dagre-VKFMJZFB-yjrP1oXL.cjs → dagre-VKFMJZFB-BmFsAJzi.cjs} +1 -1
- package/dist/{diagram-FQU43EPY-DfigqQP9.js → diagram-FQU43EPY-0ev8XAoD.js} +2 -2
- package/dist/{diagram-FQU43EPY-DVts5oXk.cjs → diagram-FQU43EPY-Bn7xPHj7.cjs} +1 -1
- package/dist/{diagram-G47NLZAW-Cave3JO_.cjs → diagram-G47NLZAW-CjGc3D2u.cjs} +1 -1
- package/dist/{diagram-G47NLZAW-k5OpX3J4.js → diagram-G47NLZAW-RPdbjZwZ.js} +38 -38
- package/dist/{diagram-NH7WQ7WH-DDA_wiMC.js → diagram-NH7WQ7WH-CnZ4iL7c.js} +20 -20
- package/dist/{diagram-NH7WQ7WH-ByEOvB5o.cjs → diagram-NH7WQ7WH-lHSM_pTi.cjs} +1 -1
- package/dist/{diagram-OA4YK3LP-C85REJhK.cjs → diagram-OA4YK3LP-BcKaPsNW.cjs} +1 -1
- package/dist/{diagram-OA4YK3LP-DR63MTHd.js → diagram-OA4YK3LP-RtsRdjQV.js} +58 -58
- package/dist/{diagram-WEI45ONY-9_82j2nL.cjs → diagram-WEI45ONY-Cm0jKyLw.cjs} +1 -1
- package/dist/{diagram-WEI45ONY-DKy9LVdb.js → diagram-WEI45ONY-eVEUMERO.js} +10 -10
- package/dist/{ebnfDiagram-CCIWWBDH-Cn6FnIur.js → ebnfDiagram-CCIWWBDH-BlAQU47p.js} +5 -5
- package/dist/{ebnfDiagram-CCIWWBDH-CYd0AUSE.cjs → ebnfDiagram-CCIWWBDH-CcHTkkm8.cjs} +1 -1
- package/dist/{erDiagram-Q63AITRT-BF_5IEpU.js → erDiagram-Q63AITRT-Cz_PKpWU.js} +9 -9
- package/dist/{erDiagram-Q63AITRT-CMIoja24.cjs → erDiagram-Q63AITRT-Dv27IAYm.cjs} +1 -1
- package/dist/{extractHeadings-sSLGzcdt.cjs → extractHeadings-BMNm4Zss.cjs} +82 -82
- package/dist/{extractHeadings-DZi9v6vp.js → extractHeadings-OhPxZ04C.js} +6611 -6424
- package/dist/flowDiagram-23GEKE2U-BoCXOrea.js +7 -0
- package/dist/flowDiagram-23GEKE2U-Dsludo9a.cjs +1 -0
- package/dist/{ganttDiagram-NO4QXBWP-Drcm5yEd.cjs → ganttDiagram-NO4QXBWP-CbbUbAi1.cjs} +1 -1
- package/dist/{ganttDiagram-NO4QXBWP-DEnf80Mq.js → ganttDiagram-NO4QXBWP-DtwVRaBN.js} +2 -2
- package/dist/{gitGraphDiagram-IHSO6WYX-GII6PPu9.cjs → gitGraphDiagram-IHSO6WYX-BHOaT-JP.cjs} +1 -1
- package/dist/{gitGraphDiagram-IHSO6WYX-eyfAn5cz.js → gitGraphDiagram-IHSO6WYX-BiUZZefR.js} +10 -10
- package/dist/index.cjs +1 -1
- package/dist/index.client.cjs +1 -1
- package/dist/index.client.d.ts +3 -1
- package/dist/index.client.js +32 -31
- package/dist/index.js +32 -31
- package/dist/{infoDiagram-FWYZ7A6U-DPC7xHqx.js → infoDiagram-FWYZ7A6U-DI2c0joH.js} +1 -1
- package/dist/{infoDiagram-FWYZ7A6U-C2FBPXIG.cjs → infoDiagram-FWYZ7A6U-DsF_dahQ.cjs} +1 -1
- package/dist/{ishikawaDiagram-FXEZZL3T-DqNbTlei.js → ishikawaDiagram-FXEZZL3T-0U9dSh7F.js} +25 -25
- package/dist/{ishikawaDiagram-FXEZZL3T-CJVI_dU0.cjs → ishikawaDiagram-FXEZZL3T-CaDgpvd5.cjs} +1 -1
- package/dist/{journeyDiagram-5HDEW3XC-DiVOEWa6.cjs → journeyDiagram-5HDEW3XC-5qIvxqpC.cjs} +1 -1
- package/dist/{journeyDiagram-5HDEW3XC-DuKx5oFy.js → journeyDiagram-5HDEW3XC-Y9ABNCEY.js} +4 -4
- package/dist/{kanban-definition-HUTT4EX6-BklyDLxL.cjs → kanban-definition-HUTT4EX6-DDy8tXpk.cjs} +1 -1
- package/dist/{kanban-definition-HUTT4EX6-DezliCFs.js → kanban-definition-HUTT4EX6-DTsrmMh8.js} +52 -52
- package/dist/{linear-CdYfVjua.js → linear-B7M8-_qH.js} +5 -5
- package/dist/{linear-w1JR48Qh.cjs → linear-CYNosLx1.cjs} +1 -1
- package/dist/{mindmap-definition-LN4V7U3C-BlvTH7wL.cjs → mindmap-definition-LN4V7U3C-AQHTbAWm.cjs} +1 -1
- package/dist/{mindmap-definition-LN4V7U3C-7q4b7Jdd.js → mindmap-definition-LN4V7U3C-CNXzfo0L.js} +16 -16
- package/dist/{pegDiagram-2B236MQR-BPY_9I4m.js → pegDiagram-2B236MQR-CNgWrgv-.js} +3 -3
- package/dist/{pegDiagram-2B236MQR-DirAhjr9.cjs → pegDiagram-2B236MQR-D0SEAIrf.cjs} +1 -1
- package/dist/{pieDiagram-ENE6RG2P-CLMNCcZD.cjs → pieDiagram-ENE6RG2P-BlmNu0Kw.cjs} +1 -1
- package/dist/{pieDiagram-ENE6RG2P-L4j2AB7Y.js → pieDiagram-ENE6RG2P-DzbrqPW4.js} +51 -51
- package/dist/{quadrantDiagram-ABIIQ3AL-lyExQfuw.cjs → quadrantDiagram-ABIIQ3AL-BXPkUo_7.cjs} +1 -1
- package/dist/{quadrantDiagram-ABIIQ3AL-B9uzT4Zl.js → quadrantDiagram-ABIIQ3AL-_XC0L6LA.js} +43 -43
- package/dist/{railroadDiagram-RFXS5EU6-BgW-4T7B.js → railroadDiagram-RFXS5EU6-CfXmkCxt.js} +7 -7
- package/dist/{railroadDiagram-RFXS5EU6-u2Ztkufm.cjs → railroadDiagram-RFXS5EU6-EyrFshDZ.cjs} +1 -1
- package/dist/{requirementDiagram-TGXJPOKE-BnyCTa79.js → requirementDiagram-TGXJPOKE-DKjGDx3E.js} +18 -18
- package/dist/{requirementDiagram-TGXJPOKE-Cm9r8e07.cjs → requirementDiagram-TGXJPOKE-KjSczfMx.cjs} +1 -1
- package/dist/{sankeyDiagram-HTMAVEWB-KJ5WdXGw.cjs → sankeyDiagram-HTMAVEWB-6JC0mA8g.cjs} +1 -1
- package/dist/{sankeyDiagram-HTMAVEWB-Cv3KCrBX.js → sankeyDiagram-HTMAVEWB-R3EgjVk3.js} +1 -1
- package/dist/{sequenceDiagram-DBY2YBRQ-CUa9htwo.js → sequenceDiagram-DBY2YBRQ-BeK8wcJ4.js} +3 -3
- package/dist/{sequenceDiagram-DBY2YBRQ-DYXMeMoq.cjs → sequenceDiagram-DBY2YBRQ-jllfFbkK.cjs} +1 -1
- package/dist/{sizeCapture-X5ZJPWSS-D0cfhTVe.js → sizeCapture-X5ZJPWSS-C9QakD3W.js} +1 -1
- package/dist/{sizeCapture-X5ZJPWSS-C4RUlRk2.cjs → sizeCapture-X5ZJPWSS-QkZ2crvh.cjs} +1 -1
- package/dist/{stateDiagram-2N3HPSRC-C4DOBTHC.cjs → stateDiagram-2N3HPSRC-CoHLlhZX.cjs} +1 -1
- package/dist/{stateDiagram-2N3HPSRC-CUQCdjYa.js → stateDiagram-2N3HPSRC-DXh1e2K8.js} +10 -10
- package/dist/{stateDiagram-v2-6OUMAXLB-BK27mYqW.cjs → stateDiagram-v2-6OUMAXLB-B0KQB01K.cjs} +1 -1
- package/dist/{stateDiagram-v2-6OUMAXLB-C1Fb_pKt.js → stateDiagram-v2-6OUMAXLB-D6Dlbs-H.js} +2 -2
- package/dist/styles/markdown.css +1 -1
- package/dist/styles/markdown.standalone.css +1 -1
- package/dist/{swimlanes-5IMT3BWC-DUPAete1.js → swimlanes-5IMT3BWC-BaTEG5rQ.js} +313 -313
- package/dist/{swimlanes-5IMT3BWC-DZLnPVID.cjs → swimlanes-5IMT3BWC-D-D1lzxE.cjs} +1 -1
- package/dist/{swimlanesDiagram-G3AALYLV-BrpRN3Vb.js → swimlanesDiagram-G3AALYLV-C6p-5K6G.js} +2 -2
- package/dist/{swimlanesDiagram-G3AALYLV-CMa-ZboO.cjs → swimlanesDiagram-G3AALYLV-DSssDQXF.cjs} +1 -1
- package/dist/{timeline-definition-FHXFAJF6-DC2SJZSb.js → timeline-definition-FHXFAJF6-Bq5nzkkn.js} +108 -108
- package/dist/{timeline-definition-FHXFAJF6-wvuHQLus.cjs → timeline-definition-FHXFAJF6-DtewJvNV.cjs} +1 -1
- package/dist/{vennDiagram-L72KCM5P-HK22xYss.js → vennDiagram-L72KCM5P-5QsbfRVK.js} +101 -101
- package/dist/{vennDiagram-L72KCM5P-DbIG-wm1.cjs → vennDiagram-L72KCM5P-g-vN7N0T.cjs} +1 -1
- package/dist/{wardleyDiagram-EHGQE667-BN2PkxRg.cjs → wardleyDiagram-EHGQE667-B78Ehxdt.cjs} +1 -1
- package/dist/{wardleyDiagram-EHGQE667-JHC6pqAp.js → wardleyDiagram-EHGQE667-Dk_QVzpo.js} +85 -85
- package/dist/{xychartDiagram-FW5EYKEG-DNLQTD-2.js → xychartDiagram-FW5EYKEG-CwpcSS8_.js} +40 -40
- package/dist/{xychartDiagram-FW5EYKEG-CMRlyJDS.cjs → xychartDiagram-FW5EYKEG-DwiqWfUA.cjs} +1 -1
- package/package.json +11 -11
- package/dist/flowDiagram-23GEKE2U-BCDxgNfH.js +0 -7
- package/dist/flowDiagram-23GEKE2U-DDbv1eCW.cjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./extractHeadings-sSLGzcdt.cjs"),vt=(t,n)=>k.adjustChannel(t,"a",-n),Mt=1e-10;function st(t,n){const s=Gt(t),e=s.filter(l=>Ut(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=wt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const x={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),E=Math.atan2(f.x-p.x,f.y-p.y);let w=E-M;w<0&&(w+=2*Math.PI);const S=E-w/2;let g=q(x,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=at(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-Mt,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function Ut(t,n){return n.every(s=>q(t,s)<s.radius+Mt)}function Gt(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=St(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function at(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function gt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return at(t,e)+at(n,i)}function St(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function wt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function Wt(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,x=t(a);if(x*r>=0&&(n=a),Math.abs(f)<o||x===0)return a}return n+f}function lt(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function It(t,n){return lt(t).map(()=>lt(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ct(t){return Math.sqrt($(t,t))}function ut(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function Tt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,x=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let _=0;_<b;++_){const c=n.slice();c[_]=c[_]?c[_]*i:o,p[_+1]=c,p[_+1].fx=t(c),p[_+1].id=_+1}function M(_){for(let c=0;c<_.length;c++)p[b][c]=_[c];p[b].fx=_.fx}const E=(_,c)=>_.fx-c.fx,w=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let _=0;_<e;++_){if(p.sort(E),s.history){const y=p.map(d=>{const R=d.slice();return R.fx=d.fx,R.id=d.id,R});y.sort((d,R)=>d.id-R.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:y})}h=0;for(let y=0;y<b;++y)h=Math.max(h,Math.abs(p[0][y]-p[1][y]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let y=0;y<b;++y){w[y]=0;for(let d=0;d<b;++d)w[y]+=p[d][y];w[y]/=b}const c=p[b];if(J(S,1+f,w,-f,c),S.fx=t(S),S.fx<p[0].fx)J(m,1+u,w,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let y=!1;if(S.fx>c.fx?(J(g,1+a,w,-a,c),g.fx=t(g),g.fx<c.fx?M(g):y=!0):(J(g,1-a*f,w,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):y=!0),y){if(x>=1)break;for(let d=1;d<p.length;++d)J(p[d],1-x,p[0],x,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(E),{fx:p[0].fx,x:p[0]}}function Kt(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,x=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,E){for(let w=0;w<16;++w)if(i=(p+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||u>=E)M=i;else{if(Math.abs(x)<=-r*f)return i;x*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(x)<=-r*f)return i;if(x>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function Ht(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ut(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=Kt(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ut(r,e.fxprime,-1);else{J(o,1,i.fxprime,-1,e.fxprime);const x=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/x);J(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ct(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function Et(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||Jt,e=n.lossFunction||tt,i=Yt(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=Tt(a=>{const x={};for(let h=0;h<r.length;++h){const b=r[h];x[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(x,i)},l,n).x;for(let a=0;a<r.length;++a){const x=r[a];o[x].x=u[2*a],o[x].y=u[2*a+1]}return o}const zt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+zt?Math.abs(t-n):Wt(e=>gt(t,n,e)-s,0,t+n)}function Yt(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let x=u+1;x<f.sets.length;x++){const h=String(f.sets[x]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function Xt(t,n,s){const e=It(n.length,n.length),i=It(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(f,u,o.size);e[r][l]=e[l][r]=a;let x=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?x=1:o.size<=1e-10&&(x=-1),i[r][l]=i[l][r]=x}),{distances:e,constraints:i}}function Zt(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],x=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-x*x;h>0&&p<=x||h<0&&p>=x||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function Jt(t,n={}){let s=$t(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=Qt(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function Qt(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=Xt(t,e,i);const l=ct(o.map(ct))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>Zt(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=lt(o.length*2).map(Math.random),p=Ht(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,x={};for(let h=0;h<e.length;++h){const b=e[h];x[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ut(h.x,l);return x}function $t(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const x of t)if(x.sets.length===1){const h=x.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:x.size,radius:Math.sqrt(x.size/Math.PI)},i[h]=[]}t=t.filter(x=>x.sets.length===2);for(const x of t){let h=x.weight!=null?x.weight:1;const b=x.sets[0],p=x.sets[1];x.size+zt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:x.size,weight:h}),i[p].push({set:b,size:x.size,weight:h})}const o=[];Object.keys(i).forEach(x=>{let h=0;for(let b=0;b<i[x].length;++b)h+=i[x][b].size*i[x][b].weight;o.push({set:x,size:h})});function r(x,h){return h.size-x.size}o.sort(r);const l={};function f(x){return x.set in l}function u(x,h){e[h].x=x.x,e[h].y=x.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let x=1;x<o.length;++x){const h=o[x].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ft(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){const _=e[b[m].set],c=ft(p.radius,_.radius,b[m].size),y=St({x:S.x,y:S.y,radius:g},{x:_.x,y:_.y,radius:c});M.push(...y)}}let E=1e50,w=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<E&&(E=g,w=S)}u(w,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=gt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function At(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=gt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function te(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function ee(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function ht(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ot(t).map(u=>Object.assign({},u));const i=ee(e);for(const u of i){te(u,n,s);const a=ht(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,x){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(x)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=ht(e);return Ct(e)}function Rt(t,n,s,e,i){const o=Ot(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=ht(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),x=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Ct(o.map(b=>({radius:a*b.radius,x:e+x+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ct(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ot(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ne(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,x=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},w=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(y){if(y in E)return E[y];var d=E[y]=w[S];return S+=1,S>=w.length&&(S=0),d},m=Et,_=tt;function c(y){let d=y.datum();const R=new Set;d.forEach(I=>{I.size==0&&I.sets.length==1&&R.add(I.sets[0])}),d=d.filter(I=>!I.sets.some(j=>R.has(j)));let v={},C={};if(d.length>0){let I=m(d,{lossFunction:_,distinct:b});l&&(I=Dt(I,r,h)),v=Rt(I,s,e,i,f),C=jt(v,d,M)}const U={};d.forEach(I=>{I.label&&(U[I.sets]=I.label)});function V(I){if(I.sets in U)return U[I.sets];if(I.sets.length==1)return""+I.sets[0]}y.selectAll("svg").data([v]).enter().append("svg");const N=y.select("svg");n?N.attr("viewBox",`0 0 ${s} ${e}`):N.attr("width",s).attr("height",e);const D={};let T=!1;N.selectAll(".venn-area path").each(function(I){const j=this.getAttribute("d");I.sets.length==1&&j&&!b&&(T=!0,D[I.sets[0]]=oe(j))});function A(I){return j=>{const H=I.sets.map(et=>{let Y=D[et],Z=v[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-j)+Z.x*j,y:Y.y*(1-j)+Z.y*j,radius:Y.radius*(1-j)+Z.radius*j}});return kt(H,p)}}const G=N.selectAll(".venn-area").data(d,I=>I.sets),L=G.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),B=L.append("path"),P=L.append("text").attr("class","label").text(I=>V(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),P.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function K(I){return typeof I.transition=="function"?I.transition("venn").duration(o):I}let z=y;T&&typeof z.transition=="function"?(z=K(y),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",I=>kt(I.sets.map(j=>v[j])),p);const O=z.selectAll("text").filter(I=>I.sets in C).text(I=>V(I)).attr("x",I=>Math.floor(C[I.sets].x)).attr("y",I=>Math.floor(C[I.sets].y));u&&(T?"on"in O?O.on("end",ot(v,V)):O.each("end",ot(v,V)):O.each(ot(v,V)));const F=K(G.exit()).remove();typeof G.transition=="function"&&F.selectAll("path").attrTween("d",A);const X=F.selectAll("text").attr("x",s/2).attr("y",e/2);return x!==null&&(P.style("font-size","0px"),O.style("font-size",x),X.style("font-size","0px")),{circles:v,textCentres:C,nodes:G,enter:L,update:z,exit:F}}return c.wrap=function(y){return arguments.length?(u=y,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(y){return arguments.length?(s=y,c):s},c.height=function(y){return arguments.length?(e=y,c):e},c.padding=function(y){return arguments.length?(i=y,c):i},c.distinct=function(y){return arguments.length?(b=y,c):b},c.colours=function(y){return arguments.length?(g=y,c):g},c.colors=function(y){return arguments.length?(g=y,c):g},c.fontSize=function(y){return arguments.length?(x=y,c):x},c.round=function(y){return arguments.length?(p=y,c):p},c.duration=function(y){return arguments.length?(o=y,c):o},c.layoutFunction=function(y){return arguments.length?(m=y,c):m},c.normalize=function(y){return arguments.length?(l=y,c):l},c.scaleToFit=function(y){return arguments.length?(f=y,c):f},c.styled=function(y){return arguments.length?(a=y,c):a},c.orientation=function(y){return arguments.length?(r=y,c):r},c.orientationOrder=function(y){return arguments.length?(h=y,c):h},c.lossFunction=function(y){return arguments.length?(_=y==="default"?tt:y==="logRatio"?At:y,c):_},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],x=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),x++)}const E=.35-x*h/2,w=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",w),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function rt(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function Nt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=rt(e[0],t,n);for(let a=1;a<e.length;++a){const x=rt(e[a],t,n);x>=o&&(i=e[a],o=x)}const r=Tt(a=>-1*rt({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Nt(t,[]):wt(u.arcs.map(a=>a.p1))}function se(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function jt(t,n,s){const e={},i=se(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const x=Nt(u,a,s);e[r]=x,x.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ie(t,n,s){const e=[];return e.push(`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./extractHeadings-BMNm4Zss.cjs"),vt=(t,n)=>k.adjustChannel(t,"a",-n),Mt=1e-10;function st(t,n){const s=Gt(t),e=s.filter(l=>Ut(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=wt(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let f=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];o+=(f.x+a.x)*(a.y-f.y);const x={x:(a.x+f.x)/2,y:(a.y+f.y)/2};let h=null;for(let b=0;b<a.parentIndex.length;++b)if(f.parentIndex.includes(a.parentIndex[b])){const p=t[a.parentIndex[b]],M=Math.atan2(a.x-p.x,a.y-p.y),E=Math.atan2(f.x-p.x,f.y-p.y);let w=E-M;w<0&&(w+=2*Math.PI);const S=E-w/2;let g=q(x,{x:p.x+p.radius*Math.sin(S),y:p.y+p.radius*Math.cos(S)});g>p.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=at(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let f=!1;for(let u=0;u<t.length;++u)if(q(t[u],l)>Math.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-Mt,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function Ut(t,n){return n.every(s=>q(t,s)<s.radius+Mt)}function Gt(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=St(t[s],t[e]);for(const o of i)o.parentIndex=[s,e],n.push(o)}return n}function at(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function gt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return at(t,e)+at(n,i)}function St(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function wt(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function Wt(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u<i;++u){f/=2;const a=n+f,x=t(a);if(x*r>=0&&(n=a),Math.abs(f)<o||x===0)return a}return n+f}function lt(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function It(t,n){return lt(t).map(()=>lt(n))}function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ct(t){return Math.sqrt($(t,t))}function ut(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function J(t,n,s,e,i){for(let o=0;o<t.length;++o)t[o]=n*s[o]+e*i[o]}function Tt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,o=s.zeroDelta||.001,r=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,f=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,x=s.sigma!==void 0?s.sigma:.5;let h;const b=n.length,p=new Array(b+1);p[0]=n,p[0].fx=t(n),p[0].id=0;for(let _=0;_<b;++_){const c=n.slice();c[_]=c[_]?c[_]*i:o,p[_+1]=c,p[_+1].fx=t(c),p[_+1].id=_+1}function M(_){for(let c=0;c<_.length;c++)p[b][c]=_[c];p[b].fx=_.fx}const E=(_,c)=>_.fx-c.fx,w=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let _=0;_<e;++_){if(p.sort(E),s.history){const y=p.map(d=>{const R=d.slice();return R.fx=d.fx,R.id=d.id,R});y.sort((d,R)=>d.id-R.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:y})}h=0;for(let y=0;y<b;++y)h=Math.max(h,Math.abs(p[0][y]-p[1][y]));if(Math.abs(p[0].fx-p[b].fx)<r&&h<l)break;for(let y=0;y<b;++y){w[y]=0;for(let d=0;d<b;++d)w[y]+=p[d][y];w[y]/=b}const c=p[b];if(J(S,1+f,w,-f,c),S.fx=t(S),S.fx<p[0].fx)J(m,1+u,w,-u,c),m.fx=t(m),m.fx<S.fx?M(m):M(S);else if(S.fx>=p[b-1].fx){let y=!1;if(S.fx>c.fx?(J(g,1+a,w,-a,c),g.fx=t(g),g.fx<c.fx?M(g):y=!0):(J(g,1-a*f,w,a*f,c),g.fx=t(g),g.fx<S.fx?M(g):y=!0),y){if(x>=1)break;for(let d=1;d<p.length;++d)J(p[d],1-x,p[0],x,p[d]),p[d].fx=t(p[d])}}else M(S)}return p.sort(E),{fx:p[0].fx,x:p[0]}}function Kt(t,n,s,e,i,o,r){const l=s.fx,f=$(s.fxprime,n);let u=l,a=l,x=f,h=0;i=i||1,o=o||1e-6,r=r||.1;function b(p,M,E){for(let w=0;w<16;++w)if(i=(p+M)/2,J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||u>=E)M=i;else{if(Math.abs(x)<=-r*f)return i;x*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),x=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(x)<=-r*f)return i;if(x>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function Ht(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ut(r,e.fxprime,-1);for(let a=0;a<u;++a){if(f=Kt(t,r,e,i,f),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),!f)ut(r,e.fxprime,-1);else{J(o,1,i.fxprime,-1,e.fxprime);const x=$(e.fxprime,e.fxprime),h=Math.max(0,$(o,i.fxprime)/x);J(r,h,r,-1,i.fxprime),l=e,e=i,i=l}if(ct(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:f}),e}function Et(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||Jt,e=n.lossFunction||tt,i=Yt(t,n),o=s(i,n),r=Object.keys(o),l=[];for(const a of r)l.push(o[a].x),l.push(o[a].y);const u=Tt(a=>{const x={};for(let h=0;h<r.length;++h){const b=r[h];x[b]={x:a[2*h],y:a[2*h+1],radius:o[b].radius}}return e(x,i)},l,n).x;for(let a=0;a<r.length;++a){const x=r[a];o[x].x=u[2*a],o[x].y=u[2*a+1]}return o}const zt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+zt?Math.abs(t-n):Wt(e=>gt(t,n,e)-s,0,t+n)}function Yt(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;u<f.sets.length;u++){const a=String(f.sets[u]);l.set(a,f.size+(l.get(a)||0));for(let x=u+1;x<f.sets.length;x++){const h=String(f.sets[x]),b=`${a};${h}`,p=`${h};${a}`;l.set(b,f.size+(l.get(b)||0)),l.set(p,f.size+(l.get(p)||0))}}for(const f of e)f.sets.length<3&&(f.size=l.get(i(f.sets)))}const o=[],r=new Set;for(const l of e)if(l.sets.length===1)o.push(l.sets[0]);else if(l.sets.length===2){const f=l.sets[0],u=l.sets[1];r.add(i(l.sets)),r.add(i([u,f]))}o.sort((l,f)=>l===f?0:l<f?-1:1);for(let l=0;l<o.length;++l){const f=o[l];for(let u=l+1;u<o.length;++u){const a=o[u];r.has(i([f,a]))||e.push({sets:[f,a],size:0})}}return e}function Xt(t,n,s){const e=It(n.length,n.length),i=It(n.length,n.length);return t.filter(o=>o.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(f,u,o.size);e[r][l]=e[l][r]=a;let x=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?x=1:o.size<=1e-10&&(x=-1),i[r][l]=i[l][r]=x}),{distances:e,constraints:i}}function Zt(t,n,s,e){for(let o=0;o<n.length;++o)n[o]=0;let i=0;for(let o=0;o<s.length;++o){const r=t[2*o],l=t[2*o+1];for(let f=o+1;f<s.length;++f){const u=t[2*f],a=t[2*f+1],x=s[o][f],h=e[o][f],b=(u-r)*(u-r)+(a-l)*(a-l),p=Math.sqrt(b),M=b-x*x;h>0&&p<=x||h<0&&p>=x||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function Jt(t,n={}){let s=$t(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=Qt(t,n),o=e(i,t),r=e(s,t);o+1e-8<r&&(s=i)}return s}function Qt(t,n={}){const s=n.restarts||10,e=[],i={};for(const h of t)h.sets.length===1&&(i[h.sets[0]]=e.length,e.push(h));let{distances:o,constraints:r}=Xt(t,e,i);const l=ct(o.map(ct))/o.length;o=o.map(h=>h.map(b=>b/l));const f=(h,b)=>Zt(h,b,o,r);let u=null;for(let h=0;h<s;++h){const b=lt(o.length*2).map(Math.random),p=Ht(f,b,n);(!u||p.fx<u.fx)&&(u=p)}const a=u.x,x={};for(let h=0;h<e.length;++h){const b=e[h];x[b.sets[0]]={x:a[2*h]*l,y:a[2*h+1]*l,radius:Math.sqrt(b.size/Math.PI)}}if(n.history)for(const h of n.history)ut(h.x,l);return x}function $t(t,n){const s=n&&n.lossFunction?n.lossFunction:tt,e={},i={};for(const x of t)if(x.sets.length===1){const h=x.sets[0];e[h]={x:1e10,y:1e10,rowid:e.length,size:x.size,radius:Math.sqrt(x.size/Math.PI)},i[h]=[]}t=t.filter(x=>x.sets.length===2);for(const x of t){let h=x.weight!=null?x.weight:1;const b=x.sets[0],p=x.sets[1];x.size+zt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:x.size,weight:h}),i[p].push({set:b,size:x.size,weight:h})}const o=[];Object.keys(i).forEach(x=>{let h=0;for(let b=0;b<i[x].length;++b)h+=i[x][b].size*i[x][b].weight;o.push({set:x,size:h})});function r(x,h){return h.size-x.size}o.sort(r);const l={};function f(x){return x.set in l}function u(x,h){e[h].x=x.x,e[h].y=x.y,l[h]=!0}u({x:0,y:0},o[0].set);for(let x=1;x<o.length;++x){const h=o[x].set,b=i[h].filter(f),p=e[h];if(b.sort(r),b.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<b.length;++a){const S=e[b[a].set],g=ft(p.radius,S.radius,b[a].size);M.push({x:S.x+g,y:S.y}),M.push({x:S.x-g,y:S.y}),M.push({y:S.y+g,x:S.x}),M.push({y:S.y-g,x:S.x});for(let m=a+1;m<b.length;++m){const _=e[b[m].set],c=ft(p.radius,_.radius,b[m].size),y=St({x:S.x,y:S.y,radius:g},{x:_.x,y:_.y,radius:c});M.push(...y)}}let E=1e50,w=M[0];for(const S of M){e[h].x=S.x,e[h].y=S.y;const g=s(e,t);g<E&&(E=g,w=S)}u(w,h)}return e}function tt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const r=t[e.sets[0]],l=t[e.sets[1]];i=gt(r.radius,l.radius,q(r,l))}else i=st(e.sets.map(r=>t[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function At(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=gt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function te(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function ee(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i<t.length;++i)for(let o=i+1;o<t.length;++o){const r=t[i].radius+t[o].radius;q(t[i],t[o])+1e-10<r&&s(t[o],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const o=n(t[i]).parent.setid;e.has(o)||e.set(o,[]),e.get(o).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function ht(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Dt(t,n,s){n==null&&(n=Math.PI/2);let e=Ot(t).map(u=>Object.assign({},u));const i=ee(e);for(const u of i){te(u,n,s);const a=ht(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,x){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(x)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f<i.length;)l(i[f],!0,!1),l(i[f+1],!1,!0),l(i[f+2],!0,!0),f+=3,o=ht(e);return Ct(e)}function Rt(t,n,s,e,i){const o=Ot(t);n-=2*e,s-=2*e;const{xRange:r,yRange:l}=ht(o);if(r.max===r.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let f,u;if(i){const b=Math.sqrt(i/Math.PI)*2;f=n/b,u=s/b}else f=n/(r.max-r.min),u=s/(l.max-l.min);const a=Math.min(u,f),x=(n-(r.max-r.min)*a)/2,h=(s-(l.max-l.min)*a)/2;return Ct(o.map(b=>({radius:a*b.radius,x:e+x+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ct(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ot(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ne(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,x=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},w=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(y){if(y in E)return E[y];var d=E[y]=w[S];return S+=1,S>=w.length&&(S=0),d},m=Et,_=tt;function c(y){let d=y.datum();const R=new Set;d.forEach(I=>{I.size==0&&I.sets.length==1&&R.add(I.sets[0])}),d=d.filter(I=>!I.sets.some(j=>R.has(j)));let v={},C={};if(d.length>0){let I=m(d,{lossFunction:_,distinct:b});l&&(I=Dt(I,r,h)),v=Rt(I,s,e,i,f),C=jt(v,d,M)}const U={};d.forEach(I=>{I.label&&(U[I.sets]=I.label)});function V(I){if(I.sets in U)return U[I.sets];if(I.sets.length==1)return""+I.sets[0]}y.selectAll("svg").data([v]).enter().append("svg");const N=y.select("svg");n?N.attr("viewBox",`0 0 ${s} ${e}`):N.attr("width",s).attr("height",e);const D={};let T=!1;N.selectAll(".venn-area path").each(function(I){const j=this.getAttribute("d");I.sets.length==1&&j&&!b&&(T=!0,D[I.sets[0]]=oe(j))});function A(I){return j=>{const H=I.sets.map(et=>{let Y=D[et],Z=v[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-j)+Z.x*j,y:Y.y*(1-j)+Z.y*j,radius:Y.radius*(1-j)+Z.radius*j}});return kt(H,p)}}const G=N.selectAll(".venn-area").data(d,I=>I.sets),L=G.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),B=L.append("path"),P=L.append("text").attr("class","label").text(I=>V(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),P.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function K(I){return typeof I.transition=="function"?I.transition("venn").duration(o):I}let z=y;T&&typeof z.transition=="function"?(z=K(y),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",I=>kt(I.sets.map(j=>v[j])),p);const O=z.selectAll("text").filter(I=>I.sets in C).text(I=>V(I)).attr("x",I=>Math.floor(C[I.sets].x)).attr("y",I=>Math.floor(C[I.sets].y));u&&(T?"on"in O?O.on("end",ot(v,V)):O.each("end",ot(v,V)):O.each(ot(v,V)));const F=K(G.exit()).remove();typeof G.transition=="function"&&F.selectAll("path").attrTween("d",A);const X=F.selectAll("text").attr("x",s/2).attr("y",e/2);return x!==null&&(P.style("font-size","0px"),O.style("font-size",x),X.style("font-size","0px")),{circles:v,textCentres:C,nodes:G,enter:L,update:z,exit:F}}return c.wrap=function(y){return arguments.length?(u=y,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(y){return arguments.length?(s=y,c):s},c.height=function(y){return arguments.length?(e=y,c):e},c.padding=function(y){return arguments.length?(i=y,c):i},c.distinct=function(y){return arguments.length?(b=y,c):b},c.colours=function(y){return arguments.length?(g=y,c):g},c.colors=function(y){return arguments.length?(g=y,c):g},c.fontSize=function(y){return arguments.length?(x=y,c):x},c.round=function(y){return arguments.length?(p=y,c):p},c.duration=function(y){return arguments.length?(o=y,c):o},c.layoutFunction=function(y){return arguments.length?(m=y,c):m},c.normalize=function(y){return arguments.length?(l=y,c):l},c.scaleToFit=function(y){return arguments.length?(f=y,c):f},c.styled=function(y){return arguments.length?(a=y,c):a},c.orientation=function(y){return arguments.length?(r=y,c):r},c.orientationOrder=function(y){return arguments.length?(h=y,c):h},c.lossFunction=function(y){return arguments.length?(_=y==="default"?tt:y==="logRatio"?At:y,c):_},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],x=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),x++)}const E=.35-x*h/2,w=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",w),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function rt(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i<n.length;++i){const o=n[i].radius-q(n[i],t);o<=e&&(e=o)}for(let i=0;i<s.length;++i){const o=q(s[i],t)-s[i].radius;o<=e&&(e=o)}return e}function Nt(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],o=rt(e[0],t,n);for(let a=1;a<e.length;++a){const x=rt(e[a],t,n);x>=o&&(i=e[a],o=x)}const r=Tt(a=>-1*rt({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)<a.radius){f=!1;break}if(f)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Nt(t,[]):wt(u.arcs.map(a=>a.p1))}function se(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],o=t[i];for(let r=e+1;r<s.length;++r){const l=s[r],f=t[l],u=q(o,f);u+f.radius<=o.radius+1e-10?n[l].push(i):u+o.radius<=f.radius+1e-10&&n[i].push(l)}}return n}function jt(t,n,s){const e={},i=se(t);for(let o=0;o<n.length;++o){const r=n[o].sets,l={},f={};for(let h=0;h<r.length;++h){l[r[h]]=!0;const b=i[r[h]];for(let p=0;p<b.length;++p)f[b[p]]=!0}const u=[],a=[];for(let h in t)h in l?u.push(t[h]):h in f||a.push(t[h]);const x=Nt(u,a,s);e[r]=x,x.disjoint&&n[o].size>0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ie(t,n,s){const e=[];return e.push(`
|
|
2
2
|
M`,t,n),e.push(`
|
|
3
3
|
m`,-s,0),e.push(`
|
|
4
4
|
a`,s,s,0,1,0,s*2,0),e.push(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Pt=require("./chunk-JWPE2WC7-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Pt=require("./chunk-JWPE2WC7-Bqw3GN0H.cjs"),f=require("./extractHeadings-BMNm4Zss.cjs"),Ct=require("./cynefin-VYW2F7L2-MpAliYy9.cjs");var D=f.__name((o,r)=>{const e=o<=1?o*100:o;if(e<0||e>100)throw new Error(`${r} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${o}`);return e},"toPercent"),L=f.__name((o,r,e)=>({x:D(r,`${e} evolution`),y:D(o,`${e} visibility`)}),"toCoordinates"),J=f.__name(o=>{if(o){if(o==="+<>")return"bidirectional";if(o==="+<")return"backward";if(o==="+>")return"forward"}},"getFlowFromPort"),St=f.__name(o=>{if(!o?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(o)?.[1];return o.includes("<>")?{flow:"bidirectional",label:e}:o.includes("<")?{flow:"backward",label:e}:o.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Mt=f.__name((o,r)=>{if(Pt.populateCommonDb(o,r),o.size&&r.setSize(o.size.width,o.size.height),o.evolution){const e=o.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),g=o.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);r.updateAxes({stages:e,stageBoundaries:g})}if(o.anchors.forEach(e=>{const g=L(e.visibility,e.evolution,`Anchor "${e.name}"`);r.addNode(e.name,e.name,g.x,g.y,"anchor")}),o.components.forEach(e=>{const g=L(e.visibility,e.evolution,`Component "${e.name}"`),a=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=e.decorator?.strategy;r.addNode(e.name,e.name,g.x,g.y,"component",a,d,e.inertia,m)}),o.notes.forEach(e=>{const g=L(e.visibility,e.evolution,`Note "${e.text}"`);r.addNote(e.text,g.x,g.y)}),o.pipelines.forEach(e=>{const g=r.getNode(e.parent);if(!g||typeof g.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const a=g.y;r.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,y=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,B=D(d.evolution,`Pipeline component "${d.name}" evolution`);r.addNode(m,d.name,B,a,"pipeline-component",C,y),r.addPipelineComponent(e.parent,m)})}),o.links.forEach(e=>{const g=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let a=J(e.fromPort)??J(e.toPort);const{flow:d,label:m}=St(e.arrow);!a&&d&&(a=d);const C=e.linkLabel,y=m??C;r.addLink(r.resolveNodeId(e.from),r.resolveNodeId(e.to),g,y,a)}),o.evolves.forEach(e=>{const g=r.getNode(e.component);if(g?.y!==void 0){const a=D(e.target,`Evolve target for "${e.component}"`);r.addTrend(e.component,a,g.y)}}),o.annotations.length>0){const e=o.annotations[0],g=L(e.x,e.y,"Annotations box");r.setAnnotationsBox(g.x,g.y)}o.annotation.forEach(e=>{const g=L(e.x,e.y,`Annotation ${e.number}`);r.addAnnotation(e.number,[{x:g.x,y:g.y}],e.text)}),o.accelerators.forEach(e=>{const g=L(e.x,e.y,`Accelerator "${e.name}"`);r.addAccelerator(e.name,g.x,g.y)}),o.deaccelerators.forEach(e=>{const g=L(e.x,e.y,`Deaccelerator "${e.name}"`);r.addDeaccelerator(e.name,g.x,g.y)})},"populateDb"),U={parser:{yy:void 0},parse:f.__name(async o=>{const r=await Ct.parse("wardley",o);f.log.debug(r);const e=U.parser?.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Mt(r,e)},"parse")},X,_t=(X=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={}}addNode(r){const e=this.nodes.get(r.id)??{id:r.id,label:r.label},g={...e,...r,className:r.className??e.className,labelOffsetX:r.labelOffsetX??e.labelOffsetX,labelOffsetY:r.labelOffsetY??e.labelOffsetY};this.nodes.set(r.id,g)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});const e=this.nodes.get(r);e&&(e.isPipelineParent=!0)}addPipelineComponent(r,e){const g=this.pipelines.get(r);g&&g.componentIds.push(e);const a=this.nodes.get(e);a&&(a.inPipeline=!0)}addAnnotation(r){this.annotations.push(r)}addNote(r){this.notes.push(r)}addAccelerator(r){this.accelerators.push(r)}addDeaccelerator(r){this.deaccelerators.push(r)}setAnnotationsBox(r,e){this.annotationsBox={x:r,y:e}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,e){this.size={width:r,height:e}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(const[e,g]of this.nodes)if(g.label===r)return e;return r}build(){const r=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);r.push(e)}return{nodes:r,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}},f.__name(X,"WardleyBuilder"),X),k=new _t;function K(){return f.getConfig2()["wardley-beta"]}f.__name(K,"getConfig");function Q(o,r,e,g,a,d,m,C,y){k.addNode({id:o,label:r,x:e,y:g,className:a,labelOffsetX:d,labelOffsetY:m,inertia:C,sourceStrategy:y})}f.__name(Q,"addNode");function tt(o,r,e=!1,g,a){k.addLink({source:o,target:r,dashed:e,label:g,flow:a})}f.__name(tt,"addLink");function et(o,r,e){k.addTrend({nodeId:o,targetX:r,targetY:e})}f.__name(et,"addTrend");function at(o,r,e){k.addAnnotation({number:o,coordinates:r,text:e})}f.__name(at,"addAnnotation");function rt(o,r,e){k.addNote({text:o,x:r,y:e})}f.__name(rt,"addNote");function ot(o,r,e){k.addAccelerator({name:o,x:r,y:e})}f.__name(ot,"addAccelerator");function nt(o,r,e){k.addDeaccelerator({name:o,x:r,y:e})}f.__name(nt,"addDeaccelerator");function st(o,r){k.setAnnotationsBox(o,r)}f.__name(st,"setAnnotationsBox");function it(o,r){k.setSize(o,r)}f.__name(it,"setSize");function dt(o){k.startPipeline(o)}f.__name(dt,"startPipeline");function lt(o,r){k.addPipelineComponent(o,r)}f.__name(lt,"addPipelineComponent");function ct(o){k.setAxes(o)}f.__name(ct,"updateAxes");function pt(o){return k.getNode(o)}f.__name(pt,"getNode");function ft(o){return k.resolveNodeId(o)}f.__name(ft,"resolveNodeId");function ht(){return k.build()}f.__name(ht,"getWardleyData");function gt(){k.clear(),f.clear()}f.__name(gt,"clear");var Nt={getConfig:K,addNode:Q,addLink:tt,addTrend:et,addAnnotation:at,addNote:rt,addAccelerator:ot,addDeaccelerator:nt,setAnnotationsBox:st,setSize:it,startPipeline:dt,addPipelineComponent:lt,updateAxes:ct,getNode:pt,resolveNodeId:ft,getWardleyData:ht,clear:gt,setAccTitle:f.setAccTitle,getAccTitle:f.getAccTitle,setDiagramTitle:f.setDiagramTitle,getDiagramTitle:f.getDiagramTitle,getAccDescription:f.getAccDescription,setAccDescription:f.setAccDescription},Tt=["Genesis","Custom Built","Product","Commodity"],At=f.__name(()=>{const{themeVariables:o}=f.getConfig2();return{backgroundColor:o.wardley?.backgroundColor??o.background??"#fff",axisColor:o.wardley?.axisColor??"#000",axisTextColor:o.wardley?.axisTextColor??o.primaryTextColor??"#222",gridColor:o.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:o.wardley?.componentFill??"#fff",componentStroke:o.wardley?.componentStroke??"#000",componentLabelColor:o.wardley?.componentLabelColor??o.primaryTextColor??"#222",linkStroke:o.wardley?.linkStroke??"#000",evolutionStroke:o.wardley?.evolutionStroke??"#dc3545",annotationStroke:o.wardley?.annotationStroke??"#000",annotationTextColor:o.wardley?.annotationTextColor??o.primaryTextColor??"#222",annotationFill:o.wardley?.annotationFill??o.background??"#fff"}},"getTheme"),Lt=f.__name(()=>{const o=f.getConfig2()["wardley-beta"];return{width:o?.width??900,height:o?.height??600,padding:o?.padding??48,nodeRadius:o?.nodeRadius??6,nodeLabelOffset:o?.nodeLabelOffset??8,axisFontSize:o?.axisFontSize??12,labelFontSize:o?.labelFontSize??10,showGrid:o?.showGrid??!1,useMaxWidth:o?.useMaxWidth??!0}},"getConfigValues"),zt=f.__name((o,r,e,g)=>{f.log.debug(`Rendering Wardley map
|
|
2
2
|
`+o);const a=Lt(),d=At(),m=a.nodeRadius*1.6,C=g.db,y=C.getWardleyData(),B=C.getDiagramTitle(),S=y.size?.width??a.width,b=y.size?.height??a.height,E=f.selectSvgElement(r);E.selectAll("*").remove(),f.configureSvgSize(E,b,S,a.useMaxWidth),E.attr("viewBox",`0 0 ${S} ${b}`);const v=E.append("g").attr("class","wardley-map"),G=E.append("defs");G.append("marker").attr("id",`arrow-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-end-${r}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-start-${r}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);const Y=S-a.padding*2,I=b-a.padding*2;B&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(B);const N=f.__name(t=>a.padding+t/100*Y,"projectX"),T=f.__name(t=>b-a.padding-t/100*I,"projectY"),O=v.append("g").attr("class","wardley-axes");O.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const xt=y.axes.xLabel??"Evolution",yt=y.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+Y/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(xt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+I/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+I/2})`).text(yt);const F=y.axes.stages&&y.axes.stages.length>0?y.axes.stages:Tt;if(F.length>0){const t=v.append("g").attr("class","wardley-stages"),s=y.axes.stageBoundaries,n=[];if(s&&s.length===F.length){let i=0;s.forEach(p=>{n.push({start:i,end:p}),i=p})}else{const i=1/F.length;F.forEach((p,l)=>{n.push({start:l*i,end:(l+1)*i})})}F.forEach((i,p)=>{const l=n[p],h=a.padding+l.start*Y,x=a.padding+l.end*Y,u=(h+x)/2;p>0&&t.append("line").attr("x1",h).attr("x2",h).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){const t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const n=s/4,i=a.padding+Y*n;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-I*n).attr("y2",b-a.padding-I*n).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(y.nodes.forEach(t=>{c.set(t.id,{x:N(t.x),y:T(t.y),node:t})}),y.pipelines.length>0){const t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");y.pipelines.forEach(n=>{if(n.componentIds.length===0)return;const i=n.componentIds.map(x=>({id:x,pos:c.get(x),node:y.nodes.find(u=>u.id===x)})).filter(x=>x.pos&&x.node).sort((x,u)=>x.node.x-u.node.x);for(let x=0;x<i.length-1;x++){const u=i[x],w=i[x+1];s.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",u.pos.x).attr("y1",u.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let p=1/0,l=-1/0,h=0;if(n.componentIds.forEach(x=>{const u=c.get(x);u&&(p=Math.min(p,u.x),l=Math.max(l,u.x),h=u.y)}),p!==1/0&&l!==-1/0){const u=a.nodeRadius*4,w=h-u/2,P=c.get(n.nodeId);if(P){const _=(p+l)/2;P.x=_,P.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",w).attr("width",l-p+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const j=v.append("g").attr("class","wardley-links"),V=new Map;y.pipelines.forEach(t=>{V.set(t.nodeId,new Set(t.componentIds))});const Z=y.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||V.get(t.target)?.has(t.source)));j.selectAll("line").data(Z).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),n=c.get(t.target),p=y.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,h=n.y-s.y,x=Math.sqrt(l*l+h*h);return s.x+l/x*p}).attr("y1",t=>{const s=c.get(t.source),n=c.get(t.target),p=y.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=n.x-s.x,h=n.y-s.y,x=Math.sqrt(l*l+h*h);return s.y+h/x*p}).attr("x2",t=>{const s=c.get(t.source),n=c.get(t.target),p=y.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,h=s.y-n.y,x=Math.sqrt(l*l+h*h);return n.x+l/x*p}).attr("y2",t=>{const s=c.get(t.source),n=c.get(t.target),p=y.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):a.nodeRadius,l=s.x-n.x,h=s.y-n.y,x=Math.sqrt(l*l+h*h);return n.y+h/x*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${r})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${r})`:null),j.selectAll("text").data(Z.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=n.y-s.y,l=n.x-s.x,h=Math.sqrt(l*l+p*p),x=8,u=p/h;return i+u*x}).attr("y",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.y+n.y)/2,p=n.x-s.x,l=n.y-s.y,h=Math.sqrt(p*p+l*l),x=8,u=-p/h;return i+u*x}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),n=c.get(t.target),i=(s.x+n.x)/2,p=(s.y+n.y)/2,l=n.x-s.x,h=n.y-s.y,x=Math.sqrt(l*l+h*h),u=8,w=h/x,P=-l/x,_=i+w*u,R=p+P*u;let z=Math.atan2(h,l)*180/Math.PI;return(z>90||z<-90)&&(z+=180),`rotate(${z} ${_} ${R})`}).text(t=>t.label);const ut=v.append("g").attr("class","wardley-trends"),mt=y.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const n=N(t.targetX),i=T(t.targetY),p=n-s.x,l=i-s.y,h=Math.sqrt(p*p+l*l),x=a.nodeRadius+2,u=h>x?n-p/h*x:n,w=h>x?i-l/h*x:i;return{origin:s,targetX:n,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);ut.selectAll("line").data(mt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${r})`);const M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(y.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const A=M.filter(t=>t.sourceStrategy==="market");A.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const q=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(A.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),A.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),A.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),A.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),A.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),A.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let n=t.isPipelineParent?m/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y1",t=>{const s=c.get(t.id),n=t.isPipelineParent?m:a.nodeRadius*2;return s.y-n/2}).attr("x2",t=>{const s=c.get(t.id);let n=t.isPipelineParent?m/2+15:a.nodeRadius+15;return t.sourceStrategy&&(n+=a.nodeRadius+10),s.x+n}).attr("y2",t=>{const s=c.get(t.id),n=t.isPipelineParent?m:a.nodeRadius*2;return s.y+n/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let n=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(n+=10);const i=t.labelOffsetX??n;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let n=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(n-=10);const i=t.labelOffsetY??n;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),y.annotations.length>0){const t=v.append("g").attr("class","wardley-annotations");if(y.annotations.forEach(s=>{const n=s.coordinates.map(i=>({x:N(i.x),y:T(i.y)}));if(n.length>1)for(let i=0;i<n.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",n[i].x).attr("y1",n[i].y).attr("x2",n[i+1].x).attr("y2",n[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");n.forEach(i=>{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),y.annotationsBox){let s=N(y.annotationsBox.x),n=T(y.annotationsBox.y);const i=10,p=16,l=11,h=t.append("g").attr("class","wardley-annotations-box"),x=[...y.annotations].filter(w=>w.text).sort((w,P)=>w.number-P.number),u=[];if(x.forEach((w,P)=>{const _=h.append("text").attr("x",s+i).attr("y",n+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(_)}),u.length>0){let w=0,P=0;u.forEach(H=>{const W=H.node(),$t=W.getComputedTextLength();w=Math.max(w,$t);const vt=W.getBBox();P=Math.max(P,vt.height)});const _=w+i*2+105,R=x.length*p+i*2+P/2,z=a.padding,wt=S-a.padding-_,kt=a.padding,bt=b-a.padding-R;s=Math.max(z,Math.min(s,wt)),n=Math.max(kt,Math.min(n,bt)),u.forEach((H,W)=>{H.attr("x",s+i).attr("y",n+i+(W+1)*p)}),h.insert("rect","text").attr("x",s).attr("y",n).attr("width",_).attr("height",R).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(y.notes.length>0){const t=v.append("g").attr("class","wardley-notes");y.notes.forEach(s=>{const n=N(s.x),i=T(s.y);t.append("text").attr("x",n).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(y.accelerators.length>0){const t=v.append("g").attr("class","wardley-accelerators");y.accelerators.forEach(s=>{const n=N(s.x),i=T(s.y),p=60,l=30,h=20,x=`
|
|
3
3
|
M ${n} ${i-l/2}
|
|
4
4
|
L ${n+p-h} ${i-l/2}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { p as Mt } from "./chunk-JWPE2WC7-
|
|
2
|
-
import {
|
|
3
|
-
import { p as
|
|
1
|
+
import { p as Mt } from "./chunk-JWPE2WC7-COh8RdRz.js";
|
|
2
|
+
import { G as Nt, J as zt, a9 as Lt, a8 as Tt, K as At, O as Xt, _ as u, ao as Et, ai as Yt, ak as J, U as Q, an as It, V as Bt, ae as Ft, Q as V } from "./extractHeadings-OhPxZ04C.js";
|
|
3
|
+
import { p as Ot } from "./cynefin-VYW2F7L2-Bkk-F_Js.js";
|
|
4
4
|
var G = /* @__PURE__ */ u((o, r) => {
|
|
5
5
|
const e = o <= 1 ? o * 100 : o;
|
|
6
6
|
if (e < 0 || e > 100)
|
|
@@ -20,21 +20,21 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
20
20
|
if (o === "+>")
|
|
21
21
|
return "forward";
|
|
22
22
|
}
|
|
23
|
-
}, "getFlowFromPort"),
|
|
23
|
+
}, "getFlowFromPort"), Rt = /* @__PURE__ */ u((o) => {
|
|
24
24
|
if (!o?.startsWith("+"))
|
|
25
25
|
return {};
|
|
26
26
|
const e = /^\+'([^']*)'/.exec(o)?.[1];
|
|
27
27
|
return o.includes("<>") ? { flow: "bidirectional", label: e } : o.includes("<") ? { flow: "backward", label: e } : o.includes(">") ? { flow: "forward", label: e } : { label: e };
|
|
28
28
|
}, "extractFlowFromArrow"), Wt = /* @__PURE__ */ u((o, r) => {
|
|
29
29
|
if (Mt(o, r), o.size && r.setSize(o.size.width, o.size.height), o.evolution) {
|
|
30
|
-
const e = o.evolution.stages.map((a) => a.secondName ? `${a.name.trim()} / ${a.secondName.trim()}` : a.name.trim()),
|
|
31
|
-
r.updateAxes({ stages: e, stageBoundaries:
|
|
30
|
+
const e = o.evolution.stages.map((a) => a.secondName ? `${a.name.trim()} / ${a.secondName.trim()}` : a.name.trim()), h = o.evolution.stages.filter((a) => a.boundary !== void 0).map((a) => a.boundary);
|
|
31
|
+
r.updateAxes({ stages: e, stageBoundaries: h });
|
|
32
32
|
}
|
|
33
33
|
if (o.anchors.forEach((e) => {
|
|
34
|
-
const
|
|
35
|
-
r.addNode(e.name, e.name,
|
|
34
|
+
const h = A(e.visibility, e.evolution, `Anchor "${e.name}"`);
|
|
35
|
+
r.addNode(e.name, e.name, h.x, h.y, "anchor");
|
|
36
36
|
}), o.components.forEach((e) => {
|
|
37
|
-
const
|
|
37
|
+
const h = A(
|
|
38
38
|
e.visibility,
|
|
39
39
|
e.evolution,
|
|
40
40
|
`Component "${e.name}"`
|
|
@@ -42,8 +42,8 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
42
42
|
r.addNode(
|
|
43
43
|
e.name,
|
|
44
44
|
e.name,
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
h.x,
|
|
46
|
+
h.y,
|
|
47
47
|
"component",
|
|
48
48
|
a,
|
|
49
49
|
d,
|
|
@@ -51,21 +51,21 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
51
51
|
w
|
|
52
52
|
);
|
|
53
53
|
}), o.notes.forEach((e) => {
|
|
54
|
-
const
|
|
55
|
-
r.addNote(e.text,
|
|
54
|
+
const h = A(e.visibility, e.evolution, `Note "${e.text}"`);
|
|
55
|
+
r.addNote(e.text, h.x, h.y);
|
|
56
56
|
}), o.pipelines.forEach((e) => {
|
|
57
|
-
const
|
|
58
|
-
if (!
|
|
57
|
+
const h = r.getNode(e.parent);
|
|
58
|
+
if (!h || typeof h.y != "number")
|
|
59
59
|
throw new Error(
|
|
60
60
|
`Pipeline "${e.parent}" must reference an existing component with coordinates.`
|
|
61
61
|
);
|
|
62
|
-
const a =
|
|
62
|
+
const a = h.y;
|
|
63
63
|
r.startPipeline(e.parent), e.components.forEach((d) => {
|
|
64
|
-
const w = `${e.parent}_${d.name}`, C = d.label ? (d.label.negX ? -1 : 1) * d.label.offsetX : void 0, g = d.label ? (d.label.negY ? -1 : 1) * d.label.offsetY : void 0,
|
|
64
|
+
const w = `${e.parent}_${d.name}`, C = d.label ? (d.label.negX ? -1 : 1) * d.label.offsetX : void 0, g = d.label ? (d.label.negY ? -1 : 1) * d.label.offsetY : void 0, O = G(d.evolution, `Pipeline component "${d.name}" evolution`);
|
|
65
65
|
r.addNode(
|
|
66
66
|
w,
|
|
67
67
|
d.name,
|
|
68
|
-
|
|
68
|
+
O,
|
|
69
69
|
a,
|
|
70
70
|
"pipeline-component",
|
|
71
71
|
C,
|
|
@@ -73,35 +73,35 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
73
73
|
), r.addPipelineComponent(e.parent, w);
|
|
74
74
|
});
|
|
75
75
|
}), o.links.forEach((e) => {
|
|
76
|
-
const
|
|
76
|
+
const h = !!e.arrow && (e.arrow.includes("-.->") || e.arrow.includes(".-."));
|
|
77
77
|
let a = K(e.fromPort) ?? K(e.toPort);
|
|
78
|
-
const { flow: d, label: w } =
|
|
78
|
+
const { flow: d, label: w } = Rt(e.arrow);
|
|
79
79
|
!a && d && (a = d);
|
|
80
80
|
const C = e.linkLabel, g = w ?? C;
|
|
81
|
-
r.addLink(r.resolveNodeId(e.from), r.resolveNodeId(e.to),
|
|
81
|
+
r.addLink(r.resolveNodeId(e.from), r.resolveNodeId(e.to), h, g, a);
|
|
82
82
|
}), o.evolves.forEach((e) => {
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
83
|
+
const h = r.getNode(e.component);
|
|
84
|
+
if (h?.y !== void 0) {
|
|
85
85
|
const a = G(e.target, `Evolve target for "${e.component}"`);
|
|
86
|
-
r.addTrend(e.component, a,
|
|
86
|
+
r.addTrend(e.component, a, h.y);
|
|
87
87
|
}
|
|
88
88
|
}), o.annotations.length > 0) {
|
|
89
|
-
const e = o.annotations[0],
|
|
90
|
-
r.setAnnotationsBox(
|
|
89
|
+
const e = o.annotations[0], h = A(e.x, e.y, "Annotations box");
|
|
90
|
+
r.setAnnotationsBox(h.x, h.y);
|
|
91
91
|
}
|
|
92
92
|
o.annotation.forEach((e) => {
|
|
93
|
-
const
|
|
94
|
-
r.addAnnotation(e.number, [{ x:
|
|
93
|
+
const h = A(e.x, e.y, `Annotation ${e.number}`);
|
|
94
|
+
r.addAnnotation(e.number, [{ x: h.x, y: h.y }], e.text);
|
|
95
95
|
}), o.accelerators.forEach((e) => {
|
|
96
|
-
const
|
|
97
|
-
r.addAccelerator(e.name,
|
|
96
|
+
const h = A(e.x, e.y, `Accelerator "${e.name}"`);
|
|
97
|
+
r.addAccelerator(e.name, h.x, h.y);
|
|
98
98
|
}), o.deaccelerators.forEach((e) => {
|
|
99
|
-
const
|
|
99
|
+
const h = A(
|
|
100
100
|
e.x,
|
|
101
101
|
e.y,
|
|
102
102
|
`Deaccelerator "${e.name}"`
|
|
103
103
|
);
|
|
104
|
-
r.addDeaccelerator(e.name,
|
|
104
|
+
r.addDeaccelerator(e.name, h.x, h.y);
|
|
105
105
|
});
|
|
106
106
|
}, "populateDb"), tt = {
|
|
107
107
|
parser: {
|
|
@@ -109,7 +109,7 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
109
109
|
yy: void 0
|
|
110
110
|
},
|
|
111
111
|
parse: /* @__PURE__ */ u(async (o) => {
|
|
112
|
-
const r = await
|
|
112
|
+
const r = await Ot("wardley", o);
|
|
113
113
|
Q.debug(r);
|
|
114
114
|
const e = tt.parser?.yy;
|
|
115
115
|
if (!e || typeof e.addNode != "function")
|
|
@@ -123,14 +123,14 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
123
123
|
this.nodes = /* @__PURE__ */ new Map(), this.links = [], this.trends = /* @__PURE__ */ new Map(), this.pipelines = /* @__PURE__ */ new Map(), this.annotations = [], this.notes = [], this.accelerators = [], this.deaccelerators = [], this.axes = {};
|
|
124
124
|
}
|
|
125
125
|
addNode(r) {
|
|
126
|
-
const e = this.nodes.get(r.id) ?? { id: r.id, label: r.label },
|
|
126
|
+
const e = this.nodes.get(r.id) ?? { id: r.id, label: r.label }, h = {
|
|
127
127
|
...e,
|
|
128
128
|
...r,
|
|
129
129
|
className: r.className ?? e.className,
|
|
130
130
|
labelOffsetX: r.labelOffsetX ?? e.labelOffsetX,
|
|
131
131
|
labelOffsetY: r.labelOffsetY ?? e.labelOffsetY
|
|
132
132
|
};
|
|
133
|
-
this.nodes.set(r.id,
|
|
133
|
+
this.nodes.set(r.id, h);
|
|
134
134
|
}
|
|
135
135
|
addLink(r) {
|
|
136
136
|
this.links.push(r);
|
|
@@ -144,8 +144,8 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
144
144
|
e && (e.isPipelineParent = !0);
|
|
145
145
|
}
|
|
146
146
|
addPipelineComponent(r, e) {
|
|
147
|
-
const
|
|
148
|
-
|
|
147
|
+
const h = this.pipelines.get(r);
|
|
148
|
+
h && h.componentIds.push(e);
|
|
149
149
|
const a = this.nodes.get(e);
|
|
150
150
|
a && (a.inPipeline = !0);
|
|
151
151
|
}
|
|
@@ -184,8 +184,8 @@ var G = /* @__PURE__ */ u((o, r) => {
|
|
|
184
184
|
resolveNodeId(r) {
|
|
185
185
|
if (this.nodes.has(r))
|
|
186
186
|
return r;
|
|
187
|
-
for (const [e,
|
|
188
|
-
if (
|
|
187
|
+
for (const [e, h] of this.nodes)
|
|
188
|
+
if (h.label === r)
|
|
189
189
|
return e;
|
|
190
190
|
return r;
|
|
191
191
|
}
|
|
@@ -218,12 +218,12 @@ function et() {
|
|
|
218
218
|
return V()["wardley-beta"];
|
|
219
219
|
}
|
|
220
220
|
u(et, "getConfig");
|
|
221
|
-
function at(o, r, e,
|
|
221
|
+
function at(o, r, e, h, a, d, w, C, g) {
|
|
222
222
|
k.addNode({
|
|
223
223
|
id: o,
|
|
224
224
|
label: r,
|
|
225
225
|
x: e,
|
|
226
|
-
y:
|
|
226
|
+
y: h,
|
|
227
227
|
className: a,
|
|
228
228
|
labelOffsetX: d,
|
|
229
229
|
labelOffsetY: w,
|
|
@@ -232,12 +232,12 @@ function at(o, r, e, f, a, d, w, C, g) {
|
|
|
232
232
|
});
|
|
233
233
|
}
|
|
234
234
|
u(at, "addNode");
|
|
235
|
-
function rt(o, r, e = !1,
|
|
235
|
+
function rt(o, r, e = !1, h, a) {
|
|
236
236
|
k.addLink({
|
|
237
237
|
source: o,
|
|
238
238
|
target: r,
|
|
239
239
|
dashed: e,
|
|
240
|
-
label:
|
|
240
|
+
label: h,
|
|
241
241
|
flow: a
|
|
242
242
|
});
|
|
243
243
|
}
|
|
@@ -290,14 +290,14 @@ function pt(o) {
|
|
|
290
290
|
k.startPipeline(o);
|
|
291
291
|
}
|
|
292
292
|
u(pt, "startPipeline");
|
|
293
|
-
function
|
|
293
|
+
function ft(o, r) {
|
|
294
294
|
k.addPipelineComponent(o, r);
|
|
295
295
|
}
|
|
296
|
-
u(
|
|
297
|
-
function
|
|
296
|
+
u(ft, "addPipelineComponent");
|
|
297
|
+
function ht(o) {
|
|
298
298
|
k.setAxes(o);
|
|
299
299
|
}
|
|
300
|
-
u(
|
|
300
|
+
u(ht, "updateAxes");
|
|
301
301
|
function xt(o) {
|
|
302
302
|
return k.getNode(o);
|
|
303
303
|
}
|
|
@@ -326,8 +326,8 @@ var Gt = {
|
|
|
326
326
|
setAnnotationsBox: lt,
|
|
327
327
|
setSize: ct,
|
|
328
328
|
startPipeline: pt,
|
|
329
|
-
addPipelineComponent:
|
|
330
|
-
updateAxes:
|
|
329
|
+
addPipelineComponent: ft,
|
|
330
|
+
updateAxes: ht,
|
|
331
331
|
getNode: xt,
|
|
332
332
|
resolveNodeId: gt,
|
|
333
333
|
getWardleyData: yt,
|
|
@@ -367,19 +367,19 @@ var Gt = {
|
|
|
367
367
|
showGrid: o?.showGrid ?? !1,
|
|
368
368
|
useMaxWidth: o?.useMaxWidth ?? !0
|
|
369
369
|
};
|
|
370
|
-
}, "getConfigValues"), Vt = /* @__PURE__ */ u((o, r, e,
|
|
370
|
+
}, "getConfigValues"), Vt = /* @__PURE__ */ u((o, r, e, h) => {
|
|
371
371
|
Q.debug(`Rendering Wardley map
|
|
372
372
|
` + o);
|
|
373
|
-
const a = jt(), d = Ht(), w = a.nodeRadius * 1.6, C =
|
|
373
|
+
const a = jt(), d = Ht(), w = a.nodeRadius * 1.6, C = h.db, g = C.getWardleyData(), O = C.getDiagramTitle(), S = g.size?.width ?? a.width, b = g.size?.height ?? a.height, Y = It(r);
|
|
374
374
|
Y.selectAll("*").remove(), Bt(Y, b, S, a.useMaxWidth), Y.attr("viewBox", `0 0 ${S} ${b}`);
|
|
375
375
|
const v = Y.append("g").attr("class", "wardley-map"), q = Y.append("defs");
|
|
376
376
|
q.append("marker").attr("id", `arrow-${r}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 6).attr("markerHeight", 6).attr("orient", "auto-start-reverse").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", d.evolutionStroke).attr("stroke", "none"), q.append("marker").attr("id", `link-arrow-end-${r}`).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("fill", d.linkStroke).attr("stroke", "none"), q.append("marker").attr("id", `link-arrow-start-${r}`).attr("viewBox", "0 0 10 10").attr("refX", 1).attr("refY", 5).attr("markerWidth", 5).attr("markerHeight", 5).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z").attr("fill", d.linkStroke).attr("stroke", "none"), v.append("rect").attr("class", "wardley-background").attr("width", S).attr("height", b).attr("fill", d.backgroundColor);
|
|
377
377
|
const I = S - a.padding * 2, B = b - a.padding * 2;
|
|
378
|
-
|
|
379
|
-
const z = /* @__PURE__ */ u((t) => a.padding + t / 100 * I, "projectX"), L = /* @__PURE__ */ u((t) => b - a.padding - t / 100 * B, "projectY"),
|
|
380
|
-
|
|
378
|
+
O && v.append("text").attr("class", "wardley-title").attr("x", S / 2).attr("y", a.padding / 2).attr("fill", d.axisTextColor).attr("font-size", a.axisFontSize * 1.05).attr("font-weight", "bold").attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(O);
|
|
379
|
+
const z = /* @__PURE__ */ u((t) => a.padding + t / 100 * I, "projectX"), L = /* @__PURE__ */ u((t) => b - a.padding - t / 100 * B, "projectY"), R = v.append("g").attr("class", "wardley-axes");
|
|
380
|
+
R.append("line").attr("x1", a.padding).attr("x2", S - a.padding).attr("y1", b - a.padding).attr("y2", b - a.padding).attr("stroke", d.axisColor).attr("stroke-width", 1), R.append("line").attr("x1", a.padding).attr("x2", a.padding).attr("y1", a.padding).attr("y2", b - a.padding).attr("stroke", d.axisColor).attr("stroke-width", 1);
|
|
381
381
|
const wt = g.axes.xLabel ?? "Evolution", mt = g.axes.yLabel ?? "Visibility";
|
|
382
|
-
|
|
382
|
+
R.append("text").attr("class", "wardley-axis-label wardley-axis-label-x").attr("x", a.padding + I / 2).attr("y", b - a.padding / 4).attr("fill", d.axisTextColor).attr("font-size", a.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").text(wt), R.append("text").attr("class", "wardley-axis-label wardley-axis-label-y").attr("x", a.padding / 3).attr("y", a.padding + B / 2).attr("fill", d.axisTextColor).attr("font-size", a.axisFontSize).attr("font-weight", "bold").attr("text-anchor", "middle").attr(
|
|
383
383
|
"transform",
|
|
384
384
|
`rotate(-90 ${a.padding / 3} ${a.padding + B / 2})`
|
|
385
385
|
).text(mt);
|
|
@@ -401,8 +401,8 @@ var Gt = {
|
|
|
401
401
|
});
|
|
402
402
|
}
|
|
403
403
|
F.forEach((i, p) => {
|
|
404
|
-
const l = n[p],
|
|
405
|
-
p > 0 && t.append("line").attr("x1",
|
|
404
|
+
const l = n[p], f = a.padding + l.start * I, x = a.padding + l.end * I, y = (f + x) / 2;
|
|
405
|
+
p > 0 && t.append("line").attr("x1", f).attr("x2", f).attr("y1", a.padding).attr("y2", b - a.padding).attr("stroke", "#000").attr("stroke-width", 1).attr("stroke-dasharray", "5 5").attr("opacity", 0.8), t.append("text").attr("class", "wardley-stage-label").attr("x", y).attr("y", b - a.padding / 1.5).attr("fill", d.axisTextColor).attr("font-size", a.axisFontSize - 2).attr("text-anchor", "middle").text(i);
|
|
406
406
|
});
|
|
407
407
|
}
|
|
408
408
|
if (a.showGrid) {
|
|
@@ -429,12 +429,12 @@ var Gt = {
|
|
|
429
429
|
const y = i[x], m = i[x + 1];
|
|
430
430
|
s.append("line").attr("class", "wardley-pipeline-evolution-link").attr("x1", y.pos.x).attr("y1", y.pos.y).attr("x2", m.pos.x).attr("y2", m.pos.y).attr("stroke", d.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", "4 4");
|
|
431
431
|
}
|
|
432
|
-
let p = 1 / 0, l = -1 / 0,
|
|
432
|
+
let p = 1 / 0, l = -1 / 0, f = 0;
|
|
433
433
|
if (n.componentIds.forEach((x) => {
|
|
434
434
|
const y = c.get(x);
|
|
435
|
-
y && (p = Math.min(p, y.x), l = Math.max(l, y.x),
|
|
435
|
+
y && (p = Math.min(p, y.x), l = Math.max(l, y.x), f = y.y);
|
|
436
436
|
}), p !== 1 / 0 && l !== -1 / 0) {
|
|
437
|
-
const y = a.nodeRadius * 4, m =
|
|
437
|
+
const y = a.nodeRadius * 4, m = f - y / 2, P = c.get(n.nodeId);
|
|
438
438
|
if (P) {
|
|
439
439
|
const N = (p + l) / 2;
|
|
440
440
|
P.x = N, P.y = m - w / 6;
|
|
@@ -449,33 +449,33 @@ var Gt = {
|
|
|
449
449
|
});
|
|
450
450
|
const Z = g.links.filter((t) => !(!c.has(t.source) || !c.has(t.target) || U.get(t.target)?.has(t.source)));
|
|
451
451
|
_.selectAll("line").data(Z).enter().append("line").attr("class", (t) => `wardley-link${t.dashed ? " wardley-link--dashed" : ""}`).attr("x1", (t) => {
|
|
452
|
-
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.source).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = n.x - s.x,
|
|
452
|
+
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.source).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = n.x - s.x, f = n.y - s.y, x = Math.sqrt(l * l + f * f);
|
|
453
453
|
return s.x + l / x * p;
|
|
454
454
|
}).attr("y1", (t) => {
|
|
455
|
-
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.source).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = n.x - s.x,
|
|
456
|
-
return s.y +
|
|
455
|
+
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.source).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = n.x - s.x, f = n.y - s.y, x = Math.sqrt(l * l + f * f);
|
|
456
|
+
return s.y + f / x * p;
|
|
457
457
|
}).attr("x2", (t) => {
|
|
458
|
-
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.target).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = s.x - n.x,
|
|
458
|
+
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.target).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = s.x - n.x, f = s.y - n.y, x = Math.sqrt(l * l + f * f);
|
|
459
459
|
return n.x + l / x * p;
|
|
460
460
|
}).attr("y2", (t) => {
|
|
461
|
-
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.target).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = s.x - n.x,
|
|
462
|
-
return n.y +
|
|
461
|
+
const s = c.get(t.source), n = c.get(t.target), p = g.nodes.find((y) => y.id === t.target).isPipelineParent ? w / Math.sqrt(2) : a.nodeRadius, l = s.x - n.x, f = s.y - n.y, x = Math.sqrt(l * l + f * f);
|
|
462
|
+
return n.y + f / x * p;
|
|
463
463
|
}).attr("stroke", d.linkStroke).attr("stroke-width", 1).attr("stroke-dasharray", (t) => t.dashed ? "6 6" : null).attr("marker-end", (t) => t.flow === "forward" || t.flow === "bidirectional" ? `url(#link-arrow-end-${r})` : null).attr("marker-start", (t) => t.flow === "backward" || t.flow === "bidirectional" ? `url(#link-arrow-start-${r})` : null), _.selectAll("text").data(Z.filter((t) => t.label)).enter().append("text").attr("class", "wardley-link-label").attr("x", (t) => {
|
|
464
|
-
const s = c.get(t.source), n = c.get(t.target), i = (s.x + n.x) / 2, p = n.y - s.y, l = n.x - s.x,
|
|
464
|
+
const s = c.get(t.source), n = c.get(t.target), i = (s.x + n.x) / 2, p = n.y - s.y, l = n.x - s.x, f = Math.sqrt(l * l + p * p), x = 8, y = p / f;
|
|
465
465
|
return i + y * x;
|
|
466
466
|
}).attr("y", (t) => {
|
|
467
|
-
const s = c.get(t.source), n = c.get(t.target), i = (s.y + n.y) / 2, p = n.x - s.x, l = n.y - s.y,
|
|
467
|
+
const s = c.get(t.source), n = c.get(t.target), i = (s.y + n.y) / 2, p = n.x - s.x, l = n.y - s.y, f = Math.sqrt(p * p + l * l), x = 8, y = -p / f;
|
|
468
468
|
return i + y * x;
|
|
469
469
|
}).attr("fill", d.axisTextColor).attr("font-size", a.labelFontSize).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("transform", (t) => {
|
|
470
|
-
const s = c.get(t.source), n = c.get(t.target), i = (s.x + n.x) / 2, p = (s.y + n.y) / 2, l = n.x - s.x,
|
|
471
|
-
let X = Math.atan2(
|
|
470
|
+
const s = c.get(t.source), n = c.get(t.target), i = (s.x + n.x) / 2, p = (s.y + n.y) / 2, l = n.x - s.x, f = n.y - s.y, x = Math.sqrt(l * l + f * f), y = 8, m = f / x, P = -l / x, N = i + m * y, W = p + P * y;
|
|
471
|
+
let X = Math.atan2(f, l) * 180 / Math.PI;
|
|
472
472
|
return (X > 90 || X < -90) && (X += 180), `rotate(${X} ${N} ${W})`;
|
|
473
473
|
}).text((t) => t.label);
|
|
474
474
|
const kt = v.append("g").attr("class", "wardley-trends"), bt = g.trends.map((t) => {
|
|
475
475
|
const s = c.get(t.nodeId);
|
|
476
476
|
if (!s)
|
|
477
477
|
return null;
|
|
478
|
-
const n = z(t.targetX), i = L(t.targetY), p = n - s.x, l = i - s.y,
|
|
478
|
+
const n = z(t.targetX), i = L(t.targetY), p = n - s.x, l = i - s.y, f = Math.sqrt(p * p + l * l), x = a.nodeRadius + 2, y = f > x ? n - p / f * x : n, m = f > x ? i - l / f * x : i;
|
|
479
479
|
return {
|
|
480
480
|
origin: s,
|
|
481
481
|
targetX: n,
|
|
@@ -541,9 +541,9 @@ var Gt = {
|
|
|
541
541
|
});
|
|
542
542
|
}), g.annotationsBox) {
|
|
543
543
|
let s = z(g.annotationsBox.x), n = L(g.annotationsBox.y);
|
|
544
|
-
const i = 10, p = 16, l = 11,
|
|
544
|
+
const i = 10, p = 16, l = 11, f = t.append("g").attr("class", "wardley-annotations-box"), x = [...g.annotations].filter((m) => m.text).sort((m, P) => m.number - P.number), y = [];
|
|
545
545
|
if (x.forEach((m, P) => {
|
|
546
|
-
const N =
|
|
546
|
+
const N = f.append("text").attr("x", s + i).attr("y", n + i + (P + 1) * p).attr("font-size", l).attr("fill", d.axisTextColor).attr("text-anchor", "start").attr("dominant-baseline", "middle").text(`${m.number}. ${m.text}`);
|
|
547
547
|
y.push(N);
|
|
548
548
|
}), y.length > 0) {
|
|
549
549
|
let m = 0, P = 0;
|
|
@@ -556,7 +556,7 @@ var Gt = {
|
|
|
556
556
|
const N = m + i * 2 + 105, W = x.length * p + i * 2 + P / 2, X = a.padding, $t = S - a.padding - N, vt = a.padding, Pt = b - a.padding - W;
|
|
557
557
|
s = Math.max(X, Math.min(s, $t)), n = Math.max(vt, Math.min(n, Pt)), y.forEach((j, D) => {
|
|
558
558
|
j.attr("x", s + i).attr("y", n + i + (D + 1) * p);
|
|
559
|
-
}),
|
|
559
|
+
}), f.insert("rect", "text").attr("x", s).attr("y", n).attr("width", N).attr("height", W).attr("fill", "white").attr("stroke", d.axisColor).attr("stroke-width", 1.5).attr("rx", 4).attr("ry", 4);
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
}
|
|
@@ -570,13 +570,13 @@ var Gt = {
|
|
|
570
570
|
if (g.accelerators.length > 0) {
|
|
571
571
|
const t = v.append("g").attr("class", "wardley-accelerators");
|
|
572
572
|
g.accelerators.forEach((s) => {
|
|
573
|
-
const n = z(s.x), i = L(s.y), p = 60, l = 30,
|
|
573
|
+
const n = z(s.x), i = L(s.y), p = 60, l = 30, f = 20, x = `
|
|
574
574
|
M ${n} ${i - l / 2}
|
|
575
|
-
L ${n + p -
|
|
576
|
-
L ${n + p -
|
|
575
|
+
L ${n + p - f} ${i - l / 2}
|
|
576
|
+
L ${n + p - f} ${i - l / 2 - 8}
|
|
577
577
|
L ${n + p} ${i}
|
|
578
|
-
L ${n + p -
|
|
579
|
-
L ${n + p -
|
|
578
|
+
L ${n + p - f} ${i + l / 2 + 8}
|
|
579
|
+
L ${n + p - f} ${i + l / 2}
|
|
580
580
|
L ${n} ${i + l / 2}
|
|
581
581
|
Z
|
|
582
582
|
`;
|
|
@@ -586,13 +586,13 @@ var Gt = {
|
|
|
586
586
|
if (g.deaccelerators.length > 0) {
|
|
587
587
|
const t = v.append("g").attr("class", "wardley-deaccelerators");
|
|
588
588
|
g.deaccelerators.forEach((s) => {
|
|
589
|
-
const n = z(s.x), i = L(s.y), p = 60, l = 30,
|
|
589
|
+
const n = z(s.x), i = L(s.y), p = 60, l = 30, f = 20, x = `
|
|
590
590
|
M ${n + p} ${i - l / 2}
|
|
591
|
-
L ${n +
|
|
592
|
-
L ${n +
|
|
591
|
+
L ${n + f} ${i - l / 2}
|
|
592
|
+
L ${n + f} ${i - l / 2 - 8}
|
|
593
593
|
L ${n} ${i}
|
|
594
|
-
L ${n +
|
|
595
|
-
L ${n +
|
|
594
|
+
L ${n + f} ${i + l / 2 + 8}
|
|
595
|
+
L ${n + f} ${i + l / 2}
|
|
596
596
|
L ${n + p} ${i + l / 2}
|
|
597
597
|
Z
|
|
598
598
|
`;
|
|
@@ -604,7 +604,7 @@ var Gt = {
|
|
|
604
604
|
}, Ut = /* @__PURE__ */ u(({
|
|
605
605
|
wardley: o
|
|
606
606
|
} = {}) => {
|
|
607
|
-
const r = Et(), e = Yt(),
|
|
607
|
+
const r = Et(), e = Yt(), h = J(r, e.themeVariables), a = J(h.wardley, o);
|
|
608
608
|
return `
|
|
609
609
|
.wardley-background {
|
|
610
610
|
fill: ${a.backgroundColor};
|