@zjlab-frontier/markdown 1.0.4

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 (53) hide show
  1. package/README.md +148 -0
  2. package/dist/Tableau10-D7jGxypv.mjs +8 -0
  3. package/dist/arc-BkFOiLi7.mjs +84 -0
  4. package/dist/array-CqVTtuYm.mjs +6 -0
  5. package/dist/blockDiagram-c4efeb88-CngVNufX.mjs +1221 -0
  6. package/dist/c4Diagram-c83219d4-CvSWXhSV.mjs +1579 -0
  7. package/dist/channel-BCTzeqLo.mjs +5 -0
  8. package/dist/classDiagram-beda092f-8UkpWDgI.mjs +218 -0
  9. package/dist/classDiagram-v2-2358418a-D3LsBhTm.mjs +200 -0
  10. package/dist/clone-DZgGXtyK.mjs +8 -0
  11. package/dist/createText-1719965b-DMv-Bu7A.mjs +155 -0
  12. package/dist/edges-96097737-BeVwLt3S.mjs +1088 -0
  13. package/dist/erDiagram-0228fc6a-GXXkRZ8r.mjs +929 -0
  14. package/dist/flowDb-c6c81e3f-CrOg5i55.mjs +1126 -0
  15. package/dist/flowDiagram-50d868cf-sXe_oFAW.mjs +788 -0
  16. package/dist/flowDiagram-v2-4f6560a1-CoKYvZkH.mjs +17 -0
  17. package/dist/flowchart-elk-definition-6af322e1-SuvGsuBl.mjs +48146 -0
  18. package/dist/ganttDiagram-a2739b55-BbWq9bqY.mjs +2477 -0
  19. package/dist/gitGraphDiagram-82fe8481-C6-e4UmK.mjs +1264 -0
  20. package/dist/graph-CoIGCRFf.mjs +847 -0
  21. package/dist/index-5325376f-BENBY8aO.mjs +373 -0
  22. package/dist/index-5_ujiRGo.mjs +46276 -0
  23. package/dist/index.css +1 -0
  24. package/dist/index.d.ts +2 -0
  25. package/dist/index.mjs +8 -0
  26. package/dist/index.umd.js +2421 -0
  27. package/dist/infoDiagram-8eee0895-BEAb2pCD.mjs +319 -0
  28. package/dist/init-DjUOC4st.mjs +16 -0
  29. package/dist/journeyDiagram-c64418c1-CERjyYnA.mjs +801 -0
  30. package/dist/layout-aCAVHR2T.mjs +1472 -0
  31. package/dist/line-BGunMwE-.mjs +33 -0
  32. package/dist/linear-DciWi0hE.mjs +423 -0
  33. package/dist/markdown.d.ts +25 -0
  34. package/dist/mindmap-definition-8da855dc-Cc8_U7zD.mjs +21936 -0
  35. package/dist/ordinal-C0oynhte.mjs +61 -0
  36. package/dist/path-DLwuMfdd.mjs +84 -0
  37. package/dist/pieDiagram-a8764435-B00hy7Ez.mjs +500 -0
  38. package/dist/quadrantDiagram-1e28029f-DR7IGAoM.mjs +903 -0
  39. package/dist/requirementDiagram-08caed73-o6N3X3-m.mjs +767 -0
  40. package/dist/sankeyDiagram-a04cb91d-CYF9Ro1W.mjs +802 -0
  41. package/dist/sequenceDiagram-c5b8d532-vz_R7xBU.mjs +2234 -0
  42. package/dist/stateDiagram-1ecb1508-B0YUHnuE.mjs +266 -0
  43. package/dist/stateDiagram-v2-c2b004d7-CDTm1Jfb.mjs +184 -0
  44. package/dist/styles/highlight.scss +115 -0
  45. package/dist/styles/markdown.scss +1163 -0
  46. package/dist/styles-b4e223ce-C_-huVuQ.mjs +1089 -0
  47. package/dist/styles-ca3715f6-soe07Bnw.mjs +960 -0
  48. package/dist/styles-d45a18b0-0ZXwJp5P.mjs +436 -0
  49. package/dist/svgDrawCommon-b86b1483-UCLksviB.mjs +64 -0
  50. package/dist/timeline-definition-faaaa080-Dt5unv7p.mjs +792 -0
  51. package/dist/vite.config.d.ts +2 -0
  52. package/dist/xychartDiagram-f5964ef8-BZWS0E_9.mjs +1282 -0
  53. package/package.json +66 -0
