@bkm016/basalt 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. package/README.md +53 -5
  2. package/{chunk-y648fzx0.js → chunk-0039s4jt.js} +3 -3
  3. package/{chunk-m40gxwq4.js → chunk-00gwse5r.js} +3 -3
  4. package/{chunk-t6zs4kw0.js → chunk-0fwdxd45.js} +2 -2
  5. package/{chunk-6hssbcgj.js → chunk-0j0qggej.js} +1 -1
  6. package/chunk-0n99m9m4.js +2 -0
  7. package/{chunk-d8gtbw9g.js → chunk-0stvywr8.js} +1 -1
  8. package/{chunk-ztsjgssj.js → chunk-1xa7d5mh.js} +1 -1
  9. package/chunk-2nb3d92s.js +2 -0
  10. package/chunk-2nkfxhef.js +3868 -0
  11. package/chunk-2pa1z37c.js +2 -0
  12. package/{chunk-fw2bpqmw.js → chunk-2qcpq99g.js} +1 -1
  13. package/{chunk-981f9dw8.js → chunk-36cqq0ga.js} +6 -6
  14. package/{chunk-3cjsd292.js → chunk-3c330qna.js} +2 -2
  15. package/chunk-3k627vf2.js +3 -0
  16. package/{chunk-r7fpkb49.js → chunk-3k7ejpkc.js} +1 -1
  17. package/chunk-4g5f43ea.js +3 -0
  18. package/{chunk-fjtvjrkg.js → chunk-539ekagy.js} +4 -4
  19. package/{chunk-97rzj7f6.js → chunk-5v4g21rw.js} +1 -1
  20. package/{chunk-aefadsy6.js → chunk-6dsq0fns.js} +2 -2
  21. package/{chunk-pbcy6zdt.js → chunk-7as47pcw.js} +1 -1
  22. package/{chunk-g2t6t8fk.js → chunk-7jezts2n.js} +2 -2
  23. package/{chunk-8tjad3r0.js → chunk-7qq99360.js} +6 -6
  24. package/{chunk-gp7y0fja.js → chunk-7tgqhveh.js} +15 -15
  25. package/{chunk-mvfsxdx6.js → chunk-7w0mefgk.js} +10 -10
  26. package/{chunk-y58ygzn9.js → chunk-818nd6s1.js} +3 -3
  27. package/{chunk-vv7fp27r.js → chunk-8mezk0cb.js} +2 -2
  28. package/{chunk-rtzqqngy.js → chunk-8xb636vr.js} +5 -5
  29. package/{chunk-2esbgxps.js → chunk-980drajf.js} +15 -15
  30. package/{chunk-c7x1zq39.js → chunk-9z7sdh5e.js} +3 -3
  31. package/{chunk-10xzzn07.js → chunk-a4b75ekk.js} +2 -2
  32. package/{chunk-5j1krv9v.js → chunk-ar3dbfp9.js} +1 -1
  33. package/{chunk-vk1gxk1t.js → chunk-aw65h276.js} +1 -1
  34. package/{chunk-75m78j7x.js → chunk-b9fqretv.js} +2 -2
  35. package/{chunk-y0m980k3.js → chunk-bgkegf0k.js} +22 -22
  36. package/{chunk-0y7ne3d0.js → chunk-bwawt15q.js} +2 -2
  37. package/{chunk-pxsrqrd0.js → chunk-c4qr1f41.js} +2 -2
  38. package/chunk-dddsrff6.js +478 -0
  39. package/{chunk-xfvvh1s5.js → chunk-e63c1186.js} +1 -1
  40. package/{chunk-8296hw9m.js → chunk-ebzkckyw.js} +2 -2
  41. package/chunk-eegztdzb.js +2 -0
  42. package/{chunk-hwr56pfj.js → chunk-gw05p4g3.js} +1 -1
  43. package/{chunk-k23t7vhs.js → chunk-h1rypb99.js} +5 -5
  44. package/{chunk-nbb9trwz.js → chunk-hq5ke1yp.js} +2 -2
  45. package/{chunk-jwdb0ccj.js → chunk-jvwg4rn1.js} +3 -3
  46. package/{chunk-fm0k0qtz.js → chunk-jyrwk08p.js} +2 -2
  47. package/chunk-kns4kv7b.js +3 -0
  48. package/{chunk-8d46jtbj.js → chunk-mat08ab1.js} +2 -2
  49. package/{chunk-bannb9xm.js → chunk-mkp28k1x.js} +2 -2
  50. package/{chunk-d2j735sd.js → chunk-npez1492.js} +2 -2
  51. package/{chunk-shadcb9z.js → chunk-nx3jnbv8.js} +2 -2
  52. package/{chunk-ykens1hy.js → chunk-nxkmd29x.js} +1 -1
  53. package/{chunk-y7nma9rk.js → chunk-pjr91g6k.js} +2 -2
  54. package/{chunk-m8vkwdgr.js → chunk-r0jc8e7t.js} +4 -4
  55. package/chunk-rxj6tct8.js +2 -0
  56. package/{chunk-362g64pd.js → chunk-sqaam5ak.js} +1 -1
  57. package/{chunk-gzxnene8.js → chunk-srjgvdvs.js} +12 -12
  58. package/{chunk-r9aatvwm.js → chunk-stj493dn.js} +2 -2
  59. package/{chunk-k6w6y71k.js → chunk-t7sc0wwc.js} +2 -2
  60. package/{chunk-27gntzs5.js → chunk-v4k3qmdm.js} +2 -2
  61. package/{chunk-x1xss1d7.js → chunk-vt1anydc.js} +4 -4
  62. package/chunk-wd3z74av.js +2 -0
  63. package/{chunk-z55bmysw.js → chunk-wfyrfvfn.js} +1 -1
  64. package/{chunk-v9fea96h.js → chunk-wnzvnskb.js} +2 -2
  65. package/{chunk-cjc90f84.js → chunk-x89em726.js} +3 -3
  66. package/{chunk-1qpces5a.js → chunk-xtq1xpq0.js} +2 -2
  67. package/chunk-yna8bwqc.js +2 -0
  68. package/{chunk-k506w58v.js → chunk-zn0g0859.js} +2 -2
  69. package/{chunk-qe0teyn1.js → chunk-zrkh5dw7.js} +1 -1
  70. package/chunk-zzwjt7fp.js +2 -0
  71. package/compiled.js +12 -12
  72. package/package.json +1 -1
  73. package/ui-test-worker.js +20 -20
  74. package/web/chunk-01hcjafh.js +2 -0
  75. package/web/{chunk-n8sky2q6.js → chunk-07agqp8h.js} +1 -1
  76. package/web/{chunk-tx8240k4.js → chunk-0k9aec1s.js} +20 -20
  77. package/web/{chunk-74j07k8k.js → chunk-0p1nmj5n.js} +2 -2
  78. package/web/chunk-0qr891eq.js +70 -0
  79. package/web/{chunk-ts7zrf5b.js → chunk-0whceqes.js} +2 -2
  80. package/web/chunk-0ytga215.js +1 -0
  81. package/web/{chunk-h288yd5w.js → chunk-12z7d0hp.js} +3 -3
  82. package/web/chunk-14bad871.js +2 -0
  83. package/web/chunk-1amzv4ha.js +1 -0
  84. package/web/chunk-1cfh0e2e.js +324 -0
  85. package/web/chunk-1pasbxwh.js +89 -0
  86. package/web/{chunk-j0bwwc1g.js → chunk-1s2hp6h1.js} +1 -1
  87. package/web/chunk-26bwh1sb.js +169 -0
  88. package/web/{chunk-b0a8nbj0.js → chunk-2nht58dc.js} +5 -5
  89. package/web/chunk-2y0rc1fe.js +1 -0
  90. package/web/chunk-3hkgdw6f.js +36 -0
  91. package/web/chunk-4a4j030b.js +1 -0
  92. package/web/{chunk-4fzj0azw.js → chunk-4m3zdd41.js} +6 -6
  93. package/web/chunk-4w298aqs.js +1 -0
  94. package/web/{chunk-2hd1pe9w.js → chunk-56krfj3b.js} +7 -7
  95. package/web/{chunk-ds7srg4p.js → chunk-5nda24gv.js} +1 -1
  96. package/web/{chunk-5hmfk69r.js → chunk-5shygfgb.js} +19 -19
  97. package/web/chunk-65nwc4cf.js +1 -0
  98. package/web/chunk-6bwgdvf6.js +1 -0
  99. package/web/chunk-6enn8p66.js +1 -0
  100. package/web/chunk-6stt9d18.js +1 -0
  101. package/web/{chunk-4gavbw65.js → chunk-7a3c137d.js} +1 -1
  102. package/web/chunk-7e47b1sn.js +1 -0
  103. package/web/chunk-7pypx5h8.js +2 -0
  104. package/web/chunk-7znyd1mj.js +39 -0
  105. package/web/{chunk-0z0jycs8.js → chunk-892nf39p.js} +7 -7
  106. package/web/chunk-8r0s8tx7.js +1 -0
  107. package/web/chunk-9dy7z3ej.js +2 -0
  108. package/web/chunk-9mq2cdtq.js +1 -0
  109. package/web/chunk-9w5tf22s.js +1 -0
  110. package/web/{chunk-es28k2t7.js → chunk-9xgspn75.js} +2 -2
  111. package/web/{chunk-0xc2c540.js → chunk-abhad4zj.js} +56 -56
  112. package/web/chunk-advfpyb9.js +140 -0
  113. package/web/chunk-affear07.js +3 -0
  114. package/web/chunk-ahztazsg.js +1 -0
  115. package/web/chunk-aqt7kc3s.js +106 -0
  116. package/web/chunk-b5hah4mf.js +1 -0
  117. package/web/chunk-b8tfetd8.js +1 -0
  118. package/web/{chunk-7yc083xj.js → chunk-bnb9xhgw.js} +15 -15
  119. package/web/{chunk-n1dmrz44.js → chunk-c01176kn.js} +2 -2
  120. package/web/chunk-c3nn0vvc.js +1 -0
  121. package/web/chunk-c53xmf48.js +30 -0
  122. package/web/chunk-ckgpy4r4.js +1 -0
  123. package/web/chunk-crzseqbx.js +24 -0
  124. package/web/chunk-d22wq71s.js +1 -0
  125. package/web/{chunk-97b62pvb.js → chunk-d60dpf69.js} +19 -19
  126. package/web/{chunk-sn9ecfvy.js → chunk-d6ddkh6e.js} +1 -1
  127. package/web/{chunk-cg3jterp.js → chunk-d9wdsjkk.js} +2 -2
  128. package/web/{chunk-ttg6tbwx.js → chunk-da7m1kva.js} +2 -2
  129. package/web/chunk-dbnrfxt1.js +8 -0
  130. package/web/chunk-ddxf8e84.js +1 -0
  131. package/web/chunk-dzg1pv80.js +200 -0
  132. package/web/{chunk-xnq41dgs.js → chunk-e8h45nyr.js} +1 -1
  133. package/web/chunk-ej9vb61c.js +1 -0
  134. package/web/chunk-f9k3xrwb.js +2 -0
  135. package/web/{chunk-7xk0ntav.js → chunk-fjag6yg8.js} +2 -2
  136. package/web/chunk-fnnrrzqa.js +78 -0
  137. package/web/{chunk-n90cqdvg.js → chunk-fv6vm14n.js} +2 -2
  138. package/web/{chunk-axkyft9f.js → chunk-g5jxwkdh.js} +1 -1
  139. package/web/{chunk-ep37qp12.js → chunk-g8kkc6vz.js} +1 -1
  140. package/web/chunk-g9sqbafw.js +2 -0
  141. package/web/{chunk-g46f421r.js → chunk-gcv91974.js} +4 -4
  142. package/web/{chunk-7qxhk1kz.js → chunk-gxqaa4sv.js} +7 -7
  143. package/web/chunk-gxsb5tx3.js +1 -0
  144. package/web/{chunk-54thej0t.js → chunk-gyp6v7jd.js} +2 -2
  145. package/web/chunk-h0c42zy3.js +1 -0
  146. package/web/chunk-h2ag4kvz.js +2 -0
  147. package/web/{chunk-eqsd8zta.js → chunk-h6gh63xj.js} +2 -2
  148. package/web/{chunk-6m69hczt.js → chunk-h6k1x096.js} +2 -2
  149. package/web/{chunk-24mfx6w1.js → chunk-j1bw5v1g.js} +2 -2
  150. package/web/chunk-j34q5jn6.js +1 -0
  151. package/web/{chunk-0pbjgdgp.js → chunk-ja7w629n.js} +2 -2
  152. package/web/{chunk-zbj1trar.js → chunk-jam45rqg.js} +2 -2
  153. package/web/{chunk-23c1df7e.js → chunk-jcdw85mv.js} +1 -1
  154. package/web/chunk-jfvxxp5c.js +1 -0
  155. package/web/chunk-jg6fmz2d.js +1 -0
  156. package/web/{chunk-90xqeczk.js → chunk-k67v6dyg.js} +40 -40
  157. package/web/chunk-ka7c5rhx.js +99 -0
  158. package/web/{chunk-acybsx44.js → chunk-kza0t0gj.js} +1 -1
  159. package/web/{chunk-7520nrbb.js → chunk-m8knte9z.js} +1 -1
  160. package/web/{chunk-v5cnt7c8.js → chunk-mnzramhc.js} +1 -1
  161. package/web/{chunk-7v5rxabp.js → chunk-mpfgr049.js} +1 -1
  162. package/web/chunk-mz1dabxh.js +1 -0
  163. package/web/chunk-mz9b5bsa.js +1 -0
  164. package/web/chunk-p53n0hwr.js +1 -0
  165. package/web/chunk-paywgcf7.js +40 -0
  166. package/web/chunk-pfcnr9tw.js +1 -0
  167. package/web/chunk-pyg1mr80.js +303 -0
  168. package/web/chunk-q7xkscc5.js +1 -0
  169. package/web/{chunk-xzp7jf7e.js → chunk-qcge7d6s.js} +2 -2
  170. package/web/chunk-qmbgb79a.js +1139 -0
  171. package/web/{chunk-5b2nw6j1.js → chunk-qq5gh5zr.js} +1 -1
  172. package/web/chunk-qrdh9j62.js +1 -0
  173. package/web/{chunk-w7snhcyg.js → chunk-s24qs1bn.js} +9 -9
  174. package/web/chunk-sd22cnjy.js +1 -0
  175. package/web/{chunk-ydtrc1ay.js → chunk-sd3cdqcm.js} +2 -2
  176. package/web/{chunk-rykfak98.js → chunk-sf101c23.js} +2 -2
  177. package/web/{chunk-p9hsd3rn.js → chunk-sfq6cw45.js} +2 -2
  178. package/web/chunk-svqj4az8.js +1 -0
  179. package/web/chunk-t7jwyvvr.js +1 -0
  180. package/web/{chunk-47q4hmfp.js → chunk-tcp77cp2.js} +2 -2
  181. package/web/chunk-tf18d2dk.css +1 -0
  182. package/web/chunk-thbqwq6b.js +1 -0
  183. package/web/chunk-v0g4cqc1.js +4 -0
  184. package/web/chunk-vhzys0rr.js +292 -0
  185. package/web/chunk-vnt34mkb.js +1 -0
  186. package/web/chunk-vqfz99ff.js +1 -0
  187. package/web/chunk-vttgyb5v.js +2 -0
  188. package/web/chunk-x7sb3bwf.js +370 -0
  189. package/web/chunk-xce8n339.js +1 -0
  190. package/web/{chunk-mb4qx9hy.js → chunk-xk1t58c4.js} +12 -12
  191. package/web/chunk-xsrvw7dt.js +4 -0
  192. package/web/chunk-xtss82z2.js +1 -0
  193. package/web/{chunk-2j4m0bh1.js → chunk-y7jq61nv.js} +2 -2
  194. package/web/{chunk-7ba8vrfc.js → chunk-ybw6vgf6.js} +2 -2
  195. package/web/{chunk-24h1rfje.js → chunk-yvgs6bm3.js} +4 -4
  196. package/web/{chunk-sb1cjpq8.js → chunk-z4aj066q.js} +1 -1
  197. package/web/chunk-zazs8p6c.js +1 -0
  198. package/web/{chunk-n8gfjj9a.js → chunk-zc1mk10n.js} +19 -19
  199. package/web/{chunk-5qqw2e0t.js → chunk-zqht0jzx.js} +6 -6
  200. package/web/{chunk-mwj9tpkz.js → chunk-zz397b0v.js} +12 -12
  201. package/web/index.html +1 -1
  202. package/worker.js +1 -1
  203. package/chunk-06hdzq5n.js +0 -2
  204. package/chunk-09rj27b2.js +0 -2
  205. package/chunk-1zdwrgd4.js +0 -2
  206. package/chunk-5c9j8qe4.js +0 -478
  207. package/chunk-9mmz6wt3.js +0 -2
  208. package/chunk-bpw6q7g0.js +0 -3
  209. package/chunk-bxn5kmpz.js +0 -3753
  210. package/chunk-n6e43rvk.js +0 -3
  211. package/chunk-pmqtkqsf.js +0 -2
  212. package/chunk-ry0z4ev6.js +0 -2
  213. package/chunk-v258nxcz.js +0 -2
  214. package/chunk-zmsgwr3s.js +0 -2
  215. package/web/chunk-0s80zw00.js +0 -1
  216. package/web/chunk-166qe5j6.js +0 -2
  217. package/web/chunk-1c95wfvq.js +0 -1
  218. package/web/chunk-329rtxa9.js +0 -1
  219. package/web/chunk-33qwz9bc.js +0 -2
  220. package/web/chunk-3qjnwsph.js +0 -1
  221. package/web/chunk-4rm1vy7w.js +0 -1
  222. package/web/chunk-59kqahb3.js +0 -1
  223. package/web/chunk-61jahh35.js +0 -292
  224. package/web/chunk-6beqrmtq.js +0 -1
  225. package/web/chunk-6gxf3vsg.js +0 -1
  226. package/web/chunk-6parf7sy.js +0 -2
  227. package/web/chunk-89fkdgbp.js +0 -2
  228. package/web/chunk-8qgpfxkz.js +0 -1
  229. package/web/chunk-9a3q0jsh.js +0 -36
  230. package/web/chunk-9bgey148.js +0 -169
  231. package/web/chunk-9xh96b33.js +0 -2
  232. package/web/chunk-a5sg33w2.js +0 -3
  233. package/web/chunk-a91vxtx4.js +0 -1
  234. package/web/chunk-agec7jj4.js +0 -1
  235. package/web/chunk-c516cghj.js +0 -1
  236. package/web/chunk-cqp1d4p0.js +0 -1
  237. package/web/chunk-cwtdnacf.js +0 -1
  238. package/web/chunk-dg1vas6z.js +0 -8
  239. package/web/chunk-dy2gm1fs.js +0 -1
  240. package/web/chunk-f91wzwtk.js +0 -1
  241. package/web/chunk-fc0nx23g.js +0 -1
  242. package/web/chunk-fhnypcrm.js +0 -1139
  243. package/web/chunk-fv60p68p.js +0 -1
  244. package/web/chunk-g1ev11wx.js +0 -1
  245. package/web/chunk-h18tnrf2.js +0 -1
  246. package/web/chunk-hfaffkrh.js +0 -1
  247. package/web/chunk-hszjc2ny.js +0 -70
  248. package/web/chunk-j2vt8c8v.js +0 -1
  249. package/web/chunk-jqa39f8t.js +0 -78
  250. package/web/chunk-jvbbrnpa.js +0 -1
  251. package/web/chunk-jzfd7cyh.js +0 -2
  252. package/web/chunk-ka3q31t1.js +0 -1
  253. package/web/chunk-ka9ak8wr.js +0 -1
  254. package/web/chunk-m2d1sp30.js +0 -1
  255. package/web/chunk-mnjd59jk.js +0 -1
  256. package/web/chunk-ng0nbfhh.js +0 -1
  257. package/web/chunk-nz9nxk48.js +0 -1
  258. package/web/chunk-phw908hn.js +0 -1
  259. package/web/chunk-pjmmma1k.js +0 -1
  260. package/web/chunk-pxe3vna4.js +0 -1
  261. package/web/chunk-q7yn4m3t.js +0 -1
  262. package/web/chunk-qh15dxav.css +0 -1
  263. package/web/chunk-qnhqexe0.js +0 -1
  264. package/web/chunk-rcx1aee5.js +0 -99
  265. package/web/chunk-rjqj6ffe.js +0 -1
  266. package/web/chunk-rks7ksv3.js +0 -106
  267. package/web/chunk-rtf2zzzv.js +0 -1
  268. package/web/chunk-sgvp8vge.js +0 -1
  269. package/web/chunk-sjjwte12.js +0 -1
  270. package/web/chunk-srrfphes.js +0 -1
  271. package/web/chunk-t7bwsdbr.js +0 -1
  272. package/web/chunk-tse9gvyq.js +0 -89
  273. package/web/chunk-vd6y2pcm.js +0 -39
  274. package/web/chunk-vpa55vje.js +0 -4
  275. package/web/chunk-vymqrpm3.js +0 -303
  276. package/web/chunk-wdtnhpd6.js +0 -4
  277. package/web/chunk-wmvd6j0b.js +0 -200
  278. package/web/chunk-xvsmtetz.js +0 -30
  279. package/web/chunk-y3ajqthy.js +0 -370
  280. package/web/chunk-yd1ez3wd.js +0 -2
  281. package/web/chunk-yfbxtg5p.js +0 -1
  282. package/web/chunk-ywp4s71k.js +0 -40
  283. package/web/chunk-z4x331rx.js +0 -140
  284. package/web/chunk-z6bpamwq.js +0 -24
  285. package/web/chunk-zmdnxn6m.js +0 -2
  286. package/web/install.ps1 +0 -91
  287. package/web/install.sh +0 -177
