@bkm016/basalt 0.1.1 → 0.1.3
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 +16 -22
- package/chunk-06hdzq5n.js +2 -0
- package/chunk-09rj27b2.js +2 -0
- package/{chunk-qnr1f5pj.js → chunk-0y7ne3d0.js} +2 -2
- package/{chunk-vgvq3q12.js → chunk-10xzzn07.js} +2 -2
- package/{chunk-6qertm2t.js → chunk-1qpces5a.js} +1 -1
- package/{chunk-nt2gntad.js → chunk-1zdwrgd4.js} +1 -1
- package/{chunk-sh74qzvt.js → chunk-27gntzs5.js} +4 -4
- package/{chunk-1v7st27a.js → chunk-2esbgxps.js} +14 -14
- package/{chunk-exnn1867.js → chunk-362g64pd.js} +1 -1
- package/{chunk-1aspj1hn.js → chunk-3cjsd292.js} +2 -2
- package/chunk-5c9j8qe4.js +478 -0
- package/{chunk-8dxzqwq3.js → chunk-5j1krv9v.js} +1 -1
- package/{chunk-vkkj4awb.js → chunk-6hssbcgj.js} +1 -1
- package/{chunk-1b7gbe8g.js → chunk-75m78j7x.js} +2 -2
- package/{chunk-kfq8wyd3.js → chunk-8296hw9m.js} +1 -1
- package/{chunk-szat3vp4.js → chunk-8d46jtbj.js} +2 -2
- package/{chunk-qczbfccb.js → chunk-8tjad3r0.js} +4 -4
- package/{chunk-agntrqs9.js → chunk-97rzj7f6.js} +1 -1
- package/{chunk-k7w7ac9q.js → chunk-981f9dw8.js} +8 -8
- package/{chunk-xysny0ve.js → chunk-aefadsy6.js} +2 -2
- package/{chunk-jhd54p1b.js → chunk-bannb9xm.js} +1 -1
- package/{chunk-0qqb6v41.js → chunk-bxn5kmpz.js} +120 -120
- package/{chunk-a3tqx584.js → chunk-c7x1zq39.js} +1 -1
- package/{chunk-rv06x0kn.js → chunk-cjc90f84.js} +1 -1
- package/{chunk-x3dnb9sz.js → chunk-d2j735sd.js} +2 -2
- package/{chunk-yskm0hsy.js → chunk-d8gtbw9g.js} +1 -1
- package/{chunk-rm3kcxq9.js → chunk-fjtvjrkg.js} +13 -13
- package/{chunk-h6sw8fbt.js → chunk-fm0k0qtz.js} +1 -1
- package/{chunk-1yzt0qm0.js → chunk-fw2bpqmw.js} +1 -1
- package/{chunk-45cz26ap.js → chunk-gp7y0fja.js} +13 -13
- package/{chunk-2bb01ddq.js → chunk-gzxnene8.js} +1 -1
- package/{chunk-a8nyk4k9.js → chunk-hwr56pfj.js} +1 -1
- package/{chunk-0hbjv3y6.js → chunk-jwdb0ccj.js} +3 -3
- package/{chunk-kf8hq21a.js → chunk-k23t7vhs.js} +5 -5
- package/{chunk-bhqyxyap.js → chunk-k506w58v.js} +1 -1
- package/{chunk-44ek81ad.js → chunk-k6w6y71k.js} +2 -2
- package/chunk-m40gxwq4.js +5 -0
- package/chunk-m8vkwdgr.js +5 -0
- package/{chunk-f7egr55n.js → chunk-mvfsxdx6.js} +13 -13
- package/{chunk-pvncysbb.js → chunk-nbb9trwz.js} +1 -1
- package/{chunk-0szjy61m.js → chunk-pbcy6zdt.js} +1 -1
- package/chunk-pmqtkqsf.js +2 -0
- package/{chunk-hat3s3pr.js → chunk-pxsrqrd0.js} +1 -1
- package/{chunk-xsbxykr4.js → chunk-qe0teyn1.js} +1 -1
- package/{chunk-2zqny2sy.js → chunk-r7fpkb49.js} +1 -1
- package/{chunk-3m7qwfm3.js → chunk-rtzqqngy.js} +3 -3
- package/{chunk-6e49xsf5.js → chunk-shadcb9z.js} +2 -2
- package/{chunk-cv5wsd9m.js → chunk-t6zs4kw0.js} +2 -2
- package/{chunk-hcn9cf6v.js → chunk-v258nxcz.js} +1 -1
- package/{chunk-a6r4z44b.js → chunk-vk1gxk1t.js} +1 -1
- package/{chunk-s37s3k24.js → chunk-x1xss1d7.js} +2 -2
- package/{chunk-dakrpbe6.js → chunk-x4874m8e.js} +2 -2
- package/{chunk-wx7kdf0b.js → chunk-xfvvh1s5.js} +1 -1
- package/{chunk-0yytz0r1.js → chunk-y0m980k3.js} +5 -5
- package/{chunk-dhm42y04.js → chunk-y58ygzn9.js} +3 -3
- package/{chunk-2wkaw73s.js → chunk-y648fzx0.js} +5 -5
- package/{chunk-32at88hc.js → chunk-y7nma9rk.js} +1 -1
- package/{chunk-pmc3y1z8.js → chunk-ykens1hy.js} +1 -1
- package/{chunk-q8zx3kt6.js → chunk-z55bmysw.js} +1 -1
- package/{chunk-qx0m82rw.js → chunk-zmsgwr3s.js} +1 -1
- package/{chunk-501zkf9b.js → chunk-ztsjgssj.js} +1 -1
- package/compiled.js +5 -5
- package/package.json +1 -1
- package/ui-test-worker.js +63 -63
- package/web/{chunk-b4wbk7vc.js → chunk-0xc2c540.js} +3 -3
- package/web/{chunk-dt462hk9.js → chunk-0z0jycs8.js} +1 -1
- package/web/chunk-166qe5j6.js +2 -0
- package/web/chunk-1c95wfvq.js +1 -0
- package/web/{chunk-qnaqf0cr.js → chunk-23c1df7e.js} +1 -1
- package/web/{chunk-jrcyc9s9.js → chunk-24h1rfje.js} +1 -1
- package/web/{chunk-fscafg24.js → chunk-2hd1pe9w.js} +5 -5
- package/web/chunk-329rtxa9.js +1 -0
- package/web/{chunk-9yakxvjb.js → chunk-33qwz9bc.js} +2 -2
- package/web/{chunk-qd8bxxdj.js → chunk-3qjnwsph.js} +1 -1
- package/web/{chunk-p3b9crsa.js → chunk-47q4hmfp.js} +2 -2
- package/web/{chunk-y49fhfda.js → chunk-4fzj0azw.js} +1 -1
- package/web/{chunk-22a4ety5.js → chunk-5b2nw6j1.js} +1 -1
- package/web/{chunk-bgnnrpna.js → chunk-5hmfk69r.js} +4 -4
- package/web/{chunk-tqmwd9qp.js → chunk-5qqw2e0t.js} +1 -1
- package/web/{chunk-3jhyzmnf.js → chunk-61jahh35.js} +3 -3
- package/web/chunk-6gxf3vsg.js +1 -0
- package/web/{chunk-qefasa1j.js → chunk-6parf7sy.js} +1 -1
- package/web/{chunk-2m12wyrb.js → chunk-7520nrbb.js} +1 -1
- package/web/{chunk-9p12mgs6.js → chunk-7ba8vrfc.js} +1 -1
- package/web/{chunk-fm2ybfj5.js → chunk-7qxhk1kz.js} +4 -4
- package/web/{chunk-w880psmw.js → chunk-7v5rxabp.js} +1 -1
- package/web/{chunk-kdyjnwdx.js → chunk-7xk0ntav.js} +2 -2
- package/web/{chunk-q0p5xqe1.js → chunk-7yc083xj.js} +4 -4
- package/web/{chunk-b1pe46zz.js → chunk-89fkdgbp.js} +1 -1
- package/web/{chunk-v28fx2nd.js → chunk-8qgpfxkz.js} +1 -1
- package/web/{chunk-2ps6mepk.js → chunk-90xqeczk.js} +3 -3
- package/web/{chunk-fz06t6km.js → chunk-97b62pvb.js} +1 -1
- package/web/{chunk-a1z5qx1r.js → chunk-9a3q0jsh.js} +3 -3
- package/web/{chunk-xjxv8dg8.js → chunk-9bgey148.js} +4 -4
- package/web/{chunk-70qwwwak.js → chunk-9xh96b33.js} +1 -1
- package/web/{chunk-e6jxqbv7.js → chunk-a5sg33w2.js} +1 -1
- package/web/chunk-a91vxtx4.js +1 -0
- package/web/{chunk-pf2ab8p8.js → chunk-acybsx44.js} +1 -1
- package/web/chunk-agec7jj4.js +1 -0
- package/web/{chunk-e53wfgb8.js → chunk-axkyft9f.js} +1 -1
- package/web/{chunk-bc78qf1m.js → chunk-b0a8nbj0.js} +5 -5
- package/web/chunk-c516cghj.js +1 -0
- package/web/chunk-cqp1d4p0.js +1 -0
- package/web/{chunk-05w4fyzc.js → chunk-cwtdnacf.js} +1 -1
- package/web/chunk-dg1vas6z.js +8 -0
- package/web/{chunk-0mrkjnte.js → chunk-ds7srg4p.js} +1 -1
- package/web/{chunk-bjkc94mv.js → chunk-ep37qp12.js} +1 -1
- package/web/{chunk-90kp4pnz.js → chunk-eqsd8zta.js} +1 -1
- package/web/{chunk-ss1bcb0n.js → chunk-es28k2t7.js} +2 -2
- package/web/chunk-fc0nx23g.js +1 -0
- package/web/chunk-fhnypcrm.js +1139 -0
- package/web/{chunk-2scce33n.js → chunk-fv60p68p.js} +1 -1
- package/web/{chunk-rpmpttbk.js → chunk-g46f421r.js} +1 -1
- package/web/{chunk-2msj52w6.js → chunk-h18tnrf2.js} +1 -1
- package/web/{chunk-a5x2zveg.js → chunk-h288yd5w.js} +1 -1
- package/web/{chunk-8p4tc9f4.js → chunk-hszjc2ny.js} +3 -3
- package/web/{chunk-4ks96e4r.js → chunk-j0bwwc1g.js} +1 -1
- package/web/{chunk-9dxjafp2.js → chunk-jqa39f8t.js} +2 -2
- package/web/chunk-jvbbrnpa.js +1 -0
- package/web/{chunk-wptv8atc.js → chunk-jzfd7cyh.js} +1 -1
- package/web/chunk-ka9ak8wr.js +1 -0
- package/web/{chunk-9an7cjd9.js → chunk-mb4qx9hy.js} +2 -2
- package/web/chunk-mnjd59jk.js +1 -0
- package/web/{chunk-xbty0rv7.js → chunk-mwj9tpkz.js} +1 -1
- package/web/{chunk-taynqrgq.js → chunk-n8gfjj9a.js} +2 -2
- package/web/{chunk-20q90epj.js → chunk-n8sky2q6.js} +1 -1
- package/web/chunk-ng0nbfhh.js +1 -0
- package/web/chunk-nz9nxk48.js +1 -0
- package/web/{chunk-0vt9fg48.js → chunk-p9hsd3rn.js} +2 -2
- package/web/chunk-phw908hn.js +1 -0
- package/web/chunk-pjmmma1k.js +1 -0
- package/web/chunk-q7yn4m3t.js +1 -0
- package/web/chunk-qh15dxav.css +1 -0
- package/web/chunk-qnhqexe0.js +1 -0
- package/web/{chunk-bj90t5gh.js → chunk-rcx1aee5.js} +4 -4
- package/web/chunk-rjqj6ffe.js +1 -0
- package/web/{chunk-g4azyef7.js → chunk-rks7ksv3.js} +1 -1
- package/web/{chunk-q5ke7a33.js → chunk-sb1cjpq8.js} +1 -1
- package/web/{chunk-e32y85kx.js → chunk-sgvp8vge.js} +1 -1
- package/web/chunk-sjjwte12.js +1 -0
- package/web/{chunk-xrxne80b.js → chunk-sn9ecfvy.js} +1 -1
- package/web/{chunk-z7dcbxws.js → chunk-t7bwsdbr.js} +1 -1
- package/web/{chunk-fk0dh93x.js → chunk-tse9gvyq.js} +5 -5
- package/web/{chunk-a3verqw9.js → chunk-tx8240k4.js} +5 -5
- package/web/{chunk-dzwxgqgm.js → chunk-vd6y2pcm.js} +2 -2
- package/web/{chunk-5vw9rs4r.js → chunk-vpa55vje.js} +3 -3
- package/web/{chunk-y0m8hrwz.js → chunk-vymqrpm3.js} +77 -77
- package/web/{chunk-tmvakq7n.js → chunk-w7snhcyg.js} +4 -4
- package/web/{chunk-qh7265qw.js → chunk-wdtnhpd6.js} +2 -2
- package/web/{chunk-3ee04tmm.js → chunk-wmvd6j0b.js} +5 -5
- package/web/{chunk-yd46jhqv.js → chunk-xnq41dgs.js} +1 -1
- package/web/{chunk-45fzdcgz.js → chunk-xvsmtetz.js} +5 -5
- package/web/{chunk-ca682sm6.js → chunk-y3ajqthy.js} +14 -14
- package/web/{chunk-f26smjjf.js → chunk-yd1ez3wd.js} +1 -1
- package/web/chunk-yfbxtg5p.js +1 -0
- package/web/{chunk-4v8en1yw.js → chunk-ywp4s71k.js} +1 -1
- package/web/{chunk-gqw3f02j.js → chunk-z4x331rx.js} +5 -5
- package/web/{chunk-jwzd9tzk.js → chunk-z6bpamwq.js} +2 -2
- package/web/{chunk-hev4hq89.js → chunk-zmdnxn6m.js} +2 -2
- package/web/{icon-yx2p2pye.svg → icon-1wgy7kzy.svg} +13 -13
- package/web/icon.svg +13 -13
- package/web/index.html +2 -2
- package/web/install.sh +0 -0
- package/web/sw.js +9 -0
- package/worker.js +1 -1
- package/chunk-09vr609h.js +0 -2
- package/chunk-58vz2qsq.js +0 -2
- package/chunk-c25s4w6a.js +0 -5
- package/chunk-t057xfrt.js +0 -5
- package/chunk-wjd9fr23.js +0 -2
- package/chunk-zef13k3h.js +0 -471
- package/web/chunk-2pver6r4.js +0 -1
- package/web/chunk-37ajk6zg.js +0 -2
- package/web/chunk-4wkm9fda.js +0 -1
- package/web/chunk-amzgyy1k.js +0 -1
- package/web/chunk-cff5hcm8.js +0 -8
- package/web/chunk-esp1mmgr.js +0 -1
- package/web/chunk-ew3cgdtd.js +0 -1
- package/web/chunk-gjq1pxw3.js +0 -1
- package/web/chunk-h5ejbf6e.js +0 -1
- package/web/chunk-jjh5jvva.js +0 -1
- package/web/chunk-k5btcvbg.js +0 -1
- package/web/chunk-kpvgecwy.js +0 -1
- package/web/chunk-kq40ss39.js +0 -1
- package/web/chunk-q7dsnvpf.js +0 -1
- package/web/chunk-rg426vkf.js +0 -1
- package/web/chunk-ry9256r7.js +0 -1
- package/web/chunk-scpwc9ev.js +0 -1
- package/web/chunk-ssy07dd2.js +0 -1
- package/web/chunk-tgpbhzn9.js +0 -1
- package/web/chunk-vt40e1kp.js +0 -1136
- package/web/chunk-w53rba6g.js +0 -1
- package/web/chunk-w86n42dy.js +0 -1
- package/web/chunk-wtawdeej.css +0 -1
- package/web/chunk-zde7mj43.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{hn}from"./chunk-9p12mgs6.js";import{W}from"./chunk-b1pe46zz.js";import{e,r,D,b,y,C,S,E,T,A,I,L,s,wr,p,Ui,U,N}from"./chunk-y0m8hrwz.js";import{X}from"./chunk-taynqrgq.js";var v={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Ce=D.gitGraph,J=e(()=>U({...Ce,...b().gitGraph}),"getConfig"),m=new hn(()=>{let t=J(),{mainBranchName:a,mainBranchOrder:o}=t;return{mainBranchName:a,commits:new Map,head:null,branchConfig:new Map([[a,{name:a,order:o}]]),branches:new Map([[a,null]]),currBranch:a,direction:"LR",seq:0,options:{}}});function ne(){return Ui({length:7})}e(ne,"getID");function pe(t,a){let o=Object.create(null);return t.reduce((i,d)=>{let l=a(d);if(!o[l])o[l]=!0,i.push(d);return i},[])}e(pe,"uniqBy");var ve=e(function(t){m.records.direction=t},"setDirection"),Ee=e(function(t){r.debug("options str",t),t=t?.trim(),t=t||"{}";try{m.records.options=JSON.parse(t)}catch(a){r.error("error while parsing gitGraph options",a.message)}},"setOptions"),Te=e(function(){return m.records.options},"getOptions"),Le=e(function(t){let{msg:a,id:o,type:i,tags:d}=t;r.info("commit",a,o,i,d),r.debug("Entering commit:",a,o,i,d);let l=J();o=y.sanitizeText(o,l),a=y.sanitizeText(a,l),d=d?.map((n)=>y.sanitizeText(n,l));let c={id:o?o:m.records.seq+"-"+ne(),message:a,seq:m.records.seq++,type:i??v.NORMAL,tags:d??[],parents:m.records.head==null?[]:[m.records.head.id],branch:m.records.currBranch};if(m.records.head=c,r.info("main branch",l.mainBranchName),m.records.commits.has(c.id))r.warn(`Commit ID ${c.id} already exists`);m.records.commits.set(c.id,c),m.records.branches.set(m.records.currBranch,c.id),r.debug("in pushCommit "+c.id)},"commit"),Me=e(function(t){let{name:a,order:o}=t;if(a=y.sanitizeText(a,J()),m.records.branches.has(a))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 ${a}")`);m.records.branches.set(a,m.records.head!=null?m.records.head.id:null),m.records.branchConfig.set(a,{name:a,order:o}),ye(a),r.debug("in createBranch")},"branch"),Pe=e((t)=>{let{branch:a,id:o,type:i,tags:d}=t,l=J();if(a=y.sanitizeText(a,l),o)o=y.sanitizeText(o,l);let c=m.records.branches.get(m.records.currBranch),n=m.records.branches.get(a),g=c?m.records.commits.get(c):void 0,x=n?m.records.commits.get(n):void 0;if(g&&x&&g.branch===a)throw Error(`Cannot merge branch '${a}' into itself.`);if(m.records.currBranch===a){let h=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:["branch abc"]},h}if(g===void 0||!g){let h=Error(`Incorrect usage of "merge". Current branch (${m.records.currBranch})has no commits`);throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:["commit"]},h}if(!m.records.branches.has(a)){let h=Error('Incorrect usage of "merge". Branch to be merged ('+a+") does not exist");throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:[`branch ${a}`]},h}if(x===void 0||!x){let h=Error('Incorrect usage of "merge". Branch to be merged ('+a+") has no commits");throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:['"commit"']},h}if(g===x){let h=Error('Incorrect usage of "merge". Both branches have same head');throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:["branch abc"]},h}if(o&&m.records.commits.has(o)){let h=Error('Incorrect usage of "merge". Commit with id:'+o+" already exists, use different custom id");throw h.hash={text:`merge ${a} ${o} ${i} ${d?.join(" ")}`,token:`merge ${a} ${o} ${i} ${d?.join(" ")}`,expected:[`merge ${a} ${o}_UNIQUE ${i} ${d?.join(" ")}`]},h}let u=n?n:"",f={id:o||`${m.records.seq}-${ne()}`,message:`merged branch ${a} 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:i,customId:o?!0:!1,tags:d??[]};m.records.head=f,m.records.commits.set(f.id,f),m.records.branches.set(m.records.currBranch,f.id),r.debug(m.records.branches),r.debug("in mergeBranch")},"merge"),Re=e(function(t){let{id:a,targetId:o,tags:i,parent:d}=t;r.debug("Entering cherryPick:",a,o,i);let l=J();if(a=y.sanitizeText(a,l),o=y.sanitizeText(o,l),i=i?.map((g)=>y.sanitizeText(g,l)),d=y.sanitizeText(d,l),!a||!m.records.commits.has(a)){let g=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw g.hash={text:`cherryPick ${a} ${o}`,token:`cherryPick ${a} ${o}`,expected:["cherry-pick abc"]},g}let c=m.records.commits.get(a);if(c===void 0||!c)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(d&&!(Array.isArray(c.parents)&&c.parents.includes(d)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let n=c.branch;if(c.type===v.MERGE&&!d)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(n===m.records.currBranch){let f=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${a} ${o}`,token:`cherryPick ${a} ${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 ${a} ${o}`,token:`cherryPick ${a} ${o}`,expected:["cherry-pick abc"]},f}let x=m.records.commits.get(g);if(x===void 0||!x){let f=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${a} ${o}`,token:`cherryPick ${a} ${o}`,expected:["cherry-pick abc"]},f}let u={id:m.records.seq+"-"+ne(),message:`cherry-picked ${c?.message} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,c.id],branch:m.records.currBranch,type:v.CHERRY_PICK,tags:i?i.filter(Boolean):[`cherry-pick:${c.id}${c.type===v.MERGE?`|parent:${d}`:""}`]};m.records.head=u,m.records.commits.set(u.id,u),m.records.branches.set(m.records.currBranch,u.id),r.debug(m.records.branches),r.debug("in cherryPick")}},"cherryPick"),ye=e(function(t){if(t=y.sanitizeText(t,J()),!m.records.branches.has(t)){let a=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw a.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},a}else{m.records.currBranch=t;let a=m.records.branches.get(m.records.currBranch);if(a===void 0||!a)m.records.head=null;else m.records.head=m.records.commits.get(a)??null}},"checkout");function he(t,a,o){let i=t.indexOf(a);if(i===-1)t.push(o);else t.splice(i,1,o)}e(he,"upsert");function me(t){let a=t.reduce((d,l)=>{if(d.seq>l.seq)return d;return l},t[0]),o="";t.forEach(function(d){if(d===a)o+="\t*";else o+="\t|"});let i=[o,a.id,a.seq];for(let d in m.records.branches)if(m.records.branches.get(d)===a.id)i.push(d);if(r.debug(i.join(" ")),a.parents&&a.parents.length==2&&a.parents[0]&&a.parents[1]){let d=m.records.commits.get(a.parents[0]);if(he(t,a,d),a.parents[1])t.push(m.records.commits.get(a.parents[1]))}else if(a.parents.length==0)return;else if(a.parents[0]){let d=m.records.commits.get(a.parents[0]);he(t,a,d)}t=pe(t,(d)=>d.id),me(t)}e(me,"prettyPrintCommitHistory");var Oe=e(function(){r.debug(m.records.commits);let t=xe()[0];me([t])},"prettyPrint"),Ie=e(function(){m.reset(),C()},"clear"),_e=e(function(){return[...m.records.branchConfig.values()].map((a,o)=>{if(a.order!==null&&a.order!==void 0)return a;return{...a,order:parseFloat(`0.${o}`)}}).sort((a,o)=>(a.order??0)-(o.order??0)).map(({name:a})=>({name:a}))},"getBranchesAsObjArray"),Ge=e(function(){return m.records.branches},"getBranches"),De=e(function(){return m.records.commits},"getCommits"),xe=e(function(){let t=[...m.records.commits.values()];return t.forEach(function(a){r.debug(a.id)}),t.sort((a,o)=>a.seq-o.seq),t},"getCommitsArray"),We=e(function(){return m.records.currBranch},"getCurrentBranch"),qe=e(function(){return m.records.direction},"getDirection"),Ae=e(function(){return m.records.head},"getHead"),ue={commitType:v,getConfig:J,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:I,getDiagramTitle:L},He=e((t,a)=>{if(W(t,a),t.dir)a.setDirection(t.dir);for(let o of t.statements)Se(o,a)},"populate"),Se=e((t,a)=>{let i={Commit:e((d)=>a.commit(Ne(d)),"Commit"),Branch:e((d)=>a.branch(Fe(d)),"Branch"),Merge:e((d)=>a.merge(ze(d)),"Merge"),Checkout:e((d)=>a.checkout(Ye(d)),"Checkout"),CherryPicking:e((d)=>a.cherryPick(je(d)),"CherryPicking")}[t.$type];if(i)i(t);else r.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),Ne=e((t)=>({id:t.id,msg:t.message??"",type:t.type!==void 0?v[t.type]:v.NORMAL,tags:t.tags??void 0}),"parseCommit"),Fe=e((t)=>({name:t.name,order:t.order??0}),"parseBranch"),ze=e((t)=>({branch:t.branch,id:t.id??"",type:t.type!==void 0?v[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),Ye=e((t)=>t.branch,"parseCheckout"),je=e((t)=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),Ke={parse:e(async(t)=>{let a=await X("gitGraph",t);r.debug(a),He(a,ue)},"parse")},j=10,K=40,H=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=e((t,a,o=!1)=>{if(o&&t>0)return(t-1)%(a-1)+1;return t%a},"calcColorIndex"),_=new Map,G=new Map,oe=30,te=new Map,se=[],Y=0,B="LR",Ve=e(()=>{_.clear(),G.clear(),te.clear(),Y=0,se=[],B="LR"},"clear"),be=e((t)=>{let a=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof t==="string"?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach((i)=>{let d=document.createElementNS("http://www.w3.org/2000/svg","tspan");d.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),d.setAttribute("dy","1em"),d.setAttribute("x","0"),d.setAttribute("class","row"),d.textContent=i.trim(),a.appendChild(d)}),a},"drawText"),we=e((t)=>{let a,o,i;if(B==="BT")o=e((d,l)=>d<=l,"comparisonFunc"),i=1/0;else o=e((d,l)=>d>=l,"comparisonFunc"),i=0;return t.forEach((d)=>{let l=B==="TB"||B=="BT"?G.get(d)?.y:G.get(d)?.x;if(l!==void 0&&o(l,i))a=d,i=l}),a},"findClosestParent"),Ze=e((t)=>{let a="",o=1/0;return t.forEach((i)=>{let d=G.get(i).y;if(d<=o)a=i,o=d}),a||void 0},"findClosestParentBT"),Xe=e((t,a,o)=>{let i=o,d=o,l=[];t.forEach((c)=>{let n=a.get(c);if(!n)throw Error(`Commit not found for key ${c}`);if(n.parents.length)i=Qe(n),d=Math.max(i,d);else l.push(n);et(n,i)}),i=d,l.forEach((c)=>{tt(c,i,o)}),t.forEach((c)=>{let n=a.get(c);if(n?.parents.length){let g=Ze(n.parents);if(i=G.get(g).y-K,i<=d)d=i;let x=_.get(n.branch).pos,u=i-j;G.set(n.id,{x,y:u})}})},"setParallelBTPos"),Je=e((t)=>{let a=we(t.parents.filter((i)=>i!==null));if(!a)throw Error(`Closest parent not found for commit ${t.id}`);let o=G.get(a)?.y;if(o===void 0)throw Error(`Closest parent position not found for commit ${t.id}`);return o},"findClosestParentPos"),Qe=e((t)=>Je(t)+K,"calculateCommitPosition"),et=e((t,a)=>{let o=_.get(t.branch);if(!o)throw Error(`Branch not found for commit ${t.id}`);let i=o.pos,d=a+j;return G.set(t.id,{x:i,y:d}),{x:i,y:d}},"setCommitPosition"),tt=e((t,a,o)=>{let i=_.get(t.branch);if(!i)throw Error(`Branch not found for commit ${t.id}`);let d=a+o,l=i.pos;G.set(t.id,{x:l,y:d})},"setRootPosition"),rt=e((t,a,o,i,d,l)=>{let{theme:c}=s(),n=ce.has(c??""),g=ge.has(c??""),x=Ue.has(c??"");if(l===v.HIGHLIGHT)t.append("rect").attr("x",o.x-10+(n?3:0)).attr("y",o.y-10+(n?3:0)).attr("width",n?14:20).attr("height",n?14:20).attr("class",`commit ${a.id} commit-highlight${Z(d,V,g)} ${i}-outer`),t.append("rect").attr("x",o.x-6+(n?2:0)).attr("y",o.y-6+(n?2:0)).attr("width",n?8:12).attr("height",n?8:12).attr("class",`commit ${a.id} commit${Z(d,V,g)} ${i}-inner`);else if(l===v.CHERRY_PICK)t.append("circle").attr("cx",o.x).attr("cy",o.y).attr("r",n?7:10).attr("class",`commit ${a.id} ${i}`),t.append("circle").attr("cx",o.x-3).attr("cy",o.y+2).attr("r",n?2.5:2.75).attr("fill",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`),t.append("circle").attr("cx",o.x+3).attr("cy",o.y+2).attr("r",n?2.5:2.75).attr("fill",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`),t.append("line").attr("x1",o.x+3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`),t.append("line").attr("x1",o.x-3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`);else{let u=t.append("circle");if(u.attr("cx",o.x),u.attr("cy",o.y),u.attr("r",n?7:10),u.attr("class",`commit ${a.id} commit${Z(d,V,g)}`),l===v.MERGE){let f=t.append("circle");f.attr("cx",o.x),f.attr("cy",o.y),f.attr("r",n?5:6),f.attr("class",`commit ${i} ${a.id} commit${Z(d,V,g)}`)}if(l===v.REVERSE){let f=t.append("path"),h=n?4:5;f.attr("d",`M ${o.x-h},${o.y-h}L${o.x+h},${o.y+h}M${o.x-h},${o.y+h}L${o.x+h},${o.y-h}`).attr("class",`commit ${i} ${a.id} commit${Z(d,V,g)}`)}}},"drawCommitBullet"),at=e((t,a,o,i,d)=>{if(a.type!==v.CHERRY_PICK&&(a.customId&&a.type===v.MERGE||a.type!==v.MERGE)&&d.showCommitLabel){let l=t.append("g"),c=l.insert("rect").attr("class","commit-label-bkg"),n=l.append("text").attr("x",i).attr("y",o.y+25).attr("class","commit-label").text(a.id),g=n.node()?.getBBox();if(g){if(c.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")c.attr("x",o.x-(g.width+4*H+5)).attr("y",o.y-12),n.attr("x",o.x-(g.width+4*H)).attr("y",o.y+g.height-12);else n.attr("x",o.posWithOffset-g.width/2);if(d.rotateCommitLabel)if(B==="TB"||B==="BT")n.attr("transform","rotate(-45, "+o.x+", "+o.y+")"),c.attr("transform","rotate(-45, "+o.x+", "+o.y+")");else{let x=-7.5-(g.width+10)/25*9.5,u=10+g.width/25*8.5;l.attr("transform","translate("+x+", "+u+") rotate(-45, "+i+", "+o.y+")")}}}},"drawCommitLabel"),ot=e((t,a,o,i)=>{if(a.tags.length>0){let d=0,l=0,c=0,n=[];for(let g of a.tags.reverse()){let x=t.insert("polygon"),u=t.append("circle"),f=t.append("text").attr("y",o.y-16-d).attr("class","tag-label").text(g),h=f.node()?.getBBox();if(!h)throw Error("Tag bbox not found");l=Math.max(l,h.width),c=Math.max(c,h.height),f.attr("x",o.posWithOffset-h.width/2),n.push({tag:f,hole:u,rect:x,yOffset:d}),d+=20}for(let{tag:g,hole:x,rect:u,yOffset:f}of n){let h=c/2,k=o.y-19.2-f;if(u.attr("class","tag-label-bkg").attr("points",`
|
|
1
|
+
import{hn}from"./chunk-7ba8vrfc.js";import{W}from"./chunk-89fkdgbp.js";import{e,r,D,b,y,C,S,E,T,A,I,L,s,wr,p,Ui,U,N}from"./chunk-vymqrpm3.js";import{X}from"./chunk-n8gfjj9a.js";var v={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Ce=D.gitGraph,J=e(()=>U({...Ce,...b().gitGraph}),"getConfig"),m=new hn(()=>{let t=J(),{mainBranchName:a,mainBranchOrder:o}=t;return{mainBranchName:a,commits:new Map,head:null,branchConfig:new Map([[a,{name:a,order:o}]]),branches:new Map([[a,null]]),currBranch:a,direction:"LR",seq:0,options:{}}});function ne(){return Ui({length:7})}e(ne,"getID");function pe(t,a){let o=Object.create(null);return t.reduce((i,d)=>{let l=a(d);if(!o[l])o[l]=!0,i.push(d);return i},[])}e(pe,"uniqBy");var ve=e(function(t){m.records.direction=t},"setDirection"),Ee=e(function(t){r.debug("options str",t),t=t?.trim(),t=t||"{}";try{m.records.options=JSON.parse(t)}catch(a){r.error("error while parsing gitGraph options",a.message)}},"setOptions"),Te=e(function(){return m.records.options},"getOptions"),Le=e(function(t){let{msg:a,id:o,type:i,tags:d}=t;r.info("commit",a,o,i,d),r.debug("Entering commit:",a,o,i,d);let l=J();o=y.sanitizeText(o,l),a=y.sanitizeText(a,l),d=d?.map((n)=>y.sanitizeText(n,l));let c={id:o?o:m.records.seq+"-"+ne(),message:a,seq:m.records.seq++,type:i??v.NORMAL,tags:d??[],parents:m.records.head==null?[]:[m.records.head.id],branch:m.records.currBranch};if(m.records.head=c,r.info("main branch",l.mainBranchName),m.records.commits.has(c.id))r.warn(`Commit ID ${c.id} already exists`);m.records.commits.set(c.id,c),m.records.branches.set(m.records.currBranch,c.id),r.debug("in pushCommit "+c.id)},"commit"),Me=e(function(t){let{name:a,order:o}=t;if(a=y.sanitizeText(a,J()),m.records.branches.has(a))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 ${a}")`);m.records.branches.set(a,m.records.head!=null?m.records.head.id:null),m.records.branchConfig.set(a,{name:a,order:o}),ye(a),r.debug("in createBranch")},"branch"),Pe=e((t)=>{let{branch:a,id:o,type:i,tags:d}=t,l=J();if(a=y.sanitizeText(a,l),o)o=y.sanitizeText(o,l);let c=m.records.branches.get(m.records.currBranch),n=m.records.branches.get(a),g=c?m.records.commits.get(c):void 0,x=n?m.records.commits.get(n):void 0;if(g&&x&&g.branch===a)throw Error(`Cannot merge branch '${a}' into itself.`);if(m.records.currBranch===a){let h=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:["branch abc"]},h}if(g===void 0||!g){let h=Error(`Incorrect usage of "merge". Current branch (${m.records.currBranch})has no commits`);throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:["commit"]},h}if(!m.records.branches.has(a)){let h=Error('Incorrect usage of "merge". Branch to be merged ('+a+") does not exist");throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:[`branch ${a}`]},h}if(x===void 0||!x){let h=Error('Incorrect usage of "merge". Branch to be merged ('+a+") has no commits");throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:['"commit"']},h}if(g===x){let h=Error('Incorrect usage of "merge". Both branches have same head');throw h.hash={text:`merge ${a}`,token:`merge ${a}`,expected:["branch abc"]},h}if(o&&m.records.commits.has(o)){let h=Error('Incorrect usage of "merge". Commit with id:'+o+" already exists, use different custom id");throw h.hash={text:`merge ${a} ${o} ${i} ${d?.join(" ")}`,token:`merge ${a} ${o} ${i} ${d?.join(" ")}`,expected:[`merge ${a} ${o}_UNIQUE ${i} ${d?.join(" ")}`]},h}let u=n?n:"",f={id:o||`${m.records.seq}-${ne()}`,message:`merged branch ${a} 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:i,customId:o?!0:!1,tags:d??[]};m.records.head=f,m.records.commits.set(f.id,f),m.records.branches.set(m.records.currBranch,f.id),r.debug(m.records.branches),r.debug("in mergeBranch")},"merge"),Re=e(function(t){let{id:a,targetId:o,tags:i,parent:d}=t;r.debug("Entering cherryPick:",a,o,i);let l=J();if(a=y.sanitizeText(a,l),o=y.sanitizeText(o,l),i=i?.map((g)=>y.sanitizeText(g,l)),d=y.sanitizeText(d,l),!a||!m.records.commits.has(a)){let g=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw g.hash={text:`cherryPick ${a} ${o}`,token:`cherryPick ${a} ${o}`,expected:["cherry-pick abc"]},g}let c=m.records.commits.get(a);if(c===void 0||!c)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(d&&!(Array.isArray(c.parents)&&c.parents.includes(d)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let n=c.branch;if(c.type===v.MERGE&&!d)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(n===m.records.currBranch){let f=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw f.hash={text:`cherryPick ${a} ${o}`,token:`cherryPick ${a} ${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 ${a} ${o}`,token:`cherryPick ${a} ${o}`,expected:["cherry-pick abc"]},f}let x=m.records.commits.get(g);if(x===void 0||!x){let f=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw f.hash={text:`cherryPick ${a} ${o}`,token:`cherryPick ${a} ${o}`,expected:["cherry-pick abc"]},f}let u={id:m.records.seq+"-"+ne(),message:`cherry-picked ${c?.message} into ${m.records.currBranch}`,seq:m.records.seq++,parents:m.records.head==null?[]:[m.records.head.id,c.id],branch:m.records.currBranch,type:v.CHERRY_PICK,tags:i?i.filter(Boolean):[`cherry-pick:${c.id}${c.type===v.MERGE?`|parent:${d}`:""}`]};m.records.head=u,m.records.commits.set(u.id,u),m.records.branches.set(m.records.currBranch,u.id),r.debug(m.records.branches),r.debug("in cherryPick")}},"cherryPick"),ye=e(function(t){if(t=y.sanitizeText(t,J()),!m.records.branches.has(t)){let a=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw a.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},a}else{m.records.currBranch=t;let a=m.records.branches.get(m.records.currBranch);if(a===void 0||!a)m.records.head=null;else m.records.head=m.records.commits.get(a)??null}},"checkout");function he(t,a,o){let i=t.indexOf(a);if(i===-1)t.push(o);else t.splice(i,1,o)}e(he,"upsert");function me(t){let a=t.reduce((d,l)=>{if(d.seq>l.seq)return d;return l},t[0]),o="";t.forEach(function(d){if(d===a)o+="\t*";else o+="\t|"});let i=[o,a.id,a.seq];for(let d in m.records.branches)if(m.records.branches.get(d)===a.id)i.push(d);if(r.debug(i.join(" ")),a.parents&&a.parents.length==2&&a.parents[0]&&a.parents[1]){let d=m.records.commits.get(a.parents[0]);if(he(t,a,d),a.parents[1])t.push(m.records.commits.get(a.parents[1]))}else if(a.parents.length==0)return;else if(a.parents[0]){let d=m.records.commits.get(a.parents[0]);he(t,a,d)}t=pe(t,(d)=>d.id),me(t)}e(me,"prettyPrintCommitHistory");var Oe=e(function(){r.debug(m.records.commits);let t=xe()[0];me([t])},"prettyPrint"),Ie=e(function(){m.reset(),C()},"clear"),_e=e(function(){return[...m.records.branchConfig.values()].map((a,o)=>{if(a.order!==null&&a.order!==void 0)return a;return{...a,order:parseFloat(`0.${o}`)}}).sort((a,o)=>(a.order??0)-(o.order??0)).map(({name:a})=>({name:a}))},"getBranchesAsObjArray"),Ge=e(function(){return m.records.branches},"getBranches"),De=e(function(){return m.records.commits},"getCommits"),xe=e(function(){let t=[...m.records.commits.values()];return t.forEach(function(a){r.debug(a.id)}),t.sort((a,o)=>a.seq-o.seq),t},"getCommitsArray"),We=e(function(){return m.records.currBranch},"getCurrentBranch"),qe=e(function(){return m.records.direction},"getDirection"),Ae=e(function(){return m.records.head},"getHead"),ue={commitType:v,getConfig:J,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:I,getDiagramTitle:L},He=e((t,a)=>{if(W(t,a),t.dir)a.setDirection(t.dir);for(let o of t.statements)Se(o,a)},"populate"),Se=e((t,a)=>{let i={Commit:e((d)=>a.commit(Ne(d)),"Commit"),Branch:e((d)=>a.branch(Fe(d)),"Branch"),Merge:e((d)=>a.merge(ze(d)),"Merge"),Checkout:e((d)=>a.checkout(Ye(d)),"Checkout"),CherryPicking:e((d)=>a.cherryPick(je(d)),"CherryPicking")}[t.$type];if(i)i(t);else r.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),Ne=e((t)=>({id:t.id,msg:t.message??"",type:t.type!==void 0?v[t.type]:v.NORMAL,tags:t.tags??void 0}),"parseCommit"),Fe=e((t)=>({name:t.name,order:t.order??0}),"parseBranch"),ze=e((t)=>({branch:t.branch,id:t.id??"",type:t.type!==void 0?v[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),Ye=e((t)=>t.branch,"parseCheckout"),je=e((t)=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),Ke={parse:e(async(t)=>{let a=await X("gitGraph",t);r.debug(a),He(a,ue)},"parse")},j=10,K=40,H=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=e((t,a,o=!1)=>{if(o&&t>0)return(t-1)%(a-1)+1;return t%a},"calcColorIndex"),_=new Map,G=new Map,oe=30,te=new Map,se=[],Y=0,B="LR",Ve=e(()=>{_.clear(),G.clear(),te.clear(),Y=0,se=[],B="LR"},"clear"),be=e((t)=>{let a=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof t==="string"?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach((i)=>{let d=document.createElementNS("http://www.w3.org/2000/svg","tspan");d.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),d.setAttribute("dy","1em"),d.setAttribute("x","0"),d.setAttribute("class","row"),d.textContent=i.trim(),a.appendChild(d)}),a},"drawText"),we=e((t)=>{let a,o,i;if(B==="BT")o=e((d,l)=>d<=l,"comparisonFunc"),i=1/0;else o=e((d,l)=>d>=l,"comparisonFunc"),i=0;return t.forEach((d)=>{let l=B==="TB"||B=="BT"?G.get(d)?.y:G.get(d)?.x;if(l!==void 0&&o(l,i))a=d,i=l}),a},"findClosestParent"),Ze=e((t)=>{let a="",o=1/0;return t.forEach((i)=>{let d=G.get(i).y;if(d<=o)a=i,o=d}),a||void 0},"findClosestParentBT"),Xe=e((t,a,o)=>{let i=o,d=o,l=[];t.forEach((c)=>{let n=a.get(c);if(!n)throw Error(`Commit not found for key ${c}`);if(n.parents.length)i=Qe(n),d=Math.max(i,d);else l.push(n);et(n,i)}),i=d,l.forEach((c)=>{tt(c,i,o)}),t.forEach((c)=>{let n=a.get(c);if(n?.parents.length){let g=Ze(n.parents);if(i=G.get(g).y-K,i<=d)d=i;let x=_.get(n.branch).pos,u=i-j;G.set(n.id,{x,y:u})}})},"setParallelBTPos"),Je=e((t)=>{let a=we(t.parents.filter((i)=>i!==null));if(!a)throw Error(`Closest parent not found for commit ${t.id}`);let o=G.get(a)?.y;if(o===void 0)throw Error(`Closest parent position not found for commit ${t.id}`);return o},"findClosestParentPos"),Qe=e((t)=>Je(t)+K,"calculateCommitPosition"),et=e((t,a)=>{let o=_.get(t.branch);if(!o)throw Error(`Branch not found for commit ${t.id}`);let i=o.pos,d=a+j;return G.set(t.id,{x:i,y:d}),{x:i,y:d}},"setCommitPosition"),tt=e((t,a,o)=>{let i=_.get(t.branch);if(!i)throw Error(`Branch not found for commit ${t.id}`);let d=a+o,l=i.pos;G.set(t.id,{x:l,y:d})},"setRootPosition"),rt=e((t,a,o,i,d,l)=>{let{theme:c}=s(),n=ce.has(c??""),g=ge.has(c??""),x=Ue.has(c??"");if(l===v.HIGHLIGHT)t.append("rect").attr("x",o.x-10+(n?3:0)).attr("y",o.y-10+(n?3:0)).attr("width",n?14:20).attr("height",n?14:20).attr("class",`commit ${a.id} commit-highlight${Z(d,V,g)} ${i}-outer`),t.append("rect").attr("x",o.x-6+(n?2:0)).attr("y",o.y-6+(n?2:0)).attr("width",n?8:12).attr("height",n?8:12).attr("class",`commit ${a.id} commit${Z(d,V,g)} ${i}-inner`);else if(l===v.CHERRY_PICK)t.append("circle").attr("cx",o.x).attr("cy",o.y).attr("r",n?7:10).attr("class",`commit ${a.id} ${i}`),t.append("circle").attr("cx",o.x-3).attr("cy",o.y+2).attr("r",n?2.5:2.75).attr("fill",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`),t.append("circle").attr("cx",o.x+3).attr("cy",o.y+2).attr("r",n?2.5:2.75).attr("fill",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`),t.append("line").attr("x1",o.x+3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`),t.append("line").attr("x1",o.x-3).attr("y1",o.y+1).attr("x2",o.x).attr("y2",o.y-5).attr("stroke",x?"#000000":"#fff").attr("class",`commit ${a.id} ${i}`);else{let u=t.append("circle");if(u.attr("cx",o.x),u.attr("cy",o.y),u.attr("r",n?7:10),u.attr("class",`commit ${a.id} commit${Z(d,V,g)}`),l===v.MERGE){let f=t.append("circle");f.attr("cx",o.x),f.attr("cy",o.y),f.attr("r",n?5:6),f.attr("class",`commit ${i} ${a.id} commit${Z(d,V,g)}`)}if(l===v.REVERSE){let f=t.append("path"),h=n?4:5;f.attr("d",`M ${o.x-h},${o.y-h}L${o.x+h},${o.y+h}M${o.x-h},${o.y+h}L${o.x+h},${o.y-h}`).attr("class",`commit ${i} ${a.id} commit${Z(d,V,g)}`)}}},"drawCommitBullet"),at=e((t,a,o,i,d)=>{if(a.type!==v.CHERRY_PICK&&(a.customId&&a.type===v.MERGE||a.type!==v.MERGE)&&d.showCommitLabel){let l=t.append("g"),c=l.insert("rect").attr("class","commit-label-bkg"),n=l.append("text").attr("x",i).attr("y",o.y+25).attr("class","commit-label").text(a.id),g=n.node()?.getBBox();if(g){if(c.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")c.attr("x",o.x-(g.width+4*H+5)).attr("y",o.y-12),n.attr("x",o.x-(g.width+4*H)).attr("y",o.y+g.height-12);else n.attr("x",o.posWithOffset-g.width/2);if(d.rotateCommitLabel)if(B==="TB"||B==="BT")n.attr("transform","rotate(-45, "+o.x+", "+o.y+")"),c.attr("transform","rotate(-45, "+o.x+", "+o.y+")");else{let x=-7.5-(g.width+10)/25*9.5,u=10+g.width/25*8.5;l.attr("transform","translate("+x+", "+u+") rotate(-45, "+i+", "+o.y+")")}}}},"drawCommitLabel"),ot=e((t,a,o,i)=>{if(a.tags.length>0){let d=0,l=0,c=0,n=[];for(let g of a.tags.reverse()){let x=t.insert("polygon"),u=t.append("circle"),f=t.append("text").attr("y",o.y-16-d).attr("class","tag-label").text(g),h=f.node()?.getBBox();if(!h)throw Error("Tag bbox not found");l=Math.max(l,h.width),c=Math.max(c,h.height),f.attr("x",o.posWithOffset-h.width/2),n.push({tag:f,hole:u,rect:x,yOffset:d}),d+=20}for(let{tag:g,hole:x,rect:u,yOffset:f}of n){let h=c/2,k=o.y-19.2-f;if(u.attr("class","tag-label-bkg").attr("points",`
|
|
2
2
|
${i-l/2-H/2},${k+z}
|
|
3
3
|
${i-l/2-H/2},${k-z}
|
|
4
4
|
${o.posWithOffset-l/2-H},${k-h-z}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W}from"./chunk-b1pe46zz.js";import{e,r,we,D,b,B,C,S,E,T,A,I,L,p,q,Wr,k,U}from"./chunk-y0m8hrwz.js";import{Dt}from"./chunk-0mrkjnte.js";import{X}from"./chunk-taynqrgq.js";import{Xe}from"./chunk-20q90epj.js";import{oe}from"./chunk-hev4hq89.js";function je(t){var n=0,l=t.children,o=l&&l.length;if(!o)n=1;else while(--o>=0)n+=l[o].value;t.value=n}function ge(){return this.eachAfter(je)}function ye(t,n){let l=-1;for(let o of this)t.call(n,o,++l,this);return this}function xe(t,n){var l=this,o=[l],s,d,f=-1;while(l=o.pop())if(t.call(n,l,++f,this),s=l.children)for(d=s.length-1;d>=0;--d)o.push(s[d]);return this}function Se(t,n){var l=this,o=[l],s=[],d,f,h,v=-1;while(l=o.pop())if(s.push(l),d=l.children)for(f=0,h=d.length;f<h;++f)o.push(d[f]);while(l=s.pop())t.call(n,l,++v,this);return this}function ve(t,n){let l=-1;for(let o of this)if(t.call(n,o,++l,this))return o}function be(t){return this.eachAfter(function(n){var l=+t(n.data)||0,o=n.children,s=o&&o.length;while(--s>=0)l+=o[s].value;n.value=l})}function Ce(t){return this.eachBefore(function(n){if(n.children)n.children.sort(t)})}function Te(t){var n=this,l=Ze(n,t),o=[n];while(n!==l)n=n.parent,o.push(n);var s=o.length;while(t!==l)o.splice(s,0,t),t=t.parent;return o}function Ze(t,n){if(t===n)return t;var l=t.ancestors(),o=n.ancestors(),s=null;t=l.pop(),n=o.pop();while(t===n)s=t,t=l.pop(),n=o.pop();return s}function Le(){var t=this,n=[t];while(t=t.parent)n.push(t);return n}function $e(){return Array.from(this)}function Ae(){var t=[];return this.eachBefore(function(n){if(!n.children)t.push(n)}),t}function Fe(){var t=this,n=[];return t.each(function(l){if(l!==t)n.push({source:l.parent,target:l})}),n}function*Ne(){var t=this,n,l=[t],o,s,d;do{n=l.reverse(),l=[];while(t=n.pop())if(yield t,o=t.children)for(s=0,d=o.length;s<d;++s)l.push(o[s])}while(l.length)}function re(t,n){if(t instanceof Map){if(t=[void 0,t],n===void 0)n=Ke}else if(n===void 0)n=Je;var l=new ce(t),o,s=[l],d,f,h,v;while(o=s.pop())if((f=n(o.data))&&(v=(f=Array.from(f)).length)){o.children=f;for(h=v-1;h>=0;--h)s.push(d=f[h]=new ce(f[h])),d.parent=o,d.depth=o.depth+1}return l.eachBefore(et)}function Ue(){return re(this).eachBefore(Qe)}function Je(t){return t.children}function Ke(t){return Array.isArray(t)?t[1]:null}function Qe(t){if(t.data.value!==void 0)t.value=t.data.value;t.data=t.data.data}function et(t){var n=0;do t.height=n;while((t=t.parent)&&t.height<++n)}function ce(t){this.data=t,this.depth=this.height=0,this.parent=null}ce.prototype=re.prototype={constructor:ce,count:ge,each:ye,eachAfter:Se,eachBefore:xe,find:ve,sum:be,sort:Ce,path:Te,ancestors:Le,descendants:$e,leaves:Ae,links:Fe,copy:Ue,[Symbol.iterator]:Ne};function Be(t){if(typeof t!=="function")throw Error();return t}function ne(){return 0}function Q(t){return function(){return t}}function ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Me(t,n,l,o,s){var d=t.children,f,h=-1,v=d.length,u=t.value&&(o-n)/t.value;while(++h<v)f=d[h],f.y0=l,f.y1=s,f.x0=n,f.x1=n+=f.value*u}function _e(t,n,l,o,s){var d=t.children,f,h=-1,v=d.length,u=t.value&&(s-l)/t.value;while(++h<v)f=d[h],f.x0=n,f.x1=o,f.y0=l,f.y1=l+=f.value*u}var tt=(1+Math.sqrt(5))/2;function at(t,n,l,o,s,d){var f=[],h=n.children,v,u,m=0,_=0,i=h.length,M,F,N=n.value,g,w,Y,O,ee,se,j;while(m<i){M=s-l,F=d-o;do g=h[_++].value;while(!g&&_<i);w=Y=g,se=Math.max(F/M,M/F)/(N*t),j=g*g*se,ee=Math.max(Y/j,j/w);for(;_<i;++_){if(g+=u=h[_].value,u<w)w=u;if(u>Y)Y=u;if(j=g*g*se,O=Math.max(Y/j,j/w),O>ee){g-=u;break}ee=O}if(f.push(v={value:g,dice:M<F,children:h.slice(m,_)}),v.dice)Me(v,l,o,s,N?o+=F*g/N:d);else _e(v,l,o,N?l+=M*g/N:s,d);N-=g,m=_}return f}var Ee=function t(n){function l(o,s,d,f,h){at(n,o,s,d,f,h)}return l.ratio=function(o){return t((o=+o)>1?o:1)},l}(tt);function fe(){var t=Ee,n=!1,l=1,o=1,s=[0],d=ne,f=ne,h=ne,v=ne,u=ne;function m(i){if(i.x0=i.y0=0,i.x1=l,i.y1=o,i.eachBefore(_),s=[0],n)i.eachBefore(ke);return i}function _(i){var M=s[i.depth],F=i.x0+M,N=i.y0+M,g=i.x1-M,w=i.y1-M;if(g<F)F=g=(F+g)/2;if(w<N)N=w=(N+w)/2;if(i.x0=F,i.y0=N,i.x1=g,i.y1=w,i.children){if(M=s[i.depth+1]=d(i)/2,F+=u(i)-M,N+=f(i)-M,g-=h(i)-M,w-=v(i)-M,g<F)F=g=(F+g)/2;if(w<N)N=w=(N+w)/2;t(i,F,N,g,w)}}return m.round=function(i){return arguments.length?(n=!!i,m):n},m.size=function(i){return arguments.length?(l=+i[0],o=+i[1],m):[l,o]},m.tile=function(i){return arguments.length?(t=Be(i),m):t},m.padding=function(i){return arguments.length?m.paddingInner(i).paddingOuter(i):m.paddingInner()},m.paddingInner=function(i){return arguments.length?(d=typeof i==="function"?i:Q(+i),m):d},m.paddingOuter=function(i){return arguments.length?m.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i):m.paddingTop()},m.paddingTop=function(i){return arguments.length?(f=typeof i==="function"?i:Q(+i),m):f},m.paddingRight=function(i){return arguments.length?(h=typeof i==="function"?i:Q(+i),m):h},m.paddingBottom=function(i){return arguments.length?(v=typeof i==="function"?i:Q(+i),m):v},m.paddingLeft=function(i){return arguments.length?(u=typeof i==="function"?i:Q(+i),m):u},m}var Re=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T}static{e(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let t=D,n=b();return U({...t.treemap,...n.treemap??{}})}addNode(t,n){if(this.nodes.push(t),this.levels.set(t,n),n===0)this.outerNodes.push(t),this.root??=t}getRoot(){return{name:"",children:this.outerNodes}}addClass(t,n){let l=this.classes.get(t)??{id:t,styles:[],textStyles:[]},o=n.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");if(o)o.forEach((s)=>{if(Wr(s))if(l?.textStyles)l.textStyles.push(s);else l.textStyles=[s];if(l?.styles)l.styles.push(s);else l.styles=[s]});this.classes.set(t,l)}getClasses(){return this.classes}getStylesForClass(t){return this.classes.get(t)?.styles??[]}clear(){C(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function We(t){if(!t.length)return[];let n=[],l=[];return t.forEach((o)=>{let s={name:o.name,children:o.type==="Leaf"?void 0:[]};if(s.classSelector=o?.classSelector,o?.cssCompiledStyles)s.cssCompiledStyles=o.cssCompiledStyles;if(o.type==="Leaf"&&o.value!==void 0)s.value=o.value;while(l.length>0&&l[l.length-1].level>=o.level)l.pop();if(l.length===0)n.push(s);else{let d=l[l.length-1].node;if(d.children)d.children.push(s);else d.children=[s]}if(o.type!=="Leaf")l.push({node:s,level:o.level})}),n}e(We,"buildHierarchy");var rt=e((t,n)=>{W(t,n);let l=[];for(let d of t.TreemapRows??[])if(d.$type==="ClassDefStatement")n.addClass(d.className??"",d.styleText??"");for(let d of t.TreemapRows??[]){let f=d.item;if(!f)continue;let h=d.indent?parseInt(d.indent):0,v=nt(f),u=f.classSelector?n.getStylesForClass(f.classSelector):[],m=u.length>0?u:void 0,_={level:h,name:v,type:f.$type,value:f.value,classSelector:f.classSelector,cssCompiledStyles:m};l.push(_)}let o=We(l),s=e((d,f)=>{for(let h of d)if(n.addNode(h,f),h.children&&h.children.length>0)s(h.children,f+1)},"addNodesRecursively");s(o,0)},"populate"),nt=e((t)=>t.name?String(t.name):"","getItemName"),He={parser:{yy:void 0},parse:e(async(t)=>{try{let l=await X("treemap",t);r.debug("Treemap AST:",l);let o=He.parser?.yy;if(!(o instanceof Re))throw Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(l,o)}catch(n){throw r.error("Error parsing treemap:",n),n}},"parse")},lt=10,le=10,pe=25,ot=e((t,n,l,o)=>{let s=o.db,d=s.getConfig(),f=d.padding??lt,h=s.getDiagramTitle(),v=s.getRoot(),{themeVariables:u}=b();if(!v)return;let m=h?30:0,_=q(n),i=d.nodeWidth?d.nodeWidth*le:960,M=d.nodeHeight?d.nodeHeight*le:500,F=i,N=M+m;_.attr("viewBox",`0 0 ${F} ${N}`),B(_,N,F,d.useMaxWidth);let g;try{let a=d.valueFormat||",";if(a==="$0,0")g=e((c)=>"$"+Dt(",")(c),"valueFormat");else if(a.startsWith("$")&&a.includes(",")){let c=/\.\d+/.exec(a),y=c?c[0]:"";g=e((z)=>"$"+Dt(","+y)(z),"valueFormat")}else if(a.startsWith("$")){let c=a.substring(1);g=e((y)=>"$"+Dt(c||"")(y),"valueFormat")}else g=Dt(a)}catch(a){r.error("Error creating format function:",a),g=Dt(",")}let w=Xe().range(["transparent",u.cScale0,u.cScale1,u.cScale2,u.cScale3,u.cScale4,u.cScale5,u.cScale6,u.cScale7,u.cScale8,u.cScale9,u.cScale10,u.cScale11]),Y=Xe().range(["transparent",u.cScalePeer0,u.cScalePeer1,u.cScalePeer2,u.cScalePeer3,u.cScalePeer4,u.cScalePeer5,u.cScalePeer6,u.cScalePeer7,u.cScalePeer8,u.cScalePeer9,u.cScalePeer10,u.cScalePeer11]),O=Xe().range([u.cScaleLabel0,u.cScaleLabel1,u.cScaleLabel2,u.cScaleLabel3,u.cScaleLabel4,u.cScaleLabel5,u.cScaleLabel6,u.cScaleLabel7,u.cScaleLabel8,u.cScaleLabel9,u.cScaleLabel10,u.cScaleLabel11]);if(h)_.append("text").attr("x",F/2).attr("y",m/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);let ee=_.append("g").attr("transform",`translate(0, ${m})`).attr("class","treemapContainer"),se=re(v).sum((a)=>a.value??0).sort((a,c)=>(c.value??0)-(a.value??0)),ze=fe().size([i,M]).paddingTop((a)=>a.children&&a.children.length>0?pe+le:0).paddingInner(f).paddingLeft((a)=>a.children&&a.children.length>0?le:0).paddingRight((a)=>a.children&&a.children.length>0?le:0).paddingBottom((a)=>a.children&&a.children.length>0?le:0).round(!0)(se),Ie=ze.descendants().filter((a)=>a.children&&a.children.length>0),ie=ee.selectAll(".treemapSection").data(Ie).enter().append("g").attr("class","treemapSection").attr("transform",(a)=>`translate(${a.x0},${a.y0})`);if(ie.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",pe).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",0.6).attr("stroke-width",0.6).attr("style",(a)=>{if(a.depth===0)return"display: none;";return""}),ie.append("clipPath").attr("id",(a,c)=>`clip-section-${n}-${c}`).append("rect").attr("width",(a)=>Math.max(0,a.x1-a.x0-12)).attr("height",pe),ie.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",(a)=>a.y1-a.y0).attr("class",(a,c)=>`treemapSection section${c}`).attr("fill",(a)=>w(a.data.name)).attr("fill-opacity",0.6).attr("stroke",(a)=>Y(a.data.name)).attr("stroke-width",2).attr("stroke-opacity",0.4).attr("style",(a)=>{if(a.depth===0)return"display: none;";let c=k({cssCompiledStyles:a.data.cssCompiledStyles});return c.nodeStyles+";"+c.borderStyles.join(";")}),ie.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",pe/2).attr("dominant-baseline","middle").text((a)=>a.depth===0?"":a.data.name).attr("font-weight","bold").attr("clip-path",(a,c)=>`url(#clip-section-${n}-${c})`).attr("style",(a)=>{if(a.depth===0)return"display: none;";let c="dominant-baseline: middle; font-size: 12px; fill:"+O(a.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",y=k({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")}).each(function(a){if(a.depth===0)return;let c=p(this),y=a.data.name;c.text(y);let z=a.x1-a.x0,P=6,V;if(d.showValues!==!1&&a.value){let H=z-10,K=30,Ge=10;V=H-30-10-P}else V=z-P-6;let x=Math.max(15,V),J=c.node();if(J.getComputedTextLength()>x){let K=y;while(K.length>0){if(K=y.substring(0,K.length-1),K.length===0){if(c.text("..."),J.getComputedTextLength()>x)c.text("");break}if(c.text(K+"..."),J.getComputedTextLength()<=x)break}}}),d.showValues!==!1)ie.append("text").attr("class","treemapSectionValue").attr("x",(a)=>a.x1-a.x0-10).attr("y",pe/2).attr("text-anchor","end").attr("dominant-baseline","middle").text((a)=>a.value?g(a.value):"").attr("font-style","italic").attr("style",(a)=>{if(a.depth===0)return"display: none;";let c="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+O(a.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",y=k({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")});let De=ze.leaves(),G=De.length>20,Oe=G?16:38,de=G?14:28,te=G?4:8,ae=G?4:6,he=G?2:4,Ve=G?8:10,me=G?1:2,ue=ee.selectAll(".treemapLeafGroup").data(De).enter().append("g").attr("class",(a,c)=>`treemapNode treemapLeafGroup leaf${c}${a.data.classSelector?` ${a.data.classSelector}`:""}x`).attr("transform",(a)=>`translate(${a.x0},${a.y0})`);if(ue.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",(a)=>a.y1-a.y0).attr("class","treemapLeaf").attr("fill",(a)=>a.parent?w(a.parent.data.name):w(a.data.name)).attr("style",(a)=>k({cssCompiledStyles:a.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",0.3).attr("stroke",(a)=>a.parent?w(a.parent.data.name):w(a.data.name)).attr("stroke-width",3),ue.append("clipPath").attr("id",(a,c)=>`clip-${n}-${c}`).append("rect").attr("width",(a)=>Math.max(0,a.x1-a.x0-4)).attr("height",(a)=>Math.max(0,a.y1-a.y0-4)),ue.append("text").attr("class","treemapLabel").attr("x",(a)=>(a.x1-a.x0)/2).attr("y",(a)=>(a.y1-a.y0)/2).attr("style",(a)=>{let c=`text-anchor: middle; dominant-baseline: middle; font-size: ${Oe}px;fill:`+O(a.data.name)+";",y=k({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")}).attr("clip-path",(a,c)=>`url(#clip-${n}-${c})`).text((a)=>a.data.name).each(function(a){let c=p(this),y=a.x1-a.x0,z=a.y1-a.y0,P=c.node(),V=y-2*he,Z=z-2*he;if(V<Ve||Z<Ve){c.style("display","none");return}let x=parseInt(c.style("font-size"),10),J=0.6;while(P.getComputedTextLength()>V&&x>te)x--,c.style("font-size",`${x}px`);let R=Math.max(ae,Math.min(de,Math.round(x*J))),H=x+me+R;while(H>Z&&x>te){if(x--,R=Math.max(ae,Math.min(de,Math.round(x*J))),R<ae&&x===te)break;if(c.style("font-size",`${x}px`),H=x+me+R,R<=ae&&H>Z);}if(c.style("font-size",`${x}px`),G){if(x<te||Z<te)c.style("display","none")}else if(P.getComputedTextLength()>V||x<te||Z<x)c.style("display","none")}),d.showValues!==!1)ue.append("text").attr("class","treemapValue").attr("x",(c)=>(c.x1-c.x0)/2).attr("y",function(c){return(c.y1-c.y0)/2}).attr("style",(c)=>{let y=`text-anchor: middle; dominant-baseline: hanging; font-size: ${de}px;fill:`+O(c.data.name)+";",z=k({cssCompiledStyles:c.data.cssCompiledStyles});return y+z.labelStyles.replace("color:","fill:")}).attr("clip-path",(c,y)=>`url(#clip-${n}-${y})`).text((c)=>c.value?g(c.value):"").each(function(c){let y=p(this),z=this.parentNode;if(!z){y.style("display","none");return}let P=p(z).select(".treemapLabel");if(P.empty()||P.style("display")==="none"){y.style("display","none");return}let V=parseFloat(P.style("font-size")),x=Math.max(ae,Math.min(de,Math.round(V*0.6)));y.style("font-size",`${x}px`);let R=(c.y1-c.y0)/2+V/2+me;y.attr("y",R);let H=c.x1-c.x0,Pe=c.y1-c.y0-4,Ye=H-2*he;if(y.node().getComputedTextLength()>Ye||R+x>Pe||x<ae)y.style("display","none");else y.style("display",null)});let qe=d.diagramPadding??8;oe(_,qe,"flowchart",d?.useMaxWidth||!1)},"draw"),st=e(function(t,n){return n.db.getClasses()},"getClasses"),it={draw:ot,getClasses:st},ct={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},pt=e(({treemap:t}={})=>{let n=we(),l=b(),o=U(n,l.themeVariables),s=U(ct,t),d=s.titleColor??o.titleColor,f=s.labelColor??o.textColor,h=s.valueColor??o.textColor;return`
|
|
1
|
+
import{W}from"./chunk-89fkdgbp.js";import{e,r,we,D,b,B,C,S,E,T,A,I,L,p,V,Wr,k,U}from"./chunk-vymqrpm3.js";import{Nt}from"./chunk-ds7srg4p.js";import{X}from"./chunk-n8gfjj9a.js";import{Xe}from"./chunk-n8sky2q6.js";import{se}from"./chunk-zmdnxn6m.js";function je(t){var n=0,l=t.children,o=l&&l.length;if(!o)n=1;else while(--o>=0)n+=l[o].value;t.value=n}function ge(){return this.eachAfter(je)}function ye(t,n){let l=-1;for(let o of this)t.call(n,o,++l,this);return this}function xe(t,n){var l=this,o=[l],s,d,f=-1;while(l=o.pop())if(t.call(n,l,++f,this),s=l.children)for(d=s.length-1;d>=0;--d)o.push(s[d]);return this}function Se(t,n){var l=this,o=[l],s=[],d,f,h,v=-1;while(l=o.pop())if(s.push(l),d=l.children)for(f=0,h=d.length;f<h;++f)o.push(d[f]);while(l=s.pop())t.call(n,l,++v,this);return this}function ve(t,n){let l=-1;for(let o of this)if(t.call(n,o,++l,this))return o}function be(t){return this.eachAfter(function(n){var l=+t(n.data)||0,o=n.children,s=o&&o.length;while(--s>=0)l+=o[s].value;n.value=l})}function Ce(t){return this.eachBefore(function(n){if(n.children)n.children.sort(t)})}function Te(t){var n=this,l=Ze(n,t),o=[n];while(n!==l)n=n.parent,o.push(n);var s=o.length;while(t!==l)o.splice(s,0,t),t=t.parent;return o}function Ze(t,n){if(t===n)return t;var l=t.ancestors(),o=n.ancestors(),s=null;t=l.pop(),n=o.pop();while(t===n)s=t,t=l.pop(),n=o.pop();return s}function Le(){var t=this,n=[t];while(t=t.parent)n.push(t);return n}function $e(){return Array.from(this)}function Ae(){var t=[];return this.eachBefore(function(n){if(!n.children)t.push(n)}),t}function Fe(){var t=this,n=[];return t.each(function(l){if(l!==t)n.push({source:l.parent,target:l})}),n}function*Ne(){var t=this,n,l=[t],o,s,d;do{n=l.reverse(),l=[];while(t=n.pop())if(yield t,o=t.children)for(s=0,d=o.length;s<d;++s)l.push(o[s])}while(l.length)}function re(t,n){if(t instanceof Map){if(t=[void 0,t],n===void 0)n=Ke}else if(n===void 0)n=Je;var l=new ce(t),o,s=[l],d,f,h,v;while(o=s.pop())if((f=n(o.data))&&(v=(f=Array.from(f)).length)){o.children=f;for(h=v-1;h>=0;--h)s.push(d=f[h]=new ce(f[h])),d.parent=o,d.depth=o.depth+1}return l.eachBefore(et)}function Ue(){return re(this).eachBefore(Qe)}function Je(t){return t.children}function Ke(t){return Array.isArray(t)?t[1]:null}function Qe(t){if(t.data.value!==void 0)t.value=t.data.value;t.data=t.data.data}function et(t){var n=0;do t.height=n;while((t=t.parent)&&t.height<++n)}function ce(t){this.data=t,this.depth=this.height=0,this.parent=null}ce.prototype=re.prototype={constructor:ce,count:ge,each:ye,eachAfter:Se,eachBefore:xe,find:ve,sum:be,sort:Ce,path:Te,ancestors:Le,descendants:$e,leaves:Ae,links:Fe,copy:Ue,[Symbol.iterator]:Ne};function Be(t){if(typeof t!=="function")throw Error();return t}function ne(){return 0}function Q(t){return function(){return t}}function ke(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}function Me(t,n,l,o,s){var d=t.children,f,h=-1,v=d.length,u=t.value&&(o-n)/t.value;while(++h<v)f=d[h],f.y0=l,f.y1=s,f.x0=n,f.x1=n+=f.value*u}function _e(t,n,l,o,s){var d=t.children,f,h=-1,v=d.length,u=t.value&&(s-l)/t.value;while(++h<v)f=d[h],f.x0=n,f.x1=o,f.y0=l,f.y1=l+=f.value*u}var tt=(1+Math.sqrt(5))/2;function at(t,n,l,o,s,d){var f=[],h=n.children,v,u,m=0,_=0,i=h.length,M,F,N=n.value,g,w,Y,q,ee,oe,j;while(m<i){M=s-l,F=d-o;do g=h[_++].value;while(!g&&_<i);w=Y=g,oe=Math.max(F/M,M/F)/(N*t),j=g*g*oe,ee=Math.max(Y/j,j/w);for(;_<i;++_){if(g+=u=h[_].value,u<w)w=u;if(u>Y)Y=u;if(j=g*g*oe,q=Math.max(Y/j,j/w),q>ee){g-=u;break}ee=q}if(f.push(v={value:g,dice:M<F,children:h.slice(m,_)}),v.dice)Me(v,l,o,s,N?o+=F*g/N:d);else _e(v,l,o,N?l+=M*g/N:s,d);N-=g,m=_}return f}var Ee=function t(n){function l(o,s,d,f,h){at(n,o,s,d,f,h)}return l.ratio=function(o){return t((o=+o)>1?o:1)},l}(tt);function fe(){var t=Ee,n=!1,l=1,o=1,s=[0],d=ne,f=ne,h=ne,v=ne,u=ne;function m(i){if(i.x0=i.y0=0,i.x1=l,i.y1=o,i.eachBefore(_),s=[0],n)i.eachBefore(ke);return i}function _(i){var M=s[i.depth],F=i.x0+M,N=i.y0+M,g=i.x1-M,w=i.y1-M;if(g<F)F=g=(F+g)/2;if(w<N)N=w=(N+w)/2;if(i.x0=F,i.y0=N,i.x1=g,i.y1=w,i.children){if(M=s[i.depth+1]=d(i)/2,F+=u(i)-M,N+=f(i)-M,g-=h(i)-M,w-=v(i)-M,g<F)F=g=(F+g)/2;if(w<N)N=w=(N+w)/2;t(i,F,N,g,w)}}return m.round=function(i){return arguments.length?(n=!!i,m):n},m.size=function(i){return arguments.length?(l=+i[0],o=+i[1],m):[l,o]},m.tile=function(i){return arguments.length?(t=Be(i),m):t},m.padding=function(i){return arguments.length?m.paddingInner(i).paddingOuter(i):m.paddingInner()},m.paddingInner=function(i){return arguments.length?(d=typeof i==="function"?i:Q(+i),m):d},m.paddingOuter=function(i){return arguments.length?m.paddingTop(i).paddingRight(i).paddingBottom(i).paddingLeft(i):m.paddingTop()},m.paddingTop=function(i){return arguments.length?(f=typeof i==="function"?i:Q(+i),m):f},m.paddingRight=function(i){return arguments.length?(h=typeof i==="function"?i:Q(+i),m):h},m.paddingBottom=function(i){return arguments.length?(v=typeof i==="function"?i:Q(+i),m):v},m.paddingLeft=function(i){return arguments.length?(u=typeof i==="function"?i:Q(+i),m):u},m}var Re=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=S,this.getAccTitle=E,this.setDiagramTitle=I,this.getDiagramTitle=L,this.getAccDescription=A,this.setAccDescription=T}static{e(this,"TreeMapDB")}getNodes(){return this.nodes}getConfig(){let t=D,n=b();return U({...t.treemap,...n.treemap??{}})}addNode(t,n){if(this.nodes.push(t),this.levels.set(t,n),n===0)this.outerNodes.push(t),this.root??=t}getRoot(){return{name:"",children:this.outerNodes}}addClass(t,n){let l=this.classes.get(t)??{id:t,styles:[],textStyles:[]},o=n.replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");if(o)o.forEach((s)=>{if(Wr(s))if(l?.textStyles)l.textStyles.push(s);else l.textStyles=[s];if(l?.styles)l.styles.push(s);else l.styles=[s]});this.classes.set(t,l)}getClasses(){return this.classes}getStylesForClass(t){return this.classes.get(t)?.styles??[]}clear(){C(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function We(t){if(!t.length)return[];let n=[],l=[];return t.forEach((o)=>{let s={name:o.name,children:o.type==="Leaf"?void 0:[]};if(s.classSelector=o?.classSelector,o?.cssCompiledStyles)s.cssCompiledStyles=o.cssCompiledStyles;if(o.type==="Leaf"&&o.value!==void 0)s.value=o.value;while(l.length>0&&l[l.length-1].level>=o.level)l.pop();if(l.length===0)n.push(s);else{let d=l[l.length-1].node;if(d.children)d.children.push(s);else d.children=[s]}if(o.type!=="Leaf")l.push({node:s,level:o.level})}),n}e(We,"buildHierarchy");var rt=e((t,n)=>{W(t,n);let l=[];for(let d of t.TreemapRows??[])if(d.$type==="ClassDefStatement")n.addClass(d.className??"",d.styleText??"");for(let d of t.TreemapRows??[]){let f=d.item;if(!f)continue;let h=d.indent?parseInt(d.indent):0,v=nt(f),u=f.classSelector?n.getStylesForClass(f.classSelector):[],m=u.length>0?u:void 0,_={level:h,name:v,type:f.$type,value:f.value,classSelector:f.classSelector,cssCompiledStyles:m};l.push(_)}let o=We(l),s=e((d,f)=>{for(let h of d)if(n.addNode(h,f),h.children&&h.children.length>0)s(h.children,f+1)},"addNodesRecursively");s(o,0)},"populate"),nt=e((t)=>t.name?String(t.name):"","getItemName"),He={parser:{yy:void 0},parse:e(async(t)=>{try{let l=await X("treemap",t);r.debug("Treemap AST:",l);let o=He.parser?.yy;if(!(o instanceof Re))throw Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");rt(l,o)}catch(n){throw r.error("Error parsing treemap:",n),n}},"parse")},lt=10,le=10,pe=25,ot=e((t,n,l,o)=>{let s=o.db,d=s.getConfig(),f=d.padding??lt,h=s.getDiagramTitle(),v=s.getRoot(),{themeVariables:u}=b();if(!v)return;let m=h?30:0,_=V(n),i=d.nodeWidth?d.nodeWidth*le:960,M=d.nodeHeight?d.nodeHeight*le:500,F=i,N=M+m;_.attr("viewBox",`0 0 ${F} ${N}`),B(_,N,F,d.useMaxWidth);let g;try{let a=d.valueFormat||",";if(a==="$0,0")g=e((c)=>"$"+Nt(",")(c),"valueFormat");else if(a.startsWith("$")&&a.includes(",")){let c=/\.\d+/.exec(a),y=c?c[0]:"";g=e((z)=>"$"+Nt(","+y)(z),"valueFormat")}else if(a.startsWith("$")){let c=a.substring(1);g=e((y)=>"$"+Nt(c||"")(y),"valueFormat")}else g=Nt(a)}catch(a){r.error("Error creating format function:",a),g=Nt(",")}let w=Xe().range(["transparent",u.cScale0,u.cScale1,u.cScale2,u.cScale3,u.cScale4,u.cScale5,u.cScale6,u.cScale7,u.cScale8,u.cScale9,u.cScale10,u.cScale11]),Y=Xe().range(["transparent",u.cScalePeer0,u.cScalePeer1,u.cScalePeer2,u.cScalePeer3,u.cScalePeer4,u.cScalePeer5,u.cScalePeer6,u.cScalePeer7,u.cScalePeer8,u.cScalePeer9,u.cScalePeer10,u.cScalePeer11]),q=Xe().range([u.cScaleLabel0,u.cScaleLabel1,u.cScaleLabel2,u.cScaleLabel3,u.cScaleLabel4,u.cScaleLabel5,u.cScaleLabel6,u.cScaleLabel7,u.cScaleLabel8,u.cScaleLabel9,u.cScaleLabel10,u.cScaleLabel11]);if(h)_.append("text").attr("x",F/2).attr("y",m/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(h);let ee=_.append("g").attr("transform",`translate(0, ${m})`).attr("class","treemapContainer"),oe=re(v).sum((a)=>a.value??0).sort((a,c)=>(c.value??0)-(a.value??0)),ze=fe().size([i,M]).paddingTop((a)=>a.children&&a.children.length>0?pe+le:0).paddingInner(f).paddingLeft((a)=>a.children&&a.children.length>0?le:0).paddingRight((a)=>a.children&&a.children.length>0?le:0).paddingBottom((a)=>a.children&&a.children.length>0?le:0).round(!0)(oe),Ie=ze.descendants().filter((a)=>a.children&&a.children.length>0),ie=ee.selectAll(".treemapSection").data(Ie).enter().append("g").attr("class","treemapSection").attr("transform",(a)=>`translate(${a.x0},${a.y0})`);if(ie.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",pe).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",0.6).attr("stroke-width",0.6).attr("style",(a)=>{if(a.depth===0)return"display: none;";return""}),ie.append("clipPath").attr("id",(a,c)=>`clip-section-${n}-${c}`).append("rect").attr("width",(a)=>Math.max(0,a.x1-a.x0-12)).attr("height",pe),ie.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",(a)=>a.y1-a.y0).attr("class",(a,c)=>`treemapSection section${c}`).attr("fill",(a)=>w(a.data.name)).attr("fill-opacity",0.6).attr("stroke",(a)=>Y(a.data.name)).attr("stroke-width",2).attr("stroke-opacity",0.4).attr("style",(a)=>{if(a.depth===0)return"display: none;";let c=k({cssCompiledStyles:a.data.cssCompiledStyles});return c.nodeStyles+";"+c.borderStyles.join(";")}),ie.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",pe/2).attr("dominant-baseline","middle").text((a)=>a.depth===0?"":a.data.name).attr("font-weight","bold").attr("clip-path",(a,c)=>`url(#clip-section-${n}-${c})`).attr("style",(a)=>{if(a.depth===0)return"display: none;";let c="dominant-baseline: middle; font-size: 12px; fill:"+q(a.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",y=k({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")}).each(function(a){if(a.depth===0)return;let c=p(this),y=a.data.name;c.text(y);let z=a.x1-a.x0,R=6,P;if(d.showValues!==!1&&a.value){let O=z-10,K=30,Ge=10;P=O-30-10-R}else P=z-R-6;let x=Math.max(15,P),J=c.node();if(J.getComputedTextLength()>x){let K=y;while(K.length>0){if(K=y.substring(0,K.length-1),K.length===0){if(c.text("..."),J.getComputedTextLength()>x)c.text("");break}if(c.text(K+"..."),J.getComputedTextLength()<=x)break}}}),d.showValues!==!1)ie.append("text").attr("class","treemapSectionValue").attr("x",(a)=>a.x1-a.x0-10).attr("y",pe/2).attr("text-anchor","end").attr("dominant-baseline","middle").text((a)=>a.value?g(a.value):"").attr("font-style","italic").attr("style",(a)=>{if(a.depth===0)return"display: none;";let c="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+q(a.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",y=k({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")});let De=ze.leaves(),G=De.length>20,Oe=G?16:38,de=G?14:28,te=G?4:8,ae=G?4:6,he=G?2:4,Ve=G?8:10,me=G?1:2,ue=ee.selectAll(".treemapLeafGroup").data(De).enter().append("g").attr("class",(a,c)=>`treemapNode treemapLeafGroup leaf${c}${a.data.classSelector?` ${a.data.classSelector}`:""}x`).attr("transform",(a)=>`translate(${a.x0},${a.y0})`);if(ue.append("rect").attr("width",(a)=>a.x1-a.x0).attr("height",(a)=>a.y1-a.y0).attr("class","treemapLeaf").attr("fill",(a)=>a.parent?w(a.parent.data.name):w(a.data.name)).attr("style",(a)=>k({cssCompiledStyles:a.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",0.3).attr("stroke",(a)=>a.parent?w(a.parent.data.name):w(a.data.name)).attr("stroke-width",3),ue.append("clipPath").attr("id",(a,c)=>`clip-${n}-${c}`).append("rect").attr("width",(a)=>Math.max(0,a.x1-a.x0-4)).attr("height",(a)=>Math.max(0,a.y1-a.y0-4)),ue.append("text").attr("class","treemapLabel").attr("x",(a)=>(a.x1-a.x0)/2).attr("y",(a)=>(a.y1-a.y0)/2).attr("style",(a)=>{let c=`text-anchor: middle; dominant-baseline: middle; font-size: ${Oe}px;fill:`+q(a.data.name)+";",y=k({cssCompiledStyles:a.data.cssCompiledStyles});return c+y.labelStyles.replace("color:","fill:")}).attr("clip-path",(a,c)=>`url(#clip-${n}-${c})`).text((a)=>a.data.name).each(function(a){let c=p(this),y=a.x1-a.x0,z=a.y1-a.y0,R=c.node(),P=y-2*he,Z=z-2*he;if(P<Ve||Z<Ve){c.style("display","none");return}let x=parseInt(c.style("font-size"),10),J=0.6;while(R.getComputedTextLength()>P&&x>te)x--,c.style("font-size",`${x}px`);let H=Math.max(ae,Math.min(de,Math.round(x*J))),O=x+me+H;while(O>Z&&x>te){if(x--,H=Math.max(ae,Math.min(de,Math.round(x*J))),H<ae&&x===te)break;if(c.style("font-size",`${x}px`),O=x+me+H,H<=ae&&O>Z);}if(c.style("font-size",`${x}px`),G){if(x<te||Z<te)c.style("display","none")}else if(R.getComputedTextLength()>P||x<te||Z<x)c.style("display","none")}),d.showValues!==!1)ue.append("text").attr("class","treemapValue").attr("x",(c)=>(c.x1-c.x0)/2).attr("y",function(c){return(c.y1-c.y0)/2}).attr("style",(c)=>{let y=`text-anchor: middle; dominant-baseline: hanging; font-size: ${de}px;fill:`+q(c.data.name)+";",z=k({cssCompiledStyles:c.data.cssCompiledStyles});return y+z.labelStyles.replace("color:","fill:")}).attr("clip-path",(c,y)=>`url(#clip-${n}-${y})`).text((c)=>c.value?g(c.value):"").each(function(c){let y=p(this),z=this.parentNode;if(!z){y.style("display","none");return}let R=p(z).select(".treemapLabel");if(R.empty()||R.style("display")==="none"){y.style("display","none");return}let P=parseFloat(R.style("font-size")),x=Math.max(ae,Math.min(de,Math.round(P*0.6)));y.style("font-size",`${x}px`);let H=(c.y1-c.y0)/2+P/2+me;y.attr("y",H);let O=c.x1-c.x0,Pe=c.y1-c.y0-4,Ye=O-2*he;if(y.node().getComputedTextLength()>Ye||H+x>Pe||x<ae)y.style("display","none");else y.style("display",null)});let qe=d.diagramPadding??8;se(_,qe,"flowchart",d?.useMaxWidth||!1)},"draw"),st=e(function(t,n){return n.db.getClasses()},"getClasses"),it={draw:ot,getClasses:st},ct={sectionStrokeColor:"black",sectionStrokeWidth:"1",sectionFillColor:"#efefef",leafStrokeColor:"black",leafStrokeWidth:"1",leafFillColor:"#efefef",labelFontSize:"12px",valueFontSize:"10px",titleFontSize:"14px"},pt=e(({treemap:t}={})=>{let n=we(),l=b(),o=U(n,l.themeVariables),s=U(ct,t),d=s.titleColor??o.titleColor,f=s.labelColor??o.textColor,h=s.valueColor??o.textColor;return`
|
|
2
2
|
.treemapNode.section {
|
|
3
3
|
stroke: ${s.sectionStrokeColor};
|
|
4
4
|
stroke-width: ${s.sectionStrokeWidth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e,r}from"./chunk-
|
|
1
|
+
import{e,r}from"./chunk-vymqrpm3.js";import{K,It,Rt}from"./chunk-tse9gvyq.js";import{W}from"./chunk-89fkdgbp.js";import{rr,_t}from"./chunk-n8gfjj9a.js";var o=rr().Railroad.parser.LangiumParser,n=e((a)=>{switch(a.$type){case"RailroadTerminalExpr":return{type:"terminal",value:a.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:a.name};case"RailroadSpecialExpr":return{type:"special",text:a.text};case"RailroadSequenceExpr":{let t=a.elements.map(n);return t.length===1?t[0]:{type:"sequence",elements:t}}case"RailroadChoiceExpr":{let t=a.alternatives.map(n);return t.length===1?t[0]:{type:"choice",alternatives:t}}case"RailroadOptionalExpr":return{type:"optional",element:n(a.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:n(a.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:n(a.element),min:0,max:1/0};default:throw Error(`Unsupported railroad expression: ${a.$type}`)}},"transformExpression"),l=e((a)=>({name:a.name,definition:n(a.definition)}),"transformRule"),s=e((a)=>{if(W(a,K),a.title)K.setTitle(a.title);a.rules.map((t)=>K.addRule(l(t)))},"populateDb"),m={parse:e((a)=>{K.clear(),r.debug("[Railroad Parser] Starting Langium parse");let t=o.parse(a);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new _t(t);let i=t.value;r.debug("[Railroad Parser] Parsed rules:",i.rules.length),s(i),r.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:K}},R={parser:m,db:K,renderer:Rt,styles:It};export{R as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{wo}from"./chunk-fhnypcrm.js";export{wo as QuestionDock};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W}from"./chunk-
|
|
1
|
+
import{W}from"./chunk-89fkdgbp.js";import{e,r,we,D,b,B,C,S,E,T,A,I,L,V,U}from"./chunk-vymqrpm3.js";import{X}from"./chunk-n8gfjj9a.js";var ht=e(()=>({domains:new Map,transitions:[]}),"createDefaultData"),ot=ht(),St=e(()=>ot.domains,"getDomains"),Mt=e(()=>ot.transitions,"getTransitions"),zt=e((t)=>{if(!t)return;for(let n of t){let o=n.domain,a=(n.items??[]).map((l)=>({label:l.label}));ot.domains.set(o,{name:o,items:a})}},"setDomains"),Lt=e((t)=>{if(!t)return;ot.transitions=t.filter((n)=>{if(n.from===n.to)return r.warn(`Cynefin: self-loop transition on domain "${n.from}" is not meaningful and will be skipped.`),!1;return!0}).map((n)=>({from:n.from,to:n.to,label:n.label||void 0}))},"setTransitions"),Nt=e(()=>U({...D.cynefin,...b().cynefin}),"getConfig"),Pt=e(()=>{C(),ot=ht()},"clear"),it={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:S,getAccTitle:E,setDiagramTitle:I,getDiagramTitle:L,getAccDescription:A,setAccDescription:T},It=e((t)=>{W(t,it),it.setDomains(t.domains),it.setTransitions(t.transitions)},"populate"),Wt={parse:e(async(t)=>{let n=await X("cynefin",t);r.debug(n),It(n)},"parse")};function nt(t){let n=t+1831565813|0;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}e(nt,"seededRandom");function xt(t){let n=0;for(let o=0;o<t.length;o++){let a=t.charCodeAt(o);n=(n<<5)-n+a,n|=0}return n}e(xt,"hashString");function $t(t,n){if(typeof t==="number"&&Number.isFinite(t)&&t!==0)return t;return xt(n)}e($t,"resolveSeed");function bt(t,n,o,a){let l=t/2,p=a??t*0.015,at=7,Z=n/7,f=[];for(let i=0;i<=7;i++){let y=nt(o+i*17)*p*2-p;f.push({x:l+y,y:i*Z})}let N=`M${f[0].x},${f[0].y}`;for(let i=0;i<f.length-1;i++){let y=f[i],c=f[i+1],m=(y.y+c.y)/2,k=i%2===0?1:-1,h=p*1.5*k*nt(o+i*31+7),J=y.x+h,K=m,tt=c.x-h;N+=` C${J},${K} ${tt},${m} ${c.x},${c.y}`}return N}e(bt,"generateFoldPath");function wt(t,n,o,a){let l=n/2,p=a??n*0.015,at=7,Z=t/7,f=[];for(let i=0;i<=7;i++){let y=nt(o+i*23)*p*2-p;f.push({x:i*Z,y:l+y})}let N=`M${f[0].x},${f[0].y}`;for(let i=0;i<f.length-1;i++){let y=f[i],c=f[i+1],m=(y.x+c.x)/2,k=i%2===0?1:-1,h=p*1.5*k*nt(o+i*37+11),J=m,K=y.y+h,tt=m,Y=c.y-h;N+=` C${J},${K} ${tt},${Y} ${c.x},${c.y}`}return N}e(wt,"generateHorizontalBoundary");function Ct(t,n){let o=t/2,a=n*0.5,l=n,p=t*0.03;return[`M${o},${a}`,`C${o+p},${a+(l-a)*0.2}`,`${o-p*1.5},${a+(l-a)*0.55}`,`${o+p*0.5},${a+(l-a)*0.75}`,`C${o-p},${a+(l-a)*0.85}`,`${o+p*0.3},${a+(l-a)*0.95}`,`${o},${l}`].join(" ")}e(Ct,"generateCliffPath");function vt(t,n,o,a){return[`M${t-o},${n}`,`A${o},${a} 0 1,1 ${t+o},${n}`,`A${o},${a} 0 1,1 ${t-o},${n}`,"Z"].join(" ")}e(vt,"generateConfusionPath");var gt={complex:{model:"Probe → Sense → Respond",practice:"Emergent Practices"},complicated:{model:"Sense → Analyse → Respond",practice:"Good Practices"},clear:{model:"Sense → Categorise → Respond",practice:"Best Practices"},chaotic:{model:"Act → Sense → Respond",practice:"Novel Practices"},confusion:{model:"",practice:"Disorder"}},Rt=e((t,n)=>{let o=t/2,a=n/2;return{complex:{cx:o/2,cy:a/2,x:0,y:0,w:o,h:a},complicated:{cx:o+o/2,cy:a/2,x:o,y:0,w:o,h:a},chaotic:{cx:o/2,cy:a+a/2,x:0,y:a,w:o,h:a},clear:{cx:o+o/2,cy:a+a/2,x:o,y:a,w:o,h:a},confusion:{cx:o,cy:a,x:o*0.7,y:a*0.7,w:o*0.6,h:a*0.6}}},"getDomainLayouts"),Ft=e(()=>{let t=we(),n=b();return U(t,n.themeVariables).cynefin},"getCynefinDomainColors"),lt=3,Vt=e((t,n,o,a)=>{let l=a.db,p=l.getDomains(),at=l.getTransitions(),Z=l.getDiagramTitle(),f=l.getAccTitle(),N=l.getAccDescription(),i=l.getConfig(),y=Ft();r.debug("Rendering Cynefin diagram");let{width:c,height:m,padding:k,showDomainDescriptions:h,boundaryAmplitude:J}=i,K=c+k*2,tt=m+k*2,Y={complex:y.complexBg,complicated:y.complicatedBg,clear:y.clearBg,chaotic:y.chaoticBg,confusion:y.confusionBg},P=V(n);if(B(P,tt,K,i.useMaxWidth??!0),P.attr("viewBox",`0 0 ${K} ${tt}`),f)P.append("title").text(f);if(N)P.append("desc").text(N);let R=P.append("g").attr("transform",`translate(${k}, ${k})`),et=Rt(c,m),dt=$t(i.seed,n),Dt=R.append("g").attr("class","cynefin-backgrounds"),st=["complex","complicated","chaotic","clear"];for(let d of st){let s=et[d];Dt.append("rect").attr("class","cynefinDomain").attr("x",s.x).attr("y",s.y).attr("width",s.w).attr("height",s.h).attr("fill",Y[d]).attr("fill-opacity",0.4).attr("stroke","none")}let ct=R.append("g").attr("class","cynefin-boundaries");ct.append("path").attr("class","cynefinBoundary").attr("d",bt(c,m,dt,J)).attr("fill","none"),ct.append("path").attr("class","cynefinBoundary").attr("d",wt(c,m,dt+100,J)).attr("fill","none"),ct.append("path").attr("class","cynefinCliff").attr("d",Ct(c,m)).attr("fill","none");let kt=c*0.15,Tt=m*0.15;R.append("path").attr("class","cynefinConfusion").attr("d",vt(c/2,m/2,kt,Tt)).attr("fill",Y.confusion).attr("fill-opacity",0.5);let ft=R.append("g").attr("class","cynefin-labels");for(let d of st){let s=et[d];ft.append("text").attr("class","cynefinDomainLabel").attr("x",s.cx).attr("y",h?s.cy-30:s.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(d.charAt(0).toUpperCase()+d.slice(1))}if(ft.append("text").attr("class","cynefinDomainLabel").attr("x",c/2).attr("y",h?m/2-10:m/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){let d=R.append("g").attr("class","cynefin-subtitles");for(let s of st){let g=et[s],u=gt[s];d.append("text").attr("class","cynefinSubtitle").attr("x",g.cx).attr("y",g.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(u.model),d.append("text").attr("class","cynefinSubtitle").attr("x",g.cx).attr("y",g.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(u.practice)}d.append("text").attr("class","cynefinSubtitle").attr("x",c/2).attr("y",m/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(gt.confusion.practice)}let mt=R.append("g").attr("class","cynefin-items"),F=26,pt=10,At=["complex","complicated","chaotic","clear","confusion"];for(let d of At){let s=p.get(d);if(!s||s.items.length===0)continue;let g=et[d],u=d==="confusion",O=s.items,j=0;if(u&&s.items.length>lt)j=s.items.length-lt,O=s.items.slice(0,lt);let _;if(u){let w=h?22:14;_=g.cy+w}else _=g.cy+(h?25:15);if([...O].forEach((w,H)=>{let M=_+H*(F+4),G=mt.append("g"),q=G.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",F/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(w.label),v=w.label.length*7,x=q.node();if(x&&typeof x.getBBox==="function"){let rt=x.getBBox();if(rt.width>0)v=rt.width}let z=v+pt*2,Q=g.cx-z/2;G.attr("transform",`translate(${Q}, ${M})`),G.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",z).attr("height",F).attr("rx",4).attr("ry",4).attr("fill",Y[d]).attr("fill-opacity",0.95),q.attr("x",z/2).attr("y",F/2)}),j>0){let w=_+O.length*(F+4),H=`+${j} more`,M=mt.append("g"),G=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",F/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(H),q=H.length*7,v=G.node();if(v&&typeof v.getBBox==="function"){let Q=v.getBBox();if(Q.width>0)q=Q.width}let x=q+pt*2,z=g.cx-x/2;M.attr("transform",`translate(${z}, ${w})`),M.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",F).attr("rx",4).attr("ry",4).attr("fill",Y[d]).attr("fill-opacity",0.6),G.attr("x",x/2).attr("y",F/2)}}if(at.length>0){let d=P.select("defs").empty()?P.append("defs"):P.select("defs"),s=`cynefin-arrow-${n}`;d.append("marker").attr("id",s).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("class","cynefinArrowHead");let g=R.append("g").attr("class","cynefin-arrows");at.forEach((u)=>{let O=et[u.from],j=et[u.to];if(!O||!j)return;if(u.from===u.to){r.warn(`Cynefin renderer: skipping self-loop on domain "${u.from}"`);return}let{cx:_,cy:w}=O,{cx:H,cy:M}=j,G=(_+H)/2,q=(w+M)/2,v=H-_,x=M-w,z=Math.sqrt(v*v+x*x),Q=z*0.15,rt=-x/z,Bt=v/z,yt=G+rt*Q,ut=q+Bt*Q;if(g.append("path").attr("class","cynefinArrowLine").attr("d",`M${_},${w} Q${yt},${ut} ${H},${M}`).attr("fill","none").attr("marker-end",`url(#${s})`),u.label)g.append("text").attr("class","cynefinArrowLabel").attr("x",yt).attr("y",ut-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(u.label)})}if(Z)R.append("text").attr("class","cynefinTitle").attr("x",c/2).attr("y",-k/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(Z)},"draw"),_t={draw:Vt},Et=e(()=>{let t=we(),n=b();return U(t,n.themeVariables).cynefin},"getCynefinTheme"),Ht=e(()=>{let t=Et();return`
|
|
2
2
|
.cynefinDomain {
|
|
3
3
|
stroke: none;
|
|
4
4
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e,r}from"./chunk-
|
|
1
|
+
import{e,r}from"./chunk-vymqrpm3.js";import{K,It,Rt}from"./chunk-tse9gvyq.js";import{W}from"./chunk-89fkdgbp.js";import{or,_t}from"./chunk-n8gfjj9a.js";var i=or().RailroadPeg.parser.LangiumParser,s=e((t)=>{let a=t.alternatives.map(l);if(a.length===1)return a[0];return{type:"choice",alternatives:a}},"transformOrderedChoice"),l=e((t)=>{let a=t.elements.map(m);if(a.length===1)return a[0];return{type:"sequence",elements:a}},"transformSequence"),m=e((t)=>{let a=p(t.suffix);if(!t.operator)return a;return{type:"special",text:t.operator==="&"?`&${o(a)}`:`!${o(a)}`}},"transformPrefix"),o=e((t)=>{switch(t.type){case"terminal":return`"${t.value}"`;case"nonterminal":return t.name;case"special":return t.text;default:return"(...)"}},"nodeToLabel"),p=e((t)=>{let a=u(t.primary);if(!t.operator)return a;switch(t.operator){case"?":return{type:"optional",element:a};case"*":return{type:"repetition",element:a,min:0,max:1/0};case"+":return{type:"repetition",element:a,min:1,max:1/0};default:throw Error(`Unsupported PEG suffix operator: ${t.operator}`)}},"transformSuffix"),u=e((t)=>{switch(t.$type){case"PegLiteral":return{type:"terminal",value:t.value};case"PegIdentifier":return{type:"nonterminal",name:t.name};case"PegGroup":return s(t.element);case"PegAny":return{type:"special",text:t.dot};default:throw Error(`Unsupported PEG primary node: ${t.$type}`)}},"transformPrimary"),c=e((t)=>({name:t.name,definition:s(t.definition)}),"transformRule"),f=e((t)=>{if(W(t,K),t.title)K.setTitle(t.title);t.rules.map((a)=>K.addRule(c(a)))},"populateDb"),d={parse:e((t)=>{K.clear(),r.debug("[PEG Parser] Starting Langium parse");let a=i.parse(t);if(a.lexerErrors.length>0||a.parserErrors.length>0)throw new _t(a);let n=a.value;r.debug("[PEG Parser] Parsed rules:",n.rules.length),f(n),r.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:K}},w={parser:d,db:K,renderer:Rt,styles:It};export{w as diagram};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{e,r,we,b,O,B,C,s,
|
|
2
|
-
`),r.debug("[Railroad] Accessibility description set:",t)},"setAccDescription"),te=e(()=>E,"getAccDescription"),re=L,ie=I,K={clear:
|
|
1
|
+
import{e,r,we,b,O,B,C,s,V}from"./chunk-vymqrpm3.js";var M="",D="",E="",W=[],N=new Map,S=e((t)=>O(t,s()),"sanitizeText"),R=e((t)=>{switch(t.type){case"terminal":return{...t,value:S(t.value)};case"nonterminal":return{...t,name:S(t.name)};case"sequence":return{...t,elements:t.elements.map(R)};case"choice":return{...t,alternatives:t.alternatives.map(R)};case"optional":return{...t,element:R(t.element)};case"repetition":return{...t,element:R(t.element),separator:t.separator?R(t.separator):void 0};case"special":return{...t,text:S(t.text)}}},"sanitizeAstNode"),G=e(()=>{M="",D="",E="",W.length=0,N.clear(),C(),r.debug("[Railroad] Database cleared")},"clear"),L=e((t)=>{M=S(t),r.debug("[Railroad] Title set:",t)},"setTitle"),I=e(()=>M,"getTitle"),U=e((t)=>{let a={...t,name:S(t.name),definition:R(t.definition),comment:t.comment?S(t.comment):void 0};if(r.debug("[Railroad] Adding rule:",a.name),N.has(a.name))r.warn(`[Railroad] Rule '${a.name}' is already defined. Overwriting.`);W.push(a),N.set(a.name,a)},"addRule"),j=e(()=>W,"getRules"),J=e((t)=>N.get(t),"getRule"),Q=e((t)=>{D=S(t).replace(/^\s+/g,""),r.debug("[Railroad] Accessibility title set:",t)},"setAccTitle"),Z=e(()=>D,"getAccTitle"),ee=e((t)=>{E=S(t).replace(/\n\s+/g,`
|
|
2
|
+
`),r.debug("[Railroad] Accessibility description set:",t)},"setAccDescription"),te=e(()=>E,"getAccDescription"),re=L,ie=I,K={clear:G,setTitle:L,getTitle:I,addRule:U,getRules:j,getRule:J,setAccTitle:Q,getAccTitle:Z,setAccDescription:ee,getAccDescription:te,setDiagramTitle:re,getDiagramTitle:ie},T={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},ne=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,ae=/^[\w "',.-]+$/,oe=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),X=e((t)=>{if(!t)return!1;return Object.keys(t).every((a)=>a==="railroad"||oe.has(a))},"isRailroadStyleOptions"),le=e((t)=>{if(!t)return{};if("railroad"in t&&t.railroad)return t.railroad;return X(t)?t:{}},"extractRailroadOverrides"),se=e((t)=>{if(!t||X(t))return{};let{railroad:a,svgId:l,theme:n,look:i,...o}=t;return o},"extractThemeOverrides"),u=e((t,a)=>{if(typeof t!=="string")return a;let l=t.trim();return ne.test(l)?l:a},"sanitizeColorValue"),H=e((t,a)=>{if(typeof t!=="string")return a;let l=t.trim();return ae.test(l)?l:a},"sanitizeFontFamilyValue"),y=e((t,a)=>{let l=typeof t==="number"?t:typeof t==="string"?Number.parseFloat(t):Number.NaN;return Number.isFinite(l)&&l>=0?l:a},"sanitizeNumberValue"),de=e((t)=>{let a=typeof t==="number"?t:typeof t==="string"?Number.parseFloat(t):Number.NaN;return Number.isFinite(a)&&a>0?a:void 0},"parseThemeFontSize"),ce=e((t)=>{let a=H(t.fontFamily,T.fontFamily),l=de(t.fontSize)??T.fontSize;return{...T,fontFamily:a,fontSize:l,terminalFill:u(t.secondBkg??t.secondaryColor,T.terminalFill),terminalStroke:u(t.secondaryBorderColor??t.lineColor,T.terminalStroke),terminalTextColor:u(t.secondaryTextColor??t.textColor,T.terminalTextColor),nonTerminalFill:u(t.mainBkg??t.background,T.nonTerminalFill),nonTerminalStroke:u(t.primaryBorderColor??t.lineColor,T.nonTerminalStroke),nonTerminalTextColor:u(t.primaryTextColor??t.textColor,T.nonTerminalTextColor),lineColor:u(t.lineColor,T.lineColor),markerFill:u(t.lineColor,T.markerFill),commentFill:u(t.labelBackground??t.tertiaryColor,T.commentFill),commentStroke:u(t.tertiaryBorderColor??t.lineColor,T.commentStroke),commentTextColor:u(t.tertiaryTextColor??t.textColor,T.commentTextColor),specialFill:u(t.tertiaryColor??t.secondaryColor,T.specialFill),specialStroke:u(t.tertiaryBorderColor??t.secondaryBorderColor,T.specialStroke),ruleNameColor:u(t.titleColor??t.textColor,T.ruleNameColor)}},"buildThemeDefaults"),_=e((t)=>{let a=b(),l={...we(),...a.themeVariables??{},...se(t)},n=ce(l),i={...a.railroad??{},...le(t)};return{compactMode:i.compactMode??n.compactMode,padding:y(i.padding,n.padding),verticalSeparation:y(i.verticalSeparation,n.verticalSeparation),horizontalSeparation:y(i.horizontalSeparation,n.horizontalSeparation),arcRadius:y(i.arcRadius,n.arcRadius),fontSize:y(i.fontSize,n.fontSize),fontFamily:H(i.fontFamily,n.fontFamily),terminalFill:u(i.terminalFill,n.terminalFill),terminalStroke:u(i.terminalStroke,n.terminalStroke),terminalTextColor:u(i.terminalTextColor,n.terminalTextColor),nonTerminalFill:u(i.nonTerminalFill,n.nonTerminalFill),nonTerminalStroke:u(i.nonTerminalStroke,n.nonTerminalStroke),nonTerminalTextColor:u(i.nonTerminalTextColor,n.nonTerminalTextColor),lineColor:u(i.lineColor,n.lineColor),strokeWidth:y(i.strokeWidth,n.strokeWidth),markerFill:u(i.markerFill,n.markerFill),commentFill:u(i.commentFill,n.commentFill),commentStroke:u(i.commentStroke,n.commentStroke),commentTextColor:u(i.commentTextColor,n.commentTextColor),specialFill:u(i.specialFill,n.specialFill),specialStroke:u(i.specialStroke,n.specialStroke),ruleNameColor:u(i.ruleNameColor,n.ruleNameColor),showMarkers:i.showMarkers??n.showMarkers,markerRadius:y(i.markerRadius,n.markerRadius)}},"buildRailroadStyleOptions"),It=e((t)=>{let{fontFamily:a,fontSize:l,terminalFill:n,terminalStroke:i,terminalTextColor:o,nonTerminalFill:g,nonTerminalStroke:m,nonTerminalTextColor:d,lineColor:f,strokeWidth:p,markerFill:h,commentFill:k,commentStroke:c,commentTextColor:x,specialFill:z,specialStroke:F,ruleNameColor:v}=_(t);return`
|
|
3
3
|
.railroad-diagram {
|
|
4
4
|
font-family: ${a};
|
|
5
5
|
font-size: ${l}px;
|
|
@@ -84,6 +84,6 @@ import{e,r,we,b,O,B,C,s,q}from"./chunk-y0m8hrwz.js";var M="",D="",E="",W=[],N=ne
|
|
|
84
84
|
.railroad-group {
|
|
85
85
|
/* Grouping container, no specific styles */
|
|
86
86
|
}
|
|
87
|
-
`},"getStyles"),w=class{constructor(){this.d=""}static{e(this,"PathBuilder")}moveTo(t,a){return this.d+=`M ${t} ${a} `,this}lineTo(t,a){return this.d+=`L ${t} ${a} `,this}horizontalTo(t){return this.d+=`H ${t} `,this}verticalTo(t){return this.d+=`V ${t} `,this}arcTo(t,a,l,n,i,o,g){return this.d+=`A ${t} ${a} ${l} ${n?1:0} ${i?1:0} ${o} ${g} `,this}build(){return this.d.trim()}},me=class{constructor(t,a=_()){this.textCache=new Map,this.svg=t,this.config=a}static{e(this,"RailroadRenderer")}measureText(t){if(this.textCache.has(t))return this.textCache.get(t);let a=this.svg.append("text").attr("font-family",this.config.fontFamily).attr("font-size",this.config.fontSize).text(t),l=a.node().getBBox(),n={width:l.width,height:l.height};return a.remove(),this.textCache.set(t,n),n}renderTerminal(t,a){let l=this.measureText(a),n=l.width+this.config.padding*2,i=l.height+this.config.padding*2,o=t.append("g").attr("class","railroad-terminal");return o.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i).attr("rx",10).attr("ry",10),o.append("text").attr("x",n/2).attr("y",i/2).text(a),{element:o.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderNonTerminal(t,a){let l=this.measureText(a),n=l.width+this.config.padding*2,i=l.height+this.config.padding*2,o=t.append("g").attr("class","railroad-nonterminal");return o.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i),o.append("text").attr("x",n/2).attr("y",i/2).text(a),{element:o.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderSequence(t,a){let l=a.map((d)=>this.renderExpression(t,d)),n=0,i=0,o=0;for(let d of l)n+=d.dimensions.width,i=Math.max(i,d.dimensions.up),o=Math.max(o,d.dimensions.down);n+=(l.length-1)*this.config.horizontalSeparation;let g=t.append("g").attr("class","railroad-sequence"),m=0;for(let d=0;d<l.length;d++){let f=l[d],p=i-f.dimensions.up;if(g.node().appendChild(f.element).setAttribute("transform",`translate(${m}, ${p})`),d<l.length-1){let k=m+f.dimensions.width,c=k+this.config.horizontalSeparation,x=i;g.append("path").attr("class","railroad-line").attr("d",new w().moveTo(k,x).lineTo(c,x).build())}m+=f.dimensions.width+this.config.horizontalSeparation}return{element:g.node(),dimensions:{width:n,height:i+o,up:i,down:o}}}renderChoice(t,a){let l=a.map((h)=>this.renderExpression(t,h)),n=0,i=0;for(let h of l)n=Math.max(n,h.dimensions.width),i+=h.dimensions.height;i+=(l.length-1)*this.config.verticalSeparation;let o=this.config.arcRadius,g=o*4,m=n+g,d=t.append("g").attr("class","railroad-choice"),f=0,p=i/2;for(let h of l){let k=f,c=k+h.dimensions.up,x=o*2+(n-h.dimensions.width)/2;d.node().appendChild(h.element).setAttribute("transform",`translate(${x}, ${k})`);let F=new w,v=c>p;if(c===p)F.moveTo(0,p).lineTo(x,c);else F.moveTo(0,p).arcTo(o,o,0,!1,v,o,p+(v?o:-o)).lineTo(o,c-(v?o:-o)).arcTo(o,o,0,!1,!v,o*2,c).lineTo(x,c);d.append("path").attr("class","railroad-line").attr("d",F.build());let A=new w,Y=x+h.dimensions.width,
|
|
88
|
-
`+t);try{let n=
|
|
89
|
-
export{K,
|
|
87
|
+
`},"getStyles"),w=class{constructor(){this.d=""}static{e(this,"PathBuilder")}moveTo(t,a){return this.d+=`M ${t} ${a} `,this}lineTo(t,a){return this.d+=`L ${t} ${a} `,this}horizontalTo(t){return this.d+=`H ${t} `,this}verticalTo(t){return this.d+=`V ${t} `,this}arcTo(t,a,l,n,i,o,g){return this.d+=`A ${t} ${a} ${l} ${n?1:0} ${i?1:0} ${o} ${g} `,this}build(){return this.d.trim()}},me=class{constructor(t,a=_()){this.textCache=new Map,this.svg=t,this.config=a}static{e(this,"RailroadRenderer")}measureText(t){if(this.textCache.has(t))return this.textCache.get(t);let a=this.svg.append("text").attr("font-family",this.config.fontFamily).attr("font-size",this.config.fontSize).text(t),l=a.node().getBBox(),n={width:l.width,height:l.height};return a.remove(),this.textCache.set(t,n),n}renderTerminal(t,a){let l=this.measureText(a),n=l.width+this.config.padding*2,i=l.height+this.config.padding*2,o=t.append("g").attr("class","railroad-terminal");return o.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i).attr("rx",10).attr("ry",10),o.append("text").attr("x",n/2).attr("y",i/2).text(a),{element:o.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderNonTerminal(t,a){let l=this.measureText(a),n=l.width+this.config.padding*2,i=l.height+this.config.padding*2,o=t.append("g").attr("class","railroad-nonterminal");return o.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i),o.append("text").attr("x",n/2).attr("y",i/2).text(a),{element:o.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderSequence(t,a){let l=a.map((d)=>this.renderExpression(t,d)),n=0,i=0,o=0;for(let d of l)n+=d.dimensions.width,i=Math.max(i,d.dimensions.up),o=Math.max(o,d.dimensions.down);n+=(l.length-1)*this.config.horizontalSeparation;let g=t.append("g").attr("class","railroad-sequence"),m=0;for(let d=0;d<l.length;d++){let f=l[d],p=i-f.dimensions.up;if(g.node().appendChild(f.element).setAttribute("transform",`translate(${m}, ${p})`),d<l.length-1){let k=m+f.dimensions.width,c=k+this.config.horizontalSeparation,x=i;g.append("path").attr("class","railroad-line").attr("d",new w().moveTo(k,x).lineTo(c,x).build())}m+=f.dimensions.width+this.config.horizontalSeparation}return{element:g.node(),dimensions:{width:n,height:i+o,up:i,down:o}}}renderChoice(t,a){let l=a.map((h)=>this.renderExpression(t,h)),n=0,i=0;for(let h of l)n=Math.max(n,h.dimensions.width),i+=h.dimensions.height;i+=(l.length-1)*this.config.verticalSeparation;let o=this.config.arcRadius,g=o*4,m=n+g,d=t.append("g").attr("class","railroad-choice"),f=0,p=i/2;for(let h of l){let k=f,c=k+h.dimensions.up,x=o*2+(n-h.dimensions.width)/2;d.node().appendChild(h.element).setAttribute("transform",`translate(${x}, ${k})`);let F=new w,v=c>p;if(c===p)F.moveTo(0,p).lineTo(x,c);else F.moveTo(0,p).arcTo(o,o,0,!1,v,o,p+(v?o:-o)).lineTo(o,c-(v?o:-o)).arcTo(o,o,0,!1,!v,o*2,c).lineTo(x,c);d.append("path").attr("class","railroad-line").attr("d",F.build());let A=new w,Y=x+h.dimensions.width,q=m-o*2;if(c===p)A.moveTo(Y,c).lineTo(m,p);else A.moveTo(Y,c).lineTo(q,c).arcTo(o,o,0,!1,!v,m-o,c+(v?-o:o)).lineTo(m-o,p+(v?o:-o)).arcTo(o,o,0,!1,v,m,p);d.append("path").attr("class","railroad-line").attr("d",A.build()),f+=h.dimensions.height+this.config.verticalSeparation}return{element:d.node(),dimensions:{width:m,height:i,up:p,down:i-p}}}renderOptional(t,a){let l=this.renderExpression(t,a),n=this.config.arcRadius,i=n*2,o=l.dimensions.width+n*4,g=l.dimensions.height+i,m=t.append("g").attr("class","railroad-optional"),d=n*2,f=i;m.node().appendChild(l.element).setAttribute("transform",`translate(${d}, ${f})`);let h=f+l.dimensions.up,k=new w().moveTo(0,h).lineTo(n*2,h);m.append("path").attr("class","railroad-line").attr("d",k.build());let c=new w().moveTo(d+l.dimensions.width,h).lineTo(o,h);m.append("path").attr("class","railroad-line").attr("d",c.build());let x=new w().moveTo(0,h).arcTo(n,n,0,!1,!1,n,h-n).lineTo(n,n).arcTo(n,n,0,!1,!0,n*2,0).lineTo(o-n*2,0).arcTo(n,n,0,!1,!0,o-n,n).lineTo(o-n,h-n).arcTo(n,n,0,!1,!1,o,h);return m.append("path").attr("class","railroad-line").attr("d",x.build()),{element:m.node(),dimensions:{width:o,height:g,up:h,down:g-h}}}renderRepetition(t,a,l){let n=this.renderExpression(t,a),i=this.config.arcRadius,o=i*2,g=n.dimensions.width+i*4,m=l===0,d=n.dimensions.height+o+(m?o:0),f=t.append("g").attr("class","railroad-repetition"),p=i*2,h=m?o:0;f.node().appendChild(n.element).setAttribute("transform",`translate(${p}, ${h})`);let c=h+n.dimensions.up;f.append("path").attr("class","railroad-line").attr("d",new w().moveTo(0,c).lineTo(i*2,c).build()),f.append("path").attr("class","railroad-line").attr("d",new w().moveTo(p+n.dimensions.width,c).lineTo(g,c).build());let x=h+n.dimensions.height+i,z=new w().moveTo(p+n.dimensions.width,c).arcTo(i,i,0,!1,!0,p+n.dimensions.width+i,c+i).lineTo(p+n.dimensions.width+i,x).arcTo(i,i,0,!1,!0,p+n.dimensions.width,x+i).lineTo(i*2,x+i).arcTo(i,i,0,!1,!0,i,x).lineTo(i,c+i).arcTo(i,i,0,!1,!0,i*2,c);if(f.append("path").attr("class","railroad-line").attr("d",z.build()),m){let F=new w().moveTo(0,c).arcTo(i,i,0,!1,!1,i,c-i).lineTo(i,i).arcTo(i,i,0,!1,!0,i*2,0).lineTo(g-i*2,0).arcTo(i,i,0,!1,!0,g-i,i).lineTo(g-i,c-i).arcTo(i,i,0,!1,!1,g,c);f.append("path").attr("class","railroad-line").attr("d",F.build())}return{element:f.node(),dimensions:{width:g,height:d,up:c,down:d-c}}}renderSpecial(t,a){let l=this.measureText("? "+a+" ?"),n=l.width+this.config.padding*2,i=l.height+this.config.padding*2,o=t.append("g").attr("class","railroad-special");return o.append("rect").attr("x",0).attr("y",0).attr("width",n).attr("height",i),o.append("text").attr("x",n/2).attr("y",i/2).text("? "+a+" ?"),{element:o.node(),dimensions:{width:n,height:i,up:i/2,down:i/2}}}renderExpression(t,a){switch(a.type){case"terminal":return this.renderTerminal(t,a.value);case"nonterminal":return this.renderNonTerminal(t,a.name);case"sequence":return this.renderSequence(t,a.elements);case"choice":return this.renderChoice(t,a.alternatives);case"optional":return this.renderOptional(t,a.element);case"repetition":return this.renderRepetition(t,a.element,a.min);case"special":return this.renderSpecial(t,a.text);default:throw Error(`Unknown node type: ${a.type}`)}}renderRule(t,a){let l=this.svg.append("g").attr("class","railroad-rule").attr("transform",`translate(0, ${a})`),n=t.name+" =",i=this.measureText(n).width+20,o=i+20,g=l.append("g"),m=this.renderExpression(g,t.definition),d=Math.max(20,m.dimensions.up),f=d-m.dimensions.up;return g.attr("transform",`translate(${o}, ${f})`),l.append("g").attr("class","railroad-rule-name-group").append("text").attr("class","railroad-rule-name").attr("x",0).attr("y",d).text(n),l.append("g").attr("class","railroad-start").append("circle").attr("cx",i).attr("cy",d).attr("r",this.config.markerRadius),l.append("g").attr("class","railroad-end").append("circle").attr("cx",o+m.dimensions.width+10).attr("cy",d).attr("r",this.config.markerRadius),l.append("path").attr("class","railroad-line").attr("d",new w().moveTo(i+this.config.markerRadius,d).lineTo(o,d).build()),l.append("path").attr("class","railroad-line").attr("d",new w().moveTo(o+m.dimensions.width,d).lineTo(o+m.dimensions.width+10-this.config.markerRadius,d).build()),{height:Math.max(40,f+m.dimensions.height+this.config.padding*2),width:o+m.dimensions.width+10+this.config.markerRadius}}renderDiagram(t){let a=this.config.padding,l=0;for(let n of t){let i=this.renderRule(n,a);a+=i.height+this.config.verticalSeparation,l=Math.max(l,i.width)}return{width:l+this.config.padding*2,height:a+this.config.padding}}},P=e((t,a,l)=>{B(t,a.height,a.width,l),t.attr("viewBox",`0 0 ${a.width} ${a.height}`)},"configureRailroadSvgSize"),he=e((t,a,l)=>{r.debug(`[Railroad] Rendering diagram
|
|
88
|
+
`+t);try{let n=V(a);n.attr("class","railroad-diagram");let o=b().railroad?.useMaxWidth??!0,g=K.getRules();if(r.debug(`[Railroad] Rendering ${g.length} rules`),g.length===0){r.warn("[Railroad] No rules to render"),P(n,{height:100,width:200},o);return}let d=new me(n,_()).renderDiagram(g);P(n,d,o),r.debug("[Railroad] Render complete")}catch(n){throw r.error("[Railroad] Render error:",n),n}},"draw"),Rt={draw:he};
|
|
89
|
+
export{K,It,Rt};
|