@bkm016/basalt 0.1.13 → 0.1.14
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 +3 -2
- package/{chunk-bng72094.js → chunk-03wzwnn6.js} +1 -1
- package/{chunk-9e8vhzy7.js → chunk-0crbhhna.js} +1 -1
- package/{chunk-h9zxqeqr.js → chunk-0rasqm8y.js} +2 -2
- package/{chunk-0x9netvr.js → chunk-1w4nh5t6.js} +1 -1
- package/{chunk-dk6fgprw.js → chunk-2eaehpp6.js} +1 -1
- package/{chunk-6sea12mw.js → chunk-30dxcr91.js} +1 -1
- package/{chunk-2zbj8ny6.js → chunk-343jsm46.js} +2 -2
- package/chunk-38g4jd6v.js +5 -0
- package/{chunk-zx75vnw8.js → chunk-39mh7h58.js} +22 -22
- package/chunk-44b9yx79.js +2 -0
- package/{chunk-r1jn77q6.js → chunk-4f6p4n7k.js} +2 -2
- package/{chunk-sgz87ht5.js → chunk-4w8j6n7z.js} +1 -1
- package/{chunk-szj85dqe.js → chunk-4yxd2kg1.js} +2 -2
- package/{chunk-bp61xdsc.js → chunk-59hg9a84.js} +1 -1
- package/{chunk-bq54argx.js → chunk-62ebm0bn.js} +1 -1
- package/{chunk-6d9r9p91.js → chunk-6ef085c1.js} +4 -4
- package/{chunk-zk91579b.js → chunk-6hx9y86d.js} +2 -2
- package/chunk-73t051r6.js +2 -0
- package/{chunk-pryvvs96.js → chunk-7mgkpn94.js} +22 -22
- package/{chunk-2q56egb8.js → chunk-81x8r8w4.js} +1 -1
- package/{chunk-rn3jwyh1.js → chunk-8np9b2y8.js} +2 -2
- package/{chunk-1q6e3mj7.js → chunk-9ew8cap5.js} +2 -2
- package/chunk-9v3b7jjv.js +2 -0
- package/{chunk-tjg0gcks.js → chunk-9vam83py.js} +1 -1
- package/{chunk-ct77cdg7.js → chunk-9xjecw6c.js} +1 -1
- package/{chunk-8cgz8xv7.js → chunk-b2wpj81x.js} +2 -2
- package/{chunk-302n9g7p.js → chunk-bjvv3403.js} +1 -1
- package/{chunk-tfhze1vq.js → chunk-c8g9jjqs.js} +2 -2
- package/{chunk-0a7ft50x.js → chunk-cs91rmbf.js} +8 -8
- package/{chunk-gpnqmtbk.js → chunk-edcf97ka.js} +1 -1
- package/{chunk-74wwdx3y.js → chunk-en7z6ne5.js} +2 -2
- package/{chunk-f0h2bv11.js → chunk-evnqkyt7.js} +10 -10
- package/{chunk-4rnmxtpx.js → chunk-ge38dhv9.js} +2 -2
- package/chunk-hggam3je.js +2 -0
- package/{chunk-mf04h0yy.js → chunk-k38jaz6c.js} +4 -4
- package/{chunk-jjtt9aq8.js → chunk-kcn05erf.js} +3 -3
- package/{chunk-y23dpz5e.js → chunk-m5km74eq.js} +2 -2
- package/{chunk-095adzn5.js → chunk-mfb3dgs8.js} +2 -2
- package/{chunk-0nedq669.js → chunk-mh4bjtfs.js} +3 -3
- package/{chunk-yy1f9jxc.js → chunk-nysatg77.js} +429 -312
- package/{chunk-bja7p3em.js → chunk-p886jr17.js} +13 -13
- package/{chunk-xvm0y99b.js → chunk-pdt65s31.js} +2 -2
- package/{chunk-ymg7mtcx.js → chunk-pjgt1bdx.js} +2 -2
- package/{chunk-959z9efn.js → chunk-pyj6avd5.js} +2 -2
- package/chunk-qd2enpr2.js +3 -0
- package/{chunk-tnj2kqb8.js → chunk-qe76naq9.js} +1 -1
- package/{chunk-z0c8ek0j.js → chunk-qjnx4fsn.js} +2 -2
- package/{chunk-2tf7qfbx.js → chunk-qs161f2q.js} +2 -2
- package/{chunk-nbjnwd54.js → chunk-rghqprav.js} +1 -1
- package/{chunk-7chv3knf.js → chunk-t33bm5aa.js} +1 -1
- package/chunk-vd5332ps.js +2 -0
- package/{chunk-22az84sh.js → chunk-w55cnj0f.js} +2 -2
- package/{chunk-4k9t9jvx.js → chunk-wnd3y4c0.js} +1 -1
- package/{chunk-snz19yc2.js → chunk-xafx1p7z.js} +2 -2
- package/{chunk-15ve3nmv.js → chunk-xf7zw32f.js} +12 -12
- package/chunk-xk3t5ves.js +482 -0
- package/{chunk-kbpbrr11.js → chunk-xq74x4gc.js} +2 -2
- package/{chunk-mdkfm1ak.js → chunk-y0274xr2.js} +3 -3
- package/{chunk-y4pvhes1.js → chunk-z9p6s986.js} +6 -6
- package/{chunk-41das1ty.js → chunk-zcwz44db.js} +1 -1
- package/{chunk-77c2cqp2.js → chunk-zhyzhekt.js} +1 -1
- package/compiled.js +12 -12
- package/package.json +1 -1
- package/ui-test-worker.js +51 -51
- package/web/chunk-15g9pnzy.js +1 -0
- package/web/{chunk-16jc5m0f.js → chunk-17wwzrp4.js} +1 -1
- package/web/chunk-19tkjg9w.js +1 -0
- package/web/chunk-1y387f45.js +1 -0
- package/web/{chunk-mykrm8ba.js → chunk-25sn840r.js} +2 -2
- package/web/chunk-26sp6jre.js +1 -0
- package/web/{chunk-wpxtkxjt.js → chunk-2c7kxr4v.js} +2 -2
- package/web/{chunk-et1rsgmp.js → chunk-2gsf89vs.js} +2 -2
- package/web/{chunk-jpem3qvs.js → chunk-2gvz70wr.js} +5 -5
- package/web/chunk-2s3my1jn.js +1 -0
- package/web/{chunk-yn4t5s9r.js → chunk-32dh0hft.js} +1 -1
- package/web/{chunk-5cwxhhae.js → chunk-3haw3wcw.js} +2 -2
- package/web/{chunk-t82sngk9.js → chunk-3rxhs9qm.js} +7 -7
- package/web/chunk-410qdvmv.js +1 -0
- package/web/chunk-4qehf2xx.js +2 -0
- package/web/{chunk-b9jry5a3.js → chunk-51b8n5e1.js} +1 -1
- package/web/{chunk-xe121vg7.js → chunk-54mgncq3.js} +1 -1
- package/web/{chunk-ze6azq7z.js → chunk-59g6rrew.js} +4 -4
- package/web/{chunk-h6k1x096.js → chunk-5d9veaef.js} +2 -2
- package/web/chunk-6481wt3t.js +1 -0
- package/web/chunk-6ehecat3.js +1 -0
- package/web/chunk-6m8hq6ph.js +1 -0
- package/web/chunk-73941p08.js +1 -0
- package/web/{chunk-0jbf73pr.js → chunk-783s8jds.js} +3 -3
- package/web/{chunk-qbmtah1x.js → chunk-78m018ya.js} +1 -1
- package/web/{chunk-3p9w8sg5.js → chunk-797bh7z6.js} +3 -3
- package/web/{chunk-1xm9x7d6.js → chunk-7hpqrfgg.js} +2 -2
- package/web/{chunk-zxrbbbtp.js → chunk-7kywe73f.js} +2 -2
- package/web/chunk-7qq1ypvj.js +1 -0
- package/web/{chunk-awkdw9rw.js → chunk-7wzszsf5.js} +2 -2
- package/web/{chunk-c57f714b.js → chunk-7zfqppsx.js} +2 -2
- package/web/{chunk-jh33m2mq.js → chunk-8sr9w61v.js} +3 -3
- package/web/{chunk-4py9sndw.js → chunk-8ttp8fh3.js} +6 -6
- package/web/chunk-8zg89764.js +1 -0
- package/web/{chunk-ct7z7bea.js → chunk-988e9wx6.js} +3 -3
- package/web/{chunk-vk7ch6fh.js → chunk-9h0f3gar.js} +2 -2
- package/web/{chunk-p6e2vr51.js → chunk-9vr6hpmk.js} +6 -6
- package/web/chunk-9vrp249f.js +2 -0
- package/web/{chunk-eqxy6535.js → chunk-a205cj09.js} +2 -2
- package/web/{chunk-980zhtht.js → chunk-ahn2frbt.js} +1 -1
- package/web/{chunk-xvm66b7v.js → chunk-aknsydan.js} +4 -4
- package/web/chunk-at0xtfhy.js +1 -0
- package/web/chunk-bahccwb9.js +1 -0
- package/web/{chunk-w4tfad6c.js → chunk-c7fqrs8j.js} +1 -1
- package/web/{chunk-zqcg6frm.js → chunk-d3hyf9yd.js} +1 -1
- package/web/chunk-dcegr80c.js +1 -0
- package/web/{chunk-v4cqc9f9.js → chunk-dwtatme7.js} +1 -1
- package/web/{chunk-cr04125j.js → chunk-ex8rmqn1.js} +12 -12
- package/web/{chunk-jh3k7xex.js → chunk-faskbfjf.js} +3 -3
- package/web/{chunk-zb61mf0a.js → chunk-feanedhx.js} +1 -1
- package/web/{chunk-xk1vkcj4.js → chunk-ffywf5w5.js} +4 -4
- package/web/chunk-fx3d48e6.js +1 -0
- package/web/{chunk-3jjksgze.js → chunk-g3szt4c4.js} +1 -1
- package/web/chunk-g7bcntpm.js +1 -0
- package/web/chunk-gr1tjqbd.js +1 -0
- package/web/{chunk-2sef2wft.js → chunk-hbwxtbq3.js} +2 -2
- package/web/{chunk-6e87m0nm.js → chunk-hdtvrh0f.js} +2 -2
- package/web/chunk-j031r08w.js +1 -0
- package/web/{chunk-5ym5ffd5.js → chunk-j6wcszxq.js} +2 -2
- package/web/{chunk-jccz14ye.js → chunk-jdx7qp2w.js} +2 -2
- package/web/chunk-jge7nn3s.js +1 -0
- package/web/chunk-jy8zat04.js +1 -0
- package/web/{chunk-0rhx7qb8.js → chunk-jzge034r.js} +1 -1
- package/web/{chunk-qq6m2my8.js → chunk-k4qrqmdk.js} +2 -2
- package/web/chunk-k8s7kye3.js +1 -0
- package/web/{chunk-ke8dffnk.js → chunk-k9fyqrhp.js} +2 -2
- package/web/chunk-k9zn1n6d.js +1 -0
- package/web/chunk-kg3tksv7.js +1 -0
- package/web/chunk-kk5rw81s.js +2 -0
- package/web/{chunk-y9waq403.js → chunk-kpmd893m.js} +2 -2
- package/web/chunk-md9j949p.js +1 -0
- package/web/{chunk-e57h40qa.js → chunk-mn2wv9ye.js} +2 -2
- package/web/{chunk-14vmr99v.js → chunk-mv7jgmnb.js} +3 -3
- package/web/{chunk-qq06x2ce.js → chunk-mvm68qtt.js} +2 -2
- package/web/chunk-nbcpbqq4.js +1 -0
- package/web/{chunk-6rsr2cyw.js → chunk-nfpff7yf.js} +8 -8
- package/web/chunk-nk7jkpam.js +1 -0
- package/web/chunk-nmvt1rn3.js +1 -0
- package/web/{chunk-3ctmehg4.js → chunk-npw1s1h2.js} +1 -1
- package/web/chunk-nzzxv84v.js +8 -0
- package/web/{chunk-a9er7a7c.js → chunk-p4pqtybm.js} +19 -19
- package/web/{chunk-ba9qy65y.js → chunk-p79c7aak.js} +1 -1
- package/web/{chunk-frnh4zqf.js → chunk-pafw34vg.js} +2 -2
- package/web/{chunk-ct90yf8z.js → chunk-pf65cank.js} +2 -2
- package/web/{chunk-g0be12na.js → chunk-ppa21760.js} +1 -1
- package/web/{chunk-g7hqafb8.js → chunk-ptpkv0te.js} +1 -1
- package/web/{chunk-ddg8rz82.js → chunk-qcdej581.js} +1 -1
- package/web/{chunk-xxmaqj1m.js → chunk-qftcdcps.js} +2 -2
- package/web/{chunk-eqndhs21.js → chunk-qv1w36ja.js} +2 -2
- package/web/{chunk-mnf4ngj9.js → chunk-r8p741qj.js} +2 -2
- package/web/chunk-rcexbkjj.js +1 -0
- package/web/{chunk-w28dn4dw.js → chunk-rjakb64x.js} +1 -1
- package/web/{chunk-k0cg4n2k.js → chunk-s0xy00v5.js} +2 -2
- package/web/{chunk-cr05dttm.js → chunk-s2ps0ct5.js} +1 -1
- package/web/{chunk-xcyqd7cn.js → chunk-s45g7fp6.js} +1 -1
- package/web/{chunk-h1k2kqbs.js → chunk-s70aj1v5.js} +4 -4
- package/web/chunk-say8bvkc.js +1 -0
- package/web/{chunk-qh62nkem.js → chunk-sd3cdqcm.js} +2 -2
- package/web/{chunk-a6g3nqp0.js → chunk-sgkevxdf.js} +2 -2
- package/web/chunk-sjffrcq9.js +1 -0
- package/web/{chunk-2y1avvqj.js → chunk-snaepr87.js} +3 -3
- package/web/{chunk-p7pa02k9.js → chunk-tdzh6nsz.js} +2 -2
- package/web/{chunk-ga07tv37.js → chunk-tjd8qp87.js} +1 -1
- package/web/chunk-tncc9e57.js +1 -0
- package/web/{chunk-ve8gy05p.js → chunk-ty2rmwda.js} +92 -92
- package/web/chunk-v22hp18w.js +1 -0
- package/web/{chunk-zh7193nq.js → chunk-ve9dz857.js} +2 -2
- package/web/{chunk-s935z8er.js → chunk-vg346gxc.js} +2 -2
- package/web/{chunk-b4gcpsbg.js → chunk-vpegzgzb.js} +5 -5
- package/web/{chunk-pzg25qqe.js → chunk-vvvd3grf.js} +2 -2
- package/web/{chunk-ss96cz1f.js → chunk-vwv6pqy7.js} +1 -1
- package/web/{chunk-sq75q603.js → chunk-vxm7n7w6.js} +6 -6
- package/web/{chunk-qb8mbptk.js → chunk-w5q7978e.js} +1 -1
- package/web/{chunk-97t3ngqf.js → chunk-we4mhfmq.js} +7 -7
- package/web/{chunk-20jxvmbw.js → chunk-wfgrdabk.js} +1 -1
- package/web/{chunk-3wpxymxa.js → chunk-wkhj4hsw.js} +3 -3
- package/web/{chunk-q4vy3dkk.js → chunk-wspk8qbg.js} +2 -2
- package/web/{chunk-9wz8jne3.js → chunk-xf1hnpme.js} +1 -1
- package/web/{chunk-fnvgdvrg.js → chunk-xhqvzmfj.js} +4 -4
- package/web/chunk-xq70hgre.js +1 -0
- package/web/chunk-xtss82z2.js +1 -0
- package/web/{chunk-8j4tzff5.js → chunk-y3tb6410.js} +3 -3
- package/web/{chunk-mkxeenph.js → chunk-y6mcxfm0.js} +1 -1
- package/web/{chunk-0rvwj2wh.js → chunk-ya696bfe.js} +2 -2
- package/web/{chunk-2x7vmhm0.js → chunk-ysw5fs45.js} +3 -3
- package/web/{chunk-atppv8fk.js → chunk-zkq1xknc.js} +1 -1
- package/web/chunk-zkv025s5.js +1 -0
- package/web/{chunk-dmha2y9c.js → chunk-zpzvz973.js} +18 -18
- package/web/{chunk-c6m4vfn5.js → chunk-zsat72qd.js} +68 -68
- package/web/{chunk-9k7fkx80.js → chunk-zx3h7v72.js} +1 -1
- package/web/index.html +1 -1
- package/chunk-1dbfmejf.js +0 -2
- package/chunk-4w9zqv0k.js +0 -2
- package/chunk-6f4ht2hw.js +0 -2
- package/chunk-edbq461k.js +0 -5
- package/chunk-m71pj3g1.js +0 -2
- package/chunk-n22vd4at.js +0 -2
- package/chunk-sgrrxsnz.js +0 -482
- package/chunk-ydzag81d.js +0 -3
- package/web/chunk-12qf1r6m.js +0 -1
- package/web/chunk-1m6fx2h7.js +0 -2
- package/web/chunk-2n5xbnrt.js +0 -1
- package/web/chunk-36s08nye.js +0 -1
- package/web/chunk-4swea9sn.js +0 -1
- package/web/chunk-4zz5a483.js +0 -1
- package/web/chunk-6y55gk1n.js +0 -1
- package/web/chunk-7aep7k4v.js +0 -1
- package/web/chunk-8tgavnwx.js +0 -1
- package/web/chunk-a00vg115.js +0 -1
- package/web/chunk-a4gbxnm3.js +0 -1
- package/web/chunk-bq6mep6p.js +0 -2
- package/web/chunk-bwy3e58v.js +0 -1
- package/web/chunk-de29pe57.js +0 -1
- package/web/chunk-eeesa5q1.js +0 -1
- package/web/chunk-f7jpakwh.js +0 -1
- package/web/chunk-fp62avjh.js +0 -1
- package/web/chunk-gr163fex.js +0 -1
- package/web/chunk-gx340asc.js +0 -1
- package/web/chunk-gxtz10wf.js +0 -1
- package/web/chunk-k9qnvx86.js +0 -2
- package/web/chunk-kcnj0gan.js +0 -1
- package/web/chunk-kpp5xqsb.js +0 -1
- package/web/chunk-m33yted6.js +0 -1
- package/web/chunk-me5jqqn6.js +0 -1
- package/web/chunk-mzqqwbmr.js +0 -1
- package/web/chunk-mzzaet63.js +0 -1
- package/web/chunk-q34as3v6.js +0 -1
- package/web/chunk-q6c8p73w.js +0 -1
- package/web/chunk-qn93we3a.js +0 -1
- package/web/chunk-r1f1egve.js +0 -1
- package/web/chunk-tt9410zw.js +0 -8
- package/web/chunk-vg1ebkce.js +0 -1
- package/web/chunk-vnt34mkb.js +0 -1
- package/web/chunk-xh4xn1az.js +0 -1
- package/web/chunk-xrk5ewsn.js +0 -1
- package/web/chunk-xzwxcxb4.js +0 -1
- package/web/chunk-ydhnkws0.js +0 -1
- package/web/chunk-ys2tns0p.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{H}from"./chunk-
|
|
2
|
-
`+r);let o=qt(),p=Gt(),b=o.nodeRadius*1.6,X=u.db,m=X.getWardleyData(),tt=X.getDiagramTitle(),Y=m.size?.width??o.width,M=m.size?.height??o.height,_=V(i);_.selectAll("*").remove(),F(_,M,Y,o.useMaxWidth),_.attr("viewBox",`0 0 ${Y} ${M}`);let z=_.append("g").attr("class","wardley-map"),nt=_.append("defs");nt.append("marker").attr("id",`arrow-${i}`).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",p.evolutionStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-end-${i}`).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",p.linkStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-start-${i}`).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",p.linkStroke).attr("stroke","none"),z.append("rect").attr("class","wardley-background").attr("width",Y).attr("height",M).attr("fill",p.backgroundColor);let Z=Y-o.padding*2,K=M-o.padding*2;if(tt)z.append("text").attr("class","wardley-title").attr("x",Y/2).attr("y",o.padding/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(tt);let O=t((e)=>o.padding+e/100*Z,"projectX"),D=t((e)=>M-o.padding-e/100*K,"projectY"),et=z.append("g").attr("class","wardley-axes");et.append("line").attr("x1",o.padding).attr("x2",Y-o.padding).attr("y1",M-o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1),et.append("line").attr("x1",o.padding).attr("x2",o.padding).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1);let Lt=m.axes.xLabel??"Evolution",Tt=m.axes.yLabel??"Visibility";et.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",o.padding+Z/2).attr("y",M-o.padding/4).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Lt),et.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",o.padding/3).attr("y",o.padding+K/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${o.padding/3} ${o.padding+K/2})`).text(Tt);let Q=m.axes.stages&&m.axes.stages.length>0?m.axes.stages:Dt;if(Q.length>0){let e=z.append("g").attr("class","wardley-stages"),d=m.axes.stageBoundaries,s=[];if(d&&d.length===Q.length){let c=0;d.forEach((f)=>{s.push({start:c,end:f}),c=f})}else{let c=1/Q.length;Q.forEach((f,g)=>{s.push({start:g*c,end:(g+1)*c})})}Q.forEach((c,f)=>{let g=s[f],w=o.padding+g.start*Z,y=o.padding+g.end*Z,k=(w+y)/2;if(f>0)e.append("line").attr("x1",w).attr("x2",w).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);e.append("text").attr("class","wardley-stage-label").attr("x",k).attr("y",M-o.padding/1.5).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize-2).attr("text-anchor","middle").text(c)})}if(o.showGrid){let e=z.append("g").attr("class","wardley-grid");for(let d=1;d<4;d++){let s=d/4,c=o.padding+Z*s;e.append("line").attr("x1",c).attr("x2",c).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6"),e.append("line").attr("x1",o.padding).attr("x2",Y-o.padding).attr("y1",M-o.padding-K*s).attr("y2",M-o.padding-K*s).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6")}}let h=new Map;if(m.nodes.forEach((e)=>{h.set(e.id,{x:O(e.x),y:D(e.y),node:e})}),m.pipelines.length>0){let e=z.append("g").attr("class","wardley-pipelines"),d=z.append("g").attr("class","wardley-pipeline-links");m.pipelines.forEach((s)=>{if(s.componentIds.length===0)return;let c=s.componentIds.map((y)=>({id:y,pos:h.get(y),node:m.nodes.find((k)=>k.id===y)})).filter((y)=>y.pos&&y.node).sort((y,k)=>y.node.x-k.node.x);for(let y=0;y<c.length-1;y++){let k=c[y],v=c[y+1];d.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",k.pos.x).attr("y1",k.pos.y).attr("x2",v.pos.x).attr("y2",v.pos.y).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let f=1/0,g=-1/0,w=0;if(s.componentIds.forEach((y)=>{let k=h.get(y);if(k)f=Math.min(f,k.x),g=Math.max(g,k.x),w=k.y}),f!==1/0&&g!==-1/0){let k=o.nodeRadius*4,v=w-k/2,W=h.get(s.nodeId);if(W){let B=(f+g)/2;W.x=B,W.y=v-b/6}e.append("rect").attr("class","wardley-pipeline-box").attr("x",f-15).attr("y",v).attr("width",g-f+30).attr("height",k).attr("fill","none").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let dt=z.append("g").attr("class","wardley-links"),lt=new Map;m.pipelines.forEach((e)=>{lt.set(e.nodeId,new Set(e.componentIds))});let ct=m.links.filter((e)=>{if(!h.has(e.source)||!h.has(e.target))return!1;if(lt.get(e.target)?.has(e.source))return!1;return!0});dt.selectAll("line").data(ct).enter().append("line").attr("class",(e)=>`wardley-link${e.dashed?" wardley-link--dashed":""}`).attr("x1",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.source).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=s.x-d.x,w=s.y-d.y,y=Math.sqrt(g*g+w*w);return d.x+g/y*f}).attr("y1",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.source).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=s.x-d.x,w=s.y-d.y,y=Math.sqrt(g*g+w*w);return d.y+w/y*f}).attr("x2",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.target).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=d.x-s.x,w=d.y-s.y,y=Math.sqrt(g*g+w*w);return s.x+g/y*f}).attr("y2",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.target).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=d.x-s.x,w=d.y-s.y,y=Math.sqrt(g*g+w*w);return s.y+w/y*f}).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(e)=>e.dashed?"6 6":null).attr("marker-end",(e)=>{if(e.flow==="forward"||e.flow==="bidirectional")return`url(#link-arrow-end-${i})`;return null}).attr("marker-start",(e)=>{if(e.flow==="backward"||e.flow==="bidirectional")return`url(#link-arrow-start-${i})`;return null}),dt.selectAll("text").data(ct.filter((e)=>e.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(e)=>{let d=h.get(e.source),s=h.get(e.target),c=(d.x+s.x)/2,f=s.y-d.y,g=s.x-d.x,w=Math.sqrt(g*g+f*f),y=8,k=f/w;return c+k*8}).attr("y",(e)=>{let d=h.get(e.source),s=h.get(e.target),c=(d.y+s.y)/2,f=s.x-d.x,g=s.y-d.y,w=Math.sqrt(f*f+g*g),y=8,k=-f/w;return c+k*8}).attr("fill",p.axisTextColor).attr("font-size",o.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(e)=>{let d=h.get(e.source),s=h.get(e.target),c=(d.x+s.x)/2,f=(d.y+s.y)/2,g=s.x-d.x,w=s.y-d.y,y=Math.sqrt(g*g+w*w),k=8,v=w/y,W=-g/y,B=c+v*8,at=f+W*8,j=Math.atan2(w,g)*180/Math.PI;if(j>90||j<-90)j+=180;return`rotate(${j} ${B} ${at})`}).text((e)=>e.label);let Wt=z.append("g").attr("class","wardley-trends"),At=m.trends.map((e)=>{let d=h.get(e.nodeId);if(!d)return null;let s=O(e.targetX),c=D(e.targetY),f=s-d.x,g=c-d.y,w=Math.sqrt(f*f+g*g),y=o.nodeRadius+2,k=w>y?s-f/w*y:s,v=w>y?c-g/w*y:c;return{origin:d,targetX:s,targetY:c,adjustedX2:k,adjustedY2:v}}).filter((e)=>e!==null);Wt.selectAll("line").data(At).enter().append("line").attr("class","wardley-trend").attr("x1",(e)=>e.origin.x).attr("y1",(e)=>e.origin.y).attr("x2",(e)=>e.adjustedX2).attr("y2",(e)=>e.adjustedY2).attr("stroke",p.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${i})`);let I=z.append("g").attr("class","wardley-nodes").selectAll("g").data(m.nodes).enter().append("g").attr("class",(e)=>["wardley-node",e.className?`wardley-node--${e.className}`:""].filter(Boolean).join(" "));I.filter((e)=>e.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","#666").attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>e.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","#ccc").attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>e.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let G=I.filter((e)=>e.sourceStrategy==="market");G.append("circle").attr("class","wardley-market-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>!e.isPipelineParent&&e.sourceStrategy!=="market"&&e.className!=="anchor").append("circle").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1);let st=o.nodeRadius*0.7,N=o.nodeRadius*1.2;if(G.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x).attr("y1",(e)=>h.get(e.id).y-N).attr("x2",(e)=>h.get(e.id).x-N*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),G.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x-N*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x+N*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),G.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x+N*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x).attr("y2",(e)=>h.get(e.id).y-N).attr("stroke",p.componentStroke).attr("stroke-width",1),G.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y-N).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),G.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x-N*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),G.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x+N*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),I.filter((e)=>e.isPipelineParent===!0).append("rect").attr("x",(e)=>h.get(e.id).x-b/2).attr("y",(e)=>h.get(e.id).y-b/2).attr("width",b).attr("height",b).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>e.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b/2+15:o.nodeRadius+15;if(e.sourceStrategy)s+=o.nodeRadius+10;return d.x+s}).attr("y1",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b:o.nodeRadius*2;return d.y-s/2}).attr("x2",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b/2+15:o.nodeRadius+15;if(e.sourceStrategy)s+=o.nodeRadius+10;return d.x+s}).attr("y2",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b:o.nodeRadius*2;return d.y+s/2}).attr("stroke",p.componentStroke).attr("stroke-width",6),I.append("text").attr("x",(e)=>{let d=h.get(e.id);if(e.className==="anchor")return e.labelOffsetX!==void 0?d.x+e.labelOffsetX:d.x;let s=o.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetX===void 0)s+=10;let c=e.labelOffsetX??s;return d.x+c}).attr("y",(e)=>{let d=h.get(e.id);if(e.className==="anchor")return e.labelOffsetY!==void 0?d.y+e.labelOffsetY:d.y-3;let s=-o.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetY===void 0)s-=10;let c=e.labelOffsetY??s;return d.y+c}).attr("class","wardley-node-label").attr("fill",(e)=>{if(e.className==="evolved")return p.evolutionStroke;if(e.className==="anchor")return"#000";return p.componentLabelColor}).attr("font-size",o.labelFontSize).attr("font-weight",(e)=>e.className==="anchor"?"bold":"normal").attr("text-anchor",(e)=>e.className==="anchor"?"middle":"start").attr("dominant-baseline",(e)=>e.className==="anchor"?"middle":"auto").text((e)=>e.label),m.annotations.length>0){let e=z.append("g").attr("class","wardley-annotations");if(m.annotations.forEach((d)=>{let s=d.coordinates.map((c)=>({x:O(c.x),y:D(c.y)}));if(s.length>1)for(let c=0;c<s.length-1;c++)e.append("line").attr("class","wardley-annotation-line").attr("x1",s[c].x).attr("y1",s[c].y).attr("x2",s[c+1].x).attr("y2",s[c+1].y).attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach((c)=>{let f=e.append("g").attr("class","wardley-annotation");f.append("circle").attr("cx",c.x).attr("cy",c.y).attr("r",10).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5),f.append("text").attr("x",c.x).attr("y",c.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(d.number)})}),m.annotationsBox){let d=O(m.annotationsBox.x),s=D(m.annotationsBox.y),c=10,f=16,g=11,w=e.append("g").attr("class","wardley-annotations-box"),y=[...m.annotations].filter((v)=>v.text).sort((v,W)=>v.number-W.number),k=[];if(y.forEach((v,W)=>{let B=w.append("text").attr("x",d+c).attr("y",s+c+(W+1)*f).attr("font-size",g).attr("fill",p.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${v.number}. ${v.text}`);k.push(B)}),k.length>0){let v=0,W=0;k.forEach((it)=>{let rt=it.node(),Yt=rt.getComputedTextLength();v=Math.max(v,Yt);let It=rt.getBBox();W=Math.max(W,It.height)});let B=v+c*2+105,at=y.length*f+c*2+W/2,j=o.padding,Xt=Y-o.padding-B,Et=o.padding,Ht=M-o.padding-at;d=Math.max(j,Math.min(d,Xt)),s=Math.max(Et,Math.min(s,Ht)),k.forEach((it,rt)=>{it.attr("x",d+c).attr("y",s+c+(rt+1)*f)}),w.insert("rect","text").attr("x",d).attr("y",s).attr("width",B).attr("height",at).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(m.notes.length>0){let e=z.append("g").attr("class","wardley-notes");m.notes.forEach((d)=>{let s=O(d.x),c=D(d.y);e.append("text").attr("x",s).attr("y",c).attr("text-anchor","start").attr("font-size",11).attr("fill",p.axisTextColor).attr("font-weight","bold").text(d.text)})}if(m.accelerators.length>0){let e=z.append("g").attr("class","wardley-accelerators");m.accelerators.forEach((d)=>{let s=O(d.x),c=D(d.y),f=60,g=30,w=20,y=`
|
|
1
|
+
import{H}from"./chunk-p79c7aak.js";import{t,a,we,x,F,C,S,E,T,A,L,R,l,V,j}from"./chunk-zsat72qd.js";import{J}from"./chunk-p4pqtybm.js";var ot=t((r,i)=>{let n=r<=1?r*100:r;if(n<0||n>100)throw Error(`${i} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${r}`);return n},"toPercent"),q=t((r,i,n)=>({x:ot(i,`${n} evolution`),y:ot(r,`${n} visibility`)}),"toCoordinates"),pt=t((r)=>{if(!r)return;if(r==="+<>")return"bidirectional";if(r==="+<")return"backward";if(r==="+>")return"forward";return},"getFlowFromPort"),Bt=t((r)=>{if(!r?.startsWith("+"))return{};let n=/^\+'([^']*)'/.exec(r)?.[1];if(r.includes("<>"))return{flow:"bidirectional",label:n};if(r.includes("<"))return{flow:"backward",label:n};if(r.includes(">"))return{flow:"forward",label:n};return{label:n}},"extractFlowFromArrow"),Ft=t((r,i)=>{if(H(r,i),r.size)i.setSize(r.size.width,r.size.height);if(r.evolution){let n=r.evolution.stages.map((o)=>{if(o.secondName)return`${o.name.trim()} / ${o.secondName.trim()}`;return o.name.trim()}),u=r.evolution.stages.filter((o)=>o.boundary!==void 0).map((o)=>o.boundary);i.updateAxes({stages:n,stageBoundaries:u})}if(r.anchors.forEach((n)=>{let u=q(n.visibility,n.evolution,`Anchor "${n.name}"`);i.addNode(n.name,n.name,u.x,u.y,"anchor")}),r.components.forEach((n)=>{let u=q(n.visibility,n.evolution,`Component "${n.name}"`),o=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,p=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,b=n.decorator?.strategy;i.addNode(n.name,n.name,u.x,u.y,"component",o,p,n.inertia,b)}),r.notes.forEach((n)=>{let u=q(n.visibility,n.evolution,`Note "${n.text}"`);i.addNote(n.text,u.x,u.y)}),r.pipelines.forEach((n)=>{let u=i.getNode(n.parent);if(!u||typeof u.y!=="number")throw Error(`Pipeline "${n.parent}" must reference an existing component with coordinates.`);let o=u.y;i.startPipeline(n.parent),n.components.forEach((p)=>{let b=`${n.parent}_${p.name}`,X=p.label?(p.label.negX?-1:1)*p.label.offsetX:void 0,m=p.label?(p.label.negY?-1:1)*p.label.offsetY:void 0,tt=ot(p.evolution,`Pipeline component "${p.name}" evolution`);i.addNode(b,p.name,tt,o,"pipeline-component",X,m),i.addPipelineComponent(n.parent,b)})}),r.links.forEach((n)=>{let u=!!n.arrow&&(n.arrow.includes("-.->")||n.arrow.includes(".-.")),o=pt(n.fromPort)??pt(n.toPort),{flow:p,label:b}=Bt(n.arrow);if(!o&&p)o=p;let X=n.linkLabel,m=b??X;i.addLink(i.resolveNodeId(n.from),i.resolveNodeId(n.to),u,m,o)}),r.evolves.forEach((n)=>{let u=i.getNode(n.component);if(u?.y!==void 0){let o=ot(n.target,`Evolve target for "${n.component}"`);i.addTrend(n.component,o,u.y)}}),r.annotations.length>0){let n=r.annotations[0],u=q(n.x,n.y,"Annotations box");i.setAnnotationsBox(u.x,u.y)}r.annotation.forEach((n)=>{let u=q(n.x,n.y,`Annotation ${n.number}`);i.addAnnotation(n.number,[{x:u.x,y:u.y}],n.text)}),r.accelerators.forEach((n)=>{let u=q(n.x,n.y,`Accelerator "${n.name}"`);i.addAccelerator(n.name,u.x,u.y)}),r.deaccelerators.forEach((n)=>{let u=q(n.x,n.y,`Deaccelerator "${n.name}"`);i.addDeaccelerator(n.name,u.x,u.y)})},"populateDb"),ht={parser:{yy:void 0},parse:t(async(r)=>{let i=await J("wardley",r);a.debug(i);let n=ht.parser?.yy;if(!n||typeof n.addNode!=="function")throw 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.");Ft(i,n)},"parse")},Rt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{t(this,"WardleyBuilder")}addNode(r){let i=this.nodes.get(r.id)??{id:r.id,label:r.label},n={...i,...r,className:r.className??i.className,labelOffsetX:r.labelOffsetX??i.labelOffsetX,labelOffsetY:r.labelOffsetY??i.labelOffsetY};this.nodes.set(r.id,n)}addLink(r){this.links.push(r)}addTrend(r){this.trends.set(r.nodeId,r)}startPipeline(r){this.pipelines.set(r,{nodeId:r,componentIds:[]});let i=this.nodes.get(r);if(i)i.isPipelineParent=!0}addPipelineComponent(r,i){let n=this.pipelines.get(r);if(n)n.componentIds.push(i);let u=this.nodes.get(i);if(u)u.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,i){this.annotationsBox={x:r,y:i}}setAxes(r){this.axes={...this.axes,...r}}setSize(r,i){this.size={width:r,height:i}}getNode(r){return this.nodes.get(r)}resolveNodeId(r){if(this.nodes.has(r))return r;for(let[i,n]of this.nodes)if(n.label===r)return i;return r}build(){let r=[];for(let i of this.nodes.values()){if(typeof i.x!=="number"||typeof i.y!=="number")throw Error(`Node "${i.label}" is missing coordinates`);r.push(i)}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}},P=new Rt;function ft(){return l()["wardley-beta"]}t(ft,"getConfig");function xt(r,i,n,u,o,p,b,X,m){P.addNode({id:r,label:i,x:n,y:u,className:o,labelOffsetX:p,labelOffsetY:b,inertia:X,sourceStrategy:m})}t(xt,"addNode");function gt(r,i,n=!1,u,o){P.addLink({source:r,target:i,dashed:n,label:u,flow:o})}t(gt,"addLink");function yt(r,i,n){P.addTrend({nodeId:r,targetX:i,targetY:n})}t(yt,"addTrend");function ut(r,i,n){P.addAnnotation({number:r,coordinates:i,text:n})}t(ut,"addAnnotation");function wt(r,i,n){P.addNote({text:r,x:i,y:n})}t(wt,"addNote");function mt(r,i,n){P.addAccelerator({name:r,x:i,y:n})}t(mt,"addAccelerator");function kt(r,i,n){P.addDeaccelerator({name:r,x:i,y:n})}t(kt,"addDeaccelerator");function bt(r,i){P.setAnnotationsBox(r,i)}t(bt,"setAnnotationsBox");function $t(r,i){P.setSize(r,i)}t($t,"setSize");function vt(r){P.startPipeline(r)}t(vt,"startPipeline");function Pt(r,i){P.addPipelineComponent(r,i)}t(Pt,"addPipelineComponent");function Ct(r){P.setAxes(r)}t(Ct,"updateAxes");function St(r){return P.getNode(r)}t(St,"getNode");function Mt(r){return P.resolveNodeId(r)}t(Mt,"resolveNodeId");function Nt(){return P.build()}t(Nt,"getWardleyData");function zt(){P.clear(),C()}t(zt,"clear");var Ot={getConfig:ft,addNode:xt,addLink:gt,addTrend:yt,addAnnotation:ut,addNote:wt,addAccelerator:mt,addDeaccelerator:kt,setAnnotationsBox:bt,setSize:$t,startPipeline:vt,addPipelineComponent:Pt,updateAxes:Ct,getNode:St,resolveNodeId:Mt,getWardleyData:Nt,clear:zt,setAccTitle:S,getAccTitle:E,setDiagramTitle:L,getDiagramTitle:R,getAccDescription:A,setAccDescription:T},Dt=["Genesis","Custom Built","Product","Commodity"],Gt=t(()=>{let{themeVariables:r}=l();return{backgroundColor:r.wardley?.backgroundColor??r.background??"#fff",axisColor:r.wardley?.axisColor??"#000",axisTextColor:r.wardley?.axisTextColor??r.primaryTextColor??"#222",gridColor:r.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:r.wardley?.componentFill??"#fff",componentStroke:r.wardley?.componentStroke??"#000",componentLabelColor:r.wardley?.componentLabelColor??r.primaryTextColor??"#222",linkStroke:r.wardley?.linkStroke??"#000",evolutionStroke:r.wardley?.evolutionStroke??"#dc3545",annotationStroke:r.wardley?.annotationStroke??"#000",annotationTextColor:r.wardley?.annotationTextColor??r.primaryTextColor??"#222",annotationFill:r.wardley?.annotationFill??r.background??"#fff"}},"getTheme"),qt=t(()=>{let r=l()["wardley-beta"];return{width:r?.width??900,height:r?.height??600,padding:r?.padding??48,nodeRadius:r?.nodeRadius??6,nodeLabelOffset:r?.nodeLabelOffset??8,axisFontSize:r?.axisFontSize??12,labelFontSize:r?.labelFontSize??10,showGrid:r?.showGrid??!1,useMaxWidth:r?.useMaxWidth??!0}},"getConfigValues"),jt=t((r,i,n,u)=>{a.debug(`Rendering Wardley map
|
|
2
|
+
`+r);let o=qt(),p=Gt(),b=o.nodeRadius*1.6,X=u.db,m=X.getWardleyData(),tt=X.getDiagramTitle(),Y=m.size?.width??o.width,M=m.size?.height??o.height,Z=V(i);Z.selectAll("*").remove(),F(Z,M,Y,o.useMaxWidth),Z.attr("viewBox",`0 0 ${Y} ${M}`);let z=Z.append("g").attr("class","wardley-map"),nt=Z.append("defs");nt.append("marker").attr("id",`arrow-${i}`).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",p.evolutionStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-end-${i}`).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",p.linkStroke).attr("stroke","none"),nt.append("marker").attr("id",`link-arrow-start-${i}`).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",p.linkStroke).attr("stroke","none"),z.append("rect").attr("class","wardley-background").attr("width",Y).attr("height",M).attr("fill",p.backgroundColor);let U=Y-o.padding*2,K=M-o.padding*2;if(tt)z.append("text").attr("class","wardley-title").attr("x",Y/2).attr("y",o.padding/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(tt);let O=t((e)=>o.padding+e/100*U,"projectX"),D=t((e)=>M-o.padding-e/100*K,"projectY"),et=z.append("g").attr("class","wardley-axes");et.append("line").attr("x1",o.padding).attr("x2",Y-o.padding).attr("y1",M-o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1),et.append("line").attr("x1",o.padding).attr("x2",o.padding).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.axisColor).attr("stroke-width",1);let Lt=m.axes.xLabel??"Evolution",Tt=m.axes.yLabel??"Visibility";et.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",o.padding+U/2).attr("y",M-o.padding/4).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Lt),et.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",o.padding/3).attr("y",o.padding+K/2).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${o.padding/3} ${o.padding+K/2})`).text(Tt);let Q=m.axes.stages&&m.axes.stages.length>0?m.axes.stages:Dt;if(Q.length>0){let e=z.append("g").attr("class","wardley-stages"),d=m.axes.stageBoundaries,s=[];if(d&&d.length===Q.length){let c=0;d.forEach((f)=>{s.push({start:c,end:f}),c=f})}else{let c=1/Q.length;Q.forEach((f,g)=>{s.push({start:g*c,end:(g+1)*c})})}Q.forEach((c,f)=>{let g=s[f],w=o.padding+g.start*U,y=o.padding+g.end*U,k=(w+y)/2;if(f>0)e.append("line").attr("x1",w).attr("x2",w).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);e.append("text").attr("class","wardley-stage-label").attr("x",k).attr("y",M-o.padding/1.5).attr("fill",p.axisTextColor).attr("font-size",o.axisFontSize-2).attr("text-anchor","middle").text(c)})}if(o.showGrid){let e=z.append("g").attr("class","wardley-grid");for(let d=1;d<4;d++){let s=d/4,c=o.padding+U*s;e.append("line").attr("x1",c).attr("x2",c).attr("y1",o.padding).attr("y2",M-o.padding).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6"),e.append("line").attr("x1",o.padding).attr("x2",Y-o.padding).attr("y1",M-o.padding-K*s).attr("y2",M-o.padding-K*s).attr("stroke",p.gridColor).attr("stroke-dasharray","2 6")}}let h=new Map;if(m.nodes.forEach((e)=>{h.set(e.id,{x:O(e.x),y:D(e.y),node:e})}),m.pipelines.length>0){let e=z.append("g").attr("class","wardley-pipelines"),d=z.append("g").attr("class","wardley-pipeline-links");m.pipelines.forEach((s)=>{if(s.componentIds.length===0)return;let c=s.componentIds.map((y)=>({id:y,pos:h.get(y),node:m.nodes.find((k)=>k.id===y)})).filter((y)=>y.pos&&y.node).sort((y,k)=>y.node.x-k.node.x);for(let y=0;y<c.length-1;y++){let k=c[y],v=c[y+1];d.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",k.pos.x).attr("y1",k.pos.y).attr("x2",v.pos.x).attr("y2",v.pos.y).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let f=1/0,g=-1/0,w=0;if(s.componentIds.forEach((y)=>{let k=h.get(y);if(k)f=Math.min(f,k.x),g=Math.max(g,k.x),w=k.y}),f!==1/0&&g!==-1/0){let k=o.nodeRadius*4,v=w-k/2,W=h.get(s.nodeId);if(W){let B=(f+g)/2;W.x=B,W.y=v-b/6}e.append("rect").attr("class","wardley-pipeline-box").attr("x",f-15).attr("y",v).attr("width",g-f+30).attr("height",k).attr("fill","none").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let dt=z.append("g").attr("class","wardley-links"),lt=new Map;m.pipelines.forEach((e)=>{lt.set(e.nodeId,new Set(e.componentIds))});let ct=m.links.filter((e)=>{if(!h.has(e.source)||!h.has(e.target))return!1;if(lt.get(e.target)?.has(e.source))return!1;return!0});dt.selectAll("line").data(ct).enter().append("line").attr("class",(e)=>`wardley-link${e.dashed?" wardley-link--dashed":""}`).attr("x1",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.source).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=s.x-d.x,w=s.y-d.y,y=Math.sqrt(g*g+w*w);return d.x+g/y*f}).attr("y1",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.source).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=s.x-d.x,w=s.y-d.y,y=Math.sqrt(g*g+w*w);return d.y+w/y*f}).attr("x2",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.target).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=d.x-s.x,w=d.y-s.y,y=Math.sqrt(g*g+w*w);return s.x+g/y*f}).attr("y2",(e)=>{let d=h.get(e.source),s=h.get(e.target),f=m.nodes.find((k)=>k.id===e.target).isPipelineParent?b/Math.sqrt(2):o.nodeRadius,g=d.x-s.x,w=d.y-s.y,y=Math.sqrt(g*g+w*w);return s.y+w/y*f}).attr("stroke",p.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(e)=>e.dashed?"6 6":null).attr("marker-end",(e)=>{if(e.flow==="forward"||e.flow==="bidirectional")return`url(#link-arrow-end-${i})`;return null}).attr("marker-start",(e)=>{if(e.flow==="backward"||e.flow==="bidirectional")return`url(#link-arrow-start-${i})`;return null}),dt.selectAll("text").data(ct.filter((e)=>e.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(e)=>{let d=h.get(e.source),s=h.get(e.target),c=(d.x+s.x)/2,f=s.y-d.y,g=s.x-d.x,w=Math.sqrt(g*g+f*f),y=8,k=f/w;return c+k*8}).attr("y",(e)=>{let d=h.get(e.source),s=h.get(e.target),c=(d.y+s.y)/2,f=s.x-d.x,g=s.y-d.y,w=Math.sqrt(f*f+g*g),y=8,k=-f/w;return c+k*8}).attr("fill",p.axisTextColor).attr("font-size",o.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(e)=>{let d=h.get(e.source),s=h.get(e.target),c=(d.x+s.x)/2,f=(d.y+s.y)/2,g=s.x-d.x,w=s.y-d.y,y=Math.sqrt(g*g+w*w),k=8,v=w/y,W=-g/y,B=c+v*8,at=f+W*8,_=Math.atan2(w,g)*180/Math.PI;if(_>90||_<-90)_+=180;return`rotate(${_} ${B} ${at})`}).text((e)=>e.label);let Wt=z.append("g").attr("class","wardley-trends"),At=m.trends.map((e)=>{let d=h.get(e.nodeId);if(!d)return null;let s=O(e.targetX),c=D(e.targetY),f=s-d.x,g=c-d.y,w=Math.sqrt(f*f+g*g),y=o.nodeRadius+2,k=w>y?s-f/w*y:s,v=w>y?c-g/w*y:c;return{origin:d,targetX:s,targetY:c,adjustedX2:k,adjustedY2:v}}).filter((e)=>e!==null);Wt.selectAll("line").data(At).enter().append("line").attr("class","wardley-trend").attr("x1",(e)=>e.origin.x).attr("y1",(e)=>e.origin.y).attr("x2",(e)=>e.adjustedX2).attr("y2",(e)=>e.adjustedY2).attr("stroke",p.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${i})`);let I=z.append("g").attr("class","wardley-nodes").selectAll("g").data(m.nodes).enter().append("g").attr("class",(e)=>["wardley-node",e.className?`wardley-node--${e.className}`:""].filter(Boolean).join(" "));I.filter((e)=>e.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","#666").attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>e.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","#ccc").attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>e.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let G=I.filter((e)=>e.sourceStrategy==="market");G.append("circle").attr("class","wardley-market-overlay").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius*2).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>!e.isPipelineParent&&e.sourceStrategy!=="market"&&e.className!=="anchor").append("circle").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y).attr("r",o.nodeRadius).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1);let st=o.nodeRadius*0.7,N=o.nodeRadius*1.2;if(G.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x).attr("y1",(e)=>h.get(e.id).y-N).attr("x2",(e)=>h.get(e.id).x-N*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),G.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x-N*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x+N*Math.cos(Math.PI/6)).attr("y2",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("stroke",p.componentStroke).attr("stroke-width",1),G.append("line").attr("class","wardley-market-line").attr("x1",(e)=>h.get(e.id).x+N*Math.cos(Math.PI/6)).attr("y1",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("x2",(e)=>h.get(e.id).x).attr("y2",(e)=>h.get(e.id).y-N).attr("stroke",p.componentStroke).attr("stroke-width",1),G.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x).attr("cy",(e)=>h.get(e.id).y-N).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),G.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x-N*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),G.append("circle").attr("class","wardley-market-dot").attr("cx",(e)=>h.get(e.id).x+N*Math.cos(Math.PI/6)).attr("cy",(e)=>h.get(e.id).y+N*Math.sin(Math.PI/6)).attr("r",st).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",2),I.filter((e)=>e.isPipelineParent===!0).append("rect").attr("x",(e)=>h.get(e.id).x-b/2).attr("y",(e)=>h.get(e.id).y-b/2).attr("width",b).attr("height",b).attr("fill",p.componentFill).attr("stroke",p.componentStroke).attr("stroke-width",1),I.filter((e)=>e.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b/2+15:o.nodeRadius+15;if(e.sourceStrategy)s+=o.nodeRadius+10;return d.x+s}).attr("y1",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b:o.nodeRadius*2;return d.y-s/2}).attr("x2",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b/2+15:o.nodeRadius+15;if(e.sourceStrategy)s+=o.nodeRadius+10;return d.x+s}).attr("y2",(e)=>{let d=h.get(e.id),s=e.isPipelineParent?b:o.nodeRadius*2;return d.y+s/2}).attr("stroke",p.componentStroke).attr("stroke-width",6),I.append("text").attr("x",(e)=>{let d=h.get(e.id);if(e.className==="anchor")return e.labelOffsetX!==void 0?d.x+e.labelOffsetX:d.x;let s=o.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetX===void 0)s+=10;let c=e.labelOffsetX??s;return d.x+c}).attr("y",(e)=>{let d=h.get(e.id);if(e.className==="anchor")return e.labelOffsetY!==void 0?d.y+e.labelOffsetY:d.y-3;let s=-o.nodeLabelOffset;if(e.sourceStrategy&&e.labelOffsetY===void 0)s-=10;let c=e.labelOffsetY??s;return d.y+c}).attr("class","wardley-node-label").attr("fill",(e)=>{if(e.className==="evolved")return p.evolutionStroke;if(e.className==="anchor")return"#000";return p.componentLabelColor}).attr("font-size",o.labelFontSize).attr("font-weight",(e)=>e.className==="anchor"?"bold":"normal").attr("text-anchor",(e)=>e.className==="anchor"?"middle":"start").attr("dominant-baseline",(e)=>e.className==="anchor"?"middle":"auto").text((e)=>e.label),m.annotations.length>0){let e=z.append("g").attr("class","wardley-annotations");if(m.annotations.forEach((d)=>{let s=d.coordinates.map((c)=>({x:O(c.x),y:D(c.y)}));if(s.length>1)for(let c=0;c<s.length-1;c++)e.append("line").attr("class","wardley-annotation-line").attr("x1",s[c].x).attr("y1",s[c].y).attr("x2",s[c+1].x).attr("y2",s[c+1].y).attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach((c)=>{let f=e.append("g").attr("class","wardley-annotation");f.append("circle").attr("cx",c.x).attr("cy",c.y).attr("r",10).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5),f.append("text").attr("x",c.x).attr("y",c.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(d.number)})}),m.annotationsBox){let d=O(m.annotationsBox.x),s=D(m.annotationsBox.y),c=10,f=16,g=11,w=e.append("g").attr("class","wardley-annotations-box"),y=[...m.annotations].filter((v)=>v.text).sort((v,W)=>v.number-W.number),k=[];if(y.forEach((v,W)=>{let B=w.append("text").attr("x",d+c).attr("y",s+c+(W+1)*f).attr("font-size",g).attr("fill",p.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${v.number}. ${v.text}`);k.push(B)}),k.length>0){let v=0,W=0;k.forEach((it)=>{let rt=it.node(),Yt=rt.getComputedTextLength();v=Math.max(v,Yt);let It=rt.getBBox();W=Math.max(W,It.height)});let B=v+c*2+105,at=y.length*f+c*2+W/2,_=o.padding,Xt=Y-o.padding-B,Et=o.padding,Ht=M-o.padding-at;d=Math.max(_,Math.min(d,Xt)),s=Math.max(Et,Math.min(s,Ht)),k.forEach((it,rt)=>{it.attr("x",d+c).attr("y",s+c+(rt+1)*f)}),w.insert("rect","text").attr("x",d).attr("y",s).attr("width",B).attr("height",at).attr("fill","white").attr("stroke",p.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(m.notes.length>0){let e=z.append("g").attr("class","wardley-notes");m.notes.forEach((d)=>{let s=O(d.x),c=D(d.y);e.append("text").attr("x",s).attr("y",c).attr("text-anchor","start").attr("font-size",11).attr("fill",p.axisTextColor).attr("font-weight","bold").text(d.text)})}if(m.accelerators.length>0){let e=z.append("g").attr("class","wardley-accelerators");m.accelerators.forEach((d)=>{let s=O(d.x),c=D(d.y),f=60,g=30,w=20,y=`
|
|
3
3
|
M ${s} ${c-15}
|
|
4
4
|
L ${s+60-20} ${c-15}
|
|
5
5
|
L ${s+60-20} ${c-15-8}
|
|
@@ -17,7 +17,7 @@ import{H}from"./chunk-ba9qy65y.js";import{t,a,we,x,F,C,S,E,T,A,L,R,l,V,U}from"./
|
|
|
17
17
|
L ${s+20} ${c+15}
|
|
18
18
|
L ${s+60} ${c+15}
|
|
19
19
|
Z
|
|
20
|
-
`;e.append("path").attr("d",y).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),e.append("text").attr("x",s+30).attr("y",c+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(d.name)})}},"draw"),Vt={draw:jt},_t=t(({wardley:r}={})=>{let i=we(),n=x(),u=
|
|
20
|
+
`;e.append("path").attr("d",y).attr("fill","white").attr("stroke",p.componentStroke).attr("stroke-width",1),e.append("text").attr("x",s+30).attr("y",c+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",p.axisTextColor).attr("font-weight","bold").text(d.name)})}},"draw"),Vt={draw:jt},_t=t(({wardley:r}={})=>{let i=we(),n=x(),u=j(i,n.themeVariables),o=j(u.wardley,r);return`
|
|
21
21
|
.wardley-background {
|
|
22
22
|
fill: ${o.backgroundColor};
|
|
23
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{hn}from"./chunk-0rvwj2wh.js";import{H}from"./chunk-ba9qy65y.js";import{t,a,N,x,b,C,S,E,T,A,L,R,l,kr,p,Zi,U,M}from"./chunk-c6m4vfn5.js";import{J}from"./chunk-a9er7a7c.js";var v={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Ce=N.gitGraph,X=t(()=>U({...Ce,...x().gitGraph}),"getConfig"),m=new hn(()=>{let e=X(),{mainBranchName:r,mainBranchOrder:o}=e;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:o}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function ne(){return Zi({length:7})}t(ne,"getID");function pe(e,r){let o=Object.create(null);return e.reduce((c,i)=>{let h=r(i);if(!o[h])o[h]=!0,c.push(i);return c},[])}t(pe,"uniqBy");var ve=t(function(e){m.records.direction=e},"setDirection"),Ee=t(function(e){a.debug("options str",e),e=e?.trim(),e=e||"{}";try{m.records.options=JSON.parse(e)}catch(r){a.error("error while parsing gitGraph options",r.message)}},"setOptions"),Te=t(function(){return m.records.options},"getOptions"),Le=t(function(e){let{msg:r,id:o,type:c,tags:i}=e;a.info("commit",r,o,c,i),a.debug("Entering commit:",r,o,c,i);let h=X();o=b.sanitizeText(o,h),r=b.sanitizeText(r,h),i=i?.map((s)=>b.sanitizeText(s,h));let n={id:o?o:m.records.seq+"-"+ne(),message:r,seq:m.records.seq++,type:c??v.NORMAL,tags:i??[],parents:m.records.head==null?[]:[m.records.head.id],branch:m.records.currBranch};if(m.records.head=n,a.info("main branch",h.mainBranchName),m.records.commits.has(n.id))a.warn(`Commit ID ${n.id} already exists`);m.records.commits.set(n.id,n),m.records.branches.set(m.records.currBranch,n.id),a.debug("in pushCommit "+n.id)},"commit"),Me=t(function(e){let{name:r,order:o}=e;if(r=b.sanitizeText(r,X()),m.records.branches.has(r))throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);m.records.branches.set(r,m.records.head!=null?m.records.head.id:null),m.records.branchConfig.set(r,{name:r,order:o}),ye(r),a.debug("in createBranch")},"branch"),Pe=t((e)=>{let{branch:r,id:o,type:c,tags:i}=e,h=X();if(r=b.sanitizeText(r,h),o)o=b.sanitizeText(o,h);let n=m.records.branches.get(m.records.currBranch),s=m.records.branches.get(r),g=n?m.records.commits.get(n):void 0,y=s?m.records.commits.get(s):void 0;if(g&&y&&g.branch===r)throw Error(`Cannot merge branch '${r}' into itself.`);if(m.records.currBranch===r){let d=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},d}if(g===void 0||!g){let d=Error(`Incorrect usage of "merge". Current branch (${m.records.currBranch})has no commits`);throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},d}if(!m.records.branches.has(r)){let d=Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},d}if(y===void 0||!y){let d=Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},d}if(g===y){let d=Error('Incorrect usage of "merge". Both branches have same head');throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},d}if(o&&m.records.commits.has(o)){let d=Error('Incorrect usage of "merge". Commit with id:'+o+" already exists, use different custom id");throw d.hash={text:`merge ${r} ${o} ${c} ${i?.join(" ")}`,token:`merge ${r} ${o} ${c} ${i?.join(" ")}`,expected:[`merge ${r} ${o}_UNIQUE ${c} ${i?.join(" ")}`]},d}let u=s?s:"",f={id:o||`${m.records.seq}-${ne()}`,message:`merged branch ${r} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,u],branch:m.records.currBranch,type:v.MERGE,customType:c,customId:o?!0:!1,tags:i??[]};m.records.head=f,m.records.commits.set(f.id,f),m.records.branches.set(m.records.currBranch,f.id),a.debug(m.records.branches),a.debug("in mergeBranch")},"merge"),Re=t(function(e){let{id:r,targetId:o,tags:c,parent:i}=e;a.debug("Entering cherryPick:",r,o,c);let h=X();if(r=b.sanitizeText(r,h),o=b.sanitizeText(o,h),c=c?.map((g)=>b.sanitizeText(g,h)),i=b.sanitizeText(i,h),!r||!m.records.commits.has(r)){let g=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw g.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},g}let n=m.records.commits.get(r);if(n===void 0||!n)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(i&&!(Array.isArray(n.parents)&&n.parents.includes(i)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let s=n.branch;if(n.type===v.MERGE&&!i)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!o||!m.records.commits.has(o)){if(s===m.records.currBranch){let f=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},f}let g=m.records.branches.get(m.records.currBranch);if(g===void 0||!g){let f=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},f}let y=m.records.commits.get(g);if(y===void 0||!y){let f=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},f}let u={id:m.records.seq+"-"+ne(),message:`cherry-picked ${n?.message} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,n.id],branch:m.records.currBranch,type:v.CHERRY_PICK,tags:c?c.filter(Boolean):[`cherry-pick:${n.id}${n.type===v.MERGE?`|parent:${i}`:""}`]};m.records.head=u,m.records.commits.set(u.id,u),m.records.branches.set(m.records.currBranch,u.id),a.debug(m.records.branches),a.debug("in cherryPick")}},"cherryPick"),ye=t(function(e){if(e=b.sanitizeText(e,X()),!m.records.branches.has(e)){let r=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}else{m.records.currBranch=e;let r=m.records.branches.get(m.records.currBranch);if(r===void 0||!r)m.records.head=null;else m.records.head=m.records.commits.get(r)??null}},"checkout");function he(e,r,o){let c=e.indexOf(r);if(c===-1)e.push(o);else e.splice(c,1,o)}t(he,"upsert");function me(e){let r=e.reduce((i,h)=>{if(i.seq>h.seq)return i;return h},e[0]),o="";e.forEach(function(i){if(i===r)o+="\t*";else o+="\t|"});let c=[o,r.id,r.seq];for(let i in m.records.branches)if(m.records.branches.get(i)===r.id)c.push(i);if(a.debug(c.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){let i=m.records.commits.get(r.parents[0]);if(he(e,r,i),r.parents[1])e.push(m.records.commits.get(r.parents[1]))}else if(r.parents.length==0)return;else if(r.parents[0]){let i=m.records.commits.get(r.parents[0]);he(e,r,i)}e=pe(e,(i)=>i.id),me(e)}t(me,"prettyPrintCommitHistory");var Oe=t(function(){a.debug(m.records.commits);let e=xe()[0];me([e])},"prettyPrint"),Ie=t(function(){m.reset(),C()},"clear"),_e=t(function(){return[...m.records.branchConfig.values()].map((r,o)=>{if(r.order!==null&&r.order!==void 0)return r;return{...r,order:parseFloat(`0.${o}`)}}).sort((r,o)=>(r.order??0)-(o.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Ge=t(function(){return m.records.branches},"getBranches"),De=t(function(){return m.records.commits},"getCommits"),xe=t(function(){let e=[...m.records.commits.values()];return e.forEach(function(r){a.debug(r.id)}),e.sort((r,o)=>r.seq-o.seq),e},"getCommitsArray"),We=t(function(){return m.records.currBranch},"getCurrentBranch"),qe=t(function(){return m.records.direction},"getDirection"),Ae=t(function(){return m.records.head},"getHead"),ue={commitType:v,getConfig:X,setDirection:ve,setOptions:Ee,getOptions:Te,commit:Le,branch:Me,merge:Pe,cherryPick:Re,checkout:ye,prettyPrint:Oe,clear:Ie,getBranchesAsObjArray:_e,getBranches:Ge,getCommits:De,getCommitsArray:xe,getCurrentBranch:We,getDirection:qe,getHead:Ae,setAccTitle:S,getAccTitle:E,getAccDescription:A,setAccDescription:T,setDiagramTitle:L,getDiagramTitle:R},He=t((e,r)=>{if(H(e,r),e.dir)r.setDirection(e.dir);for(let o of e.statements)Se(o,r)},"populate"),Se=t((e,r)=>{let c={Commit:t((i)=>r.commit(Ne(i)),"Commit"),Branch:t((i)=>r.branch(Fe(i)),"Branch"),Merge:t((i)=>r.merge(ze(i)),"Merge"),Checkout:t((i)=>r.checkout(Ye(i)),"Checkout"),CherryPicking:t((i)=>r.cherryPick(je(i)),"CherryPicking")}[e.$type];if(c)c(e);else a.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ne=t((e)=>({id:e.id,msg:e.message??"",type:e.type!==void 0?v[e.type]:v.NORMAL,tags:e.tags??void 0}),"parseCommit"),Fe=t((e)=>({name:e.name,order:e.order??0}),"parseBranch"),ze=t((e)=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?v[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ye=t((e)=>e.branch,"parseCheckout"),je=t((e)=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),Ke={parse:t(async(e)=>{let r=await J("gitGraph",e);a.debug(r),He(r,ue)},"parse")},j=10,K=40,q=4,z=2,V=8,ce=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),le=12,ge=new Set(["redux-color","redux-dark-color"]),Ue=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),Z=t((e,r,o=!1)=>{if(o&&e>0)return(e-1)%(r-1)+1;return e%r},"calcColorIndex"),G=new Map,D=new Map,oe=30,te=new Map,se=[],Y=0,B="LR",Ve=t(()=>{G.clear(),D.clear(),te.clear(),Y=0,se=[],B="LR"},"clear"),be=t((e)=>{let r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e==="string"?e.split(/\\n|\n|<br\s*\/?>/gi):e).forEach((c)=>{let i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),i.setAttribute("dy","1em"),i.setAttribute("x","0"),i.setAttribute("class","row"),i.textContent=c.trim(),r.appendChild(i)}),r},"drawText"),we=t((e)=>{let r,o,c;if(B==="BT")o=t((i,h)=>i<=h,"comparisonFunc"),c=1/0;else o=t((i,h)=>i>=h,"comparisonFunc"),c=0;return e.forEach((i)=>{let h=B==="TB"||B=="BT"?D.get(i)?.y:D.get(i)?.x;if(h!==void 0&&o(h,c))r=i,c=h}),r},"findClosestParent"),Ze=t((e)=>{let r="",o=1/0;return e.forEach((c)=>{let i=D.get(c).y;if(i<=o)r=c,o=i}),r||void 0},"findClosestParentBT"),Xe=t((e,r,o)=>{let c=o,i=o,h=[];e.forEach((n)=>{let s=r.get(n);if(!s)throw Error(`Commit not found for key ${n}`);if(s.parents.length)c=Qe(s),i=Math.max(c,i);else h.push(s);et(s,c)}),c=i,h.forEach((n)=>{tt(n,c,o)}),e.forEach((n)=>{let s=r.get(n);if(s?.parents.length){let g=Ze(s.parents);if(c=D.get(g).y-K,c<=i)i=c;let y=G.get(s.branch).pos,u=c-j;D.set(s.id,{x:y,y:u})}})},"setParallelBTPos"),Je=t((e)=>{let r=we(e.parents.filter((c)=>c!==null));if(!r)throw Error(`Closest parent not found for commit ${e.id}`);let o=D.get(r)?.y;if(o===void 0)throw Error(`Closest parent position not found for commit ${e.id}`);return o},"findClosestParentPos"),Qe=t((e)=>Je(e)+K,"calculateCommitPosition"),et=t((e,r)=>{let o=G.get(e.branch);if(!o)throw Error(`Branch not found for commit ${e.id}`);let c=o.pos,i=r+j;return D.set(e.id,{x:c,y:i}),{x:c,y:i}},"setCommitPosition"),tt=t((e,r,o)=>{let c=G.get(e.branch);if(!c)throw Error(`Branch not found for commit ${e.id}`);let i=r+o,h=c.pos;D.set(e.id,{x:h,y:i})},"setRootPosition"),rt=t((e,r,o,c,i,h)=>{let{theme:n}=l(),s=ce.has(n??""),g=ge.has(n??""),y=Ue.has(n??"");if(h===v.HIGHLIGHT)e.append("rect").attr("x",o.x-10+(s?3:0)).attr("y",o.y-10+(s?3:0)).attr("width",s?14:20).attr("height",s?14:20).attr("class",`commit ${r.id} commit-highlight${Z(i,V,g)} ${c}-outer`),e.append("rect").attr("x",o.x-6+(s?2:0)).attr("y",o.y-6+(s?2:0)).attr("width",s?8:12).attr("height",s?8:12).attr("class",`commit ${r.id} commit${Z(i,V,g)} ${c}-inner`);else if(h===v.CHERRY_PICK)e.append("circle").attr("cx",o.x).attr("cy",o.y).attr("r",s?7:10).attr("class",`commit ${r.id} ${c}`),e.append("circle").attr("cx",o.x-3).attr("cy",o.y+2).attr("r",s?2.5:2.75).attr("fill",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`),e.append("circle").attr("cx",o.x+3).attr("cy",o.y+2).attr("r",s?2.5:2.75).attr("fill",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`),e.append("line").attr("x1",o.x+3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`),e.append("line").attr("x1",o.x-3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`);else{let u=e.append("circle");if(u.attr("cx",o.x),u.attr("cy",o.y),u.attr("r",s?7:10),u.attr("class",`commit ${r.id} commit${Z(i,V,g)}`),h===v.MERGE){let f=e.append("circle");f.attr("cx",o.x),f.attr("cy",o.y),f.attr("r",s?5:6),f.attr("class",`commit ${c} ${r.id} commit${Z(i,V,g)}`)}if(h===v.REVERSE){let f=e.append("path"),d=s?4:5;f.attr("d",`M ${o.x-d},${o.y-d}L${o.x+d},${o.y+d}M${o.x-d},${o.y+d}L${o.x+d},${o.y-d}`).attr("class",`commit ${c} ${r.id} commit${Z(i,V,g)}`)}}},"drawCommitBullet"),at=t((e,r,o,c,i)=>{if(r.type!==v.CHERRY_PICK&&(r.customId&&r.type===v.MERGE||r.type!==v.MERGE)&&i.showCommitLabel){let h=e.append("g"),n=h.insert("rect").attr("class","commit-label-bkg"),s=h.append("text").attr("x",c).attr("y",o.y+25).attr("class","commit-label").text(r.id),g=s.node()?.getBBox();if(g){if(n.attr("x",o.posWithOffset-g.width/2-z).attr("y",o.y+13.5).attr("width",g.width+2*z).attr("height",g.height+2*z),B==="TB"||B==="BT")n.attr("x",o.x-(g.width+4*q+5)).attr("y",o.y-12),s.attr("x",o.x-(g.width+4*q)).attr("y",o.y+g.height-12);else s.attr("x",o.posWithOffset-g.width/2);if(i.rotateCommitLabel)if(B==="TB"||B==="BT")s.attr("transform","rotate(-45, "+o.x+", "+o.y+")"),n.attr("transform","rotate(-45, "+o.x+", "+o.y+")");else{let y=-7.5-(g.width+10)/25*9.5,u=10+g.width/25*8.5;h.attr("transform","translate("+y+", "+u+") rotate(-45, "+c+", "+o.y+")")}}}},"drawCommitLabel"),ot=t((e,r,o,c)=>{if(r.tags.length>0){let i=0,h=0,n=0,s=[];for(let g of r.tags.reverse()){let y=e.insert("polygon"),u=e.append("circle"),f=e.append("text").attr("y",o.y-16-i).attr("class","tag-label").text(g),d=f.node()?.getBBox();if(!d)throw Error("Tag bbox not found");h=Math.max(h,d.width),n=Math.max(n,d.height),f.attr("x",o.posWithOffset-d.width/2),s.push({tag:f,hole:u,rect:y,yOffset:i}),i+=20}for(let{tag:g,hole:y,rect:u,yOffset:f}of s){let d=n/2,k=o.y-19.2-f;if(u.attr("class","tag-label-bkg").attr("points",`
|
|
1
|
+
import{gn}from"./chunk-ya696bfe.js";import{H}from"./chunk-p79c7aak.js";import{t,a,N,x,b,C,S,E,T,A,L,R,l,Sr,p,Ki,j,M}from"./chunk-zsat72qd.js";import{J}from"./chunk-p4pqtybm.js";var v={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Ce=N.gitGraph,X=t(()=>j({...Ce,...x().gitGraph}),"getConfig"),m=new gn(()=>{let e=X(),{mainBranchName:r,mainBranchOrder:o}=e;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:o}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function ne(){return Ki({length:7})}t(ne,"getID");function pe(e,r){let o=Object.create(null);return e.reduce((c,i)=>{let h=r(i);if(!o[h])o[h]=!0,c.push(i);return c},[])}t(pe,"uniqBy");var ve=t(function(e){m.records.direction=e},"setDirection"),Ee=t(function(e){a.debug("options str",e),e=e?.trim(),e=e||"{}";try{m.records.options=JSON.parse(e)}catch(r){a.error("error while parsing gitGraph options",r.message)}},"setOptions"),Te=t(function(){return m.records.options},"getOptions"),Le=t(function(e){let{msg:r,id:o,type:c,tags:i}=e;a.info("commit",r,o,c,i),a.debug("Entering commit:",r,o,c,i);let h=X();o=b.sanitizeText(o,h),r=b.sanitizeText(r,h),i=i?.map((s)=>b.sanitizeText(s,h));let n={id:o?o:m.records.seq+"-"+ne(),message:r,seq:m.records.seq++,type:c??v.NORMAL,tags:i??[],parents:m.records.head==null?[]:[m.records.head.id],branch:m.records.currBranch};if(m.records.head=n,a.info("main branch",h.mainBranchName),m.records.commits.has(n.id))a.warn(`Commit ID ${n.id} already exists`);m.records.commits.set(n.id,n),m.records.branches.set(m.records.currBranch,n.id),a.debug("in pushCommit "+n.id)},"commit"),Me=t(function(e){let{name:r,order:o}=e;if(r=b.sanitizeText(r,X()),m.records.branches.has(r))throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);m.records.branches.set(r,m.records.head!=null?m.records.head.id:null),m.records.branchConfig.set(r,{name:r,order:o}),ye(r),a.debug("in createBranch")},"branch"),Pe=t((e)=>{let{branch:r,id:o,type:c,tags:i}=e,h=X();if(r=b.sanitizeText(r,h),o)o=b.sanitizeText(o,h);let n=m.records.branches.get(m.records.currBranch),s=m.records.branches.get(r),g=n?m.records.commits.get(n):void 0,y=s?m.records.commits.get(s):void 0;if(g&&y&&g.branch===r)throw Error(`Cannot merge branch '${r}' into itself.`);if(m.records.currBranch===r){let d=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},d}if(g===void 0||!g){let d=Error(`Incorrect usage of "merge". Current branch (${m.records.currBranch})has no commits`);throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},d}if(!m.records.branches.has(r)){let d=Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},d}if(y===void 0||!y){let d=Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},d}if(g===y){let d=Error('Incorrect usage of "merge". Both branches have same head');throw d.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},d}if(o&&m.records.commits.has(o)){let d=Error('Incorrect usage of "merge". Commit with id:'+o+" already exists, use different custom id");throw d.hash={text:`merge ${r} ${o} ${c} ${i?.join(" ")}`,token:`merge ${r} ${o} ${c} ${i?.join(" ")}`,expected:[`merge ${r} ${o}_UNIQUE ${c} ${i?.join(" ")}`]},d}let u=s?s:"",f={id:o||`${m.records.seq}-${ne()}`,message:`merged branch ${r} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,u],branch:m.records.currBranch,type:v.MERGE,customType:c,customId:o?!0:!1,tags:i??[]};m.records.head=f,m.records.commits.set(f.id,f),m.records.branches.set(m.records.currBranch,f.id),a.debug(m.records.branches),a.debug("in mergeBranch")},"merge"),Re=t(function(e){let{id:r,targetId:o,tags:c,parent:i}=e;a.debug("Entering cherryPick:",r,o,c);let h=X();if(r=b.sanitizeText(r,h),o=b.sanitizeText(o,h),c=c?.map((g)=>b.sanitizeText(g,h)),i=b.sanitizeText(i,h),!r||!m.records.commits.has(r)){let g=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw g.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},g}let n=m.records.commits.get(r);if(n===void 0||!n)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(i&&!(Array.isArray(n.parents)&&n.parents.includes(i)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let s=n.branch;if(n.type===v.MERGE&&!i)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!o||!m.records.commits.has(o)){if(s===m.records.currBranch){let f=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},f}let g=m.records.branches.get(m.records.currBranch);if(g===void 0||!g){let f=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},f}let y=m.records.commits.get(g);if(y===void 0||!y){let f=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${r} ${o}`,token:`cherryPick ${r} ${o}`,expected:["cherry-pick abc"]},f}let u={id:m.records.seq+"-"+ne(),message:`cherry-picked ${n?.message} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,n.id],branch:m.records.currBranch,type:v.CHERRY_PICK,tags:c?c.filter(Boolean):[`cherry-pick:${n.id}${n.type===v.MERGE?`|parent:${i}`:""}`]};m.records.head=u,m.records.commits.set(u.id,u),m.records.branches.set(m.records.currBranch,u.id),a.debug(m.records.branches),a.debug("in cherryPick")}},"cherryPick"),ye=t(function(e){if(e=b.sanitizeText(e,X()),!m.records.branches.has(e)){let r=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}else{m.records.currBranch=e;let r=m.records.branches.get(m.records.currBranch);if(r===void 0||!r)m.records.head=null;else m.records.head=m.records.commits.get(r)??null}},"checkout");function he(e,r,o){let c=e.indexOf(r);if(c===-1)e.push(o);else e.splice(c,1,o)}t(he,"upsert");function me(e){let r=e.reduce((i,h)=>{if(i.seq>h.seq)return i;return h},e[0]),o="";e.forEach(function(i){if(i===r)o+="\t*";else o+="\t|"});let c=[o,r.id,r.seq];for(let i in m.records.branches)if(m.records.branches.get(i)===r.id)c.push(i);if(a.debug(c.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){let i=m.records.commits.get(r.parents[0]);if(he(e,r,i),r.parents[1])e.push(m.records.commits.get(r.parents[1]))}else if(r.parents.length==0)return;else if(r.parents[0]){let i=m.records.commits.get(r.parents[0]);he(e,r,i)}e=pe(e,(i)=>i.id),me(e)}t(me,"prettyPrintCommitHistory");var Oe=t(function(){a.debug(m.records.commits);let e=xe()[0];me([e])},"prettyPrint"),Ie=t(function(){m.reset(),C()},"clear"),_e=t(function(){return[...m.records.branchConfig.values()].map((r,o)=>{if(r.order!==null&&r.order!==void 0)return r;return{...r,order:parseFloat(`0.${o}`)}}).sort((r,o)=>(r.order??0)-(o.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Ge=t(function(){return m.records.branches},"getBranches"),De=t(function(){return m.records.commits},"getCommits"),xe=t(function(){let e=[...m.records.commits.values()];return e.forEach(function(r){a.debug(r.id)}),e.sort((r,o)=>r.seq-o.seq),e},"getCommitsArray"),We=t(function(){return m.records.currBranch},"getCurrentBranch"),qe=t(function(){return m.records.direction},"getDirection"),Ae=t(function(){return m.records.head},"getHead"),ue={commitType:v,getConfig:X,setDirection:ve,setOptions:Ee,getOptions:Te,commit:Le,branch:Me,merge:Pe,cherryPick:Re,checkout:ye,prettyPrint:Oe,clear:Ie,getBranchesAsObjArray:_e,getBranches:Ge,getCommits:De,getCommitsArray:xe,getCurrentBranch:We,getDirection:qe,getHead:Ae,setAccTitle:S,getAccTitle:E,getAccDescription:A,setAccDescription:T,setDiagramTitle:L,getDiagramTitle:R},He=t((e,r)=>{if(H(e,r),e.dir)r.setDirection(e.dir);for(let o of e.statements)Se(o,r)},"populate"),Se=t((e,r)=>{let c={Commit:t((i)=>r.commit(Ne(i)),"Commit"),Branch:t((i)=>r.branch(Fe(i)),"Branch"),Merge:t((i)=>r.merge(ze(i)),"Merge"),Checkout:t((i)=>r.checkout(Ye(i)),"Checkout"),CherryPicking:t((i)=>r.cherryPick(je(i)),"CherryPicking")}[e.$type];if(c)c(e);else a.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),Ne=t((e)=>({id:e.id,msg:e.message??"",type:e.type!==void 0?v[e.type]:v.NORMAL,tags:e.tags??void 0}),"parseCommit"),Fe=t((e)=>({name:e.name,order:e.order??0}),"parseBranch"),ze=t((e)=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?v[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ye=t((e)=>e.branch,"parseCheckout"),je=t((e)=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),Ke={parse:t(async(e)=>{let r=await J("gitGraph",e);a.debug(r),He(r,ue)},"parse")},K=10,U=40,q=4,z=2,V=8,ce=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),le=12,ge=new Set(["redux-color","redux-dark-color"]),Ue=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),Z=t((e,r,o=!1)=>{if(o&&e>0)return(e-1)%(r-1)+1;return e%r},"calcColorIndex"),G=new Map,D=new Map,oe=30,te=new Map,se=[],Y=0,B="LR",Ve=t(()=>{G.clear(),D.clear(),te.clear(),Y=0,se=[],B="LR"},"clear"),be=t((e)=>{let r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e==="string"?e.split(/\\n|\n|<br\s*\/?>/gi):e).forEach((c)=>{let i=document.createElementNS("http://www.w3.org/2000/svg","tspan");i.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),i.setAttribute("dy","1em"),i.setAttribute("x","0"),i.setAttribute("class","row"),i.textContent=c.trim(),r.appendChild(i)}),r},"drawText"),we=t((e)=>{let r,o,c;if(B==="BT")o=t((i,h)=>i<=h,"comparisonFunc"),c=1/0;else o=t((i,h)=>i>=h,"comparisonFunc"),c=0;return e.forEach((i)=>{let h=B==="TB"||B=="BT"?D.get(i)?.y:D.get(i)?.x;if(h!==void 0&&o(h,c))r=i,c=h}),r},"findClosestParent"),Ze=t((e)=>{let r="",o=1/0;return e.forEach((c)=>{let i=D.get(c).y;if(i<=o)r=c,o=i}),r||void 0},"findClosestParentBT"),Xe=t((e,r,o)=>{let c=o,i=o,h=[];e.forEach((n)=>{let s=r.get(n);if(!s)throw Error(`Commit not found for key ${n}`);if(s.parents.length)c=Qe(s),i=Math.max(c,i);else h.push(s);et(s,c)}),c=i,h.forEach((n)=>{tt(n,c,o)}),e.forEach((n)=>{let s=r.get(n);if(s?.parents.length){let g=Ze(s.parents);if(c=D.get(g).y-U,c<=i)i=c;let y=G.get(s.branch).pos,u=c-K;D.set(s.id,{x:y,y:u})}})},"setParallelBTPos"),Je=t((e)=>{let r=we(e.parents.filter((c)=>c!==null));if(!r)throw Error(`Closest parent not found for commit ${e.id}`);let o=D.get(r)?.y;if(o===void 0)throw Error(`Closest parent position not found for commit ${e.id}`);return o},"findClosestParentPos"),Qe=t((e)=>Je(e)+U,"calculateCommitPosition"),et=t((e,r)=>{let o=G.get(e.branch);if(!o)throw Error(`Branch not found for commit ${e.id}`);let c=o.pos,i=r+K;return D.set(e.id,{x:c,y:i}),{x:c,y:i}},"setCommitPosition"),tt=t((e,r,o)=>{let c=G.get(e.branch);if(!c)throw Error(`Branch not found for commit ${e.id}`);let i=r+o,h=c.pos;D.set(e.id,{x:h,y:i})},"setRootPosition"),rt=t((e,r,o,c,i,h)=>{let{theme:n}=l(),s=ce.has(n??""),g=ge.has(n??""),y=Ue.has(n??"");if(h===v.HIGHLIGHT)e.append("rect").attr("x",o.x-10+(s?3:0)).attr("y",o.y-10+(s?3:0)).attr("width",s?14:20).attr("height",s?14:20).attr("class",`commit ${r.id} commit-highlight${Z(i,V,g)} ${c}-outer`),e.append("rect").attr("x",o.x-6+(s?2:0)).attr("y",o.y-6+(s?2:0)).attr("width",s?8:12).attr("height",s?8:12).attr("class",`commit ${r.id} commit${Z(i,V,g)} ${c}-inner`);else if(h===v.CHERRY_PICK)e.append("circle").attr("cx",o.x).attr("cy",o.y).attr("r",s?7:10).attr("class",`commit ${r.id} ${c}`),e.append("circle").attr("cx",o.x-3).attr("cy",o.y+2).attr("r",s?2.5:2.75).attr("fill",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`),e.append("circle").attr("cx",o.x+3).attr("cy",o.y+2).attr("r",s?2.5:2.75).attr("fill",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`),e.append("line").attr("x1",o.x+3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`),e.append("line").attr("x1",o.x-3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",y?"#000000":"#fff").attr("class",`commit ${r.id} ${c}`);else{let u=e.append("circle");if(u.attr("cx",o.x),u.attr("cy",o.y),u.attr("r",s?7:10),u.attr("class",`commit ${r.id} commit${Z(i,V,g)}`),h===v.MERGE){let f=e.append("circle");f.attr("cx",o.x),f.attr("cy",o.y),f.attr("r",s?5:6),f.attr("class",`commit ${c} ${r.id} commit${Z(i,V,g)}`)}if(h===v.REVERSE){let f=e.append("path"),d=s?4:5;f.attr("d",`M ${o.x-d},${o.y-d}L${o.x+d},${o.y+d}M${o.x-d},${o.y+d}L${o.x+d},${o.y-d}`).attr("class",`commit ${c} ${r.id} commit${Z(i,V,g)}`)}}},"drawCommitBullet"),at=t((e,r,o,c,i)=>{if(r.type!==v.CHERRY_PICK&&(r.customId&&r.type===v.MERGE||r.type!==v.MERGE)&&i.showCommitLabel){let h=e.append("g"),n=h.insert("rect").attr("class","commit-label-bkg"),s=h.append("text").attr("x",c).attr("y",o.y+25).attr("class","commit-label").text(r.id),g=s.node()?.getBBox();if(g){if(n.attr("x",o.posWithOffset-g.width/2-z).attr("y",o.y+13.5).attr("width",g.width+2*z).attr("height",g.height+2*z),B==="TB"||B==="BT")n.attr("x",o.x-(g.width+4*q+5)).attr("y",o.y-12),s.attr("x",o.x-(g.width+4*q)).attr("y",o.y+g.height-12);else s.attr("x",o.posWithOffset-g.width/2);if(i.rotateCommitLabel)if(B==="TB"||B==="BT")s.attr("transform","rotate(-45, "+o.x+", "+o.y+")"),n.attr("transform","rotate(-45, "+o.x+", "+o.y+")");else{let y=-7.5-(g.width+10)/25*9.5,u=10+g.width/25*8.5;h.attr("transform","translate("+y+", "+u+") rotate(-45, "+c+", "+o.y+")")}}}},"drawCommitLabel"),ot=t((e,r,o,c)=>{if(r.tags.length>0){let i=0,h=0,n=0,s=[];for(let g of r.tags.reverse()){let y=e.insert("polygon"),u=e.append("circle"),f=e.append("text").attr("y",o.y-16-i).attr("class","tag-label").text(g),d=f.node()?.getBBox();if(!d)throw Error("Tag bbox not found");h=Math.max(h,d.width),n=Math.max(n,d.height),f.attr("x",o.posWithOffset-d.width/2),s.push({tag:f,hole:u,rect:y,yOffset:i}),i+=20}for(let{tag:g,hole:y,rect:u,yOffset:f}of s){let d=n/2,k=o.y-19.2-f;if(u.attr("class","tag-label-bkg").attr("points",`
|
|
2
2
|
${c-h/2-q/2},${k+z}
|
|
3
3
|
${c-h/2-q/2},${k-z}
|
|
4
4
|
${o.posWithOffset-h/2-q},${k-d-z}
|
|
@@ -7,11 +7,11 @@ import{hn}from"./chunk-0rvwj2wh.js";import{H}from"./chunk-ba9qy65y.js";import{t,
|
|
|
7
7
|
${o.posWithOffset-h/2-q},${k+d+z}`),y.attr("cy",k).attr("cx",c-h/2+q/2).attr("r",1.5).attr("class","tag-hole"),B==="TB"||B==="BT"){let w=c+f;u.attr("class","tag-label-bkg").attr("points",`
|
|
8
8
|
${o.x},${w+2}
|
|
9
9
|
${o.x},${w-2}
|
|
10
|
-
${o.x+
|
|
11
|
-
${o.x+
|
|
12
|
-
${o.x+
|
|
13
|
-
${o.x+
|
|
14
|
-
`,"id:",r,o);let i=c.db;if(!i.getConfig){a.error("getConfig method is not available on db");return}let h=i.getConfig(),n=h.rotateCommitLabel??!1;te=i.getCommits();let s=i.getBranchesAsObjArray();B=i.getDirection();let g=p(`[id="${r}"]`),{look:y,theme:u,themeVariables:f}=l(),{useGradient:d,gradientStart:k,gradientStop:w,filterColor:P}=f;if(d){let I=g.append("defs").append("linearGradient").attr("id",r+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");I.append("stop").attr("offset","0%").attr("stop-color",k).attr("stop-opacity",1),I.append("stop").attr("offset","100%").attr("stop-color",w).attr("stop-opacity",1)}if(y==="neo"&&ce.has(u??""))g.append("defs").append("filter").attr("id",r+"-drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",P);let O=0;if(s.forEach((I,ie)=>{let ee=be(I.name),W=g.append("g"),de=W.insert("g").attr("class","branchLabel"),F=de.insert("g").attr("class","label branch-label");F.node()?.appendChild(ee);let _=ee.getBBox();O=mt(I.name,O,ie,_,n),F.remove(),de.remove(),W.remove()}),$e(g,te,!1,h),h.showBranches)lt(g,s,h,r);ht(g,te),$e(g,te,!0,h),M.insertTitle(g,"gitTitleText",h.titleTopMargin??0,i.getDiagramTitle()),
|
|
10
|
+
${o.x+K},${w-d-2}
|
|
11
|
+
${o.x+K+h+4},${w-d-2}
|
|
12
|
+
${o.x+K+h+4},${w+d+2}
|
|
13
|
+
${o.x+K},${w+d+2}`).attr("transform","translate(12,12) rotate(45, "+o.x+","+c+")"),y.attr("cx",o.x+q/2).attr("cy",w).attr("transform","translate(12,12) rotate(45, "+o.x+","+c+")"),g.attr("x",o.x+5).attr("y",w+3).attr("transform","translate(14,14) rotate(45, "+o.x+","+c+")")}}}},"drawCommitTags"),st=t((e)=>{switch(e.customType??e.type){case v.NORMAL:return"commit-normal";case v.REVERSE:return"commit-reverse";case v.HIGHLIGHT:return"commit-highlight";case v.MERGE:return"commit-merge";case v.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),nt=t((e,r,o,c)=>{let i={x:0,y:0};if(e.parents.length>0){let h=we(e.parents);if(h){let n=c.get(h)??i;if(r==="TB")return n.y+U;else if(r==="BT")return(c.get(e.id)??i).y-U;else return n.x+U}}else if(r==="TB")return oe;else if(r==="BT")return(c.get(e.id)??i).y-U;else return 0;return 0},"calculatePosition"),ct=t((e,r,o)=>{let c=B==="BT"&&o?r:r+K,i=G.get(e.branch)?.pos,h=B==="TB"||B==="BT"?G.get(e.branch)?.pos:c;if(h===void 0||i===void 0)throw Error(`Position were undefined for commit ${e.id}`);let n=ce.has(l().theme??""),s=B==="TB"||B==="BT"?c:i+(n?le/2+1:-2);return{x:h,y:s,posWithOffset:c}},"getCommitPosition"),$e=t((e,r,o,c)=>{let i=e.append("g").attr("class","commit-bullets"),h=e.append("g").attr("class","commit-labels"),n=B==="TB"||B==="BT"?oe:0,s=[...r.keys()],g=c.parallelCommits??!1,y=t((f,d)=>{let k=r.get(f)?.seq,w=r.get(d)?.seq;return k!==void 0&&w!==void 0?k-w:0},"sortKeys"),u=s.sort(y);if(B==="BT"){if(g)Xe(u,r,n);u=u.reverse()}u.forEach((f)=>{let d=r.get(f);if(!d)throw Error(`Commit not found for key ${f}`);if(g)n=nt(d,B,n,D);let k=ct(d,n,g);if(o){let w=st(d),P=d.customType??d.type,O=G.get(d.branch)?.index??0;rt(i,d,k,w,O,P),at(h,d,k,n,c),ot(h,d,k,n)}if(B==="TB"||B==="BT")D.set(d.id,{x:k.x,y:k.posWithOffset});else D.set(d.id,{x:k.posWithOffset,y:k.y});if(n=B==="BT"&&g?n+U:n+U+K,n>Y)Y=n})},"drawCommits"),it=t((e,r,o,c,i)=>{let n=(B==="TB"||B==="BT"?o.x<c.x:o.y<c.y)?r.branch:e.branch,s=t((y)=>y.branch===n,"isOnBranchToGetCurve"),g=t((y)=>y.seq>e.seq&&y.seq<r.seq,"isBetweenCommits");return[...i.values()].some((y)=>g(y)&&s(y))},"shouldRerouteArrow"),re=t((e,r,o=0)=>{let c=e+Math.abs(e-r)/2;if(o>5)return c;if(se.every((n)=>Math.abs(n-c)>=10))return se.push(c),c;let h=Math.abs(e-r);return re(e,r-h/5,o+1)},"findLane"),dt=t((e,r,o,c)=>{let{theme:i}=l(),h=ge.has(i??""),n=D.get(r.id),s=D.get(o.id);if(n===void 0||s===void 0)throw Error(`Commit positions not found for commits ${r.id} and ${o.id}`);let g=it(r,o,n,s,c),y="",u="",f=0,d=0,k=G.get(o.branch)?.index;if(o.type===v.MERGE&&r.id!==o.parents[0])k=G.get(r.branch)?.index;let w;if(g){y="A 10 10, 0, 0, 0,",u="A 10 10, 0, 0, 1,",f=10,d=10;let P=n.y<s.y?re(n.y,s.y):re(s.y,n.y),O=n.x<s.x?re(n.x,s.x):re(s.x,n.x);if(B==="TB")if(n.x<s.x)w=`M ${n.x} ${n.y} L ${O-f} ${n.y} ${u} ${O} ${n.y+d} L ${O} ${s.y-f} ${y} ${O+d} ${s.y} L ${s.x} ${s.y}`;else k=G.get(r.branch)?.index,w=`M ${n.x} ${n.y} L ${O+f} ${n.y} ${y} ${O} ${n.y+d} L ${O} ${s.y-f} ${u} ${O-d} ${s.y} L ${s.x} ${s.y}`;else if(B==="BT")if(n.x<s.x)w=`M ${n.x} ${n.y} L ${O-f} ${n.y} ${y} ${O} ${n.y-d} L ${O} ${s.y+f} ${u} ${O+d} ${s.y} L ${s.x} ${s.y}`;else k=G.get(r.branch)?.index,w=`M ${n.x} ${n.y} L ${O+f} ${n.y} ${u} ${O} ${n.y-d} L ${O} ${s.y+f} ${y} ${O-d} ${s.y} L ${s.x} ${s.y}`;else if(n.y<s.y)w=`M ${n.x} ${n.y} L ${n.x} ${P-f} ${y} ${n.x+d} ${P} L ${s.x-f} ${P} ${u} ${s.x} ${P+d} L ${s.x} ${s.y}`;else k=G.get(r.branch)?.index,w=`M ${n.x} ${n.y} L ${n.x} ${P+f} ${u} ${n.x+d} ${P} L ${s.x-f} ${P} ${y} ${s.x} ${P-d} L ${s.x} ${s.y}`}else if(y="A 20 20, 0, 0, 0,",u="A 20 20, 0, 0, 1,",f=20,d=20,B==="TB"){if(n.x<s.x)if(o.type===v.MERGE&&r.id!==o.parents[0])w=`M ${n.x} ${n.y} L ${n.x} ${s.y-f} ${y} ${n.x+d} ${s.y} L ${s.x} ${s.y}`;else w=`M ${n.x} ${n.y} L ${s.x-f} ${n.y} ${u} ${s.x} ${n.y+d} L ${s.x} ${s.y}`;if(n.x>s.x)if(y="A 20 20, 0, 0, 0,",u="A 20 20, 0, 0, 1,",f=20,d=20,o.type===v.MERGE&&r.id!==o.parents[0])w=`M ${n.x} ${n.y} L ${n.x} ${s.y-f} ${u} ${n.x-d} ${s.y} L ${s.x} ${s.y}`;else w=`M ${n.x} ${n.y} L ${s.x+f} ${n.y} ${y} ${s.x} ${n.y+d} L ${s.x} ${s.y}`;if(n.x===s.x)w=`M ${n.x} ${n.y} L ${s.x} ${s.y}`}else if(B==="BT"){if(n.x<s.x)if(o.type===v.MERGE&&r.id!==o.parents[0])w=`M ${n.x} ${n.y} L ${n.x} ${s.y+f} ${u} ${n.x+d} ${s.y} L ${s.x} ${s.y}`;else w=`M ${n.x} ${n.y} L ${s.x-f} ${n.y} ${y} ${s.x} ${n.y-d} L ${s.x} ${s.y}`;if(n.x>s.x)if(y="A 20 20, 0, 0, 0,",u="A 20 20, 0, 0, 1,",f=20,d=20,o.type===v.MERGE&&r.id!==o.parents[0])w=`M ${n.x} ${n.y} L ${n.x} ${s.y+f} ${y} ${n.x-d} ${s.y} L ${s.x} ${s.y}`;else w=`M ${n.x} ${n.y} L ${s.x+f} ${n.y} ${u} ${s.x} ${n.y-d} L ${s.x} ${s.y}`;if(n.x===s.x)w=`M ${n.x} ${n.y} L ${s.x} ${s.y}`}else{if(n.y<s.y)if(o.type===v.MERGE&&r.id!==o.parents[0])w=`M ${n.x} ${n.y} L ${s.x-f} ${n.y} ${u} ${s.x} ${n.y+d} L ${s.x} ${s.y}`;else w=`M ${n.x} ${n.y} L ${n.x} ${s.y-f} ${y} ${n.x+d} ${s.y} L ${s.x} ${s.y}`;if(n.y>s.y)if(o.type===v.MERGE&&r.id!==o.parents[0])w=`M ${n.x} ${n.y} L ${s.x-f} ${n.y} ${y} ${s.x} ${n.y-d} L ${s.x} ${s.y}`;else w=`M ${n.x} ${n.y} L ${n.x} ${s.y+f} ${u} ${n.x+d} ${s.y} L ${s.x} ${s.y}`;if(n.y===s.y)w=`M ${n.x} ${n.y} L ${s.x} ${s.y}`}if(w===void 0)throw Error("Line definition not found");e.append("path").attr("d",w).attr("class","arrow arrow"+Z(k,V,h))},"drawArrow"),ht=t((e,r)=>{let o=e.append("g").attr("class","commit-arrows");[...r.keys()].forEach((c)=>{let i=r.get(c);if(i.parents&&i.parents.length>0)i.parents.forEach((h)=>{dt(o,r.get(h),i,r)})})},"drawArrows"),lt=t((e,r,o,c)=>{let{look:i,theme:h,themeVariables:n}=l(),{dropShadow:s,THEME_COLOR_LIMIT:g}=n,y=ce.has(h??""),u=ge.has(h??""),f=e.append("g");r.forEach((d,k)=>{let w=Z(k,y?g:V,u),P=G.get(d.name)?.pos;if(P===void 0)throw Error(`Position not found for branch ${d.name}`);let O=B==="TB"||B==="BT"?P:y?P+le/2+1:P-2,I=f.append("line");if(I.attr("x1",0),I.attr("y1",O),I.attr("x2",Y),I.attr("y2",O),I.attr("class","branch branch"+w),B==="TB")I.attr("y1",oe),I.attr("x1",P),I.attr("y2",Y),I.attr("x2",P);else if(B==="BT")I.attr("y1",Y),I.attr("x1",P),I.attr("y2",oe),I.attr("x2",P);se.push(O);let ie=d.name,ee=be(ie),W=f.insert("rect"),F=f.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+w);F.node().appendChild(ee);let _=ee.getBBox(),fe=y?0:4,ae=y?16:0,Q=y?le:0;if(i==="neo")W.attr("data-look","neo");if(W.attr("class","branchLabelBkg label"+w).attr("style",i==="neo"?`filter:${y?`url(#${c}-drop-shadow)`:s}`:"").attr("rx",fe).attr("ry",fe).attr("x",-_.width-4-(o.rotateCommitLabel===!0?30:0)).attr("y",-_.height/2+10).attr("width",_.width+18+ae).attr("height",_.height+4+Q),F.attr("transform","translate("+(-_.width-14-(o.rotateCommitLabel===!0?30:0)+ae/2)+", "+(O-_.height/2-2)+")"),B==="TB"){if(W.attr("x",P-_.width/2-10).attr("y",0),F.attr("transform","translate("+(P-_.width/2-5)+", 0)"),y)W.attr("transform",`translate(${-ae/2-3}, ${-Q-10})`),F.attr("transform","translate("+(P-_.width/2-5)+", "+(-Q*2+7)+")")}else if(B==="BT"){if(W.attr("x",P-_.width/2-10).attr("y",Y),F.attr("transform","translate("+(P-_.width/2-5)+", "+Y+")"),y)W.attr("transform",`translate(${-ae/2-3}, ${Q+10})`),F.attr("transform","translate("+(P-_.width/2-5)+", "+(Y+Q*2+4)+")")}else W.attr("transform","translate(-19, "+(O-12-Q/2)+")")})},"drawBranches"),mt=t(function(e,r,o,c,i){return G.set(e,{pos:r,index:o}),r+=50+(i?40:0)+(B==="TB"||B==="BT"?c.width/2:0),r},"setBranchPosition"),gt=t(function(e,r,o,c){Ve(),a.debug("in gitgraph renderer",e+`
|
|
14
|
+
`,"id:",r,o);let i=c.db;if(!i.getConfig){a.error("getConfig method is not available on db");return}let h=i.getConfig(),n=h.rotateCommitLabel??!1;te=i.getCommits();let s=i.getBranchesAsObjArray();B=i.getDirection();let g=p(`[id="${r}"]`),{look:y,theme:u,themeVariables:f}=l(),{useGradient:d,gradientStart:k,gradientStop:w,filterColor:P}=f;if(d){let I=g.append("defs").append("linearGradient").attr("id",r+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");I.append("stop").attr("offset","0%").attr("stop-color",k).attr("stop-opacity",1),I.append("stop").attr("offset","100%").attr("stop-color",w).attr("stop-opacity",1)}if(y==="neo"&&ce.has(u??""))g.append("defs").append("filter").attr("id",r+"-drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",P);let O=0;if(s.forEach((I,ie)=>{let ee=be(I.name),W=g.append("g"),de=W.insert("g").attr("class","branchLabel"),F=de.insert("g").attr("class","label branch-label");F.node()?.appendChild(ee);let _=ee.getBBox();O=mt(I.name,O,ie,_,n),F.remove(),de.remove(),W.remove()}),$e(g,te,!1,h),h.showBranches)lt(g,s,h,r);ht(g,te),$e(g,te,!0,h),M.insertTitle(g,"gitTitleText",h.titleTopMargin??0,i.getDiagramTitle()),Sr(void 0,g,h.diagramPadding,h.useMaxWidth)},"draw"),ft={draw:gt},Be=8,ke=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),$t=new Set(["redux-color","redux-dark-color"]),pt=new Set(["neo","neo-dark"]),yt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),xt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),ut=t((e)=>{let{svgId:r}=e,o="";if(e.useGradient&&r)for(let c=0;c<e.THEME_COLOR_LIMIT;c++)o+=`
|
|
15
15
|
.label${c} { fill: ${e.mainBkg}; stroke: url(${r}-gradient); stroke-width: ${e.strokeWidth};}
|
|
16
16
|
`;return o},"genGitGraphGradient"),bt=t((e)=>{let r=x(),{theme:o,themeVariables:c}=r,{borderColorArray:i}=c,h=ke.has(o);if(pt.has(o)){let n="";for(let s=0;s<e.THEME_COLOR_LIMIT;s++)if(s===0)n+=`
|
|
17
17
|
.branch-label${s} { fill: ${e.nodeBorder};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{mi}from"./chunk-7wzszsf5.js";export{mi as default};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{t,a,Re,b,C,S,E,T,A,L,R,l,p,
|
|
1
|
+
import{t,a,Re,b,C,S,E,T,A,L,R,l,p,Xi,M,pe,le,ce,vt,ge,ye}from"./chunk-zsat72qd.js";import{Ft}from"./chunk-k9fyqrhp.js";import{he}from"./chunk-y6mcxfm0.js";import{ue}from"./chunk-51b8n5e1.js";var Bt=function(){var e=t(function(Q,h,g,n){for(g=g||{},n=Q.length;n--;g[Q[n]]=h);return g},"o"),s=[1,2],c=[1,3],r=[1,4],u=[2,4],f=[1,9],m=[1,11],k=[1,16],o=[1,17],D=[1,18],x=[1,19],G=[1,33],Y=[1,20],j=[1,21],O=[1,22],y=[1,23],V=[1,24],F=[1,26],z=[1,27],W=[1,28],K=[1,29],N=[1,30],st=[1,31],pt=[1,32],St=[1,35],gt=[1,36],yt=[1,37],mt=[1,38],rt=[1,34],_=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],bt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],Mt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],Lt={trace:t(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:t(function(h,g,n,v,w,i,it){var d=i.length-1;switch(w){case 3:return v.setRootDoc(i[d]),i[d];break;case 4:this.$=[];break;case 5:if(i[d]!="nl")i[d-1].push(i[d]),this.$=i[d-1];break;case 6:case 7:this.$=i[d];break;case 8:this.$="nl";break;case 12:this.$=i[d];break;case 13:let Tt=i[d-1];Tt.description=v.trimColon(i[d]),this.$=Tt;break;case 14:this.$={stmt:"relation",state1:i[d-2],state2:i[d]};break;case 15:let Et=v.trimColon(i[d]);this.$={stmt:"relation",state1:i[d-3],state2:i[d-1],description:Et};break;case 19:this.$={stmt:"state",id:i[d-3],type:"default",description:"",doc:i[d-1]};break;case 20:var X=i[d],J=i[d-2].trim();if(i[d].match(":")){var lt=i[d].split(":");X=lt[0],J=[J,lt[1]]}this.$={stmt:"state",id:X,type:"default",description:J};break;case 21:this.$={stmt:"state",id:i[d-3],type:"default",description:i[d-5],doc:i[d-1]};break;case 22:this.$={stmt:"state",id:i[d],type:"fork"};break;case 23:this.$={stmt:"state",id:i[d],type:"join"};break;case 24:this.$={stmt:"state",id:i[d],type:"choice"};break;case 25:this.$={stmt:"state",id:v.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[d-1].trim(),note:{position:i[d-2].trim(),text:i[d].trim()}};break;case 29:this.$=i[d].trim(),v.setAccTitle(this.$);break;case 30:case 31:this.$=i[d].trim(),v.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[d-3],url:i[d-2],tooltip:i[d-1]};break;case 33:this.$={stmt:"click",id:i[d-3],url:i[d-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[d-1].trim(),classes:i[d].trim()};break;case 36:this.$={stmt:"style",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 37:this.$={stmt:"applyClass",id:i[d-1].trim(),styleClass:i[d].trim()};break;case 38:v.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:v.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:v.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:v.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[d].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[d-2].trim(),classes:[i[d].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:s,5:c,6:r},{1:[3]},{3:5,4:s,5:c,6:r},{3:6,4:s,5:c,6:r},e([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],u,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:f,5:m,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:o,19:D,22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:gt,53:yt,54:mt,57:rt},e(_,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:k,17:o,19:D,22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:gt,53:yt,54:mt,57:rt},e(_,[2,7]),e(_,[2,8]),e(_,[2,9]),e(_,[2,10]),e(_,[2,11]),e(_,[2,12],{14:[1,40],15:[1,41]}),e(_,[2,16]),{18:[1,42]},e(_,[2,18],{20:[1,43]}),{23:[1,44]},e(_,[2,22]),e(_,[2,23]),e(_,[2,24]),e(_,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},e(_,[2,28]),{34:[1,49]},{36:[1,50]},e(_,[2,31]),{13:51,24:G,57:rt},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},e(bt,[2,44],{58:[1,56]}),e(bt,[2,45],{58:[1,57]}),e(_,[2,38]),e(_,[2,39]),e(_,[2,40]),e(_,[2,41]),e(_,[2,6]),e(_,[2,13]),{13:58,24:G,57:rt},e(_,[2,17]),e(Mt,u,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},e(_,[2,29]),e(_,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},e(_,[2,14],{14:[1,71]}),{4:f,5:m,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:o,19:D,21:[1,72],22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:gt,53:yt,54:mt,57:rt},e(_,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},e(_,[2,34]),e(_,[2,35]),e(_,[2,36]),e(_,[2,37]),e(bt,[2,46]),e(bt,[2,47]),e(_,[2,15]),e(_,[2,19]),e(Mt,u,{7:78}),e(_,[2,26]),e(_,[2,27]),{5:[1,79]},{5:[1,80]},{4:f,5:m,8:8,9:10,10:12,11:13,12:14,13:15,16:k,17:o,19:D,21:[1,81],22:x,24:G,25:Y,26:j,27:O,28:y,29:V,32:25,33:F,35:z,37:W,38:K,41:N,45:st,48:pt,51:St,52:gt,53:yt,54:mt,57:rt},e(_,[2,32]),e(_,[2,33]),e(_,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:t(function(h,g){if(g.recoverable)this.trace(h);else{var n=Error(h);throw n.hash=g,n}},"parseError"),parse:t(function(h){var g=this,n=[0],v=[],w=[null],i=[],it=this.table,d="",X=0,J=0,lt=0,Tt=2,Et=1,be=i.slice.call(arguments,1),I=Object.create(this.lexer),tt={yy:{}};for(var wt in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,wt))tt.yy[wt]=this.yy[wt];if(I.setInput(h,tt.yy),tt.yy.lexer=I,tt.yy.parser=this,typeof I.yylloc>"u")I.yylloc={};var It=I.yylloc;i.push(It);var ke=I.options&&I.options.ranges;if(typeof tt.yy.parseError==="function")this.parseError=tt.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function Te(H){n.length=n.length-2*H,w.length=w.length-H,i.length=i.length-H}t(Te,"popStack");function Wt(){var H=v.pop()||I.lex()||Et;if(typeof H!=="number"){if(H instanceof Array)v=H,H=v.pop();H=g.symbols_[H]||H}return H}t(Wt,"lex");var P,Nt,et,U,ts,Ot,at={},_t,q,jt,Dt;while(!0){if(et=n[n.length-1],this.defaultActions[et])U=this.defaultActions[et];else{if(P===null||typeof P>"u")P=Wt();U=it[et]&&it[et][P]}if(typeof U>"u"||!U.length||!U[0]){var Rt="";Dt=[];for(_t in it[et])if(this.terminals_[_t]&&_t>Tt)Dt.push("'"+this.terminals_[_t]+"'");if(I.showPosition)Rt="Parse error on line "+(X+1)+`:
|
|
2
2
|
`+I.showPosition()+`
|
|
3
|
-
Expecting `+Dt.join(", ")+", got '"+(this.terminals_[P]||P)+"'";else Rt="Parse error on line "+(X+1)+": Unexpected "+(P==
|
|
3
|
+
Expecting `+Dt.join(", ")+", got '"+(this.terminals_[P]||P)+"'";else Rt="Parse error on line "+(X+1)+": Unexpected "+(P==Et?"end of input":"'"+(this.terminals_[P]||P)+"'");this.parseError(Rt,{text:I.match,token:this.terminals_[P]||P,line:I.yylineno,loc:It,expected:Dt})}if(U[0]instanceof Array&&U.length>1)throw Error("Parse Error: multiple actions possible at state: "+et+", token: "+P);switch(U[0]){case 1:if(n.push(P),w.push(I.yytext),i.push(I.yylloc),n.push(U[1]),P=null,!Nt){if(J=I.yyleng,d=I.yytext,X=I.yylineno,It=I.yylloc,lt>0)lt--}else P=Nt,Nt=null;break;case 2:if(q=this.productions_[U[1]][1],at.$=w[w.length-q],at._$={first_line:i[i.length-(q||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(q||1)].first_column,last_column:i[i.length-1].last_column},ke)at._$.range=[i[i.length-(q||1)].range[0],i[i.length-1].range[1]];if(Ot=this.performAction.apply(at,[d,J,X,tt.yy,U[1],w,i].concat(be)),typeof Ot<"u")return Ot;if(q)n=n.slice(0,-1*q*2),w=w.slice(0,-1*q),i=i.slice(0,-1*q);n.push(this.productions_[U[1]][0]),w.push(at.$),i.push(at._$),jt=it[n[n.length-2]][n[n.length-1]],n.push(jt);break;case 3:return!0}}return!0},"parse")},me=function(){var Q={EOF:1,parseError:t(function(g,n){if(this.yy.parser)this.yy.parser.parseError(g,n);else throw Error(g)},"parseError"),setInput:t(function(h,g){if(this.yy=g||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges)this.yylloc.range=[0,0];return this.offset=0,this},"setInput"),input:t(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var g=h.match(/(?:\r\n?|\n).*/g);if(g)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),h},"input"),unput:t(function(h){var g=h.length,n=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var v=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1)this.yylineno-=n.length-1;var w=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===v.length?this.yylloc.first_column:0)+v[v.length-n.length].length-n[0].length:this.yylloc.first_column-g},this.options.ranges)this.yylloc.range=[w[0],w[0]+this.yyleng-g];return this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:t(function(h){this.unput(this.match.slice(h))},"less"),pastInput:t(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var h=this.match;if(h.length<20)h+=this._input.substr(0,20-h.length);return(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var h=this.pastInput(),g=Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
5
5
|
`+g+"^"},"showPosition"),test_match:t(function(h,g){var n,v,w;if(this.options.backtrack_lexer){if(w={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges)w.yylloc.range=this.yylloc.range.slice(0)}if(v=h[0].match(/(?:\r\n?|\n).*/g),v)this.yylineno+=v.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:v?v[v.length-1].length-v[v.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(h[0].length),this.matched+=h[0],n=this.performAction.call(this,this.yy,this,g,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(n)return n;else if(this._backtrack){for(var i in w)this[i]=w[i];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var h,g,n,v;if(!this._more)this.yytext="",this.match="";var w=this._currentRules();for(var i=0;i<w.length;i++)if(n=this._input.match(this.rules[w[i]]),n&&(!g||n[0].length>g[0].length)){if(g=n,v=i,this.options.backtrack_lexer)if(h=this.test_match(n,w[i]),h!==!1)return h;else if(this._backtrack){g=!1;continue}else return!1;else if(!this.options.flex)break}if(g){if(h=this.test_match(g,w[v]),h!==!1)return h;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
-
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:t(function(g){this.conditionStack.push(g)},"begin"),popState:t(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:t(function(g){this.begin(g)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(g,n,v,w){function i(){let d=n.yytext.indexOf("%%");if(d===0)return!1;if(d>0){let X=n.yytext.slice(0,d),J=n.yytext.slice(d);if(J)g.lexer.unput(J);n.yytext=X}return!0}t(i,"processId");var it=w;switch(v){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!i())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw Error('Error: State name must be a single word. Found: "'+n.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!i())return;return this.popState(),"ID";break;case 66:if(!i())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),n.yytext=n.yytext.substr(2).trim(),31;break;case 68:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!i())return;return 24;case 74:return n.yytext=n.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return Q}();Lt.lexer=me;function Tt(){this.yy={}}return t(Tt,"Parser"),Tt.prototype=Lt,Lt.Parser=Tt,new Tt}();Bt.parser=Bt;var Ee=Bt,_e="TB",qt="TB",Ut="dir",ot="state",nt="root",Gt="relation",ve="classDef",De="style",Ce="applyClass",ut="default",Qt="divider",Zt="fill:none",te="fill: #333",ee="c",se="markdown",re="normal",$t="rect",Pt="rectWithTitle",Ae="stateStart",xe="stateEnd",Yt="divider",Ht="roundedWithTitle",Le="note",we="noteGroup",ft="statediagram",Ie="state",Ne=`${ft}-${Ie}`,ie="transition",Oe="note",$e="note-edge",Fe=`${ie} ${$e}`,Pe=`${ft}-${Oe}`,Be="cluster",Ge=`${ft}-${Be}`,Ye="cluster-alt",Ve=`${ft}-${Ye}`,ae="parent",ne="note",Me="state",Vt="----",We=`${Vt}${ne}`,zt=`${Vt}${ae}`,At=new Map,Z=0,oe=0,ct=new Map,je=t((e,s,c,r)=>{if(e===Yt&&c?.id!==void 0&&ct.has(c.id)){let m=ct.get(c.id);return ct.set(s,m),m}let u=oe++,f=r?void 0:u;return ct.set(s,f),f},"colorSlotFor");function xt(e="",s=0,c="",r=Vt){let u=c!==null&&c.length>0?`${r}${c}`:"";return`${Me}-${e}${u}-${s}`}t(xt,"stateDomId");var Ue=t((e,s,c,r,u,f,m,k)=>{a.trace("items",s),s.forEach((o)=>{switch(o.stmt){case ot:dt(e,o,c,r,u,f,m,k);break;case ut:dt(e,o,c,r,u,f,m,k);break;case Gt:{dt(e,o.state1,c,r,u,f,m,k),dt(e,o.state2,c,r,u,f,m,k);let D=m==="neo",x={id:"edge"+Z,start:o.state1.id,end:o.state2.id,arrowhead:"normal",arrowTypeEnd:D?"arrow_barb_neo":"arrow_barb",style:Zt,labelStyle:"",label:b.sanitizeText(o.description??"",l()),arrowheadStyle:te,labelpos:ee,labelType:se,thickness:re,classes:ie,look:m};u.push(x),Z++}break}})},"setupDoc"),Kt=t((e,s=qt)=>{let c=s;if(e.doc){for(let r of e.doc)if(r.stmt==="dir")c=r.value}return c},"getDir");function ht(e,s,c){if(!s.id||s.id==="</join></fork>"||s.id==="</choice>")return;if(s.cssClasses){if(!Array.isArray(s.cssCompiledStyles))s.cssCompiledStyles=[];s.cssClasses.split(" ").forEach((u)=>{let f=c.get(u);if(f)s.cssCompiledStyles=[...s.cssCompiledStyles??[],...f.styles]})}let r=e.find((u)=>u.id===s.id);if(r)Object.assign(r,s);else e.push(s)}t(ht,"insertOrUpdateNode");function de(e){return e?.classes?.join(" ")??""}t(de,"getClassesFromDbInfo");function fe(e){return e?.styles??[]}t(fe,"getStylesFromDbInfo");var dt=t((e,s,c,r,u,f,m,k)=>{let o=s.id,D=c.get(o),x=de(D),G=fe(D),Y=l(),j=x.trim()!==""||G.length>0;if(a.info("dataFetcher parsedItem",s,D,G),o!=="root"){let O=$t;if(s.start===!0)O=Ae;else if(s.start===!1)O=xe;if(s.type!==ut)O=s.type;if(!At.get(o))At.set(o,{id:o,shape:O,description:b.sanitizeText(o,Y),cssClasses:`${x} ${Ne}`,cssStyles:G});let y=At.get(o);if(s.description){if(Array.isArray(y.description))y.shape=Pt,y.description.push(s.description);else if(y.description?.length&&y.description.length>0)if(y.shape=Pt,y.description===o)y.description=[s.description];else y.description=[y.description,s.description];else y.shape=$t,y.description=s.description;y.description=b.sanitizeTextOrArray(y.description,Y)}if(y.description?.length===1&&y.shape===Pt)if(y.type==="group")y.shape=Ht;else y.shape=$t;if(!y.type&&s.doc)a.info("Setting cluster for XCX",o,Kt(s)),y.type="group",y.isGroup=!0,y.dir=Kt(s),y.shape=s.type===Qt?Yt:Ht,y.colorIndex=je(y.shape,o,e,j),y.cssClasses=`${y.cssClasses} ${Ge} ${f?Ve:""}`;let V={labelStyle:"",shape:y.shape,label:y.description,cssClasses:y.cssClasses,cssCompiledStyles:[],cssStyles:y.cssStyles,id:o,dir:y.dir,domId:xt(o,Z),type:y.type,isGroup:y.type==="group",colorIndex:y.colorIndex,padding:8,rx:10,ry:10,look:m,labelType:"markdown"};if(V.shape===Yt)V.label="";if(e&&e.id!=="root")a.trace("Setting node ",o," to be child of its parent ",e.id),V.parentId=e.id;if(V.centerLabel=!0,s.note){let F={labelStyle:"",shape:Le,label:s.note.text,labelType:"markdown",cssClasses:Pe,cssStyles:[],cssCompiledStyles:[],id:o+We+"-"+Z,domId:xt(o,Z,ne),type:"node",isGroup:!1,padding:Y.flowchart?.padding,look:m,position:s.note.position},z=o+zt,W={labelStyle:"",shape:we,label:s.note.text,cssClasses:y.cssClasses,cssStyles:[],id:o+zt,domId:xt(o,Z,ae),type:"group",isGroup:!0,padding:16,look:m,position:s.note.position};Z++,W.id=z,F.parentId=z,ht(r,W,k),ht(r,F,k),ht(r,V,k);let K=o,N=F.id;if(s.note.position==="left of")K=F.id,N=o;u.push({id:K+"-"+N,start:K,end:N,arrowhead:"none",arrowTypeEnd:"",style:Zt,labelStyle:"",classes:Fe,pattern:"dashed",arrowheadStyle:te,labelpos:ee,labelType:se,thickness:re,look:m})}else ht(r,V,k)}if(s.doc)a.trace("Adding nodes children "),Ue(s,s.doc,c,r,u,!f,m,k)},"dataFetcher"),He=t(()=>{At.clear(),Z=0,oe=0,ct.clear()},"reset"),Se=t((e,s=qt)=>{if(!e.doc)return s;let c=s;for(let r of e.doc)if(r.stmt==="dir")c=r.value;return c},"getDir"),ze=t(function(e,s){return s.db.getClasses()},"getClasses"),Ke=t(async function(e,s,c,r){a.info("REF0:"),a.info("Drawing state diagram (v2)",s);let{securityLevel:u,state:f,layout:m}=l();r.db.extract(r.db.getRootDocV2());let k=r.db.getData(),o=he(s,u);if(k.type=r.type,k.layoutAlgorithm=ye(m),k.nodeSpacing=f?.nodeSpacing||50,k.rankSpacing=f?.rankSpacing||50,l().look==="neo")k.markers=["barbNeo"];else k.markers=["barb"];k.diagramId=s,await ge(k,o);let x=8;try{(typeof r.db.getLinks==="function"?r.db.getLinks():new Map).forEach((Y,j)=>{let O=typeof j==="string"?j:typeof j?.id==="string"?j.id:"",y=k.nodes.find((N)=>N.id===O);if(!O){a.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(j));return}let V=o.node()?.querySelectorAll("g.node, g.rough-node"),F;if(V?.forEach((N)=>{let st=N.textContent?.trim();if(N.id===y?.domId||st===O)F=N}),!F){a.warn("⚠️ Could not find node matching text:",O);return}let z=F.parentNode;if(!z){a.warn("⚠️ Node has no parent, cannot wrap:",O);return}let W=document.createElementNS("http://www.w3.org/2000/svg","a"),K=Y.url.replace(/^"+|"+$/g,"");if(W.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",K),W.setAttribute("target","_blank"),Y.tooltip){let N=Y.tooltip.replace(/^"+|"+$/g,"");W.setAttribute("title",N),F.setAttribute("title",N)}z.replaceChild(W,F),W.appendChild(F),a.info("\uD83D\uDD17 Wrapped node in <a> tag for:",O,Y.url)})}catch(G){a.error("❌ Error injecting clickable links:",G)}M.insertTitle(o,"statediagramTitleText",f?.titleTopMargin??25,r.db.getDiagramTitle()),ue(o,x,ft,f?.useMaxWidth??!0)},"draw"),Xe={getClasses:ze,draw:Ke,getDir:Se},B={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Xt=t(()=>new Map,"newClassesList"),Jt=t(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),Ct=t((e)=>JSON.parse(JSON.stringify(e)),"clone"),Je=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Xt(),this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=E,this.setAccTitle=S,this.getAccDescription=A,this.setAccDescription=T,this.setDiagramTitle=L,this.getDiagramTitle=R,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{t(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let r of Array.isArray(e)?e:e.doc)switch(r.stmt){case ot:this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case Gt:this.addRelation(r.state1,r.state2,r.description);break;case ve:this.addStyleClass(r.id.trim(),r.classes);break;case De:this.handleStyleDef(r);break;case Ce:this.setCssClass(r.id.trim(),r.styleClass);break;case"click":this.addLink(r.id,r.url,r.tooltip);break}let s=this.getStates(),c=l();He(),dt(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,c.look,this.classes);for(let r of this.nodes){if(!Array.isArray(r.label))continue;if(r.description=r.label.slice(1),r.isGroup&&r.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${r.id}]`);r.label=r.label[0]}}handleStyleDef(e){let s=e.id.trim().split(","),c=e.styleClass.split(",");for(let r of s){let u=this.getState(r);if(!u){let f=r.trim();this.addState(f),u=this.getState(f)}if(u)u.styles=c.map((f)=>f.replace(/;/g,"")?.trim())}}setRootDoc(e){if(a.info("Setting root doc",e),this.rootDoc=e,this.version===1)this.extract(e);else this.extract(this.getRootDocV2())}docTranslator(e,s,c){if(s.stmt===Gt){this.docTranslator(e,s.state1,!0),this.docTranslator(e,s.state2,!1);return}if(s.stmt===ot)if(s.id===B.START_NODE)s.id=e.id+(c?"_start":"_end"),s.start=c;else s.id=s.id.trim();if(s.stmt!==nt&&s.stmt!==ot||!s.doc)return;let r=[],u=[];for(let f of s.doc)if(f.type===Qt){let m=Ct(f);m.doc=Ct(u),r.push(m),u=[]}else u.push(f);if(r.length>0&&u.length>0){let f={stmt:ot,id:Yi(),type:"divider",doc:Ct(u)};r.push(Ct(f)),s.doc=r}s.doc.forEach((f)=>this.docTranslator(s,f,!0))}getRootDocV2(){return this.docTranslator({id:nt,stmt:nt},{id:nt,stmt:nt,doc:this.rootDoc},!0),{id:nt,doc:this.rootDoc}}addState(e,s=ut,c=void 0,r=void 0,u=void 0,f=void 0,m=void 0,k=void 0){let o=e?.trim();if(!this.currentDocument.states.has(o))a.info("Adding state ",o,r),this.currentDocument.states.set(o,{stmt:ot,id:o,descriptions:[],type:s,doc:c,note:u,classes:[],styles:[],textStyles:[]});else{let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);if(!D.doc)D.doc=c;if(!D.type)D.type=s}if(r)a.info("Setting state description",o,r),(Array.isArray(r)?r:[r]).forEach((x)=>this.addDescription(o,x.trim()));if(u){let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);D.note=u,D.note.text=b.sanitizeText(D.note.text,l())}if(f)a.info("Setting state classes",o,f),(Array.isArray(f)?f:[f]).forEach((x)=>this.setCssClass(o,x.trim()));if(m)a.info("Setting state styles",o,m),(Array.isArray(m)?m:[m]).forEach((x)=>this.setStyle(o,x.trim()));if(k)a.info("Setting state styles",o,m),(Array.isArray(k)?k:[k]).forEach((x)=>this.setTextStyle(o,x.trim()))}clear(e){if(this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Xt(),!e)this.links=new Map,C()}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){a.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,s,c){this.links.set(e,{url:s,tooltip:c}),a.warn("Adding link",e,s,c)}getLinks(){return this.links}startIdIfNeeded(e=""){if(e===B.START_NODE)return this.startEndCount++,`${B.START_TYPE}${this.startEndCount}`;return e}startTypeIfNeeded(e="",s=ut){return e===B.START_NODE?B.START_TYPE:s}endIdIfNeeded(e=""){if(e===B.END_NODE)return this.startEndCount++,`${B.END_TYPE}${this.startEndCount}`;return e}endTypeIfNeeded(e="",s=ut){return e===B.END_NODE?B.END_TYPE:s}addRelationObjs(e,s,c=""){let r=this.startIdIfNeeded(e.id.trim()),u=this.startTypeIfNeeded(e.id.trim(),e.type),f=this.startIdIfNeeded(s.id.trim()),m=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(r,u,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(f,m,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:b.sanitizeText(c,l())})}addRelation(e,s,c){if(typeof e==="object"&&typeof s==="object")this.addRelationObjs(e,s,c);else if(typeof e==="string"&&typeof s==="string"){let r=this.startIdIfNeeded(e.trim()),u=this.startTypeIfNeeded(e),f=this.endIdIfNeeded(s.trim()),m=this.endTypeIfNeeded(s);this.addState(r,u),this.addState(f,m),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:c?b.sanitizeText(c,l()):void 0})}}addDescription(e,s){let c=this.currentDocument.states.get(e),r=s.startsWith(":")?s.replace(":","").trim():s;c?.descriptions?.push(b.sanitizeText(r,l()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,s=""){if(!this.classes.has(e))this.classes.set(e,{id:e,styles:[],textStyles:[]});let c=this.classes.get(e);if(s&&c)s.split(B.STYLECLASS_SEP).forEach((r)=>{let u=r.replace(/([^;]*);/,"$1").trim();if(RegExp(B.COLOR_KEYWORD).exec(r)){let m=u.replace(B.FILL_KEYWORD,B.BG_FILL).replace(B.COLOR_KEYWORD,B.FILL_KEYWORD);c.textStyles.push(m)}c.styles.push(u)})}getClasses(){return this.classes}setupToolTips(e){let s=Ft();p(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover",(u)=>{let f=p(u.currentTarget),m=f.attr("title");if(m===null)return;let k=u.currentTarget?.getBoundingClientRect();s.transition().duration(200).style("opacity",".9"),s.style("left",window.scrollX+k.left+(k.right-k.left)/2+"px").style("top",window.scrollY+k.bottom+"px"),s.html(Re.sanitize(m)),f.classed("hover",!0)}).on("mouseout",(u)=>{s.transition().duration(500).style("opacity",0),p(u.currentTarget).classed("hover",!1)})}setCssClass(e,s){e.split(",").forEach((c)=>{let r=this.getState(c);if(!r){let u=c.trim();this.addState(u),r=this.getState(u)}r?.classes?.push(s)})}setStyle(e,s){this.getState(e)?.styles?.push(s)}setTextStyle(e,s){this.getState(e)?.textStyles?.push(s)}bindFunctions(e){this.funs.forEach((s)=>{s(e)})}getDirectionStatement(){return this.rootDoc.find((e)=>e.stmt===Ut)}getDirection(){return this.getDirectionStatement()?.value??_e}setDirection(e){let s=this.getDirectionStatement();if(s)s.value=e;else this.rootDoc.unshift({stmt:Ut,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){let e=l();for(let s of this.nodes)if(s.wrappingWidth??=e.state?.wrappingWidth,!s.isGroup)s.minWidth??=e.state?.minNodeWidth;return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:Se(this.getRootDocV2())}}getConfig(){return l().state}},qe=t((e)=>{let{theme:s,bkgColorArray:c,borderColorArray:r}=e;if(!le(s,r))return"";let u=ce(e.look),f=pe(c),m="";for(let k=0;k<yt(r);k++){let o=r[k],D=f?`fill: ${c[k%c.length]};`:"",x=`[data-look="${u}"][data-color-id="color-${k}"]`;m+=`
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){var g=this.next();if(g)return g;else return this.lex()},"lex"),begin:t(function(g){this.conditionStack.push(g)},"begin"),popState:t(function(){var g=this.conditionStack.length-1;if(g>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:t(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(g){if(g=this.conditionStack.length-1-Math.abs(g||0),g>=0)return this.conditionStack[g];else return"INITIAL"},"topState"),pushState:t(function(g){this.begin(g)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(g,n,v,w){function i(){let d=n.yytext.indexOf("%%");if(d===0)return!1;if(d>0){let X=n.yytext.slice(0,d),J=n.yytext.slice(d);if(J)g.lexer.unput(J);n.yytext=X}return!0}t(i,"processId");var it=w;switch(v){case 0:return 38;case 1:return 40;case 2:return 39;case 3:return 44;case 4:return 51;case 5:return 52;case 6:return 53;case 7:return 54;case 8:return 5;case 9:break;case 10:break;case 11:break;case 12:break;case 13:return this.pushState("SCALE"),17;break;case 14:return 18;case 15:this.popState();break;case 16:return this.begin("acc_title"),33;break;case 17:return this.popState(),"acc_title_value";break;case 18:return this.begin("acc_descr"),35;break;case 19:return this.popState(),"acc_descr_value";break;case 20:this.begin("acc_descr_multiline");break;case 21:this.popState();break;case 22:return"acc_descr_multiline_value";case 23:return this.pushState("CLASSDEF"),41;break;case 24:return this.popState(),this.pushState("CLASSDEFID"),"DEFAULT_CLASSDEF_ID";break;case 25:return this.popState(),this.pushState("CLASSDEFID"),42;break;case 26:return this.popState(),43;break;case 27:return this.pushState("CLASS"),48;break;case 28:return this.popState(),this.pushState("CLASS_STYLE"),49;break;case 29:return this.popState(),50;break;case 30:return this.pushState("STYLE"),45;break;case 31:return this.popState(),this.pushState("STYLEDEF_STYLES"),46;break;case 32:return this.popState(),47;break;case 33:return this.pushState("SCALE"),17;break;case 34:return 18;case 35:this.popState();break;case 36:this.pushState("STATE");break;case 37:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 38:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 39:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 40:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),25;break;case 41:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),26;break;case 42:return this.popState(),n.yytext=n.yytext.slice(0,-10).trim(),27;break;case 43:return 51;case 44:return 52;case 45:return 53;case 46:return 54;case 47:this.pushState("STATE_STRING");break;case 48:return this.pushState("STATE_ID"),"AS";break;case 49:if(!i())return;return this.popState(),"ID";break;case 50:this.popState();break;case 51:return"STATE_DESCR";case 52:throw Error('Error: State name must be a single word. Found: "'+n.yytext.trim()+'"');case 53:return 19;case 54:this.popState();break;case 55:return this.popState(),this.pushState("struct"),20;break;case 56:return this.popState(),21;break;case 57:break;case 58:return this.begin("NOTE"),29;break;case 59:return this.popState(),this.pushState("NOTE_ID"),59;break;case 60:return this.popState(),this.pushState("NOTE_ID"),60;break;case 61:this.popState(),this.pushState("FLOATING_NOTE");break;case 62:return this.popState(),this.pushState("FLOATING_NOTE_ID"),"AS";break;case 63:break;case 64:return"NOTE_TEXT";case 65:if(!i())return;return this.popState(),"ID";break;case 66:if(!i())return;return this.popState(),this.pushState("NOTE_TEXT"),24;break;case 67:return this.popState(),n.yytext=n.yytext.substr(2).trim(),31;break;case 68:return this.popState(),n.yytext=n.yytext.slice(0,-8).trim(),31;break;case 69:return 6;case 70:return 6;case 71:return 16;case 72:return 57;case 73:if(!i())return;return 24;case 74:return n.yytext=n.yytext.trim(),14;break;case 75:return 15;case 76:return 28;case 77:return 58;case 78:return 5;case 79:return"INVALID"}},"anonymous"),rules:[/^(?:click\b)/i,/^(?:href\b)/i,/^(?:"[^"]*")/i,/^(?:default\b)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:((?!\n)\s)+)/i,/^(?:#[^\n]*)/i,/^(?:%%(?!\{)[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:classDef\s+)/i,/^(?:DEFAULT\s+)/i,/^(?:\w+\s+)/i,/^(?:[^\n]*)/i,/^(?:class\s+)/i,/^(?:(\w+)+((,\s*\w+)*))/i,/^(?:[^\n]*)/i,/^(?:style\s+)/i,/^(?:[\w,]+\s+)/i,/^(?:[^\n]*)/i,/^(?:scale\s+)/i,/^(?:\d+)/i,/^(?:\s+width\b)/i,/^(?:state\s+)/i,/^(?:.*<<fork>>)/i,/^(?:.*<<join>>)/i,/^(?:.*<<choice>>)/i,/^(?:.*\[\[fork\]\])/i,/^(?:.*\[\[join\]\])/i,/^(?:.*\[\[choice\]\])/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:["])/i,/^(?:\s*as\s+)/i,/^(?:[^\n\{]*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\w+\s+\w+.*?\{)/i,/^(?:[^\n\s\{]+)/i,/^(?:\n)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:[\n])/i,/^(?:note\s+)/i,/^(?:left of\b)/i,/^(?:right of\b)/i,/^(?:")/i,/^(?:\s*as\s*)/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[^\n]*)/i,/^(?:\s*[^:\n\s\-]+)/i,/^(?:\s*:[^:\n;]+)/i,/^(?:[\s\S]*?\n\s*end note\b)/i,/^(?:stateDiagram\s+)/i,/^(?:stateDiagram-v2\s+)/i,/^(?:hide empty description\b)/i,/^(?:\[\*\])/i,/^(?:[^:\n\s\-\{]+)/i,/^(?:\s*:(?:[^:\n;]|:[^:\n;])+)/i,/^(?:-->)/i,/^(?:--)/i,/^(?::::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{LINE:{rules:[10,11,12],inclusive:!1},struct:{rules:[10,11,12,23,27,30,36,43,44,45,46,56,57,58,72,73,74,75,76,77],inclusive:!1},FLOATING_NOTE_ID:{rules:[65],inclusive:!1},FLOATING_NOTE:{rules:[62,63,64],inclusive:!1},NOTE_TEXT:{rules:[67,68],inclusive:!1},NOTE_ID:{rules:[66],inclusive:!1},NOTE:{rules:[59,60,61],inclusive:!1},STYLEDEF_STYLEOPTS:{rules:[],inclusive:!1},STYLEDEF_STYLES:{rules:[32],inclusive:!1},STYLE_IDS:{rules:[],inclusive:!1},STYLE:{rules:[31],inclusive:!1},CLASS_STYLE:{rules:[29],inclusive:!1},CLASS:{rules:[28],inclusive:!1},CLASSDEFID:{rules:[26],inclusive:!1},CLASSDEF:{rules:[24,25],inclusive:!1},acc_descr_multiline:{rules:[21,22],inclusive:!1},acc_descr:{rules:[19],inclusive:!1},acc_title:{rules:[17],inclusive:!1},SCALE:{rules:[14,15,34,35],inclusive:!1},ALIAS:{rules:[],inclusive:!1},STATE_ID:{rules:[49],inclusive:!1},STATE_STRING:{rules:[50,51],inclusive:!1},FORK_STATE:{rules:[],inclusive:!1},STATE:{rules:[10,11,12,37,38,39,40,41,42,47,48,52,53,54,55],inclusive:!1},ID:{rules:[10,11,12],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,12,13,16,18,20,23,27,30,33,36,55,58,69,70,71,72,73,74,75,77,78,79],inclusive:!0}}};return Q}();Lt.lexer=me;function kt(){this.yy={}}return t(kt,"Parser"),kt.prototype=Lt,Lt.Parser=kt,new kt}();Bt.parser=Bt;var Ee=Bt,_e="TB",qt="TB",Ut="dir",ot="state",nt="root",Gt="relation",ve="classDef",De="style",Ce="applyClass",ut="default",Qt="divider",Zt="fill:none",te="fill: #333",ee="c",se="markdown",re="normal",$t="rect",Pt="rectWithTitle",Ae="stateStart",xe="stateEnd",Yt="divider",Ht="roundedWithTitle",Le="note",we="noteGroup",ft="statediagram",Ie="state",Ne=`${ft}-${Ie}`,ie="transition",Oe="note",$e="note-edge",Fe=`${ie} ${$e}`,Pe=`${ft}-${Oe}`,Be="cluster",Ge=`${ft}-${Be}`,Ye="cluster-alt",Ve=`${ft}-${Ye}`,ae="parent",ne="note",Me="state",Vt="----",We=`${Vt}${ne}`,zt=`${Vt}${ae}`,At=new Map,Z=0,oe=0,ct=new Map,je=t((e,s,c,r)=>{if(e===Yt&&c?.id!==void 0&&ct.has(c.id)){let m=ct.get(c.id);return ct.set(s,m),m}let u=oe++,f=r?void 0:u;return ct.set(s,f),f},"colorSlotFor");function xt(e="",s=0,c="",r=Vt){let u=c!==null&&c.length>0?`${r}${c}`:"";return`${Me}-${e}${u}-${s}`}t(xt,"stateDomId");var Ue=t((e,s,c,r,u,f,m,k)=>{a.trace("items",s),s.forEach((o)=>{switch(o.stmt){case ot:dt(e,o,c,r,u,f,m,k);break;case ut:dt(e,o,c,r,u,f,m,k);break;case Gt:{dt(e,o.state1,c,r,u,f,m,k),dt(e,o.state2,c,r,u,f,m,k);let D=m==="neo",x={id:"edge"+Z,start:o.state1.id,end:o.state2.id,arrowhead:"normal",arrowTypeEnd:D?"arrow_barb_neo":"arrow_barb",style:Zt,labelStyle:"",label:b.sanitizeText(o.description??"",l()),arrowheadStyle:te,labelpos:ee,labelType:se,thickness:re,classes:ie,look:m};u.push(x),Z++}break}})},"setupDoc"),Kt=t((e,s=qt)=>{let c=s;if(e.doc){for(let r of e.doc)if(r.stmt==="dir")c=r.value}return c},"getDir");function ht(e,s,c){if(!s.id||s.id==="</join></fork>"||s.id==="</choice>")return;if(s.cssClasses){if(!Array.isArray(s.cssCompiledStyles))s.cssCompiledStyles=[];s.cssClasses.split(" ").forEach((u)=>{let f=c.get(u);if(f)s.cssCompiledStyles=[...s.cssCompiledStyles??[],...f.styles]})}let r=e.find((u)=>u.id===s.id);if(r)Object.assign(r,s);else e.push(s)}t(ht,"insertOrUpdateNode");function de(e){return e?.classes?.join(" ")??""}t(de,"getClassesFromDbInfo");function fe(e){return e?.styles??[]}t(fe,"getStylesFromDbInfo");var dt=t((e,s,c,r,u,f,m,k)=>{let o=s.id,D=c.get(o),x=de(D),G=fe(D),Y=l(),j=x.trim()!==""||G.length>0;if(a.info("dataFetcher parsedItem",s,D,G),o!=="root"){let O=$t;if(s.start===!0)O=Ae;else if(s.start===!1)O=xe;if(s.type!==ut)O=s.type;if(!At.get(o))At.set(o,{id:o,shape:O,description:b.sanitizeText(o,Y),cssClasses:`${x} ${Ne}`,cssStyles:G});let y=At.get(o);if(s.description){if(Array.isArray(y.description))y.shape=Pt,y.description.push(s.description);else if(y.description?.length&&y.description.length>0)if(y.shape=Pt,y.description===o)y.description=[s.description];else y.description=[y.description,s.description];else y.shape=$t,y.description=s.description;y.description=b.sanitizeTextOrArray(y.description,Y)}if(y.description?.length===1&&y.shape===Pt)if(y.type==="group")y.shape=Ht;else y.shape=$t;if(!y.type&&s.doc)a.info("Setting cluster for XCX",o,Kt(s)),y.type="group",y.isGroup=!0,y.dir=Kt(s),y.shape=s.type===Qt?Yt:Ht,y.colorIndex=je(y.shape,o,e,j),y.cssClasses=`${y.cssClasses} ${Ge} ${f?Ve:""}`;let V={labelStyle:"",shape:y.shape,label:y.description,cssClasses:y.cssClasses,cssCompiledStyles:[],cssStyles:y.cssStyles,id:o,dir:y.dir,domId:xt(o,Z),type:y.type,isGroup:y.type==="group",colorIndex:y.colorIndex,padding:8,rx:10,ry:10,look:m,labelType:"markdown"};if(V.shape===Yt)V.label="";if(e&&e.id!=="root")a.trace("Setting node ",o," to be child of its parent ",e.id),V.parentId=e.id;if(V.centerLabel=!0,s.note){let F={labelStyle:"",shape:Le,label:s.note.text,labelType:"markdown",cssClasses:Pe,cssStyles:[],cssCompiledStyles:[],id:o+We+"-"+Z,domId:xt(o,Z,ne),type:"node",isGroup:!1,padding:Y.flowchart?.padding,look:m,position:s.note.position},z=o+zt,W={labelStyle:"",shape:we,label:s.note.text,cssClasses:y.cssClasses,cssStyles:[],id:o+zt,domId:xt(o,Z,ae),type:"group",isGroup:!0,padding:16,look:m,position:s.note.position};Z++,W.id=z,F.parentId=z,ht(r,W,k),ht(r,F,k),ht(r,V,k);let K=o,N=F.id;if(s.note.position==="left of")K=F.id,N=o;u.push({id:K+"-"+N,start:K,end:N,arrowhead:"none",arrowTypeEnd:"",style:Zt,labelStyle:"",classes:Fe,pattern:"dashed",arrowheadStyle:te,labelpos:ee,labelType:se,thickness:re,look:m})}else ht(r,V,k)}if(s.doc)a.trace("Adding nodes children "),Ue(s,s.doc,c,r,u,!f,m,k)},"dataFetcher"),He=t(()=>{At.clear(),Z=0,oe=0,ct.clear()},"reset"),Se=t((e,s=qt)=>{if(!e.doc)return s;let c=s;for(let r of e.doc)if(r.stmt==="dir")c=r.value;return c},"getDir"),ze=t(function(e,s){return s.db.getClasses()},"getClasses"),Ke=t(async function(e,s,c,r){a.info("REF0:"),a.info("Drawing state diagram (v2)",s);let{securityLevel:u,state:f,layout:m}=l();r.db.extract(r.db.getRootDocV2());let k=r.db.getData(),o=he(s,u);if(k.type=r.type,k.layoutAlgorithm=ye(m),k.nodeSpacing=f?.nodeSpacing||50,k.rankSpacing=f?.rankSpacing||50,l().look==="neo")k.markers=["barbNeo"];else k.markers=["barb"];k.diagramId=s,await ge(k,o);let x=8;try{(typeof r.db.getLinks==="function"?r.db.getLinks():new Map).forEach((Y,j)=>{let O=typeof j==="string"?j:typeof j?.id==="string"?j.id:"",y=k.nodes.find((N)=>N.id===O);if(!O){a.warn("⚠️ Invalid or missing stateId from key:",JSON.stringify(j));return}let V=o.node()?.querySelectorAll("g.node, g.rough-node"),F;if(V?.forEach((N)=>{let st=N.textContent?.trim();if(N.id===y?.domId||st===O)F=N}),!F){a.warn("⚠️ Could not find node matching text:",O);return}let z=F.parentNode;if(!z){a.warn("⚠️ Node has no parent, cannot wrap:",O);return}let W=document.createElementNS("http://www.w3.org/2000/svg","a"),K=Y.url.replace(/^"+|"+$/g,"");if(W.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",K),W.setAttribute("target","_blank"),Y.tooltip){let N=Y.tooltip.replace(/^"+|"+$/g,"");W.setAttribute("title",N),F.setAttribute("title",N)}z.replaceChild(W,F),W.appendChild(F),a.info("\uD83D\uDD17 Wrapped node in <a> tag for:",O,Y.url)})}catch(G){a.error("❌ Error injecting clickable links:",G)}M.insertTitle(o,"statediagramTitleText",f?.titleTopMargin??25,r.db.getDiagramTitle()),ue(o,x,ft,f?.useMaxWidth??!0)},"draw"),Xe={getClasses:ze,draw:Ke,getDir:Se},B={START_NODE:"[*]",START_TYPE:"start",END_NODE:"[*]",END_TYPE:"end",COLOR_KEYWORD:"color",FILL_KEYWORD:"fill",BG_FILL:"bgFill",STYLECLASS_SEP:","},Xt=t(()=>new Map,"newClassesList"),Jt=t(()=>({relations:[],states:new Map,documents:{}}),"newDoc"),Ct=t((e)=>JSON.parse(JSON.stringify(e)),"clone"),Je=class{constructor(e){this.version=e,this.nodes=[],this.edges=[],this.rootDoc=[],this.classes=Xt(),this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.dividerCnt=0,this.links=new Map,this.funs=[],this.getAccTitle=E,this.setAccTitle=S,this.getAccDescription=A,this.setAccDescription=T,this.setDiagramTitle=L,this.getDiagramTitle=R,this.clear(),this.setRootDoc=this.setRootDoc.bind(this),this.getDividerId=this.getDividerId.bind(this),this.setDirection=this.setDirection.bind(this),this.trimColon=this.trimColon.bind(this),this.bindFunctions=this.bindFunctions.bind(this)}static{t(this,"StateDB")}static{this.relationType={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3}}extract(e){this.clear(!0);for(let r of Array.isArray(e)?e:e.doc)switch(r.stmt){case ot:this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case Gt:this.addRelation(r.state1,r.state2,r.description);break;case ve:this.addStyleClass(r.id.trim(),r.classes);break;case De:this.handleStyleDef(r);break;case Ce:this.setCssClass(r.id.trim(),r.styleClass);break;case"click":this.addLink(r.id,r.url,r.tooltip);break}let s=this.getStates(),c=l();He(),dt(void 0,this.getRootDocV2(),s,this.nodes,this.edges,!0,c.look,this.classes);for(let r of this.nodes){if(!Array.isArray(r.label))continue;if(r.description=r.label.slice(1),r.isGroup&&r.description.length>0)throw Error(`Group nodes can only have label. Remove the additional description for node [${r.id}]`);r.label=r.label[0]}}handleStyleDef(e){let s=e.id.trim().split(","),c=e.styleClass.split(",");for(let r of s){let u=this.getState(r);if(!u){let f=r.trim();this.addState(f),u=this.getState(f)}if(u)u.styles=c.map((f)=>f.replace(/;/g,"")?.trim())}}setRootDoc(e){if(a.info("Setting root doc",e),this.rootDoc=e,this.version===1)this.extract(e);else this.extract(this.getRootDocV2())}docTranslator(e,s,c){if(s.stmt===Gt){this.docTranslator(e,s.state1,!0),this.docTranslator(e,s.state2,!1);return}if(s.stmt===ot)if(s.id===B.START_NODE)s.id=e.id+(c?"_start":"_end"),s.start=c;else s.id=s.id.trim();if(s.stmt!==nt&&s.stmt!==ot||!s.doc)return;let r=[],u=[];for(let f of s.doc)if(f.type===Qt){let m=Ct(f);m.doc=Ct(u),r.push(m),u=[]}else u.push(f);if(r.length>0&&u.length>0){let f={stmt:ot,id:Xi(),type:"divider",doc:Ct(u)};r.push(Ct(f)),s.doc=r}s.doc.forEach((f)=>this.docTranslator(s,f,!0))}getRootDocV2(){return this.docTranslator({id:nt,stmt:nt},{id:nt,stmt:nt,doc:this.rootDoc},!0),{id:nt,doc:this.rootDoc}}addState(e,s=ut,c=void 0,r=void 0,u=void 0,f=void 0,m=void 0,k=void 0){let o=e?.trim();if(!this.currentDocument.states.has(o))a.info("Adding state ",o,r),this.currentDocument.states.set(o,{stmt:ot,id:o,descriptions:[],type:s,doc:c,note:u,classes:[],styles:[],textStyles:[]});else{let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);if(!D.doc)D.doc=c;if(!D.type)D.type=s}if(r)a.info("Setting state description",o,r),(Array.isArray(r)?r:[r]).forEach((x)=>this.addDescription(o,x.trim()));if(u){let D=this.currentDocument.states.get(o);if(!D)throw Error(`State not found: ${o}`);D.note=u,D.note.text=b.sanitizeText(D.note.text,l())}if(f)a.info("Setting state classes",o,f),(Array.isArray(f)?f:[f]).forEach((x)=>this.setCssClass(o,x.trim()));if(m)a.info("Setting state styles",o,m),(Array.isArray(m)?m:[m]).forEach((x)=>this.setStyle(o,x.trim()));if(k)a.info("Setting state styles",o,m),(Array.isArray(k)?k:[k]).forEach((x)=>this.setTextStyle(o,x.trim()))}clear(e){if(this.nodes=[],this.edges=[],this.funs=[this.setupToolTips.bind(this)],this.documents={root:Jt()},this.currentDocument=this.documents.root,this.startEndCount=0,this.classes=Xt(),!e)this.links=new Map,C()}getState(e){return this.currentDocument.states.get(e)}getStates(){return this.currentDocument.states}logDocuments(){a.info("Documents = ",this.documents)}getRelations(){return this.currentDocument.relations}addLink(e,s,c){this.links.set(e,{url:s,tooltip:c}),a.warn("Adding link",e,s,c)}getLinks(){return this.links}startIdIfNeeded(e=""){if(e===B.START_NODE)return this.startEndCount++,`${B.START_TYPE}${this.startEndCount}`;return e}startTypeIfNeeded(e="",s=ut){return e===B.START_NODE?B.START_TYPE:s}endIdIfNeeded(e=""){if(e===B.END_NODE)return this.startEndCount++,`${B.END_TYPE}${this.startEndCount}`;return e}endTypeIfNeeded(e="",s=ut){return e===B.END_NODE?B.END_TYPE:s}addRelationObjs(e,s,c=""){let r=this.startIdIfNeeded(e.id.trim()),u=this.startTypeIfNeeded(e.id.trim(),e.type),f=this.startIdIfNeeded(s.id.trim()),m=this.startTypeIfNeeded(s.id.trim(),s.type);this.addState(r,u,e.doc,e.description,e.note,e.classes,e.styles,e.textStyles),this.addState(f,m,s.doc,s.description,s.note,s.classes,s.styles,s.textStyles),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:b.sanitizeText(c,l())})}addRelation(e,s,c){if(typeof e==="object"&&typeof s==="object")this.addRelationObjs(e,s,c);else if(typeof e==="string"&&typeof s==="string"){let r=this.startIdIfNeeded(e.trim()),u=this.startTypeIfNeeded(e),f=this.endIdIfNeeded(s.trim()),m=this.endTypeIfNeeded(s);this.addState(r,u),this.addState(f,m),this.currentDocument.relations.push({id1:r,id2:f,relationTitle:c?b.sanitizeText(c,l()):void 0})}}addDescription(e,s){let c=this.currentDocument.states.get(e),r=s.startsWith(":")?s.replace(":","").trim():s;c?.descriptions?.push(b.sanitizeText(r,l()))}cleanupLabel(e){return e.startsWith(":")?e.slice(2).trim():e.trim()}getDividerId(){return this.dividerCnt++,`divider-id-${this.dividerCnt}`}addStyleClass(e,s=""){if(!this.classes.has(e))this.classes.set(e,{id:e,styles:[],textStyles:[]});let c=this.classes.get(e);if(s&&c)s.split(B.STYLECLASS_SEP).forEach((r)=>{let u=r.replace(/([^;]*);/,"$1").trim();if(RegExp(B.COLOR_KEYWORD).exec(r)){let m=u.replace(B.FILL_KEYWORD,B.BG_FILL).replace(B.COLOR_KEYWORD,B.FILL_KEYWORD);c.textStyles.push(m)}c.styles.push(u)})}getClasses(){return this.classes}setupToolTips(e){let s=Ft();p(e).select("svg").selectAll("g.node, g.rough-node").on("mouseover",(u)=>{let f=p(u.currentTarget),m=f.attr("title");if(m===null)return;let k=u.currentTarget?.getBoundingClientRect();s.transition().duration(200).style("opacity",".9"),s.style("left",window.scrollX+k.left+(k.right-k.left)/2+"px").style("top",window.scrollY+k.bottom+"px"),s.html(Re.sanitize(m)),f.classed("hover",!0)}).on("mouseout",(u)=>{s.transition().duration(500).style("opacity",0),p(u.currentTarget).classed("hover",!1)})}setCssClass(e,s){e.split(",").forEach((c)=>{let r=this.getState(c);if(!r){let u=c.trim();this.addState(u),r=this.getState(u)}r?.classes?.push(s)})}setStyle(e,s){this.getState(e)?.styles?.push(s)}setTextStyle(e,s){this.getState(e)?.textStyles?.push(s)}bindFunctions(e){this.funs.forEach((s)=>{s(e)})}getDirectionStatement(){return this.rootDoc.find((e)=>e.stmt===Ut)}getDirection(){return this.getDirectionStatement()?.value??_e}setDirection(e){let s=this.getDirectionStatement();if(s)s.value=e;else this.rootDoc.unshift({stmt:Ut,value:e})}trimColon(e){return e.startsWith(":")?e.slice(1).trim():e.trim()}getData(){let e=l();for(let s of this.nodes)if(s.wrappingWidth??=e.state?.wrappingWidth,!s.isGroup)s.minWidth??=e.state?.minNodeWidth;return{nodes:this.nodes,edges:this.edges,other:{},config:e,direction:Se(this.getRootDocV2())}}getConfig(){return l().state}},qe=t((e)=>{let{theme:s,bkgColorArray:c,borderColorArray:r}=e;if(!le(s,r))return"";let u=ce(e.look),f=pe(c),m="";for(let k=0;k<vt(r);k++){let o=r[k],D=f?`fill: ${c[k%c.length]};`:"",x=`[data-look="${u}"][data-color-id="color-${k}"]`;m+=`
|
|
7
7
|
|
|
8
8
|
/* The title strip: \`rect.outer\` spans the whole composite and \`rect.inner\` covers
|
|
9
9
|
the body, so what stays visible of \`outer\` is the band behind the label. */
|