@aidapt/caity-chat 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +73 -0
  2. package/dist/lib/_baseUniq-BVCT-t6P.js +477 -0
  3. package/dist/lib/arc-Kj6ZmwPS.js +83 -0
  4. package/dist/lib/architectureDiagram-Q4EWVU46-DA4kYaz_.js +4690 -0
  5. package/dist/lib/blockDiagram-DXYQGD6D-BWT5yya1.js +2295 -0
  6. package/dist/lib/c4Diagram-AHTNJAMY-BjY6DW3U.js +1577 -0
  7. package/dist/lib/caity-chat.tgz +0 -0
  8. package/dist/lib/channel-BjraetTo.js +5 -0
  9. package/dist/lib/chunk-4BX2VUAB-iSPZGgxQ.js +8 -0
  10. package/dist/lib/chunk-4TB4RGXK-DvnUcLoe.js +1465 -0
  11. package/dist/lib/chunk-55IACEB6-Mw25YX9j.js +8 -0
  12. package/dist/lib/chunk-EDXVE4YY-Dtbxz7df.js +19 -0
  13. package/dist/lib/chunk-FMBD7UC4-OCIy3top.js +19 -0
  14. package/dist/lib/chunk-OYMX7WX6-DFW9El2C.js +1383 -0
  15. package/dist/lib/chunk-QZHKN3VN-BYFTfk7k.js +15 -0
  16. package/dist/lib/chunk-YZCP3GAM-Cs-HTcyJ.js +68 -0
  17. package/dist/lib/classDiagram-6PBFFD2Q-CrDUlIYr.js +16 -0
  18. package/dist/lib/classDiagram-v2-HSJHXN6E-CrDUlIYr.js +16 -0
  19. package/dist/lib/clone-C0qEGPCz.js +8 -0
  20. package/dist/lib/cose-bilkent-S5V4N54A-H1-YbKvI.js +2609 -0
  21. package/dist/lib/cytoscape.esm-D_3MZVO6.js +18707 -0
  22. package/dist/lib/dagre-KV5264BT-DhEnTJ4D.js +443 -0
  23. package/dist/lib/defaultLocale-BgPVtth8.js +171 -0
  24. package/dist/lib/diagram-5BDNPKRD-CK6wgKxI.js +123 -0
  25. package/dist/lib/diagram-G4DWMVQ6-IhA_MJ0t.js +528 -0
  26. package/dist/lib/diagram-MMDJMWI5-DDuA1rYY.js +217 -0
  27. package/dist/lib/diagram-TYMM5635-_VI1en0S.js +142 -0
  28. package/dist/lib/erDiagram-SMLLAGMA-B1REwW7y.js +899 -0
  29. package/dist/lib/flowDiagram-DWJPFMVM-rWzOGDlg.js +1628 -0
  30. package/dist/lib/ganttDiagram-T4ZO3ILL-UhSvbAmM.js +2701 -0
  31. package/dist/lib/gitGraphDiagram-UUTBAWPF-DrsSMMoJ.js +815 -0
  32. package/dist/lib/graph-DMr8NrNW.js +738 -0
  33. package/dist/lib/index.d.ts +665 -0
  34. package/dist/lib/index.js +52 -0
  35. package/dist/lib/infoDiagram-42DDH7IO-CPF3XCNj.js +24 -0
  36. package/dist/lib/init-DjUOC4st.js +16 -0
  37. package/dist/lib/ishikawaDiagram-UXIWVN3A-B4Nt1TdW.js +621 -0
  38. package/dist/lib/journeyDiagram-VCZTEJTY-DW5yRsOM.js +834 -0
  39. package/dist/lib/kanban-definition-6JOO6SKY-5DmJRubo.js +724 -0
  40. package/dist/lib/layout-B00IQLgh.js +1441 -0
  41. package/dist/lib/linear-LLab47WO.js +259 -0
  42. package/dist/lib/main-C9dvh9CT.js +88771 -0
  43. package/dist/lib/mermaid.core-BrBkhL9h.js +15967 -0
  44. package/dist/lib/min-CJFyJhXg.js +38 -0
  45. package/dist/lib/mindmap-definition-QFDTVHPH-doqZCFNi.js +833 -0
  46. package/dist/lib/ordinal-B6-f3MAq.js +61 -0
  47. package/dist/lib/pieDiagram-DEJITSTG-DKi5GKup.js +163 -0
  48. package/dist/lib/quadrantDiagram-34T5L4WZ-COYWmEhy.js +1022 -0
  49. package/dist/lib/requirementDiagram-MS252O5E-D3odK6YH.js +882 -0
  50. package/dist/lib/sankeyDiagram-XADWPNL6-D36eaMCx.js +810 -0
  51. package/dist/lib/sequenceDiagram-FGHM5R23-NpESTwMk.js +2883 -0
  52. package/dist/lib/standalone.js +4 -0
  53. package/dist/lib/stateDiagram-FHFEXIEX-kXZ_Bn-a.js +263 -0
  54. package/dist/lib/stateDiagram-v2-QKLJ7IA2-B5xMdEuE.js +16 -0
  55. package/dist/lib/timeline-definition-GMOUNBTQ-DZDdcJwy.js +1055 -0
  56. package/dist/lib/vennDiagram-DHZGUBPP-Clhb6EGF.js +1557 -0
  57. package/dist/lib/wardley-RL74JXVD-CwSnyVu7.js +18396 -0
  58. package/dist/lib/wardleyDiagram-NUSXRM2D-DnXL4F04.js +594 -0
  59. package/dist/lib/xychartDiagram-5P7HB3ND-CweIkrg3.js +1342 -0
  60. package/package.json +95 -0
  61. package/src/types/caity-chat.d.ts +213 -0
  62. package/src/types/template-slots.d.ts +167 -0
