hexagon-editor 0.1.5 → 0.1.6

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 (117) hide show
  1. package/README.md +24 -11
  2. package/dist/MarkdownEditor.vue.d.ts +28 -26
  3. package/dist/MarkdownEditor.vue.d.ts.map +1 -1
  4. package/dist/{MarkdownEditorLinkForm-C7CGgA83.js → MarkdownEditorLinkForm-B9dEX3WT.js} +1 -1
  5. package/dist/{base-Bnv2-Te4.js → base-BPdMUtQo.js} +141 -137
  6. package/dist/components/MarkdownEditorToolbar.vue.d.ts +4 -3
  7. package/dist/components/MarkdownEditorToolbar.vue.d.ts.map +1 -1
  8. package/dist/configure.d.ts +0 -2
  9. package/dist/configure.d.ts.map +1 -1
  10. package/dist/configure.js +11 -12
  11. package/dist/core/basic-editor-markdown.d.ts.map +1 -1
  12. package/dist/core/basic-editor-renderers.d.ts +6 -4
  13. package/dist/core/basic-editor-renderers.d.ts.map +1 -1
  14. package/dist/core/basic-editor-types.d.ts +2 -0
  15. package/dist/core/basic-editor-types.d.ts.map +1 -1
  16. package/dist/core/basic-editor.d.ts +1 -1
  17. package/dist/core/basic-editor.d.ts.map +1 -1
  18. package/dist/core/index.d.ts +0 -2
  19. package/dist/core/index.d.ts.map +1 -1
  20. package/dist/core.js +28 -31
  21. package/dist/extensions.js +1 -1
  22. package/dist/forms/MarkdownEditorImageForm.vue.d.ts +2 -2
  23. package/dist/forms/MarkdownEditorImageForm.vue.d.ts.map +1 -1
  24. package/dist/forms/MarkdownEditorLinkForm.vue.d.ts +2 -2
  25. package/dist/forms/MarkdownEditorTextInput.vue.d.ts +2 -2
  26. package/dist/forms/MarkdownEditorTextInput.vue.d.ts.map +1 -1
  27. package/dist/forms.js +1 -1
  28. package/dist/{full-C-o2lPBX.js → full-Da8esvj2.js} +1 -1
  29. package/dist/{full-specs-Cl-ODShc.js → full-specs-hXKoMF-0.js} +1 -1
  30. package/dist/index-D_CMntQU.js +3173 -0
  31. package/dist/index.css +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +3611 -1283
  35. package/dist/{markup-commands-B2NMfYHE.js → markup-commands-BYsx8ADT.js} +1989 -1963
  36. package/dist/presets.js +2 -2
  37. package/dist/public-types.d.ts +22 -0
  38. package/dist/public-types.d.ts.map +1 -1
  39. package/dist/renderer/MarkdownRenderer.vue.d.ts +2 -0
  40. package/dist/renderer/MarkdownRenderer.vue.d.ts.map +1 -1
  41. package/dist/renderer/markdown.d.ts +2 -1
  42. package/dist/renderer/markdown.d.ts.map +1 -1
  43. package/dist/renderer.css +1 -1
  44. package/dist/renderer.js +142 -146
  45. package/package.json +106 -108
  46. package/dist/MarkdownEditorLinkForm.css +0 -1
  47. package/dist/abnfDiagram-N423BO3Z-DCf6sPky.js +0 -87
  48. package/dist/arc-y6UeoJpJ.js +0 -83
  49. package/dist/architectureDiagram-T3A2C74G-Cc3_3-cI.js +0 -4778
  50. package/dist/base.css +0 -1
  51. package/dist/blockDiagram-VBNYF7ZC-DWVLZwXY.js +0 -2419
  52. package/dist/c4Diagram-5PPSVZJV-CaIN7qay.js +0 -1577
  53. package/dist/channel-BwXGcavV.js +0 -5
  54. package/dist/chunk-2GRJ4B5K-O75udjPr.js +0 -68
  55. package/dist/chunk-2Q5K7J3B-CySL0lOA.js +0 -15
  56. package/dist/chunk-5RXB4S5H-BKPnLCOJ.js +0 -1408
  57. package/dist/chunk-5VM5RSS4--it1VJIv.js +0 -19
  58. package/dist/chunk-6Q2QTUOP-DNiML-50.js +0 -664
  59. package/dist/chunk-GF5L2VYU-z7A-k0-V.js +0 -1533
  60. package/dist/chunk-JWPE2WC7-DAjx3Kjr.js +0 -8
  61. package/dist/chunk-KBJHAD2P-D4R1VW0r.js +0 -19
  62. package/dist/chunk-RYQCIY6F-DmJAYxq8.js +0 -313
  63. package/dist/chunk-XXDRQBXY-CK913N-t.js +0 -8
  64. package/dist/classDiagram-JCYQIIEL-Djipq_HJ.js +0 -16
  65. package/dist/classDiagram-v2-OCEON4UE-Djipq_HJ.js +0 -16
  66. package/dist/core/optional-renderers.d.ts +0 -9
  67. package/dist/core/optional-renderers.d.ts.map +0 -1
  68. package/dist/cose-bilkent-JH36ORCC-CXuKFbXy.js +0 -2608
  69. package/dist/cynefin-VYW2F7L2-Bkk-F_Js.js +0 -23766
  70. package/dist/cynefinDiagram-MW4NZA55-DwOK40hm.js +0 -299
  71. package/dist/cytoscape.esm-3W4EOjxC.js +0 -18756
  72. package/dist/dagre-VZM6K2ZE-0VsGm8Ag.js +0 -340
  73. package/dist/defaultLocale-BgPVtth8.js +0 -171
  74. package/dist/diagram-7IWD3JNH-BrApu1hz.js +0 -350
  75. package/dist/diagram-B4RE2ZJO-CVXoBg2r.js +0 -461
  76. package/dist/diagram-LBJQPF4R-Dp0eSz2L.js +0 -142
  77. package/dist/diagram-Q27KOJAE-DWIltqIH.js +0 -528
  78. package/dist/diagram-UB23O5K3-B7z2Lj3K.js +0 -219
  79. package/dist/ebnfDiagram-BXEA7PRR-CYgE6z_2.js +0 -109
  80. package/dist/erDiagram-JOGREHBK-D3QWrPo-.js +0 -910
  81. package/dist/flowDiagram-UKHOOZJN-CfjPcHNW.js +0 -1638
  82. package/dist/ganttDiagram-PKOTCBZU-ECmaWI-9.js +0 -2711
  83. package/dist/gitGraphDiagram-DS77QQ5N-DgG1RGJ8.js +0 -815
  84. package/dist/graph-DAHC4kPm.js +0 -1545
  85. package/dist/infoDiagram-6WML65LV-B1Yl3nZV.js +0 -24
  86. package/dist/init-DjUOC4st.js +0 -16
  87. package/dist/ishikawaDiagram-WSZJBQD7-4sngaB5o.js +0 -621
  88. package/dist/journeyDiagram-NVQOT4AX-B_6AmR_j.js +0 -834
  89. package/dist/kanban-definition-27J2QSJJ-B8BO9o8J.js +0 -724
  90. package/dist/katex-ByXcxnHy.js +0 -14436
  91. package/dist/katex-DoRnZ_sp.js +0 -11682
  92. package/dist/layout-DBbo_M5I.js +0 -1519
  93. package/dist/linear-BEdRfKba.js +0 -259
  94. package/dist/map-DRdzG8Ho.js +0 -224
  95. package/dist/markup-commands.css +0 -1
  96. package/dist/mermaid.core-CR0bA2Wa.js +0 -16496
  97. package/dist/mindmap-definition-FAOFIHXS-DnPz807N.js +0 -827
  98. package/dist/optional-renderers-BalvqqvY.js +0 -11
  99. package/dist/ordinal-B6-f3MAq.js +0 -61
  100. package/dist/pegDiagram-VL7TDLO6-csGWlzs8.js +0 -95
  101. package/dist/pieDiagram-7S7Q4E2Y-Bqs8j5FX.js +0 -207
  102. package/dist/quadrantDiagram-CIZ2JOQS-jzP4lRrY.js +0 -1023
  103. package/dist/railroadDiagram-AXF67PYL-BSCyR24u.js +0 -77
  104. package/dist/renderer/mermaid-runtime.d.ts +0 -4
  105. package/dist/renderer/mermaid-runtime.d.ts.map +0 -1
  106. package/dist/requirementDiagram-LRYGKXZP-DmEkLYqX.js +0 -882
  107. package/dist/sankeyDiagram-W5VNT64P-CYvRYMTh.js +0 -847
  108. package/dist/sequenceDiagram-SI44F4Z6-CyWbDtPA.js +0 -2888
  109. package/dist/sizeCapture-X5ZJPWSS-xKhYCY84.js +0 -46
  110. package/dist/stateDiagram-OKZ733FA-DP44R2Dd.js +0 -263
  111. package/dist/stateDiagram-v2-UEYNNEHI-BvlOisND.js +0 -16
  112. package/dist/swimlanes-SLNWSIFB-BKFp8twH.js +0 -5332
  113. package/dist/swimlanesDiagram-ULZ7WXOC-CTvIFuHq.js +0 -13
  114. package/dist/timeline-definition-Z64GVDOM-B4137uIl.js +0 -1055
  115. package/dist/vennDiagram-T6HMQDX7-CPs8gXjx.js +0 -1578
  116. package/dist/wardleyDiagram-T6FBY63Y-BYp13hbI.js +0 -675
  117. package/dist/xychartDiagram-ELKLHX3M-DTT37K2u.js +0 -1388
