smart-chat-asp 2.11.1

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