@@ -0,0 +1,929 @@
1
+ import { C as Et, D as mt, a as gt, s as kt, b as xt, c as Rt, g as Z, l as V, d as rt, B as Ot, e as bt, E as Nt, F as Tt, G as At } from "./index-5_ujiRGo.mjs";
2
+ import { G as Mt } from "./graph-CoIGCRFf.mjs";
3
+ import { l as St } from "./layout-aCAVHR2T.mjs";
4
+ import { l as wt } from "./line-BGunMwE-.mjs";
5
+ const It = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
6
+ function Dt(t) {
7
+ return typeof t == "string" && It.test(t);
8
+ }
9
+ const A = [];
10
+ for (let t = 0; t < 256; ++t)
11
+ A.push((t + 256).toString(16).slice(1));
12
+ function vt(t, e = 0) {
13
+ return A[t[e + 0]] + A[t[e + 1]] + A[t[e + 2]] + A[t[e + 3]] + "-" + A[t[e + 4]] + A[t[e + 5]] + "-" + A[t[e + 6]] + A[t[e + 7]] + "-" + A[t[e + 8]] + A[t[e + 9]] + "-" + A[t[e + 10]] + A[t[e + 11]] + A[t[e + 12]] + A[t[e + 13]] + A[t[e + 14]] + A[t[e + 15]];
14
+ }
15
+ function Lt(t) {
16
+ if (!Dt(t))
17
+ throw TypeError("Invalid UUID");
18
+ let e;
19
+ const r = new Uint8Array(16);
20
+ return r[0] = (e = parseInt(t.slice(0, 8), 16)) >>> 24, r[1] = e >>> 16 & 255, r[2] = e >>> 8 & 255, r[3] = e & 255, r[4] = (e = parseInt(t.slice(9, 13), 16)) >>> 8, r[5] = e & 255, r[6] = (e = parseInt(t.slice(14, 18), 16)) >>> 8, r[7] = e & 255, r[8] = (e = parseInt(t.slice(19, 23), 16)) >>> 8, r[9] = e & 255, r[10] = (e = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, r[11] = e / 4294967296 & 255, r[12] = e >>> 24 & 255, r[13] = e >>> 16 & 255, r[14] = e >>> 8 & 255, r[15] = e & 255, r;
21
+ }
22
+ function Bt(t) {
23
+ t = unescape(encodeURIComponent(t));
24
+ const e = [];
25
+ for (let r = 0; r < t.length; ++r)
26
+ e.push(t.charCodeAt(r));
27
+ return e;
28
+ }
29
+ const Ct = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", Pt = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
30
+ function Yt(t, e, r) {
31
+ function u(l, p, f, o) {
32
+ var h;
33
+ if (typeof l == "string" && (l = Bt(l)), typeof p == "string" && (p = Lt(p)), ((h = p) === null || h === void 0 ? void 0 : h.length) !== 16)
34
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
35
+ let _ = new Uint8Array(16 + l.length);
36
+ if (_.set(p), _.set(l, p.length), _ = r(_), _[6] = _[6] & 15 | e, _[8] = _[8] & 63 | 128, f) {
37
+ o = o || 0;
38
+ for (let m = 0; m < 16; ++m)
39
+ f[o + m] = _[m];
40
+ return f;
41
+ }
42
+ return vt(_);
43
+ }
44
+ try {
45
+ u.name = t;
46
+ } catch {
47
+ }
48
+ return u.DNS = Ct, u.URL = Pt, u;
49
+ }
50
+ function Zt(t, e, r, u) {
51
+ switch (t) {
52
+ case 0:
53
+ return e & r ^ ~e & u;
54
+ case 1:
55
+ return e ^ r ^ u;
56
+ case 2:
57
+ return e & r ^ e & u ^ r & u;
58
+ case 3:
59
+ return e ^ r ^ u;
60
+ }
61
+ }
62
+ function it(t, e) {
63
+ return t << e | t >>> 32 - e;
64
+ }
65
+ function Ft(t) {
66
+ const e = [1518500249, 1859775393, 2400959708, 3395469782], r = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
67
+ if (typeof t == "string") {
68
+ const f = unescape(encodeURIComponent(t));
69
+ t = [];
70
+ for (let o = 0; o < f.length; ++o)
71
+ t.push(f.charCodeAt(o));
72
+ } else Array.isArray(t) || (t = Array.prototype.slice.call(t));
73
+ t.push(128);
74
+ const u = t.length / 4 + 2, l = Math.ceil(u / 16), p = new Array(l);
75
+ for (let f = 0; f < l; ++f) {
76
+ const o = new Uint32Array(16);
77
+ for (let h = 0; h < 16; ++h)
78
+ o[h] = t[f * 64 + h * 4] << 24 | t[f * 64 + h * 4 + 1] << 16 | t[f * 64 + h * 4 + 2] << 8 | t[f * 64 + h * 4 + 3];
79
+ p[f] = o;
80
+ }
81
+ p[l - 1][14] = (t.length - 1) * 8 / Math.pow(2, 32), p[l - 1][14] = Math.floor(p[l - 1][14]), p[l - 1][15] = (t.length - 1) * 8 & 4294967295;
82
+ for (let f = 0; f < l; ++f) {
83
+ const o = new Uint32Array(80);
84
+ for (let y = 0; y < 16; ++y)
85
+ o[y] = p[f][y];
86
+ for (let y = 16; y < 80; ++y)
87
+ o[y] = it(o[y - 3] ^ o[y - 8] ^ o[y - 14] ^ o[y - 16], 1);
88
+ let h = r[0], _ = r[1], m = r[2], g = r[3], x = r[4];
89
+ for (let y = 0; y < 80; ++y) {
90
+ const N = Math.floor(y / 20), I = it(h, 5) + Zt(N, _, m, g) + x + e[N] + o[y] >>> 0;
91
+ x = g, g = m, m = it(_, 30) >>> 0, _ = h, h = I;
92
+ }
93
+ r[0] = r[0] + h >>> 0, r[1] = r[1] + _ >>> 0, r[2] = r[2] + m >>> 0, r[3] = r[3] + g >>> 0, r[4] = r[4] + x >>> 0;
94
+ }
95
+ return [r[0] >> 24 & 255, r[0] >> 16 & 255, r[0] >> 8 & 255, r[0] & 255, r[1] >> 24 & 255, r[1] >> 16 & 255, r[1] >> 8 & 255, r[1] & 255, r[2] >> 24 & 255, r[2] >> 16 & 255, r[2] >> 8 & 255, r[2] & 255, r[3] >> 24 & 255, r[3] >> 16 & 255, r[3] >> 8 & 255, r[3] & 255, r[4] >> 24 & 255, r[4] >> 16 & 255, r[4] >> 8 & 255, r[4] & 255];
96
+ }
97
+ const Wt = Yt("v5", 80, Ft);
98
+ var at = (function() {
99
+ var t = function(S, a, n, c) {
100
+ for (n = n || {}, c = S.length; c--; n[S[c]] = a)
101
+ ;
102
+ return n;
103
+ }, e = [6, 8, 10, 20, 22, 24, 26, 27, 28], r = [1, 10], u = [1, 11], l = [1, 12], p = [1, 13], f = [1, 14], o = [1, 15], h = [1, 21], _ = [1, 22], m = [1, 23], g = [1, 24], x = [1, 25], y = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], N = [1, 34], I = [27, 28, 46, 47], F = [41, 42, 43, 44, 45], W = [17, 34], C = [1, 54], T = [1, 53], M = [17, 34, 36, 38], R = {
104
+ trace: function() {
105
+ },
106
+ yy: {},
107
+ symbols_: { error: 2, start: 3, ER_DIAGRAM: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, entityName: 11, relSpec: 12, ":": 13, role: 14, BLOCK_START: 15, attributes: 16, BLOCK_STOP: 17, SQS: 18, SQE: 19, title: 20, title_value: 21, acc_title: 22, acc_title_value: 23, acc_descr: 24, acc_descr_value: 25, acc_descr_multiline_value: 26, ALPHANUM: 27, ENTITY_NAME: 28, attribute: 29, attributeType: 30, attributeName: 31, attributeKeyTypeList: 32, attributeComment: 33, ATTRIBUTE_WORD: 34, attributeKeyType: 35, COMMA: 36, ATTRIBUTE_KEY: 37, COMMENT: 38, cardinality: 39, relType: 40, ZERO_OR_ONE: 41, ZERO_OR_MORE: 42, ONE_OR_MORE: 43, ONLY_ONE: 44, MD_PARENT: 45, NON_IDENTIFYING: 46, IDENTIFYING: 47, WORD: 48, $accept: 0, $end: 1 },
108
+ terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: ":", 15: "BLOCK_START", 17: "BLOCK_STOP", 18: "SQS", 19: "SQE", 20: "title", 21: "title_value", 22: "acc_title", 23: "acc_title_value", 24: "acc_descr", 25: "acc_descr_value", 26: "acc_descr_multiline_value", 27: "ALPHANUM", 28: "ENTITY_NAME", 34: "ATTRIBUTE_WORD", 36: "COMMA", 37: "ATTRIBUTE_KEY", 38: "COMMENT", 41: "ZERO_OR_ONE", 42: "ZERO_OR_MORE", 43: "ONE_OR_MORE", 44: "ONLY_ONE", 45: "MD_PARENT", 46: "NON_IDENTIFYING", 47: "IDENTIFYING", 48: "WORD" },
109
+ productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 4], [9, 3], [9, 1], [9, 7], [9, 6], [9, 4], [9, 2], [9, 2], [9, 2], [9, 1], [11, 1], [11, 1], [16, 1], [16, 2], [29, 2], [29, 3], [29, 3], [29, 4], [30, 1], [31, 1], [32, 1], [32, 3], [35, 1], [33, 1], [12, 3], [39, 1], [39, 1], [39, 1], [39, 1], [39, 1], [40, 1], [40, 1], [14, 1], [14, 1], [14, 1]],
110
+ performAction: function(a, n, c, d, E, i, K) {
111
+ var s = i.length - 1;
112
+ switch (E) {
113
+ case 1:
114
+ break;
115
+ case 2:
116
+ this.$ = [];
117
+ break;
118
+ case 3:
119
+ i[s - 1].push(i[s]), this.$ = i[s - 1];
120
+ break;
121
+ case 4:
122
+ case 5:
123
+ this.$ = i[s];
124
+ break;
125
+ case 6:
126
+ case 7:
127
+ this.$ = [];
128
+ break;
129
+ case 8:
130
+ d.addEntity(i[s - 4]), d.addEntity(i[s - 2]), d.addRelationship(i[s - 4], i[s], i[s - 2], i[s - 3]);
131
+ break;
132
+ case 9:
133
+ d.addEntity(i[s - 3]), d.addAttributes(i[s - 3], i[s - 1]);
134
+ break;
135
+ case 10:
136
+ d.addEntity(i[s - 2]);
137
+ break;
138
+ case 11:
139
+ d.addEntity(i[s]);
140
+ break;
141
+ case 12:
142
+ d.addEntity(i[s - 6], i[s - 4]), d.addAttributes(i[s - 6], i[s - 1]);
143
+ break;
144
+ case 13:
145
+ d.addEntity(i[s - 5], i[s - 3]);
146
+ break;
147
+ case 14:
148
+ d.addEntity(i[s - 3], i[s - 1]);
149
+ break;
150
+ case 15:
151
+ case 16:
152
+ this.$ = i[s].trim(), d.setAccTitle(this.$);
153
+ break;
154
+ case 17:
155
+ case 18:
156
+ this.$ = i[s].trim(), d.setAccDescription(this.$);
157
+ break;
158
+ case 19:
159
+ case 43:
160
+ this.$ = i[s];
161
+ break;
162
+ case 20:
163
+ case 41:
164
+ case 42:
165
+ this.$ = i[s].replace(/"/g, "");
166
+ break;
167
+ case 21:
168
+ case 29:
169
+ this.$ = [i[s]];
170
+ break;
171
+ case 22:
172
+ i[s].push(i[s - 1]), this.$ = i[s];
173
+ break;
174
+ case 23:
175
+ this.$ = { attributeType: i[s - 1], attributeName: i[s] };
176
+ break;
177
+ case 24:
178
+ this.$ = { attributeType: i[s - 2], attributeName: i[s - 1], attributeKeyTypeList: i[s] };
179
+ break;
180
+ case 25:
181
+ this.$ = { attributeType: i[s - 2], attributeName: i[s - 1], attributeComment: i[s] };
182
+ break;
183
+ case 26:
184
+ this.$ = { attributeType: i[s - 3], attributeName: i[s - 2], attributeKeyTypeList: i[s - 1], attributeComment: i[s] };
185
+ break;
186
+ case 27:
187
+ case 28:
188
+ case 31:
189
+ this.$ = i[s];
190
+ break;
191
+ case 30:
192
+ i[s - 2].push(i[s]), this.$ = i[s - 2];
193
+ break;
194
+ case 32:
195
+ this.$ = i[s].replace(/"/g, "");
196
+ break;
197
+ case 33:
198
+ this.$ = { cardA: i[s], relType: i[s - 1], cardB: i[s - 2] };
199
+ break;
200
+ case 34:
201
+ this.$ = d.Cardinality.ZERO_OR_ONE;
202
+ break;
203
+ case 35:
204
+ this.$ = d.Cardinality.ZERO_OR_MORE;
205
+ break;
206
+ case 36:
207
+ this.$ = d.Cardinality.ONE_OR_MORE;
208
+ break;
209
+ case 37:
210
+ this.$ = d.Cardinality.ONLY_ONE;
211
+ break;
212
+ case 38:
213
+ this.$ = d.Cardinality.MD_PARENT;
214
+ break;
215
+ case 39:
216
+ this.$ = d.Identification.NON_IDENTIFYING;
217
+ break;
218
+ case 40:
219
+ this.$ = d.Identification.IDENTIFYING;
220
+ break;
221
+ }
222
+ },
223
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: r, 22: u, 24: l, 26: p, 27: f, 28: o }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 16, 11: 9, 20: r, 22: u, 24: l, 26: p, 27: f, 28: o }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: h, 42: _, 43: m, 44: g, 45: x }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, t(e, [2, 18]), t(y, [2, 19]), t(y, [2, 20]), t(e, [2, 4]), { 11: 29, 27: f, 28: o }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: N }, { 11: 35, 27: f, 28: o }, { 40: 36, 46: [1, 37], 47: [1, 38] }, t(I, [2, 34]), t(I, [2, 35]), t(I, [2, 36]), t(I, [2, 37]), t(I, [2, 38]), t(e, [2, 15]), t(e, [2, 16]), t(e, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, t(e, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: N }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: h, 42: _, 43: m, 44: g, 45: x }, t(F, [2, 39]), t(F, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, t(e, [2, 9]), { 17: [2, 22] }, t(W, [2, 23], { 32: 50, 33: 51, 35: 52, 37: C, 38: T }), t([17, 34, 37, 38], [2, 28]), t(e, [2, 14], { 15: [1, 55] }), t([27, 28], [2, 33]), t(e, [2, 8]), t(e, [2, 41]), t(e, [2, 42]), t(e, [2, 43]), t(W, [2, 24], { 33: 56, 36: [1, 57], 38: T }), t(W, [2, 25]), t(M, [2, 29]), t(W, [2, 32]), t(M, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: N }, t(W, [2, 26]), { 35: 60, 37: C }, { 17: [1, 61] }, t(e, [2, 13]), t(M, [2, 30]), t(e, [2, 12])],
224
+ defaultActions: { 34: [2, 27], 41: [2, 22] },
225
+ parseError: function(a, n) {
226
+ if (n.recoverable)
227
+ this.trace(a);
228
+ else {
229
+ var c = new Error(a);
230
+ throw c.hash = n, c;
231
+ }
232
+ },
233
+ parse: function(a) {
234
+ var n = this, c = [0], d = [], E = [null], i = [], K = this.table, s = "", Q = 0, st = 0, ft = 2, ot = 1, yt = i.slice.call(arguments, 1), b = Object.create(this.lexer), G = { yy: {} };
235
+ for (var J in this.yy)
236
+ Object.prototype.hasOwnProperty.call(this.yy, J) && (G.yy[J] = this.yy[J]);
237
+ b.setInput(a, G.yy), G.yy.lexer = b, G.yy.parser = this, typeof b.yylloc > "u" && (b.yylloc = {});
238
+ var $ = b.yylloc;
239
+ i.push($);
240
+ var pt = b.options && b.options.ranges;
241
+ typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
242
+ function _t() {
243
+ var Y;
244
+ return Y = d.pop() || b.lex() || ot, typeof Y != "number" && (Y instanceof Array && (d = Y, Y = d.pop()), Y = n.symbols_[Y] || Y), Y;
245
+ }
246
+ for (var w, H, D, tt, z = {}, j, P, lt, q; ; ) {
247
+ if (H = c[c.length - 1], this.defaultActions[H] ? D = this.defaultActions[H] : ((w === null || typeof w > "u") && (w = _t()), D = K[H] && K[H][w]), typeof D > "u" || !D.length || !D[0]) {
248
+ var et = "";
249
+ q = [];
250
+ for (j in K[H])
251
+ this.terminals_[j] && j > ft && q.push("'" + this.terminals_[j] + "'");
252
+ b.showPosition ? et = "Parse error on line " + (Q + 1) + `:
253
+ ` + b.showPosition() + `
254
+ Expecting ` + q.join(", ") + ", got '" + (this.terminals_[w] || w) + "'" : et = "Parse error on line " + (Q + 1) + ": Unexpected " + (w == ot ? "end of input" : "'" + (this.terminals_[w] || w) + "'"), this.parseError(et, {
255
+ text: b.match,
256
+ token: this.terminals_[w] || w,
257
+ line: b.yylineno,
258
+ loc: $,
259
+ expected: q
260
+ });
261
+ }
262
+ if (D[0] instanceof Array && D.length > 1)
263
+ throw new Error("Parse Error: multiple actions possible at state: " + H + ", token: " + w);
264
+ switch (D[0]) {
265
+ case 1:
266
+ c.push(w), E.push(b.yytext), i.push(b.yylloc), c.push(D[1]), w = null, st = b.yyleng, s = b.yytext, Q = b.yylineno, $ = b.yylloc;
267
+ break;
268
+ case 2:
269
+ if (P = this.productions_[D[1]][1], z.$ = E[E.length - P], z._$ = {
270
+ first_line: i[i.length - (P || 1)].first_line,
271
+ last_line: i[i.length - 1].last_line,
272
+ first_column: i[i.length - (P || 1)].first_column,
273
+ last_column: i[i.length - 1].last_column
274
+ }, pt && (z._$.range = [
275
+ i[i.length - (P || 1)].range[0],
276
+ i[i.length - 1].range[1]
277
+ ]), tt = this.performAction.apply(z, [
278
+ s,
279
+ st,
280
+ Q,
281
+ G.yy,
282
+ D[1],
283
+ E,
284
+ i
285
+ ].concat(yt)), typeof tt < "u")
286
+ return tt;
287
+ P && (c = c.slice(0, -1 * P * 2), E = E.slice(0, -1 * P), i = i.slice(0, -1 * P)), c.push(this.productions_[D[1]][0]), E.push(z.$), i.push(z._$), lt = K[c[c.length - 2]][c[c.length - 1]], c.push(lt);
288
+ break;
289
+ case 3:
290
+ return !0;
291
+ }
292
+ }
293
+ return !0;
294
+ }
295
+ }, O = /* @__PURE__ */ (function() {
296
+ var S = {
297
+ EOF: 1,
298
+ parseError: function(n, c) {
299
+ if (this.yy.parser)
300
+ this.yy.parser.parseError(n, c);
301
+ else
302
+ throw new Error(n);
303
+ },
304
+ // resets the lexer, sets new input
305
+ setInput: function(a, n) {
306
+ return this.yy = n || this.yy || {}, this._input = a, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
307
+ first_line: 1,
308
+ first_column: 0,
309
+ last_line: 1,
310
+ last_column: 0
311
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
312
+ },
313
+ // consumes and returns one char from the input
314
+ input: function() {
315
+ var a = this._input[0];
316
+ this.yytext += a, this.yyleng++, this.offset++, this.match += a, this.matched += a;
317
+ var n = a.match(/(?:\r\n?|\n).*/g);
318
+ return n ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), a;
319
+ },
320
+ // unshifts one char (or a string) into the input
321
+ unput: function(a) {
322
+ var n = a.length, c = a.split(/(?:\r\n?|\n)/g);
323
+ this._input = a + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - n), this.offset -= n;
324
+ var d = this.match.split(/(?:\r\n?|\n)/g);
325
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), c.length - 1 && (this.yylineno -= c.length - 1);
326
+ var E = this.yylloc.range;
327
+ return this.yylloc = {
328
+ first_line: this.yylloc.first_line,
329
+ last_line: this.yylineno + 1,
330
+ first_column: this.yylloc.first_column,
331
+ last_column: c ? (c.length === d.length ? this.yylloc.first_column : 0) + d[d.length - c.length].length - c[0].length : this.yylloc.first_column - n
332
+ }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - n]), this.yyleng = this.yytext.length, this;
333
+ },
334
+ // When called from action, caches matched text and appends it on next action
335
+ more: function() {
336
+ return this._more = !0, this;
337
+ },
338
+ // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
339
+ reject: function() {
340
+ if (this.options.backtrack_lexer)
341
+ this._backtrack = !0;
342
+ else
343
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
344
+ ` + this.showPosition(), {
345
+ text: "",
346
+ token: null,
347
+ line: this.yylineno
348
+ });
349
+ return this;
350
+ },
351
+ // retain first n characters of the match
352
+ less: function(a) {
353
+ this.unput(this.match.slice(a));
354
+ },
355
+ // displays already matched input, i.e. for error messages
356
+ pastInput: function() {
357
+ var a = this.matched.substr(0, this.matched.length - this.match.length);
358
+ return (a.length > 20 ? "..." : "") + a.substr(-20).replace(/\n/g, "");
359
+ },
360
+ // displays upcoming input, i.e. for error messages
361
+ upcomingInput: function() {
362
+ var a = this.match;
363
+ return a.length < 20 && (a += this._input.substr(0, 20 - a.length)), (a.substr(0, 20) + (a.length > 20 ? "..." : "")).replace(/\n/g, "");
364
+ },
365
+ // displays the character position where the lexing error occurred, i.e. for error messages
366
+ showPosition: function() {
367
+ var a = this.pastInput(), n = new Array(a.length + 1).join("-");
368
+ return a + this.upcomingInput() + `
369
+ ` + n + "^";
370
+ },
371
+ // test the lexed token: return FALSE when not a match, otherwise return token
372
+ test_match: function(a, n) {
373
+ var c, d, E;
374
+ if (this.options.backtrack_lexer && (E = {
375
+ yylineno: this.yylineno,
376
+ yylloc: {
377
+ first_line: this.yylloc.first_line,
378
+ last_line: this.last_line,
379
+ first_column: this.yylloc.first_column,
380
+ last_column: this.yylloc.last_column
381
+ },
382
+ yytext: this.yytext,
383
+ match: this.match,
384
+ matches: this.matches,
385
+ matched: this.matched,
386
+ yyleng: this.yyleng,
387
+ offset: this.offset,
388
+ _more: this._more,
389
+ _input: this._input,
390
+ yy: this.yy,
391
+ conditionStack: this.conditionStack.slice(0),
392
+ done: this.done
393
+ }, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), d = a[0].match(/(?:\r\n?|\n).*/g), d && (this.yylineno += d.length), this.yylloc = {
394
+ first_line: this.yylloc.last_line,
395
+ last_line: this.yylineno + 1,
396
+ first_column: this.yylloc.last_column,
397
+ last_column: d ? d[d.length - 1].length - d[d.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + a[0].length
398
+ }, this.yytext += a[0], this.match += a[0], this.matches = a, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(a[0].length), this.matched += a[0], c = this.performAction.call(this, this.yy, this, n, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), c)
399
+ return c;
400
+ if (this._backtrack) {
401
+ for (var i in E)
402
+ this[i] = E[i];
403
+ return !1;
404
+ }
405
+ return !1;
406
+ },
407
+ // return next match in input
408
+ next: function() {
409
+ if (this.done)
410
+ return this.EOF;
411
+ this._input || (this.done = !0);
412
+ var a, n, c, d;
413
+ this._more || (this.yytext = "", this.match = "");
414
+ for (var E = this._currentRules(), i = 0; i < E.length; i++)
415
+ if (c = this._input.match(this.rules[E[i]]), c && (!n || c[0].length > n[0].length)) {
416
+ if (n = c, d = i, this.options.backtrack_lexer) {
417
+ if (a = this.test_match(c, E[i]), a !== !1)
418
+ return a;
419
+ if (this._backtrack) {
420
+ n = !1;
421
+ continue;
422
+ } else
423
+ return !1;
424
+ } else if (!this.options.flex)
425
+ break;
426
+ }
427
+ return n ? (a = this.test_match(n, E[d]), a !== !1 ? a : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
428
+ ` + this.showPosition(), {
429
+ text: "",
430
+ token: null,
431
+ line: this.yylineno
432
+ });
433
+ },
434
+ // return next match that has a token
435
+ lex: function() {
436
+ var n = this.next();
437
+ return n || this.lex();
438
+ },
439
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
440
+ begin: function(n) {
441
+ this.conditionStack.push(n);
442
+ },
443
+ // pop the previously active lexer condition state off the condition stack
444
+ popState: function() {
445
+ var n = this.conditionStack.length - 1;
446
+ return n > 0 ? this.conditionStack.pop() : this.conditionStack[0];
447
+ },
448
+ // produce the lexer rule set which is active for the currently active lexer condition state
449
+ _currentRules: function() {
450
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
451
+ },
452
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
453
+ topState: function(n) {
454
+ return n = this.conditionStack.length - 1 - Math.abs(n || 0), n >= 0 ? this.conditionStack[n] : "INITIAL";
455
+ },
456
+ // alias for begin(condition)
457
+ pushState: function(n) {
458
+ this.begin(n);
459
+ },
460
+ // return the number of states currently on the stack
461
+ stateStackSize: function() {
462
+ return this.conditionStack.length;
463
+ },
464
+ options: { "case-insensitive": !0 },
465
+ performAction: function(n, c, d, E) {
466
+ switch (d) {
467
+ case 0:
468
+ return this.begin("acc_title"), 22;
469
+ case 1:
470
+ return this.popState(), "acc_title_value";
471
+ case 2:
472
+ return this.begin("acc_descr"), 24;
473
+ case 3:
474
+ return this.popState(), "acc_descr_value";
475
+ case 4:
476
+ this.begin("acc_descr_multiline");
477
+ break;
478
+ case 5:
479
+ this.popState();
480
+ break;
481
+ case 6:
482
+ return "acc_descr_multiline_value";
483
+ case 7:
484
+ return 10;
485
+ case 8:
486
+ break;
487
+ case 9:
488
+ return 8;
489
+ case 10:
490
+ return 28;
491
+ case 11:
492
+ return 48;
493
+ case 12:
494
+ return 4;
495
+ case 13:
496
+ return this.begin("block"), 15;
497
+ case 14:
498
+ return 36;
499
+ case 15:
500
+ break;
501
+ case 16:
502
+ return 37;
503
+ case 17:
504
+ return 34;
505
+ case 18:
506
+ return 34;
507
+ case 19:
508
+ return 38;
509
+ case 20:
510
+ break;
511
+ case 21:
512
+ return this.popState(), 17;
513
+ case 22:
514
+ return c.yytext[0];
515
+ case 23:
516
+ return 18;
517
+ case 24:
518
+ return 19;
519
+ case 25:
520
+ return 41;
521
+ case 26:
522
+ return 43;
523
+ case 27:
524
+ return 43;
525
+ case 28:
526
+ return 43;
527
+ case 29:
528
+ return 41;
529
+ case 30:
530
+ return 41;
531
+ case 31:
532
+ return 42;
533
+ case 32:
534
+ return 42;
535
+ case 33:
536
+ return 42;
537
+ case 34:
538
+ return 42;
539
+ case 35:
540
+ return 42;
541
+ case 36:
542
+ return 43;
543
+ case 37:
544
+ return 42;
545
+ case 38:
546
+ return 43;
547
+ case 39:
548
+ return 44;
549
+ case 40:
550
+ return 44;
551
+ case 41:
552
+ return 44;
553
+ case 42:
554
+ return 44;
555
+ case 43:
556
+ return 41;
557
+ case 44:
558
+ return 42;
559
+ case 45:
560
+ return 43;
561
+ case 46:
562
+ return 45;
563
+ case 47:
564
+ return 46;
565
+ case 48:
566
+ return 47;
567
+ case 49:
568
+ return 47;
569
+ case 50:
570
+ return 46;
571
+ case 51:
572
+ return 46;
573
+ case 52:
574
+ return 46;
575
+ case 53:
576
+ return 27;
577
+ case 54:
578
+ return c.yytext[0];
579
+ case 55:
580
+ return 6;
581
+ }
582
+ },
583
+ rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
584
+ conditions: { acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, block: { rules: [14, 15, 16, 17, 18, 19, 20, 21, 22], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55], inclusive: !0 } }
585
+ };
586
+ return S;
587
+ })();
588
+ R.lexer = O;
589
+ function v() {
590
+ this.yy = {};
591
+ }
592
+ return v.prototype = R, R.Parser = v, new v();
593
+ })();
594
+ at.parser = at;
595
+ const Ut = at;
596
+ let U = {}, nt = [];
597
+ const Gt = {
598
+ ZERO_OR_ONE: "ZERO_OR_ONE",
599
+ ZERO_OR_MORE: "ZERO_OR_MORE",
600
+ ONE_OR_MORE: "ONE_OR_MORE",
601
+ ONLY_ONE: "ONLY_ONE",
602
+ MD_PARENT: "MD_PARENT"
603
+ }, Ht = {
604
+ NON_IDENTIFYING: "NON_IDENTIFYING",
605
+ IDENTIFYING: "IDENTIFYING"
606
+ }, dt = function(t, e = void 0) {
607
+ return U[t] === void 0 ? (U[t] = { attributes: [], alias: e }, V.info("Added new entity :", t)) : U[t] && !U[t].alias && e && (U[t].alias = e, V.info(`Add alias '${e}' to entity '${t}'`)), U[t];
608
+ }, zt = () => U, Kt = function(t, e) {
609
+ let r = dt(t), u;
610
+ for (u = e.length - 1; u >= 0; u--)
611
+ r.attributes.push(e[u]), V.debug("Added attribute ", e[u].attributeName);
612
+ }, Vt = function(t, e, r, u) {
613
+ let l = {
614
+ entityA: t,
615
+ roleA: e,
616
+ entityB: r,
617
+ relSpec: u
618
+ };
619
+ nt.push(l), V.debug("Added new relationship :", l);
620
+ }, Xt = () => nt, Qt = function() {
621
+ U = {}, nt = [], Nt();
622
+ }, jt = {
623
+ Cardinality: Gt,
624
+ Identification: Ht,
625
+ getConfig: () => Z().er,
626
+ addEntity: dt,
627
+ addAttributes: Kt,
628
+ getEntities: zt,
629
+ addRelationship: Vt,
630
+ getRelationships: Xt,
631
+ clear: Qt,
632
+ setAccTitle: Rt,
633
+ getAccTitle: xt,
634
+ setAccDescription: kt,
635
+ getAccDescription: gt,
636
+ setDiagramTitle: mt,
637
+ getDiagramTitle: Et
638
+ }, L = {
639
+ ONLY_ONE_START: "ONLY_ONE_START",
640
+ ONLY_ONE_END: "ONLY_ONE_END",
641
+ ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
642
+ ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
643
+ ONE_OR_MORE_START: "ONE_OR_MORE_START",
644
+ ONE_OR_MORE_END: "ONE_OR_MORE_END",
645
+ ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
646
+ ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
647
+ MD_PARENT_END: "MD_PARENT_END",
648
+ MD_PARENT_START: "MD_PARENT_START"
649
+ }, qt = function(t, e) {
650
+ let r;
651
+ t.append("defs").append("marker").attr("id", L.MD_PARENT_START).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", L.MD_PARENT_END).attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", L.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18"), t.append("defs").append("marker").attr("id", L.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,0 L21,18"), t.append("defs").append("marker").attr("id", L.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"), t.append("defs").append("marker").attr("id", L.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18"), r = t.append("defs").append("marker").attr("id", L.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), r.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), r.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
652
+ }, B = {
653
+ ERMarkers: L,
654
+ insertMarkers: qt
655
+ }, Jt = /[^\dA-Za-z](\W)*/g;
656
+ let k = {}, X = /* @__PURE__ */ new Map();
657
+ const $t = function(t) {
658
+ const e = Object.keys(t);
659
+ for (const r of e)
660
+ k[r] = t[r];
661
+ }, te = (t, e, r) => {
662
+ const u = k.entityPadding / 3, l = k.entityPadding / 3, p = k.fontSize * 0.85, f = e.node().getBBox(), o = [];
663
+ let h = !1, _ = !1, m = 0, g = 0, x = 0, y = 0, N = f.height + u * 2, I = 1;
664
+ r.forEach((T) => {
665
+ T.attributeKeyTypeList !== void 0 && T.attributeKeyTypeList.length > 0 && (h = !0), T.attributeComment !== void 0 && (_ = !0);
666
+ }), r.forEach((T) => {
667
+ const M = `${e.node().id}-attr-${I}`;
668
+ let R = 0;
669
+ const O = At(T.attributeType), v = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(O), S = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(T.attributeName), a = {};
670
+ a.tn = v, a.nn = S;
671
+ const n = v.node().getBBox(), c = S.node().getBBox();
672
+ if (m = Math.max(m, n.width), g = Math.max(g, c.width), R = Math.max(n.height, c.height), h) {
673
+ const d = T.attributeKeyTypeList !== void 0 ? T.attributeKeyTypeList.join(",") : "", E = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(d);
674
+ a.kn = E;
675
+ const i = E.node().getBBox();
676
+ x = Math.max(x, i.width), R = Math.max(R, i.height);
677
+ }
678
+ if (_) {
679
+ const d = t.append("text").classed("er entityLabel", !0).attr("id", `${M}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Z().fontFamily).style("font-size", p + "px").text(T.attributeComment || "");
680
+ a.cn = d;
681
+ const E = d.node().getBBox();
682
+ y = Math.max(y, E.width), R = Math.max(R, E.height);
683
+ }
684
+ a.height = R, o.push(a), N += R + u * 2, I += 1;
685
+ });
686
+ let F = 4;
687
+ h && (F += 2), _ && (F += 2);
688
+ const W = m + g + x + y, C = {
689
+ width: Math.max(
690
+ k.minEntityWidth,
691
+ Math.max(
692
+ f.width + k.entityPadding * 2,
693
+ W + l * F
694
+ )
695
+ ),
696
+ height: r.length > 0 ? N : Math.max(k.minEntityHeight, f.height + k.entityPadding * 2)
697
+ };
698
+ if (r.length > 0) {
699
+ const T = Math.max(
700
+ 0,
701
+ (C.width - W - l * F) / (F / 2)
702
+ );
703
+ e.attr(
704
+ "transform",
705
+ "translate(" + C.width / 2 + "," + (u + f.height / 2) + ")"
706
+ );
707
+ let M = f.height + u * 2, R = "attributeBoxOdd";
708
+ o.forEach((O) => {
709
+ const v = M + u + O.height / 2;
710
+ O.tn.attr("transform", "translate(" + l + "," + v + ")");
711
+ const S = t.insert("rect", "#" + O.tn.node().id).classed(`er ${R}`, !0).attr("x", 0).attr("y", M).attr("width", m + l * 2 + T).attr("height", O.height + u * 2), a = parseFloat(S.attr("x")) + parseFloat(S.attr("width"));
712
+ O.nn.attr(
713
+ "transform",
714
+ "translate(" + (a + l) + "," + v + ")"
715
+ );
716
+ const n = t.insert("rect", "#" + O.nn.node().id).classed(`er ${R}`, !0).attr("x", a).attr("y", M).attr("width", g + l * 2 + T).attr("height", O.height + u * 2);
717
+ let c = parseFloat(n.attr("x")) + parseFloat(n.attr("width"));
718
+ if (h) {
719
+ O.kn.attr(
720
+ "transform",
721
+ "translate(" + (c + l) + "," + v + ")"
722
+ );
723
+ const d = t.insert("rect", "#" + O.kn.node().id).classed(`er ${R}`, !0).attr("x", c).attr("y", M).attr("width", x + l * 2 + T).attr("height", O.height + u * 2);
724
+ c = parseFloat(d.attr("x")) + parseFloat(d.attr("width"));
725
+ }
726
+ _ && (O.cn.attr(
727
+ "transform",
728
+ "translate(" + (c + l) + "," + v + ")"
729
+ ), t.insert("rect", "#" + O.cn.node().id).classed(`er ${R}`, "true").attr("x", c).attr("y", M).attr("width", y + l * 2 + T).attr("height", O.height + u * 2)), M += O.height + u * 2, R = R === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
730
+ });
731
+ } else
732
+ C.height = Math.max(k.minEntityHeight, N), e.attr("transform", "translate(" + C.width / 2 + "," + C.height / 2 + ")");
733
+ return C;
734
+ }, ee = function(t, e, r) {
735
+ const u = Object.keys(e);
736
+ let l;
737
+ return u.forEach(function(p) {
738
+ const f = oe(p, "entity");
739
+ X.set(p, f);
740
+ const o = t.append("g").attr("id", f);
741
+ l = l === void 0 ? f : l;
742
+ const h = "text-" + f, _ = o.append("text").classed("er entityLabel", !0).attr("id", h).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", Z().fontFamily).style("font-size", k.fontSize + "px").text(e[p].alias ?? p), { width: m, height: g } = te(
743
+ o,
744
+ _,
745
+ e[p].attributes
746
+ ), y = o.insert("rect", "#" + h).classed("er entityBox", !0).attr("x", 0).attr("y", 0).attr("width", m).attr("height", g).node().getBBox();
747
+ r.setNode(f, {
748
+ width: y.width,
749
+ height: y.height,
750
+ shape: "rect",
751
+ id: f
752
+ });
753
+ }), l;
754
+ }, re = function(t, e) {
755
+ e.nodes().forEach(function(r) {
756
+ r !== void 0 && e.node(r) !== void 0 && t.select("#" + r).attr(
757
+ "transform",
758
+ "translate(" + (e.node(r).x - e.node(r).width / 2) + "," + (e.node(r).y - e.node(r).height / 2) + " )"
759
+ );
760
+ });
761
+ }, ut = function(t) {
762
+ return (t.entityA + t.roleA + t.entityB).replace(/\s/g, "");
763
+ }, ie = function(t, e) {
764
+ return t.forEach(function(r) {
765
+ e.setEdge(
766
+ X.get(r.entityA),
767
+ X.get(r.entityB),
768
+ { relationship: r },
769
+ ut(r)
770
+ );
771
+ }), t;
772
+ };
773
+ let ct = 0;
774
+ const ae = function(t, e, r, u, l) {
775
+ ct++;
776
+ const p = r.edge(
777
+ X.get(e.entityA),
778
+ X.get(e.entityB),
779
+ ut(e)
780
+ ), f = wt().x(function(N) {
781
+ return N.x;
782
+ }).y(function(N) {
783
+ return N.y;
784
+ }).curve(Tt), o = t.insert("path", "#" + u).classed("er relationshipLine", !0).attr("d", f(p.points)).style("stroke", k.stroke).style("fill", "none");
785
+ e.relSpec.relType === l.db.Identification.NON_IDENTIFYING && o.attr("stroke-dasharray", "8,8");
786
+ let h = "";
787
+ switch (k.arrowMarkerAbsolute && (h = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, h = h.replace(/\(/g, "\\("), h = h.replace(/\)/g, "\\)")), e.relSpec.cardA) {
788
+ case l.db.Cardinality.ZERO_OR_ONE:
789
+ o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ZERO_OR_ONE_END + ")");
790
+ break;
791
+ case l.db.Cardinality.ZERO_OR_MORE:
792
+ o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ZERO_OR_MORE_END + ")");
793
+ break;
794
+ case l.db.Cardinality.ONE_OR_MORE:
795
+ o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ONE_OR_MORE_END + ")");
796
+ break;
797
+ case l.db.Cardinality.ONLY_ONE:
798
+ o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.ONLY_ONE_END + ")");
799
+ break;
800
+ case l.db.Cardinality.MD_PARENT:
801
+ o.attr("marker-end", "url(" + h + "#" + B.ERMarkers.MD_PARENT_END + ")");
802
+ break;
803
+ }
804
+ switch (e.relSpec.cardB) {
805
+ case l.db.Cardinality.ZERO_OR_ONE:
806
+ o.attr(
807
+ "marker-start",
808
+ "url(" + h + "#" + B.ERMarkers.ZERO_OR_ONE_START + ")"
809
+ );
810
+ break;
811
+ case l.db.Cardinality.ZERO_OR_MORE:
812
+ o.attr(
813
+ "marker-start",
814
+ "url(" + h + "#" + B.ERMarkers.ZERO_OR_MORE_START + ")"
815
+ );
816
+ break;
817
+ case l.db.Cardinality.ONE_OR_MORE:
818
+ o.attr(
819
+ "marker-start",
820
+ "url(" + h + "#" + B.ERMarkers.ONE_OR_MORE_START + ")"
821
+ );
822
+ break;
823
+ case l.db.Cardinality.ONLY_ONE:
824
+ o.attr("marker-start", "url(" + h + "#" + B.ERMarkers.ONLY_ONE_START + ")");
825
+ break;
826
+ case l.db.Cardinality.MD_PARENT:
827
+ o.attr("marker-start", "url(" + h + "#" + B.ERMarkers.MD_PARENT_START + ")");
828
+ break;
829
+ }
830
+ const _ = o.node().getTotalLength(), m = o.node().getPointAtLength(_ * 0.5), g = "rel" + ct, y = t.append("text").classed("er relationshipLabel", !0).attr("id", g).attr("x", m.x).attr("y", m.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", Z().fontFamily).style("font-size", k.fontSize + "px").text(e.roleA).node().getBBox();
831
+ t.insert("rect", "#" + g).classed("er relationshipLabelBox", !0).attr("x", m.x - y.width / 2).attr("y", m.y - y.height / 2).attr("width", y.width).attr("height", y.height);
832
+ }, ne = function(t, e, r, u) {
833
+ k = Z().er, V.info("Drawing ER diagram");
834
+ const l = Z().securityLevel;
835
+ let p;
836
+ l === "sandbox" && (p = rt("#i" + e));
837
+ const o = (l === "sandbox" ? rt(p.nodes()[0].contentDocument.body) : rt("body")).select(`[id='${e}']`);
838
+ B.insertMarkers(o, k);
839
+ let h;
840
+ h = new Mt({
841
+ multigraph: !0,
842
+ directed: !0,
843
+ compound: !1
844
+ }).setGraph({
845
+ rankdir: k.layoutDirection,
846
+ marginx: 20,
847
+ marginy: 20,
848
+ nodesep: 100,
849
+ edgesep: 100,
850
+ ranksep: 100
851
+ }).setDefaultEdgeLabel(function() {
852
+ return {};
853
+ });
854
+ const _ = ee(o, u.db.getEntities(), h), m = ie(u.db.getRelationships(), h);
855
+ St(h), re(o, h), m.forEach(function(I) {
856
+ ae(o, I, h, _, u);
857
+ });
858
+ const g = k.diagramPadding;
859
+ Ot.insertTitle(o, "entityTitleText", k.titleTopMargin, u.db.getDiagramTitle());
860
+ const x = o.node().getBBox(), y = x.width + g * 2, N = x.height + g * 2;
861
+ bt(o, N, y, k.useMaxWidth), o.attr("viewBox", `${x.x - g} ${x.y - g} ${y} ${N}`);
862
+ }, se = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
863
+ function oe(t = "", e = "") {
864
+ const r = t.replace(Jt, "");
865
+ return `${ht(e)}${ht(r)}${Wt(
866
+ t,
867
+ se
868
+ )}`;
869
+ }
870
+ function ht(t = "") {
871
+ return t.length > 0 ? `${t}-` : "";
872
+ }
873
+ const le = {
874
+ setConf: $t,
875
+ draw: ne
876
+ }, ce = (t) => `
877
+ .entityBox {
878
+ fill: ${t.mainBkg};
879
+ stroke: ${t.nodeBorder};
880
+ }
881
+
882
+ .attributeBoxOdd {
883
+ fill: ${t.attributeBackgroundColorOdd};
884
+ stroke: ${t.nodeBorder};
885
+ }
886
+
887
+ .attributeBoxEven {
888
+ fill: ${t.attributeBackgroundColorEven};
889
+ stroke: ${t.nodeBorder};
890
+ }
891
+
892
+ .relationshipLabelBox {
893
+ fill: ${t.tertiaryColor};
894
+ opacity: 0.7;
895
+ background-color: ${t.tertiaryColor};
896
+ rect {
897
+ opacity: 0.5;
898
+ }
899
+ }
900
+
901
+ .relationshipLine {
902
+ stroke: ${t.lineColor};
903
+ }
904
+
905
+ .entityTitleText {
906
+ text-anchor: middle;
907
+ font-size: 18px;
908
+ fill: ${t.textColor};
909
+ }
910
+ #MD_PARENT_START {
911
+ fill: #f5f5f5 !important;
912
+ stroke: ${t.lineColor} !important;
913
+ stroke-width: 1;
914
+ }
915
+ #MD_PARENT_END {
916
+ fill: #f5f5f5 !important;
917
+ stroke: ${t.lineColor} !important;
918
+ stroke-width: 1;
919
+ }
920
+
921
+ `, he = ce, pe = {
922
+ parser: Ut,
923
+ db: jt,
924
+ renderer: le,
925
+ styles: he
926
+ };
927
+ export {
928
+ pe as diagram
929
+ };