lowcoder-comps 0.0.7 → 0.0.8

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 (79) hide show
  1. package/icons/icon-chart.svg +15 -0
  2. package/icons/icon-comp-calendar.svg +22 -0
  3. package/index.html +26 -0
  4. package/index.tsx +19 -0
  5. package/jest.config.js +5 -0
  6. package/package/012a06bb.js +34 -0
  7. package/package/06481cb7.js +1060 -0
  8. package/package/0c8b29d5.js +6 -0
  9. package/package/114884df.js +805 -0
  10. package/package/1264ddb2.js +194 -0
  11. package/package/1cee31ec.js +1095 -0
  12. package/package/269c3ba3.js +46662 -0
  13. package/package/2a2c2e55.js +799 -0
  14. package/package/2b3ab1e4.js +98763 -0
  15. package/package/37590a81.js +967 -0
  16. package/package/3cd7980e.js +184 -0
  17. package/package/40112498.js +424 -0
  18. package/package/4b6e1d6f.js +24 -0
  19. package/package/4bc1082b.js +86 -0
  20. package/package/53e49f9b.js +1600 -0
  21. package/package/55bd5c26.js +266 -0
  22. package/package/591684c8.js +2071 -0
  23. package/package/6c000872.js +16 -0
  24. package/package/756addec.js +775 -0
  25. package/package/7668124e.js +8 -0
  26. package/package/79e8eeeb.js +949 -0
  27. package/package/926fbfec.js +91 -0
  28. package/package/945eefb3.js +2665 -0
  29. package/package/a35f148e.js +1228 -0
  30. package/package/a4d12a43.js +175 -0
  31. package/package/a60de5d1.js +804 -0
  32. package/package/a8dde1ea.js +589 -0
  33. package/package/b4148642.js +7 -0
  34. package/package/b7dd22a2.js +847 -0
  35. package/package/d4f3a2c4.js +18046 -0
  36. package/package/e0f479f3.js +91 -0
  37. package/package/eaa160c9.js +341 -0
  38. package/package/f1bfd8b5.js +311 -0
  39. package/package/f1f9ba79.js +900 -0
  40. package/package/fba61f63.js +2868 -0
  41. package/package/icons/icon-chart.svg +15 -0
  42. package/package/icons/icon-comp-calendar.svg +22 -0
  43. package/package/index.js +5 -0
  44. package/package/package.json +73 -0
  45. package/package.json +1 -4
  46. package/src/__test__/allComp.test.tsx +61 -0
  47. package/src/app-env.d.ts +3 -0
  48. package/src/comps/calendarComp/calendarComp.tsx +442 -0
  49. package/src/comps/calendarComp/calendarConstants.tsx +897 -0
  50. package/src/comps/chartComp/chartComp.tsx +249 -0
  51. package/src/comps/chartComp/chartConfigs/barChartConfig.tsx +51 -0
  52. package/src/comps/chartComp/chartConfigs/cartesianAxisConfig.tsx +307 -0
  53. package/src/comps/chartComp/chartConfigs/chartUrls.tsx +6 -0
  54. package/src/comps/chartComp/chartConfigs/legendConfig.tsx +55 -0
  55. package/src/comps/chartComp/chartConfigs/lineChartConfig.tsx +96 -0
  56. package/src/comps/chartComp/chartConfigs/pieChartConfig.tsx +83 -0
  57. package/src/comps/chartComp/chartConfigs/scatterChartConfig.tsx +62 -0
  58. package/src/comps/chartComp/chartConstants.tsx +243 -0
  59. package/src/comps/chartComp/chartPropertyView.tsx +161 -0
  60. package/src/comps/chartComp/chartUtils.ts +240 -0
  61. package/src/comps/chartComp/reactEcharts/core.tsx +187 -0
  62. package/src/comps/chartComp/reactEcharts/index.ts +20 -0
  63. package/src/comps/chartComp/reactEcharts/types.ts +70 -0
  64. package/src/comps/chartComp/seriesComp.tsx +119 -0
  65. package/src/comps/imageEditorComp/imageEditorClass.tsx +52 -0
  66. package/src/comps/imageEditorComp/imageEditorConstants.tsx +109 -0
  67. package/src/comps/imageEditorComp/index.tsx +184 -0
  68. package/src/comps/mermaidComp/index.tsx +44 -0
  69. package/src/comps/mermaidComp/mermaid.tsx +29 -0
  70. package/src/global.ts +1 -0
  71. package/src/i18n/comps/index.tsx +29 -0
  72. package/src/i18n/comps/locales/en.ts +142 -0
  73. package/src/i18n/comps/locales/enObj.tsx +120 -0
  74. package/src/i18n/comps/locales/index.ts +7 -0
  75. package/src/i18n/comps/locales/types.tsx +9 -0
  76. package/src/i18n/comps/locales/zh.ts +4 -0
  77. package/src/i18n/comps/locales/zhObj.tsx +4 -0
  78. package/src/index.ts +11 -0
  79. package/vite.config.js +10 -0
