@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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +180 -0
  3. package/dist/analytics/index.d.ts +10 -0
  4. package/dist/chunks/abnfDiagram-VCTEODGH-DyAP6Aua.js +87 -0
  5. package/dist/chunks/arc-OroUeRL_.js +83 -0
  6. package/dist/chunks/architectureDiagram-5GKGNRK7-FjmrDCl4.js +4784 -0
  7. package/dist/chunks/blockDiagram-I7D4REHJ-BF3oIDlI.js +1416 -0
  8. package/dist/chunks/c4Diagram-7LVT6UL2-Cmdq0LZr.js +1511 -0
  9. package/dist/chunks/channel-Bdy1QZHo.js +5 -0
  10. package/dist/chunks/chunk-2Q5K7J3B-BwxRSEKd.js +15 -0
  11. package/dist/chunks/chunk-5VM5RSS4-BtHwUU4T.js +19 -0
  12. package/dist/chunks/chunk-F27PBJKO-DF4TGftR.js +68 -0
  13. package/dist/chunks/chunk-IMKFNOWR-DkBQ-1aV.js +1421 -0
  14. package/dist/chunks/chunk-JWPE2WC7-BIokdAUW.js +9 -0
  15. package/dist/chunks/chunk-POPQ4Y6H-CcjOsf9X.js +20 -0
  16. package/dist/chunks/chunk-SHT3W25Y-lYp5BdEg.js +1695 -0
  17. package/dist/chunks/chunk-SVP7TREG-DN-ravNt.js +664 -0
  18. package/dist/chunks/chunk-TICWLB2K-CtTJ0xaY.js +1534 -0
  19. package/dist/chunks/chunk-XXDRQBXY-BovkWFC0.js +8 -0
  20. package/dist/chunks/classDiagram-ZZMXUADV-CMYS0pHw.js +16 -0
  21. package/dist/chunks/classDiagram-v2-VYDZK3BY-CMYS0pHw.js +16 -0
  22. package/dist/chunks/common-BJ4q25wy.js +12633 -0
  23. package/dist/chunks/cose-bilkent-JH36ORCC-CaMqpJY7.js +2608 -0
  24. package/dist/chunks/cynefin-OW5HDTMX-Bzjecpt-.js +23853 -0
  25. package/dist/chunks/cynefinDiagram-5FMLGOSQ-C0NuKLt0.js +299 -0
  26. package/dist/chunks/cytoscape.esm-DmPrb1GM.js +18787 -0
  27. package/dist/chunks/dagre-GXQ25YYZ-Ds09_NdN.js +461 -0
  28. package/dist/chunks/defaultLocale-BgPVtth8.js +171 -0
  29. package/dist/chunks/diagram-S7CK7UJ4-IvSazk1O.js +349 -0
  30. package/dist/chunks/diagram-UQ7AKVKN-58epdx5V.js +223 -0
  31. package/dist/chunks/diagram-VSXAHHWV-BrzRGMeV.js +466 -0
  32. package/dist/chunks/diagram-VX7I27RA-DPL0Nw6d.js +530 -0
  33. package/dist/chunks/diagram-Z3DM3KII-8VWVu0I5.js +143 -0
  34. package/dist/chunks/ebnfDiagram-PWID7BFC-DeByR_ze.js +109 -0
  35. package/dist/chunks/erDiagram-RLTQ6QDP-C9uo9iE1.js +1060 -0
  36. package/dist/chunks/flowDiagram-HODETNUW-BpoY3OMp.js +7 -0
  37. package/dist/chunks/ganttDiagram-EL5Y4UJY-psdwnC-T.js +2711 -0
  38. package/dist/chunks/gitGraphDiagram-WWUBYQGX-vsDfkn_Q.js +828 -0
  39. package/dist/chunks/index-f7Uzykhj.js +38262 -0
  40. package/dist/chunks/infoDiagram-27XIBGKW-8K-eQZiU.js +24 -0
  41. package/dist/chunks/init-DjUOC4st.js +16 -0
  42. package/dist/chunks/ishikawaDiagram-5VMMS53U-CuqR1k5i.js +622 -0
  43. package/dist/chunks/journeyDiagram-3NMN7TZE-BPW1nmwZ.js +834 -0
  44. package/dist/chunks/kanban-definition-UXKFOSKX-iY6-d6jO.js +726 -0
  45. package/dist/chunks/katex-jHfnQmlp.js +11682 -0
  46. package/dist/chunks/layout-CgV9vOdp.js +1704 -0
  47. package/dist/chunks/linear-BzcaSMTS.js +259 -0
  48. package/dist/chunks/mindmap-definition-YA3MSWOX-CaLfHyv0.js +831 -0
  49. package/dist/chunks/ordinal-DfAQgscy.js +61 -0
  50. package/dist/chunks/pegDiagram-XKGWAZYB-6Y28VvVh.js +95 -0
  51. package/dist/chunks/pieDiagram-E7YTZNPT-OrjeRxhs.js +209 -0
  52. package/dist/chunks/quadrantDiagram-AXDQQJYC-rgw2lV2J.js +1025 -0
  53. package/dist/chunks/railroadDiagram-O6MQD6OU-D6QNO5r1.js +77 -0
  54. package/dist/chunks/requirementDiagram-BXWQKSXE-a8tNRSuE.js +884 -0
  55. package/dist/chunks/sankeyDiagram-P5KCCOFB-CdaC8rLw.js +847 -0
  56. package/dist/chunks/sequenceDiagram-WJ2MYXX4-CGLi38Hj.js +2898 -0
  57. package/dist/chunks/sizeCapture-INFHLROL-g5RJXnik.js +47 -0
  58. package/dist/chunks/stateDiagram-D77RDMKH-Cou0eVl1.js +262 -0
  59. package/dist/chunks/stateDiagram-v2-MP3YSRHH-BHQspnUg.js +16 -0
  60. package/dist/chunks/swimlanes-42K2YHIH-BU7S1WgJ.js +5239 -0
  61. package/dist/chunks/swimlanesDiagram-VR7AAH4N-BsEplbno.js +13 -0
  62. package/dist/chunks/timeline-definition-24CTP7MA-BB-IyxWL.js +1066 -0
  63. package/dist/chunks/vennDiagram-4TSXK5OY-BToYolPI.js +1585 -0
  64. package/dist/chunks/wardleyDiagram-VM6X3IG4-BgoueOw_.js +684 -0
  65. package/dist/chunks/xychartDiagram-S5SC5T6Z-CF0fWv-W.js +1492 -0
  66. package/dist/components/CodeBlock.d.ts +5 -0
  67. package/dist/components/CommunityLinks.d.ts +21 -0
  68. package/dist/components/CookieConsent.d.ts +2 -0
  69. package/dist/components/DocLinkCard.d.ts +6 -0
  70. package/dist/components/LecturePageView.d.ts +3 -0
  71. package/dist/components/MermaidDiagram.d.ts +3 -0
  72. package/dist/components/SearchPopup.d.ts +6 -0
  73. package/dist/components/WikiApp.d.ts +9 -0
  74. package/dist/components/WikiLayout.d.ts +2 -0
  75. package/dist/components/WikiPageView.d.ts +6 -0
  76. package/dist/components/ZoomableImage.d.ts +2 -0
  77. package/dist/context/LangContext.d.ts +2 -0
  78. package/dist/context/WikiContext.d.ts +18 -0
  79. package/dist/data.d.ts +8 -0
  80. package/dist/hooks/useLanguage.d.ts +4 -0
  81. package/dist/hooks/useTheme.d.ts +5 -0
  82. package/dist/hooks/useWiki.d.ts +2 -0
  83. package/dist/index.d.ts +24 -0
  84. package/dist/index.js +45 -0
  85. package/dist/languages/ue-cpp.d.ts +7 -0
  86. package/dist/languages/ue-cpp.js +21 -0
  87. package/dist/types.d.ts +119 -0
  88. package/dist/wiki-engine.css +1 -0
  89. package/package.json +76 -0