@@ -1,1578 +0,0 @@
1
- import { b4 as Wt, s as Kt, g as Ht, o as Yt, n as Xt, a as Zt, b as Jt, _ as w, y as wt, D as Qt, d as ot, al as $t, T as te, U as ee, V as ne, e as se, p as ie, A as oe, B as re } from "./mermaid.core-CR0bA2Wa.js";
2
- const kt = (t, n) => Wt(t, "a", -n), _t = 1e-10;
3
- function st(t, n) {
4
- const s = le(t), e = s.filter((l) => ae(l, t));
5
- let i = 0, o = 0;
6
- const r = [];
7
- if (e.length > 1) {
8
- const l = Et(e);
9
- for (let u = 0; u < e.length; ++u) {
10
- const a = e[u];
11
- a.angle = Math.atan2(a.x - l.x, a.y - l.y);
12
- }
13
- e.sort((u, a) => a.angle - u.angle);
14
- let f = e[e.length - 1];
15
- for (let u = 0; u < e.length; ++u) {
16
- const a = e[u];
17
- o += (f.x + a.x) * (a.y - f.y);
18
- const y = { x: (a.x + f.x) / 2, y: (a.y + f.y) / 2 };
19
- let h = null;
20
- for (let b = 0; b < a.parentIndex.length; ++b)
21
- if (f.parentIndex.includes(a.parentIndex[b])) {
22
- const p = t[a.parentIndex[b]], M = Math.atan2(a.x - p.x, a.y - p.y), E = Math.atan2(f.x - p.x, f.y - p.y);
23
- let _ = E - M;
24
- _ < 0 && (_ += 2 * Math.PI);
25
- const S = E - _ / 2;
26
- let g = U(y, {
27
- x: p.x + p.radius * Math.sin(S),
28
- y: p.y + p.radius * Math.cos(S)
29
- });
30
- g > p.radius * 2 && (g = p.radius * 2), (h == null || h.width > g) && (h = { circle: p, width: g, p1: a, p2: f, large: g > p.radius, sweep: !0 });
31
- }
32
- h != null && (r.push(h), i += lt(h.circle.radius, h.width), f = a);
33
- }
34
- } else {
35
- let l = t[0];
36
- for (let u = 1; u < t.length; ++u)
37
- t[u].radius < l.radius && (l = t[u]);
38
- let f = !1;
39
- for (let u = 0; u < t.length; ++u)
40
- if (U(t[u], l) > Math.abs(l.radius - t[u].radius)) {
41
- f = !0;
42
- break;
43
- }
44
- f ? i = o = 0 : (i = l.radius * l.radius * Math.PI, r.push({
45
- circle: l,
46
- p1: { x: l.x, y: l.y + l.radius },
47
- p2: { x: l.x - _t, y: l.y + l.radius },
48
- width: l.radius * 2,
49
- large: !0,
50
- sweep: !0
51
- }));
52
- }
53
- return o /= 2, n && (n.area = i + o, n.arcArea = i, n.polygonArea = o, n.arcs = r, n.innerPoints = e, n.intersectionPoints = s), i + o;
54
- }
55
- function ae(t, n) {
56
- return n.every((s) => U(t, s) < s.radius + _t);
57
- }
58
- function le(t) {
59
- const n = [];
60
- for (let s = 0; s < t.length; ++s)
61
- for (let e = s + 1; e < t.length; ++e) {
62
- const i = Tt(t[s], t[e]);
63
- for (const o of i)
64
- o.parentIndex = [s, e], n.push(o);
65
- }
66
- return n;
67
- }
68
- function lt(t, n) {
69
- return t * t * Math.acos(1 - n / t) - (t - n) * Math.sqrt(n * (2 * t - n));
70
- }
71
- function U(t, n) {
72
- return Math.sqrt((t.x - n.x) * (t.x - n.x) + (t.y - n.y) * (t.y - n.y));
73
- }
74
- function xt(t, n, s) {
75
- if (s >= t + n)
76
- return 0;
77
- if (s <= Math.abs(t - n))
78
- return Math.PI * Math.min(t, n) * Math.min(t, n);
79
- const e = t - (s * s - n * n + t * t) / (2 * s), i = n - (s * s - t * t + n * n) / (2 * s);
80
- return lt(t, e) + lt(n, i);
81
- }
82
- function Tt(t, n) {
83
- const s = U(t, n), e = t.radius, i = n.radius;
84
- if (s >= e + i || s <= Math.abs(e - i))
85
- return [];
86
- const o = (e * e - i * i + s * s) / (2 * s), r = Math.sqrt(e * e - o * o), l = t.x + o * (n.x - t.x) / s, f = t.y + o * (n.y - t.y) / s, u = -(n.y - t.y) * (r / s), a = -(n.x - t.x) * (r / s);
87
- return [
88
- { x: l + u, y: f - a },
89
- { x: l - u, y: f + a }
90
- ];
91
- }
92
- function Et(t) {
93
- const n = { x: 0, y: 0 };
94
- for (const s of t)
95
- n.x += s.x, n.y += s.y;
96
- return n.x /= t.length, n.y /= t.length, n;
97
- }
98
- function ce(t, n, s, e) {
99
- e = e || {};
100
- const i = e.maxIterations || 100, o = e.tolerance || 1e-10, r = t(n), l = t(s);
101
- let f = s - n;
102
- if (r * l > 0)
103
- throw "Initial bisect points must have opposite signs";
104
- if (r === 0) return n;
105
- if (l === 0) return s;
106
- for (let u = 0; u < i; ++u) {
107
- f /= 2;
108
- const a = n + f, y = t(a);
109
- if (y * r >= 0 && (n = a), Math.abs(f) < o || y === 0)
110
- return a;
111
- }
112
- return n + f;
113
- }
114
- function ct(t) {
115
- const n = new Array(t);
116
- for (let s = 0; s < t; ++s)
117
- n[s] = 0;
118
- return n;
119
- }
120
- function Mt(t, n) {
121
- return ct(t).map(() => ct(n));
122
- }
123
- function $(t, n) {
124
- let s = 0;
125
- for (let e = 0; e < t.length; ++e)
126
- s += t[e] * n[e];
127
- return s;
128
- }
129
- function ut(t) {
130
- return Math.sqrt($(t, t));
131
- }
132
- function ft(t, n, s) {
133
- for (let e = 0; e < n.length; ++e)
134
- t[e] = n[e] * s;
135
- }
136
- function J(t, n, s, e, i) {
137
- for (let o = 0; o < t.length; ++o)
138
- t[o] = n * s[o] + e * i[o];
139
- }
140
- function zt(t, n, s) {
141
- s = s || {};
142
- const e = s.maxIterations || n.length * 200, i = s.nonZeroDelta || 1.05, o = s.zeroDelta || 1e-3, r = s.minErrorDelta || 1e-6, l = s.minErrorDelta || 1e-5, f = s.rho !== void 0 ? s.rho : 1, u = s.chi !== void 0 ? s.chi : 2, a = s.psi !== void 0 ? s.psi : -0.5, y = s.sigma !== void 0 ? s.sigma : 0.5;
143
- let h;
144
- const b = n.length, p = new Array(b + 1);
145
- p[0] = n, p[0].fx = t(n), p[0].id = 0;
146
- for (let v = 0; v < b; ++v) {
147
- const c = n.slice();
148
- c[v] = c[v] ? c[v] * i : o, p[v + 1] = c, p[v + 1].fx = t(c), p[v + 1].id = v + 1;
149
- }
150
- function M(v) {
151
- for (let c = 0; c < v.length; c++)
152
- p[b][c] = v[c];
153
- p[b].fx = v.fx;
154
- }
155
- const E = (v, c) => v.fx - c.fx, _ = n.slice(), S = n.slice(), g = n.slice(), m = n.slice();
156
- for (let v = 0; v < e; ++v) {
157
- if (p.sort(E), s.history) {
158
- const x = p.map((d) => {
159
- const D = d.slice();
160
- return D.fx = d.fx, D.id = d.id, D;
161
- });
162
- x.sort((d, D) => d.id - D.id), s.history.push({
163
- x: p[0].slice(),
164
- fx: p[0].fx,
165
- simplex: x
166
- });
167
- }
168
- h = 0;
169
- for (let x = 0; x < b; ++x)
170
- h = Math.max(h, Math.abs(p[0][x] - p[1][x]));
171
- if (Math.abs(p[0].fx - p[b].fx) < r && h < l)
172
- break;
173
- for (let x = 0; x < b; ++x) {
174
- _[x] = 0;
175
- for (let d = 0; d < b; ++d)
176
- _[x] += p[d][x];
177
- _[x] /= b;
178
- }
179
- const c = p[b];
180
- if (J(S, 1 + f, _, -f, c), S.fx = t(S), S.fx < p[0].fx)
181
- J(m, 1 + u, _, -u, c), m.fx = t(m), m.fx < S.fx ? M(m) : M(S);
182
- else if (S.fx >= p[b - 1].fx) {
183
- let x = !1;
184
- if (S.fx > c.fx ? (J(g, 1 + a, _, -a, c), g.fx = t(g), g.fx < c.fx ? M(g) : x = !0) : (J(g, 1 - a * f, _, a * f, c), g.fx = t(g), g.fx < S.fx ? M(g) : x = !0), x) {
185
- if (y >= 1) break;
186
- for (let d = 1; d < p.length; ++d)
187
- J(p[d], 1 - y, p[0], y, p[d]), p[d].fx = t(p[d]);
188
- }
189
- } else
190
- M(S);
191
- }
192
- return p.sort(E), { fx: p[0].fx, x: p[0] };
193
- }
194
- function ue(t, n, s, e, i, o, r) {
195
- const l = s.fx, f = $(s.fxprime, n);
196
- let u = l, a = l, y = f, h = 0;
197
- i = i || 1, o = o || 1e-6, r = r || 0.1;
198
- function b(p, M, E) {
199
- for (let _ = 0; _ < 16; ++_)
200
- if (i = (p + M) / 2, J(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = $(e.fxprime, n), u > l + o * i * f || u >= E)
201
- M = i;
202
- else {
203
- if (Math.abs(y) <= -r * f)
204
- return i;
205
- y * (M - p) >= 0 && (M = p), p = i, E = u;
206
- }
207
- return 0;
208
- }
209
- for (let p = 0; p < 10; ++p) {
210
- if (J(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = $(e.fxprime, n), u > l + o * i * f || p && u >= a)
211
- return b(h, i, a);
212
- if (Math.abs(y) <= -r * f)
213
- return i;
214
- if (y >= 0)
215
- return b(i, h, u);
216
- a = u, h = i, i *= 2;
217
- }
218
- return i;
219
- }
220
- function fe(t, n, s) {
221
- let e = { x: n.slice(), fx: 0, fxprime: n.slice() }, i = { x: n.slice(), fx: 0, fxprime: n.slice() };
222
- const o = n.slice();
223
- let r, l, f = 1, u;
224
- s = s || {}, u = s.maxIterations || n.length * 20, e.fx = t(e.x, e.fxprime), r = e.fxprime.slice(), ft(r, e.fxprime, -1);
225
- for (let a = 0; a < u; ++a) {
226
- if (f = ue(t, r, e, i, f), s.history && s.history.push({
227
- x: e.x.slice(),
228
- fx: e.fx,
229
- fxprime: e.fxprime.slice(),
230
- alpha: f
231
- }), !f)
232
- ft(r, e.fxprime, -1);
233
- else {
234
- J(o, 1, i.fxprime, -1, e.fxprime);
235
- const y = $(e.fxprime, e.fxprime), h = Math.max(0, $(o, i.fxprime) / y);
236
- J(r, h, r, -1, i.fxprime), l = e, e = i, i = l;
237
- }
238
- if (ut(e.fxprime) <= 1e-5)
239
- break;
240
- }
241
- return s.history && s.history.push({
242
- x: e.x.slice(),
243
- fx: e.fx,
244
- fxprime: e.fxprime.slice(),
245
- alpha: f
246
- }), e;
247
- }
248
- function At(t, n = {}) {
249
- n.maxIterations = n.maxIterations || 500;
250
- const s = n.initialLayout || xe, e = n.lossFunction || tt, i = he(t, n), o = s(i, n), r = Object.keys(o), l = [];
251
- for (const a of r)
252
- l.push(o[a].x), l.push(o[a].y);
253
- const u = zt(
254
- (a) => {
255
- const y = {};
256
- for (let h = 0; h < r.length; ++h) {
257
- const b = r[h];
258
- y[b] = {
259
- x: a[2 * h],
260
- y: a[2 * h + 1],
261
- radius: o[b].radius
262
- // size : circles[setid].size
263
- };
264
- }
265
- return e(y, i);
266
- },
267
- l,
268
- n
269
- ).x;
270
- for (let a = 0; a < r.length; ++a) {
271
- const y = r[a];
272
- o[y].x = u[2 * a], o[y].y = u[2 * a + 1];
273
- }
274
- return o;
275
- }
276
- const Rt = 1e-10;
277
- function ht(t, n, s) {
278
- return Math.min(t, n) * Math.min(t, n) * Math.PI <= s + Rt ? Math.abs(t - n) : ce((e) => xt(t, n, e) - s, 0, t + n);
279
- }
280
- function he(t, n = {}) {
281
- const s = n.distinct, e = t.map((l) => Object.assign({}, l));
282
- function i(l) {
283
- return l.join(";");
284
- }
285
- if (s) {
286
- const l = /* @__PURE__ */ new Map();
287
- for (const f of e)
288
- for (let u = 0; u < f.sets.length; u++) {
289
- const a = String(f.sets[u]);
290
- l.set(a, f.size + (l.get(a) || 0));
291
- for (let y = u + 1; y < f.sets.length; y++) {
292
- const h = String(f.sets[y]), b = `${a};${h}`, p = `${h};${a}`;
293
- l.set(b, f.size + (l.get(b) || 0)), l.set(p, f.size + (l.get(p) || 0));
294
- }
295
- }
296
- for (const f of e)
297
- f.sets.length < 3 && (f.size = l.get(i(f.sets)));
298
- }
299
- const o = [], r = /* @__PURE__ */ new Set();
300
- for (const l of e)
301
- if (l.sets.length === 1)
302
- o.push(l.sets[0]);
303
- else if (l.sets.length === 2) {
304
- const f = l.sets[0], u = l.sets[1];
305
- r.add(i(l.sets)), r.add(i([u, f]));
306
- }
307
- o.sort((l, f) => l === f ? 0 : l < f ? -1 : 1);
308
- for (let l = 0; l < o.length; ++l) {
309
- const f = o[l];
310
- for (let u = l + 1; u < o.length; ++u) {
311
- const a = o[u];
312
- r.has(i([f, a])) || e.push({ sets: [f, a], size: 0 });
313
- }
314
- }
315
- return e;
316
- }
317
- function de(t, n, s) {
318
- const e = Mt(n.length, n.length), i = Mt(n.length, n.length);
319
- return t.filter((o) => o.sets.length === 2).forEach((o) => {
320
- const r = s[o.sets[0]], l = s[o.sets[1]], f = Math.sqrt(n[r].size / Math.PI), u = Math.sqrt(n[l].size / Math.PI), a = ht(f, u, o.size);
321
- e[r][l] = e[l][r] = a;
322
- let y = 0;
323
- o.size + 1e-10 >= Math.min(n[r].size, n[l].size) ? y = 1 : o.size <= 1e-10 && (y = -1), i[r][l] = i[l][r] = y;
324
- }), { distances: e, constraints: i };
325
- }
326
- function ge(t, n, s, e) {
327
- for (let o = 0; o < n.length; ++o)
328
- n[o] = 0;
329
- let i = 0;
330
- for (let o = 0; o < s.length; ++o) {
331
- const r = t[2 * o], l = t[2 * o + 1];
332
- for (let f = o + 1; f < s.length; ++f) {
333
- const u = t[2 * f], a = t[2 * f + 1], y = s[o][f], h = e[o][f], b = (u - r) * (u - r) + (a - l) * (a - l), p = Math.sqrt(b), M = b - y * y;
334
- h > 0 && p <= y || h < 0 && p >= y || (i += 2 * M * M, n[2 * o] += 4 * M * (r - u), n[2 * o + 1] += 4 * M * (l - a), n[2 * f] += 4 * M * (u - r), n[2 * f + 1] += 4 * M * (a - l));
335
- }
336
- }
337
- return i;
338
- }
339
- function xe(t, n = {}) {
340
- let s = pe(t, n);
341
- const e = n.lossFunction || tt;
342
- if (t.length >= 8) {
343
- const i = ye(t, n), o = e(i, t), r = e(s, t);
344
- o + 1e-8 < r && (s = i);
345
- }
346
- return s;
347
- }
348
- function ye(t, n = {}) {
349
- const s = n.restarts || 10, e = [], i = {};
350
- for (const h of t)
351
- h.sets.length === 1 && (i[h.sets[0]] = e.length, e.push(h));
352
- let { distances: o, constraints: r } = de(t, e, i);
353
- const l = ut(o.map(ut)) / o.length;
354
- o = o.map((h) => h.map((b) => b / l));
355
- const f = (h, b) => ge(h, b, o, r);
356
- let u = null;
357
- for (let h = 0; h < s; ++h) {
358
- const b = ct(o.length * 2).map(Math.random), p = fe(f, b, n);
359
- (!u || p.fx < u.fx) && (u = p);
360
- }
361
- const a = u.x, y = {};
362
- for (let h = 0; h < e.length; ++h) {
363
- const b = e[h];
364
- y[b.sets[0]] = {
365
- x: a[2 * h] * l,
366
- y: a[2 * h + 1] * l,
367
- radius: Math.sqrt(b.size / Math.PI)
368
- };
369
- }
370
- if (n.history)
371
- for (const h of n.history)
372
- ft(h.x, l);
373
- return y;
374
- }
375
- function pe(t, n) {
376
- const s = n && n.lossFunction ? n.lossFunction : tt, e = {}, i = {};
377
- for (const y of t)
378
- if (y.sets.length === 1) {
379
- const h = y.sets[0];
380
- e[h] = {
381
- x: 1e10,
382
- y: 1e10,
383
- rowid: e.length,
384
- size: y.size,
385
- radius: Math.sqrt(y.size / Math.PI)
386
- }, i[h] = [];
387
- }
388
- t = t.filter((y) => y.sets.length === 2);
389
- for (const y of t) {
390
- let h = y.weight != null ? y.weight : 1;
391
- const b = y.sets[0], p = y.sets[1];
392
- y.size + Rt >= Math.min(e[b].size, e[p].size) && (h = 0), i[b].push({ set: p, size: y.size, weight: h }), i[p].push({ set: b, size: y.size, weight: h });
393
- }
394
- const o = [];
395
- Object.keys(i).forEach((y) => {
396
- let h = 0;
397
- for (let b = 0; b < i[y].length; ++b)
398
- h += i[y][b].size * i[y][b].weight;
399
- o.push({ set: y, size: h });
400
- });
401
- function r(y, h) {
402
- return h.size - y.size;
403
- }
404
- o.sort(r);
405
- const l = {};
406
- function f(y) {
407
- return y.set in l;
408
- }
409
- function u(y, h) {
410
- e[h].x = y.x, e[h].y = y.y, l[h] = !0;
411
- }
412
- u({ x: 0, y: 0 }, o[0].set);
413
- for (let y = 1; y < o.length; ++y) {
414
- const h = o[y].set, b = i[h].filter(f), p = e[h];
415
- if (b.sort(r), b.length === 0)
416
- throw "ERROR: missing pairwise overlap information";
417
- const M = [];
418
- for (var a = 0; a < b.length; ++a) {
419
- const S = e[b[a].set], g = ht(p.radius, S.radius, b[a].size);
420
- M.push({ x: S.x + g, y: S.y }), M.push({ x: S.x - g, y: S.y }), M.push({ y: S.y + g, x: S.x }), M.push({ y: S.y - g, x: S.x });
421
- for (let m = a + 1; m < b.length; ++m) {
422
- const v = e[b[m].set], c = ht(p.radius, v.radius, b[m].size), x = Tt(
423
- { x: S.x, y: S.y, radius: g },
424
- { x: v.x, y: v.y, radius: c }
425
- );
426
- M.push(...x);
427
- }
428
- }
429
- let E = 1e50, _ = M[0];
430
- for (const S of M) {
431
- e[h].x = S.x, e[h].y = S.y;
432
- const g = s(e, t);
433
- g < E && (E = g, _ = S);
434
- }
435
- u(_, h);
436
- }
437
- return e;
438
- }
439
- function tt(t, n) {
440
- let s = 0;
441
- for (const e of n) {
442
- if (e.sets.length === 1)
443
- continue;
444
- let i;
445
- if (e.sets.length === 2) {
446
- const r = t[e.sets[0]], l = t[e.sets[1]];
447
- i = xt(r.radius, l.radius, U(r, l));
448
- } else
449
- i = st(e.sets.map((r) => t[r]));
450
- const o = e.weight != null ? e.weight : 1;
451
- s += o * (i - e.size) * (i - e.size);
452
- }
453
- return s;
454
- }
455
- function Dt(t, n) {
456
- let s = 0;
457
- for (const e of n) {
458
- if (e.sets.length === 1)
459
- continue;
460
- let i;
461
- if (e.sets.length === 2) {
462
- const l = t[e.sets[0]], f = t[e.sets[1]];
463
- i = xt(l.radius, f.radius, U(l, f));
464
- } else
465
- i = st(e.sets.map((l) => t[l]));
466
- const o = e.weight != null ? e.weight : 1, r = Math.log((i + 1) / (e.size + 1));
467
- s += o * r * r;
468
- }
469
- return s;
470
- }
471
- function me(t, n, s) {
472
- if (s == null ? t.sort((i, o) => o.radius - i.radius) : t.sort(s), t.length > 0) {
473
- const i = t[0].x, o = t[0].y;
474
- for (const r of t)
475
- r.x -= i, r.y -= o;
476
- }
477
- if (t.length === 2 && U(t[0], t[1]) < Math.abs(t[1].radius - t[0].radius) && (t[1].x = t[0].x + t[0].radius - t[1].radius - 1e-10, t[1].y = t[0].y), t.length > 1) {
478
- const i = Math.atan2(t[1].x, t[1].y) - n, o = Math.cos(i), r = Math.sin(i);
479
- for (const l of t) {
480
- const f = l.x, u = l.y;
481
- l.x = o * f - r * u, l.y = r * f + o * u;
482
- }
483
- }
484
- if (t.length > 2) {
485
- let i = Math.atan2(t[2].x, t[2].y) - n;
486
- for (; i < 0; )
487
- i += 2 * Math.PI;
488
- for (; i > 2 * Math.PI; )
489
- i -= 2 * Math.PI;
490
- if (i > Math.PI) {
491
- const o = t[1].y / (1e-10 + t[1].x);
492
- for (const r of t) {
493
- var e = (r.x + o * r.y) / (1 + o * o);
494
- r.x = 2 * e - r.x, r.y = 2 * e * o - r.y;
495
- }
496
- }
497
- }
498
- }
499
- function be(t) {
500
- t.forEach((i) => {
501
- i.parent = i;
502
- });
503
- function n(i) {
504
- return i.parent !== i && (i.parent = n(i.parent)), i.parent;
505
- }
506
- function s(i, o) {
507
- const r = n(i), l = n(o);
508
- r.parent = l;
509
- }
510
- for (let i = 0; i < t.length; ++i)
511
- for (let o = i + 1; o < t.length; ++o) {
512
- const r = t[i].radius + t[o].radius;
513
- U(t[i], t[o]) + 1e-10 < r && s(t[o], t[i]);
514
- }
515
- const e = /* @__PURE__ */ new Map();
516
- for (let i = 0; i < t.length; ++i) {
517
- const o = n(t[i]).parent.setid;
518
- e.has(o) || e.set(o, []), e.get(o).push(t[i]);
519
- }
520
- return t.forEach((i) => {
521
- delete i.parent;
522
- }), Array.from(e.values());
523
- }
524
- function dt(t) {
525
- const n = (s) => {
526
- const e = t.reduce((o, r) => Math.max(o, r[s] + r.radius), Number.NEGATIVE_INFINITY), i = t.reduce((o, r) => Math.min(o, r[s] - r.radius), Number.POSITIVE_INFINITY);
527
- return { max: e, min: i };
528
- };
529
- return { xRange: n("x"), yRange: n("y") };
530
- }
531
- function Ct(t, n, s) {
532
- n == null && (n = Math.PI / 2);
533
- let e = Ft(t).map((u) => Object.assign({}, u));
534
- const i = be(e);
535
- for (const u of i) {
536
- me(u, n, s);
537
- const a = dt(u);
538
- u.size = (a.xRange.max - a.xRange.min) * (a.yRange.max - a.yRange.min), u.bounds = a;
539
- }
540
- i.sort((u, a) => a.size - u.size), e = i[0];
541
- let o = e.bounds;
542
- const r = (o.xRange.max - o.xRange.min) / 50;
543
- function l(u, a, y) {
544
- if (!u)
545
- return;
546
- const h = u.bounds;
547
- let b, p;
548
- if (a)
549
- b = o.xRange.max - h.xRange.min + r;
550
- else {
551
- b = o.xRange.max - h.xRange.max;
552
- const M = (h.xRange.max - h.xRange.min) / 2 - (o.xRange.max - o.xRange.min) / 2;
553
- M < 0 && (b += M);
554
- }
555
- if (y)
556
- p = o.yRange.max - h.yRange.min + r;
557
- else {
558
- p = o.yRange.max - h.yRange.max;
559
- const M = (h.yRange.max - h.yRange.min) / 2 - (o.yRange.max - o.yRange.min) / 2;
560
- M < 0 && (p += M);
561
- }
562
- for (const M of u)
563
- M.x += b, M.y += p, e.push(M);
564
- }
565
- let f = 1;
566
- for (; f < i.length; )
567
- l(i[f], !0, !1), l(i[f + 1], !1, !0), l(i[f + 2], !0, !0), f += 3, o = dt(e);
568
- return Ot(e);
569
- }
570
- function Nt(t, n, s, e, i) {
571
- const o = Ft(t);
572
- n -= 2 * e, s -= 2 * e;
573
- const { xRange: r, yRange: l } = dt(o);
574
- if (r.max === r.min || l.max === l.min)
575
- return console.log("not scaling solution: zero size detected"), t;
576
- let f, u;
577
- if (i) {
578
- const b = Math.sqrt(i / Math.PI) * 2;
579
- f = n / b, u = s / b;
580
- } else
581
- f = n / (r.max - r.min), u = s / (l.max - l.min);
582
- const a = Math.min(u, f), y = (n - (r.max - r.min) * a) / 2, h = (s - (l.max - l.min) * a) / 2;
583
- return Ot(
584
- o.map((b) => ({
585
- radius: a * b.radius,
586
- x: e + y + (b.x - r.min) * a,
587
- y: e + h + (b.y - l.min) * a,
588
- setid: b.setid
589
- }))
590
- );
591
- }
592
- function Ot(t) {
593
- const n = {};
594
- for (const s of t)
595
- n[s.setid] = s;
596
- return n;
597
- }
598
- function Ft(t) {
599
- return Object.keys(t).map((s) => Object.assign(t[s], { setid: s }));
600
- }
601
- function ve(t = {}) {
602
- let n = !1, s = 600, e = 350, i = 15, o = 1e3, r = Math.PI / 2, l = !0, f = null, u = !0, a = !0, y = null, h = null, b = !1, p = null, M = t && t.symmetricalTextCentre ? t.symmetricalTextCentre : !1, E = {}, _ = t && t.colourScheme ? t.colourScheme : t && t.colorScheme ? t.colorScheme : [
603
- "#1f77b4",
604
- "#ff7f0e",
605
- "#2ca02c",
606
- "#d62728",
607
- "#9467bd",
608
- "#8c564b",
609
- "#e377c2",
610
- "#7f7f7f",
611
- "#bcbd22",
612
- "#17becf"
613
- ], S = 0, g = function(x) {
614
- if (x in E)
615
- return E[x];
616
- var d = E[x] = _[S];
617
- return S += 1, S >= _.length && (S = 0), d;
618
- }, m = At, v = tt;
619
- function c(x) {
620
- let d = x.datum();
621
- const D = /* @__PURE__ */ new Set();
622
- d.forEach((k) => {
623
- k.size == 0 && k.sets.length == 1 && D.add(k.sets[0]);
624
- }), d = d.filter((k) => !k.sets.some((F) => D.has(F)));
625
- let I = {}, C = {};
626
- if (d.length > 0) {
627
- let k = m(d, { lossFunction: v, distinct: b });
628
- l && (k = Ct(k, r, h)), I = Nt(k, s, e, i, f), C = Lt(I, d, M);
629
- }
630
- const q = {};
631
- d.forEach((k) => {
632
- k.label && (q[k.sets] = k.label);
633
- });
634
- function V(k) {
635
- if (k.sets in q)
636
- return q[k.sets];
637
- if (k.sets.length == 1)
638
- return "" + k.sets[0];
639
- }
640
- x.selectAll("svg").data([I]).enter().append("svg");
641
- const O = x.select("svg");
642
- n ? O.attr("viewBox", `0 0 ${s} ${e}`) : O.attr("width", s).attr("height", e);
643
- const R = {};
644
- let T = !1;
645
- O.selectAll(".venn-area path").each(function(k) {
646
- const F = this.getAttribute("d");
647
- k.sets.length == 1 && F && !b && (T = !0, R[k.sets[0]] = Me(F));
648
- });
649
- function A(k) {
650
- return (F) => {
651
- const H = k.sets.map((et) => {
652
- let Y = R[et], Z = I[et];
653
- return Y || (Y = { x: s / 2, y: e / 2, radius: 1 }), Z || (Z = { x: s / 2, y: e / 2, radius: 1 }), {
654
- x: Y.x * (1 - F) + Z.x * F,
655
- y: Y.y * (1 - F) + Z.y * F,
656
- radius: Y.radius * (1 - F) + Z.radius * F
657
- };
658
- });
659
- return St(H, p);
660
- };
661
- }
662
- const G = O.selectAll(".venn-area").data(d, (k) => k.sets), P = G.enter().append("g").attr(
663
- "class",
664
- (k) => `venn-area venn-${k.sets.length == 1 ? "circle" : "intersection"}${k.colour || k.color ? " venn-coloured" : ""}`
665
- ).attr("data-venn-sets", (k) => k.sets.join("_")), B = P.append("path"), L = P.append("text").attr("class", "label").text((k) => V(k)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", s / 2).attr("y", e / 2);
666
- a && (B.style("fill-opacity", "0").filter((k) => k.sets.length == 1).style("fill", (k) => k.colour ? k.colour : k.color ? k.color : g(k.sets)).style("fill-opacity", ".25"), L.style("fill", (k) => k.colour || k.color ? "#FFF" : t.textFill ? t.textFill : k.sets.length == 1 ? g(k.sets) : "#444"));
667
- function K(k) {
668
- return typeof k.transition == "function" ? k.transition("venn").duration(o) : k;
669
- }
670
- let z = x;
671
- T && typeof z.transition == "function" ? (z = K(x), z.selectAll("path").attrTween("d", A)) : z.selectAll("path").attr("d", (k) => St(k.sets.map((F) => I[F])), p);
672
- const N = z.selectAll("text").filter((k) => k.sets in C).text((k) => V(k)).attr("x", (k) => Math.floor(C[k.sets].x)).attr("y", (k) => Math.floor(C[k.sets].y));
673
- u && (T ? "on" in N ? N.on("end", rt(I, V)) : N.each("end", rt(I, V)) : N.each(rt(I, V)));
674
- const j = K(G.exit()).remove();
675
- typeof G.transition == "function" && j.selectAll("path").attrTween("d", A);
676
- const X = j.selectAll("text").attr("x", s / 2).attr("y", e / 2);
677
- return y !== null && (L.style("font-size", "0px"), N.style("font-size", y), X.style("font-size", "0px")), { circles: I, textCentres: C, nodes: G, enter: P, update: z, exit: j };
678
- }
679
- return c.wrap = function(x) {
680
- return arguments.length ? (u = x, c) : u;
681
- }, c.useViewBox = function() {
682
- return n = !0, c;
683
- }, c.width = function(x) {
684
- return arguments.length ? (s = x, c) : s;
685
- }, c.height = function(x) {
686
- return arguments.length ? (e = x, c) : e;
687
- }, c.padding = function(x) {
688
- return arguments.length ? (i = x, c) : i;
689
- }, c.distinct = function(x) {
690
- return arguments.length ? (b = x, c) : b;
691
- }, c.colours = function(x) {
692
- return arguments.length ? (g = x, c) : g;
693
- }, c.colors = function(x) {
694
- return arguments.length ? (g = x, c) : g;
695
- }, c.fontSize = function(x) {
696
- return arguments.length ? (y = x, c) : y;
697
- }, c.round = function(x) {
698
- return arguments.length ? (p = x, c) : p;
699
- }, c.duration = function(x) {
700
- return arguments.length ? (o = x, c) : o;
701
- }, c.layoutFunction = function(x) {
702
- return arguments.length ? (m = x, c) : m;
703
- }, c.normalize = function(x) {
704
- return arguments.length ? (l = x, c) : l;
705
- }, c.scaleToFit = function(x) {
706
- return arguments.length ? (f = x, c) : f;
707
- }, c.styled = function(x) {
708
- return arguments.length ? (a = x, c) : a;
709
- }, c.orientation = function(x) {
710
- return arguments.length ? (r = x, c) : r;
711
- }, c.orientationOrder = function(x) {
712
- return arguments.length ? (h = x, c) : h;
713
- }, c.lossFunction = function(x) {
714
- return arguments.length ? (v = x === "default" ? tt : x === "logRatio" ? Dt : x, c) : v;
715
- }, c;
716
- }
717
- function rt(t, n) {
718
- return function(s) {
719
- const e = this, i = t[s.sets[0]].radius || 50, o = n(s) || "", r = o.split(/\s+/).reverse(), f = (o.length + r.length) / 3;
720
- let u = r.pop(), a = [u], y = 0;
721
- const h = 1.1;
722
- e.textContent = null;
723
- const b = [];
724
- function p(g) {
725
- const m = e.ownerDocument.createElementNS(e.namespaceURI, "tspan");
726
- return m.textContent = g, b.push(m), e.append(m), m;
727
- }
728
- let M = p(u);
729
- for (; u = r.pop(), !!u; ) {
730
- a.push(u);
731
- const g = a.join(" ");
732
- M.textContent = g, g.length > f && M.getComputedTextLength() > i && (a.pop(), M.textContent = a.join(" "), a = [u], M = p(u), y++);
733
- }
734
- const E = 0.35 - y * h / 2, _ = e.getAttribute("x"), S = e.getAttribute("y");
735
- b.forEach((g, m) => {
736
- g.setAttribute("x", _), g.setAttribute("y", S), g.setAttribute("dy", `${E + m * h}em`);
737
- });
738
- };
739
- }
740
- function at(t, n, s) {
741
- let e = n[0].radius - U(n[0], t);
742
- for (let i = 1; i < n.length; ++i) {
743
- const o = n[i].radius - U(n[i], t);
744
- o <= e && (e = o);
745
- }
746
- for (let i = 0; i < s.length; ++i) {
747
- const o = U(s[i], t) - s[i].radius;
748
- o <= e && (e = o);
749
- }
750
- return e;
751
- }
752
- function jt(t, n, s) {
753
- const e = [];
754
- for (const a of t)
755
- e.push({ x: a.x, y: a.y }), e.push({ x: a.x + a.radius / 2, y: a.y }), e.push({ x: a.x - a.radius / 2, y: a.y }), e.push({ x: a.x, y: a.y + a.radius / 2 }), e.push({ x: a.x, y: a.y - a.radius / 2 });
756
- let i = e[0], o = at(e[0], t, n);
757
- for (let a = 1; a < e.length; ++a) {
758
- const y = at(e[a], t, n);
759
- y >= o && (i = e[a], o = y);
760
- }
761
- const r = zt(
762
- (a) => -1 * at({ x: a[0], y: a[1] }, t, n),
763
- [i.x, i.y],
764
- { maxIterations: 500, minErrorDelta: 1e-10 }
765
- ).x, l = { x: s ? 0 : r[0], y: r[1] };
766
- let f = !0;
767
- for (const a of t)
768
- if (U(l, a) > a.radius) {
769
- f = !1;
770
- break;
771
- }
772
- for (const a of n)
773
- if (U(l, a) < a.radius) {
774
- f = !1;
775
- break;
776
- }
777
- if (f)
778
- return l;
779
- if (t.length == 1)
780
- return { x: t[0].x, y: t[0].y };
781
- const u = {};
782
- return st(t, u), u.arcs.length === 0 ? { x: 0, y: -1e3, disjoint: !0 } : u.arcs.length == 1 ? { x: u.arcs[0].circle.x, y: u.arcs[0].circle.y } : n.length ? jt(t, []) : Et(u.arcs.map((a) => a.p1));
783
- }
784
- function Ie(t) {
785
- const n = {}, s = Object.keys(t);
786
- for (const e of s)
787
- n[e] = [];
788
- for (let e = 0; e < s.length; e++) {
789
- const i = s[e], o = t[i];
790
- for (let r = e + 1; r < s.length; ++r) {
791
- const l = s[r], f = t[l], u = U(o, f);
792
- u + f.radius <= o.radius + 1e-10 ? n[l].push(i) : u + o.radius <= f.radius + 1e-10 && n[i].push(l);
793
- }
794
- }
795
- return n;
796
- }
797
- function Lt(t, n, s) {
798
- const e = {}, i = Ie(t);
799
- for (let o = 0; o < n.length; ++o) {
800
- const r = n[o].sets, l = {}, f = {};
801
- for (let h = 0; h < r.length; ++h) {
802
- l[r[h]] = !0;
803
- const b = i[r[h]];
804
- for (let p = 0; p < b.length; ++p)
805
- f[b[p]] = !0;
806
- }
807
- const u = [], a = [];
808
- for (let h in t)
809
- h in l ? u.push(t[h]) : h in f || a.push(t[h]);
810
- const y = jt(u, a, s);
811
- e[r] = y, y.disjoint && n[o].size > 0 && console.log("WARNING: area " + r + " not represented on screen");
812
- }
813
- return e;
814
- }
815
- function ke(t, n, s) {
816
- const e = [];
817
- return e.push(`
818
- M`, t, n), e.push(`
819
- m`, -s, 0), e.push(`
820
- a`, s, s, 0, 1, 0, s * 2, 0), e.push(`
821
- a`, s, s, 0, 1, 0, -s * 2, 0), e.join(" ");
822
- }
823
- function Me(t) {
824
- const n = t.split(" ");
825
- return { x: Number.parseFloat(n[1]), y: Number.parseFloat(n[2]), radius: -Number.parseFloat(n[4]) };
826
- }
827
- function Pt(t) {
828
- if (t.length === 0)
829
- return [];
830
- const n = {};
831
- return st(t, n), n.arcs;
832
- }
833
- function Bt(t, n) {
834
- if (t.length === 0)
835
- return "M 0 0";
836
- const s = Math.pow(10, n || 0), e = n != null ? (o) => Math.round(o * s) / s : (o) => o;
837
- if (t.length == 1) {
838
- const o = t[0].circle;
839
- return ke(e(o.x), e(o.y), e(o.radius));
840
- }
841
- const i = [`
842
- M`, e(t[0].p2.x), e(t[0].p2.y)];
843
- for (const o of t) {
844
- const r = e(o.circle.radius);
845
- i.push(`
846
- A`, r, r, 0, o.large ? 1 : 0, o.sweep ? 1 : 0, e(o.p1.x), e(o.p1.y));
847
- }
848
- return i.join(" ");
849
- }
850
- function St(t, n) {
851
- return Bt(Pt(t), n);
852
- }
853
- function Se(t, n = {}) {
854
- const {
855
- lossFunction: s,
856
- layoutFunction: e = At,
857
- normalize: i = !0,
858
- orientation: o = Math.PI / 2,
859
- orientationOrder: r,
860
- width: l = 600,
861
- height: f = 350,
862
- padding: u = 15,
863
- scaleToFit: a = !1,
864
- symmetricalTextCentre: y = !1,
865
- distinct: h,
866
- round: b = 2
867
- } = n;
868
- let p = e(t, {
869
- lossFunction: s === "default" || !s ? tt : s === "logRatio" ? Dt : s,
870
- distinct: h
871
- });
872
- i && (p = Ct(p, o, r));
873
- const M = Nt(p, l, f, u, a), E = Lt(M, t, y), _ = new Map(
874
- Object.keys(M).map((m) => [
875
- m,
876
- {
877
- set: m,
878
- x: M[m].x,
879
- y: M[m].y,
880
- radius: M[m].radius
881
- }
882
- ])
883
- ), S = t.map((m) => {
884
- const v = m.sets.map((d) => _.get(d)), c = Pt(v), x = Bt(c, b);
885
- return { circles: v, arcs: c, path: x, area: m, has: new Set(m.sets) };
886
- });
887
- function g(m) {
888
- let v = "";
889
- for (const c of S)
890
- c.has.size > m.length && m.every((x) => c.has.has(x)) && (v += " " + c.path);
891
- return v;
892
- }
893
- return S.map(({ circles: m, arcs: v, path: c, area: x }) => ({
894
- data: x,
895
- text: E[x.sets],
896
- circles: m,
897
- arcs: v,
898
- path: c,
899
- distinctPath: c + g(x.sets)
900
- }));
901
- }
902
- var gt = (function() {
903
- var t = /* @__PURE__ */ w(function(S, g, m, v) {
904
- for (m = m || {}, v = S.length; v--; m[S[v]] = g) ;
905
- return m;
906
- }, "o"), n = [5, 8], s = [7, 8, 11, 12, 17, 19, 22, 24], e = [1, 17], i = [1, 18], o = [7, 8, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 27], r = [1, 31], l = [1, 39], f = [7, 8, 11, 12, 17, 19, 22, 24, 27], u = [1, 57], a = [1, 56], y = [1, 58], h = [1, 59], b = [1, 60], p = [7, 8, 11, 12, 16, 17, 19, 20, 22, 24, 27, 31, 32, 33], M = {
907
- trace: /* @__PURE__ */ w(function() {
908
- }, "trace"),
909
- yy: {},
910
- symbols_: { error: 2, start: 3, optNewlines: 4, VENN: 5, document: 6, EOF: 7, NEWLINE: 8, line: 9, statement: 10, TITLE: 11, SET: 12, identifier: 13, BRACKET_LABEL: 14, COLON: 15, NUMERIC: 16, UNION: 17, identifierList: 18, TEXT: 19, IDENTIFIER: 20, STRING: 21, INDENT_TEXT: 22, indentedTextTail: 23, STYLE: 24, stylesOpt: 25, styleField: 26, COMMA: 27, styleValue: 28, valueTokens: 29, valueToken: 30, HEXCOLOR: 31, RGBCOLOR: 32, RGBACOLOR: 33, $accept: 0, $end: 1 },
911
- terminals_: { 2: "error", 5: "VENN", 7: "EOF", 8: "NEWLINE", 11: "TITLE", 12: "SET", 14: "BRACKET_LABEL", 15: "COLON", 16: "NUMERIC", 17: "UNION", 19: "TEXT", 20: "IDENTIFIER", 21: "STRING", 22: "INDENT_TEXT", 24: "STYLE", 27: "COMMA", 31: "HEXCOLOR", 32: "RGBCOLOR", 33: "RGBACOLOR" },
912
- productions_: [0, [3, 4], [4, 0], [4, 2], [6, 0], [6, 2], [9, 1], [9, 1], [10, 1], [10, 2], [10, 3], [10, 4], [10, 5], [10, 2], [10, 3], [10, 4], [10, 5], [10, 3], [10, 3], [10, 3], [10, 4], [10, 4], [10, 2], [10, 3], [23, 1], [23, 1], [23, 1], [23, 2], [23, 2], [25, 1], [25, 3], [26, 3], [28, 1], [28, 1], [29, 1], [29, 2], [30, 1], [30, 1], [30, 1], [30, 1], [30, 1], [18, 1], [18, 3], [13, 1], [13, 1]],
913
- performAction: /* @__PURE__ */ w(function(g, m, v, c, x, d, D) {
914
- var I = d.length - 1;
915
- switch (x) {
916
- case 1:
917
- return d[I - 1];
918
- case 2:
919
- case 3:
920
- case 4:
921
- this.$ = [];
922
- break;
923
- case 5:
924
- d[I - 1].push(d[I]), this.$ = d[I - 1];
925
- break;
926
- case 6:
927
- this.$ = [];
928
- break;
929
- case 7:
930
- case 22:
931
- case 32:
932
- case 36:
933
- case 37:
934
- case 38:
935
- case 39:
936
- case 40:
937
- this.$ = d[I];
938
- break;
939
- case 8:
940
- c.setDiagramTitle(d[I].substr(6)), this.$ = d[I].substr(6);
941
- break;
942
- case 9:
943
- c.addSubsetData([d[I]], void 0, void 0), c.setIndentMode && c.setIndentMode(!0);
944
- break;
945
- case 10:
946
- c.addSubsetData([d[I - 1]], d[I], void 0), c.setIndentMode && c.setIndentMode(!0);
947
- break;
948
- case 11:
949
- c.addSubsetData([d[I - 2]], void 0, parseFloat(d[I])), c.setIndentMode && c.setIndentMode(!0);
950
- break;
951
- case 12:
952
- c.addSubsetData([d[I - 3]], d[I - 2], parseFloat(d[I])), c.setIndentMode && c.setIndentMode(!0);
953
- break;
954
- case 13:
955
- if (d[I].length < 2)
956
- throw new Error("union requires multiple identifiers");
957
- c.validateUnionIdentifiers && c.validateUnionIdentifiers(d[I]), c.addSubsetData(d[I], void 0, void 0), c.setIndentMode && c.setIndentMode(!0);
958
- break;
959
- case 14:
960
- if (d[I - 1].length < 2)
961
- throw new Error("union requires multiple identifiers");
962
- c.validateUnionIdentifiers && c.validateUnionIdentifiers(d[I - 1]), c.addSubsetData(d[I - 1], d[I], void 0), c.setIndentMode && c.setIndentMode(!0);
963
- break;
964
- case 15:
965
- if (d[I - 2].length < 2)
966
- throw new Error("union requires multiple identifiers");
967
- c.validateUnionIdentifiers && c.validateUnionIdentifiers(d[I - 2]), c.addSubsetData(d[I - 2], void 0, parseFloat(d[I])), c.setIndentMode && c.setIndentMode(!0);
968
- break;
969
- case 16:
970
- if (d[I - 3].length < 2)
971
- throw new Error("union requires multiple identifiers");
972
- c.validateUnionIdentifiers && c.validateUnionIdentifiers(d[I - 3]), c.addSubsetData(d[I - 3], d[I - 2], parseFloat(d[I])), c.setIndentMode && c.setIndentMode(!0);
973
- break;
974
- case 17:
975
- case 18:
976
- case 19:
977
- c.addTextData(d[I - 1], d[I], void 0);
978
- break;
979
- case 20:
980
- case 21:
981
- c.addTextData(d[I - 2], d[I - 1], d[I]);
982
- break;
983
- case 23:
984
- c.addStyleData(d[I - 1], d[I]);
985
- break;
986
- case 24:
987
- case 25:
988
- case 26:
989
- var C = c.getCurrentSets();
990
- if (!C) throw new Error("text requires set");
991
- c.addTextData(C, d[I], void 0);
992
- break;
993
- case 27:
994
- case 28:
995
- var C = c.getCurrentSets();
996
- if (!C) throw new Error("text requires set");
997
- c.addTextData(C, d[I - 1], d[I]);
998
- break;
999
- case 29:
1000
- case 41:
1001
- this.$ = [d[I]];
1002
- break;
1003
- case 30:
1004
- case 42:
1005
- this.$ = [...d[I - 2], d[I]];
1006
- break;
1007
- case 31:
1008
- this.$ = [d[I - 2], d[I]];
1009
- break;
1010
- case 33:
1011
- this.$ = d[I].join(" ");
1012
- break;
1013
- case 34:
1014
- this.$ = [d[I]];
1015
- break;
1016
- case 35:
1017
- d[I - 1].push(d[I]), this.$ = d[I - 1];
1018
- break;
1019
- case 43:
1020
- case 44:
1021
- this.$ = d[I];
1022
- break;
1023
- }
1024
- }, "anonymous"),
1025
- table: [t(n, [2, 2], { 3: 1, 4: 2 }), { 1: [3] }, { 5: [1, 3], 8: [1, 4] }, t(s, [2, 4], { 6: 5 }), t(n, [2, 3]), { 7: [1, 6], 8: [1, 8], 9: 7, 10: 9, 11: [1, 10], 12: [1, 11], 17: [1, 12], 19: [1, 13], 22: [1, 14], 24: [1, 15] }, { 1: [2, 1] }, t(s, [2, 5]), t(s, [2, 6]), t(s, [2, 7]), t(s, [2, 8]), { 13: 16, 20: e, 21: i }, { 13: 20, 18: 19, 20: e, 21: i }, { 13: 20, 18: 21, 20: e, 21: i }, { 16: [1, 25], 20: [1, 23], 21: [1, 24], 23: 22 }, { 13: 20, 18: 26, 20: e, 21: i }, t(s, [2, 9], { 14: [1, 27], 15: [1, 28] }), t(o, [2, 43]), t(o, [2, 44]), t(s, [2, 13], { 14: [1, 29], 15: [1, 30], 27: r }), t(o, [2, 41]), { 16: [1, 34], 20: [1, 32], 21: [1, 33], 27: r }, t(s, [2, 22]), t(s, [2, 24], { 14: [1, 35] }), t(s, [2, 25], { 14: [1, 36] }), t(s, [2, 26]), { 20: l, 25: 37, 26: 38, 27: r }, t(s, [2, 10], { 15: [1, 40] }), { 16: [1, 41] }, t(s, [2, 14], { 15: [1, 42] }), { 16: [1, 43] }, { 13: 44, 20: e, 21: i }, t(s, [2, 17], { 14: [1, 45] }), t(s, [2, 18], { 14: [1, 46] }), t(s, [2, 19]), t(s, [2, 27]), t(s, [2, 28]), t(s, [2, 23], { 27: [1, 47] }), t(f, [2, 29]), { 15: [1, 48] }, { 16: [1, 49] }, t(s, [2, 11]), { 16: [1, 50] }, t(s, [2, 15]), t(o, [2, 42]), t(s, [2, 20]), t(s, [2, 21]), { 20: l, 26: 51 }, { 16: u, 20: a, 21: [1, 53], 28: 52, 29: 54, 30: 55, 31: y, 32: h, 33: b }, t(s, [2, 12]), t(s, [2, 16]), t(f, [2, 30]), t(f, [2, 31]), t(f, [2, 32]), t(f, [2, 33], { 30: 61, 16: u, 20: a, 31: y, 32: h, 33: b }), t(p, [2, 34]), t(p, [2, 36]), t(p, [2, 37]), t(p, [2, 38]), t(p, [2, 39]), t(p, [2, 40]), t(p, [2, 35])],
1026
- defaultActions: { 6: [2, 1] },
1027
- parseError: /* @__PURE__ */ w(function(g, m) {
1028
- if (m.recoverable)
1029
- this.trace(g);
1030
- else {
1031
- var v = new Error(g);
1032
- throw v.hash = m, v;
1033
- }
1034
- }, "parseError"),
1035
- parse: /* @__PURE__ */ w(function(g) {
1036
- var m = this, v = [0], c = [], x = [null], d = [], D = this.table, I = "", C = 0, q = 0, V = 2, O = 1, R = d.slice.call(arguments, 1), T = Object.create(this.lexer), A = { yy: {} };
1037
- for (var G in this.yy)
1038
- Object.prototype.hasOwnProperty.call(this.yy, G) && (A.yy[G] = this.yy[G]);
1039
- T.setInput(g, A.yy), A.yy.lexer = T, A.yy.parser = this, typeof T.yylloc > "u" && (T.yylloc = {});
1040
- var P = T.yylloc;
1041
- d.push(P);
1042
- var B = T.options && T.options.ranges;
1043
- typeof A.yy.parseError == "function" ? this.parseError = A.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
1044
- function L(W) {
1045
- v.length = v.length - 2 * W, x.length = x.length - W, d.length = d.length - W;
1046
- }
1047
- w(L, "popStack");
1048
- function K() {
1049
- var W;
1050
- return W = c.pop() || T.lex() || O, typeof W != "number" && (W instanceof Array && (c = W, W = c.pop()), W = m.symbols_[W] || W), W;
1051
- }
1052
- w(K, "lex");
1053
- for (var z, N, j, X, k = {}, F, H, et, Y; ; ) {
1054
- if (N = v[v.length - 1], this.defaultActions[N] ? j = this.defaultActions[N] : ((z === null || typeof z > "u") && (z = K()), j = D[N] && D[N][z]), typeof j > "u" || !j.length || !j[0]) {
1055
- var Z = "";
1056
- Y = [];
1057
- for (F in D[N])
1058
- this.terminals_[F] && F > V && Y.push("'" + this.terminals_[F] + "'");
1059
- T.showPosition ? Z = "Parse error on line " + (C + 1) + `:
1060
- ` + T.showPosition() + `
1061
- Expecting ` + Y.join(", ") + ", got '" + (this.terminals_[z] || z) + "'" : Z = "Parse error on line " + (C + 1) + ": Unexpected " + (z == O ? "end of input" : "'" + (this.terminals_[z] || z) + "'"), this.parseError(Z, {
1062
- text: T.match,
1063
- token: this.terminals_[z] || z,
1064
- line: T.yylineno,
1065
- loc: P,
1066
- expected: Y
1067
- });
1068
- }
1069
- if (j[0] instanceof Array && j.length > 1)
1070
- throw new Error("Parse Error: multiple actions possible at state: " + N + ", token: " + z);
1071
- switch (j[0]) {
1072
- case 1:
1073
- v.push(z), x.push(T.yytext), d.push(T.yylloc), v.push(j[1]), z = null, q = T.yyleng, I = T.yytext, C = T.yylineno, P = T.yylloc;
1074
- break;
1075
- case 2:
1076
- if (H = this.productions_[j[1]][1], k.$ = x[x.length - H], k._$ = {
1077
- first_line: d[d.length - (H || 1)].first_line,
1078
- last_line: d[d.length - 1].last_line,
1079
- first_column: d[d.length - (H || 1)].first_column,
1080
- last_column: d[d.length - 1].last_column
1081
- }, B && (k._$.range = [
1082
- d[d.length - (H || 1)].range[0],
1083
- d[d.length - 1].range[1]
1084
- ]), X = this.performAction.apply(k, [
1085
- I,
1086
- q,
1087
- C,
1088
- A.yy,
1089
- j[1],
1090
- x,
1091
- d
1092
- ].concat(R)), typeof X < "u")
1093
- return X;
1094
- H && (v = v.slice(0, -1 * H * 2), x = x.slice(0, -1 * H), d = d.slice(0, -1 * H)), v.push(this.productions_[j[1]][0]), x.push(k.$), d.push(k._$), et = D[v[v.length - 2]][v[v.length - 1]], v.push(et);
1095
- break;
1096
- case 3:
1097
- return !0;
1098
- }
1099
- }
1100
- return !0;
1101
- }, "parse")
1102
- }, E = /* @__PURE__ */ (function() {
1103
- var S = {
1104
- EOF: 1,
1105
- parseError: /* @__PURE__ */ w(function(m, v) {
1106
- if (this.yy.parser)
1107
- this.yy.parser.parseError(m, v);
1108
- else
1109
- throw new Error(m);
1110
- }, "parseError"),
1111
- // resets the lexer, sets new input
1112
- setInput: /* @__PURE__ */ w(function(g, m) {
1113
- return this.yy = m || this.yy || {}, this._input = g, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
1114
- first_line: 1,
1115
- first_column: 0,
1116
- last_line: 1,
1117
- last_column: 0
1118
- }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
1119
- }, "setInput"),
1120
- // consumes and returns one char from the input
1121
- input: /* @__PURE__ */ w(function() {
1122
- var g = this._input[0];
1123
- this.yytext += g, this.yyleng++, this.offset++, this.match += g, this.matched += g;
1124
- var m = g.match(/(?:\r\n?|\n).*/g);
1125
- return m ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), g;
1126
- }, "input"),
1127
- // unshifts one char (or a string) into the input
1128
- unput: /* @__PURE__ */ w(function(g) {
1129
- var m = g.length, v = g.split(/(?:\r\n?|\n)/g);
1130
- this._input = g + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - m), this.offset -= m;
1131
- var c = this.match.split(/(?:\r\n?|\n)/g);
1132
- this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), v.length - 1 && (this.yylineno -= v.length - 1);
1133
- var x = this.yylloc.range;
1134
- return this.yylloc = {
1135
- first_line: this.yylloc.first_line,
1136
- last_line: this.yylineno + 1,
1137
- first_column: this.yylloc.first_column,
1138
- last_column: v ? (v.length === c.length ? this.yylloc.first_column : 0) + c[c.length - v.length].length - v[0].length : this.yylloc.first_column - m
1139
- }, this.options.ranges && (this.yylloc.range = [x[0], x[0] + this.yyleng - m]), this.yyleng = this.yytext.length, this;
1140
- }, "unput"),
1141
- // When called from action, caches matched text and appends it on next action
1142
- more: /* @__PURE__ */ w(function() {
1143
- return this._more = !0, this;
1144
- }, "more"),
1145
- // 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.
1146
- reject: /* @__PURE__ */ w(function() {
1147
- if (this.options.backtrack_lexer)
1148
- this._backtrack = !0;
1149
- else
1150
- 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).
1151
- ` + this.showPosition(), {
1152
- text: "",
1153
- token: null,
1154
- line: this.yylineno
1155
- });
1156
- return this;
1157
- }, "reject"),
1158
- // retain first n characters of the match
1159
- less: /* @__PURE__ */ w(function(g) {
1160
- this.unput(this.match.slice(g));
1161
- }, "less"),
1162
- // displays already matched input, i.e. for error messages
1163
- pastInput: /* @__PURE__ */ w(function() {
1164
- var g = this.matched.substr(0, this.matched.length - this.match.length);
1165
- return (g.length > 20 ? "..." : "") + g.substr(-20).replace(/\n/g, "");
1166
- }, "pastInput"),
1167
- // displays upcoming input, i.e. for error messages
1168
- upcomingInput: /* @__PURE__ */ w(function() {
1169
- var g = this.match;
1170
- return g.length < 20 && (g += this._input.substr(0, 20 - g.length)), (g.substr(0, 20) + (g.length > 20 ? "..." : "")).replace(/\n/g, "");
1171
- }, "upcomingInput"),
1172
- // displays the character position where the lexing error occurred, i.e. for error messages
1173
- showPosition: /* @__PURE__ */ w(function() {
1174
- var g = this.pastInput(), m = new Array(g.length + 1).join("-");
1175
- return g + this.upcomingInput() + `
1176
- ` + m + "^";
1177
- }, "showPosition"),
1178
- // test the lexed token: return FALSE when not a match, otherwise return token
1179
- test_match: /* @__PURE__ */ w(function(g, m) {
1180
- var v, c, x;
1181
- if (this.options.backtrack_lexer && (x = {
1182
- yylineno: this.yylineno,
1183
- yylloc: {
1184
- first_line: this.yylloc.first_line,
1185
- last_line: this.last_line,
1186
- first_column: this.yylloc.first_column,
1187
- last_column: this.yylloc.last_column
1188
- },
1189
- yytext: this.yytext,
1190
- match: this.match,
1191
- matches: this.matches,
1192
- matched: this.matched,
1193
- yyleng: this.yyleng,
1194
- offset: this.offset,
1195
- _more: this._more,
1196
- _input: this._input,
1197
- yy: this.yy,
1198
- conditionStack: this.conditionStack.slice(0),
1199
- done: this.done
1200
- }, this.options.ranges && (x.yylloc.range = this.yylloc.range.slice(0))), c = g[0].match(/(?:\r\n?|\n).*/g), c && (this.yylineno += c.length), this.yylloc = {
1201
- first_line: this.yylloc.last_line,
1202
- last_line: this.yylineno + 1,
1203
- first_column: this.yylloc.last_column,
1204
- last_column: c ? c[c.length - 1].length - c[c.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + g[0].length
1205
- }, this.yytext += g[0], this.match += g[0], this.matches = g, 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(g[0].length), this.matched += g[0], v = this.performAction.call(this, this.yy, this, m, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), v)
1206
- return v;
1207
- if (this._backtrack) {
1208
- for (var d in x)
1209
- this[d] = x[d];
1210
- return !1;
1211
- }
1212
- return !1;
1213
- }, "test_match"),
1214
- // return next match in input
1215
- next: /* @__PURE__ */ w(function() {
1216
- if (this.done)
1217
- return this.EOF;
1218
- this._input || (this.done = !0);
1219
- var g, m, v, c;
1220
- this._more || (this.yytext = "", this.match = "");
1221
- for (var x = this._currentRules(), d = 0; d < x.length; d++)
1222
- if (v = this._input.match(this.rules[x[d]]), v && (!m || v[0].length > m[0].length)) {
1223
- if (m = v, c = d, this.options.backtrack_lexer) {
1224
- if (g = this.test_match(v, x[d]), g !== !1)
1225
- return g;
1226
- if (this._backtrack) {
1227
- m = !1;
1228
- continue;
1229
- } else
1230
- return !1;
1231
- } else if (!this.options.flex)
1232
- break;
1233
- }
1234
- return m ? (g = this.test_match(m, x[c]), g !== !1 ? g : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
1235
- ` + this.showPosition(), {
1236
- text: "",
1237
- token: null,
1238
- line: this.yylineno
1239
- });
1240
- }, "next"),
1241
- // return next match that has a token
1242
- lex: /* @__PURE__ */ w(function() {
1243
- var m = this.next();
1244
- return m || this.lex();
1245
- }, "lex"),
1246
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
1247
- begin: /* @__PURE__ */ w(function(m) {
1248
- this.conditionStack.push(m);
1249
- }, "begin"),
1250
- // pop the previously active lexer condition state off the condition stack
1251
- popState: /* @__PURE__ */ w(function() {
1252
- var m = this.conditionStack.length - 1;
1253
- return m > 0 ? this.conditionStack.pop() : this.conditionStack[0];
1254
- }, "popState"),
1255
- // produce the lexer rule set which is active for the currently active lexer condition state
1256
- _currentRules: /* @__PURE__ */ w(function() {
1257
- return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
1258
- }, "_currentRules"),
1259
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
1260
- topState: /* @__PURE__ */ w(function(m) {
1261
- return m = this.conditionStack.length - 1 - Math.abs(m || 0), m >= 0 ? this.conditionStack[m] : "INITIAL";
1262
- }, "topState"),
1263
- // alias for begin(condition)
1264
- pushState: /* @__PURE__ */ w(function(m) {
1265
- this.begin(m);
1266
- }, "pushState"),
1267
- // return the number of states currently on the stack
1268
- stateStackSize: /* @__PURE__ */ w(function() {
1269
- return this.conditionStack.length;
1270
- }, "stateStackSize"),
1271
- options: { "case-insensitive": !0 },
1272
- performAction: /* @__PURE__ */ w(function(m, v, c, x) {
1273
- switch (c) {
1274
- case 0:
1275
- break;
1276
- case 1:
1277
- break;
1278
- case 2:
1279
- break;
1280
- case 3:
1281
- if (m.getIndentMode && m.getIndentMode())
1282
- return m.consumeIndentText = !0, this.begin("INITIAL"), 22;
1283
- break;
1284
- case 4:
1285
- break;
1286
- case 5:
1287
- m.setIndentMode && m.setIndentMode(!1), this.begin("INITIAL"), this.unput(v.yytext);
1288
- break;
1289
- case 6:
1290
- return this.begin("bol"), 8;
1291
- case 7:
1292
- break;
1293
- case 8:
1294
- break;
1295
- case 9:
1296
- return 7;
1297
- case 10:
1298
- return 11;
1299
- case 11:
1300
- return 5;
1301
- case 12:
1302
- return 12;
1303
- case 13:
1304
- return 17;
1305
- case 14:
1306
- if (m.consumeIndentText)
1307
- m.consumeIndentText = !1;
1308
- else
1309
- return 19;
1310
- break;
1311
- case 15:
1312
- return 24;
1313
- case 16:
1314
- return v.yytext = v.yytext.slice(2, -2), 14;
1315
- case 17:
1316
- return v.yytext = v.yytext.slice(1, -1).trim(), 14;
1317
- case 18:
1318
- return 16;
1319
- case 19:
1320
- return 31;
1321
- case 20:
1322
- return 33;
1323
- case 21:
1324
- return 32;
1325
- case 22:
1326
- return 20;
1327
- case 23:
1328
- return 21;
1329
- case 24:
1330
- return 27;
1331
- case 25:
1332
- return 15;
1333
- }
1334
- }, "anonymous"),
1335
- rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[ \t]+(?=[\n\r]))/i, /^(?:[ \t]+(?=text\b))/i, /^(?:[ \t]+)/i, /^(?:[^ \t\n\r])/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[ \t]+)/i, /^(?:$)/i, /^(?:title\s[^#\n;]+)/i, /^(?:venn-beta\b)/i, /^(?:set\b)/i, /^(?:union\b)/i, /^(?:text\b)/i, /^(?:style\b)/i, /^(?:\["[^\"]*"\])/i, /^(?:\[[^\]\"]+\])/i, /^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i, /^(?:#[0-9a-fA-F]{3,8})/i, /^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:"[^\"]*")/i, /^(?:,)/i, /^(?::)/i],
1336
- conditions: { bol: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], inclusive: !0 }, INITIAL: { rules: [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25], inclusive: !0 } }
1337
- };
1338
- return S;
1339
- })();
1340
- M.lexer = E;
1341
- function _() {
1342
- this.yy = {};
1343
- }
1344
- return w(_, "Parser"), _.prototype = M, M.Parser = _, new _();
1345
- })();
1346
- gt.parser = gt;
1347
- var we = gt, yt = [], pt = [], mt = [], bt = /* @__PURE__ */ new Set(), vt, It = !1, _e = /* @__PURE__ */ w((t, n, s) => {
1348
- const e = it(t).sort(), i = s ?? 10 / Math.pow(t.length, 2);
1349
- vt = e, e.length === 1 && bt.add(e[0]), yt.push({
1350
- sets: e,
1351
- size: i,
1352
- label: n ? nt(n) : void 0
1353
- });
1354
- }, "addSubsetData"), Te = /* @__PURE__ */ w(() => yt, "getSubsetData"), nt = /* @__PURE__ */ w((t) => {
1355
- const n = t.trim();
1356
- return n.length >= 2 && n.startsWith('"') && n.endsWith('"') ? n.slice(1, -1) : n;
1357
- }, "normalizeText"), Ee = /* @__PURE__ */ w((t) => t && nt(t), "normalizeStyleValue"), ze = /* @__PURE__ */ w((t, n, s) => {
1358
- const e = nt(n);
1359
- pt.push({
1360
- sets: it(t).sort(),
1361
- id: e,
1362
- label: s ? nt(s) : void 0
1363
- });
1364
- }, "addTextData"), Ae = /* @__PURE__ */ w((t, n) => {
1365
- const s = it(t).sort(), e = {};
1366
- for (const [i, o] of n)
1367
- e[i] = Ee(o) ?? o;
1368
- mt.push({ targets: s, styles: e });
1369
- }, "addStyleData"), Re = /* @__PURE__ */ w(() => mt, "getStyleData"), it = /* @__PURE__ */ w((t) => t.map((n) => nt(n)), "normalizeIdentifierList"), De = /* @__PURE__ */ w((t) => {
1370
- const s = it(t).filter((e) => !bt.has(e));
1371
- if (s.length > 0)
1372
- throw new Error(`unknown set identifier: ${s.join(", ")}`);
1373
- }, "validateUnionIdentifiers"), Ce = /* @__PURE__ */ w(() => pt, "getTextData"), Ne = /* @__PURE__ */ w(() => vt, "getCurrentSets"), Oe = /* @__PURE__ */ w(() => It, "getIndentMode"), Fe = /* @__PURE__ */ w((t) => {
1374
- It = t;
1375
- }, "setIndentMode"), je = re.venn;
1376
- function Vt() {
1377
- return oe(je, wt().venn);
1378
- }
1379
- w(Vt, "getConfig");
1380
- var Le = /* @__PURE__ */ w(() => {
1381
- ie(), yt.length = 0, pt.length = 0, mt.length = 0, bt.clear(), vt = void 0, It = !1;
1382
- }, "customClear"), Pe = {
1383
- getConfig: Vt,
1384
- clear: Le,
1385
- setAccTitle: Jt,
1386
- getAccTitle: Zt,
1387
- setDiagramTitle: Xt,
1388
- getDiagramTitle: Yt,
1389
- getAccDescription: Ht,
1390
- setAccDescription: Kt,
1391
- addSubsetData: _e,
1392
- getSubsetData: Te,
1393
- addTextData: ze,
1394
- addStyleData: Ae,
1395
- validateUnionIdentifiers: De,
1396
- getTextData: Ce,
1397
- getStyleData: Re,
1398
- getCurrentSets: Ne,
1399
- getIndentMode: Oe,
1400
- setIndentMode: Fe
1401
- }, Be = /* @__PURE__ */ w((t) => `
1402
- .venn-title {
1403
- font-size: 32px;
1404
- fill: ${t.vennTitleTextColor};
1405
- font-family: ${t.fontFamily};
1406
- }
1407
-
1408
- .venn-circle text {
1409
- font-size: 48px;
1410
- font-family: ${t.fontFamily};
1411
- }
1412
-
1413
- .venn-intersection text {
1414
- font-size: 48px;
1415
- fill: ${t.vennSetTextColor};
1416
- font-family: ${t.fontFamily};
1417
- }
1418
-
1419
- .venn-text-node {
1420
- font-family: ${t.fontFamily};
1421
- color: ${t.vennSetTextColor};
1422
- }
1423
- `, "getStyles"), Ve = Be;
1424
- function Ut(t) {
1425
- const n = /* @__PURE__ */ new Map();
1426
- for (const s of t) {
1427
- const e = s.targets.join("|"), i = n.get(e);
1428
- i ? Object.assign(i, s.styles) : n.set(e, { ...s.styles });
1429
- }
1430
- return n;
1431
- }
1432
- w(Ut, "buildStyleByKey");
1433
- var Ue = /* @__PURE__ */ w((t, n, s, e) => {
1434
- const i = e.db, o = i.getConfig?.(), { themeVariables: r, look: l, handDrawnSeed: f } = wt(), u = l === "handDrawn", a = [
1435
- r.venn1,
1436
- r.venn2,
1437
- r.venn3,
1438
- r.venn4,
1439
- r.venn5,
1440
- r.venn6,
1441
- r.venn7,
1442
- r.venn8
1443
- ].filter(Boolean), y = i.getDiagramTitle?.(), h = i.getSubsetData(), b = i.getTextData(), p = Ut(i.getStyleData()), M = Gt(h), E = o?.width ?? 800, _ = o?.height ?? 450, g = E / 1600, m = y ? 48 * g : 0, v = r.primaryTextColor ?? r.textColor, c = Qt(n);
1444
- c.attr("viewBox", `0 0 ${E} ${_}`), y && c.append("text").text(y).attr("class", "venn-title").attr("font-size", `${32 * g}px`).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("x", "50%").attr("y", 32 * g).style("fill", r.vennTitleTextColor || r.titleColor);
1445
- const x = ot(document.createElement("div")), d = ve().width(E).height(_ - m);
1446
- x.datum(M).call(d);
1447
- const D = u ? $t.svg(x.select("svg").node()) : void 0, I = Se(M, {
1448
- width: E,
1449
- height: _ - m,
1450
- padding: o?.padding ?? 15
1451
- }), C = /* @__PURE__ */ new Map();
1452
- for (const R of I) {
1453
- const T = Q([...R.data.sets].sort());
1454
- C.set(T, R);
1455
- }
1456
- b.length > 0 && qt(o, C, x, b, g, p);
1457
- const q = te(r.background || "#f4f4f4");
1458
- x.selectAll(".venn-circle").each(function(R, T) {
1459
- const A = ot(this), P = Q([...R.sets].sort()), B = p.get(P), L = B?.fill || a[T % a.length] || r.primaryColor;
1460
- A.classed(`venn-set-${T % 8}`, !0);
1461
- const K = B?.["fill-opacity"] ?? 0.1, z = B?.stroke || L, N = B?.["stroke-width"] || `${5 * g}`;
1462
- if (u && D) {
1463
- const X = C.get(P);
1464
- if (X && X.circles.length > 0) {
1465
- const k = X.circles[0], F = D.circle(k.x, k.y, k.radius * 2, {
1466
- roughness: 0.7,
1467
- seed: f,
1468
- fill: kt(L, 0.7),
1469
- fillStyle: "hachure",
1470
- fillWeight: 2,
1471
- hachureGap: 8,
1472
- hachureAngle: -41 + T * 60,
1473
- stroke: z,
1474
- strokeWidth: parseFloat(String(N))
1475
- });
1476
- A.select("path").remove(), A.node()?.insertBefore(F, A.select("text").node());
1477
- }
1478
- } else
1479
- A.select("path").style("fill", L).style("fill-opacity", K).style("stroke", z).style("stroke-width", N).style("stroke-opacity", 0.95);
1480
- const j = B?.color || (q ? ee(L, 30) : ne(L, 30));
1481
- A.select("text").style("font-size", `${48 * g}px`).style("fill", j);
1482
- }), u && D ? x.selectAll(".venn-intersection").each(function(R) {
1483
- const T = ot(this), G = Q([...R.sets].sort()), P = p.get(G), B = P?.fill;
1484
- if (B) {
1485
- const L = T.select("path"), K = L.attr("d");
1486
- if (K) {
1487
- const z = D.path(K, {
1488
- roughness: 0.7,
1489
- seed: f,
1490
- fill: kt(B, 0.3),
1491
- fillStyle: "cross-hatch",
1492
- fillWeight: 2,
1493
- hachureGap: 6,
1494
- hachureAngle: 60,
1495
- stroke: "none"
1496
- }), N = L.node();
1497
- N?.parentNode?.insertBefore(z, N), L.remove();
1498
- }
1499
- } else
1500
- T.select("path").style("fill-opacity", 0);
1501
- T.select("text").style("font-size", `${48 * g}px`).style("fill", P?.color ?? r.vennSetTextColor ?? v);
1502
- }) : (x.selectAll(".venn-intersection text").style("font-size", `${48 * g}px`).style("fill", (R) => {
1503
- const A = Q([...R.sets].sort());
1504
- return p.get(A)?.color ?? r.vennSetTextColor ?? v;
1505
- }), x.selectAll(".venn-intersection path").style("fill-opacity", (R) => {
1506
- const A = Q([...R.sets].sort());
1507
- return p.get(A)?.fill ? 1 : 0;
1508
- }).style("fill", (R) => {
1509
- const A = Q([...R.sets].sort());
1510
- return p.get(A)?.fill ?? "transparent";
1511
- }));
1512
- const V = c.append("g").attr("transform", `translate(0, ${m})`), O = x.select("svg").node();
1513
- if (O && "childNodes" in O)
1514
- for (const R of [...O.childNodes])
1515
- V.node()?.appendChild(R);
1516
- se(c, _, E, o?.useMaxWidth ?? !0);
1517
- }, "draw");
1518
- function Q(t) {
1519
- return t.join("|");
1520
- }
1521
- w(Q, "stableSetsKey");
1522
- function qt(t, n, s, e, i, o) {
1523
- const r = t?.useDebugLayout ?? !1, f = s.select("svg").append("g").attr("class", "venn-text-nodes"), u = /* @__PURE__ */ new Map();
1524
- for (const a of e) {
1525
- const y = Q(a.sets), h = u.get(y);
1526
- h ? h.push(a) : u.set(y, [a]);
1527
- }
1528
- for (const [a, y] of u.entries()) {
1529
- const h = n.get(a);
1530
- if (!h?.text)
1531
- continue;
1532
- const b = h.text.x, p = h.text.y, M = Math.min(...h.circles.map((O) => O.radius)), E = Math.min(
1533
- ...h.circles.map((O) => O.radius - Math.hypot(b - O.x, p - O.y))
1534
- );
1535
- let _ = Number.isFinite(E) ? Math.max(0, E) : 0;
1536
- _ === 0 && Number.isFinite(M) && (_ = M * 0.6);
1537
- const S = f.append("g").attr("class", "venn-text-area").attr("font-size", `${40 * i}px`);
1538
- r && S.append("circle").attr("class", "venn-text-debug-circle").attr("cx", b).attr("cy", p).attr("r", _).attr("fill", "none").attr("stroke", "purple").attr("stroke-width", 1.5 * i).attr("stroke-dasharray", `${6 * i} ${4 * i}`);
1539
- const g = Math.max(80 * i, _ * 2 * 0.95), m = Math.max(60 * i, _ * 2 * 0.95), x = (h.data.label && h.data.label.length > 0 ? Math.min(32 * i, _ * 0.25) : 0) + (y.length <= 2 ? 30 * i : 0), d = b - g / 2, D = p - m / 2 + x, I = Math.max(1, Math.ceil(Math.sqrt(y.length))), C = Math.max(1, Math.ceil(y.length / I)), q = g / I, V = m / C;
1540
- for (const [O, R] of y.entries()) {
1541
- const T = O % I, A = Math.floor(O / I), G = d + q * (T + 0.5), P = D + V * (A + 0.5);
1542
- r && S.append("rect").attr("class", "venn-text-debug-cell").attr("x", d + q * T).attr("y", D + V * A).attr("width", q).attr("height", V).attr("fill", "none").attr("stroke", "teal").attr("stroke-width", 1 * i).attr("stroke-dasharray", `${4 * i} ${3 * i}`);
1543
- const B = q * 0.9, L = V * 0.9, K = S.append("foreignObject").attr("class", "venn-text-node-fo").attr("width", B).attr("height", L).attr("x", G - B / 2).attr("y", P - L / 2).attr("overflow", "visible"), z = o.get(R.id)?.color, N = K.append("xhtml:span").attr("class", "venn-text-node").style("display", "flex").style("width", "100%").style("height", "100%").style("white-space", "normal").style("align-items", "center").style("justify-content", "center").style("text-align", "center").style("overflow-wrap", "normal").style("word-break", "normal").text(R.label ?? R.id);
1544
- z && N.style("color", z);
1545
- }
1546
- }
1547
- }
1548
- w(qt, "renderTextNodes");
1549
- function Gt(t) {
1550
- const n = new Set(t.map((i) => [...i.sets].sort().join("|"))), s = new Map(
1551
- t.filter((i) => i.sets.length === 1 && i.size !== void 0).map((i) => [i.sets[0], i.size])
1552
- ), e = [];
1553
- for (const i of t) {
1554
- if (i.sets.length < 3)
1555
- continue;
1556
- const o = [...i.sets].sort();
1557
- for (let r = 0; r < o.length - 1; r++)
1558
- for (let l = r + 1; l < o.length; l++) {
1559
- const f = [o[r], o[l]], u = f.join("|");
1560
- if (!n.has(u)) {
1561
- n.add(u);
1562
- const a = s.get(f[0]), y = s.get(f[1]), h = a !== void 0 && y !== void 0 ? Math.min(a, y) / 4 : 2.5;
1563
- e.push({ sets: f, size: h, label: "" });
1564
- }
1565
- }
1566
- }
1567
- return e.length > 0 ? [...t, ...e] : t;
1568
- }
1569
- w(Gt, "ensurePairwiseSubsets");
1570
- var qe = { draw: Ue }, We = {
1571
- parser: we,
1572
- db: Pe,
1573
- renderer: qe,
1574
- styles: Ve
1575
- };
1576
- export {
1577
- We as diagram
1578
- };