@8btc/xcanvas 0.0.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 (121) hide show
  1. package/README.md +70 -0
  2. package/dist/Tableau10-BqnYsPR6.js +9 -0
  3. package/dist/XCanvas-BxdLBkBz.js +27732 -0
  4. package/dist/_commonjs-dynamic-modules-TGKdzP3c.js +6 -0
  5. package/dist/ar-SA-G6X2FPQ2-DjqDLLYL.js +41 -0
  6. package/dist/arc-D1qX5GFf.js +132 -0
  7. package/dist/array-DgktLKBx.js +6 -0
  8. package/dist/az-AZ-76LH7QW2-D7LOsF3_.js +32 -0
  9. package/dist/bg-BG-XCXSNQG7-WI4tFn23.js +36 -0
  10. package/dist/blockDiagram-38ab4fdb-DtemKfEh.js +1811 -0
  11. package/dist/bn-BD-2XOGV67Q-Bugx_8fy.js +36 -0
  12. package/dist/c4Diagram-3d4e48cf-Byd2vU9K.js +2463 -0
  13. package/dist/ca-ES-6MX7JW3Y-6rFwKGsQ.js +39 -0
  14. package/dist/channel-BT_3Ze-Y.js +7 -0
  15. package/dist/chunk-EIO257PC-C7qD7hGu.js +1641 -0
  16. package/dist/classDiagram-70f12bd4-CwfYadk-.js +354 -0
  17. package/dist/classDiagram-v2-f2320105-B28MuM8f.js +284 -0
  18. package/dist/clone-D2FUK8WY.js +8 -0
  19. package/dist/createText-2e5e7dd3-Ca1JfQaJ.js +4914 -0
  20. package/dist/cs-CZ-2BRQDIVT-Dhd8XszK.js +42 -0
  21. package/dist/da-DK-5WZEPLOC-BhL87sSs.js +36 -0
  22. package/dist/de-DE-XR44H4JA-xSrZSV0J.js +39 -0
  23. package/dist/directory-open-01563666-XowynPwH.js +14 -0
  24. package/dist/directory-open-4ed118d0-BwYbu9dw.js +55 -0
  25. package/dist/edges-e0da2a9e-9VbVapWU.js +1840 -0
  26. package/dist/el-GR-BZB4AONW-DQORZ_pY.js +41 -0
  27. package/dist/en-B4ZKOASM-D2BVbEdz.js +39 -0
  28. package/dist/erDiagram-9861fffd-D4S9QDes.js +1318 -0
  29. package/dist/es-ES-U4NZUMDT-C0Q89-0V.js +40 -0
  30. package/dist/eu-ES-A7QVB2H4-BwBW3cEw.js +42 -0
  31. package/dist/fa-IR-HGAKTJCU-DtZ74rm4.js +39 -0
  32. package/dist/fi-FI-Z5N7JZ37-QvQan48z.js +37 -0
  33. package/dist/file-open-002ab408-BNIYSKAV.js +18 -0
  34. package/dist/file-open-7c801643-B_l1UXdI.js +15 -0
  35. package/dist/file-save-3189631c-vzijizFw.js +23 -0
  36. package/dist/file-save-745eba88-B5-wM56X.js +25 -0
  37. package/dist/flowDb-956e92f1-S6T8ppJw.js +1713 -0
  38. package/dist/flowDiagram-66a62f08-C6TTwS5_.js +1264 -0
  39. package/dist/flowDiagram-v2-96b9c2cf-CzfeUNGP.js +24 -0
  40. package/dist/flowchart-elk-definition-4a651766-CRv1kWtk.js +92922 -0
  41. package/dist/fr-FR-RHASNOE6-CZFiweNU.js +40 -0
  42. package/dist/ganttDiagram-c361ad54-CAnfd8Sw.js +3420 -0
  43. package/dist/gitGraphDiagram-72cf32ee-CSGI-xRI.js +1790 -0
  44. package/dist/gl-ES-HMX3MZ6V-Bqv2xL-V.js +41 -0
  45. package/dist/graph-Ct2tKpKj.js +1253 -0
  46. package/dist/he-IL-6SHJWFNN-kso30jhn.js +41 -0
  47. package/dist/hi-IN-IWLTKZ5I-Busk5oaa.js +35 -0
  48. package/dist/hu-HU-A5ZG7DT2-xSR2C2H0.js +38 -0
  49. package/dist/id-ID-SAP4L64H-BQQZYm1L.js +41 -0
  50. package/dist/image-EDRW2JGV-Cx7o2kxD.js +6 -0
  51. package/dist/image-blob-reduce.esm-BKPqMdie.js +2396 -0
  52. package/dist/index-3862675e-B3j3w-v_.js +663 -0
  53. package/dist/index-CLOU2Ikr.js +14364 -0
  54. package/dist/index.css +450 -0
  55. package/dist/index.d.ts +40 -0
  56. package/dist/index.js +7 -0
  57. package/dist/index.umd.cjs +235477 -0
  58. package/dist/infoDiagram-f8f76790-NqA75uBo.js +510 -0
  59. package/dist/init-ZxktEp_H.js +16 -0
  60. package/dist/it-IT-JPQ66NNP-CAMVZrYt.js +42 -0
  61. package/dist/ja-JP-DBVTYXUO-CAX8A_Uj.js +39 -0
  62. package/dist/journeyDiagram-49397b02-By5oBzsZ.js +1182 -0
  63. package/dist/kaa-6HZHGXH3-4-o94cPY.js +32 -0
  64. package/dist/kab-KAB-ZGHBKWFO-CgyjjBvZ.js +39 -0
  65. package/dist/katex-C-jAQc2m.js +14516 -0
  66. package/dist/kk-KZ-P5N5QNE5-BEqZcwLA.js +32 -0
  67. package/dist/km-KH-HSX4SM5Z-DvKDbeH4.js +42 -0
  68. package/dist/ko-KR-MTYHY66A-DKCuAbKE.js +40 -0
  69. package/dist/ku-TR-6OUDTVRD-CNUs4cCe.js +40 -0
  70. package/dist/layout-AJxYKqQV.js +2292 -0
  71. package/dist/line-DJIf5OM8.js +45 -0
  72. package/dist/linear-Cfj4s4vI.js +539 -0
  73. package/dist/lt-LT-XHIRWOB4-gouzGdoW.js +34 -0
  74. package/dist/lv-LV-5QDEKY6T-CTvg1XFv.js +38 -0
  75. package/dist/mindmap-definition-fc14e90a-CBlwH_UF.js +35283 -0
  76. package/dist/mr-IN-CRQNXWMA-QeYm06Kq.js +44 -0
  77. package/dist/my-MM-5M5IBNSE-DG3k9ORf.js +32 -0
  78. package/dist/nb-NO-T6EIAALU-Cj995Nmg.js +41 -0
  79. package/dist/nl-NL-IS3SIHDZ-B-2H7xey.js +39 -0
  80. package/dist/nn-NO-6E72VCQL-DrAwKKTN.js +39 -0
  81. package/dist/oc-FR-POXYY2M6-CeyJD7tq.js +39 -0
  82. package/dist/ordinal-DSZU4PqD.js +76 -0
  83. package/dist/pa-IN-N4M65BXN-DHzi6mjo.js +35 -0
  84. package/dist/path-Cp2qmpkd.js +109 -0
  85. package/dist/percentages-BXMCSKIN-CDYsTuua.js +6 -0
  86. package/dist/pica-CzzcRNRD.js +1702 -0
  87. package/dist/pieDiagram-8a3498a8-DueGoZOh.js +768 -0
  88. package/dist/pl-PL-T2D74RX3-BBNEV2c6.js +40 -0
  89. package/dist/pt-BR-5N22H2LF-D2cTx_F0.js +40 -0
  90. package/dist/pt-PT-UZXXM6DQ-BddvLLsF.js +40 -0
  91. package/dist/quadrantDiagram-120e2f19-Tb6_oGIn.js +1198 -0
  92. package/dist/requirementDiagram-deff3bca-CEeg0ep-.js +1089 -0
  93. package/dist/ro-RO-JPDTUUEW-DynuW50i.js +42 -0
  94. package/dist/roundRect-CjfubgrN.js +152 -0
  95. package/dist/ru-RU-B4JR7IUQ-B5Hecrew.js +40 -0
  96. package/dist/sankeyDiagram-04a897e0-CGTLQ8Gm.js +1172 -0
  97. package/dist/sequenceDiagram-704730f1-CZ72D-Nd.js +3336 -0
  98. package/dist/si-LK-N5RQ5JYF-BGMa93tc.js +32 -0
  99. package/dist/sk-SK-C5VTKIMK-BttCAlBm.js +37 -0
  100. package/dist/sl-SI-NN7IZMDC-DTC59nzG.js +37 -0
  101. package/dist/stateDiagram-587899a1-XISZzz_f.js +451 -0
  102. package/dist/stateDiagram-v2-d93cdb3a-DbCcmzTc.js +319 -0
  103. package/dist/styles-6aaf32cf-CyfdkEib.js +1363 -0
  104. package/dist/styles-9a916d00-zQ92RrTB.js +1483 -0
  105. package/dist/styles-c10674c1-BWmkigmR.js +571 -0
  106. package/dist/subset-shared.chunk-BuFt2PpZ.js +8 -0
  107. package/dist/subset-worker.chunk-CgaFXU4O.js +14 -0
  108. package/dist/sv-SE-XGPEYMSR-BPDlPxC1.js +41 -0
  109. package/dist/svgDrawCommon-08f97a94-CJ0lufOi.js +100 -0
  110. package/dist/ta-IN-2NMHFXQM-CI1ZsNk9.js +40 -0
  111. package/dist/th-TH-HPSO5L25-CUM-w2Qt.js +33 -0
  112. package/dist/timeline-definition-85554ec2-DV6084Gl.js +1210 -0
  113. package/dist/tr-TR-DEFEU3FU-CGpyf_vD.js +38 -0
  114. package/dist/uk-UA-QMV73CPH-Bg15Mv3J.js +37 -0
  115. package/dist/vi-VN-M7AON7JQ-AYmca9so.js +36 -0
  116. package/dist/vite.svg +1 -0
  117. package/dist/xychartDiagram-e933f94c-P1e6EEaH.js +1796 -0
  118. package/dist/zh-CN-LNUGB5OW-Dem2Cc-c.js +41 -0
  119. package/dist/zh-HK-E62DVLB3-BjsDyiLI.js +32 -0
  120. package/dist/zh-TW-RAJ6MFWO-IDAsc9Pz.js +40 -0
  121. package/package.json +52 -0