@@ -0,0 +1,349 @@
1
+ import { I as X } from "./chunk-2Q5K7J3B-BwxRSEKd.js";
2
+ import { p as z } from "./chunk-JWPE2WC7-BIokdAUW.js";
3
+ import { q as O, b as G, s as Y, t as P, g as F, a as q, _ as g, G as A, l as E, K as Z, d as U, E as L, A as j, i as K, an as J, H as Q, ao as ee } from "./index-f7Uzykhj.js";
4
+ import { p as te } from "./cynefin-OW5HDTMX-Bzjecpt-.js";
5
+ var D = /[─━│┃└┗├┣]/, _ = /[└┗├┣]/, re = /[─━]/, V = /^[\s│┃]+$/, $ = /^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/, k = /^\s*%%/, ne = " ";
6
+ function S(r) {
7
+ return r.some((t) => D.test(t));
8
+ }
9
+ g(S, "isBoxDrawingFormat");
10
+ function M(r) {
11
+ for (const t of r) {
12
+ const e = _.exec(t);
13
+ if (e != null && e.index && e.index > 0)
14
+ return e.index;
15
+ }
16
+ return 4;
17
+ }
18
+ g(M, "inferSegmentWidth");
19
+ function R(r, t) {
20
+ return r.replace(/\bline\s+(\d+)\b/gi, (e, i) => {
21
+ const s = parseInt(i, 10), o = t.get(s);
22
+ return o ? `line ${o}` : e;
23
+ });
24
+ }
25
+ g(R, "remapErrorLines");
26
+ function H(r) {
27
+ const t = r.split(`
28
+ `), e = /* @__PURE__ */ new Map();
29
+ let i = -1;
30
+ for (const [d, l] of t.entries())
31
+ if (l.trim() === "treeView-beta") {
32
+ i = d;
33
+ break;
34
+ }
35
+ if (i === -1)
36
+ return { text: r, lineMap: e };
37
+ const s = [];
38
+ for (let d = i + 1; d < t.length; d++) {
39
+ const l = t[d];
40
+ l.trim() === "" || k.test(l) || $.test(l) || V.test(l) || s.push(l.replace(/\t/g, " "));
41
+ }
42
+ if (!S(s))
43
+ return { text: r, lineMap: e };
44
+ const o = M(s), n = [];
45
+ let c = 0;
46
+ for (let d = 0; d <= i; d++)
47
+ n.push(t[d]), c++, e.set(c, d + 1);
48
+ for (let d = i + 1; d < t.length; d++) {
49
+ const l = t[d], u = l.trim(), a = d + 1;
50
+ if (u === "") {
51
+ n.push(l), c++, e.set(c, a);
52
+ continue;
53
+ }
54
+ if (k.test(l)) {
55
+ n.push(l), c++, e.set(c, a);
56
+ continue;
57
+ }
58
+ if ($.test(l)) {
59
+ n.push(l), c++, e.set(c, a);
60
+ continue;
61
+ }
62
+ if (V.test(l))
63
+ continue;
64
+ const p = l.replace(/\t/g, " "), h = _.exec(p);
65
+ if ((h == null ? void 0 : h.index) !== void 0) {
66
+ const m = h.index, w = Math.round(m / o) + 1;
67
+ let f = m + 1;
68
+ for (; f < p.length && re.test(p[f]); )
69
+ f++;
70
+ for (; f < p.length && p[f] === " "; )
71
+ f++;
72
+ const v = p.slice(f).trimEnd();
73
+ if (!v)
74
+ throw new Error(
75
+ `Line ${a}: Empty node — expected a filename or directory name after the box-drawing prefix`
76
+ );
77
+ const b = ne.repeat(w);
78
+ n.push(b + v), c++, e.set(c, a);
79
+ } else {
80
+ if (/^[\s─━│┃└┗├┣]+$/.test(p))
81
+ continue;
82
+ if (D.test(p))
83
+ n.push(l), c++, e.set(c, a);
84
+ else {
85
+ if (/^\s+/.test(p))
86
+ throw new Error(
87
+ `Line ${a}: Unexpected indentation without box-drawing characters. In box-drawing format, use ├── or └── prefixes for indented nodes.`
88
+ );
89
+ n.push(l), c++, e.set(c, a);
90
+ }
91
+ }
92
+ }
93
+ return { text: n.join(`
94
+ `), lineMap: e };
95
+ }
96
+ g(H, "preprocessBoxDrawing");
97
+ var x = new X(() => ({
98
+ cnt: 1,
99
+ stack: [
100
+ {
101
+ id: 0,
102
+ level: -1,
103
+ name: "/",
104
+ nodeType: "directory",
105
+ children: []
106
+ }
107
+ ]
108
+ })), ie = /* @__PURE__ */ g(() => {
109
+ x.reset(), j();
110
+ }, "clear"), oe = /* @__PURE__ */ g(() => x.records.stack[0], "getRoot"), se = /* @__PURE__ */ g(() => x.records.cnt, "getCount"), ae = Q.treeView, ce = /* @__PURE__ */ g(() => A(ae, L().treeView), "getConfig"), le = /* @__PURE__ */ g((r, t, e, i, s, o) => {
111
+ for (; r <= x.records.stack[x.records.stack.length - 1].level; )
112
+ x.records.stack.pop();
113
+ const n = {
114
+ id: x.records.cnt++,
115
+ level: r,
116
+ name: t,
117
+ nodeType: e,
118
+ icon: s,
119
+ cssClass: i,
120
+ description: o,
121
+ children: []
122
+ };
123
+ x.records.stack[x.records.stack.length - 1].children.push(n), x.records.stack.push(n);
124
+ }, "addNode"), de = {
125
+ clear: ie,
126
+ addNode: le,
127
+ getRoot: oe,
128
+ getCount: se,
129
+ getConfig: ce,
130
+ getAccTitle: q,
131
+ getAccDescription: F,
132
+ getDiagramTitle: P,
133
+ setAccDescription: Y,
134
+ setAccTitle: G,
135
+ setDiagramTitle: O
136
+ }, I = de, he = /* @__PURE__ */ g((r) => {
137
+ z(r, I);
138
+ for (const t of r.nodes) {
139
+ const e = typeof t.indent == "number" ? t.indent : 0;
140
+ let i = t.name;
141
+ const s = i.endsWith("/");
142
+ s && (i = i.slice(0, -1));
143
+ const o = s ? "directory" : "file", n = t.classAnnotation || void 0, c = t.iconAnnotation, d = c !== void 0 ? c || "none" : void 0, l = t.descAnnotation || void 0, u = l ? K(l, L()) : void 0;
144
+ I.addNode(e, i, o, n, d, u);
145
+ }
146
+ }, "populate"), pe = {
147
+ parse: /* @__PURE__ */ g(async (r) => {
148
+ const { text: t, lineMap: e } = H(r);
149
+ try {
150
+ const i = await te("treeView", t);
151
+ E.debug(i), he(i);
152
+ } catch (i) {
153
+ throw e.size > 0 && i instanceof Error && (i.message = R(i.message, e)), i;
154
+ }
155
+ }, "parse")
156
+ }, C = {
157
+ prefix: "mermaid-treeview",
158
+ height: 24,
159
+ width: 24,
160
+ icons: {
161
+ folder: {
162
+ body: '<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>'
163
+ },
164
+ file: {
165
+ body: '<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>'
166
+ }
167
+ }
168
+ };
169
+ function W(r, t) {
170
+ var s;
171
+ const e = (s = t == null ? void 0 : t.filenameIcons) == null ? void 0 : s[r];
172
+ if (e)
173
+ return e;
174
+ const i = r.lastIndexOf(".");
175
+ if (i > 0) {
176
+ const o = r.substring(i).toLowerCase(), n = t == null ? void 0 : t.extensionIcons;
177
+ return (n == null ? void 0 : n[o]) ?? (n == null ? void 0 : n[o.slice(1)]);
178
+ }
179
+ }
180
+ g(W, "detectIcon");
181
+ function y(r, t) {
182
+ return r.includes(":") ? r : r in C.icons || !t ? `${C.prefix}:${r}` : `${t}:${r}`;
183
+ }
184
+ g(y, "qualifyIcon");
185
+ function T(r, t) {
186
+ if (r.icon !== "none") {
187
+ if (r.icon)
188
+ return y(r.icon, t.defaultIconPack);
189
+ if (t.showIcons) {
190
+ if (r.nodeType === "file") {
191
+ const e = W(r.name, t);
192
+ if (e === "none")
193
+ return;
194
+ if (e)
195
+ return y(e, t.defaultIconPack);
196
+ }
197
+ return `${C.prefix}:${r.nodeType === "directory" ? "folder" : "file"}`;
198
+ }
199
+ }
200
+ }
201
+ g(T, "getNodeIcon");
202
+ ee([
203
+ {
204
+ name: C.prefix,
205
+ icons: C
206
+ }
207
+ ]);
208
+ var B = 14, ge = 4, fe = 16, ue = /* @__PURE__ */ g(async (r, t) => {
209
+ const e = [], i = /* @__PURE__ */ g((o) => {
210
+ const n = T(o, t);
211
+ n && e.push({ icon: n, node: o }), o.children.forEach(i);
212
+ }, "collect");
213
+ i(r);
214
+ const s = await Promise.all(
215
+ e.map(async ({ icon: o, node: n }) => ({
216
+ id: n.id,
217
+ svg: await J(o, {
218
+ height: B,
219
+ width: B
220
+ })
221
+ }))
222
+ );
223
+ return new Map(s.map(({ id: o, svg: n }) => [o, n]));
224
+ }, "resolveNodeIcons"), we = /* @__PURE__ */ g((r, t, e, i, s, o) => {
225
+ var b;
226
+ const n = i.append("g");
227
+ let c = "treeView-node-label";
228
+ e.nodeType === "directory" && (c += " treeView-node-dir"), e.cssClass && (c += ` ${e.cssClass}`);
229
+ const d = B + ge, l = T(e, s), u = l !== void 0;
230
+ l && n.append("g").attr("class", "treeView-node-icon").attr("transform", `translate(${r + s.paddingX}, ${t + s.paddingY})`).html(o.get(e.id) ?? "");
231
+ const a = n.append("text").text(e.name).attr("dominant-baseline", "middle").attr("class", c), { height: p, width: h } = a.node().getBBox(), m = p + s.paddingY * 2, w = r + s.paddingX + (u ? d : 0);
232
+ a.attr("x", w), a.attr("y", t + m / 2);
233
+ const f = w + h, v = h + s.paddingX * 2 + (u ? d : 0);
234
+ return e.BBox = { x: r, y: t, width: v, height: m }, (b = e.cssClass) != null && b.split(/\s+/).includes("highlight") && n.insert("rect", ":first-child").attr("x", r).attr("y", t + 1).attr("width", 0).attr("height", m - 2).attr("rx", 3).attr("class", "treeView-highlight-bg"), { node: e, nodeGroup: n, labelRightEdge: f, centerY: t + m / 2 };
235
+ }, "positionLabel"), N = /* @__PURE__ */ g((r, t, e, i, s, o) => r.append("line").attr("x1", t).attr("y1", e).attr("x2", i).attr("y2", s).attr("stroke-width", o).attr("class", "treeView-node-line"), "positionLine"), me = /* @__PURE__ */ g((r, t, e, i) => {
236
+ var u;
237
+ let s = 0, o = 0;
238
+ const n = [], c = /* @__PURE__ */ g((a, p, h, m) => {
239
+ const w = m * (h.rowIndent + h.paddingX), f = we(w, s, p, a, h, i);
240
+ n.push(f);
241
+ const { height: v, width: b } = p.BBox;
242
+ N(
243
+ a,
244
+ w - h.rowIndent,
245
+ s + v / 2,
246
+ w,
247
+ s + v / 2,
248
+ h.lineThickness
249
+ ), o = Math.max(o, w + b), s += v;
250
+ }, "drawNode"), d = /* @__PURE__ */ g((a, p = 0) => {
251
+ c(r, a, e, p), a.children.forEach((f) => {
252
+ d(f, p + 1);
253
+ });
254
+ const { x: h, y: m, height: w } = a.BBox;
255
+ if (a.children.length) {
256
+ const { y: f, height: v } = a.children[a.children.length - 1].BBox;
257
+ N(
258
+ r,
259
+ h + e.paddingX,
260
+ m + w,
261
+ h + e.paddingX,
262
+ f + v / 2 + e.lineThickness / 2,
263
+ e.lineThickness
264
+ );
265
+ }
266
+ }, "processNode");
267
+ d(t);
268
+ const l = n.filter((a) => a.node.description);
269
+ if (l.length > 0) {
270
+ const p = Math.max(...n.map((h) => h.labelRightEdge)) + fe;
271
+ for (const h of l) {
272
+ const w = h.nodeGroup.append("text").text(h.node.description).attr("dominant-baseline", "middle").attr("class", "treeView-node-description").attr("x", p).attr("y", h.centerY).node().getBBox();
273
+ o = Math.max(o, p + w.width + e.paddingX);
274
+ }
275
+ }
276
+ for (const a of n)
277
+ if ((u = a.node.cssClass) != null && u.split(/\s+/).includes("highlight")) {
278
+ const p = a.nodeGroup.select(".treeView-highlight-bg");
279
+ if (!p.empty()) {
280
+ const h = o - a.node.BBox.x + 8;
281
+ p.attr("width", h), o = Math.max(o, a.node.BBox.x + h + 2);
282
+ }
283
+ }
284
+ return { totalHeight: s, totalWidth: o };
285
+ }, "drawTree"), ve = /* @__PURE__ */ g(async (r, t, e, i) => {
286
+ E.debug(`Rendering treeView diagram
287
+ ` + r);
288
+ const s = i.db, o = s.getRoot(), n = s.getConfig(), c = Z(t), d = c.append("g");
289
+ d.attr("class", "tree-view");
290
+ const l = await ue(o, n), { totalHeight: u, totalWidth: a } = me(d, o, n, l);
291
+ c.attr("viewBox", `-${n.lineThickness / 2} 0 ${a} ${u}`), U(c, u, a, n.useMaxWidth);
292
+ }, "draw"), xe = {
293
+ draw: ve
294
+ }, be = xe, Ce = {
295
+ labelFontSize: "16px",
296
+ labelColor: "black",
297
+ lineColor: "black",
298
+ iconColor: "#546e7a",
299
+ descriptionColor: "#6a9955",
300
+ highlightBg: "rgba(255, 193, 7, 0.15)",
301
+ highlightStroke: "#ffc107"
302
+ }, Ie = /* @__PURE__ */ g(({
303
+ treeView: r
304
+ }) => {
305
+ const {
306
+ labelFontSize: t,
307
+ labelColor: e,
308
+ lineColor: i,
309
+ iconColor: s,
310
+ descriptionColor: o,
311
+ highlightBg: n,
312
+ highlightStroke: c
313
+ } = A(Ce, r);
314
+ return `
315
+ .treeView-node-label {
316
+ font-size: ${t};
317
+ fill: ${e};
318
+ white-space: pre;
319
+ }
320
+ .treeView-node-dir {
321
+ font-weight: bold;
322
+ }
323
+ .treeView-node-line {
324
+ stroke: ${i};
325
+ }
326
+ .treeView-node-icon {
327
+ color: ${s};
328
+ }
329
+ .treeView-node-description {
330
+ font-size: ${t};
331
+ fill: ${o};
332
+ font-style: italic;
333
+ white-space: pre;
334
+ }
335
+ .treeView-highlight-bg {
336
+ fill: ${n};
337
+ stroke: ${c};
338
+ stroke-width: 1;
339
+ }
340
+ `;
341
+ }, "styles"), ye = Ie, ke = {
342
+ db: I,
343
+ renderer: be,
344
+ parser: pe,
345
+ styles: ye
346
+ };
347
+ export {
348
+ ke as diagram
349
+ };
@@ -0,0 +1,223 @@
1
+ import { p as I } from "./chunk-JWPE2WC7-BIokdAUW.js";
2
+ import { s as _, g as E, t as F, q as D, a as G, b as P, _ as c, K as z, A as B, G as w, E as C, H as W, l as b, L as H, d as V } from "./index-f7Uzykhj.js";
3
+ import { p as j } from "./cynefin-OW5HDTMX-Bzjecpt-.js";
4
+ var m = {
5
+ showLegend: !0,
6
+ ticks: 5,
7
+ max: null,
8
+ min: 0,
9
+ graticule: "circle"
10
+ }, y = 32, A = {
11
+ axes: [],
12
+ curves: [],
13
+ options: m
14
+ }, x = structuredClone(A), K = W.radar, U = /* @__PURE__ */ c(() => w({
15
+ ...K,
16
+ ...C().radar
17
+ }), "getConfig"), M = /* @__PURE__ */ c(() => x.axes, "getAxes"), X = /* @__PURE__ */ c(() => x.curves, "getCurves"), q = /* @__PURE__ */ c(() => x.options, "getOptions"), N = /* @__PURE__ */ c((a) => {
18
+ x.axes = a.map((t) => ({
19
+ name: t.name,
20
+ label: t.label ?? t.name
21
+ }));
22
+ }, "setAxes"), Y = /* @__PURE__ */ c((a) => {
23
+ x.curves = a.map((t) => ({
24
+ name: t.name,
25
+ label: t.label ?? t.name,
26
+ entries: Z(t.entries)
27
+ }));
28
+ }, "setCurves"), Z = /* @__PURE__ */ c((a) => {
29
+ if (a[0].axis == null)
30
+ return a.map((e) => e.value);
31
+ const t = M();
32
+ if (t.length === 0)
33
+ throw new Error("Axes must be populated before curves for reference entries");
34
+ return t.map((e) => {
35
+ const r = a.find((s) => {
36
+ var n;
37
+ return ((n = s.axis) == null ? void 0 : n.$refText) === e.name;
38
+ });
39
+ if (r === void 0)
40
+ throw new Error("Missing entry for axis " + e.label);
41
+ return r.value;
42
+ });
43
+ }, "computeCurveEntries"), J = /* @__PURE__ */ c((a) => {
44
+ var e, r, s, n, l;
45
+ const t = a.reduce(
46
+ (o, i) => (o[i.name] = i, o),
47
+ {}
48
+ );
49
+ x.options = {
50
+ showLegend: ((e = t.showLegend) == null ? void 0 : e.value) ?? m.showLegend,
51
+ ticks: ((r = t.ticks) == null ? void 0 : r.value) ?? m.ticks,
52
+ max: ((s = t.max) == null ? void 0 : s.value) ?? m.max,
53
+ min: ((n = t.min) == null ? void 0 : n.value) ?? m.min,
54
+ graticule: ((l = t.graticule) == null ? void 0 : l.value) ?? m.graticule
55
+ }, x.options.ticks > y && (b.warn(
56
+ `Radar diagram ticks (${x.options.ticks}) exceeds maximum allowed (${y}). Using ${y} instead.`
57
+ ), x.options.ticks = y);
58
+ }, "setOptions"), Q = /* @__PURE__ */ c(() => {
59
+ B(), x = structuredClone(A);
60
+ }, "clear"), $ = {
61
+ getAxes: M,
62
+ getCurves: X,
63
+ getOptions: q,
64
+ setAxes: N,
65
+ setCurves: Y,
66
+ setOptions: J,
67
+ getConfig: U,
68
+ clear: Q,
69
+ setAccTitle: P,
70
+ getAccTitle: G,
71
+ setDiagramTitle: D,
72
+ getDiagramTitle: F,
73
+ getAccDescription: E,
74
+ setAccDescription: _
75
+ }, tt = /* @__PURE__ */ c((a) => {
76
+ I(a, $);
77
+ const { axes: t, curves: e, options: r } = a;
78
+ $.setAxes(t), $.setCurves(e), $.setOptions(r);
79
+ }, "populate"), et = {
80
+ parse: /* @__PURE__ */ c(async (a) => {
81
+ const t = await j("radar", a);
82
+ b.debug(t), tt(t);
83
+ }, "parse")
84
+ }, at = /* @__PURE__ */ c((a, t, e, r) => {
85
+ const s = r.db, n = s.getAxes(), l = s.getCurves(), o = s.getOptions(), i = s.getConfig(), d = s.getDiagramTitle(), p = z(t), u = rt(p, i), g = o.max ?? Math.max(...l.map((f) => Math.max(...f.entries))), h = o.min, v = Math.min(i.width, i.height) / 2;
86
+ st(u, n, v, o.ticks, o.graticule), nt(u, n, v, i), L(u, n, l, h, g, o.graticule, i), k(u, l, o.showLegend, i), u.append("text").attr("class", "radarTitle").text(d).attr("x", 0).attr("y", -i.height / 2 - i.marginTop);
87
+ }, "draw"), rt = /* @__PURE__ */ c((a, t) => {
88
+ const e = t.width + t.marginLeft + t.marginRight, r = t.height + t.marginTop + t.marginBottom, s = {
89
+ x: t.marginLeft + t.width / 2,
90
+ y: t.marginTop + t.height / 2
91
+ };
92
+ return V(a, r, e, t.useMaxWidth ?? !0), a.attr("viewBox", `0 0 ${e} ${r}`).attr("overflow", "visible"), a.append("g").attr("transform", `translate(${s.x}, ${s.y})`);
93
+ }, "drawFrame"), st = /* @__PURE__ */ c((a, t, e, r, s) => {
94
+ if (s === "circle")
95
+ for (let n = 0; n < r; n++) {
96
+ const l = e * (n + 1) / r;
97
+ a.append("circle").attr("r", l).attr("class", "radarGraticule");
98
+ }
99
+ else if (s === "polygon") {
100
+ const n = t.length;
101
+ for (let l = 0; l < r; l++) {
102
+ const o = e * (l + 1) / r, i = t.map((d, p) => {
103
+ const u = 2 * p * Math.PI / n - Math.PI / 2, g = o * Math.cos(u), h = o * Math.sin(u);
104
+ return `${g},${h}`;
105
+ }).join(" ");
106
+ a.append("polygon").attr("points", i).attr("class", "radarGraticule");
107
+ }
108
+ }
109
+ }, "drawGraticule"), nt = /* @__PURE__ */ c((a, t, e, r) => {
110
+ const s = t.length;
111
+ for (let n = 0; n < s; n++) {
112
+ const l = t[n].label, o = 2 * n * Math.PI / s - Math.PI / 2, i = Math.cos(o), d = Math.sin(o);
113
+ a.append("line").attr("x1", 0).attr("y1", 0).attr("x2", e * r.axisScaleFactor * i).attr("y2", e * r.axisScaleFactor * d).attr("class", "radarAxisLine");
114
+ const p = i > 0.01 ? "start" : i < -0.01 ? "end" : "middle", u = d > 0.01 ? "hanging" : d < -0.01 ? "auto" : "central", g = 4;
115
+ a.append("text").text(l).attr("x", e * r.axisLabelFactor * i + g * i).attr("y", e * r.axisLabelFactor * d + g * d).attr("text-anchor", p).attr("dominant-baseline", u).attr("class", "radarAxisLabel");
116
+ }
117
+ }, "drawAxes");
118
+ function L(a, t, e, r, s, n, l) {
119
+ const o = t.length, i = Math.min(l.width, l.height) / 2;
120
+ e.forEach((d, p) => {
121
+ if (d.entries.length !== o)
122
+ return;
123
+ const u = d.entries.map((g, h) => {
124
+ const v = 2 * Math.PI * h / o - Math.PI / 2, f = T(g, r, s, i), O = f * Math.cos(v), R = f * Math.sin(v);
125
+ return { x: O, y: R };
126
+ });
127
+ n === "circle" ? a.append("path").attr("d", S(u, l.curveTension)).attr("class", `radarCurve-${p}`) : n === "polygon" && a.append("polygon").attr("points", u.map((g) => `${g.x},${g.y}`).join(" ")).attr("class", `radarCurve-${p}`);
128
+ });
129
+ }
130
+ c(L, "drawCurves");
131
+ function T(a, t, e, r) {
132
+ const s = Math.min(Math.max(a, t), e);
133
+ return r * (s - t) / (e - t);
134
+ }
135
+ c(T, "relativeRadius");
136
+ function S(a, t) {
137
+ const e = a.length;
138
+ let r = `M${a[0].x},${a[0].y}`;
139
+ for (let s = 0; s < e; s++) {
140
+ const n = a[(s - 1 + e) % e], l = a[s], o = a[(s + 1) % e], i = a[(s + 2) % e], d = {
141
+ x: l.x + (o.x - n.x) * t,
142
+ y: l.y + (o.y - n.y) * t
143
+ }, p = {
144
+ x: o.x - (i.x - l.x) * t,
145
+ y: o.y - (i.y - l.y) * t
146
+ };
147
+ r += ` C${d.x},${d.y} ${p.x},${p.y} ${o.x},${o.y}`;
148
+ }
149
+ return `${r} Z`;
150
+ }
151
+ c(S, "closedRoundCurve");
152
+ function k(a, t, e, r) {
153
+ if (!e)
154
+ return;
155
+ const s = (r.width / 2 + r.marginRight) * 3 / 4, n = -(r.height / 2 + r.marginTop) * 3 / 4, l = 20;
156
+ t.forEach((o, i) => {
157
+ const d = a.append("g").attr("transform", `translate(${s}, ${n + i * l})`);
158
+ d.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${i}`), d.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(o.label);
159
+ });
160
+ }
161
+ c(k, "drawLegend");
162
+ var ot = { draw: at }, it = /* @__PURE__ */ c((a, t) => {
163
+ let e = "";
164
+ for (let r = 0; r < a.THEME_COLOR_LIMIT; r++) {
165
+ const s = a[`cScale${r}`];
166
+ e += `
167
+ .radarCurve-${r} {
168
+ color: ${s};
169
+ fill: ${s};
170
+ fill-opacity: ${t.curveOpacity};
171
+ stroke: ${s};
172
+ stroke-width: ${t.curveStrokeWidth};
173
+ }
174
+ .radarLegendBox-${r} {
175
+ fill: ${s};
176
+ fill-opacity: ${t.curveOpacity};
177
+ stroke: ${s};
178
+ }
179
+ `;
180
+ }
181
+ return e;
182
+ }, "genIndexStyles"), lt = /* @__PURE__ */ c((a) => {
183
+ const t = H(), e = C(), r = w(t, e.themeVariables), s = w(r.radar, a);
184
+ return { themeVariables: r, radarOptions: s };
185
+ }, "buildRadarStyleOptions"), ct = /* @__PURE__ */ c(({ radar: a } = {}) => {
186
+ const { themeVariables: t, radarOptions: e } = lt(a);
187
+ return `
188
+ .radarTitle {
189
+ font-size: ${t.fontSize};
190
+ color: ${t.titleColor};
191
+ dominant-baseline: hanging;
192
+ text-anchor: middle;
193
+ }
194
+ .radarAxisLine {
195
+ stroke: ${e.axisColor};
196
+ stroke-width: ${e.axisStrokeWidth};
197
+ }
198
+ .radarAxisLabel {
199
+ font-size: ${e.axisLabelFontSize}px;
200
+ color: ${e.axisColor};
201
+ }
202
+ .radarGraticule {
203
+ fill: ${e.graticuleColor};
204
+ fill-opacity: ${e.graticuleOpacity};
205
+ stroke: ${e.graticuleColor};
206
+ stroke-width: ${e.graticuleStrokeWidth};
207
+ }
208
+ .radarLegendText {
209
+ text-anchor: start;
210
+ font-size: ${e.legendFontSize}px;
211
+ dominant-baseline: hanging;
212
+ }
213
+ ${it(t, e)}
214
+ `;
215
+ }, "styles"), gt = {
216
+ parser: et,
217
+ db: $,
218
+ renderer: ot,
219
+ styles: ct
220
+ };
221
+ export {
222
+ gt as diagram
223
+ };