@prefecthq/prefab-ui-docs 0.16.3 → 0.18.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.
Files changed (66) hide show
  1. package/dist/_renderer/_basePickBy-fiErwOTY.mjs +151 -0
  2. package/dist/_renderer/_baseUniq-Iy7gOYgw.mjs +614 -0
  3. package/dist/_renderer/arc-BYm2F1-h.mjs +83 -0
  4. package/dist/_renderer/architectureDiagram-2XIMDMQ5-BKR0-ZSX.mjs +4683 -0
  5. package/dist/_renderer/band-TE_TbDmh.mjs +56 -0
  6. package/dist/_renderer/blockDiagram-WCTKOSBZ-BruGG_9M.mjs +2298 -0
  7. package/dist/_renderer/c4Diagram-IC4MRINW-K4nxeBNU.mjs +1581 -0
  8. package/dist/_renderer/channel-D4_UYSAN.mjs +5 -0
  9. package/dist/_renderer/charts-CPJdqwrq.mjs +19182 -0
  10. package/dist/_renderer/chunk-4BX2VUAB-mqLb5fm9.mjs +9 -0
  11. package/dist/_renderer/chunk-55IACEB6-Bxgi9T70.mjs +8 -0
  12. package/dist/_renderer/chunk-FMBD7UC4-Dsah75wQ.mjs +19 -0
  13. package/dist/_renderer/chunk-JSJVCQXG-Bsg6dsjU.mjs +68 -0
  14. package/dist/_renderer/chunk-KX2RTZJC-DvDXsxvC.mjs +20 -0
  15. package/dist/_renderer/chunk-NQ4KR5QH-CwFlbBfF.mjs +1384 -0
  16. package/dist/_renderer/chunk-QZHKN3VN-CYPyScRI.mjs +15 -0
  17. package/dist/_renderer/chunk-WL4C6EOR-2eYOPJVd.mjs +1430 -0
  18. package/dist/_renderer/classDiagram-VBA2DB6C-Dj8h8-wl.mjs +16 -0
  19. package/dist/_renderer/classDiagram-v2-RAHNMMFH-Dj8h8-wl.mjs +16 -0
  20. package/dist/_renderer/clone-BmajYOc3.mjs +8 -0
  21. package/dist/_renderer/{compound-calendar-Cn18AoRs.mjs → compound-calendar-8CggRUlt.mjs} +3 -3
  22. package/dist/_renderer/{content-e43PvxaF.mjs → content-BPYMcbeG.mjs} +6 -6
  23. package/dist/_renderer/cose-bilkent-S5V4N54A-BLhD0lt7.mjs +2609 -0
  24. package/dist/_renderer/cytoscape.esm-CjI2IsL8.mjs +18735 -0
  25. package/dist/_renderer/dagre-KLK3FWXG-DCIde85z.mjs +447 -0
  26. package/dist/_renderer/defaultLocale-BgPVtth8.mjs +171 -0
  27. package/dist/_renderer/diagram-E7M64L7V-BbWs-jbo.mjs +533 -0
  28. package/dist/_renderer/diagram-IFDJBPK2-Sfx8kanl.mjs +221 -0
  29. package/dist/_renderer/diagram-P4PSJMXO-DCqYaW3Z.mjs +143 -0
  30. package/dist/_renderer/{embed-DRE2wKZJ.mjs → embed-hOWEFnqe.mjs} +4474 -4439
  31. package/dist/_renderer/embed.mjs +1 -1
  32. package/dist/_renderer/erDiagram-INFDFZHY-D8cdLSCi.mjs +863 -0
  33. package/dist/_renderer/flowDiagram-PKNHOUZH-B_rW2Xww.mjs +1647 -0
  34. package/dist/_renderer/ganttDiagram-A5KZAMGK-Be_Svnat.mjs +1964 -0
  35. package/dist/_renderer/gitGraphDiagram-K3NZZRJ6--wMgYsSv.mjs +709 -0
  36. package/dist/_renderer/graph-alLjIojU.mjs +604 -0
  37. package/dist/_renderer/{icons-CImNZgDa.mjs → icons-w8tvN_30.mjs} +155 -135
  38. package/dist/_renderer/infoDiagram-LFFYTUFH-QW1PzgNF.mjs +24 -0
  39. package/dist/_renderer/init-DxzjmxYy.mjs +32 -0
  40. package/dist/_renderer/ishikawaDiagram-PHBUUO56-xY8fsGh3.mjs +621 -0
  41. package/dist/_renderer/journeyDiagram-4ABVD52K-7XeHSH9G.mjs +834 -0
  42. package/dist/_renderer/kanban-definition-K7BYSVSG-Cn7INDI0.mjs +723 -0
  43. package/dist/_renderer/katex-AQJr8RMF.mjs +11623 -0
  44. package/dist/_renderer/layout-Bspk8k85.mjs +1335 -0
  45. package/dist/_renderer/linear-CVnzSbdA.mjs +275 -0
  46. package/dist/_renderer/mermaid-C_GnErbP.mjs +48 -0
  47. package/dist/_renderer/mermaid.core-BzbdT8_O.mjs +13838 -0
  48. package/dist/_renderer/mindmap-definition-YRQLILUH-CVIMKVZI.mjs +788 -0
  49. package/dist/_renderer/ordinal-Bq0KrZxK.mjs +62 -0
  50. package/dist/_renderer/pieDiagram-SKSYHLDU-CL_luPJM.mjs +162 -0
  51. package/dist/_renderer/{svg-BL0kMZ_p.mjs → purify.es-M2Bspgo5.mjs} +222 -240
  52. package/dist/_renderer/quadrantDiagram-337W2JSQ-BQWFWFNU.mjs +1024 -0
  53. package/dist/_renderer/requirementDiagram-Z7DCOOCP-Di29RxJ6.mjs +862 -0
  54. package/dist/_renderer/sankeyDiagram-WA2Y5GQK-DY4kgDbR.mjs +810 -0
  55. package/dist/_renderer/sequenceDiagram-2WXFIKYE-vjbD37pn.mjs +2823 -0
  56. package/dist/_renderer/stateDiagram-RAJIS63D-BQ9BAuO6.mjs +264 -0
  57. package/dist/_renderer/stateDiagram-v2-FVOUBMTO-Bs26kEor.mjs +16 -0
  58. package/dist/_renderer/string-kGvNrjOo.mjs +934 -0
  59. package/dist/_renderer/svg-BTtf8EdH.mjs +22 -0
  60. package/dist/_renderer/time-sQ_UKgU4.mjs +765 -0
  61. package/dist/_renderer/timeline-definition-YZTLITO2-CJfaRgME.mjs +799 -0
  62. package/dist/_renderer/treemap-KZPCXAKY-DQq6TCTm.mjs +17996 -0
  63. package/dist/_renderer/vennDiagram-LZ73GAT5-BkBksHrj.mjs +1564 -0
  64. package/dist/_renderer/xychartDiagram-JWTSCODW-Boo1R-nF.mjs +1299 -0
  65. package/package.json +1 -1
  66. package/dist/_renderer/charts-Dr57vKmb.mjs +0 -21311