@@ -0,0 +1,1318 @@
1
+ import { o as getDiagramTitle, p as setDiagramTitle, a as getAccDescription, s as setAccDescription, b as getAccTitle, c as setAccTitle, g as getConfig, l as log$1, d as select, u as utils, e as configureSvgSize, r as clear$1, t as curveBasis, Y as parseGenericTypes } from "./index-CLOU2Ikr.js";
2
+ import { G as Graph } from "./graph-Ct2tKpKj.js";
3
+ import { l as layout } from "./layout-AJxYKqQV.js";
4
+ import { l as line } from "./line-DJIf5OM8.js";
5
+ const REGEX = /^(?:[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 validate(uuid) {
7
+ return typeof uuid === "string" && REGEX.test(uuid);
8
+ }
9
+ const byteToHex = [];
10
+ for (let i = 0; i < 256; ++i) {
11
+ byteToHex.push((i + 256).toString(16).slice(1));
12
+ }
13
+ function unsafeStringify(arr, offset = 0) {
14
+ return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
15
+ }
16
+ function parse(uuid) {
17
+ if (!validate(uuid)) {
18
+ throw TypeError("Invalid UUID");
19
+ }
20
+ let v;
21
+ const arr = new Uint8Array(16);
22
+ arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
23
+ arr[1] = v >>> 16 & 255;
24
+ arr[2] = v >>> 8 & 255;
25
+ arr[3] = v & 255;
26
+ arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
27
+ arr[5] = v & 255;
28
+ arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
29
+ arr[7] = v & 255;
30
+ arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
31
+ arr[9] = v & 255;
32
+ arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255;
33
+ arr[11] = v / 4294967296 & 255;
34
+ arr[12] = v >>> 24 & 255;
35
+ arr[13] = v >>> 16 & 255;
36
+ arr[14] = v >>> 8 & 255;
37
+ arr[15] = v & 255;
38
+ return arr;
39
+ }
40
+ function stringToBytes(str) {
41
+ str = unescape(encodeURIComponent(str));
42
+ const bytes = [];
43
+ for (let i = 0; i < str.length; ++i) {
44
+ bytes.push(str.charCodeAt(i));
45
+ }
46
+ return bytes;
47
+ }
48
+ const DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
49
+ const URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
50
+ function v35(name, version, hashfunc) {
51
+ function generateUUID(value, namespace, buf, offset) {
52
+ var _namespace;
53
+ if (typeof value === "string") {
54
+ value = stringToBytes(value);
55
+ }
56
+ if (typeof namespace === "string") {
57
+ namespace = parse(namespace);
58
+ }
59
+ if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
60
+ throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
61
+ }
62
+ let bytes = new Uint8Array(16 + value.length);
63
+ bytes.set(namespace);
64
+ bytes.set(value, namespace.length);
65
+ bytes = hashfunc(bytes);
66
+ bytes[6] = bytes[6] & 15 | version;
67
+ bytes[8] = bytes[8] & 63 | 128;
68
+ if (buf) {
69
+ offset = offset || 0;
70
+ for (let i = 0; i < 16; ++i) {
71
+ buf[offset + i] = bytes[i];
72
+ }
73
+ return buf;
74
+ }
75
+ return unsafeStringify(bytes);
76
+ }
77
+ try {
78
+ generateUUID.name = name;
79
+ } catch (err) {
80
+ }
81
+ generateUUID.DNS = DNS;
82
+ generateUUID.URL = URL;
83
+ return generateUUID;
84
+ }
85
+ function f(s, x, y, z) {
86
+ switch (s) {
87
+ case 0:
88
+ return x & y ^ ~x & z;
89
+ case 1:
90
+ return x ^ y ^ z;
91
+ case 2:
92
+ return x & y ^ x & z ^ y & z;
93
+ case 3:
94
+ return x ^ y ^ z;
95
+ }
96
+ }
97
+ function ROTL(x, n) {
98
+ return x << n | x >>> 32 - n;
99
+ }
100
+ function sha1(bytes) {
101
+ const K = [1518500249, 1859775393, 2400959708, 3395469782];
102
+ const H = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
103
+ if (typeof bytes === "string") {
104
+ const msg = unescape(encodeURIComponent(bytes));
105
+ bytes = [];
106
+ for (let i = 0; i < msg.length; ++i) {
107
+ bytes.push(msg.charCodeAt(i));
108
+ }
109
+ } else if (!Array.isArray(bytes)) {
110
+ bytes = Array.prototype.slice.call(bytes);
111
+ }
112
+ bytes.push(128);
113
+ const l = bytes.length / 4 + 2;
114
+ const N = Math.ceil(l / 16);
115
+ const M = new Array(N);
116
+ for (let i = 0; i < N; ++i) {
117
+ const arr = new Uint32Array(16);
118
+ for (let j = 0; j < 16; ++j) {
119
+ arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];
120
+ }
121
+ M[i] = arr;
122
+ }
123
+ M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);
124
+ M[N - 1][14] = Math.floor(M[N - 1][14]);
125
+ M[N - 1][15] = (bytes.length - 1) * 8 & 4294967295;
126
+ for (let i = 0; i < N; ++i) {
127
+ const W = new Uint32Array(80);
128
+ for (let t = 0; t < 16; ++t) {
129
+ W[t] = M[i][t];
130
+ }
131
+ for (let t = 16; t < 80; ++t) {
132
+ W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);
133
+ }
134
+ let a = H[0];
135
+ let b = H[1];
136
+ let c = H[2];
137
+ let d = H[3];
138
+ let e = H[4];
139
+ for (let t = 0; t < 80; ++t) {
140
+ const s = Math.floor(t / 20);
141
+ const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;
142
+ e = d;
143
+ d = c;
144
+ c = ROTL(b, 30) >>> 0;
145
+ b = a;
146
+ a = T;
147
+ }
148
+ H[0] = H[0] + a >>> 0;
149
+ H[1] = H[1] + b >>> 0;
150
+ H[2] = H[2] + c >>> 0;
151
+ H[3] = H[3] + d >>> 0;
152
+ H[4] = H[4] + e >>> 0;
153
+ }
154
+ return [H[0] >> 24 & 255, H[0] >> 16 & 255, H[0] >> 8 & 255, H[0] & 255, H[1] >> 24 & 255, H[1] >> 16 & 255, H[1] >> 8 & 255, H[1] & 255, H[2] >> 24 & 255, H[2] >> 16 & 255, H[2] >> 8 & 255, H[2] & 255, H[3] >> 24 & 255, H[3] >> 16 & 255, H[3] >> 8 & 255, H[3] & 255, H[4] >> 24 & 255, H[4] >> 16 & 255, H[4] >> 8 & 255, H[4] & 255];
155
+ }
156
+ const v5 = v35("v5", 80, sha1);
157
+ var parser = (function() {
158
+ var o = function(k, v, o2, l) {
159
+ for (o2 = o2 || {}, l = k.length; l--; o2[k[l]] = v)
160
+ ;
161
+ return o2;
162
+ }, $V0 = [6, 8, 10, 20, 22, 24, 26, 27, 28], $V1 = [1, 10], $V2 = [1, 11], $V3 = [1, 12], $V4 = [1, 13], $V5 = [1, 14], $V6 = [1, 15], $V7 = [1, 21], $V8 = [1, 22], $V9 = [1, 23], $Va = [1, 24], $Vb = [1, 25], $Vc = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], $Vd = [1, 34], $Ve = [27, 28, 46, 47], $Vf = [41, 42, 43, 44, 45], $Vg = [17, 34], $Vh = [1, 54], $Vi = [1, 53], $Vj = [17, 34, 36, 38];
163
+ var parser2 = {
164
+ trace: function trace() {
165
+ },
166
+ yy: {},
167
+ 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 },
168
+ 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" },
169
+ 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]],
170
+ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
171
+ var $0 = $$.length - 1;
172
+ switch (yystate) {
173
+ case 1:
174
+ break;
175
+ case 2:
176
+ this.$ = [];
177
+ break;
178
+ case 3:
179
+ $$[$0 - 1].push($$[$0]);
180
+ this.$ = $$[$0 - 1];
181
+ break;
182
+ case 4:
183
+ case 5:
184
+ this.$ = $$[$0];
185
+ break;
186
+ case 6:
187
+ case 7:
188
+ this.$ = [];
189
+ break;
190
+ case 8:
191
+ yy.addEntity($$[$0 - 4]);
192
+ yy.addEntity($$[$0 - 2]);
193
+ yy.addRelationship($$[$0 - 4], $$[$0], $$[$0 - 2], $$[$0 - 3]);
194
+ break;
195
+ case 9:
196
+ yy.addEntity($$[$0 - 3]);
197
+ yy.addAttributes($$[$0 - 3], $$[$0 - 1]);
198
+ break;
199
+ case 10:
200
+ yy.addEntity($$[$0 - 2]);
201
+ break;
202
+ case 11:
203
+ yy.addEntity($$[$0]);
204
+ break;
205
+ case 12:
206
+ yy.addEntity($$[$0 - 6], $$[$0 - 4]);
207
+ yy.addAttributes($$[$0 - 6], $$[$0 - 1]);
208
+ break;
209
+ case 13:
210
+ yy.addEntity($$[$0 - 5], $$[$0 - 3]);
211
+ break;
212
+ case 14:
213
+ yy.addEntity($$[$0 - 3], $$[$0 - 1]);
214
+ break;
215
+ case 15:
216
+ case 16:
217
+ this.$ = $$[$0].trim();
218
+ yy.setAccTitle(this.$);
219
+ break;
220
+ case 17:
221
+ case 18:
222
+ this.$ = $$[$0].trim();
223
+ yy.setAccDescription(this.$);
224
+ break;
225
+ case 19:
226
+ case 43:
227
+ this.$ = $$[$0];
228
+ break;
229
+ case 20:
230
+ case 41:
231
+ case 42:
232
+ this.$ = $$[$0].replace(/"/g, "");
233
+ break;
234
+ case 21:
235
+ case 29:
236
+ this.$ = [$$[$0]];
237
+ break;
238
+ case 22:
239
+ $$[$0].push($$[$0 - 1]);
240
+ this.$ = $$[$0];
241
+ break;
242
+ case 23:
243
+ this.$ = { attributeType: $$[$0 - 1], attributeName: $$[$0] };
244
+ break;
245
+ case 24:
246
+ this.$ = { attributeType: $$[$0 - 2], attributeName: $$[$0 - 1], attributeKeyTypeList: $$[$0] };
247
+ break;
248
+ case 25:
249
+ this.$ = { attributeType: $$[$0 - 2], attributeName: $$[$0 - 1], attributeComment: $$[$0] };
250
+ break;
251
+ case 26:
252
+ this.$ = { attributeType: $$[$0 - 3], attributeName: $$[$0 - 2], attributeKeyTypeList: $$[$0 - 1], attributeComment: $$[$0] };
253
+ break;
254
+ case 27:
255
+ case 28:
256
+ case 31:
257
+ this.$ = $$[$0];
258
+ break;
259
+ case 30:
260
+ $$[$0 - 2].push($$[$0]);
261
+ this.$ = $$[$0 - 2];
262
+ break;
263
+ case 32:
264
+ this.$ = $$[$0].replace(/"/g, "");
265
+ break;
266
+ case 33:
267
+ this.$ = { cardA: $$[$0], relType: $$[$0 - 1], cardB: $$[$0 - 2] };
268
+ break;
269
+ case 34:
270
+ this.$ = yy.Cardinality.ZERO_OR_ONE;
271
+ break;
272
+ case 35:
273
+ this.$ = yy.Cardinality.ZERO_OR_MORE;
274
+ break;
275
+ case 36:
276
+ this.$ = yy.Cardinality.ONE_OR_MORE;
277
+ break;
278
+ case 37:
279
+ this.$ = yy.Cardinality.ONLY_ONE;
280
+ break;
281
+ case 38:
282
+ this.$ = yy.Cardinality.MD_PARENT;
283
+ break;
284
+ case 39:
285
+ this.$ = yy.Identification.NON_IDENTIFYING;
286
+ break;
287
+ case 40:
288
+ this.$ = yy.Identification.IDENTIFYING;
289
+ break;
290
+ }
291
+ },
292
+ table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, o($V0, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 7], { 1: [2, 1] }), o($V0, [2, 3]), { 9: 16, 11: 9, 20: $V1, 22: $V2, 24: $V3, 26: $V4, 27: $V5, 28: $V6 }, o($V0, [2, 5]), o($V0, [2, 6]), o($V0, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, o($V0, [2, 18]), o($Vc, [2, 19]), o($Vc, [2, 20]), o($V0, [2, 4]), { 11: 29, 27: $V5, 28: $V6 }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: $Vd }, { 11: 35, 27: $V5, 28: $V6 }, { 40: 36, 46: [1, 37], 47: [1, 38] }, o($Ve, [2, 34]), o($Ve, [2, 35]), o($Ve, [2, 36]), o($Ve, [2, 37]), o($Ve, [2, 38]), o($V0, [2, 15]), o($V0, [2, 16]), o($V0, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, o($V0, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: $Vd }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: $V7, 42: $V8, 43: $V9, 44: $Va, 45: $Vb }, o($Vf, [2, 39]), o($Vf, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, o($V0, [2, 9]), { 17: [2, 22] }, o($Vg, [2, 23], { 32: 50, 33: 51, 35: 52, 37: $Vh, 38: $Vi }), o([17, 34, 37, 38], [2, 28]), o($V0, [2, 14], { 15: [1, 55] }), o([27, 28], [2, 33]), o($V0, [2, 8]), o($V0, [2, 41]), o($V0, [2, 42]), o($V0, [2, 43]), o($Vg, [2, 24], { 33: 56, 36: [1, 57], 38: $Vi }), o($Vg, [2, 25]), o($Vj, [2, 29]), o($Vg, [2, 32]), o($Vj, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: $Vd }, o($Vg, [2, 26]), { 35: 60, 37: $Vh }, { 17: [1, 61] }, o($V0, [2, 13]), o($Vj, [2, 30]), o($V0, [2, 12])],
293
+ defaultActions: { 34: [2, 27], 41: [2, 22] },
294
+ parseError: function parseError(str, hash) {
295
+ if (hash.recoverable) {
296
+ this.trace(str);
297
+ } else {
298
+ var error = new Error(str);
299
+ error.hash = hash;
300
+ throw error;
301
+ }
302
+ },
303
+ parse: function parse2(input) {
304
+ var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
305
+ var args = lstack.slice.call(arguments, 1);
306
+ var lexer2 = Object.create(this.lexer);
307
+ var sharedState = { yy: {} };
308
+ for (var k in this.yy) {
309
+ if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
310
+ sharedState.yy[k] = this.yy[k];
311
+ }
312
+ }
313
+ lexer2.setInput(input, sharedState.yy);
314
+ sharedState.yy.lexer = lexer2;
315
+ sharedState.yy.parser = this;
316
+ if (typeof lexer2.yylloc == "undefined") {
317
+ lexer2.yylloc = {};
318
+ }
319
+ var yyloc = lexer2.yylloc;
320
+ lstack.push(yyloc);
321
+ var ranges = lexer2.options && lexer2.options.ranges;
322
+ if (typeof sharedState.yy.parseError === "function") {
323
+ this.parseError = sharedState.yy.parseError;
324
+ } else {
325
+ this.parseError = Object.getPrototypeOf(this).parseError;
326
+ }
327
+ function lex() {
328
+ var token;
329
+ token = tstack.pop() || lexer2.lex() || EOF;
330
+ if (typeof token !== "number") {
331
+ if (token instanceof Array) {
332
+ tstack = token;
333
+ token = tstack.pop();
334
+ }
335
+ token = self.symbols_[token] || token;
336
+ }
337
+ return token;
338
+ }
339
+ var symbol, state, action, r, yyval = {}, p, len, newState, expected;
340
+ while (true) {
341
+ state = stack[stack.length - 1];
342
+ if (this.defaultActions[state]) {
343
+ action = this.defaultActions[state];
344
+ } else {
345
+ if (symbol === null || typeof symbol == "undefined") {
346
+ symbol = lex();
347
+ }
348
+ action = table[state] && table[state][symbol];
349
+ }
350
+ if (typeof action === "undefined" || !action.length || !action[0]) {
351
+ var errStr = "";
352
+ expected = [];
353
+ for (p in table[state]) {
354
+ if (this.terminals_[p] && p > TERROR) {
355
+ expected.push("'" + this.terminals_[p] + "'");
356
+ }
357
+ }
358
+ if (lexer2.showPosition) {
359
+ errStr = "Parse error on line " + (yylineno + 1) + ":\n" + lexer2.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'";
360
+ } else {
361
+ errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF ? "end of input" : "'" + (this.terminals_[symbol] || symbol) + "'");
362
+ }
363
+ this.parseError(errStr, {
364
+ text: lexer2.match,
365
+ token: this.terminals_[symbol] || symbol,
366
+ line: lexer2.yylineno,
367
+ loc: yyloc,
368
+ expected
369
+ });
370
+ }
371
+ if (action[0] instanceof Array && action.length > 1) {
372
+ throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol);
373
+ }
374
+ switch (action[0]) {
375
+ case 1:
376
+ stack.push(symbol);
377
+ vstack.push(lexer2.yytext);
378
+ lstack.push(lexer2.yylloc);
379
+ stack.push(action[1]);
380
+ symbol = null;
381
+ {
382
+ yyleng = lexer2.yyleng;
383
+ yytext = lexer2.yytext;
384
+ yylineno = lexer2.yylineno;
385
+ yyloc = lexer2.yylloc;
386
+ }
387
+ break;
388
+ case 2:
389
+ len = this.productions_[action[1]][1];
390
+ yyval.$ = vstack[vstack.length - len];
391
+ yyval._$ = {
392
+ first_line: lstack[lstack.length - (len || 1)].first_line,
393
+ last_line: lstack[lstack.length - 1].last_line,
394
+ first_column: lstack[lstack.length - (len || 1)].first_column,
395
+ last_column: lstack[lstack.length - 1].last_column
396
+ };
397
+ if (ranges) {
398
+ yyval._$.range = [
399
+ lstack[lstack.length - (len || 1)].range[0],
400
+ lstack[lstack.length - 1].range[1]
401
+ ];
402
+ }
403
+ r = this.performAction.apply(yyval, [
404
+ yytext,
405
+ yyleng,
406
+ yylineno,
407
+ sharedState.yy,
408
+ action[1],
409
+ vstack,
410
+ lstack
411
+ ].concat(args));
412
+ if (typeof r !== "undefined") {
413
+ return r;
414
+ }
415
+ if (len) {
416
+ stack = stack.slice(0, -1 * len * 2);
417
+ vstack = vstack.slice(0, -1 * len);
418
+ lstack = lstack.slice(0, -1 * len);
419
+ }
420
+ stack.push(this.productions_[action[1]][0]);
421
+ vstack.push(yyval.$);
422
+ lstack.push(yyval._$);
423
+ newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
424
+ stack.push(newState);
425
+ break;
426
+ case 3:
427
+ return true;
428
+ }
429
+ }
430
+ return true;
431
+ }
432
+ };
433
+ var lexer = /* @__PURE__ */ (function() {
434
+ var lexer2 = {
435
+ EOF: 1,
436
+ parseError: function parseError(str, hash) {
437
+ if (this.yy.parser) {
438
+ this.yy.parser.parseError(str, hash);
439
+ } else {
440
+ throw new Error(str);
441
+ }
442
+ },
443
+ // resets the lexer, sets new input
444
+ setInput: function(input, yy) {
445
+ this.yy = yy || this.yy || {};
446
+ this._input = input;
447
+ this._more = this._backtrack = this.done = false;
448
+ this.yylineno = this.yyleng = 0;
449
+ this.yytext = this.matched = this.match = "";
450
+ this.conditionStack = ["INITIAL"];
451
+ this.yylloc = {
452
+ first_line: 1,
453
+ first_column: 0,
454
+ last_line: 1,
455
+ last_column: 0
456
+ };
457
+ if (this.options.ranges) {
458
+ this.yylloc.range = [0, 0];
459
+ }
460
+ this.offset = 0;
461
+ return this;
462
+ },
463
+ // consumes and returns one char from the input
464
+ input: function() {
465
+ var ch = this._input[0];
466
+ this.yytext += ch;
467
+ this.yyleng++;
468
+ this.offset++;
469
+ this.match += ch;
470
+ this.matched += ch;
471
+ var lines = ch.match(/(?:\r\n?|\n).*/g);
472
+ if (lines) {
473
+ this.yylineno++;
474
+ this.yylloc.last_line++;
475
+ } else {
476
+ this.yylloc.last_column++;
477
+ }
478
+ if (this.options.ranges) {
479
+ this.yylloc.range[1]++;
480
+ }
481
+ this._input = this._input.slice(1);
482
+ return ch;
483
+ },
484
+ // unshifts one char (or a string) into the input
485
+ unput: function(ch) {
486
+ var len = ch.length;
487
+ var lines = ch.split(/(?:\r\n?|\n)/g);
488
+ this._input = ch + this._input;
489
+ this.yytext = this.yytext.substr(0, this.yytext.length - len);
490
+ this.offset -= len;
491
+ var oldLines = this.match.split(/(?:\r\n?|\n)/g);
492
+ this.match = this.match.substr(0, this.match.length - 1);
493
+ this.matched = this.matched.substr(0, this.matched.length - 1);
494
+ if (lines.length - 1) {
495
+ this.yylineno -= lines.length - 1;
496
+ }
497
+ var r = this.yylloc.range;
498
+ this.yylloc = {
499
+ first_line: this.yylloc.first_line,
500
+ last_line: this.yylineno + 1,
501
+ first_column: this.yylloc.first_column,
502
+ last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
503
+ };
504
+ if (this.options.ranges) {
505
+ this.yylloc.range = [r[0], r[0] + this.yyleng - len];
506
+ }
507
+ this.yyleng = this.yytext.length;
508
+ return this;
509
+ },
510
+ // When called from action, caches matched text and appends it on next action
511
+ more: function() {
512
+ this._more = true;
513
+ return this;
514
+ },
515
+ // 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.
516
+ reject: function() {
517
+ if (this.options.backtrack_lexer) {
518
+ this._backtrack = true;
519
+ } else {
520
+ 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).\n" + this.showPosition(), {
521
+ text: "",
522
+ token: null,
523
+ line: this.yylineno
524
+ });
525
+ }
526
+ return this;
527
+ },
528
+ // retain first n characters of the match
529
+ less: function(n) {
530
+ this.unput(this.match.slice(n));
531
+ },
532
+ // displays already matched input, i.e. for error messages
533
+ pastInput: function() {
534
+ var past = this.matched.substr(0, this.matched.length - this.match.length);
535
+ return (past.length > 20 ? "..." : "") + past.substr(-20).replace(/\n/g, "");
536
+ },
537
+ // displays upcoming input, i.e. for error messages
538
+ upcomingInput: function() {
539
+ var next = this.match;
540
+ if (next.length < 20) {
541
+ next += this._input.substr(0, 20 - next.length);
542
+ }
543
+ return (next.substr(0, 20) + (next.length > 20 ? "..." : "")).replace(/\n/g, "");
544
+ },
545
+ // displays the character position where the lexing error occurred, i.e. for error messages
546
+ showPosition: function() {
547
+ var pre = this.pastInput();
548
+ var c = new Array(pre.length + 1).join("-");
549
+ return pre + this.upcomingInput() + "\n" + c + "^";
550
+ },
551
+ // test the lexed token: return FALSE when not a match, otherwise return token
552
+ test_match: function(match, indexed_rule) {
553
+ var token, lines, backup;
554
+ if (this.options.backtrack_lexer) {
555
+ backup = {
556
+ yylineno: this.yylineno,
557
+ yylloc: {
558
+ first_line: this.yylloc.first_line,
559
+ last_line: this.last_line,
560
+ first_column: this.yylloc.first_column,
561
+ last_column: this.yylloc.last_column
562
+ },
563
+ yytext: this.yytext,
564
+ match: this.match,
565
+ matches: this.matches,
566
+ matched: this.matched,
567
+ yyleng: this.yyleng,
568
+ offset: this.offset,
569
+ _more: this._more,
570
+ _input: this._input,
571
+ yy: this.yy,
572
+ conditionStack: this.conditionStack.slice(0),
573
+ done: this.done
574
+ };
575
+ if (this.options.ranges) {
576
+ backup.yylloc.range = this.yylloc.range.slice(0);
577
+ }
578
+ }
579
+ lines = match[0].match(/(?:\r\n?|\n).*/g);
580
+ if (lines) {
581
+ this.yylineno += lines.length;
582
+ }
583
+ this.yylloc = {
584
+ first_line: this.yylloc.last_line,
585
+ last_line: this.yylineno + 1,
586
+ first_column: this.yylloc.last_column,
587
+ last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
588
+ };
589
+ this.yytext += match[0];
590
+ this.match += match[0];
591
+ this.matches = match;
592
+ this.yyleng = this.yytext.length;
593
+ if (this.options.ranges) {
594
+ this.yylloc.range = [this.offset, this.offset += this.yyleng];
595
+ }
596
+ this._more = false;
597
+ this._backtrack = false;
598
+ this._input = this._input.slice(match[0].length);
599
+ this.matched += match[0];
600
+ token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
601
+ if (this.done && this._input) {
602
+ this.done = false;
603
+ }
604
+ if (token) {
605
+ return token;
606
+ } else if (this._backtrack) {
607
+ for (var k in backup) {
608
+ this[k] = backup[k];
609
+ }
610
+ return false;
611
+ }
612
+ return false;
613
+ },
614
+ // return next match in input
615
+ next: function() {
616
+ if (this.done) {
617
+ return this.EOF;
618
+ }
619
+ if (!this._input) {
620
+ this.done = true;
621
+ }
622
+ var token, match, tempMatch, index;
623
+ if (!this._more) {
624
+ this.yytext = "";
625
+ this.match = "";
626
+ }
627
+ var rules = this._currentRules();
628
+ for (var i = 0; i < rules.length; i++) {
629
+ tempMatch = this._input.match(this.rules[rules[i]]);
630
+ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
631
+ match = tempMatch;
632
+ index = i;
633
+ if (this.options.backtrack_lexer) {
634
+ token = this.test_match(tempMatch, rules[i]);
635
+ if (token !== false) {
636
+ return token;
637
+ } else if (this._backtrack) {
638
+ match = false;
639
+ continue;
640
+ } else {
641
+ return false;
642
+ }
643
+ } else if (!this.options.flex) {
644
+ break;
645
+ }
646
+ }
647
+ }
648
+ if (match) {
649
+ token = this.test_match(match, rules[index]);
650
+ if (token !== false) {
651
+ return token;
652
+ }
653
+ return false;
654
+ }
655
+ if (this._input === "") {
656
+ return this.EOF;
657
+ } else {
658
+ return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
659
+ text: "",
660
+ token: null,
661
+ line: this.yylineno
662
+ });
663
+ }
664
+ },
665
+ // return next match that has a token
666
+ lex: function lex() {
667
+ var r = this.next();
668
+ if (r) {
669
+ return r;
670
+ } else {
671
+ return this.lex();
672
+ }
673
+ },
674
+ // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
675
+ begin: function begin(condition) {
676
+ this.conditionStack.push(condition);
677
+ },
678
+ // pop the previously active lexer condition state off the condition stack
679
+ popState: function popState() {
680
+ var n = this.conditionStack.length - 1;
681
+ if (n > 0) {
682
+ return this.conditionStack.pop();
683
+ } else {
684
+ return this.conditionStack[0];
685
+ }
686
+ },
687
+ // produce the lexer rule set which is active for the currently active lexer condition state
688
+ _currentRules: function _currentRules() {
689
+ if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
690
+ return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
691
+ } else {
692
+ return this.conditions["INITIAL"].rules;
693
+ }
694
+ },
695
+ // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
696
+ topState: function topState(n) {
697
+ n = this.conditionStack.length - 1 - Math.abs(n || 0);
698
+ if (n >= 0) {
699
+ return this.conditionStack[n];
700
+ } else {
701
+ return "INITIAL";
702
+ }
703
+ },
704
+ // alias for begin(condition)
705
+ pushState: function pushState(condition) {
706
+ this.begin(condition);
707
+ },
708
+ // return the number of states currently on the stack
709
+ stateStackSize: function stateStackSize() {
710
+ return this.conditionStack.length;
711
+ },
712
+ options: { "case-insensitive": true },
713
+ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
714
+ switch ($avoiding_name_collisions) {
715
+ case 0:
716
+ this.begin("acc_title");
717
+ return 22;
718
+ case 1:
719
+ this.popState();
720
+ return "acc_title_value";
721
+ case 2:
722
+ this.begin("acc_descr");
723
+ return 24;
724
+ case 3:
725
+ this.popState();
726
+ return "acc_descr_value";
727
+ case 4:
728
+ this.begin("acc_descr_multiline");
729
+ break;
730
+ case 5:
731
+ this.popState();
732
+ break;
733
+ case 6:
734
+ return "acc_descr_multiline_value";
735
+ case 7:
736
+ return 10;
737
+ case 8:
738
+ break;
739
+ case 9:
740
+ return 8;
741
+ case 10:
742
+ return 28;
743
+ case 11:
744
+ return 48;
745
+ case 12:
746
+ return 4;
747
+ case 13:
748
+ this.begin("block");
749
+ return 15;
750
+ case 14:
751
+ return 36;
752
+ case 15:
753
+ break;
754
+ case 16:
755
+ return 37;
756
+ case 17:
757
+ return 34;
758
+ case 18:
759
+ return 34;
760
+ case 19:
761
+ return 38;
762
+ case 20:
763
+ break;
764
+ case 21:
765
+ this.popState();
766
+ return 17;
767
+ case 22:
768
+ return yy_.yytext[0];
769
+ case 23:
770
+ return 18;
771
+ case 24:
772
+ return 19;
773
+ case 25:
774
+ return 41;
775
+ case 26:
776
+ return 43;
777
+ case 27:
778
+ return 43;
779
+ case 28:
780
+ return 43;
781
+ case 29:
782
+ return 41;
783
+ case 30:
784
+ return 41;
785
+ case 31:
786
+ return 42;
787
+ case 32:
788
+ return 42;
789
+ case 33:
790
+ return 42;
791
+ case 34:
792
+ return 42;
793
+ case 35:
794
+ return 42;
795
+ case 36:
796
+ return 43;
797
+ case 37:
798
+ return 42;
799
+ case 38:
800
+ return 43;
801
+ case 39:
802
+ return 44;
803
+ case 40:
804
+ return 44;
805
+ case 41:
806
+ return 44;
807
+ case 42:
808
+ return 44;
809
+ case 43:
810
+ return 41;
811
+ case 44:
812
+ return 42;
813
+ case 45:
814
+ return 43;
815
+ case 46:
816
+ return 45;
817
+ case 47:
818
+ return 46;
819
+ case 48:
820
+ return 47;
821
+ case 49:
822
+ return 47;
823
+ case 50:
824
+ return 46;
825
+ case 51:
826
+ return 46;
827
+ case 52:
828
+ return 46;
829
+ case 53:
830
+ return 27;
831
+ case 54:
832
+ return yy_.yytext[0];
833
+ case 55:
834
+ return 6;
835
+ }
836
+ },
837
+ 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],
838
+ conditions: { "acc_descr_multiline": { "rules": [5, 6], "inclusive": false }, "acc_descr": { "rules": [3], "inclusive": false }, "acc_title": { "rules": [1], "inclusive": false }, "block": { "rules": [14, 15, 16, 17, 18, 19, 20, 21, 22], "inclusive": false }, "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": true } }
839
+ };
840
+ return lexer2;
841
+ })();
842
+ parser2.lexer = lexer;
843
+ function Parser() {
844
+ this.yy = {};
845
+ }
846
+ Parser.prototype = parser2;
847
+ parser2.Parser = Parser;
848
+ return new Parser();
849
+ })();
850
+ parser.parser = parser;
851
+ const erParser = parser;
852
+ let entities = {};
853
+ let relationships = [];
854
+ const Cardinality = {
855
+ ZERO_OR_ONE: "ZERO_OR_ONE",
856
+ ZERO_OR_MORE: "ZERO_OR_MORE",
857
+ ONE_OR_MORE: "ONE_OR_MORE",
858
+ ONLY_ONE: "ONLY_ONE",
859
+ MD_PARENT: "MD_PARENT"
860
+ };
861
+ const Identification = {
862
+ NON_IDENTIFYING: "NON_IDENTIFYING",
863
+ IDENTIFYING: "IDENTIFYING"
864
+ };
865
+ const addEntity = function(name, alias = void 0) {
866
+ if (entities[name] === void 0) {
867
+ entities[name] = { attributes: [], alias };
868
+ log$1.info("Added new entity :", name);
869
+ } else if (entities[name] && !entities[name].alias && alias) {
870
+ entities[name].alias = alias;
871
+ log$1.info(`Add alias '${alias}' to entity '${name}'`);
872
+ }
873
+ return entities[name];
874
+ };
875
+ const getEntities = () => entities;
876
+ const addAttributes = function(entityName, attribs) {
877
+ let entity = addEntity(entityName);
878
+ let i;
879
+ for (i = attribs.length - 1; i >= 0; i--) {
880
+ entity.attributes.push(attribs[i]);
881
+ log$1.debug("Added attribute ", attribs[i].attributeName);
882
+ }
883
+ };
884
+ const addRelationship = function(entA, rolA, entB, rSpec) {
885
+ let rel = {
886
+ entityA: entA,
887
+ roleA: rolA,
888
+ entityB: entB,
889
+ relSpec: rSpec
890
+ };
891
+ relationships.push(rel);
892
+ log$1.debug("Added new relationship :", rel);
893
+ };
894
+ const getRelationships = () => relationships;
895
+ const clear = function() {
896
+ entities = {};
897
+ relationships = [];
898
+ clear$1();
899
+ };
900
+ const erDb = {
901
+ Cardinality,
902
+ Identification,
903
+ getConfig: () => getConfig().er,
904
+ addEntity,
905
+ addAttributes,
906
+ getEntities,
907
+ addRelationship,
908
+ getRelationships,
909
+ clear,
910
+ setAccTitle,
911
+ getAccTitle,
912
+ setAccDescription,
913
+ getAccDescription,
914
+ setDiagramTitle,
915
+ getDiagramTitle
916
+ };
917
+ const ERMarkers = {
918
+ ONLY_ONE_START: "ONLY_ONE_START",
919
+ ONLY_ONE_END: "ONLY_ONE_END",
920
+ ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
921
+ ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
922
+ ONE_OR_MORE_START: "ONE_OR_MORE_START",
923
+ ONE_OR_MORE_END: "ONE_OR_MORE_END",
924
+ ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
925
+ ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
926
+ MD_PARENT_END: "MD_PARENT_END",
927
+ MD_PARENT_START: "MD_PARENT_START"
928
+ };
929
+ const insertMarkers = function(elem, conf2) {
930
+ let marker;
931
+ elem.append("defs").append("marker").attr("id", ERMarkers.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");
932
+ elem.append("defs").append("marker").attr("id", ERMarkers.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");
933
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18");
934
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18");
935
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
936
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6);
937
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M9,0 L9,18");
938
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto");
939
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6);
940
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M21,0 L21,18");
941
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27");
942
+ elem.append("defs").append("marker").attr("id", ERMarkers.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18");
943
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
944
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6);
945
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18");
946
+ marker = elem.append("defs").append("marker").attr("id", ERMarkers.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto");
947
+ marker.append("circle").attr("stroke", conf2.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6);
948
+ marker.append("path").attr("stroke", conf2.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
949
+ return;
950
+ };
951
+ const erMarkers = {
952
+ ERMarkers,
953
+ insertMarkers
954
+ };
955
+ const BAD_ID_CHARS_REGEXP = /[^\dA-Za-z](\W)*/g;
956
+ let conf = {};
957
+ let entityNameIds = /* @__PURE__ */ new Map();
958
+ const setConf = function(cnf) {
959
+ const keys = Object.keys(cnf);
960
+ for (const key of keys) {
961
+ conf[key] = cnf[key];
962
+ }
963
+ };
964
+ const drawAttributes = (groupNode, entityTextNode, attributes) => {
965
+ const heightPadding = conf.entityPadding / 3;
966
+ const widthPadding = conf.entityPadding / 3;
967
+ const attrFontSize = conf.fontSize * 0.85;
968
+ const labelBBox = entityTextNode.node().getBBox();
969
+ const attributeNodes = [];
970
+ let hasKeyType = false;
971
+ let hasComment = false;
972
+ let maxTypeWidth = 0;
973
+ let maxNameWidth = 0;
974
+ let maxKeyWidth = 0;
975
+ let maxCommentWidth = 0;
976
+ let cumulativeHeight = labelBBox.height + heightPadding * 2;
977
+ let attrNum = 1;
978
+ attributes.forEach((item) => {
979
+ if (item.attributeKeyTypeList !== void 0 && item.attributeKeyTypeList.length > 0) {
980
+ hasKeyType = true;
981
+ }
982
+ if (item.attributeComment !== void 0) {
983
+ hasComment = true;
984
+ }
985
+ });
986
+ attributes.forEach((item) => {
987
+ const attrPrefix = `${entityTextNode.node().id}-attr-${attrNum}`;
988
+ let nodeHeight = 0;
989
+ const attributeType = parseGenericTypes(item.attributeType);
990
+ const typeNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(attributeType);
991
+ const nameNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(item.attributeName);
992
+ const attributeNode = {};
993
+ attributeNode.tn = typeNode;
994
+ attributeNode.nn = nameNode;
995
+ const typeBBox = typeNode.node().getBBox();
996
+ const nameBBox = nameNode.node().getBBox();
997
+ maxTypeWidth = Math.max(maxTypeWidth, typeBBox.width);
998
+ maxNameWidth = Math.max(maxNameWidth, nameBBox.width);
999
+ nodeHeight = Math.max(typeBBox.height, nameBBox.height);
1000
+ if (hasKeyType) {
1001
+ const keyTypeNodeText = item.attributeKeyTypeList !== void 0 ? item.attributeKeyTypeList.join(",") : "";
1002
+ const keyTypeNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(keyTypeNodeText);
1003
+ attributeNode.kn = keyTypeNode;
1004
+ const keyTypeBBox = keyTypeNode.node().getBBox();
1005
+ maxKeyWidth = Math.max(maxKeyWidth, keyTypeBBox.width);
1006
+ nodeHeight = Math.max(nodeHeight, keyTypeBBox.height);
1007
+ }
1008
+ if (hasComment) {
1009
+ const commentNode = groupNode.append("text").classed("er entityLabel", true).attr("id", `${attrPrefix}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", getConfig().fontFamily).style("font-size", attrFontSize + "px").text(item.attributeComment || "");
1010
+ attributeNode.cn = commentNode;
1011
+ const commentNodeBBox = commentNode.node().getBBox();
1012
+ maxCommentWidth = Math.max(maxCommentWidth, commentNodeBBox.width);
1013
+ nodeHeight = Math.max(nodeHeight, commentNodeBBox.height);
1014
+ }
1015
+ attributeNode.height = nodeHeight;
1016
+ attributeNodes.push(attributeNode);
1017
+ cumulativeHeight += nodeHeight + heightPadding * 2;
1018
+ attrNum += 1;
1019
+ });
1020
+ let widthPaddingFactor = 4;
1021
+ if (hasKeyType) {
1022
+ widthPaddingFactor += 2;
1023
+ }
1024
+ if (hasComment) {
1025
+ widthPaddingFactor += 2;
1026
+ }
1027
+ const maxWidth = maxTypeWidth + maxNameWidth + maxKeyWidth + maxCommentWidth;
1028
+ const bBox = {
1029
+ width: Math.max(
1030
+ conf.minEntityWidth,
1031
+ Math.max(
1032
+ labelBBox.width + conf.entityPadding * 2,
1033
+ maxWidth + widthPadding * widthPaddingFactor
1034
+ )
1035
+ ),
1036
+ height: attributes.length > 0 ? cumulativeHeight : Math.max(conf.minEntityHeight, labelBBox.height + conf.entityPadding * 2)
1037
+ };
1038
+ if (attributes.length > 0) {
1039
+ const spareColumnWidth = Math.max(
1040
+ 0,
1041
+ (bBox.width - maxWidth - widthPadding * widthPaddingFactor) / (widthPaddingFactor / 2)
1042
+ );
1043
+ entityTextNode.attr(
1044
+ "transform",
1045
+ "translate(" + bBox.width / 2 + "," + (heightPadding + labelBBox.height / 2) + ")"
1046
+ );
1047
+ let heightOffset = labelBBox.height + heightPadding * 2;
1048
+ let attribStyle = "attributeBoxOdd";
1049
+ attributeNodes.forEach((attributeNode) => {
1050
+ const alignY = heightOffset + heightPadding + attributeNode.height / 2;
1051
+ attributeNode.tn.attr("transform", "translate(" + widthPadding + "," + alignY + ")");
1052
+ const typeRect = groupNode.insert("rect", "#" + attributeNode.tn.node().id).classed(`er ${attribStyle}`, true).attr("x", 0).attr("y", heightOffset).attr("width", maxTypeWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
1053
+ const nameXOffset = parseFloat(typeRect.attr("x")) + parseFloat(typeRect.attr("width"));
1054
+ attributeNode.nn.attr(
1055
+ "transform",
1056
+ "translate(" + (nameXOffset + widthPadding) + "," + alignY + ")"
1057
+ );
1058
+ const nameRect = groupNode.insert("rect", "#" + attributeNode.nn.node().id).classed(`er ${attribStyle}`, true).attr("x", nameXOffset).attr("y", heightOffset).attr("width", maxNameWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
1059
+ let keyTypeAndCommentXOffset = parseFloat(nameRect.attr("x")) + parseFloat(nameRect.attr("width"));
1060
+ if (hasKeyType) {
1061
+ attributeNode.kn.attr(
1062
+ "transform",
1063
+ "translate(" + (keyTypeAndCommentXOffset + widthPadding) + "," + alignY + ")"
1064
+ );
1065
+ const keyTypeRect = groupNode.insert("rect", "#" + attributeNode.kn.node().id).classed(`er ${attribStyle}`, true).attr("x", keyTypeAndCommentXOffset).attr("y", heightOffset).attr("width", maxKeyWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
1066
+ keyTypeAndCommentXOffset = parseFloat(keyTypeRect.attr("x")) + parseFloat(keyTypeRect.attr("width"));
1067
+ }
1068
+ if (hasComment) {
1069
+ attributeNode.cn.attr(
1070
+ "transform",
1071
+ "translate(" + (keyTypeAndCommentXOffset + widthPadding) + "," + alignY + ")"
1072
+ );
1073
+ groupNode.insert("rect", "#" + attributeNode.cn.node().id).classed(`er ${attribStyle}`, "true").attr("x", keyTypeAndCommentXOffset).attr("y", heightOffset).attr("width", maxCommentWidth + widthPadding * 2 + spareColumnWidth).attr("height", attributeNode.height + heightPadding * 2);
1074
+ }
1075
+ heightOffset += attributeNode.height + heightPadding * 2;
1076
+ attribStyle = attribStyle === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
1077
+ });
1078
+ } else {
1079
+ bBox.height = Math.max(conf.minEntityHeight, cumulativeHeight);
1080
+ entityTextNode.attr("transform", "translate(" + bBox.width / 2 + "," + bBox.height / 2 + ")");
1081
+ }
1082
+ return bBox;
1083
+ };
1084
+ const drawEntities = function(svgNode, entities2, graph) {
1085
+ const keys = Object.keys(entities2);
1086
+ let firstOne;
1087
+ keys.forEach(function(entityName) {
1088
+ const entityId = generateId(entityName, "entity");
1089
+ entityNameIds.set(entityName, entityId);
1090
+ const groupNode = svgNode.append("g").attr("id", entityId);
1091
+ firstOne = firstOne === void 0 ? entityId : firstOne;
1092
+ const textId = "text-" + entityId;
1093
+ const textNode = groupNode.append("text").classed("er entityLabel", true).attr("id", textId).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(entities2[entityName].alias ?? entityName);
1094
+ const { width: entityWidth, height: entityHeight } = drawAttributes(
1095
+ groupNode,
1096
+ textNode,
1097
+ entities2[entityName].attributes
1098
+ );
1099
+ const rectNode = groupNode.insert("rect", "#" + textId).classed("er entityBox", true).attr("x", 0).attr("y", 0).attr("width", entityWidth).attr("height", entityHeight);
1100
+ const rectBBox = rectNode.node().getBBox();
1101
+ graph.setNode(entityId, {
1102
+ width: rectBBox.width,
1103
+ height: rectBBox.height,
1104
+ shape: "rect",
1105
+ id: entityId
1106
+ });
1107
+ });
1108
+ return firstOne;
1109
+ };
1110
+ const adjustEntities = function(svgNode, graph) {
1111
+ graph.nodes().forEach(function(v) {
1112
+ if (v !== void 0 && graph.node(v) !== void 0) {
1113
+ svgNode.select("#" + v).attr(
1114
+ "transform",
1115
+ "translate(" + (graph.node(v).x - graph.node(v).width / 2) + "," + (graph.node(v).y - graph.node(v).height / 2) + " )"
1116
+ );
1117
+ }
1118
+ });
1119
+ };
1120
+ const getEdgeName = function(rel) {
1121
+ return (rel.entityA + rel.roleA + rel.entityB).replace(/\s/g, "");
1122
+ };
1123
+ const addRelationships = function(relationships2, g) {
1124
+ relationships2.forEach(function(r) {
1125
+ g.setEdge(
1126
+ entityNameIds.get(r.entityA),
1127
+ entityNameIds.get(r.entityB),
1128
+ { relationship: r },
1129
+ getEdgeName(r)
1130
+ );
1131
+ });
1132
+ return relationships2;
1133
+ };
1134
+ let relCnt = 0;
1135
+ const drawRelationshipFromLayout = function(svg, rel, g, insert, diagObj) {
1136
+ relCnt++;
1137
+ const edge = g.edge(
1138
+ entityNameIds.get(rel.entityA),
1139
+ entityNameIds.get(rel.entityB),
1140
+ getEdgeName(rel)
1141
+ );
1142
+ const lineFunction = line().x(function(d) {
1143
+ return d.x;
1144
+ }).y(function(d) {
1145
+ return d.y;
1146
+ }).curve(curveBasis);
1147
+ const svgPath = svg.insert("path", "#" + insert).classed("er relationshipLine", true).attr("d", lineFunction(edge.points)).style("stroke", conf.stroke).style("fill", "none");
1148
+ if (rel.relSpec.relType === diagObj.db.Identification.NON_IDENTIFYING) {
1149
+ svgPath.attr("stroke-dasharray", "8,8");
1150
+ }
1151
+ let url = "";
1152
+ if (conf.arrowMarkerAbsolute) {
1153
+ url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
1154
+ url = url.replace(/\(/g, "\\(");
1155
+ url = url.replace(/\)/g, "\\)");
1156
+ }
1157
+ switch (rel.relSpec.cardA) {
1158
+ case diagObj.db.Cardinality.ZERO_OR_ONE:
1159
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_END + ")");
1160
+ break;
1161
+ case diagObj.db.Cardinality.ZERO_OR_MORE:
1162
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_END + ")");
1163
+ break;
1164
+ case diagObj.db.Cardinality.ONE_OR_MORE:
1165
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_END + ")");
1166
+ break;
1167
+ case diagObj.db.Cardinality.ONLY_ONE:
1168
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_END + ")");
1169
+ break;
1170
+ case diagObj.db.Cardinality.MD_PARENT:
1171
+ svgPath.attr("marker-end", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_END + ")");
1172
+ break;
1173
+ }
1174
+ switch (rel.relSpec.cardB) {
1175
+ case diagObj.db.Cardinality.ZERO_OR_ONE:
1176
+ svgPath.attr(
1177
+ "marker-start",
1178
+ "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_ONE_START + ")"
1179
+ );
1180
+ break;
1181
+ case diagObj.db.Cardinality.ZERO_OR_MORE:
1182
+ svgPath.attr(
1183
+ "marker-start",
1184
+ "url(" + url + "#" + erMarkers.ERMarkers.ZERO_OR_MORE_START + ")"
1185
+ );
1186
+ break;
1187
+ case diagObj.db.Cardinality.ONE_OR_MORE:
1188
+ svgPath.attr(
1189
+ "marker-start",
1190
+ "url(" + url + "#" + erMarkers.ERMarkers.ONE_OR_MORE_START + ")"
1191
+ );
1192
+ break;
1193
+ case diagObj.db.Cardinality.ONLY_ONE:
1194
+ svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.ONLY_ONE_START + ")");
1195
+ break;
1196
+ case diagObj.db.Cardinality.MD_PARENT:
1197
+ svgPath.attr("marker-start", "url(" + url + "#" + erMarkers.ERMarkers.MD_PARENT_START + ")");
1198
+ break;
1199
+ }
1200
+ const len = svgPath.node().getTotalLength();
1201
+ const labelPoint = svgPath.node().getPointAtLength(len * 0.5);
1202
+ const labelId = "rel" + relCnt;
1203
+ const labelNode = svg.append("text").classed("er relationshipLabel", true).attr("id", labelId).attr("x", labelPoint.x).attr("y", labelPoint.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", getConfig().fontFamily).style("font-size", conf.fontSize + "px").text(rel.roleA);
1204
+ const labelBBox = labelNode.node().getBBox();
1205
+ svg.insert("rect", "#" + labelId).classed("er relationshipLabelBox", true).attr("x", labelPoint.x - labelBBox.width / 2).attr("y", labelPoint.y - labelBBox.height / 2).attr("width", labelBBox.width).attr("height", labelBBox.height);
1206
+ };
1207
+ const draw = function(text, id, _version, diagObj) {
1208
+ conf = getConfig().er;
1209
+ log$1.info("Drawing ER diagram");
1210
+ const securityLevel = getConfig().securityLevel;
1211
+ let sandboxElement;
1212
+ if (securityLevel === "sandbox") {
1213
+ sandboxElement = select("#i" + id);
1214
+ }
1215
+ const root = securityLevel === "sandbox" ? select(sandboxElement.nodes()[0].contentDocument.body) : select("body");
1216
+ const svg = root.select(`[id='${id}']`);
1217
+ erMarkers.insertMarkers(svg, conf);
1218
+ let g;
1219
+ g = new Graph({
1220
+ multigraph: true,
1221
+ directed: true,
1222
+ compound: false
1223
+ }).setGraph({
1224
+ rankdir: conf.layoutDirection,
1225
+ marginx: 20,
1226
+ marginy: 20,
1227
+ nodesep: 100,
1228
+ edgesep: 100,
1229
+ ranksep: 100
1230
+ }).setDefaultEdgeLabel(function() {
1231
+ return {};
1232
+ });
1233
+ const firstEntity = drawEntities(svg, diagObj.db.getEntities(), g);
1234
+ const relationships2 = addRelationships(diagObj.db.getRelationships(), g);
1235
+ layout(g);
1236
+ adjustEntities(svg, g);
1237
+ relationships2.forEach(function(rel) {
1238
+ drawRelationshipFromLayout(svg, rel, g, firstEntity, diagObj);
1239
+ });
1240
+ const padding = conf.diagramPadding;
1241
+ utils.insertTitle(svg, "entityTitleText", conf.titleTopMargin, diagObj.db.getDiagramTitle());
1242
+ const svgBounds = svg.node().getBBox();
1243
+ const width = svgBounds.width + padding * 2;
1244
+ const height = svgBounds.height + padding * 2;
1245
+ configureSvgSize(svg, height, width, conf.useMaxWidth);
1246
+ svg.attr("viewBox", `${svgBounds.x - padding} ${svgBounds.y - padding} ${width} ${height}`);
1247
+ };
1248
+ const MERMAID_ERDIAGRAM_UUID = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
1249
+ function generateId(str = "", prefix = "") {
1250
+ const simplifiedStr = str.replace(BAD_ID_CHARS_REGEXP, "");
1251
+ return `${strWithHyphen(prefix)}${strWithHyphen(simplifiedStr)}${v5(
1252
+ str,
1253
+ MERMAID_ERDIAGRAM_UUID
1254
+ )}`;
1255
+ }
1256
+ function strWithHyphen(str = "") {
1257
+ return str.length > 0 ? `${str}-` : "";
1258
+ }
1259
+ const erRenderer = {
1260
+ setConf,
1261
+ draw
1262
+ };
1263
+ const getStyles = (options) => `
1264
+ .entityBox {
1265
+ fill: ${options.mainBkg};
1266
+ stroke: ${options.nodeBorder};
1267
+ }
1268
+
1269
+ .attributeBoxOdd {
1270
+ fill: ${options.attributeBackgroundColorOdd};
1271
+ stroke: ${options.nodeBorder};
1272
+ }
1273
+
1274
+ .attributeBoxEven {
1275
+ fill: ${options.attributeBackgroundColorEven};
1276
+ stroke: ${options.nodeBorder};
1277
+ }
1278
+
1279
+ .relationshipLabelBox {
1280
+ fill: ${options.tertiaryColor};
1281
+ opacity: 0.7;
1282
+ background-color: ${options.tertiaryColor};
1283
+ rect {
1284
+ opacity: 0.5;
1285
+ }
1286
+ }
1287
+
1288
+ .relationshipLine {
1289
+ stroke: ${options.lineColor};
1290
+ }
1291
+
1292
+ .entityTitleText {
1293
+ text-anchor: middle;
1294
+ font-size: 18px;
1295
+ fill: ${options.textColor};
1296
+ }
1297
+ #MD_PARENT_START {
1298
+ fill: #f5f5f5 !important;
1299
+ stroke: ${options.lineColor} !important;
1300
+ stroke-width: 1;
1301
+ }
1302
+ #MD_PARENT_END {
1303
+ fill: #f5f5f5 !important;
1304
+ stroke: ${options.lineColor} !important;
1305
+ stroke-width: 1;
1306
+ }
1307
+
1308
+ `;
1309
+ const erStyles = getStyles;
1310
+ const diagram = {
1311
+ parser: erParser,
1312
+ db: erDb,
1313
+ renderer: erRenderer,
1314
+ styles: erStyles
1315
+ };
1316
+ export {
1317
+ diagram
1318
+ };