@@ -0,0 +1,900 @@
1
+ import { c as U, s as xt, g as kt, b as Ot, a as bt, v as Rt, x as Nt, m as Tt, l as tt, z as vt, h as at, y as At, i as Mt, a2 as It, a3 as wt } from "./2b3ab1e4.js";
2
+ import { G as St, l as Bt } from "./945eefb3.js";
3
+ import { l as Dt } from "./012a06bb.js";
4
+ import "./0c8b29d5.js";
5
+ import "./e0f479f3.js";
6
+ const Lt = /^(?:[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;
7
+ function Ct(t) {
8
+ return typeof t == "string" && Lt.test(t);
9
+ }
10
+ const A = [];
11
+ for (let t = 0; t < 256; ++t)
12
+ A.push((t + 256).toString(16).slice(1));
13
+ function Yt(t, r = 0) {
14
+ return (A[t[r + 0]] + A[t[r + 1]] + A[t[r + 2]] + A[t[r + 3]] + "-" + A[t[r + 4]] + A[t[r + 5]] + "-" + A[t[r + 6]] + A[t[r + 7]] + "-" + A[t[r + 8]] + A[t[r + 9]] + "-" + A[t[r + 10]] + A[t[r + 11]] + A[t[r + 12]] + A[t[r + 13]] + A[t[r + 14]] + A[t[r + 15]]).toLowerCase();
15
+ }
16
+ function Zt(t) {
17
+ if (!Ct(t))
18
+ throw TypeError("Invalid UUID");
19
+ let r;
20
+ const e = new Uint8Array(16);
21
+ return e[0] = (r = parseInt(t.slice(0, 8), 16)) >>> 24, e[1] = r >>> 16 & 255, e[2] = r >>> 8 & 255, e[3] = r & 255, e[4] = (r = parseInt(t.slice(9, 13), 16)) >>> 8, e[5] = r & 255, e[6] = (r = parseInt(t.slice(14, 18), 16)) >>> 8, e[7] = r & 255, e[8] = (r = parseInt(t.slice(19, 23), 16)) >>> 8, e[9] = r & 255, e[10] = (r = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, e[11] = r / 4294967296 & 255, e[12] = r >>> 24 & 255, e[13] = r >>> 16 & 255, e[14] = r >>> 8 & 255, e[15] = r & 255, e;
22
+ }
23
+ function Ft(t) {
24
+ t = unescape(encodeURIComponent(t));
25
+ const r = [];
26
+ for (let e = 0; e < t.length; ++e)
27
+ r.push(t.charCodeAt(e));
28
+ return r;
29
+ }
30
+ const Pt = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", Wt = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
31
+ function Ut(t, r, e) {
32
+ function a(c, p, f, l) {
33
+ var h;
34
+ if (typeof c == "string" && (c = Ft(c)), typeof p == "string" && (p = Zt(p)), ((h = p) === null || h === void 0 ? void 0 : h.length) !== 16)
35
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
36
+ let _ = new Uint8Array(16 + c.length);
37
+ if (_.set(p), _.set(c, p.length), _ = e(_), _[6] = _[6] & 15 | r, _[8] = _[8] & 63 | 128, f) {
38
+ l = l || 0;
39
+ for (let g = 0; g < 16; ++g)
40
+ f[l + g] = _[g];
41
+ return f;
42
+ }
43
+ return Yt(_);
44
+ }
45
+ try {
46
+ a.name = t;
47
+ } catch (c) {
48
+ }
49
+ return a.DNS = Pt, a.URL = Wt, a;
50
+ }
51
+ function Vt(t, r, e, a) {
52
+ switch (t) {
53
+ case 0:
54
+ return r & e ^ ~r & a;
55
+ case 1:
56
+ return r ^ e ^ a;
57
+ case 2:
58
+ return r & e ^ r & a ^ e & a;
59
+ case 3:
60
+ return r ^ e ^ a;
61
+ }
62
+ }
63
+ function st(t, r) {
64
+ return t << r | t >>> 32 - r;
65
+ }
66
+ function zt(t) {
67
+ const r = [1518500249, 1859775393, 2400959708, 3395469782], e = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
68
+ if (typeof t == "string") {
69
+ const f = unescape(encodeURIComponent(t));
70
+ t = [];
71
+ for (let l = 0; l < f.length; ++l)
72
+ t.push(f.charCodeAt(l));
73
+ } else
74
+ Array.isArray(t) || (t = Array.prototype.slice.call(t));
75
+ t.push(128);
76
+ const a = t.length / 4 + 2, c = Math.ceil(a / 16), p = new Array(c);
77
+ for (let f = 0; f < c; ++f) {
78
+ const l = new Uint32Array(16);
79
+ for (let h = 0; h < 16; ++h)
80
+ l[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];
81
+ p[f] = l;
82
+ }
83
+ p[c - 1][14] = (t.length - 1) * 8 / Math.pow(2, 32), p[c - 1][14] = Math.floor(p[c - 1][14]), p[c - 1][15] = (t.length - 1) * 8 & 4294967295;
84
+ for (let f = 0; f < c; ++f) {
85
+ const l = new Uint32Array(80);
86
+ for (let y = 0; y < 16; ++y)
87
+ l[y] = p[f][y];
88
+ for (let y = 16; y < 80; ++y)
89
+ l[y] = st(l[y - 3] ^ l[y - 8] ^ l[y - 14] ^ l[y - 16], 1);
90
+ let h = e[0], _ = e[1], g = e[2], E = e[3], O = e[4];
91
+ for (let y = 0; y < 80; ++y) {
92
+ const M = Math.floor(y / 20), D = st(h, 5) + Vt(M, _, g, E) + O + r[M] + l[y] >>> 0;
93
+ O = E, E = g, g = st(_, 30) >>> 0, _ = h, h = D;
94
+ }
95
+ e[0] = e[0] + h >>> 0, e[1] = e[1] + _ >>> 0, e[2] = e[2] + g >>> 0, e[3] = e[3] + E >>> 0, e[4] = e[4] + O >>> 0;
96
+ }
97
+ return [e[0] >> 24 & 255, e[0] >> 16 & 255, e[0] >> 8 & 255, e[0] & 255, e[1] >> 24 & 255, e[1] >> 16 & 255, e[1] >> 8 & 255, e[1] & 255, e[2] >> 24 & 255, e[2] >> 16 & 255, e[2] >> 8 & 255, e[2] & 255, e[3] >> 24 & 255, e[3] >> 16 & 255, e[3] >> 8 & 255, e[3] & 255, e[4] >> 24 & 255, e[4] >> 16 & 255, e[4] >> 8 & 255, e[4] & 255];
98
+ }
99
+ const Gt = Ut("v5", 80, zt), Kt = Gt;
100
+ var ot = function() {
101
+ var t = function(v, n, s, d) {
102
+ for (s = s || {}, d = v.length; d--; s[v[d]] = n)
103
+ ;
104
+ return s;
105
+ }, r = [1, 2], e = [1, 5], a = [6, 9, 11, 23, 25, 27, 29, 30, 31, 51], c = [1, 17], p = [1, 18], f = [1, 19], l = [1, 20], h = [1, 21], _ = [1, 22], g = [1, 25], E = [1, 30], O = [1, 31], y = [1, 32], M = [1, 33], D = [6, 9, 11, 15, 20, 23, 25, 27, 29, 30, 31, 44, 45, 46, 47, 51], V = [1, 45], z = [30, 31, 48, 49], L = [4, 6, 9, 11, 23, 25, 27, 29, 30, 31, 51], R = [44, 45, 46, 47], N = [22, 37], T = [1, 65], x = [1, 64], S = [22, 37, 39, 41], C = {
106
+ trace: function() {
107
+ },
108
+ yy: {},
109
+ symbols_: { error: 2, start: 3, ER_DIAGRAM: 4, document: 5, EOF: 6, directive: 7, line: 8, SPACE: 9, statement: 10, NEWLINE: 11, openDirective: 12, typeDirective: 13, closeDirective: 14, ":": 15, argDirective: 16, entityName: 17, relSpec: 18, role: 19, BLOCK_START: 20, attributes: 21, BLOCK_STOP: 22, title: 23, title_value: 24, acc_title: 25, acc_title_value: 26, acc_descr: 27, acc_descr_value: 28, acc_descr_multiline_value: 29, ALPHANUM: 30, ENTITY_NAME: 31, attribute: 32, attributeType: 33, attributeName: 34, attributeKeyTypeList: 35, attributeComment: 36, ATTRIBUTE_WORD: 37, attributeKeyType: 38, COMMA: 39, ATTRIBUTE_KEY: 40, COMMENT: 41, cardinality: 42, relType: 43, ZERO_OR_ONE: 44, ZERO_OR_MORE: 45, ONE_OR_MORE: 46, ONLY_ONE: 47, NON_IDENTIFYING: 48, IDENTIFYING: 49, WORD: 50, open_directive: 51, type_directive: 52, arg_directive: 53, close_directive: 54, $accept: 0, $end: 1 },
110
+ terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 9: "SPACE", 11: "NEWLINE", 15: ":", 20: "BLOCK_START", 22: "BLOCK_STOP", 23: "title", 24: "title_value", 25: "acc_title", 26: "acc_title_value", 27: "acc_descr", 28: "acc_descr_value", 29: "acc_descr_multiline_value", 30: "ALPHANUM", 31: "ENTITY_NAME", 37: "ATTRIBUTE_WORD", 39: "COMMA", 40: "ATTRIBUTE_KEY", 41: "COMMENT", 44: "ZERO_OR_ONE", 45: "ZERO_OR_MORE", 46: "ONE_OR_MORE", 47: "ONLY_ONE", 48: "NON_IDENTIFYING", 49: "IDENTIFYING", 50: "WORD", 51: "open_directive", 52: "type_directive", 53: "arg_directive", 54: "close_directive" },
111
+ productions_: [0, [3, 3], [3, 2], [5, 0], [5, 2], [8, 2], [8, 1], [8, 1], [8, 1], [7, 4], [7, 6], [10, 1], [10, 5], [10, 4], [10, 3], [10, 1], [10, 2], [10, 2], [10, 2], [10, 1], [17, 1], [17, 1], [21, 1], [21, 2], [32, 2], [32, 3], [32, 3], [32, 4], [33, 1], [34, 1], [35, 1], [35, 3], [38, 1], [36, 1], [18, 3], [42, 1], [42, 1], [42, 1], [42, 1], [43, 1], [43, 1], [19, 1], [19, 1], [19, 1], [12, 1], [13, 1], [16, 1], [14, 1]],
112
+ performAction: function(n, s, d, u, m, i, X) {
113
+ var o = i.length - 1;
114
+ switch (m) {
115
+ case 1:
116
+ break;
117
+ case 3:
118
+ this.$ = [];
119
+ break;
120
+ case 4:
121
+ i[o - 1].push(i[o]), this.$ = i[o - 1];
122
+ break;
123
+ case 5:
124
+ case 6:
125
+ this.$ = i[o];
126
+ break;
127
+ case 7:
128
+ case 8:
129
+ this.$ = [];
130
+ break;
131
+ case 12:
132
+ u.addEntity(i[o - 4]), u.addEntity(i[o - 2]), u.addRelationship(i[o - 4], i[o], i[o - 2], i[o - 3]);
133
+ break;
134
+ case 13:
135
+ u.addEntity(i[o - 3]), u.addAttributes(i[o - 3], i[o - 1]);
136
+ break;
137
+ case 14:
138
+ u.addEntity(i[o - 2]);
139
+ break;
140
+ case 15:
141
+ u.addEntity(i[o]);
142
+ break;
143
+ case 16:
144
+ case 17:
145
+ this.$ = i[o].trim(), u.setAccTitle(this.$);
146
+ break;
147
+ case 18:
148
+ case 19:
149
+ this.$ = i[o].trim(), u.setAccDescription(this.$);
150
+ break;
151
+ case 20:
152
+ case 43:
153
+ this.$ = i[o];
154
+ break;
155
+ case 21:
156
+ case 41:
157
+ case 42:
158
+ this.$ = i[o].replace(/"/g, "");
159
+ break;
160
+ case 22:
161
+ case 30:
162
+ this.$ = [i[o]];
163
+ break;
164
+ case 23:
165
+ i[o].push(i[o - 1]), this.$ = i[o];
166
+ break;
167
+ case 24:
168
+ this.$ = { attributeType: i[o - 1], attributeName: i[o] };
169
+ break;
170
+ case 25:
171
+ this.$ = { attributeType: i[o - 2], attributeName: i[o - 1], attributeKeyTypeList: i[o] };
172
+ break;
173
+ case 26:
174
+ this.$ = { attributeType: i[o - 2], attributeName: i[o - 1], attributeComment: i[o] };
175
+ break;
176
+ case 27:
177
+ this.$ = { attributeType: i[o - 3], attributeName: i[o - 2], attributeKeyTypeList: i[o - 1], attributeComment: i[o] };
178
+ break;
179
+ case 28:
180
+ case 29:
181
+ case 32:
182
+ this.$ = i[o];
183
+ break;
184
+ case 31:
185
+ i[o - 2].push(i[o]), this.$ = i[o - 2];
186
+ break;
187
+ case 33:
188
+ this.$ = i[o].replace(/"/g, "");
189
+ break;
190
+ case 34:
191
+ this.$ = { cardA: i[o], relType: i[o - 1], cardB: i[o - 2] };
192
+ break;
193
+ case 35:
194
+ this.$ = u.Cardinality.ZERO_OR_ONE;
195
+ break;
196
+ case 36:
197
+ this.$ = u.Cardinality.ZERO_OR_MORE;
198
+ break;
199
+ case 37:
200
+ this.$ = u.Cardinality.ONE_OR_MORE;
201
+ break;
202
+ case 38:
203
+ this.$ = u.Cardinality.ONLY_ONE;
204
+ break;
205
+ case 39:
206
+ this.$ = u.Identification.NON_IDENTIFYING;
207
+ break;
208
+ case 40:
209
+ this.$ = u.Identification.IDENTIFYING;
210
+ break;
211
+ case 44:
212
+ u.parseDirective("%%{", "open_directive");
213
+ break;
214
+ case 45:
215
+ u.parseDirective(i[o], "type_directive");
216
+ break;
217
+ case 46:
218
+ i[o] = i[o].trim().replace(/'/g, '"'), u.parseDirective(i[o], "arg_directive");
219
+ break;
220
+ case 47:
221
+ u.parseDirective("}%%", "close_directive", "er");
222
+ break;
223
+ }
224
+ },
225
+ table: [{ 3: 1, 4: r, 7: 3, 12: 4, 51: e }, { 1: [3] }, t(a, [2, 3], { 5: 6 }), { 3: 7, 4: r, 7: 3, 12: 4, 51: e }, { 13: 8, 52: [1, 9] }, { 52: [2, 44] }, { 6: [1, 10], 7: 15, 8: 11, 9: [1, 12], 10: 13, 11: [1, 14], 12: 4, 17: 16, 23: c, 25: p, 27: f, 29: l, 30: h, 31: _, 51: e }, { 1: [2, 2] }, { 14: 23, 15: [1, 24], 54: g }, t([15, 54], [2, 45]), t(a, [2, 8], { 1: [2, 1] }), t(a, [2, 4]), { 7: 15, 10: 26, 12: 4, 17: 16, 23: c, 25: p, 27: f, 29: l, 30: h, 31: _, 51: e }, t(a, [2, 6]), t(a, [2, 7]), t(a, [2, 11]), t(a, [2, 15], { 18: 27, 42: 29, 20: [1, 28], 44: E, 45: O, 46: y, 47: M }), { 24: [1, 34] }, { 26: [1, 35] }, { 28: [1, 36] }, t(a, [2, 19]), t(D, [2, 20]), t(D, [2, 21]), { 11: [1, 37] }, { 16: 38, 53: [1, 39] }, { 11: [2, 47] }, t(a, [2, 5]), { 17: 40, 30: h, 31: _ }, { 21: 41, 22: [1, 42], 32: 43, 33: 44, 37: V }, { 43: 46, 48: [1, 47], 49: [1, 48] }, t(z, [2, 35]), t(z, [2, 36]), t(z, [2, 37]), t(z, [2, 38]), t(a, [2, 16]), t(a, [2, 17]), t(a, [2, 18]), t(L, [2, 9]), { 14: 49, 54: g }, { 54: [2, 46] }, { 15: [1, 50] }, { 22: [1, 51] }, t(a, [2, 14]), { 21: 52, 22: [2, 22], 32: 43, 33: 44, 37: V }, { 34: 53, 37: [1, 54] }, { 37: [2, 28] }, { 42: 55, 44: E, 45: O, 46: y, 47: M }, t(R, [2, 39]), t(R, [2, 40]), { 11: [1, 56] }, { 19: 57, 30: [1, 60], 31: [1, 59], 50: [1, 58] }, t(a, [2, 13]), { 22: [2, 23] }, t(N, [2, 24], { 35: 61, 36: 62, 38: 63, 40: T, 41: x }), t([22, 37, 40, 41], [2, 29]), t([30, 31], [2, 34]), t(L, [2, 10]), t(a, [2, 12]), t(a, [2, 41]), t(a, [2, 42]), t(a, [2, 43]), t(N, [2, 25], { 36: 66, 39: [1, 67], 41: x }), t(N, [2, 26]), t(S, [2, 30]), t(N, [2, 33]), t(S, [2, 32]), t(N, [2, 27]), { 38: 68, 40: T }, t(S, [2, 31])],
226
+ defaultActions: { 5: [2, 44], 7: [2, 2], 25: [2, 47], 39: [2, 46], 45: [2, 28], 52: [2, 23] },
227
+ parseError: function(n, s) {
228
+ if (s.recoverable)
229
+ this.trace(n);
230
+ else {
231
+ var d = new Error(n);
232
+ throw d.hash = s, d;
233
+ }
234
+ },
235
+ parse: function(n) {
236
+ var s = this, d = [0], u = [], m = [null], i = [], X = this.table, o = "", q = 0, lt = 0, _t = 2, ht = 1, gt = i.slice.call(arguments, 1), b = Object.create(this.lexer), G = { yy: {} };
237
+ for (var et in this.yy)
238
+ Object.prototype.hasOwnProperty.call(this.yy, et) && (G.yy[et] = this.yy[et]);
239
+ b.setInput(n, G.yy), G.yy.lexer = b, G.yy.parser = this, typeof b.yylloc == "undefined" && (b.yylloc = {});
240
+ var rt = b.yylloc;
241
+ i.push(rt);
242
+ var mt = b.options && b.options.ranges;
243
+ typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
244
+ function Et() {
245
+ var F;
246
+ return F = u.pop() || b.lex() || ht, typeof F != "number" && (F instanceof Array && (u = F, F = u.pop()), F = s.symbols_[F] || F), F;
247
+ }
248
+ for (var I, K, w, it, H = {}, J, Z, dt, $; ; ) {
249
+ if (K = d[d.length - 1], this.defaultActions[K] ? w = this.defaultActions[K] : ((I === null || typeof I == "undefined") && (I = Et()), w = X[K] && X[K][I]), typeof w == "undefined" || !w.length || !w[0]) {
250
+ var nt = "";
251
+ $ = [];
252
+ for (J in X[K])
253
+ this.terminals_[J] && J > _t && $.push("'" + this.terminals_[J] + "'");
254
+ b.showPosition ? nt = "Parse error on line " + (q + 1) + `:
255
+ ` + b.showPosition() + `
256
+ Expecting ` + $.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : nt = "Parse error on line " + (q + 1) + ": Unexpected " + (I == ht ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(nt, {
257
+ text: b.match,
258
+ token: this.terminals_[I] || I,
259
+ line: b.yylineno,
260
+ loc: rt,
261
+ expected: $
262
+ });
263
+ }
264
+ if (w[0] instanceof Array && w.length > 1)
265
+ throw new Error("Parse Error: multiple actions possible at state: " + K + ", token: " + I);
266
+ switch (w[0]) {
267
+ case 1:
268
+ d.push(I), m.push(b.yytext), i.push(b.yylloc), d.push(w[1]), I = null, lt = b.yyleng, o = b.yytext, q = b.yylineno, rt = b.yylloc;
269
+ break;
270
+ case 2:
271
+ if (Z = this.productions_[w[1]][1], H.$ = m[m.length - Z], H._$ = {
272
+ first_line: i[i.length - (Z || 1)].first_line,
273
+ last_line: i[i.length - 1].last_line,
274
+ first_column: i[i.length - (Z || 1)].first_column,
275
+ last_column: i[i.length - 1].last_column
276
+ }, mt && (H._$.range = [
277
+ i[i.length - (Z || 1)].range[0],
278
+ i[i.length - 1].range[1]
279
+ ]), it = this.performAction.apply(H, [
280
+ o,
281
+ lt,
282
+ q,
283
+ G.yy,
284
+ w[1],
285
+ m,
286
+ i
287
+ ].concat(gt)), typeof it != "undefined")
288
+ return it;
289
+ Z && (d = d.slice(0, -1 * Z * 2), m = m.slice(0, -1 * Z), i = i.slice(0, -1 * Z)), d.push(this.productions_[w[1]][0]), m.push(H.$), i.push(H._$), dt = X[d[d.length - 2]][d[d.length - 1]], d.push(dt);
290
+ break;
291
+ case 3:
292
+ return !0;
293
+ }
294
+ }
295
+ return !0;
296
+ }
297
+ }, B = function() {
298
+ var v = {
299
+ EOF: 1,
300
+ parseError: function(s, d) {
301
+ if (this.yy.parser)
302
+ this.yy.parser.parseError(s, d);
303
+ else
304
+ throw new Error(s);
305
+ },
306
+ setInput: function(n, s) {
307
+ return this.yy = s || this.yy || {}, this._input = n, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
308
+ first_line: 1,
309
+ first_column: 0,
310
+ last_line: 1,
311
+ last_column: 0
312
+ }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
313
+ },
314
+ input: function() {
315
+ var n = this._input[0];
316
+ this.yytext += n, this.yyleng++, this.offset++, this.match += n, this.matched += n;
317
+ var s = n.match(/(?:\r\n?|\n).*/g);
318
+ return s ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), n;
319
+ },
320
+ unput: function(n) {
321
+ var s = n.length, d = n.split(/(?:\r\n?|\n)/g);
322
+ this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - s), this.offset -= s;
323
+ var u = this.match.split(/(?:\r\n?|\n)/g);
324
+ this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), d.length - 1 && (this.yylineno -= d.length - 1);
325
+ var m = this.yylloc.range;
326
+ return this.yylloc = {
327
+ first_line: this.yylloc.first_line,
328
+ last_line: this.yylineno + 1,
329
+ first_column: this.yylloc.first_column,
330
+ last_column: d ? (d.length === u.length ? this.yylloc.first_column : 0) + u[u.length - d.length].length - d[0].length : this.yylloc.first_column - s
331
+ }, this.options.ranges && (this.yylloc.range = [m[0], m[0] + this.yyleng - s]), this.yyleng = this.yytext.length, this;
332
+ },
333
+ more: function() {
334
+ return this._more = !0, this;
335
+ },
336
+ reject: function() {
337
+ if (this.options.backtrack_lexer)
338
+ this._backtrack = !0;
339
+ else
340
+ 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).
341
+ ` + this.showPosition(), {
342
+ text: "",
343
+ token: null,
344
+ line: this.yylineno
345
+ });
346
+ return this;
347
+ },
348
+ less: function(n) {
349
+ this.unput(this.match.slice(n));
350
+ },
351
+ pastInput: function() {
352
+ var n = this.matched.substr(0, this.matched.length - this.match.length);
353
+ return (n.length > 20 ? "..." : "") + n.substr(-20).replace(/\n/g, "");
354
+ },
355
+ upcomingInput: function() {
356
+ var n = this.match;
357
+ return n.length < 20 && (n += this._input.substr(0, 20 - n.length)), (n.substr(0, 20) + (n.length > 20 ? "..." : "")).replace(/\n/g, "");
358
+ },
359
+ showPosition: function() {
360
+ var n = this.pastInput(), s = new Array(n.length + 1).join("-");
361
+ return n + this.upcomingInput() + `
362
+ ` + s + "^";
363
+ },
364
+ test_match: function(n, s) {
365
+ var d, u, m;
366
+ if (this.options.backtrack_lexer && (m = {
367
+ yylineno: this.yylineno,
368
+ yylloc: {
369
+ first_line: this.yylloc.first_line,
370
+ last_line: this.last_line,
371
+ first_column: this.yylloc.first_column,
372
+ last_column: this.yylloc.last_column
373
+ },
374
+ yytext: this.yytext,
375
+ match: this.match,
376
+ matches: this.matches,
377
+ matched: this.matched,
378
+ yyleng: this.yyleng,
379
+ offset: this.offset,
380
+ _more: this._more,
381
+ _input: this._input,
382
+ yy: this.yy,
383
+ conditionStack: this.conditionStack.slice(0),
384
+ done: this.done
385
+ }, this.options.ranges && (m.yylloc.range = this.yylloc.range.slice(0))), u = n[0].match(/(?:\r\n?|\n).*/g), u && (this.yylineno += u.length), this.yylloc = {
386
+ first_line: this.yylloc.last_line,
387
+ last_line: this.yylineno + 1,
388
+ first_column: this.yylloc.last_column,
389
+ last_column: u ? u[u.length - 1].length - u[u.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + n[0].length
390
+ }, this.yytext += n[0], this.match += n[0], this.matches = n, 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(n[0].length), this.matched += n[0], d = this.performAction.call(this, this.yy, this, s, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), d)
391
+ return d;
392
+ if (this._backtrack) {
393
+ for (var i in m)
394
+ this[i] = m[i];
395
+ return !1;
396
+ }
397
+ return !1;
398
+ },
399
+ next: function() {
400
+ if (this.done)
401
+ return this.EOF;
402
+ this._input || (this.done = !0);
403
+ var n, s, d, u;
404
+ this._more || (this.yytext = "", this.match = "");
405
+ for (var m = this._currentRules(), i = 0; i < m.length; i++)
406
+ if (d = this._input.match(this.rules[m[i]]), d && (!s || d[0].length > s[0].length)) {
407
+ if (s = d, u = i, this.options.backtrack_lexer) {
408
+ if (n = this.test_match(d, m[i]), n !== !1)
409
+ return n;
410
+ if (this._backtrack) {
411
+ s = !1;
412
+ continue;
413
+ } else
414
+ return !1;
415
+ } else if (!this.options.flex)
416
+ break;
417
+ }
418
+ return s ? (n = this.test_match(s, m[u]), n !== !1 ? n : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
419
+ ` + this.showPosition(), {
420
+ text: "",
421
+ token: null,
422
+ line: this.yylineno
423
+ });
424
+ },
425
+ lex: function() {
426
+ var s = this.next();
427
+ return s || this.lex();
428
+ },
429
+ begin: function(s) {
430
+ this.conditionStack.push(s);
431
+ },
432
+ popState: function() {
433
+ var s = this.conditionStack.length - 1;
434
+ return s > 0 ? this.conditionStack.pop() : this.conditionStack[0];
435
+ },
436
+ _currentRules: function() {
437
+ return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
438
+ },
439
+ topState: function(s) {
440
+ return s = this.conditionStack.length - 1 - Math.abs(s || 0), s >= 0 ? this.conditionStack[s] : "INITIAL";
441
+ },
442
+ pushState: function(s) {
443
+ this.begin(s);
444
+ },
445
+ stateStackSize: function() {
446
+ return this.conditionStack.length;
447
+ },
448
+ options: { "case-insensitive": !0 },
449
+ performAction: function(s, d, u, m) {
450
+ switch (u) {
451
+ case 0:
452
+ return this.begin("acc_title"), 25;
453
+ case 1:
454
+ return this.popState(), "acc_title_value";
455
+ case 2:
456
+ return this.begin("acc_descr"), 27;
457
+ case 3:
458
+ return this.popState(), "acc_descr_value";
459
+ case 4:
460
+ this.begin("acc_descr_multiline");
461
+ break;
462
+ case 5:
463
+ this.popState();
464
+ break;
465
+ case 6:
466
+ return "acc_descr_multiline_value";
467
+ case 7:
468
+ return this.begin("open_directive"), 51;
469
+ case 8:
470
+ return this.begin("type_directive"), 52;
471
+ case 9:
472
+ return this.popState(), this.begin("arg_directive"), 15;
473
+ case 10:
474
+ return this.popState(), this.popState(), 54;
475
+ case 11:
476
+ return 53;
477
+ case 12:
478
+ return 11;
479
+ case 13:
480
+ break;
481
+ case 14:
482
+ return 9;
483
+ case 15:
484
+ return 31;
485
+ case 16:
486
+ return 50;
487
+ case 17:
488
+ return 4;
489
+ case 18:
490
+ return this.begin("block"), 20;
491
+ case 19:
492
+ return 39;
493
+ case 20:
494
+ break;
495
+ case 21:
496
+ return 40;
497
+ case 22:
498
+ return 37;
499
+ case 23:
500
+ return 37;
501
+ case 24:
502
+ return 41;
503
+ case 25:
504
+ break;
505
+ case 26:
506
+ return this.popState(), 22;
507
+ case 27:
508
+ return d.yytext[0];
509
+ case 28:
510
+ return 44;
511
+ case 29:
512
+ return 46;
513
+ case 30:
514
+ return 46;
515
+ case 31:
516
+ return 46;
517
+ case 32:
518
+ return 44;
519
+ case 33:
520
+ return 44;
521
+ case 34:
522
+ return 45;
523
+ case 35:
524
+ return 45;
525
+ case 36:
526
+ return 45;
527
+ case 37:
528
+ return 45;
529
+ case 38:
530
+ return 45;
531
+ case 39:
532
+ return 46;
533
+ case 40:
534
+ return 45;
535
+ case 41:
536
+ return 46;
537
+ case 42:
538
+ return 47;
539
+ case 43:
540
+ return 47;
541
+ case 44:
542
+ return 47;
543
+ case 45:
544
+ return 47;
545
+ case 46:
546
+ return 44;
547
+ case 47:
548
+ return 45;
549
+ case 48:
550
+ return 46;
551
+ case 49:
552
+ return 48;
553
+ case 50:
554
+ return 49;
555
+ case 51:
556
+ return 49;
557
+ case 52:
558
+ return 48;
559
+ case 53:
560
+ return 48;
561
+ case 54:
562
+ return 48;
563
+ case 55:
564
+ return 30;
565
+ case 56:
566
+ return d.yytext[0];
567
+ case 57:
568
+ return 6;
569
+ }
570
+ },
571
+ rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:%%\{)/i, /^(?:((?:(?!\}%%)[^:.])*))/i, /^(?::)/i, /^(?:\}%%)/i, /^(?:((?:(?!\}%%).|\n)*))/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, /^(?: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, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
572
+ conditions: { acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, open_directive: { rules: [8], inclusive: !1 }, type_directive: { rules: [9, 10], inclusive: !1 }, arg_directive: { rules: [10, 11], inclusive: !1 }, block: { rules: [19, 20, 21, 22, 23, 24, 25, 26, 27], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 12, 13, 14, 15, 16, 17, 18, 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, 56, 57], inclusive: !0 } }
573
+ };
574
+ return v;
575
+ }();
576
+ C.lexer = B;
577
+ function Y() {
578
+ this.yy = {};
579
+ }
580
+ return Y.prototype = C, C.Parser = Y, new Y();
581
+ }();
582
+ ot.parser = ot;
583
+ const Ht = ot;
584
+ let Q = {}, ct = [];
585
+ const Xt = {
586
+ ZERO_OR_ONE: "ZERO_OR_ONE",
587
+ ZERO_OR_MORE: "ZERO_OR_MORE",
588
+ ONE_OR_MORE: "ONE_OR_MORE",
589
+ ONLY_ONE: "ONLY_ONE"
590
+ }, Qt = {
591
+ NON_IDENTIFYING: "NON_IDENTIFYING",
592
+ IDENTIFYING: "IDENTIFYING"
593
+ }, jt = function(t, r, e) {
594
+ Tt.parseDirective(this, t, r, e);
595
+ }, yt = function(t) {
596
+ return Q[t] === void 0 && (Q[t] = { attributes: [] }, tt.info("Added new entity :", t)), Q[t];
597
+ }, qt = () => Q, Jt = function(t, r) {
598
+ let e = yt(t), a;
599
+ for (a = r.length - 1; a >= 0; a--)
600
+ e.attributes.push(r[a]), tt.debug("Added attribute ", r[a].attributeName);
601
+ }, $t = function(t, r, e, a) {
602
+ let c = {
603
+ entityA: t,
604
+ roleA: r,
605
+ entityB: e,
606
+ relSpec: a
607
+ };
608
+ ct.push(c), tt.debug("Added new relationship :", c);
609
+ }, te = () => ct, ee = function() {
610
+ Q = {}, ct = [], vt();
611
+ }, re = {
612
+ Cardinality: Xt,
613
+ Identification: Qt,
614
+ parseDirective: jt,
615
+ getConfig: () => U().er,
616
+ addEntity: yt,
617
+ addAttributes: Jt,
618
+ getEntities: qt,
619
+ addRelationship: $t,
620
+ getRelationships: te,
621
+ clear: ee,
622
+ setAccTitle: xt,
623
+ getAccTitle: kt,
624
+ setAccDescription: Ot,
625
+ getAccDescription: bt,
626
+ setDiagramTitle: Rt,
627
+ getDiagramTitle: Nt
628
+ }, P = {
629
+ ONLY_ONE_START: "ONLY_ONE_START",
630
+ ONLY_ONE_END: "ONLY_ONE_END",
631
+ ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
632
+ ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
633
+ ONE_OR_MORE_START: "ONE_OR_MORE_START",
634
+ ONE_OR_MORE_END: "ONE_OR_MORE_END",
635
+ ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
636
+ ZERO_OR_MORE_END: "ZERO_OR_MORE_END"
637
+ }, ie = function(t, r) {
638
+ let e;
639
+ t.append("defs").append("marker").attr("id", P.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18"), t.append("defs").append("marker").attr("id", P.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18"), e = t.append("defs").append("marker").attr("id", P.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M9,0 L9,18"), e = t.append("defs").append("marker").attr("id", P.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M21,0 L21,18"), t.append("defs").append("marker").attr("id", P.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", r.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", P.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"), e = t.append("defs").append("marker").attr("id", P.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18"), e = t.append("defs").append("marker").attr("id", P.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), e.append("circle").attr("stroke", r.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), e.append("path").attr("stroke", r.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
640
+ }, W = {
641
+ ERMarkers: P,
642
+ insertMarkers: ie
643
+ }, ne = /[^\dA-Za-z](\W)*/g;
644
+ let k = {}, j = /* @__PURE__ */ new Map();
645
+ const ae = function(t) {
646
+ const r = Object.keys(t);
647
+ for (const e of r)
648
+ k[e] = t[e];
649
+ }, se = (t, r, e) => {
650
+ const a = k.entityPadding / 3, c = k.entityPadding / 3, p = k.fontSize * 0.85, f = r.node().getBBox(), l = [];
651
+ let h = !1, _ = !1, g = 0, E = 0, O = 0, y = 0, M = f.height + a * 2, D = 1;
652
+ e.forEach((R) => {
653
+ R.attributeKeyTypeList !== void 0 && R.attributeKeyTypeList.length > 0 && (h = !0), R.attributeComment !== void 0 && (_ = !0);
654
+ }), e.forEach((R) => {
655
+ const N = `${r.node().id}-attr-${D}`;
656
+ let T = 0;
657
+ const x = wt(R.attributeType), S = t.append("text").classed("er entityLabel", !0).attr("id", `${N}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", U().fontFamily).style("font-size", p + "px").text(x), C = t.append("text").classed("er entityLabel", !0).attr("id", `${N}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", U().fontFamily).style("font-size", p + "px").text(R.attributeName), B = {};
658
+ B.tn = S, B.nn = C;
659
+ const Y = S.node().getBBox(), v = C.node().getBBox();
660
+ if (g = Math.max(g, Y.width), E = Math.max(E, v.width), T = Math.max(Y.height, v.height), h) {
661
+ const n = R.attributeKeyTypeList !== void 0 ? R.attributeKeyTypeList.join(",") : "", s = t.append("text").classed("er entityLabel", !0).attr("id", `${N}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", U().fontFamily).style("font-size", p + "px").text(n);
662
+ B.kn = s;
663
+ const d = s.node().getBBox();
664
+ O = Math.max(O, d.width), T = Math.max(T, d.height);
665
+ }
666
+ if (_) {
667
+ const n = t.append("text").classed("er entityLabel", !0).attr("id", `${N}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", U().fontFamily).style("font-size", p + "px").text(R.attributeComment || "");
668
+ B.cn = n;
669
+ const s = n.node().getBBox();
670
+ y = Math.max(y, s.width), T = Math.max(T, s.height);
671
+ }
672
+ B.height = T, l.push(B), M += T + a * 2, D += 1;
673
+ });
674
+ let V = 4;
675
+ h && (V += 2), _ && (V += 2);
676
+ const z = g + E + O + y, L = {
677
+ width: Math.max(
678
+ k.minEntityWidth,
679
+ Math.max(
680
+ f.width + k.entityPadding * 2,
681
+ z + c * V
682
+ )
683
+ ),
684
+ height: e.length > 0 ? M : Math.max(k.minEntityHeight, f.height + k.entityPadding * 2)
685
+ };
686
+ if (e.length > 0) {
687
+ const R = Math.max(
688
+ 0,
689
+ (L.width - z - c * V) / (V / 2)
690
+ );
691
+ r.attr(
692
+ "transform",
693
+ "translate(" + L.width / 2 + "," + (a + f.height / 2) + ")"
694
+ );
695
+ let N = f.height + a * 2, T = "attributeBoxOdd";
696
+ l.forEach((x) => {
697
+ const S = N + a + x.height / 2;
698
+ x.tn.attr("transform", "translate(" + c + "," + S + ")");
699
+ const C = t.insert("rect", "#" + x.tn.node().id).classed(`er ${T}`, !0).attr("x", 0).attr("y", N).attr("width", g + c * 2 + R).attr("height", x.height + a * 2), B = parseFloat(C.attr("x")) + parseFloat(C.attr("width"));
700
+ x.nn.attr(
701
+ "transform",
702
+ "translate(" + (B + c) + "," + S + ")"
703
+ );
704
+ const Y = t.insert("rect", "#" + x.nn.node().id).classed(`er ${T}`, !0).attr("x", B).attr("y", N).attr("width", E + c * 2 + R).attr("height", x.height + a * 2);
705
+ let v = parseFloat(Y.attr("x")) + parseFloat(Y.attr("width"));
706
+ if (h) {
707
+ x.kn.attr(
708
+ "transform",
709
+ "translate(" + (v + c) + "," + S + ")"
710
+ );
711
+ const n = t.insert("rect", "#" + x.kn.node().id).classed(`er ${T}`, !0).attr("x", v).attr("y", N).attr("width", O + c * 2 + R).attr("height", x.height + a * 2);
712
+ v = parseFloat(n.attr("x")) + parseFloat(n.attr("width"));
713
+ }
714
+ _ && (x.cn.attr(
715
+ "transform",
716
+ "translate(" + (v + c) + "," + S + ")"
717
+ ), t.insert("rect", "#" + x.cn.node().id).classed(`er ${T}`, "true").attr("x", v).attr("y", N).attr("width", y + c * 2 + R).attr("height", x.height + a * 2)), N += x.height + a * 2, T = T === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
718
+ });
719
+ } else
720
+ L.height = Math.max(k.minEntityHeight, M), r.attr("transform", "translate(" + L.width / 2 + "," + L.height / 2 + ")");
721
+ return L;
722
+ }, oe = function(t, r, e) {
723
+ const a = Object.keys(r);
724
+ let c;
725
+ return a.forEach(function(p) {
726
+ const f = fe(p, "entity");
727
+ j.set(p, f);
728
+ const l = t.append("g").attr("id", f);
729
+ c = c === void 0 ? f : c;
730
+ const h = "text-" + f, _ = l.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", U().fontFamily).style("font-size", k.fontSize + "px").text(p), { width: g, height: E } = se(
731
+ l,
732
+ _,
733
+ r[p].attributes
734
+ ), y = l.insert("rect", "#" + h).classed("er entityBox", !0).attr("x", 0).attr("y", 0).attr("width", g).attr("height", E).node().getBBox();
735
+ e.setNode(f, {
736
+ width: y.width,
737
+ height: y.height,
738
+ shape: "rect",
739
+ id: f
740
+ });
741
+ }), c;
742
+ }, ce = function(t, r) {
743
+ r.nodes().forEach(function(e) {
744
+ e !== void 0 && r.node(e) !== void 0 && t.select("#" + e).attr(
745
+ "transform",
746
+ "translate(" + (r.node(e).x - r.node(e).width / 2) + "," + (r.node(e).y - r.node(e).height / 2) + " )"
747
+ );
748
+ });
749
+ }, pt = function(t) {
750
+ return (t.entityA + t.roleA + t.entityB).replace(/\s/g, "");
751
+ }, le = function(t, r) {
752
+ return t.forEach(function(e) {
753
+ r.setEdge(
754
+ j.get(e.entityA),
755
+ j.get(e.entityB),
756
+ { relationship: e },
757
+ pt(e)
758
+ );
759
+ }), t;
760
+ };
761
+ let ut = 0;
762
+ const he = function(t, r, e, a, c) {
763
+ ut++;
764
+ const p = e.edge(
765
+ j.get(r.entityA),
766
+ j.get(r.entityB),
767
+ pt(r)
768
+ ), f = Dt().x(function(M) {
769
+ return M.x;
770
+ }).y(function(M) {
771
+ return M.y;
772
+ }).curve(It), l = t.insert("path", "#" + a).classed("er relationshipLine", !0).attr("d", f(p.points)).style("stroke", k.stroke).style("fill", "none");
773
+ r.relSpec.relType === c.db.Identification.NON_IDENTIFYING && l.attr("stroke-dasharray", "8,8");
774
+ let h = "";
775
+ switch (k.arrowMarkerAbsolute && (h = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, h = h.replace(/\(/g, "\\("), h = h.replace(/\)/g, "\\)")), r.relSpec.cardA) {
776
+ case c.db.Cardinality.ZERO_OR_ONE:
777
+ l.attr("marker-end", "url(" + h + "#" + W.ERMarkers.ZERO_OR_ONE_END + ")");
778
+ break;
779
+ case c.db.Cardinality.ZERO_OR_MORE:
780
+ l.attr("marker-end", "url(" + h + "#" + W.ERMarkers.ZERO_OR_MORE_END + ")");
781
+ break;
782
+ case c.db.Cardinality.ONE_OR_MORE:
783
+ l.attr("marker-end", "url(" + h + "#" + W.ERMarkers.ONE_OR_MORE_END + ")");
784
+ break;
785
+ case c.db.Cardinality.ONLY_ONE:
786
+ l.attr("marker-end", "url(" + h + "#" + W.ERMarkers.ONLY_ONE_END + ")");
787
+ break;
788
+ }
789
+ switch (r.relSpec.cardB) {
790
+ case c.db.Cardinality.ZERO_OR_ONE:
791
+ l.attr(
792
+ "marker-start",
793
+ "url(" + h + "#" + W.ERMarkers.ZERO_OR_ONE_START + ")"
794
+ );
795
+ break;
796
+ case c.db.Cardinality.ZERO_OR_MORE:
797
+ l.attr(
798
+ "marker-start",
799
+ "url(" + h + "#" + W.ERMarkers.ZERO_OR_MORE_START + ")"
800
+ );
801
+ break;
802
+ case c.db.Cardinality.ONE_OR_MORE:
803
+ l.attr(
804
+ "marker-start",
805
+ "url(" + h + "#" + W.ERMarkers.ONE_OR_MORE_START + ")"
806
+ );
807
+ break;
808
+ case c.db.Cardinality.ONLY_ONE:
809
+ l.attr("marker-start", "url(" + h + "#" + W.ERMarkers.ONLY_ONE_START + ")");
810
+ break;
811
+ }
812
+ const _ = l.node().getTotalLength(), g = l.node().getPointAtLength(_ * 0.5), E = "rel" + ut, y = t.append("text").classed("er relationshipLabel", !0).attr("id", E).attr("x", g.x).attr("y", g.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", U().fontFamily).style("font-size", k.fontSize + "px").text(r.roleA).node().getBBox();
813
+ t.insert("rect", "#" + E).classed("er relationshipLabelBox", !0).attr("x", g.x - y.width / 2).attr("y", g.y - y.height / 2).attr("width", y.width).attr("height", y.height);
814
+ }, de = function(t, r, e, a) {
815
+ k = U().er, tt.info("Drawing ER diagram");
816
+ const c = U().securityLevel;
817
+ let p;
818
+ c === "sandbox" && (p = at("#i" + r));
819
+ const l = (c === "sandbox" ? at(p.nodes()[0].contentDocument.body) : at("body")).select(`[id='${r}']`);
820
+ W.insertMarkers(l, k);
821
+ let h;
822
+ h = new St({
823
+ multigraph: !0,
824
+ directed: !0,
825
+ compound: !1
826
+ }).setGraph({
827
+ rankdir: k.layoutDirection,
828
+ marginx: 20,
829
+ marginy: 20,
830
+ nodesep: 100,
831
+ edgesep: 100,
832
+ ranksep: 100
833
+ }).setDefaultEdgeLabel(function() {
834
+ return {};
835
+ });
836
+ const _ = oe(l, a.db.getEntities(), h), g = le(a.db.getRelationships(), h);
837
+ Bt(h), ce(l, h), g.forEach(function(D) {
838
+ he(l, D, h, _, a);
839
+ });
840
+ const E = k.diagramPadding;
841
+ At.insertTitle(l, "entityTitleText", k.titleTopMargin, a.db.getDiagramTitle());
842
+ const O = l.node().getBBox(), y = O.width + E * 2, M = O.height + E * 2;
843
+ Mt(l, M, y, k.useMaxWidth), l.attr("viewBox", `${O.x - E} ${O.y - E} ${y} ${M}`);
844
+ }, ue = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
845
+ function fe(t = "", r = "") {
846
+ const e = t.replace(ne, "");
847
+ return `${ft(r)}${ft(e)}${Kt(
848
+ t,
849
+ ue
850
+ )}`;
851
+ }
852
+ function ft(t = "") {
853
+ return t.length > 0 ? `${t}-` : "";
854
+ }
855
+ const ye = {
856
+ setConf: ae,
857
+ draw: de
858
+ }, pe = (t) => `
859
+ .entityBox {
860
+ fill: ${t.mainBkg};
861
+ stroke: ${t.nodeBorder};
862
+ }
863
+
864
+ .attributeBoxOdd {
865
+ fill: ${t.attributeBackgroundColorOdd};
866
+ stroke: ${t.nodeBorder};
867
+ }
868
+
869
+ .attributeBoxEven {
870
+ fill: ${t.attributeBackgroundColorEven};
871
+ stroke: ${t.nodeBorder};
872
+ }
873
+
874
+ .relationshipLabelBox {
875
+ fill: ${t.tertiaryColor};
876
+ opacity: 0.7;
877
+ background-color: ${t.tertiaryColor};
878
+ rect {
879
+ opacity: 0.5;
880
+ }
881
+ }
882
+
883
+ .relationshipLine {
884
+ stroke: ${t.lineColor};
885
+ }
886
+
887
+ .entityTitleText {
888
+ text-anchor: middle;
889
+ font-size: 18px;
890
+ fill: ${t.textColor};
891
+ }
892
+ `, _e = pe, Oe = {
893
+ parser: Ht,
894
+ db: re,
895
+ renderer: ye,
896
+ styles: _e
897
+ };
898
+ export {
899
+ Oe as diagram
900
+ };