@@ -1,106 +0,0 @@
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
- ${i-l/2-H/2},${k+z}
3
- ${i-l/2-H/2},${k-z}
4
- ${o.posWithOffset-l/2-H},${k-h-z}
5
- ${o.posWithOffset+l/2+H},${k-h-z}
6
- ${o.posWithOffset+l/2+H},${k+h+z}
7
- ${o.posWithOffset-l/2-H},${k+h+z}`),x.attr("cy",k).attr("cx",i-l/2+H/2).attr("r",1.5).attr("class","tag-hole"),B==="TB"||B==="BT"){let w=i+f;u.attr("class","tag-label-bkg").attr("points",`
8
- ${o.x},${w+2}
9
- ${o.x},${w-2}
10
- ${o.x+j},${w-h-2}
11
- ${o.x+j+l+4},${w-h-2}
12
- ${o.x+j+l+4},${w+h+2}
13
- ${o.x+j},${w+h+2}`).attr("transform","translate(12,12) rotate(45, "+o.x+","+i+")"),x.attr("cx",o.x+H/2).attr("cy",w).attr("transform","translate(12,12) rotate(45, "+o.x+","+i+")"),g.attr("x",o.x+5).attr("y",w+3).attr("transform","translate(14,14) rotate(45, "+o.x+","+i+")")}}}},"drawCommitTags"),st=e((t)=>{switch(t.customType??t.type){case v.NORMAL:return"commit-normal";case v.REVERSE:return"commit-reverse";case v.HIGHLIGHT:return"commit-highlight";case v.MERGE:return"commit-merge";case v.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),nt=e((t,a,o,i)=>{let d={x:0,y:0};if(t.parents.length>0){let l=we(t.parents);if(l){let c=i.get(l)??d;if(a==="TB")return c.y+K;else if(a==="BT")return(i.get(t.id)??d).y-K;else return c.x+K}}else if(a==="TB")return oe;else if(a==="BT")return(i.get(t.id)??d).y-K;else return 0;return 0},"calculatePosition"),ct=e((t,a,o)=>{let i=B==="BT"&&o?a:a+j,d=_.get(t.branch)?.pos,l=B==="TB"||B==="BT"?_.get(t.branch)?.pos:i;if(l===void 0||d===void 0)throw Error(`Position were undefined for commit ${t.id}`);let c=ce.has(s().theme??""),n=B==="TB"||B==="BT"?i:d+(c?le/2+1:-2);return{x:l,y:n,posWithOffset:i}},"getCommitPosition"),$e=e((t,a,o,i)=>{let d=t.append("g").attr("class","commit-bullets"),l=t.append("g").attr("class","commit-labels"),c=B==="TB"||B==="BT"?oe:0,n=[...a.keys()],g=i.parallelCommits??!1,x=e((f,h)=>{let k=a.get(f)?.seq,w=a.get(h)?.seq;return k!==void 0&&w!==void 0?k-w:0},"sortKeys"),u=n.sort(x);if(B==="BT"){if(g)Xe(u,a,c);u=u.reverse()}u.forEach((f)=>{let h=a.get(f);if(!h)throw Error(`Commit not found for key ${f}`);if(g)c=nt(h,B,c,G);let k=ct(h,c,g);if(o){let w=st(h),M=h.customType??h.type,P=_.get(h.branch)?.index??0;rt(d,h,k,w,P,M),at(l,h,k,c,i),ot(l,h,k,c)}if(B==="TB"||B==="BT")G.set(h.id,{x:k.x,y:k.posWithOffset});else G.set(h.id,{x:k.posWithOffset,y:k.y});if(c=B==="BT"&&g?c+K:c+K+j,c>Y)Y=c})},"drawCommits"),it=e((t,a,o,i,d)=>{let c=(B==="TB"||B==="BT"?o.x<i.x:o.y<i.y)?a.branch:t.branch,n=e((x)=>x.branch===c,"isOnBranchToGetCurve"),g=e((x)=>x.seq>t.seq&&x.seq<a.seq,"isBetweenCommits");return[...d.values()].some((x)=>g(x)&&n(x))},"shouldRerouteArrow"),re=e((t,a,o=0)=>{let i=t+Math.abs(t-a)/2;if(o>5)return i;if(se.every((c)=>Math.abs(c-i)>=10))return se.push(i),i;let l=Math.abs(t-a);return re(t,a-l/5,o+1)},"findLane"),dt=e((t,a,o,i)=>{let{theme:d}=s(),l=ge.has(d??""),c=G.get(a.id),n=G.get(o.id);if(c===void 0||n===void 0)throw Error(`Commit positions not found for commits ${a.id} and ${o.id}`);let g=it(a,o,c,n,i),x="",u="",f=0,h=0,k=_.get(o.branch)?.index;if(o.type===v.MERGE&&a.id!==o.parents[0])k=_.get(a.branch)?.index;let w;if(g){x="A 10 10, 0, 0, 0,",u="A 10 10, 0, 0, 1,",f=10,h=10;let M=c.y<n.y?re(c.y,n.y):re(n.y,c.y),P=c.x<n.x?re(c.x,n.x):re(n.x,c.x);if(B==="TB")if(c.x<n.x)w=`M ${c.x} ${c.y} L ${P-f} ${c.y} ${u} ${P} ${c.y+h} L ${P} ${n.y-f} ${x} ${P+h} ${n.y} L ${n.x} ${n.y}`;else k=_.get(a.branch)?.index,w=`M ${c.x} ${c.y} L ${P+f} ${c.y} ${x} ${P} ${c.y+h} L ${P} ${n.y-f} ${u} ${P-h} ${n.y} L ${n.x} ${n.y}`;else if(B==="BT")if(c.x<n.x)w=`M ${c.x} ${c.y} L ${P-f} ${c.y} ${x} ${P} ${c.y-h} L ${P} ${n.y+f} ${u} ${P+h} ${n.y} L ${n.x} ${n.y}`;else k=_.get(a.branch)?.index,w=`M ${c.x} ${c.y} L ${P+f} ${c.y} ${u} ${P} ${c.y-h} L ${P} ${n.y+f} ${x} ${P-h} ${n.y} L ${n.x} ${n.y}`;else if(c.y<n.y)w=`M ${c.x} ${c.y} L ${c.x} ${M-f} ${x} ${c.x+h} ${M} L ${n.x-f} ${M} ${u} ${n.x} ${M+h} L ${n.x} ${n.y}`;else k=_.get(a.branch)?.index,w=`M ${c.x} ${c.y} L ${c.x} ${M+f} ${u} ${c.x+h} ${M} L ${n.x-f} ${M} ${x} ${n.x} ${M-h} L ${n.x} ${n.y}`}else if(x="A 20 20, 0, 0, 0,",u="A 20 20, 0, 0, 1,",f=20,h=20,B==="TB"){if(c.x<n.x)if(o.type===v.MERGE&&a.id!==o.parents[0])w=`M ${c.x} ${c.y} L ${c.x} ${n.y-f} ${x} ${c.x+h} ${n.y} L ${n.x} ${n.y}`;else w=`M ${c.x} ${c.y} L ${n.x-f} ${c.y} ${u} ${n.x} ${c.y+h} L ${n.x} ${n.y}`;if(c.x>n.x)if(x="A 20 20, 0, 0, 0,",u="A 20 20, 0, 0, 1,",f=20,h=20,o.type===v.MERGE&&a.id!==o.parents[0])w=`M ${c.x} ${c.y} L ${c.x} ${n.y-f} ${u} ${c.x-h} ${n.y} L ${n.x} ${n.y}`;else w=`M ${c.x} ${c.y} L ${n.x+f} ${c.y} ${x} ${n.x} ${c.y+h} L ${n.x} ${n.y}`;if(c.x===n.x)w=`M ${c.x} ${c.y} L ${n.x} ${n.y}`}else if(B==="BT"){if(c.x<n.x)if(o.type===v.MERGE&&a.id!==o.parents[0])w=`M ${c.x} ${c.y} L ${c.x} ${n.y+f} ${u} ${c.x+h} ${n.y} L ${n.x} ${n.y}`;else w=`M ${c.x} ${c.y} L ${n.x-f} ${c.y} ${x} ${n.x} ${c.y-h} L ${n.x} ${n.y}`;if(c.x>n.x)if(x="A 20 20, 0, 0, 0,",u="A 20 20, 0, 0, 1,",f=20,h=20,o.type===v.MERGE&&a.id!==o.parents[0])w=`M ${c.x} ${c.y} L ${c.x} ${n.y+f} ${x} ${c.x-h} ${n.y} L ${n.x} ${n.y}`;else w=`M ${c.x} ${c.y} L ${n.x+f} ${c.y} ${u} ${n.x} ${c.y-h} L ${n.x} ${n.y}`;if(c.x===n.x)w=`M ${c.x} ${c.y} L ${n.x} ${n.y}`}else{if(c.y<n.y)if(o.type===v.MERGE&&a.id!==o.parents[0])w=`M ${c.x} ${c.y} L ${n.x-f} ${c.y} ${u} ${n.x} ${c.y+h} L ${n.x} ${n.y}`;else w=`M ${c.x} ${c.y} L ${c.x} ${n.y-f} ${x} ${c.x+h} ${n.y} L ${n.x} ${n.y}`;if(c.y>n.y)if(o.type===v.MERGE&&a.id!==o.parents[0])w=`M ${c.x} ${c.y} L ${n.x-f} ${c.y} ${x} ${n.x} ${c.y-h} L ${n.x} ${n.y}`;else w=`M ${c.x} ${c.y} L ${c.x} ${n.y+f} ${u} ${c.x+h} ${n.y} L ${n.x} ${n.y}`;if(c.y===n.y)w=`M ${c.x} ${c.y} L ${n.x} ${n.y}`}if(w===void 0)throw Error("Line definition not found");t.append("path").attr("d",w).attr("class","arrow arrow"+Z(k,V,l))},"drawArrow"),ht=e((t,a)=>{let o=t.append("g").attr("class","commit-arrows");[...a.keys()].forEach((i)=>{let d=a.get(i);if(d.parents&&d.parents.length>0)d.parents.forEach((l)=>{dt(o,a.get(l),d,a)})})},"drawArrows"),lt=e((t,a,o,i)=>{let{look:d,theme:l,themeVariables:c}=s(),{dropShadow:n,THEME_COLOR_LIMIT:g}=c,x=ce.has(l??""),u=ge.has(l??""),f=t.append("g");a.forEach((h,k)=>{let w=Z(k,x?g:V,u),M=_.get(h.name)?.pos;if(M===void 0)throw Error(`Position not found for branch ${h.name}`);let P=B==="TB"||B==="BT"?M:x?M+le/2+1:M-2,R=f.append("line");if(R.attr("x1",0),R.attr("y1",P),R.attr("x2",Y),R.attr("y2",P),R.attr("class","branch branch"+w),B==="TB")R.attr("y1",oe),R.attr("x1",M),R.attr("y2",Y),R.attr("x2",M);else if(B==="BT")R.attr("y1",Y),R.attr("x1",M),R.attr("y2",oe),R.attr("x2",M);se.push(P);let ie=h.name,ee=be(ie),q=f.insert("rect"),F=f.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+w);F.node().appendChild(ee);let O=ee.getBBox(),fe=x?0:4,ae=x?16:0,Q=x?le:0;if(d==="neo")q.attr("data-look","neo");if(q.attr("class","branchLabelBkg label"+w).attr("style",d==="neo"?`filter:${x?`url(#${i}-drop-shadow)`:n}`:"").attr("rx",fe).attr("ry",fe).attr("x",-O.width-4-(o.rotateCommitLabel===!0?30:0)).attr("y",-O.height/2+10).attr("width",O.width+18+ae).attr("height",O.height+4+Q),F.attr("transform","translate("+(-O.width-14-(o.rotateCommitLabel===!0?30:0)+ae/2)+", "+(P-O.height/2-2)+")"),B==="TB"){if(q.attr("x",M-O.width/2-10).attr("y",0),F.attr("transform","translate("+(M-O.width/2-5)+", 0)"),x)q.attr("transform",`translate(${-ae/2-3}, ${-Q-10})`),F.attr("transform","translate("+(M-O.width/2-5)+", "+(-Q*2+7)+")")}else if(B==="BT"){if(q.attr("x",M-O.width/2-10).attr("y",Y),F.attr("transform","translate("+(M-O.width/2-5)+", "+Y+")"),x)q.attr("transform",`translate(${-ae/2-3}, ${Q+10})`),F.attr("transform","translate("+(M-O.width/2-5)+", "+(Y+Q*2+4)+")")}else q.attr("transform","translate(-19, "+(P-12-Q/2)+")")})},"drawBranches"),mt=e(function(t,a,o,i,d){return _.set(t,{pos:a,index:o}),a+=50+(d?40:0)+(B==="TB"||B==="BT"?i.width/2:0),a},"setBranchPosition"),gt=e(function(t,a,o,i){Ve(),r.debug("in gitgraph renderer",t+`
14
- `,"id:",a,o);let d=i.db;if(!d.getConfig){r.error("getConfig method is not available on db");return}let l=d.getConfig(),c=l.rotateCommitLabel??!1;te=d.getCommits();let n=d.getBranchesAsObjArray();B=d.getDirection();let g=p(`[id="${a}"]`),{look:x,theme:u,themeVariables:f}=s(),{useGradient:h,gradientStart:k,gradientStop:w,filterColor:M}=f;if(h){let R=g.append("defs").append("linearGradient").attr("id",a+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");R.append("stop").attr("offset","0%").attr("stop-color",k).attr("stop-opacity",1),R.append("stop").attr("offset","100%").attr("stop-color",w).attr("stop-opacity",1)}if(x==="neo"&&ce.has(u??""))g.append("defs").append("filter").attr("id",a+"-drop-shadow").attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",M);let P=0;if(n.forEach((R,ie)=>{let ee=be(R.name),q=g.append("g"),de=q.insert("g").attr("class","branchLabel"),F=de.insert("g").attr("class","label branch-label");F.node()?.appendChild(ee);let O=ee.getBBox();P=mt(R.name,P,ie,O,c),F.remove(),de.remove(),q.remove()}),$e(g,te,!1,l),l.showBranches)lt(g,n,l,a);ht(g,te),$e(g,te,!0,l),N.insertTitle(g,"gitTitleText",l.titleTopMargin??0,d.getDiagramTitle()),wr(void 0,g,l.diagramPadding,l.useMaxWidth)},"draw"),ft={draw:gt},Be=8,ke=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),$t=new Set(["redux-color","redux-dark-color"]),pt=new Set(["neo","neo-dark"]),yt=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),xt=new Set(["redux","redux-dark","redux-color","redux-dark-color","neo","neo-dark"]),ut=e((t)=>{let{svgId:a}=t,o="";if(t.useGradient&&a)for(let i=0;i<t.THEME_COLOR_LIMIT;i++)o+=`
15
- .label${i} { fill: ${t.mainBkg}; stroke: url(${a}-gradient); stroke-width: ${t.strokeWidth};}
16
- `;return o},"genGitGraphGradient"),bt=e((t)=>{let a=b(),{theme:o,themeVariables:i}=a,{borderColorArray:d}=i,l=ke.has(o);if(pt.has(o)){let c="";for(let n=0;n<t.THEME_COLOR_LIMIT;n++)if(n===0)c+=`
17
- .branch-label${n} { fill: ${t.nodeBorder};}
18
- .commit${n} { stroke: ${t.nodeBorder}; }
19
- .commit-highlight${n} { stroke: ${t.nodeBorder}; fill: ${t.nodeBorder}; }
20
- .arrow${n} { stroke: ${t.nodeBorder}; }
21
- .commit-bullets { fill: ${t.nodeBorder}; }
22
- .commit-cherry-pick${n} { stroke: ${t.nodeBorder}; }
23
- ${ut(t)}`;else{let g=n%Be;c+=`
24
- .branch-label${n} { fill: ${t["gitBranchLabel"+g]}; }
25
- .commit${n} { stroke: ${t["git"+g]}; fill: ${t["git"+g]}; }
26
- .commit-highlight${n} { stroke: ${t["gitInv"+g]}; fill: ${t["gitInv"+g]}; }
27
- .arrow${n} { stroke: ${t["git"+g]}; }
28
- `}return c}else if(!$t.has(o)){let c="";for(let n=0;n<t.THEME_COLOR_LIMIT;n++)c+=`
29
- .branch-label${n} { fill: ${t.nodeBorder}; ${l?`font-weight:${t.noteFontWeight}`:""} }
30
- .commit${n} { stroke: ${t.nodeBorder}; }
31
- .commit-highlight${n} { stroke: ${t.nodeBorder}; fill: ${t.nodeBorder}; }
32
- .label${n} { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: ${t.strokeWidth}; ${l?`font-weight:${t.noteFontWeight}`:""}}
33
- .arrow${n} { stroke: ${t.nodeBorder}; }
34
- .commit-bullets { fill: ${t.nodeBorder}; }
35
- .commit-cherry-pick${n} { stroke: ${t.nodeBorder}; }
36
- `;return c}else{let c="";for(let n=0;n<t.THEME_COLOR_LIMIT;n++)if(n===0)c+=`
37
- .branch-label${n} { fill: ${t.nodeBorder}; ${l?`font-weight:${t.noteFontWeight}`:""} }
38
- .commit${n} { stroke: ${t.nodeBorder}; }
39
- .commit-highlight${n} { stroke: ${t.nodeBorder}; fill: ${t.mainBkg}; }
40
- .label${n} { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: ${t.strokeWidth}; ${l?`font-weight:${t.noteFontWeight}`:""} }
41
- .arrow${n} { stroke: ${t.nodeBorder}; }
42
- .commit-bullets { fill: ${t.nodeBorder}; }
43
- `;else{let g=n%d.length;c+=`
44
- .branch-label${n} { fill: ${t.nodeBorder}; ${l?`font-weight:${t.noteFontWeight}`:""} }
45
- .commit${n} { stroke: ${d[g]}; fill: ${d[g]}; }
46
- .commit-highlight${n} { stroke: ${d[g]}; fill: ${d[g]}; }
47
- .label${n} { fill: ${yt.has(o)?t.mainBkg:d[g]}; stroke: ${d[g]}; stroke-width: ${t.strokeWidth}; }
48
- .arrow${n} { stroke: ${d[g]}; }
49
- `}return c}},"genColor"),wt=e((t)=>`${Array.from({length:t.THEME_COLOR_LIMIT},(a,o)=>o).map((a)=>{let o=a%Be;return`
50
- .branch-label${a} { fill: ${t["gitBranchLabel"+o]}; }
51
- .commit${a} { stroke: ${t["git"+o]}; fill: ${t["git"+o]}; }
52
- .commit-highlight${a} { stroke: ${t["gitInv"+o]}; fill: ${t["gitInv"+o]}; }
53
- .label${a} { fill: ${t["git"+o]}; }
54
- .arrow${a} { stroke: ${t["git"+o]}; }
55
- `}).join(`
56
- `)}`,"normalTheme"),Bt=e((t)=>{let a=b(),{theme:o}=a,i=xt.has(o);return`
57
- .commit-id,
58
- .commit-msg,
59
- .branch-label {
60
- fill: lightgrey;
61
- color: lightgrey;
62
- font-family: 'trebuchet ms', verdana, arial, sans-serif;
63
- font-family: var(--mermaid-font-family);
64
- }
65
-
66
- ${i?bt(t):wt(t)}
67
-
68
- .branch {
69
- stroke-width: ${t.strokeWidth};
70
- stroke: ${t.commitLineColor??t.lineColor};
71
- stroke-dasharray: ${i?"4 2":"2"};
72
- }
73
- .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${i?t.nodeBorder:t.commitLabelColor}; ${i?`font-weight:${t.noteFontWeight};`:""}}
74
- .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${i?"transparent":t.commitLabelBackground}; opacity: ${i?"":0.5}; }
75
- .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
76
- .tag-label-bkg { fill: ${i?t.mainBkg:t.tagLabelBackground}; stroke: ${i?t.nodeBorder:t.tagLabelBorder}; ${i?`filter:${t.dropShadow}`:""} }
77
- .tag-hole { fill: ${t.textColor}; }
78
-
79
- .commit-merge {
80
- stroke: ${i?t.mainBkg:t.primaryColor};
81
- fill: ${i?t.mainBkg:t.primaryColor};
82
- }
83
- .commit-reverse {
84
- stroke: ${i?t.mainBkg:t.primaryColor};
85
- fill: ${i?t.mainBkg:t.primaryColor};
86
- stroke-width: ${i?t.strokeWidth:3};
87
- }
88
- .commit-highlight-outer {
89
- }
90
- .commit-highlight-inner {
91
- stroke: ${i?t.mainBkg:t.primaryColor};
92
- fill: ${i?t.mainBkg:t.primaryColor};
93
- }
94
-
95
- .arrow {
96
- /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
97
- stroke-width: ${ke.has(o)?t.strokeWidth:8};
98
- stroke-linecap: round;
99
- fill: none
100
- }
101
- .gitTitleText {
102
- text-anchor: middle;
103
- font-size: 18px;
104
- fill: ${t.textColor};
105
- }
106
- `},"getStyles"),kt=Bt,Ot={parser:Ke,db:ue,renderer:ft,styles:kt};export{Ot as diagram};
@@ -1 +0,0 @@
1
- import{ai}from"./chunk-rykfak98.js";export{ai as default};
@@ -1 +0,0 @@
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};
@@ -1 +0,0 @@
1
- import{wo}from"./chunk-fhnypcrm.js";export{wo as QuestionDock};
@@ -1 +0,0 @@
1
- import{di}from"./chunk-24mfx6w1.js";export{di as default};
@@ -1 +0,0 @@
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,89 +0,0 @@
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
- .railroad-diagram {
4
- font-family: ${a};
5
- font-size: ${l}px;
6
- }
7
-
8
- .railroad-terminal rect {
9
- fill: ${n};
10
- stroke: ${i};
11
- stroke-width: ${p}px;
12
- }
13
-
14
- .railroad-terminal text {
15
- fill: ${o};
16
- font-family: ${a};
17
- font-size: ${l}px;
18
- text-anchor: middle;
19
- dominant-baseline: middle;
20
- }
21
-
22
- .railroad-nonterminal rect {
23
- fill: ${g};
24
- stroke: ${m};
25
- stroke-width: ${p}px;
26
- }
27
-
28
- .railroad-nonterminal text {
29
- fill: ${d};
30
- font-family: ${a};
31
- font-size: ${l}px;
32
- text-anchor: middle;
33
- dominant-baseline: middle;
34
- }
35
-
36
- .railroad-line {
37
- stroke: ${f};
38
- stroke-width: ${p}px;
39
- fill: none;
40
- }
41
-
42
- .railroad-start circle,
43
- .railroad-end circle {
44
- fill: ${h};
45
- }
46
-
47
- .railroad-comment ellipse {
48
- fill: ${k};
49
- stroke: ${c};
50
- stroke-width: ${p}px;
51
- }
52
-
53
- .railroad-comment text {
54
- fill: ${x};
55
- font-style: italic;
56
- font-family: ${a};
57
- font-size: ${l}px;
58
- text-anchor: middle;
59
- dominant-baseline: middle;
60
- }
61
-
62
- .railroad-special rect {
63
- fill: ${z};
64
- stroke: ${F};
65
- stroke-width: ${p}px;
66
- stroke-dasharray: 5,3;
67
- }
68
-
69
- .railroad-special text {
70
- fill: ${d};
71
- font-family: ${a};
72
- font-size: ${l}px;
73
- text-anchor: middle;
74
- dominant-baseline: middle;
75
- }
76
-
77
- .railroad-rule-name {
78
- font-weight: bold;
79
- fill: ${v};
80
- font-family: ${a};
81
- font-size: ${l}px;
82
- }
83
-
84
- .railroad-group {
85
- /* Grouping container, no specific styles */
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,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};
@@ -1,39 +0,0 @@
1
- import{W}from"./chunk-89fkdgbp.js";import{e,r,D,B,C,S,E,T,A,I,L,s,J,Un,Gr,V,Ge,U}from"./chunk-vymqrpm3.js";import{X}from"./chunk-n8gfjj9a.js";import{bt}from"./chunk-6parf7sy.js";import{Xe}from"./chunk-n8sky2q6.js";function at(t,o){return o<t?-1:o>t?1:o>=t?0:NaN}function nt(t){return t}function it(){var t=nt,o=at,k=null,H=J(0),g=J(Un),h=J(0);function l(a){var i,u=(a=Gr(a)).length,m,z,O=0,v=Array(u),c=Array(u),F=+H.apply(this,arguments),_=Math.min(Un,Math.max(-Un,g.apply(this,arguments)-F)),N,Z=Math.min(Math.abs(_)/u,h.apply(this,arguments)),p=Z*(_<0?-1:1),M;for(i=0;i<u;++i)if((M=c[v[i]=i]=+t(a[i],i,a))>0)O+=M;if(o!=null)v.sort(function(G,x){return o(c[G],c[x])});else if(k!=null)v.sort(function(G,x){return k(a[G],a[x])});for(i=0,z=O?(_-u*p)/O:0;i<u;++i,F=N)m=v[i],M=c[m],N=F+(M>0?M*z:0)+p,c[m]={data:a[m],index:i,value:M,startAngle:F,endAngle:N,padAngle:Z};return c}return l.value=function(a){return arguments.length?(t=typeof a==="function"?a:J(+a),l):t},l.sortValues=function(a){return arguments.length?(o=a,k=null,l):o},l.sort=function(a){return arguments.length?(k=a,o=null,l):k},l.startAngle=function(a){return arguments.length?(H=typeof a==="function"?a:J(+a),l):H},l.endAngle=function(a){return arguments.length?(g=typeof a==="function"?a:J(+a),l):g},l.padAngle=function(a){return arguments.length?(h=typeof a==="function"?a:J(+a),l):h},l}var dt=D.pie,ot={sections:new Map,showData:!1,config:dt},{sections:Q,showData:lt}=ot,St=structuredClone(dt),yt=e(()=>structuredClone(St),"getConfig"),wt=e(()=>{Q=new Map,lt=ot.showData,C()},"clear"),At=e(({label:t,value:o})=>{if(o<0)throw Error(`"${t}" has invalid value: ${o}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);if(!Q.has(t))Q.set(t,o),r.debug(`added new section: ${t}, with value: ${o}`)},"addSection"),Ct=e(()=>Q,"getSections"),$t=e((t)=>{lt=t},"setShowData"),Dt=e(()=>lt,"getShowData"),pt={getConfig:yt,clear:wt,setDiagramTitle:I,getDiagramTitle:L,setAccTitle:S,getAccTitle:E,setAccDescription:T,getAccDescription:A,addSection:At,getSections:Ct,setShowData:$t,getShowData:Dt},Tt=e((t,o)=>{W(t,o),o.setShowData(t.showData),t.sections.map(o.addSection)},"populateDb"),kt={parse:e(async(t)=>{let o=await X("pie",t);r.debug(o),Tt(o,pt)},"parse")},zt=e((t)=>`
2
- .pieCircle{
3
- stroke: ${t.pieStrokeColor};
4
- stroke-width : ${t.pieStrokeWidth};
5
- opacity : ${t.pieOpacity};
6
- }
7
- .pieCircle.highlighted{
8
- scale: 1.05;
9
- opacity: 1;
10
- }
11
- .pieCircle.highlightedOnHover:hover{
12
- transition-duration: 250ms;
13
- scale: 1.05;
14
- opacity: 1;
15
- }
16
- .pieOuterCircle{
17
- stroke: ${t.pieOuterStrokeColor};
18
- stroke-width: ${t.pieOuterStrokeWidth};
19
- fill: none;
20
- }
21
- .pieTitleText {
22
- text-anchor: middle;
23
- font-size: ${t.pieTitleTextSize};
24
- fill: ${t.pieTitleTextColor};
25
- font-family: ${t.fontFamily};
26
- }
27
- .slice {
28
- font-family: ${t.fontFamily};
29
- fill: ${t.pieSectionTextColor};
30
- font-size:${t.pieSectionTextSize};
31
- // fill: white;
32
- }
33
- .legend text {
34
- fill: ${t.pieLegendTextColor};
35
- font-family: ${t.fontFamily};
36
- font-size: ${t.pieLegendTextSize};
37
- }
38
- `,"getStyles"),Et=zt,Mt=e((t)=>{let o=[...t.values()].reduce((g,h)=>g+h,0),k=[...t.entries()].map(([g,h])=>({label:g,value:h})).filter((g)=>g.value/o*100>=1);return it().value((g)=>g.value).sort(null)(k)},"createPieArcs"),Rt=e((t,o,k,H)=>{r.debug(`rendering pie chart
39
- `+t);let g=H.db,h=s(),l=U(g.getConfig(),h.pie),a=40,i=18,u=4,m=450,z=m,O=V(o),v=O.append("g");v.attr("transform","translate("+z/2+","+m/2+")");let{themeVariables:c}=h,[F]=Ge(c.pieOuterStrokeWidth);F??=2;let{legendPosition:_,textPosition:N}=l,Z=l.donutHole>0&&l.donutHole<=0.9?l.donutHole:0,p=Math.min(z,m)/2-a,M=bt().innerRadius(Z*p).outerRadius(p),G=bt().innerRadius(p*N).outerRadius(p*N),x=v.append("g");x.append("circle").attr("cx",0).attr("cy",0).attr("r",p+F/2).attr("class","pieOuterCircle");let q=g.getSections(),ft=Mt(q),ht=[c.pie1,c.pie2,c.pie3,c.pie4,c.pie5,c.pie6,c.pie7,c.pie8,c.pie9,c.pie10,c.pie11,c.pie12],Y=0;q.forEach((n)=>{Y+=n});let st=ft.filter((n)=>(n.data.value/Y*100).toFixed(0)!=="0"),tt=Xe(ht).domain([...q.keys()]);x.selectAll("mySlices").data(st).enter().append("path").attr("d",M).attr("fill",(n)=>tt(n.data.label)).attr("class",(n)=>{let d="pieCircle";if(l.highlightSlice==="hover")d+=" highlightedOnHover";else if(l.highlightSlice===n.data.label)d+=" highlighted";return d}),x.selectAll("mySlices").data(st).enter().append("text").text((n)=>(n.data.value/Y*100).toFixed(0)+"%").attr("transform",(n)=>"translate("+G.centroid(n)+")").style("text-anchor","middle").attr("class","slice");let mt=v.append("text").text(g.getDiagramTitle()).attr("x",0).attr("y",-(m-50)/2).attr("class","pieTitleText"),j=[...q.entries()].map(([n,d])=>({label:n,value:d})),R=v.selectAll(".legend").data(j).enter().append("g").attr("class","legend");R.append("rect").attr("width",i).attr("height",i).style("fill",(n)=>tt(n.label)).style("stroke",(n)=>tt(n.label)),R.append("text").attr("x",i+u).attr("y",i-u).text((n)=>{if(g.getShowData())return`${n.label} [${n.value}]`;return n.label});let P=Math.max(...R.selectAll("text").nodes().map((n)=>n?.getBoundingClientRect().width??0)),K=m,et=z+a,f=i+u,rt=j.length*f;switch(_){case"center":R.attr("transform",(n,d)=>{let y=f*j.length/2,w=-P/2-(i+u),b=d*f-y;return"translate("+w+","+b+")"});break;case"top":K+=rt,R.attr("transform",(n,d)=>{let y=p,w=-P/2-(i+u),b=d*f-y;return`translate(${w}, ${b})`}),x.attr("transform",()=>`translate(0, ${rt+f})`);break;case"bottom":K+=rt,R.attr("transform",(n,d)=>{let y=-p-f,w=-P/2-(i+u),b=d*f-y;return"translate("+w+","+b+")"});break;case"left":et+=i+u+P,R.attr("transform",(n,d)=>{let y=f*j.length/2,w=-p-(i+u),b=d*f-y;return"translate("+w+","+b+")"}),x.attr("transform",()=>`translate(${P+i+u}, 0)`);break;case"right":default:et+=i+u+P,R.attr("transform",(n,d)=>{let y=f*j.length/2,w=12*i,b=d*f-y;return"translate("+w+","+b+")"});break}let ct=mt.node()?.getBoundingClientRect().width??0,vt=z/2-ct/2,xt=z/2+ct/2,ut=Math.min(0,vt),gt=Math.max(et,xt)-ut;O.attr("viewBox",`${ut} 0 ${gt} ${K}`),B(O,K,gt,l.useMaxWidth)},"draw"),Lt={draw:Rt},Kt={parser:kt,db:pt,renderer:Lt,styles:Et};export{Kt as diagram};
@@ -1,4 +0,0 @@
1
- import{z,o,g,i,a,v,t,n,_,q,li,bo,Hi,Mr,tr,xo,Yi,_o,Jr,ea,Pn,ci,ui}from"./chunk-fhnypcrm.js";var M={sealed:"已封存",folded:"已折叠",archived:"已移出"},T=["bg-accent","bg-accent-strong","bg-warning","bg-success"];function P(e,d){if(e.startsWith("recent-"))return"json";let c=d.trimStart();if(!c)return"markdown";if(c.startsWith("{")||c.startsWith("["))return"json";if(/^<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>/.test(c))return"xml";return"markdown"}function W(e){if(!e||e.length>32000)return e;if(!e.trimStart().startsWith("<"))return e;let c=[],m=0,s=(p)=>" ".repeat(p),l=/(<([a-zA-Z_][\w.-]*)(?:\s+[^>]*)?>([^\r\n<]*)<\/\2>)|(<\/[a-zA-Z_][\w.-]*>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?\/>)|(<[a-zA-Z_][\w.-]*(?:\s+[^>]*)?>)|([^<]+)/g,u;while((u=l.exec(e))!==null){let[,p,,,f,r,x,y]=u;if(p)c.push(`${s(m)}${p.trim()}`);else if(f)m=Math.max(0,m-1),c.push(`${s(m)}${f.trim()}`);else if(x)c.push(`${s(m)}${x.trim()}`),m++;else if(r)c.push(`${s(m)}${r.trim()}`);else if(y){let h=y.trim();if(h)for(let w of h.split(/\r?\n/)){let E=w.trim();if(E)c.push(`${s(m)}${E}`)}}}return c.length>0?c.join(`
2
- `):e}function R(){return n("div",{role:"status","aria-busy":"true","aria-label":"正在加载上下文",className:"space-y-2 animate-pulse",children:[t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"}),t("div",{className:"h-10 rounded-xl border border-line bg-panel/40"})]})}function k(e){let{style:d}=_();return t("p",{className:d("surface.empty"),children:e.children})}function B(e){let{cn:d}=_();if(!e.items.length)return t(k,{children:"新会话还没有上下文。发送第一条消息后,这里会显示构成。"});let c=e.items.reduce((m,s)=>m+s.tokens,0)||1;return n("div",{className:"space-y-2.5",children:[t("div",{className:"flex h-2 overflow-hidden rounded-full bg-raised",children:e.items.map((m,s)=>t("span",{className:d(T[s%T.length],"transition-[width] duration-300 ease-out-quint"),title:`${m.label}:${m.tokens.toLocaleString()} token`,style:{width:`${m.tokens/c*100}%`}},m.id))}),t("div",{className:"space-y-1.5",children:e.items.map((m,s)=>t(K,{item:m,total:c,index:s,color:T[s%T.length]??"bg-accent"},m.id))})]})}function K(e){let{cn:d,Chevron:c,CopyButton:m,Code:s,style:l,useTheme:u}=_();u();let[p,f]=a(!1),r=(e.item.tokens/e.total*100).toFixed(1),x=g(()=>p&&e.item.detail?tr(e.item.detail):"",[p,e.item.detail]),y=g(()=>x?P(e.item.id,x):"markdown",[x,e.item.id]),h=g(()=>{if(!x)return"";return y==="xml"?W(x):x},[x,y]);return n("div",{"data-state":p?"open":"closed",className:l("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":p,onClick:()=>f((w)=>!w),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[t("span",{className:d("size-2 shrink-0 rounded-full",e.color),"aria-hidden":!0}),t("span",{className:"min-w-0 flex-1 truncate font-medium text-ink",children:e.item.label}),e.item.state&&t("span",{className:l("control.badge","text-[10px]"),children:M[e.item.state]}),t("span",{className:"font-mono tabular-nums text-dim",children:e.item.tokens.toLocaleString()}),n("span",{className:"w-10 text-right font-mono text-[11px] tabular-nums text-faint",children:[r,"%"]}),t(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),p&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[t("div",{className:"mb-2 h-1 overflow-hidden rounded-full bg-raised",children:t("div",{className:d("h-full",e.color),style:{width:`${r}%`}})}),h?n("div",{className:l("surface.subtle","group/detail relative overflow-hidden rounded-lg bg-panel/70 p-2.5"),children:[t("div",{className:"absolute right-1.5 top-1.5 z-10",children:t(m,{text:e.item.detail,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),t("div",{className:"max-h-80 overflow-y-auto pr-6 text-dim",children:t(s,{code:h,lang:y,className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]}):t("p",{className:"py-2 text-center text-xs text-faint",children:"(空)"})]})]})}var I=40,H={accent:"bg-accent/15 text-accent",success:"bg-success/15 text-success",warning:"bg-warning/15 text-warning",danger:"bg-danger/15 text-danger",neutral:"bg-raised text-dim"};function A(e){let{Button:d,CopyButton:c,style:m,useTheme:s}=_();s();let[l,u]=a(I),p=i(null),f=l<e.entries.length;o(()=>{let x=p.current;if(!x||!f||typeof IntersectionObserver>"u")return;let y=new IntersectionObserver((h)=>{if(h.some((w)=>w.isIntersecting))u((w)=>Math.min(e.entries.length,w+I))},{rootMargin:"480px"});return y.observe(x),()=>y.disconnect()},[f,e.entries.length]);let r=g(()=>e.entries.slice(-l).reverse(),[e.entries,l]);if(!e.entries.length)return t(k,{children:"还没有消息。"});return n("div",{className:"space-y-1.5",children:[n("div",{className:m("surface.subtle","flex items-center justify-between px-3 py-1.5 text-xs text-faint"),children:[n("span",{children:["共 ",e.entries.length," 条记录"]}),t(c,{text:()=>e.entries.map((x)=>JSON.stringify(x,null,2)).join(`
3
-
4
- `),size:"icon-xs",label:"复制全部原始 JSON",className:"hover:bg-raised text-faint hover:text-ink"})]}),r.map((x)=>t(V,{entry:x},x.seq)),f&&n("div",{ref:p,className:m("surface.subtle","flex items-center justify-between bg-panel/40 px-3 py-2 text-xs text-faint"),children:[n("span",{children:["已显示 ",r.length," / ",e.entries.length," 条"]}),n("div",{className:"flex items-center gap-1.5",children:[t(d,{size:"sm",variant:"ghost",onClick:()=>u((x)=>Math.min(e.entries.length,x+I)),children:"加载更多"}),t(d,{size:"sm",variant:"ghost",onClick:()=>u(e.entries.length),children:"显示全部"})]})]})]})}var V=z(function(d){let{Chevron:c,CopyButton:m,style:s,useTheme:l}=_();l();let[u,p]=a(!1),f=xo(d.entry),r=g(()=>bo(d.entry.time),[d.entry.time]);return n("div",{"data-state":u?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>p((x)=>!x),className:"flex w-full items-center gap-2 px-3 py-2 text-left text-xs",children:[n("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:["#",d.entry.seq]}),t("span",{className:s("control.badge","shrink-0 font-medium text-[10px]",H[f.tone]),children:f.badge}),t("span",{className:"min-w-0 flex-1 truncate text-ink",children:f.title}),f.meta&&t("span",{className:s("control.badge","shrink-0 font-mono text-[10px] text-faint"),children:f.meta}),t("span",{className:"shrink-0 font-mono text-[10.5px] tabular-nums text-faint",children:r}),t(c,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&t("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2.5 text-xs text-dim",children:n("div",{className:"space-y-2",children:[n("div",{className:"flex items-center justify-between text-[11px] text-faint",children:[n("span",{className:"font-mono",children:[d.entry.type," · #",d.entry.seq]}),t(m,{text:()=>JSON.stringify(d.entry,null,2),size:"icon-xs",label:"复制此条 JSON",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink"})]}),t(X,{entry:d.entry})]})})]})});function X(e){let{Code:d,style:c,useTheme:m}=_();m();let s=e.entry;if(s.type==="user")return n("div",{className:"space-y-2",children:[s.text&&t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:Mr(s.text)}),s.attachments&&s.attachments.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["附件(",s.attachments.length,")"]}),t("div",{className:"flex flex-wrap gap-1.5",children:s.attachments.map((l,u)=>{let p=l.kind==="image"?Math.floor(l.data.length*0.75):l.data.length;return n("div",{className:c("surface.subtle","inline-flex items-center gap-1.5 px-2 py-1 text-[11px]"),children:[t("span",{className:c("control.badge","text-[10px] text-faint"),children:l.kind==="image"?"图片":l.kind==="path"?"路径":"文本"}),t("span",{className:"max-w-40 truncate font-medium text-ink",children:l.name}),n("span",{className:"font-mono text-[10px] text-faint",children:[l.mimeType," · ",Hi(p)]})]},`${l.name}-${u}`)})})]}),s.notices&&s.notices.length>0&&n("div",{className:"space-y-1",children:[n("div",{className:"text-[10.5px] font-medium text-faint",children:["通知来源(",s.notices.length,")"]}),s.notices.map((l)=>n("div",{className:c("surface.subtle","flex items-center justify-between px-2.5 py-1.5 font-mono text-[11px]"),children:[n("span",{className:"truncate text-ink",children:[l.sourceKind,"/",l.sourceID]}),t("span",{className:"text-faint",children:l.state})]},l.dedupeKey))]})]});if(s.type==="assistant")return n("div",{className:"space-y-2",children:[n("div",{className:"font-mono text-[11px] text-faint",children:["模型:",s.model]}),s.error&&t("div",{className:"rounded-lg border border-danger/30 bg-danger/8 px-2.5 py-2 text-xs text-danger",children:s.error}),s.parts.map((l,u)=>{if(l.type==="thinking")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[t("div",{className:"text-[10.5px] font-medium text-faint",children:"思考"}),t("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs italic leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(l.text)})]},`thinking-${u}`);if(l.type==="text")return n("div",{className:c("surface.subtle","p-2.5 space-y-1"),children:[t("div",{className:"text-[10.5px] font-medium text-faint",children:"回复"}),t("pre",{className:"max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-ink whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:Mr(l.text)})]},`text-${u}`);return n("div",{className:c("surface.subtle","p-2.5 space-y-1.5"),children:[n("div",{className:"flex items-center justify-between gap-2 text-[11px]",children:[n("span",{className:"font-mono font-medium text-ink",children:["工具调用 · ",l.name]}),t("span",{className:"truncate font-mono text-[10px] text-faint",children:l.id})]}),t("div",{className:"max-h-60 overflow-y-auto text-dim",children:t(d,{code:tr(JSON.stringify(l.input,Yi,2)),lang:"json",className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]},l.id||`tool-${u}`)})]});if(s.type==="tool_result")return n("div",{className:"space-y-2",children:[n("div",{className:"flex flex-wrap items-center gap-2 font-mono text-[11px] text-faint",children:[t("span",{className:"text-ink",children:s.name}),t("span",{children:"·"}),t("span",{className:"truncate",children:s.callID}),t("span",{className:c("control.badge","ml-auto font-sans text-[10px]",s.isError?"bg-danger/15 text-danger":"text-dim"),children:s.isError?"执行失败":"执行完成"})]}),s.images&&s.images.length>0&&t("div",{className:"flex flex-wrap gap-1.5",children:s.images.map((l,u)=>n("span",{className:c("surface.subtle","px-2 py-1 font-mono text-[10.5px] text-faint"),children:["图片 #",u+1," · ",l.mimeType," · ",Hi(Math.floor(l.data.length*0.75))]},`${l.mimeType}-${u}`))}),li(s.output)?t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words [overflow-wrap:anywhere]",s.isError?"text-danger":"text-dim"),children:Mr(s.output)}):t("p",{className:"py-1 text-faint",children:"(无文本输出)"})]});return t("pre",{className:c("surface.subtle","max-h-72 overflow-y-auto p-2.5 font-mono text-[11px] leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]"),children:_o(s)})}function L(e){let{cn:d,style:c,useTheme:m}=_();if(m(),!e.todos.length)return t(k,{children:"暂无待办。"});return t("ul",{className:"space-y-1.5",children:e.todos.map((s)=>n("li",{className:c("surface.interactive","flex items-start gap-2.5 px-3 py-2 text-xs"),children:[n("span",{className:d("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border transition-colors duration-300",s.status==="completed"&&"border-success bg-success text-panel",s.status==="in_progress"&&"border-accent",s.status==="pending"&&"border-line-strong"),children:[s.status==="completed"&&t(q,{className:"size-2.5 animate-pop",strokeWidth:3.5}),s.status==="in_progress"&&t("span",{className:"size-1.5 animate-pulse rounded-full bg-accent"})]}),t("span",{className:d("min-w-0 flex-1 break-words leading-relaxed [overflow-wrap:anywhere]",s.status==="completed"&&"text-faint line-through decoration-faint/60",s.status==="in_progress"&&"font-medium text-ink",s.status==="pending"&&"text-dim"),children:s.content})]},`${s.status}-${s.content}`))})}function O(e){let{cn:d,style:c,useTheme:m}=_();m();let[s,l]=a("all"),u=g(()=>e.tools.filter((r)=>r.deferred).length,[e.tools]),p=e.tools.length-u,f=g(()=>{if(s==="deferred")return e.tools.filter((r)=>r.deferred);if(s==="active")return e.tools.filter((r)=>!r.deferred);return e.tools},[e.tools,s]);if(!e.tools.length)return t(k,{children:"当前会话没有可用工具。"});return n("div",{className:"space-y-2",children:[u>0&&n("div",{className:"flex items-center gap-1 text-[11px]",children:[n("button",{type:"button",onClick:()=>l("all"),className:d("rounded-lg px-2 py-1 transition-colors",s==="all"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["全部 (",e.tools.length,")"]}),n("button",{type:"button",onClick:()=>l("active"),className:d("rounded-lg px-2 py-1 transition-colors",s==="active"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["常驻 (",p,")"]}),n("button",{type:"button",onClick:()=>l("deferred"),className:d("rounded-lg px-2 py-1 transition-colors",s==="deferred"?"bg-raised font-medium text-ink":"text-faint hover:text-dim"),children:["延迟加载 (",u,")"]})]}),t("div",{className:"space-y-1.5",children:f.map((r)=>t(G,{tool:r},`${r.group}-${r.name}`))})]})}function G(e){let{Chevron:d,CopyButton:c,Code:m,style:s,useTheme:l}=_();l();let[u,p]=a(!1),f=g(()=>u?JSON.stringify(e.tool.schema,null,2):"",[u,e.tool.schema]);return n("div",{"data-state":u?"open":"closed",className:s("surface.interactive","group/collapsible"),children:[n("button",{type:"button","aria-expanded":u,onClick:()=>p((r)=>!r),className:"flex w-full items-center justify-between px-3 py-2 text-left text-xs",children:[n("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 truncate font-mono text-ink",children:[t("span",{className:"truncate",children:e.tool.name}),e.tool.group&&t("span",{className:s("control.badge","font-sans text-[10px]"),children:e.tool.group}),e.tool.deferred&&t("span",{className:s("control.badge","font-sans text-[10px]"),children:"延迟加载"})]}),t(d,{className:"-rotate-90 text-faint group-data-[state=open]/collapsible:rotate-90"})]}),u&&n("div",{className:"border-t border-line/60 bg-raised/20 px-3 py-2 text-xs text-dim",children:[e.tool.deferred&&t("div",{className:s("surface.subtle","mb-2 px-2.5 py-1.5 text-[11px] text-faint"),children:"延迟加载:此工具默认以精简描述挂载,模型通过 toolsearch 取回定义后才向上下文注入完整参数 Schema。"}),e.tool.description&&t("pre",{className:"mb-2 max-h-60 overflow-y-auto font-sans text-xs leading-relaxed text-dim whitespace-pre-wrap break-words [overflow-wrap:anywhere]",children:tr(e.tool.description)}),n("div",{className:s("surface.subtle","group/schema relative overflow-hidden rounded-lg p-2.5"),children:[t("div",{className:"absolute right-1.5 top-1.5 z-10",children:t(c,{text:f,size:"icon-xs",className:"bg-raised/60 hover:bg-raised text-faint hover:text-ink backdrop-blur-sm"})}),t("div",{className:"max-h-72 overflow-y-auto pr-6 text-dim",children:t(m,{code:tr(f),lang:"json",className:"text-[11px]! leading-relaxed! [&_pre]:whitespace-pre-wrap [&_pre]:break-words [&_pre]:[overflow-wrap:anywhere]"})})]})]})]})}function Q(){try{let e=localStorage.getItem("basalt.contextSidebar.tab");if(e==="tools"||e==="todos"||e==="raw")return e}catch{}return"breakdown"}function Y(e){let{style:d,useTheme:c}=_();return c(),n("div",{className:d("surface.panel","bg-panel/70 px-3 py-2"),children:[t("div",{className:"text-[10px] font-medium uppercase tracking-wider text-faint",children:e.label}),t("div",{className:"mt-0.5 truncate font-mono text-xs font-semibold tabular-nums text-ink",children:e.value})]})}function Pe(e){let{Button:d,StatusChip:c,Segmented:m,cn:s,style:l,useTheme:u}=_();u();let[p,f]=a(Q),[r,x]=a(()=>Pn.get(e.session.id)),[y,h]=a(!1),[w,E]=a(0),[D,j]=a(!1);o(()=>{let b=setTimeout(()=>j(!0),140);return()=>clearTimeout(b)},[]),o(()=>{let b=Pn.get(e.session.id);if(b)x(b);return ci((C,Z)=>{if(C===e.session.id)x(Z)})},[e.session.id]),o(()=>{let b=new AbortController;return h(!1),e.connection.request(`/api/sessions/${encodeURIComponent(e.session.id)}/context`,{signal:AbortSignal.any([b.signal,AbortSignal.timeout(15000)])}).then((C)=>{if(!b.signal.aborted)ui(e.session.id,C),x(C)},()=>{if(!b.signal.aborted)h(!0)}),()=>b.abort()},[e.connection,e.session.id,e.session.updated,e.entries.length,w]);let N=Jr(r?.items??[],r?.usableWindow,r?.calibratedTokens,r?.lastInputTokens,r?.hasPendingOutput),S=ea(N.percent),U=(b)=>{f(b);try{localStorage.setItem("basalt.contextSidebar.tab",b)}catch{}},J=[{value:"breakdown",label:"构成"},{value:"tools",label:n("span",{className:"inline-flex items-center gap-1",children:["工具",r&&t("span",{className:"text-[10px] text-faint tabular-nums",children:r.tools.length})]})},{value:"todos",label:n("span",{className:"inline-flex items-center gap-1",children:["待办",e.session.todos.length>0&&t("span",{className:"text-[10px] text-faint tabular-nums",children:e.session.todos.length})]})},{value:"raw",label:"原始消息"}],F=n("div",{className:"border-b border-line px-3.5 py-3",children:[n("div",{className:"flex items-start justify-between gap-3",children:[n("div",{children:[t("div",{className:"text-[10.5px] font-medium uppercase tracking-wider text-faint",children:"上下文用量"}),n("div",{className:"mt-0.5 flex items-baseline gap-1.5",children:[t("span",{className:"font-mono text-xl font-semibold tabular-nums text-ink",children:r?N.totalTokens.toLocaleString():"—"}),n("span",{className:"font-mono text-xs text-dim",children:["/ ",r?.usableWindow.toLocaleString()??"—"]})]})]}),t(c,{tone:S==="overflow"||S==="near_limit"?"danger":S==="sealing"?"warning":"success",children:S==="overflow"?"预计超限":S==="near_limit"?"接近上限":S==="sealing"?"接近封存":"正常"})]}),N.percent!==null&&t("meter",{className:"sr-only","aria-label":"可用上下文窗口占比",min:0,max:100,value:Math.min(100,N.percent)}),t("div",{"aria-hidden":!0,className:s("relative mt-2.5 h-2 w-full overflow-hidden rounded-full bg-raised",!r&&"animate-pulse"),children:t("div",{className:"h-full rounded-full bg-accent transition-[width] duration-500 ease-out-quint",style:{width:`${Math.min(100,N.percent??0)}%`}})}),n("div",{className:"mt-2 flex items-center justify-between text-[11px]",children:[t("span",{className:"text-dim",children:N.percent===null?"暂无窗口数据":`${N.percent.toFixed(1)}% 可用窗口`}),n("span",{className:"text-faint",children:["总窗口 ",r?.contextWindow.toLocaleString()??"—"," · 80% 封存 · 97% 折叠"]})]}),r?.usage&&(r.usage.input>0||r.usage.output>0||r.usage.cacheRead>0||r.usage.cacheWrite>0||r.usage.cost>0)&&t("div",{className:"mt-3 grid grid-cols-2 gap-2",children:[["Input",r.usage.input.toLocaleString()],["Output",r.usage.output.toLocaleString()],["Cache",`${r.usage.cacheRead.toLocaleString()} / ${r.usage.cacheWrite.toLocaleString()}`],["平均 TPS",r.usage.tps!==void 0?`${r.usage.tps.toFixed(1)} tok/s`:"—"]].map(([b,C])=>t(Y,{label:b,value:C},b))})]});return n(v,{children:[F,t("div",{className:"border-b border-line px-3 py-2",children:t(m,{value:p,onChange:U,options:J,className:"w-full grid grid-cols-4"})}),n("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:[y&&!r&&n("div",{role:"alert",className:"flex items-center justify-between rounded-xl border border-danger/30 bg-danger/8 px-3 py-2 text-xs text-danger",children:[t("span",{children:"上下文加载失败。"}),t(d,{size:"sm",variant:"ghost",onClick:()=>E((b)=>b+1),children:"重试"})]}),t("div",{children:!D?t(R,{}):n(v,{children:[p==="raw"&&t(A,{entries:e.entries}),p==="todos"&&t(L,{todos:e.session.todos}),p==="breakdown"&&(r?t(B,{items:N.items}):!y?t(R,{}):null),p==="tools"&&(r?t(O,{tools:r.tools??[]}):!y?t(R,{}):null)]})},p)]})]})}export{Pe as ContextSidebar};