@@ -0,0 +1,815 @@
1
+ import { p as le } from "./chunk-4BX2VUAB-iSPZGgxQ.js";
2
+ import { I as he } from "./chunk-QZHKN3VN-BYFTfk7k.js";
3
+ import { q as $e, p as fe, s as ge, g as ue, a as ye, b as xe, _ as h, D as J, l as w, d as me, c as W, u as pe, E as be, z as we, k as B, F as ke, G as ve, H as Ce } from "./mermaid.core-BrBkhL9h.js";
4
+ import { p as Ee } from "./wardley-RL74JXVD-CwSnyVu7.js";
5
+ var m = {
6
+ NORMAL: 0,
7
+ REVERSE: 1,
8
+ HIGHLIGHT: 2,
9
+ MERGE: 3,
10
+ CHERRY_PICK: 4
11
+ }, Be = ve.gitGraph, S = /* @__PURE__ */ h(() => ke({
12
+ ...Be,
13
+ ...J().gitGraph
14
+ }), "getConfig"), d = new he(() => {
15
+ const e = S(), r = e.mainBranchName, t = e.mainBranchOrder;
16
+ return {
17
+ mainBranchName: r,
18
+ commits: /* @__PURE__ */ new Map(),
19
+ head: null,
20
+ branchConfig: /* @__PURE__ */ new Map([[r, { name: r, order: t }]]),
21
+ branches: /* @__PURE__ */ new Map([[r, null]]),
22
+ currBranch: r,
23
+ direction: "LR",
24
+ seq: 0,
25
+ options: {}
26
+ };
27
+ });
28
+ function Y() {
29
+ return Ce({ length: 7 });
30
+ }
31
+ h(Y, "getID");
32
+ function te(e, r) {
33
+ const t = /* @__PURE__ */ Object.create(null);
34
+ return e.reduce((s, o) => {
35
+ const i = r(o);
36
+ return t[i] || (t[i] = !0, s.push(o)), s;
37
+ }, []);
38
+ }
39
+ h(te, "uniqBy");
40
+ var Te = /* @__PURE__ */ h(function(e) {
41
+ d.records.direction = e;
42
+ }, "setDirection"), Le = /* @__PURE__ */ h(function(e) {
43
+ w.debug("options str", e), e = e?.trim(), e = e || "{}";
44
+ try {
45
+ d.records.options = JSON.parse(e);
46
+ } catch (r) {
47
+ w.error("error while parsing gitGraph options", r.message);
48
+ }
49
+ }, "setOptions"), Me = /* @__PURE__ */ h(function() {
50
+ return d.records.options;
51
+ }, "getOptions"), Re = /* @__PURE__ */ h(function(e) {
52
+ let r = e.msg, t = e.id;
53
+ const s = e.type;
54
+ let o = e.tags;
55
+ w.info("commit", r, t, s, o), w.debug("Entering commit:", r, t, s, o);
56
+ const i = S();
57
+ t = B.sanitizeText(t, i), r = B.sanitizeText(r, i), o = o?.map((a) => B.sanitizeText(a, i));
58
+ const n = {
59
+ id: t || d.records.seq + "-" + Y(),
60
+ message: r,
61
+ seq: d.records.seq++,
62
+ type: s ?? m.NORMAL,
63
+ tags: o ?? [],
64
+ parents: d.records.head == null ? [] : [d.records.head.id],
65
+ branch: d.records.currBranch
66
+ };
67
+ d.records.head = n, w.info("main branch", i.mainBranchName), d.records.commits.has(n.id) && w.warn(`Commit ID ${n.id} already exists`), d.records.commits.set(n.id, n), d.records.branches.set(d.records.currBranch, n.id), w.debug("in pushCommit " + n.id);
68
+ }, "commit"), Ie = /* @__PURE__ */ h(function(e) {
69
+ let r = e.name;
70
+ const t = e.order;
71
+ if (r = B.sanitizeText(r, S()), d.records.branches.has(r))
72
+ throw new Error(
73
+ `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`
74
+ );
75
+ d.records.branches.set(r, d.records.head != null ? d.records.head.id : null), d.records.branchConfig.set(r, { name: r, order: t }), ae(r), w.debug("in createBranch");
76
+ }, "branch"), Oe = /* @__PURE__ */ h((e) => {
77
+ let r = e.branch, t = e.id;
78
+ const s = e.type, o = e.tags, i = S();
79
+ r = B.sanitizeText(r, i), t && (t = B.sanitizeText(t, i));
80
+ const n = d.records.branches.get(d.records.currBranch), a = d.records.branches.get(r), l = n ? d.records.commits.get(n) : void 0, f = a ? d.records.commits.get(a) : void 0;
81
+ if (l && f && l.branch === r)
82
+ throw new Error(`Cannot merge branch '${r}' into itself.`);
83
+ if (d.records.currBranch === r) {
84
+ const c = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
85
+ throw c.hash = {
86
+ text: `merge ${r}`,
87
+ token: `merge ${r}`,
88
+ expected: ["branch abc"]
89
+ }, c;
90
+ }
91
+ if (l === void 0 || !l) {
92
+ const c = new Error(
93
+ `Incorrect usage of "merge". Current branch (${d.records.currBranch})has no commits`
94
+ );
95
+ throw c.hash = {
96
+ text: `merge ${r}`,
97
+ token: `merge ${r}`,
98
+ expected: ["commit"]
99
+ }, c;
100
+ }
101
+ if (!d.records.branches.has(r)) {
102
+ const c = new Error(
103
+ 'Incorrect usage of "merge". Branch to be merged (' + r + ") does not exist"
104
+ );
105
+ throw c.hash = {
106
+ text: `merge ${r}`,
107
+ token: `merge ${r}`,
108
+ expected: [`branch ${r}`]
109
+ }, c;
110
+ }
111
+ if (f === void 0 || !f) {
112
+ const c = new Error(
113
+ 'Incorrect usage of "merge". Branch to be merged (' + r + ") has no commits"
114
+ );
115
+ throw c.hash = {
116
+ text: `merge ${r}`,
117
+ token: `merge ${r}`,
118
+ expected: ['"commit"']
119
+ }, c;
120
+ }
121
+ if (l === f) {
122
+ const c = new Error('Incorrect usage of "merge". Both branches have same head');
123
+ throw c.hash = {
124
+ text: `merge ${r}`,
125
+ token: `merge ${r}`,
126
+ expected: ["branch abc"]
127
+ }, c;
128
+ }
129
+ if (t && d.records.commits.has(t)) {
130
+ const c = new Error(
131
+ 'Incorrect usage of "merge". Commit with id:' + t + " already exists, use different custom id"
132
+ );
133
+ throw c.hash = {
134
+ text: `merge ${r} ${t} ${s} ${o?.join(" ")}`,
135
+ token: `merge ${r} ${t} ${s} ${o?.join(" ")}`,
136
+ expected: [
137
+ `merge ${r} ${t}_UNIQUE ${s} ${o?.join(" ")}`
138
+ ]
139
+ }, c;
140
+ }
141
+ const g = a || "", $ = {
142
+ id: t || `${d.records.seq}-${Y()}`,
143
+ message: `merged branch ${r} into ${d.records.currBranch}`,
144
+ seq: d.records.seq++,
145
+ parents: d.records.head == null ? [] : [d.records.head.id, g],
146
+ branch: d.records.currBranch,
147
+ type: m.MERGE,
148
+ customType: s,
149
+ customId: !!t,
150
+ tags: o ?? []
151
+ };
152
+ d.records.head = $, d.records.commits.set($.id, $), d.records.branches.set(d.records.currBranch, $.id), w.debug(d.records.branches), w.debug("in mergeBranch");
153
+ }, "merge"), _e = /* @__PURE__ */ h(function(e) {
154
+ let r = e.id, t = e.targetId, s = e.tags, o = e.parent;
155
+ w.debug("Entering cherryPick:", r, t, s);
156
+ const i = S();
157
+ if (r = B.sanitizeText(r, i), t = B.sanitizeText(t, i), s = s?.map((l) => B.sanitizeText(l, i)), o = B.sanitizeText(o, i), !r || !d.records.commits.has(r)) {
158
+ const l = new Error(
159
+ 'Incorrect usage of "cherryPick". Source commit id should exist and provided'
160
+ );
161
+ throw l.hash = {
162
+ text: `cherryPick ${r} ${t}`,
163
+ token: `cherryPick ${r} ${t}`,
164
+ expected: ["cherry-pick abc"]
165
+ }, l;
166
+ }
167
+ const n = d.records.commits.get(r);
168
+ if (n === void 0 || !n)
169
+ throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');
170
+ if (o && !(Array.isArray(n.parents) && n.parents.includes(o)))
171
+ throw new Error(
172
+ "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
173
+ );
174
+ const a = n.branch;
175
+ if (n.type === m.MERGE && !o)
176
+ throw new Error(
177
+ "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
178
+ );
179
+ if (!t || !d.records.commits.has(t)) {
180
+ if (a === d.records.currBranch) {
181
+ const $ = new Error(
182
+ 'Incorrect usage of "cherryPick". Source commit is already on current branch'
183
+ );
184
+ throw $.hash = {
185
+ text: `cherryPick ${r} ${t}`,
186
+ token: `cherryPick ${r} ${t}`,
187
+ expected: ["cherry-pick abc"]
188
+ }, $;
189
+ }
190
+ const l = d.records.branches.get(d.records.currBranch);
191
+ if (l === void 0 || !l) {
192
+ const $ = new Error(
193
+ `Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`
194
+ );
195
+ throw $.hash = {
196
+ text: `cherryPick ${r} ${t}`,
197
+ token: `cherryPick ${r} ${t}`,
198
+ expected: ["cherry-pick abc"]
199
+ }, $;
200
+ }
201
+ const f = d.records.commits.get(l);
202
+ if (f === void 0 || !f) {
203
+ const $ = new Error(
204
+ `Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`
205
+ );
206
+ throw $.hash = {
207
+ text: `cherryPick ${r} ${t}`,
208
+ token: `cherryPick ${r} ${t}`,
209
+ expected: ["cherry-pick abc"]
210
+ }, $;
211
+ }
212
+ const g = {
213
+ id: d.records.seq + "-" + Y(),
214
+ message: `cherry-picked ${n?.message} into ${d.records.currBranch}`,
215
+ seq: d.records.seq++,
216
+ parents: d.records.head == null ? [] : [d.records.head.id, n.id],
217
+ branch: d.records.currBranch,
218
+ type: m.CHERRY_PICK,
219
+ tags: s ? s.filter(Boolean) : [
220
+ `cherry-pick:${n.id}${n.type === m.MERGE ? `|parent:${o}` : ""}`
221
+ ]
222
+ };
223
+ d.records.head = g, d.records.commits.set(g.id, g), d.records.branches.set(d.records.currBranch, g.id), w.debug(d.records.branches), w.debug("in cherryPick");
224
+ }
225
+ }, "cherryPick"), ae = /* @__PURE__ */ h(function(e) {
226
+ if (e = B.sanitizeText(e, S()), d.records.branches.has(e)) {
227
+ d.records.currBranch = e;
228
+ const r = d.records.branches.get(d.records.currBranch);
229
+ r === void 0 || !r ? d.records.head = null : d.records.head = d.records.commits.get(r) ?? null;
230
+ } else {
231
+ const r = new Error(
232
+ `Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`
233
+ );
234
+ throw r.hash = {
235
+ text: `checkout ${e}`,
236
+ token: `checkout ${e}`,
237
+ expected: [`branch ${e}`]
238
+ }, r;
239
+ }
240
+ }, "checkout");
241
+ function V(e, r, t) {
242
+ const s = e.indexOf(r);
243
+ s === -1 ? e.push(t) : e.splice(s, 1, t);
244
+ }
245
+ h(V, "upsert");
246
+ function Q(e) {
247
+ const r = e.reduce((o, i) => o.seq > i.seq ? o : i, e[0]);
248
+ let t = "";
249
+ e.forEach(function(o) {
250
+ o === r ? t += " *" : t += " |";
251
+ });
252
+ const s = [t, r.id, r.seq];
253
+ for (const o in d.records.branches)
254
+ d.records.branches.get(o) === r.id && s.push(o);
255
+ if (w.debug(s.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) {
256
+ const o = d.records.commits.get(r.parents[0]);
257
+ V(e, r, o), r.parents[1] && e.push(d.records.commits.get(r.parents[1]));
258
+ } else {
259
+ if (r.parents.length == 0)
260
+ return;
261
+ if (r.parents[0]) {
262
+ const o = d.records.commits.get(r.parents[0]);
263
+ V(e, r, o);
264
+ }
265
+ }
266
+ e = te(e, (o) => o.id), Q(e);
267
+ }
268
+ h(Q, "prettyPrintCommitHistory");
269
+ var Ge = /* @__PURE__ */ h(function() {
270
+ w.debug(d.records.commits);
271
+ const e = ne()[0];
272
+ Q([e]);
273
+ }, "prettyPrint"), He = /* @__PURE__ */ h(function() {
274
+ d.reset(), we();
275
+ }, "clear"), Se = /* @__PURE__ */ h(function() {
276
+ return [...d.records.branchConfig.values()].map((r, t) => r.order !== null && r.order !== void 0 ? r : {
277
+ ...r,
278
+ order: parseFloat(`0.${t}`)
279
+ }).sort((r, t) => (r.order ?? 0) - (t.order ?? 0)).map(({ name: r }) => ({ name: r }));
280
+ }, "getBranchesAsObjArray"), Ae = /* @__PURE__ */ h(function() {
281
+ return d.records.branches;
282
+ }, "getBranches"), De = /* @__PURE__ */ h(function() {
283
+ return d.records.commits;
284
+ }, "getCommits"), ne = /* @__PURE__ */ h(function() {
285
+ const e = [...d.records.commits.values()];
286
+ return e.forEach(function(r) {
287
+ w.debug(r.id);
288
+ }), e.sort((r, t) => r.seq - t.seq), e;
289
+ }, "getCommitsArray"), qe = /* @__PURE__ */ h(function() {
290
+ return d.records.currBranch;
291
+ }, "getCurrentBranch"), Pe = /* @__PURE__ */ h(function() {
292
+ return d.records.direction;
293
+ }, "getDirection"), We = /* @__PURE__ */ h(function() {
294
+ return d.records.head;
295
+ }, "getHead"), se = {
296
+ commitType: m,
297
+ getConfig: S,
298
+ setDirection: Te,
299
+ setOptions: Le,
300
+ getOptions: Me,
301
+ commit: Re,
302
+ branch: Ie,
303
+ merge: Oe,
304
+ cherryPick: _e,
305
+ checkout: ae,
306
+ //reset,
307
+ prettyPrint: Ge,
308
+ clear: He,
309
+ getBranchesAsObjArray: Se,
310
+ getBranches: Ae,
311
+ getCommits: De,
312
+ getCommitsArray: ne,
313
+ getCurrentBranch: qe,
314
+ getDirection: Pe,
315
+ getHead: We,
316
+ setAccTitle: xe,
317
+ getAccTitle: ye,
318
+ getAccDescription: ue,
319
+ setAccDescription: ge,
320
+ setDiagramTitle: fe,
321
+ getDiagramTitle: $e
322
+ }, Ne = /* @__PURE__ */ h((e, r) => {
323
+ le(e, r), e.dir && r.setDirection(e.dir);
324
+ for (const t of e.statements)
325
+ Fe(t, r);
326
+ }, "populate"), Fe = /* @__PURE__ */ h((e, r) => {
327
+ const s = {
328
+ Commit: /* @__PURE__ */ h((o) => r.commit(ze(o)), "Commit"),
329
+ Branch: /* @__PURE__ */ h((o) => r.branch(Ye(o)), "Branch"),
330
+ Merge: /* @__PURE__ */ h((o) => r.merge(je(o)), "Merge"),
331
+ Checkout: /* @__PURE__ */ h((o) => r.checkout(Ue(o)), "Checkout"),
332
+ CherryPicking: /* @__PURE__ */ h((o) => r.cherryPick(Ke(o)), "CherryPicking")
333
+ }[e.$type];
334
+ s ? s(e) : w.error(`Unknown statement type: ${e.$type}`);
335
+ }, "parseStatement"), ze = /* @__PURE__ */ h((e) => ({
336
+ id: e.id,
337
+ msg: e.message ?? "",
338
+ type: e.type !== void 0 ? m[e.type] : m.NORMAL,
339
+ tags: e.tags ?? void 0
340
+ }), "parseCommit"), Ye = /* @__PURE__ */ h((e) => ({
341
+ name: e.name,
342
+ order: e.order ?? 0
343
+ }), "parseBranch"), je = /* @__PURE__ */ h((e) => ({
344
+ branch: e.branch,
345
+ id: e.id ?? "",
346
+ type: e.type !== void 0 ? m[e.type] : void 0,
347
+ tags: e.tags ?? void 0
348
+ }), "parseMerge"), Ue = /* @__PURE__ */ h((e) => e.branch, "parseCheckout"), Ke = /* @__PURE__ */ h((e) => ({
349
+ id: e.id,
350
+ targetId: "",
351
+ tags: e.tags?.length === 0 ? void 0 : e.tags,
352
+ parent: e.parent
353
+ }), "parseCherryPicking"), Ve = {
354
+ parse: /* @__PURE__ */ h(async (e) => {
355
+ const r = await Ee("gitGraph", e);
356
+ w.debug(r), Ne(r, se);
357
+ }, "parse")
358
+ }, O = 10, _ = 40, L = 4, R = 2, G = 8, j = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]), X = 12, Z = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), Xe = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]), H = /* @__PURE__ */ h((e, r, t = !1) => t && e > 0 ? (e - 1) % (r - 1) + 1 : e % r, "calcColorIndex"), C = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), F = 30, q = /* @__PURE__ */ new Map(), z = [], I = 0, y = "LR", Je = /* @__PURE__ */ h(() => {
359
+ C.clear(), E.clear(), q.clear(), I = 0, z = [], y = "LR";
360
+ }, "clear"), oe = /* @__PURE__ */ h((e) => {
361
+ const r = document.createElementNS("http://www.w3.org/2000/svg", "text");
362
+ return (typeof e == "string" ? e.split(/\\n|\n|<br\s*\/?>/gi) : e).forEach((s) => {
363
+ const o = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
364
+ o.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), o.setAttribute("dy", "1em"), o.setAttribute("x", "0"), o.setAttribute("class", "row"), o.textContent = s.trim(), r.appendChild(o);
365
+ }), r;
366
+ }, "drawText"), ce = /* @__PURE__ */ h((e) => {
367
+ let r, t, s;
368
+ return y === "BT" ? (t = /* @__PURE__ */ h((o, i) => o <= i, "comparisonFunc"), s = 1 / 0) : (t = /* @__PURE__ */ h((o, i) => o >= i, "comparisonFunc"), s = 0), e.forEach((o) => {
369
+ const i = y === "TB" || y == "BT" ? E.get(o)?.y : E.get(o)?.x;
370
+ i !== void 0 && t(i, s) && (r = o, s = i);
371
+ }), r;
372
+ }, "findClosestParent"), Qe = /* @__PURE__ */ h((e) => {
373
+ let r = "", t = 1 / 0;
374
+ return e.forEach((s) => {
375
+ const o = E.get(s).y;
376
+ o <= t && (r = s, t = o);
377
+ }), r || void 0;
378
+ }, "findClosestParentBT"), Ze = /* @__PURE__ */ h((e, r, t) => {
379
+ let s = t, o = t;
380
+ const i = [];
381
+ e.forEach((n) => {
382
+ const a = r.get(n);
383
+ if (!a)
384
+ throw new Error(`Commit not found for key ${n}`);
385
+ a.parents.length ? (s = rr(a), o = Math.max(s, o)) : i.push(a), tr(a, s);
386
+ }), s = o, i.forEach((n) => {
387
+ ar(n, s, t);
388
+ }), e.forEach((n) => {
389
+ const a = r.get(n);
390
+ if (a?.parents.length) {
391
+ const l = Qe(a.parents);
392
+ s = E.get(l).y - _, s <= o && (o = s);
393
+ const f = C.get(a.branch).pos, g = s - O;
394
+ E.set(a.id, { x: f, y: g });
395
+ }
396
+ });
397
+ }, "setParallelBTPos"), er = /* @__PURE__ */ h((e) => {
398
+ const r = ce(e.parents.filter((s) => s !== null));
399
+ if (!r)
400
+ throw new Error(`Closest parent not found for commit ${e.id}`);
401
+ const t = E.get(r)?.y;
402
+ if (t === void 0)
403
+ throw new Error(`Closest parent position not found for commit ${e.id}`);
404
+ return t;
405
+ }, "findClosestParentPos"), rr = /* @__PURE__ */ h((e) => er(e) + _, "calculateCommitPosition"), tr = /* @__PURE__ */ h((e, r) => {
406
+ const t = C.get(e.branch);
407
+ if (!t)
408
+ throw new Error(`Branch not found for commit ${e.id}`);
409
+ const s = t.pos, o = r + O;
410
+ return E.set(e.id, { x: s, y: o }), { x: s, y: o };
411
+ }, "setCommitPosition"), ar = /* @__PURE__ */ h((e, r, t) => {
412
+ const s = C.get(e.branch);
413
+ if (!s)
414
+ throw new Error(`Branch not found for commit ${e.id}`);
415
+ const o = r + t, i = s.pos;
416
+ E.set(e.id, { x: i, y: o });
417
+ }, "setRootPosition"), nr = /* @__PURE__ */ h((e, r, t, s, o, i) => {
418
+ const { theme: n } = W(), a = j.has(n ?? ""), l = Z.has(n ?? ""), f = Xe.has(n ?? "");
419
+ if (i === m.HIGHLIGHT)
420
+ e.append("rect").attr("x", t.x - 10 + (a ? 3 : 0)).attr("y", t.y - 10 + (a ? 3 : 0)).attr("width", a ? 14 : 20).attr("height", a ? 14 : 20).attr(
421
+ "class",
422
+ `commit ${r.id} commit-highlight${H(o, G, l)} ${s}-outer`
423
+ ), e.append("rect").attr("x", t.x - 6 + (a ? 2 : 0)).attr("y", t.y - 6 + (a ? 2 : 0)).attr("width", a ? 8 : 12).attr("height", a ? 8 : 12).attr(
424
+ "class",
425
+ `commit ${r.id} commit${H(o, G, l)} ${s}-inner`
426
+ );
427
+ else if (i === m.CHERRY_PICK)
428
+ e.append("circle").attr("cx", t.x).attr("cy", t.y).attr("r", a ? 7 : 10).attr("class", `commit ${r.id} ${s}`), e.append("circle").attr("cx", t.x - 3).attr("cy", t.y + 2).attr("r", a ? 2.5 : 2.75).attr("fill", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`), e.append("circle").attr("cx", t.x + 3).attr("cy", t.y + 2).attr("r", a ? 2.5 : 2.75).attr("fill", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`), e.append("line").attr("x1", t.x + 3).attr("y1", t.y + 1).attr("x2", t.x).attr("y2", t.y - 5).attr("stroke", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`), e.append("line").attr("x1", t.x - 3).attr("y1", t.y + 1).attr("x2", t.x).attr("y2", t.y - 5).attr("stroke", f ? "#000000" : "#fff").attr("class", `commit ${r.id} ${s}`);
429
+ else {
430
+ const g = e.append("circle");
431
+ if (g.attr("cx", t.x), g.attr("cy", t.y), g.attr("r", a ? 7 : 10), g.attr(
432
+ "class",
433
+ `commit ${r.id} commit${H(o, G, l)}`
434
+ ), i === m.MERGE) {
435
+ const $ = e.append("circle");
436
+ $.attr("cx", t.x), $.attr("cy", t.y), $.attr("r", a ? 5 : 6), $.attr(
437
+ "class",
438
+ `commit ${s} ${r.id} commit${H(o, G, l)}`
439
+ );
440
+ }
441
+ if (i === m.REVERSE) {
442
+ const $ = e.append("path"), c = a ? 4 : 5;
443
+ $.attr(
444
+ "d",
445
+ `M ${t.x - c},${t.y - c}L${t.x + c},${t.y + c}M${t.x - c},${t.y + c}L${t.x + c},${t.y - c}`
446
+ ).attr(
447
+ "class",
448
+ `commit ${s} ${r.id} commit${H(o, G, l)}`
449
+ );
450
+ }
451
+ }
452
+ }, "drawCommitBullet"), sr = /* @__PURE__ */ h((e, r, t, s, o) => {
453
+ if (r.type !== m.CHERRY_PICK && (r.customId && r.type === m.MERGE || r.type !== m.MERGE) && o.showCommitLabel) {
454
+ const i = e.append("g"), n = i.insert("rect").attr("class", "commit-label-bkg"), a = i.append("text").attr("x", s).attr("y", t.y + 25).attr("class", "commit-label").text(r.id), l = a.node()?.getBBox();
455
+ if (l && (n.attr("x", t.posWithOffset - l.width / 2 - R).attr("y", t.y + 13.5).attr("width", l.width + 2 * R).attr("height", l.height + 2 * R), y === "TB" || y === "BT" ? (n.attr("x", t.x - (l.width + 4 * L + 5)).attr("y", t.y - 12), a.attr("x", t.x - (l.width + 4 * L)).attr("y", t.y + l.height - 12)) : a.attr("x", t.posWithOffset - l.width / 2), o.rotateCommitLabel))
456
+ if (y === "TB" || y === "BT")
457
+ a.attr(
458
+ "transform",
459
+ "rotate(-45, " + t.x + ", " + t.y + ")"
460
+ ), n.attr(
461
+ "transform",
462
+ "rotate(-45, " + t.x + ", " + t.y + ")"
463
+ );
464
+ else {
465
+ const f = -7.5 - (l.width + 10) / 25 * 9.5, g = 10 + l.width / 25 * 8.5;
466
+ i.attr(
467
+ "transform",
468
+ "translate(" + f + ", " + g + ") rotate(-45, " + s + ", " + t.y + ")"
469
+ );
470
+ }
471
+ }
472
+ }, "drawCommitLabel"), or = /* @__PURE__ */ h((e, r, t, s) => {
473
+ if (r.tags.length > 0) {
474
+ let o = 0, i = 0, n = 0;
475
+ const a = [];
476
+ for (const l of r.tags.reverse()) {
477
+ const f = e.insert("polygon"), g = e.append("circle"), $ = e.append("text").attr("y", t.y - 16 - o).attr("class", "tag-label").text(l), c = $.node()?.getBBox();
478
+ if (!c)
479
+ throw new Error("Tag bbox not found");
480
+ i = Math.max(i, c.width), n = Math.max(n, c.height), $.attr("x", t.posWithOffset - c.width / 2), a.push({
481
+ tag: $,
482
+ hole: g,
483
+ rect: f,
484
+ yOffset: o
485
+ }), o += 20;
486
+ }
487
+ for (const { tag: l, hole: f, rect: g, yOffset: $ } of a) {
488
+ const c = n / 2, x = t.y - 19.2 - $;
489
+ if (g.attr("class", "tag-label-bkg").attr(
490
+ "points",
491
+ `
492
+ ${s - i / 2 - L / 2},${x + R}
493
+ ${s - i / 2 - L / 2},${x - R}
494
+ ${t.posWithOffset - i / 2 - L},${x - c - R}
495
+ ${t.posWithOffset + i / 2 + L},${x - c - R}
496
+ ${t.posWithOffset + i / 2 + L},${x + c + R}
497
+ ${t.posWithOffset - i / 2 - L},${x + c + R}`
498
+ ), f.attr("cy", x).attr("cx", s - i / 2 + L / 2).attr("r", 1.5).attr("class", "tag-hole"), y === "TB" || y === "BT") {
499
+ const u = s + $;
500
+ g.attr("class", "tag-label-bkg").attr(
501
+ "points",
502
+ `
503
+ ${t.x},${u + 2}
504
+ ${t.x},${u - 2}
505
+ ${t.x + O},${u - c - 2}
506
+ ${t.x + O + i + 4},${u - c - 2}
507
+ ${t.x + O + i + 4},${u + c + 2}
508
+ ${t.x + O},${u + c + 2}`
509
+ ).attr("transform", "translate(12,12) rotate(45, " + t.x + "," + s + ")"), f.attr("cx", t.x + L / 2).attr("cy", u).attr("transform", "translate(12,12) rotate(45, " + t.x + "," + s + ")"), l.attr("x", t.x + 5).attr("y", u + 3).attr("transform", "translate(14,14) rotate(45, " + t.x + "," + s + ")");
510
+ }
511
+ }
512
+ }
513
+ }, "drawCommitTags"), cr = /* @__PURE__ */ h((e) => {
514
+ switch (e.customType ?? e.type) {
515
+ case m.NORMAL:
516
+ return "commit-normal";
517
+ case m.REVERSE:
518
+ return "commit-reverse";
519
+ case m.HIGHLIGHT:
520
+ return "commit-highlight";
521
+ case m.MERGE:
522
+ return "commit-merge";
523
+ case m.CHERRY_PICK:
524
+ return "commit-cherry-pick";
525
+ default:
526
+ return "commit-normal";
527
+ }
528
+ }, "getCommitClassType"), ir = /* @__PURE__ */ h((e, r, t, s) => {
529
+ const o = { x: 0, y: 0 };
530
+ if (e.parents.length > 0) {
531
+ const i = ce(e.parents);
532
+ if (i) {
533
+ const n = s.get(i) ?? o;
534
+ return r === "TB" ? n.y + _ : r === "BT" ? (s.get(e.id) ?? o).y - _ : n.x + _;
535
+ }
536
+ } else
537
+ return r === "TB" ? F : r === "BT" ? (s.get(e.id) ?? o).y - _ : 0;
538
+ return 0;
539
+ }, "calculatePosition"), dr = /* @__PURE__ */ h((e, r, t) => {
540
+ const s = y === "BT" && t ? r : r + O, o = C.get(e.branch)?.pos, i = y === "TB" || y === "BT" ? C.get(e.branch)?.pos : s;
541
+ if (i === void 0 || o === void 0)
542
+ throw new Error(`Position were undefined for commit ${e.id}`);
543
+ const n = j.has(W().theme ?? ""), a = y === "TB" || y === "BT" ? s : o + (n ? X / 2 + 1 : -2);
544
+ return { x: i, y: a, posWithOffset: s };
545
+ }, "getCommitPosition"), re = /* @__PURE__ */ h((e, r, t, s) => {
546
+ const o = e.append("g").attr("class", "commit-bullets"), i = e.append("g").attr("class", "commit-labels");
547
+ let n = y === "TB" || y === "BT" ? F : 0;
548
+ const a = [...r.keys()], l = s.parallelCommits ?? !1, f = /* @__PURE__ */ h(($, c) => {
549
+ const x = r.get($)?.seq, u = r.get(c)?.seq;
550
+ return x !== void 0 && u !== void 0 ? x - u : 0;
551
+ }, "sortKeys");
552
+ let g = a.sort(f);
553
+ y === "BT" && (l && Ze(g, r, n), g = g.reverse()), g.forEach(($) => {
554
+ const c = r.get($);
555
+ if (!c)
556
+ throw new Error(`Commit not found for key ${$}`);
557
+ l && (n = ir(c, y, n, E));
558
+ const x = dr(c, n, l);
559
+ if (t) {
560
+ const u = cr(c), p = c.customType ?? c.type, b = C.get(c.branch)?.index ?? 0;
561
+ nr(o, c, x, u, b, p), sr(i, c, x, n, s), or(i, c, x, n);
562
+ }
563
+ y === "TB" || y === "BT" ? E.set(c.id, { x: x.x, y: x.posWithOffset }) : E.set(c.id, { x: x.posWithOffset, y: x.y }), n = y === "BT" && l ? n + _ : n + _ + O, n > I && (I = n);
564
+ });
565
+ }, "drawCommits"), lr = /* @__PURE__ */ h((e, r, t, s, o) => {
566
+ const n = (y === "TB" || y === "BT" ? t.x < s.x : t.y < s.y) ? r.branch : e.branch, a = /* @__PURE__ */ h((f) => f.branch === n, "isOnBranchToGetCurve"), l = /* @__PURE__ */ h((f) => f.seq > e.seq && f.seq < r.seq, "isBetweenCommits");
567
+ return [...o.values()].some((f) => l(f) && a(f));
568
+ }, "shouldRerouteArrow"), P = /* @__PURE__ */ h((e, r, t = 0) => {
569
+ const s = e + Math.abs(e - r) / 2;
570
+ if (t > 5)
571
+ return s;
572
+ if (z.every((n) => Math.abs(n - s) >= 10))
573
+ return z.push(s), s;
574
+ const i = Math.abs(e - r);
575
+ return P(e, r - i / 5, t + 1);
576
+ }, "findLane"), hr = /* @__PURE__ */ h((e, r, t, s) => {
577
+ const { theme: o } = W(), i = Z.has(o ?? ""), n = E.get(r.id), a = E.get(t.id);
578
+ if (n === void 0 || a === void 0)
579
+ throw new Error(`Commit positions not found for commits ${r.id} and ${t.id}`);
580
+ const l = lr(r, t, n, a, s);
581
+ let f = "", g = "", $ = 0, c = 0, x = C.get(t.branch)?.index;
582
+ t.type === m.MERGE && r.id !== t.parents[0] && (x = C.get(r.branch)?.index);
583
+ let u;
584
+ if (l) {
585
+ f = "A 10 10, 0, 0, 0,", g = "A 10 10, 0, 0, 1,", $ = 10, c = 10;
586
+ const p = n.y < a.y ? P(n.y, a.y) : P(a.y, n.y), b = n.x < a.x ? P(n.x, a.x) : P(a.x, n.x);
587
+ y === "TB" ? n.x < a.x ? u = `M ${n.x} ${n.y} L ${b - $} ${n.y} ${g} ${b} ${n.y + c} L ${b} ${a.y - $} ${f} ${b + c} ${a.y} L ${a.x} ${a.y}` : (x = C.get(r.branch)?.index, u = `M ${n.x} ${n.y} L ${b + $} ${n.y} ${f} ${b} ${n.y + c} L ${b} ${a.y - $} ${g} ${b - c} ${a.y} L ${a.x} ${a.y}`) : y === "BT" ? n.x < a.x ? u = `M ${n.x} ${n.y} L ${b - $} ${n.y} ${f} ${b} ${n.y - c} L ${b} ${a.y + $} ${g} ${b + c} ${a.y} L ${a.x} ${a.y}` : (x = C.get(r.branch)?.index, u = `M ${n.x} ${n.y} L ${b + $} ${n.y} ${g} ${b} ${n.y - c} L ${b} ${a.y + $} ${f} ${b - c} ${a.y} L ${a.x} ${a.y}`) : n.y < a.y ? u = `M ${n.x} ${n.y} L ${n.x} ${p - $} ${f} ${n.x + c} ${p} L ${a.x - $} ${p} ${g} ${a.x} ${p + c} L ${a.x} ${a.y}` : (x = C.get(r.branch)?.index, u = `M ${n.x} ${n.y} L ${n.x} ${p + $} ${g} ${n.x + c} ${p} L ${a.x - $} ${p} ${f} ${a.x} ${p - c} L ${a.x} ${a.y}`);
588
+ } else
589
+ f = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", $ = 20, c = 20, y === "TB" ? (n.x < a.x && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y - $} ${f} ${n.x + c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${g} ${a.x} ${n.y + c} L ${a.x} ${a.y}`), n.x > a.x && (f = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", $ = 20, c = 20, t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y - $} ${g} ${n.x - c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x + $} ${n.y} ${f} ${a.x} ${n.y + c} L ${a.x} ${a.y}`), n.x === a.x && (u = `M ${n.x} ${n.y} L ${a.x} ${a.y}`)) : y === "BT" ? (n.x < a.x && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y + $} ${g} ${n.x + c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${f} ${a.x} ${n.y - c} L ${a.x} ${a.y}`), n.x > a.x && (f = "A 20 20, 0, 0, 0,", g = "A 20 20, 0, 0, 1,", $ = 20, c = 20, t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${n.x} ${a.y + $} ${f} ${n.x - c} ${a.y} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${a.x + $} ${n.y} ${g} ${a.x} ${n.y - c} L ${a.x} ${a.y}`), n.x === a.x && (u = `M ${n.x} ${n.y} L ${a.x} ${a.y}`)) : (n.y < a.y && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${g} ${a.x} ${n.y + c} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${n.x} ${a.y - $} ${f} ${n.x + c} ${a.y} L ${a.x} ${a.y}`), n.y > a.y && (t.type === m.MERGE && r.id !== t.parents[0] ? u = `M ${n.x} ${n.y} L ${a.x - $} ${n.y} ${f} ${a.x} ${n.y - c} L ${a.x} ${a.y}` : u = `M ${n.x} ${n.y} L ${n.x} ${a.y + $} ${g} ${n.x + c} ${a.y} L ${a.x} ${a.y}`), n.y === a.y && (u = `M ${n.x} ${n.y} L ${a.x} ${a.y}`));
590
+ if (u === void 0)
591
+ throw new Error("Line definition not found");
592
+ e.append("path").attr("d", u).attr(
593
+ "class",
594
+ "arrow arrow" + H(x, G, i)
595
+ );
596
+ }, "drawArrow"), $r = /* @__PURE__ */ h((e, r) => {
597
+ const t = e.append("g").attr("class", "commit-arrows");
598
+ [...r.keys()].forEach((s) => {
599
+ const o = r.get(s);
600
+ o.parents && o.parents.length > 0 && o.parents.forEach((i) => {
601
+ hr(t, r.get(i), o, r);
602
+ });
603
+ });
604
+ }, "drawArrows"), fr = /* @__PURE__ */ h((e, r, t, s) => {
605
+ const { look: o, theme: i, themeVariables: n } = W(), { dropShadow: a, THEME_COLOR_LIMIT: l } = n, f = j.has(i ?? ""), g = Z.has(i ?? ""), $ = e.append("g");
606
+ r.forEach((c, x) => {
607
+ const u = H(
608
+ x,
609
+ f ? l : G,
610
+ g
611
+ ), p = C.get(c.name)?.pos;
612
+ if (p === void 0)
613
+ throw new Error(`Position not found for branch ${c.name}`);
614
+ const b = y === "TB" || y === "BT" ? p : f ? p + X / 2 + 1 : p - 2, k = $.append("line");
615
+ k.attr("x1", 0), k.attr("y1", b), k.attr("x2", I), k.attr("y2", b), k.attr("class", "branch branch" + u), y === "TB" ? (k.attr("y1", F), k.attr("x1", p), k.attr("y2", I), k.attr("x2", p)) : y === "BT" && (k.attr("y1", I), k.attr("x1", p), k.attr("y2", F), k.attr("x2", p)), z.push(b);
616
+ const U = c.name, D = oe(U), T = $.insert("rect"), M = $.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + u);
617
+ M.node().appendChild(D);
618
+ const v = D.getBBox(), ee = f ? 0 : 4, N = f ? 16 : 0, A = f ? X : 0;
619
+ o === "neo" && T.attr("data-look", "neo"), T.attr("class", "branchLabelBkg label" + u).attr(
620
+ "style",
621
+ o === "neo" ? `filter:${f ? `url(#${s}-drop-shadow)` : a}` : ""
622
+ ).attr("rx", ee).attr("ry", ee).attr("x", -v.width - 4 - (t.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -v.height / 2 + 10).attr("width", v.width + 18 + N).attr("height", v.height + 4 + A), M.attr(
623
+ "transform",
624
+ "translate(" + (-v.width - 14 - (t.rotateCommitLabel === !0 ? 30 : 0) + N / 2) + ", " + (b - v.height / 2 - 2) + ")"
625
+ ), y === "TB" ? (T.attr("x", p - v.width / 2 - 10).attr("y", 0), M.attr("transform", "translate(" + (p - v.width / 2 - 5) + ", 0)"), f && (T.attr("transform", `translate(${-N / 2 - 3}, ${-A - 10})`), M.attr(
626
+ "transform",
627
+ "translate(" + (p - v.width / 2 - 5) + ", " + (-A * 2 + 7) + ")"
628
+ ))) : y === "BT" ? (T.attr("x", p - v.width / 2 - 10).attr("y", I), M.attr("transform", "translate(" + (p - v.width / 2 - 5) + ", " + I + ")"), f && (T.attr("transform", `translate(${-N / 2 - 3}, ${A + 10})`), M.attr(
629
+ "transform",
630
+ "translate(" + (p - v.width / 2 - 5) + ", " + (I + A * 2 + 4) + ")"
631
+ ))) : T.attr("transform", "translate(-19, " + (b - 12 - A / 2) + ")");
632
+ });
633
+ }, "drawBranches"), gr = /* @__PURE__ */ h(function(e, r, t, s, o) {
634
+ return C.set(e, { pos: r, index: t }), r += 50 + (o ? 40 : 0) + (y === "TB" || y === "BT" ? s.width / 2 : 0), r;
635
+ }, "setBranchPosition"), ur = /* @__PURE__ */ h(function(e, r, t, s) {
636
+ Je(), w.debug("in gitgraph renderer", e + `
637
+ `, "id:", r, t);
638
+ const o = s.db;
639
+ if (!o.getConfig) {
640
+ w.error("getConfig method is not available on db");
641
+ return;
642
+ }
643
+ const i = o.getConfig(), n = i.rotateCommitLabel ?? !1;
644
+ q = o.getCommits();
645
+ const a = o.getBranchesAsObjArray();
646
+ y = o.getDirection();
647
+ const l = me(`[id="${r}"]`), { look: f, theme: g, themeVariables: $ } = W(), { useGradient: c, gradientStart: x, gradientStop: u, filterColor: p } = $;
648
+ if (c) {
649
+ const k = l.append("defs").append("linearGradient").attr("id", r + "-gradient").attr("gradientUnits", "objectBoundingBox").attr("x1", "0%").attr("y1", "0%").attr("x2", "100%").attr("y2", "0%");
650
+ k.append("stop").attr("offset", "0%").attr("stop-color", x).attr("stop-opacity", 1), k.append("stop").attr("offset", "100%").attr("stop-color", u).attr("stop-opacity", 1);
651
+ }
652
+ f === "neo" && j.has(g ?? "") && l.append("defs").append("filter").attr("id", r + "-drop-shadow").attr("height", "130%").attr("width", "130%").append("feDropShadow").attr("dx", "4").attr("dy", "4").attr("stdDeviation", 0).attr("flood-opacity", "0.06").attr("flood-color", p);
653
+ let b = 0;
654
+ a.forEach((k, U) => {
655
+ const D = oe(k.name), T = l.append("g"), K = T.insert("g").attr("class", "branchLabel"), M = K.insert("g").attr("class", "label branch-label");
656
+ M.node()?.appendChild(D);
657
+ const v = D.getBBox();
658
+ b = gr(k.name, b, U, v, n), M.remove(), K.remove(), T.remove();
659
+ }), re(l, q, !1, i), i.showBranches && fr(l, a, i, r), $r(l, q), re(l, q, !0, i), pe.insertTitle(
660
+ l,
661
+ "gitTitleText",
662
+ i.titleTopMargin ?? 0,
663
+ o.getDiagramTitle()
664
+ ), be(void 0, l, i.diagramPadding, i.useMaxWidth);
665
+ }, "draw"), yr = {
666
+ draw: ur
667
+ }, ie = 8, de = /* @__PURE__ */ new Set(["redux", "redux-dark", "redux-color", "redux-dark-color"]), xr = /* @__PURE__ */ new Set(["redux-color", "redux-dark-color"]), mr = /* @__PURE__ */ new Set(["neo", "neo-dark"]), pr = /* @__PURE__ */ new Set(["dark", "redux-dark", "redux-dark-color", "neo-dark"]), br = /* @__PURE__ */ new Set([
668
+ "redux",
669
+ "redux-dark",
670
+ "redux-color",
671
+ "redux-dark-color",
672
+ "neo",
673
+ "neo-dark"
674
+ ]), wr = /* @__PURE__ */ h((e) => {
675
+ const { svgId: r } = e;
676
+ let t = "";
677
+ if (e.useGradient && r)
678
+ for (let s = 0; s < e.THEME_COLOR_LIMIT; s++)
679
+ t += `
680
+ .label${s} { fill: ${e.mainBkg}; stroke: url(${r}-gradient); stroke-width: ${e.strokeWidth};}
681
+ `;
682
+ return t;
683
+ }, "genGitGraphGradient"), kr = /* @__PURE__ */ h((e) => {
684
+ const r = J(), { theme: t, themeVariables: s } = r, { borderColorArray: o } = s, i = de.has(t);
685
+ if (mr.has(t)) {
686
+ let n = "";
687
+ for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
688
+ if (a === 0)
689
+ n += `
690
+ .branch-label${a} { fill: ${e.nodeBorder};}
691
+ .commit${a} { stroke: ${e.nodeBorder}; }
692
+ .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.nodeBorder}; }
693
+ .arrow${a} { stroke: ${e.nodeBorder}; }
694
+ .commit-bullets { fill: ${e.nodeBorder}; }
695
+ .commit-cherry-pick${a} { stroke: ${e.nodeBorder}; }
696
+ ${wr(e)}`;
697
+ else {
698
+ const l = a % ie;
699
+ n += `
700
+ .branch-label${a} { fill: ${e["gitBranchLabel" + l]}; }
701
+ .commit${a} { stroke: ${e["git" + l]}; fill: ${e["git" + l]}; }
702
+ .commit-highlight${a} { stroke: ${e["gitInv" + l]}; fill: ${e["gitInv" + l]}; }
703
+ .arrow${a} { stroke: ${e["git" + l]}; }
704
+ `;
705
+ }
706
+ return n;
707
+ } else if (xr.has(t)) {
708
+ let n = "";
709
+ for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
710
+ if (a === 0)
711
+ n += `
712
+ .branch-label${a} { fill: ${e.nodeBorder}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
713
+ .commit${a} { stroke: ${e.nodeBorder}; }
714
+ .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.mainBkg}; }
715
+ .label${a} { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: ${e.strokeWidth}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
716
+ .arrow${a} { stroke: ${e.nodeBorder}; }
717
+ .commit-bullets { fill: ${e.nodeBorder}; }
718
+ `;
719
+ else {
720
+ const l = a % o.length;
721
+ n += `
722
+ .branch-label${a} { fill: ${e.nodeBorder}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
723
+ .commit${a} { stroke: ${o[l]}; fill: ${o[l]}; }
724
+ .commit-highlight${a} { stroke: ${o[l]}; fill: ${o[l]}; }
725
+ .label${a} { fill: ${pr.has(t) ? e.mainBkg : o[l]}; stroke: ${o[l]}; stroke-width: ${e.strokeWidth}; }
726
+ .arrow${a} { stroke: ${o[l]}; }
727
+ `;
728
+ }
729
+ return n;
730
+ } else {
731
+ let n = "";
732
+ for (let a = 0; a < e.THEME_COLOR_LIMIT; a++)
733
+ n += `
734
+ .branch-label${a} { fill: ${e.nodeBorder}; ${i ? `font-weight:${e.noteFontWeight}` : ""} }
735
+ .commit${a} { stroke: ${e.nodeBorder}; }
736
+ .commit-highlight${a} { stroke: ${e.nodeBorder}; fill: ${e.nodeBorder}; }
737
+ .label${a} { fill: ${e.mainBkg}; stroke: ${e.nodeBorder}; stroke-width: ${e.strokeWidth}; ${i ? `font-weight:${e.noteFontWeight}` : ""}}
738
+ .arrow${a} { stroke: ${e.nodeBorder}; }
739
+ .commit-bullets { fill: ${e.nodeBorder}; }
740
+ .commit-cherry-pick${a} { stroke: ${e.nodeBorder}; }
741
+ `;
742
+ return n;
743
+ }
744
+ }, "genColor"), vr = /* @__PURE__ */ h((e) => `${Array.from({ length: e.THEME_COLOR_LIMIT }, (r, t) => t).map((r) => {
745
+ const t = r % ie;
746
+ return `
747
+ .branch-label${r} { fill: ${e["gitBranchLabel" + t]}; }
748
+ .commit${r} { stroke: ${e["git" + t]}; fill: ${e["git" + t]}; }
749
+ .commit-highlight${r} { stroke: ${e["gitInv" + t]}; fill: ${e["gitInv" + t]}; }
750
+ .label${r} { fill: ${e["git" + t]}; }
751
+ .arrow${r} { stroke: ${e["git" + t]}; }
752
+ `;
753
+ }).join(`
754
+ `)}`, "normalTheme"), Cr = /* @__PURE__ */ h((e) => {
755
+ const r = J(), { theme: t } = r, s = br.has(t);
756
+ return `
757
+ .commit-id,
758
+ .commit-msg,
759
+ .branch-label {
760
+ fill: lightgrey;
761
+ color: lightgrey;
762
+ font-family: 'trebuchet ms', verdana, arial, sans-serif;
763
+ font-family: var(--mermaid-font-family);
764
+ }
765
+
766
+ ${s ? kr(e) : vr(e)}
767
+
768
+ .branch {
769
+ stroke-width: ${e.strokeWidth};
770
+ stroke: ${e.commitLineColor ?? e.lineColor};
771
+ stroke-dasharray: ${s ? "4 2" : "2"};
772
+ }
773
+ .commit-label { font-size: ${e.commitLabelFontSize}; fill: ${s ? e.nodeBorder : e.commitLabelColor}; ${s ? `font-weight:${e.noteFontWeight};` : ""}}
774
+ .commit-label-bkg { font-size: ${e.commitLabelFontSize}; fill: ${s ? "transparent" : e.commitLabelBackground}; opacity: ${s ? "" : 0.5}; }
775
+ .tag-label { font-size: ${e.tagLabelFontSize}; fill: ${e.tagLabelColor};}
776
+ .tag-label-bkg { fill: ${s ? e.mainBkg : e.tagLabelBackground}; stroke: ${s ? e.nodeBorder : e.tagLabelBorder}; ${s ? `filter:${e.dropShadow}` : ""} }
777
+ .tag-hole { fill: ${e.textColor}; }
778
+
779
+ .commit-merge {
780
+ stroke: ${s ? e.mainBkg : e.primaryColor};
781
+ fill: ${s ? e.mainBkg : e.primaryColor};
782
+ }
783
+ .commit-reverse {
784
+ stroke: ${s ? e.mainBkg : e.primaryColor};
785
+ fill: ${s ? e.mainBkg : e.primaryColor};
786
+ stroke-width: ${s ? e.strokeWidth : 3};
787
+ }
788
+ .commit-highlight-outer {
789
+ }
790
+ .commit-highlight-inner {
791
+ stroke: ${s ? e.mainBkg : e.primaryColor};
792
+ fill: ${s ? e.mainBkg : e.primaryColor};
793
+ }
794
+
795
+ .arrow {
796
+ /* Intentional: neo themes keep the bold 8px arrow (like classic themes); only redux-geometry themes use the thinner options.strokeWidth. */
797
+ stroke-width: ${de.has(t) ? e.strokeWidth : 8};
798
+ stroke-linecap: round;
799
+ fill: none
800
+ }
801
+ .gitTitleText {
802
+ text-anchor: middle;
803
+ font-size: 18px;
804
+ fill: ${e.textColor};
805
+ }
806
+ `;
807
+ }, "getStyles"), Er = Cr, Rr = {
808
+ parser: Ve,
809
+ db: se,
810
+ renderer: yr,
811
+ styles: Er
812
+ };
813
+ export {
814
+ Rr as diagram
815
+ };