@@ -0,0 +1,1564 @@
1
+ import { aq as Wt, s as Gt, g as Kt, q as Ht, p as Yt, a as Xt, b as Zt, _ as S, F as St, H as Jt, d as rt, ab as Qt, U as $t, V as te, W as ee, e as ne, y as se, D as ie, E as re } from "./mermaid.core-BzbdT8_O.mjs";
2
+ const kt = (t, n) => Wt(t, "a", -n), _t = 1e-10;
3
+ function st(t, n) {
4
+ const s = ae(t), e = s.filter((c) => oe(c, t));
5
+ let i = 0, r = 0;
6
+ const o = [];
7
+ if (e.length > 1) {
8
+ const c = Tt(e);
9
+ for (let u = 0; u < e.length; ++u) {
10
+ const a = e[u];
11
+ a.angle = Math.atan2(a.x - c.x, a.y - c.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
+ r += (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 d = null;
20
+ for (let m = 0; m < a.parentIndex.length; ++m)
21
+ if (f.parentIndex.includes(a.parentIndex[m])) {
22
+ const x = t[a.parentIndex[m]], M = Math.atan2(a.x - x.x, a.y - x.y), T = Math.atan2(f.x - x.x, f.y - x.y);
23
+ let _ = T - M;
24
+ _ < 0 && (_ += 2 * Math.PI);
25
+ const w = T - _ / 2;
26
+ let g = G(y, {
27
+ x: x.x + x.radius * Math.sin(w),
28
+ y: x.y + x.radius * Math.cos(w)
29
+ });
30
+ g > x.radius * 2 && (g = x.radius * 2), (d == null || d.width > g) && (d = { circle: x, width: g, p1: a, p2: f, large: g > x.radius, sweep: !0 });
31
+ }
32
+ d != null && (o.push(d), i += lt(d.circle.radius, d.width), f = a);
33
+ }
34
+ } else {
35
+ let c = t[0];
36
+ for (let u = 1; u < t.length; ++u)
37
+ t[u].radius < c.radius && (c = t[u]);
38
+ let f = !1;
39
+ for (let u = 0; u < t.length; ++u)
40
+ if (G(t[u], c) > Math.abs(c.radius - t[u].radius)) {
41
+ f = !0;
42
+ break;
43
+ }
44
+ f ? i = r = 0 : (i = c.radius * c.radius * Math.PI, o.push({
45
+ circle: c,
46
+ p1: { x: c.x, y: c.y + c.radius },
47
+ p2: { x: c.x - _t, y: c.y + c.radius },
48
+ width: c.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 oe(t, n) {
56
+ return n.every((s) => G(t, s) < s.radius + _t);
57
+ }
58
+ function ae(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 G(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 = G(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), c = t.x + r * (n.x - t.x) / s, f = 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: c + u, y: f - a },
89
+ { x: c - u, y: f + 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 le(t, n, s, e) {
99
+ e = e || {};
100
+ const i = e.maxIterations || 100, r = e.tolerance || 1e-10, o = t(n), c = t(s);
101
+ let f = s - n;
102
+ if (o * c > 0)
103
+ throw "Initial bisect points must have opposite signs";
104
+ if (o === 0) return n;
105
+ if (c === 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 * o >= 0 && (n = a), Math.abs(f) < r || 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 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, c = 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 d;
144
+ const m = n.length, x = new Array(m + 1);
145
+ x[0] = n, x[0].fx = t(n), x[0].id = 0;
146
+ for (let v = 0; v < m; ++v) {
147
+ const l = n.slice();
148
+ l[v] = l[v] ? l[v] * i : r, x[v + 1] = l, x[v + 1].fx = t(l), x[v + 1].id = v + 1;
149
+ }
150
+ function M(v) {
151
+ for (let l = 0; l < v.length; l++)
152
+ x[m][l] = v[l];
153
+ x[m].fx = v.fx;
154
+ }
155
+ const T = (v, l) => v.fx - l.fx, _ = n.slice(), w = n.slice(), g = n.slice(), b = n.slice();
156
+ for (let v = 0; v < e; ++v) {
157
+ if (x.sort(T), s.history) {
158
+ const p = x.map((h) => {
159
+ const j = h.slice();
160
+ return j.fx = h.fx, j.id = h.id, j;
161
+ });
162
+ p.sort((h, j) => h.id - j.id), s.history.push({
163
+ x: x[0].slice(),
164
+ fx: x[0].fx,
165
+ simplex: p
166
+ });
167
+ }
168
+ d = 0;
169
+ for (let p = 0; p < m; ++p)
170
+ d = Math.max(d, Math.abs(x[0][p] - x[1][p]));
171
+ if (Math.abs(x[0].fx - x[m].fx) < o && d < c)
172
+ break;
173
+ for (let p = 0; p < m; ++p) {
174
+ _[p] = 0;
175
+ for (let h = 0; h < m; ++h)
176
+ _[p] += x[h][p];
177
+ _[p] /= m;
178
+ }
179
+ const l = x[m];
180
+ if (Q(w, 1 + f, _, -f, l), w.fx = t(w), w.fx < x[0].fx)
181
+ Q(b, 1 + u, _, -u, l), b.fx = t(b), b.fx < w.fx ? M(b) : M(w);
182
+ else if (w.fx >= x[m - 1].fx) {
183
+ let p = !1;
184
+ if (w.fx > l.fx ? (Q(g, 1 + a, _, -a, l), g.fx = t(g), g.fx < l.fx ? M(g) : p = !0) : (Q(g, 1 - a * f, _, a * f, l), g.fx = t(g), g.fx < w.fx ? M(g) : p = !0), p) {
185
+ if (y >= 1) break;
186
+ for (let h = 1; h < x.length; ++h)
187
+ Q(x[h], 1 - y, x[0], y, x[h]), x[h].fx = t(x[h]);
188
+ }
189
+ } else
190
+ M(w);
191
+ }
192
+ return x.sort(T), { fx: x[0].fx, x: x[0] };
193
+ }
194
+ function ce(t, n, s, e, i, r, o) {
195
+ const c = s.fx, f = tt(s.fxprime, n);
196
+ let u = c, a = c, y = f, d = 0;
197
+ i = i || 1, r = r || 1e-6, o = o || 0.1;
198
+ function m(x, M, T) {
199
+ for (let _ = 0; _ < 16; ++_)
200
+ if (i = (x + M) / 2, Q(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = tt(e.fxprime, n), u > c + r * i * f || u >= T)
201
+ M = i;
202
+ else {
203
+ if (Math.abs(y) <= -o * f)
204
+ return i;
205
+ y * (M - x) >= 0 && (M = x), x = i, T = u;
206
+ }
207
+ return 0;
208
+ }
209
+ for (let x = 0; x < 10; ++x) {
210
+ if (Q(e.x, 1, s.x, i, n), u = e.fx = t(e.x, e.fxprime), y = tt(e.fxprime, n), u > c + r * i * f || x && u >= a)
211
+ return m(d, i, a);
212
+ if (Math.abs(y) <= -o * f)
213
+ return i;
214
+ if (y >= 0)
215
+ return m(i, d, u);
216
+ a = u, d = i, i *= 2;
217
+ }
218
+ return i;
219
+ }
220
+ function ue(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, c, f = 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 (f = ce(t, o, 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
+ ht(o, e.fxprime, -1);
233
+ else {
234
+ Q(r, 1, i.fxprime, -1, e.fxprime);
235
+ const y = tt(e.fxprime, e.fxprime), d = Math.max(0, tt(r, i.fxprime) / y);
236
+ Q(o, d, o, -1, i.fxprime), c = e, e = i, i = c;
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 || ge, e = n.lossFunction || et, i = he(t, n), r = s(i, n), o = Object.keys(r), c = [];
251
+ for (const a of o)
252
+ c.push(r[a].x), c.push(r[a].y);
253
+ const u = zt(
254
+ (a) => {
255
+ const y = {};
256
+ for (let d = 0; d < o.length; ++d) {
257
+ const m = o[d];
258
+ y[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(y, i);
266
+ },
267
+ c,
268
+ n
269
+ ).x;
270
+ for (let a = 0; a < o.length; ++a) {
271
+ const y = o[a];
272
+ r[y].x = u[2 * a], r[y].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) : le((e) => xt(t, n, e) - s, 0, t + n);
279
+ }
280
+ function he(t, n = {}) {
281
+ const s = n.distinct, e = t.map((c) => Object.assign({}, c));
282
+ function i(c) {
283
+ return c.join(";");
284
+ }
285
+ if (s) {
286
+ const c = /* @__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
+ c.set(a, f.size + (c.get(a) || 0));
291
+ for (let y = u + 1; y < f.sets.length; y++) {
292
+ const d = String(f.sets[y]), m = `${a};${d}`, x = `${d};${a}`;
293
+ c.set(m, f.size + (c.get(m) || 0)), c.set(x, f.size + (c.get(x) || 0));
294
+ }
295
+ }
296
+ for (const f of e)
297
+ f.sets.length < 3 && (f.size = c.get(i(f.sets)));
298
+ }
299
+ const r = [], o = /* @__PURE__ */ new Set();
300
+ for (const c of e)
301
+ if (c.sets.length === 1)
302
+ r.push(c.sets[0]);
303
+ else if (c.sets.length === 2) {
304
+ const f = c.sets[0], u = c.sets[1];
305
+ o.add(i(c.sets)), o.add(i([u, f]));
306
+ }
307
+ r.sort((c, f) => c === f ? 0 : c < f ? -1 : 1);
308
+ for (let c = 0; c < r.length; ++c) {
309
+ const f = r[c];
310
+ for (let u = c + 1; u < r.length; ++u) {
311
+ const a = r[u];
312
+ o.has(i([f, a])) || e.push({ sets: [f, a], size: 0 });
313
+ }
314
+ }
315
+ return e;
316
+ }
317
+ function fe(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]], c = s[r.sets[1]], f = Math.sqrt(n[o].size / Math.PI), u = Math.sqrt(n[c].size / Math.PI), a = ft(f, u, r.size);
321
+ e[o][c] = e[c][o] = a;
322
+ let y = 0;
323
+ r.size + 1e-10 >= Math.min(n[o].size, n[c].size) ? y = 1 : r.size <= 1e-10 && (y = -1), i[o][c] = i[c][o] = y;
324
+ }), { distances: e, constraints: i };
325
+ }
326
+ function de(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], c = t[2 * r + 1];
332
+ for (let f = r + 1; f < s.length; ++f) {
333
+ const u = t[2 * f], a = t[2 * f + 1], y = s[r][f], d = e[r][f], m = (u - o) * (u - o) + (a - c) * (a - c), x = Math.sqrt(m), M = m - y * y;
334
+ d > 0 && x <= y || d < 0 && x >= y || (i += 2 * M * M, n[2 * r] += 4 * M * (o - u), n[2 * r + 1] += 4 * M * (c - a), n[2 * f] += 4 * M * (u - o), n[2 * f + 1] += 4 * M * (a - c));
335
+ }
336
+ }
337
+ return i;
338
+ }
339
+ function ge(t, n = {}) {
340
+ let s = ye(t, n);
341
+ const e = n.lossFunction || et;
342
+ if (t.length >= 8) {
343
+ const i = xe(t, n), r = e(i, t), o = e(s, t);
344
+ r + 1e-8 < o && (s = i);
345
+ }
346
+ return s;
347
+ }
348
+ function xe(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 } = fe(t, e, i);
353
+ const c = ut(r.map(ut)) / r.length;
354
+ r = r.map((d) => d.map((m) => m / c));
355
+ const f = (d, m) => de(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), x = ue(f, m, n);
359
+ (!u || x.fx < u.fx) && (u = x);
360
+ }
361
+ const a = u.x, y = {};
362
+ for (let d = 0; d < e.length; ++d) {
363
+ const m = e[d];
364
+ y[m.sets[0]] = {
365
+ x: a[2 * d] * c,
366
+ y: a[2 * d + 1] * c,
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, c);
373
+ return y;
374
+ }
375
+ function ye(t, n) {
376
+ const s = n && n.lossFunction ? n.lossFunction : et, e = {}, i = {};
377
+ for (const y of t)
378
+ if (y.sets.length === 1) {
379
+ const d = y.sets[0];
380
+ e[d] = {
381
+ x: 1e10,
382
+ y: 1e10,
383
+ rowid: e.length,
384
+ size: y.size,
385
+ radius: Math.sqrt(y.size / Math.PI)
386
+ }, i[d] = [];
387
+ }
388
+ t = t.filter((y) => y.sets.length === 2);
389
+ for (const y of t) {
390
+ let d = y.weight != null ? y.weight : 1;
391
+ const m = y.sets[0], x = y.sets[1];
392
+ y.size + Rt >= Math.min(e[m].size, e[x].size) && (d = 0), i[m].push({ set: x, size: y.size, weight: d }), i[x].push({ set: m, size: y.size, weight: d });
393
+ }
394
+ const r = [];
395
+ Object.keys(i).forEach((y) => {
396
+ let d = 0;
397
+ for (let m = 0; m < i[y].length; ++m)
398
+ d += i[y][m].size * i[y][m].weight;
399
+ r.push({ set: y, size: d });
400
+ });
401
+ function o(y, d) {
402
+ return d.size - y.size;
403
+ }
404
+ r.sort(o);
405
+ const c = {};
406
+ function f(y) {
407
+ return y.set in c;
408
+ }
409
+ function u(y, d) {
410
+ e[d].x = y.x, e[d].y = y.y, c[d] = !0;
411
+ }
412
+ u({ x: 0, y: 0 }, r[0].set);
413
+ for (let y = 1; y < r.length; ++y) {
414
+ const d = r[y].set, m = i[d].filter(f), x = 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(x.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], l = ft(x.radius, v.radius, m[b].size), p = Et(
423
+ { x: w.x, y: w.y, radius: g },
424
+ { x: v.x, y: v.y, radius: l }
425
+ );
426
+ M.push(...p);
427
+ }
428
+ }
429
+ let T = 1e50, _ = 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, _ = w);
434
+ }
435
+ u(_, 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]], c = t[e.sets[1]];
447
+ i = xt(o.radius, c.radius, G(o, c));
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 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 c = t[e.sets[0]], f = t[e.sets[1]];
463
+ i = xt(c.radius, f.radius, G(c, f));
464
+ } else
465
+ i = st(e.sets.map((c) => t[c]));
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 pe(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 && G(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 c of t) {
480
+ const f = c.x, u = c.y;
481
+ c.x = r * f - o * u, c.y = o * f + 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 me(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), c = n(r);
508
+ o.parent = c;
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
+ G(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 Ct(t, n, s) {
532
+ n == null && (n = Math.PI / 2);
533
+ let e = Ft(t).map((u) => Object.assign({}, u));
534
+ const i = me(e);
535
+ for (const u of i) {
536
+ pe(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 c(u, a, y) {
544
+ if (!u)
545
+ return;
546
+ const d = u.bounds;
547
+ let m, x;
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 (y)
556
+ x = r.yRange.max - d.yRange.min + o;
557
+ else {
558
+ x = 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 && (x += M);
561
+ }
562
+ for (const M of u)
563
+ M.x += m, M.y += x, e.push(M);
564
+ }
565
+ let f = 1;
566
+ for (; f < i.length; )
567
+ c(i[f], !0, !1), c(i[f + 1], !1, !0), c(i[f + 2], !0, !0), f += 3, r = dt(e);
568
+ return Ot(e);
569
+ }
570
+ function Nt(t, n, s, e, i) {
571
+ const r = Ft(t);
572
+ n -= 2 * e, s -= 2 * e;
573
+ const { xRange: o, yRange: c } = dt(r);
574
+ if (o.max === o.min || c.max === c.min)
575
+ return console.log("not scaling solution: zero size detected"), t;
576
+ let f, u;
577
+ if (i) {
578
+ const m = Math.sqrt(i / Math.PI) * 2;
579
+ f = n / m, u = s / m;
580
+ } else
581
+ f = n / (o.max - o.min), u = s / (c.max - c.min);
582
+ const a = Math.min(u, f), y = (n - (o.max - o.min) * a) / 2, d = (s - (c.max - c.min) * a) / 2;
583
+ return Ot(
584
+ r.map((m) => ({
585
+ radius: a * m.radius,
586
+ x: e + y + (m.x - o.min) * a,
587
+ y: e + d + (m.y - c.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 Ft(t) {
599
+ return Object.keys(t).map((s) => Object.assign(t[s], { setid: s }));
600
+ }
601
+ function be(t = {}) {
602
+ let n = !1, s = 600, e = 350, i = 15, r = 1e3, o = Math.PI / 2, c = !0, f = null, u = !0, a = !0, y = null, d = null, m = !1, x = null, M = t && t.symmetricalTextCentre ? t.symmetricalTextCentre : !1, T = {}, _ = 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(p) {
614
+ if (p in T)
615
+ return T[p];
616
+ var h = T[p] = _[w];
617
+ return w += 1, w >= _.length && (w = 0), h;
618
+ }, b = At, v = et;
619
+ function l(p) {
620
+ let h = p.datum();
621
+ const j = /* @__PURE__ */ new Set();
622
+ h.forEach((I) => {
623
+ I.size == 0 && I.sets.length == 1 && j.add(I.sets[0]);
624
+ }), h = h.filter((I) => !I.sets.some((L) => j.has(L)));
625
+ let k = {}, N = {};
626
+ if (h.length > 0) {
627
+ let I = b(h, { lossFunction: v, distinct: m });
628
+ c && (I = Ct(I, o, d)), k = Nt(I, s, e, i, f), N = jt(k, h, M);
629
+ }
630
+ const Y = {};
631
+ h.forEach((I) => {
632
+ I.label && (Y[I.sets] = I.label);
633
+ });
634
+ function B(I) {
635
+ if (I.sets in Y)
636
+ return Y[I.sets];
637
+ if (I.sets.length == 1)
638
+ return "" + I.sets[0];
639
+ }
640
+ p.selectAll("svg").data([k]).enter().append("svg");
641
+ const U = p.select("svg");
642
+ n ? U.attr("viewBox", `0 0 ${s} ${e}`) : U.attr("width", s).attr("height", e);
643
+ const q = {};
644
+ let z = !1;
645
+ U.selectAll(".venn-area path").each(function(I) {
646
+ const L = this.getAttribute("d");
647
+ I.sets.length == 1 && L && !m && (z = !0, q[I.sets[0]] = ke(L));
648
+ });
649
+ function A(I) {
650
+ return (L) => {
651
+ const W = I.sets.map((Z) => {
652
+ let H = q[Z], J = k[Z];
653
+ return H || (H = { x: s / 2, y: e / 2, radius: 1 }), J || (J = { x: s / 2, y: e / 2, radius: 1 }), {
654
+ x: H.x * (1 - L) + J.x * L,
655
+ y: H.y * (1 - L) + J.y * L,
656
+ radius: H.radius * (1 - L) + J.radius * L
657
+ };
658
+ });
659
+ return wt(W, x);
660
+ };
661
+ }
662
+ const D = U.selectAll(".venn-area").data(h, (I) => I.sets), O = D.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("_")), P = O.append("path"), V = O.append("text").attr("class", "label").text((I) => B(I)).attr("text-anchor", "middle").attr("dy", ".35em").attr("x", s / 2).attr("y", e / 2);
666
+ a && (P.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"), V.style("fill", (I) => I.colour || I.color ? "#FFF" : t.textFill ? t.textFill : I.sets.length == 1 ? g(I.sets) : "#444"));
667
+ function R(I) {
668
+ return typeof I.transition == "function" ? I.transition("venn").duration(r) : I;
669
+ }
670
+ let E = p;
671
+ z && typeof E.transition == "function" ? (E = R(p), E.selectAll("path").attrTween("d", A)) : E.selectAll("path").attr("d", (I) => wt(I.sets.map((L) => k[L])), x);
672
+ const F = E.selectAll("text").filter((I) => I.sets in N).text((I) => B(I)).attr("x", (I) => Math.floor(N[I.sets].x)).attr("y", (I) => Math.floor(N[I.sets].y));
673
+ u && (z ? "on" in F ? F.on("end", ot(k, B)) : F.each("end", ot(k, B)) : F.each(ot(k, B)));
674
+ const C = R(D.exit()).remove();
675
+ typeof D.transition == "function" && C.selectAll("path").attrTween("d", A);
676
+ const X = C.selectAll("text").attr("x", s / 2).attr("y", e / 2);
677
+ return y !== null && (V.style("font-size", "0px"), F.style("font-size", y), X.style("font-size", "0px")), { circles: k, textCentres: N, nodes: D, enter: O, update: E, exit: C };
678
+ }
679
+ return l.wrap = function(p) {
680
+ return arguments.length ? (u = p, l) : u;
681
+ }, l.useViewBox = function() {
682
+ return n = !0, l;
683
+ }, l.width = function(p) {
684
+ return arguments.length ? (s = p, l) : s;
685
+ }, l.height = function(p) {
686
+ return arguments.length ? (e = p, l) : e;
687
+ }, l.padding = function(p) {
688
+ return arguments.length ? (i = p, l) : i;
689
+ }, l.distinct = function(p) {
690
+ return arguments.length ? (m = p, l) : m;
691
+ }, l.colours = function(p) {
692
+ return arguments.length ? (g = p, l) : g;
693
+ }, l.colors = function(p) {
694
+ return arguments.length ? (g = p, l) : g;
695
+ }, l.fontSize = function(p) {
696
+ return arguments.length ? (y = p, l) : y;
697
+ }, l.round = function(p) {
698
+ return arguments.length ? (x = p, l) : x;
699
+ }, l.duration = function(p) {
700
+ return arguments.length ? (r = p, l) : r;
701
+ }, l.layoutFunction = function(p) {
702
+ return arguments.length ? (b = p, l) : b;
703
+ }, l.normalize = function(p) {
704
+ return arguments.length ? (c = p, l) : c;
705
+ }, l.scaleToFit = function(p) {
706
+ return arguments.length ? (f = p, l) : f;
707
+ }, l.styled = function(p) {
708
+ return arguments.length ? (a = p, l) : a;
709
+ }, l.orientation = function(p) {
710
+ return arguments.length ? (o = p, l) : o;
711
+ }, l.orientationOrder = function(p) {
712
+ return arguments.length ? (d = p, l) : d;
713
+ }, l.lossFunction = function(p) {
714
+ return arguments.length ? (v = p === "default" ? et : p === "logRatio" ? Dt : p, l) : v;
715
+ }, l;
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(), f = (r.length + o.length) / 3;
720
+ let u = o.pop(), a = [u], y = 0;
721
+ const d = 1.1;
722
+ e.textContent = null;
723
+ const m = [];
724
+ function x(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 = x(u);
729
+ for (; u = o.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 = x(u), y++);
733
+ }
734
+ const T = 0.35 - y * d / 2, _ = e.getAttribute("x"), w = e.getAttribute("y");
735
+ m.forEach((g, b) => {
736
+ g.setAttribute("x", _), 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 - G(n[0], t);
742
+ for (let i = 1; i < n.length; ++i) {
743
+ const r = n[i].radius - G(n[i], t);
744
+ r <= e && (e = r);
745
+ }
746
+ for (let i = 0; i < s.length; ++i) {
747
+ const r = G(s[i], t) - s[i].radius;
748
+ r <= e && (e = r);
749
+ }
750
+ return e;
751
+ }
752
+ function Lt(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 y = at(e[a], t, n);
759
+ y >= r && (i = e[a], r = y);
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, c = { x: s ? 0 : o[0], y: o[1] };
766
+ let f = !0;
767
+ for (const a of t)
768
+ if (G(c, a) > a.radius) {
769
+ f = !1;
770
+ break;
771
+ }
772
+ for (const a of n)
773
+ if (G(c, a) < a.radius) {
774
+ f = !1;
775
+ break;
776
+ }
777
+ if (f)
778
+ return c;
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 ? Lt(t, []) : Tt(u.arcs.map((a) => a.p1));
783
+ }
784
+ function ve(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 c = s[o], f = t[c], u = G(r, f);
792
+ u + f.radius <= r.radius + 1e-10 ? n[c].push(i) : u + r.radius <= f.radius + 1e-10 && n[i].push(c);
793
+ }
794
+ }
795
+ return n;
796
+ }
797
+ function jt(t, n, s) {
798
+ const e = {}, i = ve(t);
799
+ for (let r = 0; r < n.length; ++r) {
800
+ const o = n[r].sets, c = {}, f = {};
801
+ for (let d = 0; d < o.length; ++d) {
802
+ c[o[d]] = !0;
803
+ const m = i[o[d]];
804
+ for (let x = 0; x < m.length; ++x)
805
+ f[m[x]] = !0;
806
+ }
807
+ const u = [], a = [];
808
+ for (let d in t)
809
+ d in c ? u.push(t[d]) : d in f || a.push(t[d]);
810
+ const y = Lt(u, a, s);
811
+ e[o] = y, y.disjoint && n[r].size > 0 && console.log("WARNING: area " + o + " not represented on screen");
812
+ }
813
+ return e;
814
+ }
815
+ function Ie(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 ke(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 Vt(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 Ie(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 Vt(Pt(t), n);
852
+ }
853
+ function Me(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: c = 600,
861
+ height: f = 350,
862
+ padding: u = 15,
863
+ scaleToFit: a = !1,
864
+ symmetricalTextCentre: y = !1,
865
+ distinct: d,
866
+ round: m = 2
867
+ } = n;
868
+ let x = e(t, {
869
+ lossFunction: s === "default" || !s ? et : s === "logRatio" ? Dt : s,
870
+ distinct: d
871
+ });
872
+ i && (x = Ct(x, r, o));
873
+ const M = Nt(x, c, f, u, a), T = jt(M, t, y), _ = 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((h) => _.get(h)), l = Pt(v), p = Vt(l, m);
885
+ return { circles: v, arcs: l, path: p, area: b, has: new Set(b.sets) };
886
+ });
887
+ function g(b) {
888
+ let v = "";
889
+ for (const l of w)
890
+ l.has.size > b.length && b.every((p) => l.has.has(p)) && (v += " " + l.path);
891
+ return v;
892
+ }
893
+ return w.map(({ circles: b, arcs: v, path: l, area: p }) => ({
894
+ data: p,
895
+ text: T[p.sets],
896
+ circles: b,
897
+ arcs: v,
898
+ path: l,
899
+ distinctPath: l + g(p.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], c = [1, 39], f = [7, 8, 11, 12, 17, 19, 22, 24, 27], u = [1, 57], a = [1, 56], y = [1, 58], d = [1, 59], m = [1, 60], x = [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, l, p, h, j) {
914
+ var k = h.length - 1;
915
+ switch (p) {
916
+ case 1:
917
+ return h[k - 1];
918
+ case 2:
919
+ case 3:
920
+ case 4:
921
+ this.$ = [];
922
+ break;
923
+ case 5:
924
+ h[k - 1].push(h[k]), this.$ = h[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.$ = h[k];
938
+ break;
939
+ case 8:
940
+ l.setDiagramTitle(h[k].substr(6)), this.$ = h[k].substr(6);
941
+ break;
942
+ case 9:
943
+ l.addSubsetData([h[k]], void 0, void 0), l.setIndentMode && l.setIndentMode(!0);
944
+ break;
945
+ case 10:
946
+ l.addSubsetData([h[k - 1]], h[k], void 0), l.setIndentMode && l.setIndentMode(!0);
947
+ break;
948
+ case 11:
949
+ l.addSubsetData([h[k - 2]], void 0, parseFloat(h[k])), l.setIndentMode && l.setIndentMode(!0);
950
+ break;
951
+ case 12:
952
+ l.addSubsetData([h[k - 3]], h[k - 2], parseFloat(h[k])), l.setIndentMode && l.setIndentMode(!0);
953
+ break;
954
+ case 13:
955
+ if (h[k].length < 2)
956
+ throw new Error("union requires multiple identifiers");
957
+ l.validateUnionIdentifiers && l.validateUnionIdentifiers(h[k]), l.addSubsetData(h[k], void 0, void 0), l.setIndentMode && l.setIndentMode(!0);
958
+ break;
959
+ case 14:
960
+ if (h[k - 1].length < 2)
961
+ throw new Error("union requires multiple identifiers");
962
+ l.validateUnionIdentifiers && l.validateUnionIdentifiers(h[k - 1]), l.addSubsetData(h[k - 1], h[k], void 0), l.setIndentMode && l.setIndentMode(!0);
963
+ break;
964
+ case 15:
965
+ if (h[k - 2].length < 2)
966
+ throw new Error("union requires multiple identifiers");
967
+ l.validateUnionIdentifiers && l.validateUnionIdentifiers(h[k - 2]), l.addSubsetData(h[k - 2], void 0, parseFloat(h[k])), l.setIndentMode && l.setIndentMode(!0);
968
+ break;
969
+ case 16:
970
+ if (h[k - 3].length < 2)
971
+ throw new Error("union requires multiple identifiers");
972
+ l.validateUnionIdentifiers && l.validateUnionIdentifiers(h[k - 3]), l.addSubsetData(h[k - 3], h[k - 2], parseFloat(h[k])), l.setIndentMode && l.setIndentMode(!0);
973
+ break;
974
+ case 17:
975
+ case 18:
976
+ case 19:
977
+ l.addTextData(h[k - 1], h[k], void 0);
978
+ break;
979
+ case 20:
980
+ case 21:
981
+ l.addTextData(h[k - 2], h[k - 1], h[k]);
982
+ break;
983
+ case 23:
984
+ l.addStyleData(h[k - 1], h[k]);
985
+ break;
986
+ case 24:
987
+ case 25:
988
+ case 26:
989
+ var N = l.getCurrentSets();
990
+ if (!N) throw new Error("text requires set");
991
+ l.addTextData(N, h[k], void 0);
992
+ break;
993
+ case 27:
994
+ case 28:
995
+ var N = l.getCurrentSets();
996
+ if (!N) throw new Error("text requires set");
997
+ l.addTextData(N, h[k - 1], h[k]);
998
+ break;
999
+ case 29:
1000
+ case 41:
1001
+ this.$ = [h[k]];
1002
+ break;
1003
+ case 30:
1004
+ case 42:
1005
+ this.$ = [...h[k - 2], h[k]];
1006
+ break;
1007
+ case 31:
1008
+ this.$ = [h[k - 2], h[k]];
1009
+ break;
1010
+ case 33:
1011
+ this.$ = h[k].join(" ");
1012
+ break;
1013
+ case 34:
1014
+ this.$ = [h[k]];
1015
+ break;
1016
+ case 35:
1017
+ h[k - 1].push(h[k]), this.$ = h[k - 1];
1018
+ break;
1019
+ case 43:
1020
+ case 44:
1021
+ this.$ = h[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: c, 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(f, [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: c, 26: 51 }, { 16: u, 20: a, 21: [1, 53], 28: 52, 29: 54, 30: 55, 31: y, 32: d, 33: m }, 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: d, 33: m }), t(x, [2, 34]), t(x, [2, 36]), t(x, [2, 37]), t(x, [2, 38]), t(x, [2, 39]), t(x, [2, 40]), t(x, [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], l = [], p = [null], h = [], j = this.table, k = "", N = 0, Y = 0, B = 2, U = 1, q = h.slice.call(arguments, 1), z = Object.create(this.lexer), A = { yy: {} };
1037
+ for (var D in this.yy)
1038
+ Object.prototype.hasOwnProperty.call(this.yy, D) && (A.yy[D] = this.yy[D]);
1039
+ z.setInput(g, A.yy), A.yy.lexer = z, A.yy.parser = this, typeof z.yylloc > "u" && (z.yylloc = {});
1040
+ var O = z.yylloc;
1041
+ h.push(O);
1042
+ var P = z.options && z.options.ranges;
1043
+ typeof A.yy.parseError == "function" ? this.parseError = A.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
1044
+ function V(K) {
1045
+ v.length = v.length - 2 * K, p.length = p.length - K, h.length = h.length - K;
1046
+ }
1047
+ S(V, "popStack");
1048
+ function R() {
1049
+ var K;
1050
+ return K = l.pop() || z.lex() || U, typeof K != "number" && (K instanceof Array && (l = K, K = l.pop()), K = b.symbols_[K] || K), K;
1051
+ }
1052
+ S(R, "lex");
1053
+ for (var E, F, C, X, I = {}, L, W, Z, H; ; ) {
1054
+ if (F = v[v.length - 1], this.defaultActions[F] ? C = this.defaultActions[F] : ((E === null || typeof E > "u") && (E = R()), C = j[F] && j[F][E]), typeof C > "u" || !C.length || !C[0]) {
1055
+ var J = "";
1056
+ H = [];
1057
+ for (L in j[F])
1058
+ this.terminals_[L] && L > B && H.push("'" + this.terminals_[L] + "'");
1059
+ z.showPosition ? J = "Parse error on line " + (N + 1) + `:
1060
+ ` + z.showPosition() + `
1061
+ Expecting ` + H.join(", ") + ", got '" + (this.terminals_[E] || E) + "'" : J = "Parse error on line " + (N + 1) + ": Unexpected " + (E == U ? "end of input" : "'" + (this.terminals_[E] || E) + "'"), this.parseError(J, {
1062
+ text: z.match,
1063
+ token: this.terminals_[E] || E,
1064
+ line: z.yylineno,
1065
+ loc: O,
1066
+ expected: H
1067
+ });
1068
+ }
1069
+ if (C[0] instanceof Array && C.length > 1)
1070
+ throw new Error("Parse Error: multiple actions possible at state: " + F + ", token: " + E);
1071
+ switch (C[0]) {
1072
+ case 1:
1073
+ v.push(E), p.push(z.yytext), h.push(z.yylloc), v.push(C[1]), E = null, Y = z.yyleng, k = z.yytext, N = z.yylineno, O = z.yylloc;
1074
+ break;
1075
+ case 2:
1076
+ if (W = this.productions_[C[1]][1], I.$ = p[p.length - W], I._$ = {
1077
+ first_line: h[h.length - (W || 1)].first_line,
1078
+ last_line: h[h.length - 1].last_line,
1079
+ first_column: h[h.length - (W || 1)].first_column,
1080
+ last_column: h[h.length - 1].last_column
1081
+ }, P && (I._$.range = [
1082
+ h[h.length - (W || 1)].range[0],
1083
+ h[h.length - 1].range[1]
1084
+ ]), X = this.performAction.apply(I, [
1085
+ k,
1086
+ Y,
1087
+ N,
1088
+ A.yy,
1089
+ C[1],
1090
+ p,
1091
+ h
1092
+ ].concat(q)), typeof X < "u")
1093
+ return X;
1094
+ W && (v = v.slice(0, -1 * W * 2), p = p.slice(0, -1 * W), h = h.slice(0, -1 * W)), v.push(this.productions_[C[1]][0]), p.push(I.$), h.push(I._$), Z = j[v[v.length - 2]][v[v.length - 1]], v.push(Z);
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 l = 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 p = 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 === l.length ? this.yylloc.first_column : 0) + l[l.length - v.length].length - v[0].length : this.yylloc.first_column - b
1139
+ }, this.options.ranges && (this.yylloc.range = [p[0], p[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, l, p;
1181
+ if (this.options.backtrack_lexer && (p = {
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 && (p.yylloc.range = this.yylloc.range.slice(0))), l = g[0].match(/(?:\r\n?|\n).*/g), l && (this.yylineno += l.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: l ? l[l.length - 1].length - l[l.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 h in p)
1209
+ this[h] = p[h];
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, l;
1220
+ this._more || (this.yytext = "", this.match = "");
1221
+ for (var p = this._currentRules(), h = 0; h < p.length; h++)
1222
+ if (v = this._input.match(this.rules[p[h]]), v && (!b || v[0].length > b[0].length)) {
1223
+ if (b = v, l = h, this.options.backtrack_lexer) {
1224
+ if (g = this.test_match(v, p[h]), 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, p[l]), 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, l, p) {
1273
+ switch (l) {
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 _() {
1342
+ this.yy = {};
1343
+ }
1344
+ return S(_, "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, Se = /* @__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"), _e = /* @__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"), Ee = /* @__PURE__ */ S((t) => t && nt(t), "normalizeStyleValue"), Te = /* @__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"), ze = /* @__PURE__ */ S((t, n) => {
1365
+ const s = it(t).sort(), e = {};
1366
+ for (const [i, r] of n)
1367
+ e[i] = Ee(r) ?? r;
1368
+ mt.push({ targets: s, styles: e });
1369
+ }, "addStyleData"), Ae = /* @__PURE__ */ S(() => mt, "getStyleData"), it = /* @__PURE__ */ S((t) => t.map((n) => nt(n)), "normalizeIdentifierList"), Re = /* @__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"), Ce = /* @__PURE__ */ S(() => vt, "getCurrentSets"), Ne = /* @__PURE__ */ S(() => It, "getIndentMode"), Oe = /* @__PURE__ */ S((t) => {
1374
+ It = t;
1375
+ }, "setIndentMode"), Fe = re.venn;
1376
+ function Bt() {
1377
+ return ie(Fe, St().venn);
1378
+ }
1379
+ S(Bt, "getConfig");
1380
+ var Le = /* @__PURE__ */ S(() => {
1381
+ se(), yt.length = 0, pt.length = 0, mt.length = 0, bt.clear(), vt = void 0, It = !1;
1382
+ }, "customClear"), je = {
1383
+ getConfig: Bt,
1384
+ clear: Le,
1385
+ setAccTitle: Zt,
1386
+ getAccTitle: Xt,
1387
+ setDiagramTitle: Yt,
1388
+ getDiagramTitle: Ht,
1389
+ getAccDescription: Kt,
1390
+ setAccDescription: Gt,
1391
+ addSubsetData: Se,
1392
+ getSubsetData: _e,
1393
+ addTextData: Te,
1394
+ addStyleData: ze,
1395
+ validateUnionIdentifiers: Re,
1396
+ getTextData: De,
1397
+ getStyleData: Ae,
1398
+ getCurrentSets: Ce,
1399
+ getIndentMode: Ne,
1400
+ setIndentMode: Oe
1401
+ }, Pe = /* @__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 = Pe;
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 Be = /* @__PURE__ */ S((t, n, s, e) => {
1434
+ var U, q, z;
1435
+ const i = e.db, r = (U = i.getConfig) == null ? void 0 : U.call(i), { themeVariables: o, look: c, handDrawnSeed: f } = St(), u = c === "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), y = (q = i.getDiagramTitle) == null ? void 0 : q.call(i), d = i.getSubsetData(), m = i.getTextData(), x = qt(i.getStyleData()), M = (r == null ? void 0 : r.width) ?? 800, T = (r == null ? void 0 : r.height) ?? 450, w = M / 1600, g = y ? 48 * w : 0, b = o.primaryTextColor ?? o.textColor, v = Jt(n);
1445
+ v.attr("viewBox", `0 0 ${M} ${T}`), y && v.append("text").text(y).attr("class", "venn-title").attr("font-size", `${32 * w}px`).attr("text-anchor", "middle").attr("dominant-baseline", "middle").attr("x", "50%").attr("y", 32 * w).style("fill", o.vennTitleTextColor || o.titleColor);
1446
+ const l = rt(document.createElement("div")), p = be().width(M).height(T - g);
1447
+ l.datum(d).call(p);
1448
+ const h = u ? Qt.svg(l.select("svg").node()) : void 0, j = Me(d, {
1449
+ width: M,
1450
+ height: T - g,
1451
+ padding: (r == null ? void 0 : r.padding) ?? 15
1452
+ }), k = /* @__PURE__ */ new Map();
1453
+ for (const A of j) {
1454
+ const D = $([...A.data.sets].sort());
1455
+ k.set(D, A);
1456
+ }
1457
+ m.length > 0 && Ut(r, k, l, m, w, x);
1458
+ const N = $t(o.background || "#f4f4f4");
1459
+ l.selectAll(".venn-circle").each(function(A, D) {
1460
+ var L;
1461
+ const O = rt(this), V = $([...A.sets].sort()), R = x.get(V), E = (R == null ? void 0 : R.fill) || a[D % a.length] || o.primaryColor;
1462
+ O.classed(`venn-set-${D % 8}`, !0);
1463
+ const F = (R == null ? void 0 : R["fill-opacity"]) ?? 0.1, C = (R == null ? void 0 : R.stroke) || E, X = (R == null ? void 0 : R["stroke-width"]) || `${5 * w}`;
1464
+ if (u && h) {
1465
+ const W = k.get(V);
1466
+ if (W && W.circles.length > 0) {
1467
+ const Z = W.circles[0], H = h.circle(Z.x, Z.y, Z.radius * 2, {
1468
+ roughness: 0.7,
1469
+ seed: f,
1470
+ fill: kt(E, 0.7),
1471
+ fillStyle: "hachure",
1472
+ fillWeight: 2,
1473
+ hachureGap: 8,
1474
+ hachureAngle: -41 + D * 60,
1475
+ stroke: C,
1476
+ strokeWidth: parseFloat(String(X))
1477
+ });
1478
+ O.select("path").remove(), (L = O.node()) == null || L.insertBefore(H, O.select("text").node());
1479
+ }
1480
+ } else
1481
+ O.select("path").style("fill", E).style("fill-opacity", F).style("stroke", C).style("stroke-width", X).style("stroke-opacity", 0.95);
1482
+ const I = (R == null ? void 0 : R.color) || (N ? te(E, 30) : ee(E, 30));
1483
+ O.select("text").style("font-size", `${48 * w}px`).style("fill", I);
1484
+ }), u && h ? l.selectAll(".venn-intersection").each(function(A) {
1485
+ var E;
1486
+ const D = rt(this), P = $([...A.sets].sort()), V = x.get(P), R = V == null ? void 0 : V.fill;
1487
+ if (R) {
1488
+ const F = D.select("path"), C = F.attr("d");
1489
+ if (C) {
1490
+ const X = h.path(C, {
1491
+ roughness: 0.7,
1492
+ seed: f,
1493
+ fill: kt(R, 0.3),
1494
+ fillStyle: "cross-hatch",
1495
+ fillWeight: 2,
1496
+ hachureGap: 6,
1497
+ hachureAngle: 60,
1498
+ stroke: "none"
1499
+ }), I = F.node();
1500
+ (E = I == null ? void 0 : I.parentNode) == null || E.insertBefore(X, I), F.remove();
1501
+ }
1502
+ } else
1503
+ D.select("path").style("fill-opacity", 0);
1504
+ D.select("text").style("font-size", `${48 * w}px`).style("fill", (V == null ? void 0 : V.color) ?? o.vennSetTextColor ?? b);
1505
+ }) : (l.selectAll(".venn-intersection text").style("font-size", `${48 * w}px`).style("fill", (A) => {
1506
+ var P;
1507
+ const O = $([...A.sets].sort());
1508
+ return ((P = x.get(O)) == null ? void 0 : P.color) ?? o.vennSetTextColor ?? b;
1509
+ }), l.selectAll(".venn-intersection path").style("fill-opacity", (A) => {
1510
+ var P;
1511
+ const O = $([...A.sets].sort());
1512
+ return (P = x.get(O)) != null && P.fill ? 1 : 0;
1513
+ }).style("fill", (A) => {
1514
+ var P;
1515
+ const O = $([...A.sets].sort());
1516
+ return ((P = x.get(O)) == null ? void 0 : P.fill) ?? "transparent";
1517
+ }));
1518
+ const Y = v.append("g").attr("transform", `translate(0, ${g})`), B = l.select("svg").node();
1519
+ if (B && "childNodes" in B)
1520
+ for (const A of [...B.childNodes])
1521
+ (z = Y.node()) == null || z.appendChild(A);
1522
+ ne(v, T, M, (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, f = s.select("svg").append("g").attr("class", "venn-text-nodes"), u = /* @__PURE__ */ new Map();
1531
+ for (const y of e) {
1532
+ const d = $(y.sets), m = u.get(d);
1533
+ m ? m.push(y) : u.set(d, [y]);
1534
+ }
1535
+ for (const [y, d] of u.entries()) {
1536
+ const m = n.get(y);
1537
+ if (!(m != null && m.text))
1538
+ continue;
1539
+ const x = m.text.x, M = m.text.y, T = Math.min(...m.circles.map((q) => q.radius)), _ = Math.min(
1540
+ ...m.circles.map((q) => q.radius - Math.hypot(x - q.x, M - q.y))
1541
+ );
1542
+ let w = Number.isFinite(_) ? Math.max(0, _) : 0;
1543
+ w === 0 && Number.isFinite(T) && (w = T * 0.6);
1544
+ const g = f.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", x).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), h = (m.data.label && m.data.label.length > 0 ? Math.min(32 * i, w * 0.25) : 0) + (d.length <= 2 ? 30 * i : 0), j = x - b / 2, k = M - v / 2 + h, N = Math.max(1, Math.ceil(Math.sqrt(d.length))), Y = Math.max(1, Math.ceil(d.length / N)), B = b / N, U = v / Y;
1547
+ for (const [q, z] of d.entries()) {
1548
+ const A = q % N, D = Math.floor(q / N), O = j + B * (A + 0.5), P = k + U * (D + 0.5);
1549
+ o && g.append("rect").attr("class", "venn-text-debug-cell").attr("x", j + B * A).attr("y", k + U * D).attr("width", B).attr("height", U).attr("fill", "none").attr("stroke", "teal").attr("stroke-width", 1 * i).attr("stroke-dasharray", `${4 * i} ${3 * i}`);
1550
+ const V = B * 0.9, R = U * 0.9, E = g.append("foreignObject").attr("class", "venn-text-node-fo").attr("width", V).attr("height", R).attr("x", O - V / 2).attr("y", P - R / 2).attr("overflow", "visible"), F = (a = r.get(z.id)) == null ? void 0 : a.color, C = E.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
+ F && C.style("color", F);
1552
+ }
1553
+ }
1554
+ }
1555
+ S(Ut, "renderTextNodes");
1556
+ var qe = { draw: Be }, We = {
1557
+ parser: we,
1558
+ db: je,
1559
+ renderer: qe,
1560
+ styles: Ve
1561
+ };
1562
+ export {
1563
+ We as diagram
1564
+ };