@life-exe/wiki-engine 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/analytics/index.d.ts +10 -0
- package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
- package/dist/chunks/arc-OroUeRL_.js +83 -0
- package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
- package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
- package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
- package/dist/chunks/channel-Bdy1QZHo.js +5 -0
- package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
- package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
- package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
- package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
- package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
- package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
- package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
- package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
- package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
- package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
- package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
- package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
- package/dist/chunks/common-BJ4q25wy.js +12633 -0
- package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
- package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
- package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
- package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
- package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
- package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
- package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
- package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
- package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
- package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
- package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
- package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
- package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
- package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
- package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
- package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
- package/dist/chunks/index-f7Uzykhj.js +38262 -0
- package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
- package/dist/chunks/init-DjUOC4st.js +16 -0
- package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
- package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
- package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
- package/dist/chunks/katex-jHfnQmlp.js +11682 -0
- package/dist/chunks/layout-CgV9vOdp.js +1704 -0
- package/dist/chunks/linear-BzcaSMTS.js +259 -0
- package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
- package/dist/chunks/ordinal-DfAQgscy.js +61 -0
- package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
- package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
- package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
- package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
- package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
- package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
- package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
- package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
- package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
- package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
- package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
- package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
- package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
- package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
- package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
- package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
- package/dist/components/CodeBlock.d.ts +5 -0
- package/dist/components/CommunityLinks.d.ts +21 -0
- package/dist/components/CookieConsent.d.ts +2 -0
- package/dist/components/DocLinkCard.d.ts +6 -0
- package/dist/components/LecturePageView.d.ts +3 -0
- package/dist/components/MermaidDiagram.d.ts +3 -0
- package/dist/components/SearchPopup.d.ts +6 -0
- package/dist/components/WikiApp.d.ts +9 -0
- package/dist/components/WikiLayout.d.ts +2 -0
- package/dist/components/WikiPageView.d.ts +6 -0
- package/dist/components/ZoomableImage.d.ts +2 -0
- package/dist/context/LangContext.d.ts +2 -0
- package/dist/context/WikiContext.d.ts +18 -0
- package/dist/data.d.ts +8 -0
- package/dist/hooks/useLanguage.d.ts +4 -0
- package/dist/hooks/useTheme.d.ts +5 -0
- package/dist/hooks/useWiki.d.ts +2 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +45 -0
- package/dist/languages/ue-cpp.d.ts +7 -0
- package/dist/languages/ue-cpp.js +21 -0
- package/dist/types.d.ts +119 -0
- package/dist/wiki-engine.css +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,1585 @@
|
|
|
1
|
+
import { b5 as Kt, s as Wt, g as Ht, t as Yt, q as Xt, a as Zt, b as Jt, _ as S, E as St, K as Qt, j as rt, aq as $t, Y as te, $ as ee, a0 as ne, d as se, A as ie, G as re, H as oe } from "./index-f7Uzykhj.js";
|
|
2
|
+
const kt = (t, n) => Kt(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, r = 0;
|
|
6
|
+
const o = [];
|
|
7
|
+
if (e.length > 1) {
|
|
8
|
+
const l = Tt(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 h = e[e.length - 1];
|
|
15
|
+
for (let u = 0; u < e.length; ++u) {
|
|
16
|
+
const a = e[u];
|
|
17
|
+
r += (h.x + a.x) * (a.y - h.y);
|
|
18
|
+
const p = { x: (a.x + h.x) / 2, y: (a.y + h.y) / 2 };
|
|
19
|
+
let d = null;
|
|
20
|
+
for (let m = 0; m < a.parentIndex.length; ++m)
|
|
21
|
+
if (h.parentIndex.includes(a.parentIndex[m])) {
|
|
22
|
+
const y = t[a.parentIndex[m]], M = Math.atan2(a.x - y.x, a.y - y.y), T = Math.atan2(h.x - y.x, h.y - y.y);
|
|
23
|
+
let E = T - M;
|
|
24
|
+
E < 0 && (E += 2 * Math.PI);
|
|
25
|
+
const w = T - E / 2;
|
|
26
|
+
let g = W(p, {
|
|
27
|
+
x: y.x + y.radius * Math.sin(w),
|
|
28
|
+
y: y.y + y.radius * Math.cos(w)
|
|
29
|
+
});
|
|
30
|
+
g > y.radius * 2 && (g = y.radius * 2), (d == null || d.width > g) && (d = { circle: y, width: g, p1: a, p2: h, large: g > y.radius, sweep: !0 });
|
|
31
|
+
}
|
|
32
|
+
d != null && (o.push(d), i += lt(d.circle.radius, d.width), h = 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 h = !1;
|
|
39
|
+
for (let u = 0; u < t.length; ++u)
|
|
40
|
+
if (W(t[u], l) > Math.abs(l.radius - t[u].radius)) {
|
|
41
|
+
h = !0;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
h ? i = r = 0 : (i = l.radius * l.radius * Math.PI, o.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 r /= 2, n && (n.area = i + r, n.arcArea = i, n.polygonArea = r, n.arcs = o, n.innerPoints = e, n.intersectionPoints = s), i + r;
|
|
54
|
+
}
|
|
55
|
+
function ae(t, n) {
|
|
56
|
+
return n.every((s) => W(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 = Et(t[s], t[e]);
|
|
63
|
+
for (const r of i)
|
|
64
|
+
r.parentIndex = [s, e], n.push(r);
|
|
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 W(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 Et(t, n) {
|
|
83
|
+
const s = W(t, n), e = t.radius, i = n.radius;
|
|
84
|
+
if (s >= e + i || s <= Math.abs(e - i))
|
|
85
|
+
return [];
|
|
86
|
+
const r = (e * e - i * i + s * s) / (2 * s), o = Math.sqrt(e * e - r * r), l = t.x + r * (n.x - t.x) / s, h = t.y + r * (n.y - t.y) / s, u = -(n.y - t.y) * (o / s), a = -(n.x - t.x) * (o / s);
|
|
87
|
+
return [
|
|
88
|
+
{ x: l + u, y: h - a },
|
|
89
|
+
{ x: l - u, y: h + a }
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
function Tt(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, r = e.tolerance || 1e-10, o = t(n), l = t(s);
|
|
101
|
+
let h = s - n;
|
|
102
|
+
if (o * l > 0)
|
|
103
|
+
throw "Initial bisect points must have opposite signs";
|
|
104
|
+
if (o === 0) return n;
|
|
105
|
+
if (l === 0) return s;
|
|
106
|
+
for (let u = 0; u < i; ++u) {
|
|
107
|
+
h /= 2;
|
|
108
|
+
const a = n + h, p = t(a);
|
|
109
|
+
if (p * o >= 0 && (n = a), Math.abs(h) < r || p === 0)
|
|
110
|
+
return a;
|
|
111
|
+
}
|
|
112
|
+
return n + h;
|
|
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 tt(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(tt(t, t));
|
|
131
|
+
}
|
|
132
|
+
function ht(t, n, s) {
|
|
133
|
+
for (let e = 0; e < n.length; ++e)
|
|
134
|
+
t[e] = n[e] * s;
|
|
135
|
+
}
|
|
136
|
+
function Q(t, n, s, e, i) {
|
|
137
|
+
for (let r = 0; r < t.length; ++r)
|
|
138
|
+
t[r] = n * s[r] + e * i[r];
|
|
139
|
+
}
|
|
140
|
+
function zt(t, n, s) {
|
|
141
|
+
s = s || {};
|
|
142
|
+
const e = s.maxIterations || n.length * 200, i = s.nonZeroDelta || 1.05, r = s.zeroDelta || 1e-3, o = s.minErrorDelta || 1e-6, l = s.minErrorDelta || 1e-5, h = s.rho !== void 0 ? s.rho : 1, u = s.chi !== void 0 ? s.chi : 2, a = s.psi !== void 0 ? s.psi : -0.5, p = s.sigma !== void 0 ? s.sigma : 0.5;
|
|
143
|
+
let d;
|
|
144
|
+
const m = n.length, y = new Array(m + 1);
|
|
145
|
+
y[0] = n, y[0].fx = t(n), y[0].id = 0;
|
|
146
|
+
for (let v = 0; v < m; ++v) {
|
|
147
|
+
const c = n.slice();
|
|
148
|
+
c[v] = c[v] ? c[v] * i : r, y[v + 1] = c, y[v + 1].fx = t(c), y[v + 1].id = v + 1;
|
|
149
|
+
}
|
|
150
|
+
function M(v) {
|
|
151
|
+
for (let c = 0; c < v.length; c++)
|
|
152
|
+
y[m][c] = v[c];
|
|
153
|
+
y[m].fx = v.fx;
|
|
154
|
+
}
|
|
155
|
+
const T = (v, c) => v.fx - c.fx, E = n.slice(), w = n.slice(), g = n.slice(), b = n.slice();
|
|
156
|
+
for (let v = 0; v < e; ++v) {
|
|
157
|
+
if (y.sort(T), s.history) {
|
|
158
|
+
const x = y.map((f) => {
|
|
159
|
+
const O = f.slice();
|
|
160
|
+
return O.fx = f.fx, O.id = f.id, O;
|
|
161
|
+
});
|
|
162
|
+
x.sort((f, O) => f.id - O.id), s.history.push({
|
|
163
|
+
x: y[0].slice(),
|
|
164
|
+
fx: y[0].fx,
|
|
165
|
+
simplex: x
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
d = 0;
|
|
169
|
+
for (let x = 0; x < m; ++x)
|
|
170
|
+
d = Math.max(d, Math.abs(y[0][x] - y[1][x]));
|
|
171
|
+
if (Math.abs(y[0].fx - y[m].fx) < o && d < l)
|
|
172
|
+
break;
|
|
173
|
+
for (let x = 0; x < m; ++x) {
|
|
174
|
+
E[x] = 0;
|
|
175
|
+
for (let f = 0; f < m; ++f)
|
|
176
|
+
E[x] += y[f][x];
|
|
177
|
+
E[x] /= m;
|
|
178
|
+
}
|
|
179
|
+
const c = y[m];
|
|
180
|
+
if (Q(w, 1 + h, E, -h, c), w.fx = t(w), w.fx < y[0].fx)
|
|
181
|
+
Q(b, 1 + u, E, -u, c), b.fx = t(b), b.fx < w.fx ? M(b) : M(w);
|
|
182
|
+
else if (w.fx >= y[m - 1].fx) {
|
|
183
|
+
let x = !1;
|
|
184
|
+
if (w.fx > c.fx ? (Q(g, 1 + a, E, -a, c), g.fx = t(g), g.fx < c.fx ? M(g) : x = !0) : (Q(g, 1 - a * h, E, a * h, c), g.fx = t(g), g.fx < w.fx ? M(g) : x = !0), x) {
|
|
185
|
+
if (p >= 1) break;
|
|
186
|
+
for (let f = 1; f < y.length; ++f)
|
|
187
|
+
Q(y[f], 1 - p, y[0], p, y[f]), y[f].fx = t(y[f]);
|
|
188
|
+
}
|
|
189
|
+
} else
|
|
190
|
+
M(w);
|
|
191
|
+
}
|
|
192
|
+
return y.sort(T), { fx: y[0].fx, x: y[0] };
|
|
193
|
+
}
|
|
194
|
+
function ue(t, n, s, e, i, r, o) {
|
|
195
|
+
const l = s.fx, h = tt(s.fxprime, n);
|
|
196
|
+
let u = l, a = l, p = h, d = 0;
|
|
197
|
+
i = i || 1, r = r || 1e-6, o = o || 0.1;
|
|
198
|
+
function m(y, M, T) {
|
|
199
|
+
for (let E = 0; E < 16; ++E)
|
|
200
|
+
if (i = (y + M) / 2, Q(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), p = tt(e.fxprime, n), u > l + r * i * h || u >= T)
|
|
201
|
+
M = i;
|
|
202
|
+
else {
|
|
203
|
+
if (Math.abs(p) <= -o * h)
|
|
204
|
+
return i;
|
|
205
|
+
p * (M - y) >= 0 && (M = y), y = i, T = u;
|
|
206
|
+
}
|
|
207
|
+
return 0;
|
|
208
|
+
}
|
|
209
|
+
for (let y = 0; y < 10; ++y) {
|
|
210
|
+
if (Q(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), p = tt(e.fxprime, n), u > l + r * i * h || y && u >= a)
|
|
211
|
+
return m(d, i, a);
|
|
212
|
+
if (Math.abs(p) <= -o * h)
|
|
213
|
+
return i;
|
|
214
|
+
if (p >= 0)
|
|
215
|
+
return m(i, d, u);
|
|
216
|
+
a = u, d = i, i *= 2;
|
|
217
|
+
}
|
|
218
|
+
return i;
|
|
219
|
+
}
|
|
220
|
+
function he(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 r = n.slice();
|
|
223
|
+
let o, l, h = 1, u;
|
|
224
|
+
s = s || {}, u = s.maxIterations || n.length * 20, e.fx = t(e.x, e.fxprime), o = e.fxprime.slice(), ht(o, e.fxprime, -1);
|
|
225
|
+
for (let a = 0; a < u; ++a) {
|
|
226
|
+
if (h = ue(t, o, e, i, h), s.history && s.history.push({
|
|
227
|
+
x: e.x.slice(),
|
|
228
|
+
fx: e.fx,
|
|
229
|
+
fxprime: e.fxprime.slice(),
|
|
230
|
+
alpha: h
|
|
231
|
+
}), !h)
|
|
232
|
+
ht(o, e.fxprime, -1);
|
|
233
|
+
else {
|
|
234
|
+
Q(r, 1, i.fxprime, -1, e.fxprime);
|
|
235
|
+
const p = tt(e.fxprime, e.fxprime), d = Math.max(0, tt(r, i.fxprime) / p);
|
|
236
|
+
Q(o, d, o, -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: h
|
|
246
|
+
}), e;
|
|
247
|
+
}
|
|
248
|
+
function At(t, n = {}) {
|
|
249
|
+
n.maxIterations = n.maxIterations || 500;
|
|
250
|
+
const s = n.initialLayout || xe, e = n.lossFunction || et, i = fe(t, n), r = s(i, n), o = Object.keys(r), l = [];
|
|
251
|
+
for (const a of o)
|
|
252
|
+
l.push(r[a].x), l.push(r[a].y);
|
|
253
|
+
const u = zt(
|
|
254
|
+
(a) => {
|
|
255
|
+
const p = {};
|
|
256
|
+
for (let d = 0; d < o.length; ++d) {
|
|
257
|
+
const m = o[d];
|
|
258
|
+
p[m] = {
|
|
259
|
+
x: a[2 * d],
|
|
260
|
+
y: a[2 * d + 1],
|
|
261
|
+
radius: r[m].radius
|
|
262
|
+
// size : circles[setid].size
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
return e(p, i);
|
|
266
|
+
},
|
|
267
|
+
l,
|
|
268
|
+
n
|
|
269
|
+
).x;
|
|
270
|
+
for (let a = 0; a < o.length; ++a) {
|
|
271
|
+
const p = o[a];
|
|
272
|
+
r[p].x = u[2 * a], r[p].y = u[2 * a + 1];
|
|
273
|
+
}
|
|
274
|
+
return r;
|
|
275
|
+
}
|
|
276
|
+
const Rt = 1e-10;
|
|
277
|
+
function ft(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 fe(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 h of e)
|
|
288
|
+
for (let u = 0; u < h.sets.length; u++) {
|
|
289
|
+
const a = String(h.sets[u]);
|
|
290
|
+
l.set(a, h.size + (l.get(a) || 0));
|
|
291
|
+
for (let p = u + 1; p < h.sets.length; p++) {
|
|
292
|
+
const d = String(h.sets[p]), m = `${a};${d}`, y = `${d};${a}`;
|
|
293
|
+
l.set(m, h.size + (l.get(m) || 0)), l.set(y, h.size + (l.get(y) || 0));
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
for (const h of e)
|
|
297
|
+
h.sets.length < 3 && (h.size = l.get(i(h.sets)));
|
|
298
|
+
}
|
|
299
|
+
const r = [], o = /* @__PURE__ */ new Set();
|
|
300
|
+
for (const l of e)
|
|
301
|
+
if (l.sets.length === 1)
|
|
302
|
+
r.push(l.sets[0]);
|
|
303
|
+
else if (l.sets.length === 2) {
|
|
304
|
+
const h = l.sets[0], u = l.sets[1];
|
|
305
|
+
o.add(i(l.sets)), o.add(i([u, h]));
|
|
306
|
+
}
|
|
307
|
+
r.sort((l, h) => l === h ? 0 : l < h ? -1 : 1);
|
|
308
|
+
for (let l = 0; l < r.length; ++l) {
|
|
309
|
+
const h = r[l];
|
|
310
|
+
for (let u = l + 1; u < r.length; ++u) {
|
|
311
|
+
const a = r[u];
|
|
312
|
+
o.has(i([h, a])) || e.push({ sets: [h, 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((r) => r.sets.length === 2).forEach((r) => {
|
|
320
|
+
const o = s[r.sets[0]], l = s[r.sets[1]], h = Math.sqrt(n[o].size / Math.PI), u = Math.sqrt(n[l].size / Math.PI), a = ft(h, u, r.size);
|
|
321
|
+
e[o][l] = e[l][o] = a;
|
|
322
|
+
let p = 0;
|
|
323
|
+
r.size + 1e-10 >= Math.min(n[o].size, n[l].size) ? p = 1 : r.size <= 1e-10 && (p = -1), i[o][l] = i[l][o] = p;
|
|
324
|
+
}), { distances: e, constraints: i };
|
|
325
|
+
}
|
|
326
|
+
function ge(t, n, s, e) {
|
|
327
|
+
for (let r = 0; r < n.length; ++r)
|
|
328
|
+
n[r] = 0;
|
|
329
|
+
let i = 0;
|
|
330
|
+
for (let r = 0; r < s.length; ++r) {
|
|
331
|
+
const o = t[2 * r], l = t[2 * r + 1];
|
|
332
|
+
for (let h = r + 1; h < s.length; ++h) {
|
|
333
|
+
const u = t[2 * h], a = t[2 * h + 1], p = s[r][h], d = e[r][h], m = (u - o) * (u - o) + (a - l) * (a - l), y = Math.sqrt(m), M = m - p * p;
|
|
334
|
+
d > 0 && y <= p || d < 0 && y >= p || (i += 2 * M * M, n[2 * r] += 4 * M * (o - u), n[2 * r + 1] += 4 * M * (l - a), n[2 * h] += 4 * M * (u - o), n[2 * h + 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 || et;
|
|
342
|
+
if (t.length >= 8) {
|
|
343
|
+
const i = ye(t, n), r = e(i, t), o = e(s, t);
|
|
344
|
+
r + 1e-8 < o && (s = i);
|
|
345
|
+
}
|
|
346
|
+
return s;
|
|
347
|
+
}
|
|
348
|
+
function ye(t, n = {}) {
|
|
349
|
+
const s = n.restarts || 10, e = [], i = {};
|
|
350
|
+
for (const d of t)
|
|
351
|
+
d.sets.length === 1 && (i[d.sets[0]] = e.length, e.push(d));
|
|
352
|
+
let { distances: r, constraints: o } = de(t, e, i);
|
|
353
|
+
const l = ut(r.map(ut)) / r.length;
|
|
354
|
+
r = r.map((d) => d.map((m) => m / l));
|
|
355
|
+
const h = (d, m) => ge(d, m, r, o);
|
|
356
|
+
let u = null;
|
|
357
|
+
for (let d = 0; d < s; ++d) {
|
|
358
|
+
const m = ct(r.length * 2).map(Math.random), y = he(h, m, n);
|
|
359
|
+
(!u || y.fx < u.fx) && (u = y);
|
|
360
|
+
}
|
|
361
|
+
const a = u.x, p = {};
|
|
362
|
+
for (let d = 0; d < e.length; ++d) {
|
|
363
|
+
const m = e[d];
|
|
364
|
+
p[m.sets[0]] = {
|
|
365
|
+
x: a[2 * d] * l,
|
|
366
|
+
y: a[2 * d + 1] * l,
|
|
367
|
+
radius: Math.sqrt(m.size / Math.PI)
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
if (n.history)
|
|
371
|
+
for (const d of n.history)
|
|
372
|
+
ht(d.x, l);
|
|
373
|
+
return p;
|
|
374
|
+
}
|
|
375
|
+
function pe(t, n) {
|
|
376
|
+
const s = n && n.lossFunction ? n.lossFunction : et, e = {}, i = {};
|
|
377
|
+
for (const p of t)
|
|
378
|
+
if (p.sets.length === 1) {
|
|
379
|
+
const d = p.sets[0];
|
|
380
|
+
e[d] = {
|
|
381
|
+
x: 1e10,
|
|
382
|
+
y: 1e10,
|
|
383
|
+
rowid: e.length,
|
|
384
|
+
size: p.size,
|
|
385
|
+
radius: Math.sqrt(p.size / Math.PI)
|
|
386
|
+
}, i[d] = [];
|
|
387
|
+
}
|
|
388
|
+
t = t.filter((p) => p.sets.length === 2);
|
|
389
|
+
for (const p of t) {
|
|
390
|
+
let d = p.weight != null ? p.weight : 1;
|
|
391
|
+
const m = p.sets[0], y = p.sets[1];
|
|
392
|
+
p.size + Rt >= Math.min(e[m].size, e[y].size) && (d = 0), i[m].push({ set: y, size: p.size, weight: d }), i[y].push({ set: m, size: p.size, weight: d });
|
|
393
|
+
}
|
|
394
|
+
const r = [];
|
|
395
|
+
Object.keys(i).forEach((p) => {
|
|
396
|
+
let d = 0;
|
|
397
|
+
for (let m = 0; m < i[p].length; ++m)
|
|
398
|
+
d += i[p][m].size * i[p][m].weight;
|
|
399
|
+
r.push({ set: p, size: d });
|
|
400
|
+
});
|
|
401
|
+
function o(p, d) {
|
|
402
|
+
return d.size - p.size;
|
|
403
|
+
}
|
|
404
|
+
r.sort(o);
|
|
405
|
+
const l = {};
|
|
406
|
+
function h(p) {
|
|
407
|
+
return p.set in l;
|
|
408
|
+
}
|
|
409
|
+
function u(p, d) {
|
|
410
|
+
e[d].x = p.x, e[d].y = p.y, l[d] = !0;
|
|
411
|
+
}
|
|
412
|
+
u({ x: 0, y: 0 }, r[0].set);
|
|
413
|
+
for (let p = 1; p < r.length; ++p) {
|
|
414
|
+
const d = r[p].set, m = i[d].filter(h), y = e[d];
|
|
415
|
+
if (m.sort(o), m.length === 0)
|
|
416
|
+
throw "ERROR: missing pairwise overlap information";
|
|
417
|
+
const M = [];
|
|
418
|
+
for (var a = 0; a < m.length; ++a) {
|
|
419
|
+
const w = e[m[a].set], g = ft(y.radius, w.radius, m[a].size);
|
|
420
|
+
M.push({ x: w.x + g, y: w.y }), M.push({ x: w.x - g, y: w.y }), M.push({ y: w.y + g, x: w.x }), M.push({ y: w.y - g, x: w.x });
|
|
421
|
+
for (let b = a + 1; b < m.length; ++b) {
|
|
422
|
+
const v = e[m[b].set], c = ft(y.radius, v.radius, m[b].size), x = Et(
|
|
423
|
+
{ x: w.x, y: w.y, radius: g },
|
|
424
|
+
{ x: v.x, y: v.y, radius: c }
|
|
425
|
+
);
|
|
426
|
+
M.push(...x);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
let T = 1e50, E = M[0];
|
|
430
|
+
for (const w of M) {
|
|
431
|
+
e[d].x = w.x, e[d].y = w.y;
|
|
432
|
+
const g = s(e, t);
|
|
433
|
+
g < T && (T = g, E = w);
|
|
434
|
+
}
|
|
435
|
+
u(E, d);
|
|
436
|
+
}
|
|
437
|
+
return e;
|
|
438
|
+
}
|
|
439
|
+
function et(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 o = t[e.sets[0]], l = t[e.sets[1]];
|
|
447
|
+
i = xt(o.radius, l.radius, W(o, l));
|
|
448
|
+
} else
|
|
449
|
+
i = st(e.sets.map((o) => t[o]));
|
|
450
|
+
const r = e.weight != null ? e.weight : 1;
|
|
451
|
+
s += r * (i - e.size) * (i - e.size);
|
|
452
|
+
}
|
|
453
|
+
return s;
|
|
454
|
+
}
|
|
455
|
+
function Ct(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]], h = t[e.sets[1]];
|
|
463
|
+
i = xt(l.radius, h.radius, W(l, h));
|
|
464
|
+
} else
|
|
465
|
+
i = st(e.sets.map((l) => t[l]));
|
|
466
|
+
const r = e.weight != null ? e.weight : 1, o = Math.log((i + 1) / (e.size + 1));
|
|
467
|
+
s += r * o * o;
|
|
468
|
+
}
|
|
469
|
+
return s;
|
|
470
|
+
}
|
|
471
|
+
function me(t, n, s) {
|
|
472
|
+
if (s == null ? t.sort((i, r) => r.radius - i.radius) : t.sort(s), t.length > 0) {
|
|
473
|
+
const i = t[0].x, r = t[0].y;
|
|
474
|
+
for (const o of t)
|
|
475
|
+
o.x -= i, o.y -= r;
|
|
476
|
+
}
|
|
477
|
+
if (t.length === 2 && W(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, r = Math.cos(i), o = Math.sin(i);
|
|
479
|
+
for (const l of t) {
|
|
480
|
+
const h = l.x, u = l.y;
|
|
481
|
+
l.x = r * h - o * u, l.y = o * h + r * 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 r = t[1].y / (1e-10 + t[1].x);
|
|
492
|
+
for (const o of t) {
|
|
493
|
+
var e = (o.x + r * o.y) / (1 + r * r);
|
|
494
|
+
o.x = 2 * e - o.x, o.y = 2 * e * r - o.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, r) {
|
|
507
|
+
const o = n(i), l = n(r);
|
|
508
|
+
o.parent = l;
|
|
509
|
+
}
|
|
510
|
+
for (let i = 0; i < t.length; ++i)
|
|
511
|
+
for (let r = i + 1; r < t.length; ++r) {
|
|
512
|
+
const o = t[i].radius + t[r].radius;
|
|
513
|
+
W(t[i], t[r]) + 1e-10 < o && s(t[r], t[i]);
|
|
514
|
+
}
|
|
515
|
+
const e = /* @__PURE__ */ new Map();
|
|
516
|
+
for (let i = 0; i < t.length; ++i) {
|
|
517
|
+
const r = n(t[i]).parent.setid;
|
|
518
|
+
e.has(r) || e.set(r, []), e.get(r).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((r, o) => Math.max(r, o[s] + o.radius), Number.NEGATIVE_INFINITY), i = t.reduce((r, o) => Math.min(r, o[s] - o.radius), Number.POSITIVE_INFINITY);
|
|
527
|
+
return { max: e, min: i };
|
|
528
|
+
};
|
|
529
|
+
return { xRange: n("x"), yRange: n("y") };
|
|
530
|
+
}
|
|
531
|
+
function Dt(t, n, s) {
|
|
532
|
+
n == null && (n = Math.PI / 2);
|
|
533
|
+
let e = jt(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 r = e.bounds;
|
|
542
|
+
const o = (r.xRange.max - r.xRange.min) / 50;
|
|
543
|
+
function l(u, a, p) {
|
|
544
|
+
if (!u)
|
|
545
|
+
return;
|
|
546
|
+
const d = u.bounds;
|
|
547
|
+
let m, y;
|
|
548
|
+
if (a)
|
|
549
|
+
m = r.xRange.max - d.xRange.min + o;
|
|
550
|
+
else {
|
|
551
|
+
m = r.xRange.max - d.xRange.max;
|
|
552
|
+
const M = (d.xRange.max - d.xRange.min) / 2 - (r.xRange.max - r.xRange.min) / 2;
|
|
553
|
+
M < 0 && (m += M);
|
|
554
|
+
}
|
|
555
|
+
if (p)
|
|
556
|
+
y = r.yRange.max - d.yRange.min + o;
|
|
557
|
+
else {
|
|
558
|
+
y = r.yRange.max - d.yRange.max;
|
|
559
|
+
const M = (d.yRange.max - d.yRange.min) / 2 - (r.yRange.max - r.yRange.min) / 2;
|
|
560
|
+
M < 0 && (y += M);
|
|
561
|
+
}
|
|
562
|
+
for (const M of u)
|
|
563
|
+
M.x += m, M.y += y, e.push(M);
|
|
564
|
+
}
|
|
565
|
+
let h = 1;
|
|
566
|
+
for (; h < i.length; )
|
|
567
|
+
l(i[h], !0, !1), l(i[h + 1], !1, !0), l(i[h + 2], !0, !0), h += 3, r = dt(e);
|
|
568
|
+
return Ot(e);
|
|
569
|
+
}
|
|
570
|
+
function Nt(t, n, s, e, i) {
|
|
571
|
+
const r = jt(t);
|
|
572
|
+
n -= 2 * e, s -= 2 * e;
|
|
573
|
+
const { xRange: o, yRange: l } = dt(r);
|
|
574
|
+
if (o.max === o.min || l.max === l.min)
|
|
575
|
+
return console.log("not scaling solution: zero size detected"), t;
|
|
576
|
+
let h, u;
|
|
577
|
+
if (i) {
|
|
578
|
+
const m = Math.sqrt(i / Math.PI) * 2;
|
|
579
|
+
h = n / m, u = s / m;
|
|
580
|
+
} else
|
|
581
|
+
h = n / (o.max - o.min), u = s / (l.max - l.min);
|
|
582
|
+
const a = Math.min(u, h), p = (n - (o.max - o.min) * a) / 2, d = (s - (l.max - l.min) * a) / 2;
|
|
583
|
+
return Ot(
|
|
584
|
+
r.map((m) => ({
|
|
585
|
+
radius: a * m.radius,
|
|
586
|
+
x: e + p + (m.x - o.min) * a,
|
|
587
|
+
y: e + d + (m.y - l.min) * a,
|
|
588
|
+
setid: m.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 jt(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, r = 1e3, o = Math.PI / 2, l = !0, h = null, u = !0, a = !0, p = null, d = null, m = !1, y = null, M = t && t.symmetricalTextCentre ? t.symmetricalTextCentre : !1, T = {}, 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
|
+
], w = 0, g = function(x) {
|
|
614
|
+
if (x in T)
|
|
615
|
+
return T[x];
|
|
616
|
+
var f = T[x] = E[w];
|
|
617
|
+
return w += 1, w >= E.length && (w = 0), f;
|
|
618
|
+
}, b = At, v = et;
|
|
619
|
+
function c(x) {
|
|
620
|
+
let f = x.datum();
|
|
621
|
+
const O = /* @__PURE__ */ new Set();
|
|
622
|
+
f.forEach((I) => {
|
|
623
|
+
I.size == 0 && I.sets.length == 1 && O.add(I.sets[0]);
|
|
624
|
+
}), f = f.filter((I) => !I.sets.some((D) => O.has(D)));
|
|
625
|
+
let k = {}, R = {};
|
|
626
|
+
if (f.length > 0) {
|
|
627
|
+
let I = b(f, { lossFunction: v, distinct: m });
|
|
628
|
+
l && (I = Dt(I, o, d)), k = Nt(I, s, e, i, h), R = Lt(k, f, M);
|
|
629
|
+
}
|
|
630
|
+
const Z = {};
|
|
631
|
+
f.forEach((I) => {
|
|
632
|
+
I.label && (Z[I.sets] = I.label);
|
|
633
|
+
});
|
|
634
|
+
function U(I) {
|
|
635
|
+
if (I.sets in Z)
|
|
636
|
+
return Z[I.sets];
|
|
637
|
+
if (I.sets.length == 1)
|
|
638
|
+
return "" + I.sets[0];
|
|
639
|
+
}
|
|
640
|
+
x.selectAll("svg").data([k]).enter().append("svg");
|
|
641
|
+
const B = x.select("svg");
|
|
642
|
+
n ? B.attr("viewBox", `0 0 ${s} ${e}`) : B.attr("width", s).attr("height", e);
|
|
643
|
+
const V = {};
|
|
644
|
+
let z = !1;
|
|
645
|
+
B.selectAll(".venn-area path").each(function(I) {
|
|
646
|
+
const D = this.getAttribute("d");
|
|
647
|
+
I.sets.length == 1 && D && !m && (z = !0, V[I.sets[0]] = Me(D));
|
|
648
|
+
});
|
|
649
|
+
function q(I) {
|
|
650
|
+
return (D) => {
|
|
651
|
+
const G = I.sets.map((J) => {
|
|
652
|
+
let K = V[J], X = k[J];
|
|
653
|
+
return K || (K = { x: s / 2, y: e / 2, radius: 1 }), X || (X = { x: s / 2, y: e / 2, radius: 1 }), {
|
|
654
|
+
x: K.x * (1 - D) + X.x * D,
|
|
655
|
+
y: K.y * (1 - D) + X.y * D,
|
|
656
|
+
radius: K.radius * (1 - D) + X.radius * D
|
|
657
|
+
};
|
|
658
|
+
});
|
|
659
|
+
return wt(G, y);
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
const A = B.selectAll(".venn-area").data(f, (I) => I.sets), j = A.enter().append("g").attr(
|
|
663
|
+
"class",
|
|
664
|
+
(I) => `venn-area venn-${I.sets.length == 1 ? "circle" : "intersection"}${I.colour || I.color ? " venn-coloured" : ""}`
|
|
665
|
+
).attr("data-venn-sets", (I) => I.sets.join("_")), F = j.append("path"), L = j.append("text").attr("class", "label").text((I) => U(I)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", s / 2).attr("y", e / 2);
|
|
666
|
+
a && (F.style("fill-opacity", "0").filter((I) => I.sets.length == 1).style("fill", (I) => I.colour ? I.colour : I.color ? I.color : g(I.sets)).style("fill-opacity", ".25"), L.style("fill", (I) => I.colour || I.color ? "#FFF" : t.textFill ? t.textFill : I.sets.length == 1 ? g(I.sets) : "#444"));
|
|
667
|
+
function P(I) {
|
|
668
|
+
return typeof I.transition == "function" ? I.transition("venn").duration(r) : I;
|
|
669
|
+
}
|
|
670
|
+
let _ = x;
|
|
671
|
+
z && typeof _.transition == "function" ? (_ = P(x), _.selectAll("path").attrTween("d", q)) : _.selectAll("path").attr("d", (I) => wt(I.sets.map((D) => k[D])), y);
|
|
672
|
+
const C = _.selectAll("text").filter((I) => I.sets in R).text((I) => U(I)).attr("x", (I) => Math.floor(R[I.sets].x)).attr("y", (I) => Math.floor(R[I.sets].y));
|
|
673
|
+
u && (z ? "on" in C ? C.on("end", ot(k, U)) : C.each("end", ot(k, U)) : C.each(ot(k, U)));
|
|
674
|
+
const N = P(A.exit()).remove();
|
|
675
|
+
typeof A.transition == "function" && N.selectAll("path").attrTween("d", q);
|
|
676
|
+
const Y = N.selectAll("text").attr("x", s / 2).attr("y", e / 2);
|
|
677
|
+
return p !== null && (L.style("font-size", "0px"), C.style("font-size", p), Y.style("font-size", "0px")), { circles: k, textCentres: R, nodes: A, enter: j, update: _, exit: N };
|
|
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 ? (m = x, c) : m;
|
|
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 ? (p = x, c) : p;
|
|
697
|
+
}, c.round = function(x) {
|
|
698
|
+
return arguments.length ? (y = x, c) : y;
|
|
699
|
+
}, c.duration = function(x) {
|
|
700
|
+
return arguments.length ? (r = x, c) : r;
|
|
701
|
+
}, c.layoutFunction = function(x) {
|
|
702
|
+
return arguments.length ? (b = x, c) : b;
|
|
703
|
+
}, c.normalize = function(x) {
|
|
704
|
+
return arguments.length ? (l = x, c) : l;
|
|
705
|
+
}, c.scaleToFit = function(x) {
|
|
706
|
+
return arguments.length ? (h = x, c) : h;
|
|
707
|
+
}, c.styled = function(x) {
|
|
708
|
+
return arguments.length ? (a = x, c) : a;
|
|
709
|
+
}, c.orientation = function(x) {
|
|
710
|
+
return arguments.length ? (o = x, c) : o;
|
|
711
|
+
}, c.orientationOrder = function(x) {
|
|
712
|
+
return arguments.length ? (d = x, c) : d;
|
|
713
|
+
}, c.lossFunction = function(x) {
|
|
714
|
+
return arguments.length ? (v = x === "default" ? et : x === "logRatio" ? Ct : x, c) : v;
|
|
715
|
+
}, c;
|
|
716
|
+
}
|
|
717
|
+
function ot(t, n) {
|
|
718
|
+
return function(s) {
|
|
719
|
+
const e = this, i = t[s.sets[0]].radius || 50, r = n(s) || "", o = r.split(/\s+/).reverse(), h = (r.length + o.length) / 3;
|
|
720
|
+
let u = o.pop(), a = [u], p = 0;
|
|
721
|
+
const d = 1.1;
|
|
722
|
+
e.textContent = null;
|
|
723
|
+
const m = [];
|
|
724
|
+
function y(g) {
|
|
725
|
+
const b = e.ownerDocument.createElementNS(e.namespaceURI, "tspan");
|
|
726
|
+
return b.textContent = g, m.push(b), e.append(b), b;
|
|
727
|
+
}
|
|
728
|
+
let M = y(u);
|
|
729
|
+
for (; u = o.pop(), !!u; ) {
|
|
730
|
+
a.push(u);
|
|
731
|
+
const g = a.join(" ");
|
|
732
|
+
M.textContent = g, g.length > h && M.getComputedTextLength() > i && (a.pop(), M.textContent = a.join(" "), a = [u], M = y(u), p++);
|
|
733
|
+
}
|
|
734
|
+
const T = 0.35 - p * d / 2, E = e.getAttribute("x"), w = e.getAttribute("y");
|
|
735
|
+
m.forEach((g, b) => {
|
|
736
|
+
g.setAttribute("x", E), g.setAttribute("y", w), g.setAttribute("dy", `${T + b * d}em`);
|
|
737
|
+
});
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
function at(t, n, s) {
|
|
741
|
+
let e = n[0].radius - W(n[0], t);
|
|
742
|
+
for (let i = 1; i < n.length; ++i) {
|
|
743
|
+
const r = n[i].radius - W(n[i], t);
|
|
744
|
+
r <= e && (e = r);
|
|
745
|
+
}
|
|
746
|
+
for (let i = 0; i < s.length; ++i) {
|
|
747
|
+
const r = W(s[i], t) - s[i].radius;
|
|
748
|
+
r <= e && (e = r);
|
|
749
|
+
}
|
|
750
|
+
return e;
|
|
751
|
+
}
|
|
752
|
+
function Ft(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], r = at(e[0], t, n);
|
|
757
|
+
for (let a = 1; a < e.length; ++a) {
|
|
758
|
+
const p = at(e[a], t, n);
|
|
759
|
+
p >= r && (i = e[a], r = p);
|
|
760
|
+
}
|
|
761
|
+
const o = 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 : o[0], y: o[1] };
|
|
766
|
+
let h = !0;
|
|
767
|
+
for (const a of t)
|
|
768
|
+
if (W(l, a) > a.radius) {
|
|
769
|
+
h = !1;
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
for (const a of n)
|
|
773
|
+
if (W(l, a) < a.radius) {
|
|
774
|
+
h = !1;
|
|
775
|
+
break;
|
|
776
|
+
}
|
|
777
|
+
if (h)
|
|
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 ? Ft(t, []) : Tt(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], r = t[i];
|
|
790
|
+
for (let o = e + 1; o < s.length; ++o) {
|
|
791
|
+
const l = s[o], h = t[l], u = W(r, h);
|
|
792
|
+
u + h.radius <= r.radius + 1e-10 ? n[l].push(i) : u + r.radius <= h.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 r = 0; r < n.length; ++r) {
|
|
800
|
+
const o = n[r].sets, l = {}, h = {};
|
|
801
|
+
for (let d = 0; d < o.length; ++d) {
|
|
802
|
+
l[o[d]] = !0;
|
|
803
|
+
const m = i[o[d]];
|
|
804
|
+
for (let y = 0; y < m.length; ++y)
|
|
805
|
+
h[m[y]] = !0;
|
|
806
|
+
}
|
|
807
|
+
const u = [], a = [];
|
|
808
|
+
for (let d in t)
|
|
809
|
+
d in l ? u.push(t[d]) : d in h || a.push(t[d]);
|
|
810
|
+
const p = Ft(u, a, s);
|
|
811
|
+
e[o] = p, p.disjoint && n[r].size > 0 && console.log("WARNING: area " + o + " 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 ? (r) => Math.round(r * s) / s : (r) => r;
|
|
837
|
+
if (t.length == 1) {
|
|
838
|
+
const r = t[0].circle;
|
|
839
|
+
return ke(e(r.x), e(r.y), e(r.radius));
|
|
840
|
+
}
|
|
841
|
+
const i = [`
|
|
842
|
+
M`, e(t[0].p2.x), e(t[0].p2.y)];
|
|
843
|
+
for (const r of t) {
|
|
844
|
+
const o = e(r.circle.radius);
|
|
845
|
+
i.push(`
|
|
846
|
+
A`, o, o, 0, r.large ? 1 : 0, r.sweep ? 1 : 0, e(r.p1.x), e(r.p1.y));
|
|
847
|
+
}
|
|
848
|
+
return i.join(" ");
|
|
849
|
+
}
|
|
850
|
+
function wt(t, n) {
|
|
851
|
+
return Bt(Pt(t), n);
|
|
852
|
+
}
|
|
853
|
+
function we(t, n = {}) {
|
|
854
|
+
const {
|
|
855
|
+
lossFunction: s,
|
|
856
|
+
layoutFunction: e = At,
|
|
857
|
+
normalize: i = !0,
|
|
858
|
+
orientation: r = Math.PI / 2,
|
|
859
|
+
orientationOrder: o,
|
|
860
|
+
width: l = 600,
|
|
861
|
+
height: h = 350,
|
|
862
|
+
padding: u = 15,
|
|
863
|
+
scaleToFit: a = !1,
|
|
864
|
+
symmetricalTextCentre: p = !1,
|
|
865
|
+
distinct: d,
|
|
866
|
+
round: m = 2
|
|
867
|
+
} = n;
|
|
868
|
+
let y = e(t, {
|
|
869
|
+
lossFunction: s === "default" || !s ? et : s === "logRatio" ? Ct : s,
|
|
870
|
+
distinct: d
|
|
871
|
+
});
|
|
872
|
+
i && (y = Dt(y, r, o));
|
|
873
|
+
const M = Nt(y, l, h, u, a), T = Lt(M, t, p), E = new Map(
|
|
874
|
+
Object.keys(M).map((b) => [
|
|
875
|
+
b,
|
|
876
|
+
{
|
|
877
|
+
set: b,
|
|
878
|
+
x: M[b].x,
|
|
879
|
+
y: M[b].y,
|
|
880
|
+
radius: M[b].radius
|
|
881
|
+
}
|
|
882
|
+
])
|
|
883
|
+
), w = t.map((b) => {
|
|
884
|
+
const v = b.sets.map((f) => E.get(f)), c = Pt(v), x = Bt(c, m);
|
|
885
|
+
return { circles: v, arcs: c, path: x, area: b, has: new Set(b.sets) };
|
|
886
|
+
});
|
|
887
|
+
function g(b) {
|
|
888
|
+
let v = "";
|
|
889
|
+
for (const c of w)
|
|
890
|
+
c.has.size > b.length && b.every((x) => c.has.has(x)) && (v += " " + c.path);
|
|
891
|
+
return v;
|
|
892
|
+
}
|
|
893
|
+
return w.map(({ circles: b, arcs: v, path: c, area: x }) => ({
|
|
894
|
+
data: x,
|
|
895
|
+
text: T[x.sets],
|
|
896
|
+
circles: b,
|
|
897
|
+
arcs: v,
|
|
898
|
+
path: c,
|
|
899
|
+
distinctPath: c + g(x.sets)
|
|
900
|
+
}));
|
|
901
|
+
}
|
|
902
|
+
var gt = (function() {
|
|
903
|
+
var t = /* @__PURE__ */ S(function(w, g, b, v) {
|
|
904
|
+
for (b = b || {}, v = w.length; v--; b[w[v]] = g) ;
|
|
905
|
+
return b;
|
|
906
|
+
}, "o"), n = [5, 8], s = [7, 8, 11, 12, 17, 19, 22, 24], e = [1, 17], i = [1, 18], r = [7, 8, 11, 12, 14, 15, 16, 17, 19, 20, 21, 22, 24, 27], o = [1, 31], l = [1, 39], h = [7, 8, 11, 12, 17, 19, 22, 24, 27], u = [1, 57], a = [1, 56], p = [1, 58], d = [1, 59], m = [1, 60], y = [7, 8, 11, 12, 16, 17, 19, 20, 22, 24, 27, 31, 32, 33], M = {
|
|
907
|
+
trace: /* @__PURE__ */ S(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__ */ S(function(g, b, v, c, x, f, O) {
|
|
914
|
+
var k = f.length - 1;
|
|
915
|
+
switch (x) {
|
|
916
|
+
case 1:
|
|
917
|
+
return f[k - 1];
|
|
918
|
+
case 2:
|
|
919
|
+
case 3:
|
|
920
|
+
case 4:
|
|
921
|
+
this.$ = [];
|
|
922
|
+
break;
|
|
923
|
+
case 5:
|
|
924
|
+
f[k - 1].push(f[k]), this.$ = f[k - 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.$ = f[k];
|
|
938
|
+
break;
|
|
939
|
+
case 8:
|
|
940
|
+
c.setDiagramTitle(f[k].substr(6)), this.$ = f[k].substr(6);
|
|
941
|
+
break;
|
|
942
|
+
case 9:
|
|
943
|
+
c.addSubsetData([f[k]], void 0, void 0), c.setIndentMode && c.setIndentMode(!0);
|
|
944
|
+
break;
|
|
945
|
+
case 10:
|
|
946
|
+
c.addSubsetData([f[k - 1]], f[k], void 0), c.setIndentMode && c.setIndentMode(!0);
|
|
947
|
+
break;
|
|
948
|
+
case 11:
|
|
949
|
+
c.addSubsetData([f[k - 2]], void 0, parseFloat(f[k])), c.setIndentMode && c.setIndentMode(!0);
|
|
950
|
+
break;
|
|
951
|
+
case 12:
|
|
952
|
+
c.addSubsetData([f[k - 3]], f[k - 2], parseFloat(f[k])), c.setIndentMode && c.setIndentMode(!0);
|
|
953
|
+
break;
|
|
954
|
+
case 13:
|
|
955
|
+
if (f[k].length < 2)
|
|
956
|
+
throw new Error("union requires multiple identifiers");
|
|
957
|
+
c.validateUnionIdentifiers && c.validateUnionIdentifiers(f[k]), c.addSubsetData(f[k], void 0, void 0), c.setIndentMode && c.setIndentMode(!0);
|
|
958
|
+
break;
|
|
959
|
+
case 14:
|
|
960
|
+
if (f[k - 1].length < 2)
|
|
961
|
+
throw new Error("union requires multiple identifiers");
|
|
962
|
+
c.validateUnionIdentifiers && c.validateUnionIdentifiers(f[k - 1]), c.addSubsetData(f[k - 1], f[k], void 0), c.setIndentMode && c.setIndentMode(!0);
|
|
963
|
+
break;
|
|
964
|
+
case 15:
|
|
965
|
+
if (f[k - 2].length < 2)
|
|
966
|
+
throw new Error("union requires multiple identifiers");
|
|
967
|
+
c.validateUnionIdentifiers && c.validateUnionIdentifiers(f[k - 2]), c.addSubsetData(f[k - 2], void 0, parseFloat(f[k])), c.setIndentMode && c.setIndentMode(!0);
|
|
968
|
+
break;
|
|
969
|
+
case 16:
|
|
970
|
+
if (f[k - 3].length < 2)
|
|
971
|
+
throw new Error("union requires multiple identifiers");
|
|
972
|
+
c.validateUnionIdentifiers && c.validateUnionIdentifiers(f[k - 3]), c.addSubsetData(f[k - 3], f[k - 2], parseFloat(f[k])), c.setIndentMode && c.setIndentMode(!0);
|
|
973
|
+
break;
|
|
974
|
+
case 17:
|
|
975
|
+
case 18:
|
|
976
|
+
case 19:
|
|
977
|
+
c.addTextData(f[k - 1], f[k], void 0);
|
|
978
|
+
break;
|
|
979
|
+
case 20:
|
|
980
|
+
case 21:
|
|
981
|
+
c.addTextData(f[k - 2], f[k - 1], f[k]);
|
|
982
|
+
break;
|
|
983
|
+
case 23:
|
|
984
|
+
c.addStyleData(f[k - 1], f[k]);
|
|
985
|
+
break;
|
|
986
|
+
case 24:
|
|
987
|
+
case 25:
|
|
988
|
+
case 26:
|
|
989
|
+
var R = c.getCurrentSets();
|
|
990
|
+
if (!R) throw new Error("text requires set");
|
|
991
|
+
c.addTextData(R, f[k], void 0);
|
|
992
|
+
break;
|
|
993
|
+
case 27:
|
|
994
|
+
case 28:
|
|
995
|
+
var R = c.getCurrentSets();
|
|
996
|
+
if (!R) throw new Error("text requires set");
|
|
997
|
+
c.addTextData(R, f[k - 1], f[k]);
|
|
998
|
+
break;
|
|
999
|
+
case 29:
|
|
1000
|
+
case 41:
|
|
1001
|
+
this.$ = [f[k]];
|
|
1002
|
+
break;
|
|
1003
|
+
case 30:
|
|
1004
|
+
case 42:
|
|
1005
|
+
this.$ = [...f[k - 2], f[k]];
|
|
1006
|
+
break;
|
|
1007
|
+
case 31:
|
|
1008
|
+
this.$ = [f[k - 2], f[k]];
|
|
1009
|
+
break;
|
|
1010
|
+
case 33:
|
|
1011
|
+
this.$ = f[k].join(" ");
|
|
1012
|
+
break;
|
|
1013
|
+
case 34:
|
|
1014
|
+
this.$ = [f[k]];
|
|
1015
|
+
break;
|
|
1016
|
+
case 35:
|
|
1017
|
+
f[k - 1].push(f[k]), this.$ = f[k - 1];
|
|
1018
|
+
break;
|
|
1019
|
+
case 43:
|
|
1020
|
+
case 44:
|
|
1021
|
+
this.$ = f[k];
|
|
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(r, [2, 43]), t(r, [2, 44]), t(s, [2, 13], { 14: [1, 29], 15: [1, 30], 27: o }), t(r, [2, 41]), { 16: [1, 34], 20: [1, 32], 21: [1, 33], 27: o }, 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: o }, 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(h, [2, 29]), { 15: [1, 48] }, { 16: [1, 49] }, t(s, [2, 11]), { 16: [1, 50] }, t(s, [2, 15]), t(r, [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: p, 32: d, 33: m }, t(s, [2, 12]), t(s, [2, 16]), t(h, [2, 30]), t(h, [2, 31]), t(h, [2, 32]), t(h, [2, 33], { 30: 61, 16: u, 20: a, 31: p, 32: d, 33: m }), t(y, [2, 34]), t(y, [2, 36]), t(y, [2, 37]), t(y, [2, 38]), t(y, [2, 39]), t(y, [2, 40]), t(y, [2, 35])],
|
|
1026
|
+
defaultActions: { 6: [2, 1] },
|
|
1027
|
+
parseError: /* @__PURE__ */ S(function(g, b) {
|
|
1028
|
+
if (b.recoverable)
|
|
1029
|
+
this.trace(g);
|
|
1030
|
+
else {
|
|
1031
|
+
var v = new Error(g);
|
|
1032
|
+
throw v.hash = b, v;
|
|
1033
|
+
}
|
|
1034
|
+
}, "parseError"),
|
|
1035
|
+
parse: /* @__PURE__ */ S(function(g) {
|
|
1036
|
+
var b = this, v = [0], c = [], x = [null], f = [], O = this.table, k = "", R = 0, Z = 0, U = 2, B = 1, V = f.slice.call(arguments, 1), z = Object.create(this.lexer), q = { yy: {} };
|
|
1037
|
+
for (var A in this.yy)
|
|
1038
|
+
Object.prototype.hasOwnProperty.call(this.yy, A) && (q.yy[A] = this.yy[A]);
|
|
1039
|
+
z.setInput(g, q.yy), q.yy.lexer = z, q.yy.parser = this, typeof z.yylloc > "u" && (z.yylloc = {});
|
|
1040
|
+
var j = z.yylloc;
|
|
1041
|
+
f.push(j);
|
|
1042
|
+
var F = z.options && z.options.ranges;
|
|
1043
|
+
typeof q.yy.parseError == "function" ? this.parseError = q.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
|
|
1044
|
+
function L(H) {
|
|
1045
|
+
v.length = v.length - 2 * H, x.length = x.length - H, f.length = f.length - H;
|
|
1046
|
+
}
|
|
1047
|
+
S(L, "popStack");
|
|
1048
|
+
function P() {
|
|
1049
|
+
var H;
|
|
1050
|
+
return H = c.pop() || z.lex() || B, typeof H != "number" && (H instanceof Array && (c = H, H = c.pop()), H = b.symbols_[H] || H), H;
|
|
1051
|
+
}
|
|
1052
|
+
S(P, "lex");
|
|
1053
|
+
for (var _, C, N, Y, I = {}, D, G, J, K; ; ) {
|
|
1054
|
+
if (C = v[v.length - 1], this.defaultActions[C] ? N = this.defaultActions[C] : ((_ === null || typeof _ > "u") && (_ = P()), N = O[C] && O[C][_]), typeof N > "u" || !N.length || !N[0]) {
|
|
1055
|
+
var X = "";
|
|
1056
|
+
K = [];
|
|
1057
|
+
for (D in O[C])
|
|
1058
|
+
this.terminals_[D] && D > U && K.push("'" + this.terminals_[D] + "'");
|
|
1059
|
+
z.showPosition ? X = "Parse error on line " + (R + 1) + `:
|
|
1060
|
+
` + z.showPosition() + `
|
|
1061
|
+
Expecting ` + K.join(", ") + ", got '" + (this.terminals_[_] || _) + "'" : X = "Parse error on line " + (R + 1) + ": Unexpected " + (_ == B ? "end of input" : "'" + (this.terminals_[_] || _) + "'"), this.parseError(X, {
|
|
1062
|
+
text: z.match,
|
|
1063
|
+
token: this.terminals_[_] || _,
|
|
1064
|
+
line: z.yylineno,
|
|
1065
|
+
loc: j,
|
|
1066
|
+
expected: K
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
if (N[0] instanceof Array && N.length > 1)
|
|
1070
|
+
throw new Error("Parse Error: multiple actions possible at state: " + C + ", token: " + _);
|
|
1071
|
+
switch (N[0]) {
|
|
1072
|
+
case 1:
|
|
1073
|
+
v.push(_), x.push(z.yytext), f.push(z.yylloc), v.push(N[1]), _ = null, Z = z.yyleng, k = z.yytext, R = z.yylineno, j = z.yylloc;
|
|
1074
|
+
break;
|
|
1075
|
+
case 2:
|
|
1076
|
+
if (G = this.productions_[N[1]][1], I.$ = x[x.length - G], I._$ = {
|
|
1077
|
+
first_line: f[f.length - (G || 1)].first_line,
|
|
1078
|
+
last_line: f[f.length - 1].last_line,
|
|
1079
|
+
first_column: f[f.length - (G || 1)].first_column,
|
|
1080
|
+
last_column: f[f.length - 1].last_column
|
|
1081
|
+
}, F && (I._$.range = [
|
|
1082
|
+
f[f.length - (G || 1)].range[0],
|
|
1083
|
+
f[f.length - 1].range[1]
|
|
1084
|
+
]), Y = this.performAction.apply(I, [
|
|
1085
|
+
k,
|
|
1086
|
+
Z,
|
|
1087
|
+
R,
|
|
1088
|
+
q.yy,
|
|
1089
|
+
N[1],
|
|
1090
|
+
x,
|
|
1091
|
+
f
|
|
1092
|
+
].concat(V)), typeof Y < "u")
|
|
1093
|
+
return Y;
|
|
1094
|
+
G && (v = v.slice(0, -1 * G * 2), x = x.slice(0, -1 * G), f = f.slice(0, -1 * G)), v.push(this.productions_[N[1]][0]), x.push(I.$), f.push(I._$), J = O[v[v.length - 2]][v[v.length - 1]], v.push(J);
|
|
1095
|
+
break;
|
|
1096
|
+
case 3:
|
|
1097
|
+
return !0;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
return !0;
|
|
1101
|
+
}, "parse")
|
|
1102
|
+
}, T = /* @__PURE__ */ (function() {
|
|
1103
|
+
var w = {
|
|
1104
|
+
EOF: 1,
|
|
1105
|
+
parseError: /* @__PURE__ */ S(function(b, v) {
|
|
1106
|
+
if (this.yy.parser)
|
|
1107
|
+
this.yy.parser.parseError(b, v);
|
|
1108
|
+
else
|
|
1109
|
+
throw new Error(b);
|
|
1110
|
+
}, "parseError"),
|
|
1111
|
+
// resets the lexer, sets new input
|
|
1112
|
+
setInput: /* @__PURE__ */ S(function(g, b) {
|
|
1113
|
+
return this.yy = b || 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__ */ S(function() {
|
|
1122
|
+
var g = this._input[0];
|
|
1123
|
+
this.yytext += g, this.yyleng++, this.offset++, this.match += g, this.matched += g;
|
|
1124
|
+
var b = g.match(/(?:\r\n?|\n).*/g);
|
|
1125
|
+
return b ? (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__ */ S(function(g) {
|
|
1129
|
+
var b = g.length, v = g.split(/(?:\r\n?|\n)/g);
|
|
1130
|
+
this._input = g + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - b), this.offset -= b;
|
|
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 - b
|
|
1139
|
+
}, this.options.ranges && (this.yylloc.range = [x[0], x[0] + this.yyleng - b]), 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__ */ S(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__ */ S(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__ */ S(function(g) {
|
|
1160
|
+
this.unput(this.match.slice(g));
|
|
1161
|
+
}, "less"),
|
|
1162
|
+
// displays already matched input, i.e. for error messages
|
|
1163
|
+
pastInput: /* @__PURE__ */ S(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__ */ S(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__ */ S(function() {
|
|
1174
|
+
var g = this.pastInput(), b = new Array(g.length + 1).join("-");
|
|
1175
|
+
return g + this.upcomingInput() + `
|
|
1176
|
+
` + b + "^";
|
|
1177
|
+
}, "showPosition"),
|
|
1178
|
+
// test the lexed token: return FALSE when not a match, otherwise return token
|
|
1179
|
+
test_match: /* @__PURE__ */ S(function(g, b) {
|
|
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, b, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), v)
|
|
1206
|
+
return v;
|
|
1207
|
+
if (this._backtrack) {
|
|
1208
|
+
for (var f in x)
|
|
1209
|
+
this[f] = x[f];
|
|
1210
|
+
return !1;
|
|
1211
|
+
}
|
|
1212
|
+
return !1;
|
|
1213
|
+
}, "test_match"),
|
|
1214
|
+
// return next match in input
|
|
1215
|
+
next: /* @__PURE__ */ S(function() {
|
|
1216
|
+
if (this.done)
|
|
1217
|
+
return this.EOF;
|
|
1218
|
+
this._input || (this.done = !0);
|
|
1219
|
+
var g, b, v, c;
|
|
1220
|
+
this._more || (this.yytext = "", this.match = "");
|
|
1221
|
+
for (var x = this._currentRules(), f = 0; f < x.length; f++)
|
|
1222
|
+
if (v = this._input.match(this.rules[x[f]]), v && (!b || v[0].length > b[0].length)) {
|
|
1223
|
+
if (b = v, c = f, this.options.backtrack_lexer) {
|
|
1224
|
+
if (g = this.test_match(v, x[f]), g !== !1)
|
|
1225
|
+
return g;
|
|
1226
|
+
if (this._backtrack) {
|
|
1227
|
+
b = !1;
|
|
1228
|
+
continue;
|
|
1229
|
+
} else
|
|
1230
|
+
return !1;
|
|
1231
|
+
} else if (!this.options.flex)
|
|
1232
|
+
break;
|
|
1233
|
+
}
|
|
1234
|
+
return b ? (g = this.test_match(b, 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__ */ S(function() {
|
|
1243
|
+
var b = this.next();
|
|
1244
|
+
return b || this.lex();
|
|
1245
|
+
}, "lex"),
|
|
1246
|
+
// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
|
|
1247
|
+
begin: /* @__PURE__ */ S(function(b) {
|
|
1248
|
+
this.conditionStack.push(b);
|
|
1249
|
+
}, "begin"),
|
|
1250
|
+
// pop the previously active lexer condition state off the condition stack
|
|
1251
|
+
popState: /* @__PURE__ */ S(function() {
|
|
1252
|
+
var b = this.conditionStack.length - 1;
|
|
1253
|
+
return b > 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__ */ S(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__ */ S(function(b) {
|
|
1261
|
+
return b = this.conditionStack.length - 1 - Math.abs(b || 0), b >= 0 ? this.conditionStack[b] : "INITIAL";
|
|
1262
|
+
}, "topState"),
|
|
1263
|
+
// alias for begin(condition)
|
|
1264
|
+
pushState: /* @__PURE__ */ S(function(b) {
|
|
1265
|
+
this.begin(b);
|
|
1266
|
+
}, "pushState"),
|
|
1267
|
+
// return the number of states currently on the stack
|
|
1268
|
+
stateStackSize: /* @__PURE__ */ S(function() {
|
|
1269
|
+
return this.conditionStack.length;
|
|
1270
|
+
}, "stateStackSize"),
|
|
1271
|
+
options: { "case-insensitive": !0 },
|
|
1272
|
+
performAction: /* @__PURE__ */ S(function(b, 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 (b.getIndentMode && b.getIndentMode())
|
|
1282
|
+
return b.consumeIndentText = !0, this.begin("INITIAL"), 22;
|
|
1283
|
+
break;
|
|
1284
|
+
case 4:
|
|
1285
|
+
break;
|
|
1286
|
+
case 5:
|
|
1287
|
+
b.setIndentMode && b.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 (b.consumeIndentText)
|
|
1307
|
+
b.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 w;
|
|
1339
|
+
})();
|
|
1340
|
+
M.lexer = T;
|
|
1341
|
+
function E() {
|
|
1342
|
+
this.yy = {};
|
|
1343
|
+
}
|
|
1344
|
+
return S(E, "Parser"), E.prototype = M, M.Parser = E, new E();
|
|
1345
|
+
})();
|
|
1346
|
+
gt.parser = gt;
|
|
1347
|
+
var Se = gt, yt = [], pt = [], mt = [], bt = /* @__PURE__ */ new Set(), vt, It = !1, _e = /* @__PURE__ */ S((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"), Ee = /* @__PURE__ */ S(() => yt, "getSubsetData"), nt = /* @__PURE__ */ S((t) => {
|
|
1355
|
+
const n = t.trim();
|
|
1356
|
+
return n.length >= 2 && n.startsWith('"') && n.endsWith('"') ? n.slice(1, -1) : n;
|
|
1357
|
+
}, "normalizeText"), Te = /* @__PURE__ */ S((t) => t && nt(t), "normalizeStyleValue"), ze = /* @__PURE__ */ S((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__ */ S((t, n) => {
|
|
1365
|
+
const s = it(t).sort(), e = {};
|
|
1366
|
+
for (const [i, r] of n)
|
|
1367
|
+
e[i] = Te(r) ?? r;
|
|
1368
|
+
mt.push({ targets: s, styles: e });
|
|
1369
|
+
}, "addStyleData"), Re = /* @__PURE__ */ S(() => mt, "getStyleData"), it = /* @__PURE__ */ S((t) => t.map((n) => nt(n)), "normalizeIdentifierList"), Ce = /* @__PURE__ */ S((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"), De = /* @__PURE__ */ S(() => pt, "getTextData"), Ne = /* @__PURE__ */ S(() => vt, "getCurrentSets"), Oe = /* @__PURE__ */ S(() => It, "getIndentMode"), je = /* @__PURE__ */ S((t) => {
|
|
1374
|
+
It = t;
|
|
1375
|
+
}, "setIndentMode"), Fe = oe.venn;
|
|
1376
|
+
function Vt() {
|
|
1377
|
+
return re(Fe, St().venn);
|
|
1378
|
+
}
|
|
1379
|
+
S(Vt, "getConfig");
|
|
1380
|
+
var Le = /* @__PURE__ */ S(() => {
|
|
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: Wt,
|
|
1391
|
+
addSubsetData: _e,
|
|
1392
|
+
getSubsetData: Ee,
|
|
1393
|
+
addTextData: ze,
|
|
1394
|
+
addStyleData: Ae,
|
|
1395
|
+
validateUnionIdentifiers: Ce,
|
|
1396
|
+
getTextData: De,
|
|
1397
|
+
getStyleData: Re,
|
|
1398
|
+
getCurrentSets: Ne,
|
|
1399
|
+
getIndentMode: Oe,
|
|
1400
|
+
setIndentMode: je
|
|
1401
|
+
}, Be = /* @__PURE__ */ S((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 qt(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
|
+
S(qt, "buildStyleByKey");
|
|
1433
|
+
var qe = /* @__PURE__ */ S((t, n, s, e) => {
|
|
1434
|
+
var V, z, q;
|
|
1435
|
+
const i = e.db, r = (V = i.getConfig) == null ? void 0 : V.call(i), { themeVariables: o, look: l, handDrawnSeed: h } = St(), u = l === "handDrawn", a = [
|
|
1436
|
+
o.venn1,
|
|
1437
|
+
o.venn2,
|
|
1438
|
+
o.venn3,
|
|
1439
|
+
o.venn4,
|
|
1440
|
+
o.venn5,
|
|
1441
|
+
o.venn6,
|
|
1442
|
+
o.venn7,
|
|
1443
|
+
o.venn8
|
|
1444
|
+
].filter(Boolean), p = (z = i.getDiagramTitle) == null ? void 0 : z.call(i), d = i.getSubsetData(), m = i.getTextData(), y = qt(i.getStyleData()), M = Gt(d), T = (r == null ? void 0 : r.width) ?? 800, E = (r == null ? void 0 : r.height) ?? 450, g = T / 1600, b = p ? 48 * g : 0, v = o.primaryTextColor ?? o.textColor, c = Qt(n);
|
|
1445
|
+
c.attr("viewBox", `0 0 ${T} ${E}`), p && c.append("text").text(p).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", o.vennTitleTextColor || o.titleColor);
|
|
1446
|
+
const x = rt(document.createElement("div")), f = ve().width(T).height(E - b);
|
|
1447
|
+
x.datum(M).call(f);
|
|
1448
|
+
const O = u ? $t.svg(x.select("svg").node()) : void 0, k = we(M, {
|
|
1449
|
+
width: T,
|
|
1450
|
+
height: E - b,
|
|
1451
|
+
padding: (r == null ? void 0 : r.padding) ?? 15
|
|
1452
|
+
}), R = /* @__PURE__ */ new Map();
|
|
1453
|
+
for (const A of k) {
|
|
1454
|
+
const j = $([...A.data.sets].sort());
|
|
1455
|
+
R.set(j, A);
|
|
1456
|
+
}
|
|
1457
|
+
m.length > 0 && Ut(r, R, x, m, g, y);
|
|
1458
|
+
const Z = te(o.background || "#f4f4f4");
|
|
1459
|
+
x.selectAll(".venn-circle").each(function(A, j) {
|
|
1460
|
+
var G;
|
|
1461
|
+
const F = rt(this), P = $([...A.sets].sort()), _ = y.get(P), C = (_ == null ? void 0 : _.fill) || a[j % a.length] || o.primaryColor;
|
|
1462
|
+
F.classed(`venn-set-${j % 8}`, !0);
|
|
1463
|
+
const N = (_ == null ? void 0 : _["fill-opacity"]) ?? 0.1, Y = (_ == null ? void 0 : _.stroke) || C, I = (_ == null ? void 0 : _["stroke-width"]) || `${5 * g}`;
|
|
1464
|
+
if (u && O) {
|
|
1465
|
+
const J = R.get(P);
|
|
1466
|
+
if (J && J.circles.length > 0) {
|
|
1467
|
+
const K = J.circles[0], X = O.circle(K.x, K.y, K.radius * 2, {
|
|
1468
|
+
roughness: 0.7,
|
|
1469
|
+
seed: h,
|
|
1470
|
+
fill: kt(C, 0.7),
|
|
1471
|
+
fillStyle: "hachure",
|
|
1472
|
+
fillWeight: 2,
|
|
1473
|
+
hachureGap: 8,
|
|
1474
|
+
hachureAngle: -41 + j * 60,
|
|
1475
|
+
stroke: Y,
|
|
1476
|
+
strokeWidth: parseFloat(String(I))
|
|
1477
|
+
});
|
|
1478
|
+
F.select("path").remove(), (G = F.node()) == null || G.insertBefore(X, F.select("text").node());
|
|
1479
|
+
}
|
|
1480
|
+
} else
|
|
1481
|
+
F.select("path").style("fill", C).style("fill-opacity", N).style("stroke", Y).style("stroke-width", I).style("stroke-opacity", 0.95);
|
|
1482
|
+
const D = (_ == null ? void 0 : _.color) || (Z ? ee(C, 30) : ne(C, 30));
|
|
1483
|
+
F.select("text").style("font-size", `${48 * g}px`).style("fill", D);
|
|
1484
|
+
}), u && O ? x.selectAll(".venn-intersection").each(function(A) {
|
|
1485
|
+
var C;
|
|
1486
|
+
const j = rt(this), L = $([...A.sets].sort()), P = y.get(L), _ = P == null ? void 0 : P.fill;
|
|
1487
|
+
if (_) {
|
|
1488
|
+
const N = j.select("path"), Y = N.attr("d");
|
|
1489
|
+
if (Y) {
|
|
1490
|
+
const I = O.path(Y, {
|
|
1491
|
+
roughness: 0.7,
|
|
1492
|
+
seed: h,
|
|
1493
|
+
fill: kt(_, 0.3),
|
|
1494
|
+
fillStyle: "cross-hatch",
|
|
1495
|
+
fillWeight: 2,
|
|
1496
|
+
hachureGap: 6,
|
|
1497
|
+
hachureAngle: 60,
|
|
1498
|
+
stroke: "none"
|
|
1499
|
+
}), D = N.node();
|
|
1500
|
+
(C = D == null ? void 0 : D.parentNode) == null || C.insertBefore(I, D), N.remove();
|
|
1501
|
+
}
|
|
1502
|
+
} else
|
|
1503
|
+
j.select("path").style("fill-opacity", 0);
|
|
1504
|
+
j.select("text").style("font-size", `${48 * g}px`).style("fill", (P == null ? void 0 : P.color) ?? o.vennSetTextColor ?? v);
|
|
1505
|
+
}) : (x.selectAll(".venn-intersection text").style("font-size", `${48 * g}px`).style("fill", (A) => {
|
|
1506
|
+
var L;
|
|
1507
|
+
const F = $([...A.sets].sort());
|
|
1508
|
+
return ((L = y.get(F)) == null ? void 0 : L.color) ?? o.vennSetTextColor ?? v;
|
|
1509
|
+
}), x.selectAll(".venn-intersection path").style("fill-opacity", (A) => {
|
|
1510
|
+
var L;
|
|
1511
|
+
const F = $([...A.sets].sort());
|
|
1512
|
+
return (L = y.get(F)) != null && L.fill ? 1 : 0;
|
|
1513
|
+
}).style("fill", (A) => {
|
|
1514
|
+
var L;
|
|
1515
|
+
const F = $([...A.sets].sort());
|
|
1516
|
+
return ((L = y.get(F)) == null ? void 0 : L.fill) ?? "transparent";
|
|
1517
|
+
}));
|
|
1518
|
+
const U = c.append("g").attr("transform", `translate(0, ${b})`), B = x.select("svg").node();
|
|
1519
|
+
if (B && "childNodes" in B)
|
|
1520
|
+
for (const A of [...B.childNodes])
|
|
1521
|
+
(q = U.node()) == null || q.appendChild(A);
|
|
1522
|
+
se(c, E, T, (r == null ? void 0 : r.useMaxWidth) ?? !0);
|
|
1523
|
+
}, "draw");
|
|
1524
|
+
function $(t) {
|
|
1525
|
+
return t.join("|");
|
|
1526
|
+
}
|
|
1527
|
+
S($, "stableSetsKey");
|
|
1528
|
+
function Ut(t, n, s, e, i, r) {
|
|
1529
|
+
var a;
|
|
1530
|
+
const o = (t == null ? void 0 : t.useDebugLayout) ?? !1, h = s.select("svg").append("g").attr("class", "venn-text-nodes"), u = /* @__PURE__ */ new Map();
|
|
1531
|
+
for (const p of e) {
|
|
1532
|
+
const d = $(p.sets), m = u.get(d);
|
|
1533
|
+
m ? m.push(p) : u.set(d, [p]);
|
|
1534
|
+
}
|
|
1535
|
+
for (const [p, d] of u.entries()) {
|
|
1536
|
+
const m = n.get(p);
|
|
1537
|
+
if (!(m != null && m.text))
|
|
1538
|
+
continue;
|
|
1539
|
+
const y = m.text.x, M = m.text.y, T = Math.min(...m.circles.map((V) => V.radius)), E = Math.min(
|
|
1540
|
+
...m.circles.map((V) => V.radius - Math.hypot(y - V.x, M - V.y))
|
|
1541
|
+
);
|
|
1542
|
+
let w = Number.isFinite(E) ? Math.max(0, E) : 0;
|
|
1543
|
+
w === 0 && Number.isFinite(T) && (w = T * 0.6);
|
|
1544
|
+
const g = h.append("g").attr("class", "venn-text-area").attr("font-size", `${40 * i}px`);
|
|
1545
|
+
o && g.append("circle").attr("class", "venn-text-debug-circle").attr("cx", y).attr("cy", M).attr("r", w).attr("fill", "none").attr("stroke", "purple").attr("stroke-width", 1.5 * i).attr("stroke-dasharray", `${6 * i} ${4 * i}`);
|
|
1546
|
+
const b = Math.max(80 * i, w * 2 * 0.95), v = Math.max(60 * i, w * 2 * 0.95), f = (m.data.label && m.data.label.length > 0 ? Math.min(32 * i, w * 0.25) : 0) + (d.length <= 2 ? 30 * i : 0), O = y - b / 2, k = M - v / 2 + f, R = Math.max(1, Math.ceil(Math.sqrt(d.length))), Z = Math.max(1, Math.ceil(d.length / R)), U = b / R, B = v / Z;
|
|
1547
|
+
for (const [V, z] of d.entries()) {
|
|
1548
|
+
const q = V % R, A = Math.floor(V / R), j = O + U * (q + 0.5), F = k + B * (A + 0.5);
|
|
1549
|
+
o && g.append("rect").attr("class", "venn-text-debug-cell").attr("x", O + U * q).attr("y", k + B * A).attr("width", U).attr("height", B).attr("fill", "none").attr("stroke", "teal").attr("stroke-width", 1 * i).attr("stroke-dasharray", `${4 * i} ${3 * i}`);
|
|
1550
|
+
const L = U * 0.9, P = B * 0.9, _ = g.append("foreignObject").attr("class", "venn-text-node-fo").attr("width", L).attr("height", P).attr("x", j - L / 2).attr("y", F - P / 2).attr("overflow", "visible"), C = (a = r.get(z.id)) == null ? void 0 : a.color, N = _.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(z.label ?? z.id);
|
|
1551
|
+
C && N.style("color", C);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
S(Ut, "renderTextNodes");
|
|
1556
|
+
function Gt(t) {
|
|
1557
|
+
const n = new Set(t.map((i) => [...i.sets].sort().join("|"))), s = new Map(
|
|
1558
|
+
t.filter((i) => i.sets.length === 1 && i.size !== void 0).map((i) => [i.sets[0], i.size])
|
|
1559
|
+
), e = [];
|
|
1560
|
+
for (const i of t) {
|
|
1561
|
+
if (i.sets.length < 3)
|
|
1562
|
+
continue;
|
|
1563
|
+
const r = [...i.sets].sort();
|
|
1564
|
+
for (let o = 0; o < r.length - 1; o++)
|
|
1565
|
+
for (let l = o + 1; l < r.length; l++) {
|
|
1566
|
+
const h = [r[o], r[l]], u = h.join("|");
|
|
1567
|
+
if (!n.has(u)) {
|
|
1568
|
+
n.add(u);
|
|
1569
|
+
const a = s.get(h[0]), p = s.get(h[1]), d = a !== void 0 && p !== void 0 ? Math.min(a, p) / 4 : 2.5;
|
|
1570
|
+
e.push({ sets: h, size: d, label: "" });
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
return e.length > 0 ? [...t, ...e] : t;
|
|
1575
|
+
}
|
|
1576
|
+
S(Gt, "ensurePairwiseSubsets");
|
|
1577
|
+
var Ue = { draw: qe }, Ke = {
|
|
1578
|
+
parser: Se,
|
|
1579
|
+
db: Pe,
|
|
1580
|
+
renderer: Ue,
|
|
1581
|
+
styles: Ve
|
|
1582
|
+
};
|
|
1583
|
+
export {
|
|
1584
|
+
Ke as diagram
|
|
1585
|
+
};
|