schematex 0.6.5 → 0.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/ai-sdk.cjs +23 -23
- package/dist/ai/ai-sdk.d.cts +3 -3
- package/dist/ai/ai-sdk.d.ts +3 -3
- package/dist/ai/ai-sdk.js +18 -18
- package/dist/ai/index.cjs +29 -29
- package/dist/ai/index.d.cts +3 -3
- package/dist/ai/index.d.ts +3 -3
- package/dist/ai/index.js +18 -18
- package/dist/{api-BIqZjEDf.d.ts → api-DIJM_mqp.d.ts} +2 -2
- package/dist/{api-BXkOT7GL.d.cts → api-JaBtsUT8.d.cts} +2 -2
- package/dist/browser.cjs +24 -24
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +18 -18
- package/dist/{chunk-3C5DKCBJ.cjs → chunk-2SZJQVPN.cjs} +12 -12
- package/dist/{chunk-3C5DKCBJ.cjs.map → chunk-2SZJQVPN.cjs.map} +1 -1
- package/dist/{chunk-W3IXH6BN.cjs → chunk-34O3C6OC.cjs} +4 -4
- package/dist/chunk-34O3C6OC.cjs.map +1 -0
- package/dist/{chunk-RVHOCGHT.js → chunk-3GAPHXCE.js} +3 -3
- package/dist/{chunk-RVHOCGHT.js.map → chunk-3GAPHXCE.js.map} +1 -1
- package/dist/{chunk-HCBXTBFA.cjs → chunk-5FYPSIGD.cjs} +12 -12
- package/dist/{chunk-HCBXTBFA.cjs.map → chunk-5FYPSIGD.cjs.map} +1 -1
- package/dist/{chunk-B7ATOBL7.js → chunk-6NUAGU6O.js} +3 -3
- package/dist/{chunk-B7ATOBL7.js.map → chunk-6NUAGU6O.js.map} +1 -1
- package/dist/{chunk-WZ5QBGPZ.cjs → chunk-77GPD4YQ.cjs} +4 -4
- package/dist/{chunk-WZ5QBGPZ.cjs.map → chunk-77GPD4YQ.cjs.map} +1 -1
- package/dist/{chunk-S2CHBZ4A.cjs → chunk-BL57NQKN.cjs} +13 -13
- package/dist/{chunk-S2CHBZ4A.cjs.map → chunk-BL57NQKN.cjs.map} +1 -1
- package/dist/{chunk-EPKIJEH7.js → chunk-C7V57V6O.js} +54 -8
- package/dist/chunk-C7V57V6O.js.map +1 -0
- package/dist/{chunk-I6UJR4SG.cjs → chunk-DR3DDDQY.cjs} +4 -4
- package/dist/{chunk-I6UJR4SG.cjs.map → chunk-DR3DDDQY.cjs.map} +1 -1
- package/dist/{chunk-ZZHQBAC3.js → chunk-EVEPI423.js} +139 -5
- package/dist/chunk-EVEPI423.js.map +1 -0
- package/dist/{chunk-GV5QLYTW.js → chunk-HL5PS6MG.js} +3 -3
- package/dist/{chunk-GV5QLYTW.js.map → chunk-HL5PS6MG.js.map} +1 -1
- package/dist/{chunk-MKECYIWN.js → chunk-HPEAE3JM.js} +3 -3
- package/dist/{chunk-MKECYIWN.js.map → chunk-HPEAE3JM.js.map} +1 -1
- package/dist/{chunk-KPKGMOTS.js → chunk-JN6FHUC6.js} +3 -3
- package/dist/{chunk-KPKGMOTS.js.map → chunk-JN6FHUC6.js.map} +1 -1
- package/dist/{chunk-OANWVUBA.js → chunk-JTGTWBAD.js} +3 -3
- package/dist/chunk-JTGTWBAD.js.map +1 -0
- package/dist/{chunk-OHLNH7IO.js → chunk-K2D6VFLP.js} +3 -3
- package/dist/{chunk-OHLNH7IO.js.map → chunk-K2D6VFLP.js.map} +1 -1
- package/dist/{chunk-ZZFPXCAK.cjs → chunk-KGOZBABH.cjs} +12 -12
- package/dist/{chunk-ZZFPXCAK.cjs.map → chunk-KGOZBABH.cjs.map} +1 -1
- package/dist/{chunk-624UQ5R6.cjs → chunk-LDONE225.cjs} +1104 -442
- package/dist/chunk-LDONE225.cjs.map +1 -0
- package/dist/{chunk-XO7WW3I6.cjs → chunk-LPAWZYDU.cjs} +4 -4
- package/dist/{chunk-XO7WW3I6.cjs.map → chunk-LPAWZYDU.cjs.map} +1 -1
- package/dist/{chunk-IPEHLRTI.js → chunk-MPCSWRZC.js} +76 -14
- package/dist/chunk-MPCSWRZC.js.map +1 -0
- package/dist/{chunk-ROX5KEZM.cjs → chunk-NFZMNKOR.cjs} +15 -15
- package/dist/{chunk-ROX5KEZM.cjs.map → chunk-NFZMNKOR.cjs.map} +1 -1
- package/dist/{chunk-R5E2LSN2.cjs → chunk-NZT5P2XZ.cjs} +73 -2
- package/dist/chunk-NZT5P2XZ.cjs.map +1 -0
- package/dist/{chunk-GPC5BWLI.js → chunk-OFKRELZK.js} +3 -3
- package/dist/{chunk-GPC5BWLI.js.map → chunk-OFKRELZK.js.map} +1 -1
- package/dist/{chunk-XJJUJ2EF.cjs → chunk-QBS4F44Q.cjs} +517 -10
- package/dist/chunk-QBS4F44Q.cjs.map +1 -0
- package/dist/{chunk-SUIDD2C5.cjs → chunk-SHMG7BVF.cjs} +54 -8
- package/dist/chunk-SHMG7BVF.cjs.map +1 -0
- package/dist/{chunk-XEIVA2CT.js → chunk-T3FV73LM.js} +3 -3
- package/dist/{chunk-XEIVA2CT.js.map → chunk-T3FV73LM.js.map} +1 -1
- package/dist/{chunk-4THUHX2D.cjs → chunk-T5KHNJ67.cjs} +5 -5
- package/dist/{chunk-4THUHX2D.cjs.map → chunk-T5KHNJ67.cjs.map} +1 -1
- package/dist/{chunk-FXPOHPBE.cjs → chunk-TACTEF2N.cjs} +4 -4
- package/dist/{chunk-FXPOHPBE.cjs.map → chunk-TACTEF2N.cjs.map} +1 -1
- package/dist/{chunk-MI77LY6A.js → chunk-TRUJ4Q6V.js} +1044 -383
- package/dist/chunk-TRUJ4Q6V.js.map +1 -0
- package/dist/{chunk-BXNOXOE4.cjs → chunk-UHPGWO77.cjs} +77 -14
- package/dist/chunk-UHPGWO77.cjs.map +1 -0
- package/dist/{chunk-AORGFBEH.js → chunk-UK6HF6PE.js} +73 -3
- package/dist/chunk-UK6HF6PE.js.map +1 -0
- package/dist/{chunk-35XCP2E4.js → chunk-WAKRRGAV.js} +516 -10
- package/dist/chunk-WAKRRGAV.js.map +1 -0
- package/dist/{chunk-T3ZN5P32.cjs → chunk-WK36Z63Y.cjs} +141 -7
- package/dist/chunk-WK36Z63Y.cjs.map +1 -0
- package/dist/{chunk-LGFB4H5B.js → chunk-WU2N6ZVM.js} +3 -3
- package/dist/{chunk-LGFB4H5B.js.map → chunk-WU2N6ZVM.js.map} +1 -1
- package/dist/{chunk-FHZTWWI6.js → chunk-YMZTXOUG.js} +3 -3
- package/dist/{chunk-FHZTWWI6.js.map → chunk-YMZTXOUG.js.map} +1 -1
- package/dist/{chunk-XSPENTEG.js → chunk-YTGOLTLJ.js} +3 -3
- package/dist/{chunk-XSPENTEG.js.map → chunk-YTGOLTLJ.js.map} +1 -1
- package/dist/{chunk-VZO2SX6Q.cjs → chunk-Z3A2UNK2.cjs} +4 -4
- package/dist/{chunk-VZO2SX6Q.cjs.map → chunk-Z3A2UNK2.cjs.map} +1 -1
- package/dist/{diagnostics-CzHW0RCo.d.cts → diagnostics-BKRow1ur.d.cts} +15 -1
- package/dist/{diagnostics-CzHW0RCo.d.ts → diagnostics-BKRow1ur.d.ts} +15 -1
- package/dist/diagrams/blockdiagram/index.cjs +5 -5
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/blockdiagram/index.js +1 -1
- package/dist/diagrams/circuit/index.cjs +12 -8
- package/dist/diagrams/circuit/index.d.cts +13 -2
- package/dist/diagrams/circuit/index.d.ts +13 -2
- package/dist/diagrams/circuit/index.js +2 -2
- package/dist/diagrams/ecomap/index.cjs +7 -7
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/ecomap/index.js +2 -2
- package/dist/diagrams/entity/index.cjs +6 -6
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/entity/index.js +2 -2
- package/dist/diagrams/fishbone/index.cjs +8 -8
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.js +2 -2
- package/dist/diagrams/flowchart/index.cjs +8 -8
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/flowchart/index.js +2 -2
- package/dist/diagrams/genogram/index.cjs +9 -9
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/genogram/index.js +2 -2
- package/dist/diagrams/ladder/index.cjs +6 -6
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.js +2 -2
- package/dist/diagrams/logic/index.cjs +8 -8
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/logic/index.js +2 -2
- package/dist/diagrams/orgchart/index.cjs +11 -7
- package/dist/diagrams/orgchart/index.d.cts +27 -2
- package/dist/diagrams/orgchart/index.d.ts +27 -2
- package/dist/diagrams/orgchart/index.js +2 -2
- package/dist/diagrams/pedigree/index.cjs +7 -7
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.js +2 -2
- package/dist/diagrams/phylo/index.cjs +7 -7
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.js +2 -2
- package/dist/diagrams/sld/index.cjs +8 -8
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +2 -2
- package/dist/diagrams/sociogram/index.cjs +6 -6
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/sociogram/index.js +2 -2
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/venn/index.cjs +9 -9
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/diagrams/venn/index.js +2 -2
- package/dist/{index-R0IwpG20.d.cts → index-DU2h1Y-a.d.cts} +1 -1
- package/dist/{index-DdR1Auby.d.ts → index-Dq3Mfxay.d.ts} +1 -1
- package/dist/index.cjs +79 -75
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +22 -22
- package/dist/react.cjs +18 -18
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +17 -17
- package/dist/{tools-B7EqXLgD.d.ts → tools-A0HRZ8jj.d.ts} +11 -2
- package/dist/{tools-DHSVXHM9.d.cts → tools-OzOQnlnV.d.cts} +11 -2
- package/package.json +1 -1
- package/dist/chunk-35XCP2E4.js.map +0 -1
- package/dist/chunk-624UQ5R6.cjs.map +0 -1
- package/dist/chunk-AORGFBEH.js.map +0 -1
- package/dist/chunk-BXNOXOE4.cjs.map +0 -1
- package/dist/chunk-EPKIJEH7.js.map +0 -1
- package/dist/chunk-IPEHLRTI.js.map +0 -1
- package/dist/chunk-MI77LY6A.js.map +0 -1
- package/dist/chunk-OANWVUBA.js.map +0 -1
- package/dist/chunk-R5E2LSN2.cjs.map +0 -1
- package/dist/chunk-SUIDD2C5.cjs.map +0 -1
- package/dist/chunk-T3ZN5P32.cjs.map +0 -1
- package/dist/chunk-W3IXH6BN.cjs.map +0 -1
- package/dist/chunk-XJJUJ2EF.cjs.map +0 -1
- package/dist/chunk-ZZHQBAC3.js.map +0 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
14
|
-
var
|
|
3
|
+
var chunkUHPGWO77_cjs = require('./chunk-UHPGWO77.cjs');
|
|
4
|
+
var chunkQBS4F44Q_cjs = require('./chunk-QBS4F44Q.cjs');
|
|
5
|
+
var chunkSHMG7BVF_cjs = require('./chunk-SHMG7BVF.cjs');
|
|
6
|
+
var chunkTACTEF2N_cjs = require('./chunk-TACTEF2N.cjs');
|
|
7
|
+
var chunk34O3C6OC_cjs = require('./chunk-34O3C6OC.cjs');
|
|
8
|
+
var chunk77GPD4YQ_cjs = require('./chunk-77GPD4YQ.cjs');
|
|
9
|
+
var chunkT5KHNJ67_cjs = require('./chunk-T5KHNJ67.cjs');
|
|
10
|
+
var chunkLPAWZYDU_cjs = require('./chunk-LPAWZYDU.cjs');
|
|
11
|
+
var chunkDR3DDDQY_cjs = require('./chunk-DR3DDDQY.cjs');
|
|
12
|
+
var chunkNFZMNKOR_cjs = require('./chunk-NFZMNKOR.cjs');
|
|
13
|
+
var chunk2SZJQVPN_cjs = require('./chunk-2SZJQVPN.cjs');
|
|
14
|
+
var chunkKGOZBABH_cjs = require('./chunk-KGOZBABH.cjs');
|
|
15
15
|
var chunk3KRL2EGN_cjs = require('./chunk-3KRL2EGN.cjs');
|
|
16
|
-
var
|
|
17
|
-
var
|
|
16
|
+
var chunkBL57NQKN_cjs = require('./chunk-BL57NQKN.cjs');
|
|
17
|
+
var chunk5FYPSIGD_cjs = require('./chunk-5FYPSIGD.cjs');
|
|
18
18
|
var chunk2F45Y2ON_cjs = require('./chunk-2F45Y2ON.cjs');
|
|
19
|
-
var
|
|
20
|
-
var
|
|
19
|
+
var chunkZ3A2UNK2_cjs = require('./chunk-Z3A2UNK2.cjs');
|
|
20
|
+
var chunkNZT5P2XZ_cjs = require('./chunk-NZT5P2XZ.cjs');
|
|
21
21
|
var chunkNAGUZFXX_cjs = require('./chunk-NAGUZFXX.cjs');
|
|
22
22
|
var chunk3WNW5Y7P_cjs = require('./chunk-3WNW5Y7P.cjs');
|
|
23
23
|
|
|
@@ -1080,7 +1080,7 @@ function wrapText(text2, maxChars) {
|
|
|
1080
1080
|
return lines.slice(0, 2);
|
|
1081
1081
|
}
|
|
1082
1082
|
function renderDecisionTree(ast, config) {
|
|
1083
|
-
const t =
|
|
1083
|
+
const t = chunkNZT5P2XZ_cjs.resolveBaseTheme(config?.theme ?? "default");
|
|
1084
1084
|
const layout = layoutDecisionTree(ast);
|
|
1085
1085
|
const titleOffset = ast.title ? 36 : 10;
|
|
1086
1086
|
const width = Math.ceil(layout.width);
|
|
@@ -2153,7 +2153,7 @@ var ERA_ROW_GAP = 2;
|
|
|
2153
2153
|
function renderTimeline(src, config) {
|
|
2154
2154
|
const ast = parseTimeline(src);
|
|
2155
2155
|
const layout = layoutTimeline(ast);
|
|
2156
|
-
const theme =
|
|
2156
|
+
const theme = chunkNZT5P2XZ_cjs.resolveTimelineTheme(config?.theme ?? "default");
|
|
2157
2157
|
const styleBlock = styleForTheme(theme, config?.fontFamily);
|
|
2158
2158
|
const children = [
|
|
2159
2159
|
chunk3WNW5Y7P_cjs.title(ast.title ? `Timeline \u2014 ${ast.title}` : "Timeline"),
|
|
@@ -2198,7 +2198,7 @@ function renderTimeline(src, config) {
|
|
|
2198
2198
|
function styleForTheme(theme, fontFamily) {
|
|
2199
2199
|
const font = fontFamily ?? "system-ui, -apple-system, sans-serif";
|
|
2200
2200
|
return `
|
|
2201
|
-
.st-timeline { ${
|
|
2201
|
+
.st-timeline { ${chunkNZT5P2XZ_cjs.cssCustomProperties(theme)}
|
|
2202
2202
|
--st-axis: ${theme.axis};
|
|
2203
2203
|
--st-axis-label: ${theme.axisLabel};
|
|
2204
2204
|
--st-era-label: ${theme.eraLabel};
|
|
@@ -2259,8 +2259,8 @@ function renderEras(layout, theme) {
|
|
|
2259
2259
|
layout.eras.forEach((e, i) => {
|
|
2260
2260
|
const l = leftmostOnRow.get(e.bandRow);
|
|
2261
2261
|
if (l === void 0 || e.x < layout.eras[l].x) leftmostOnRow.set(e.bandRow, i);
|
|
2262
|
-
const
|
|
2263
|
-
if (
|
|
2262
|
+
const r5 = rightmostOnRow.get(e.bandRow);
|
|
2263
|
+
if (r5 === void 0 || e.x + e.width > layout.eras[r5].x + layout.eras[r5].width) rightmostOnRow.set(e.bandRow, i);
|
|
2264
2264
|
});
|
|
2265
2265
|
const plotEnd = layout.plotX + layout.plotW;
|
|
2266
2266
|
const items = layout.eras.map((e, i) => {
|
|
@@ -2386,20 +2386,20 @@ function renderSwimlanePoints(layout, theme) {
|
|
|
2386
2386
|
function renderMarker(ev, color, shape, isMilestone) {
|
|
2387
2387
|
const x = ev.x;
|
|
2388
2388
|
const y = ev.y;
|
|
2389
|
-
const
|
|
2389
|
+
const r5 = isMilestone ? 8 : 5;
|
|
2390
2390
|
const klass = isMilestone ? "st-milestone" : "st-event-dot";
|
|
2391
2391
|
switch (shape) {
|
|
2392
2392
|
case "square":
|
|
2393
|
-
return chunk3WNW5Y7P_cjs.rect({ x: x -
|
|
2393
|
+
return chunk3WNW5Y7P_cjs.rect({ x: x - r5, y: y - r5, width: r5 * 2, height: r5 * 2, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2394
2394
|
case "diamond":
|
|
2395
|
-
return chunk3WNW5Y7P_cjs.path({ d: `M ${x},${y -
|
|
2395
|
+
return chunk3WNW5Y7P_cjs.path({ d: `M ${x},${y - r5} L ${x + r5},${y} L ${x},${y + r5} L ${x - r5},${y} Z`, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2396
2396
|
case "star":
|
|
2397
|
-
return chunk3WNW5Y7P_cjs.path({ d: starPath(x, y,
|
|
2397
|
+
return chunk3WNW5Y7P_cjs.path({ d: starPath(x, y, r5 + 2, (r5 + 2) / 2.5, 5), fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2398
2398
|
case "flag":
|
|
2399
|
-
return chunk3WNW5Y7P_cjs.path({ d: `M ${x -
|
|
2399
|
+
return chunk3WNW5Y7P_cjs.path({ d: `M ${x - r5},${y + r5} L ${x - r5},${y - r5 - 4} L ${x + r5 + 4},${y - r5 - 1} L ${x - r5},${y + 2}`, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2400
2400
|
case "circle":
|
|
2401
2401
|
default:
|
|
2402
|
-
return chunk3WNW5Y7P_cjs.circle({ cx: x, cy: y, r:
|
|
2402
|
+
return chunk3WNW5Y7P_cjs.circle({ cx: x, cy: y, r: r5, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2403
2403
|
}
|
|
2404
2404
|
}
|
|
2405
2405
|
function renderLabels(layout) {
|
|
@@ -2655,10 +2655,10 @@ function starPath(cx, cy, rOuter, rInner, points) {
|
|
|
2655
2655
|
const step = Math.PI / points;
|
|
2656
2656
|
let d = "";
|
|
2657
2657
|
for (let i = 0; i < points * 2; i++) {
|
|
2658
|
-
const
|
|
2658
|
+
const r5 = i % 2 === 0 ? rOuter : rInner;
|
|
2659
2659
|
const a = i * step - Math.PI / 2;
|
|
2660
|
-
const x = cx +
|
|
2661
|
-
const y = cy +
|
|
2660
|
+
const x = cx + r5 * Math.cos(a);
|
|
2661
|
+
const y = cy + r5 * Math.sin(a);
|
|
2662
2662
|
d += (i === 0 ? "M" : "L") + x.toFixed(2) + "," + y.toFixed(2) + " ";
|
|
2663
2663
|
}
|
|
2664
2664
|
return d + "Z";
|
|
@@ -2929,7 +2929,7 @@ function parseStateDiagram(src) {
|
|
|
2929
2929
|
}
|
|
2930
2930
|
ctxTop.regionMode = true;
|
|
2931
2931
|
if (!parent.regions) parent.regions = [];
|
|
2932
|
-
const lastIdx = parent.regions.reduce((s,
|
|
2932
|
+
const lastIdx = parent.regions.reduce((s, r5) => s + r5.length, 0);
|
|
2933
2933
|
const slice = parent.children.slice(lastIdx);
|
|
2934
2934
|
parent.regions.push(slice);
|
|
2935
2935
|
i++;
|
|
@@ -3133,7 +3133,7 @@ function parseStateDiagram(src) {
|
|
|
3133
3133
|
}
|
|
3134
3134
|
function finalizeRegions(node) {
|
|
3135
3135
|
if (node.regions) {
|
|
3136
|
-
const consumed = node.regions.reduce((s,
|
|
3136
|
+
const consumed = node.regions.reduce((s, r5) => s + r5.length, 0);
|
|
3137
3137
|
if (node.children.length > consumed) {
|
|
3138
3138
|
node.regions.push(node.children.slice(consumed));
|
|
3139
3139
|
}
|
|
@@ -3334,7 +3334,7 @@ function layoutStateDiagram(ast) {
|
|
|
3334
3334
|
}
|
|
3335
3335
|
return true;
|
|
3336
3336
|
});
|
|
3337
|
-
const fcResult =
|
|
3337
|
+
const fcResult = chunkDR3DDDQY_cjs.layoutFlowchart(fcAst);
|
|
3338
3338
|
const stateById = /* @__PURE__ */ new Map();
|
|
3339
3339
|
const collectStates = (s) => {
|
|
3340
3340
|
stateById.set(s.id, s);
|
|
@@ -3578,33 +3578,33 @@ function pointsToPath(pts) {
|
|
|
3578
3578
|
const rest = pts.slice(1).map((p) => `L ${p.x} ${p.y}`).join(" ");
|
|
3579
3579
|
return rest ? `${head} ${rest}` : head;
|
|
3580
3580
|
}
|
|
3581
|
-
function trimPathStart(d, cx, cy,
|
|
3581
|
+
function trimPathStart(d, cx, cy, r5) {
|
|
3582
3582
|
const pts = parsePathPoints(d);
|
|
3583
3583
|
if (!pts || pts.length < 2) return d;
|
|
3584
3584
|
const p0 = pts[0];
|
|
3585
3585
|
const p1 = pts[1];
|
|
3586
|
-
const newP0 = projectOnPerimeter(p0, p1, cx, cy,
|
|
3586
|
+
const newP0 = projectOnPerimeter(p0, p1, cx, cy, r5);
|
|
3587
3587
|
pts[0] = newP0;
|
|
3588
3588
|
return pointsToPath(pts);
|
|
3589
3589
|
}
|
|
3590
|
-
function trimPathEnd(d, cx, cy,
|
|
3590
|
+
function trimPathEnd(d, cx, cy, r5) {
|
|
3591
3591
|
const pts = parsePathPoints(d);
|
|
3592
3592
|
if (!pts || pts.length < 2) return d;
|
|
3593
3593
|
const last = pts[pts.length - 1];
|
|
3594
3594
|
const prev = pts[pts.length - 2];
|
|
3595
|
-
const newLast = projectOnPerimeter(last, prev, cx, cy,
|
|
3595
|
+
const newLast = projectOnPerimeter(last, prev, cx, cy, r5);
|
|
3596
3596
|
pts[pts.length - 1] = newLast;
|
|
3597
3597
|
return pointsToPath(pts);
|
|
3598
3598
|
}
|
|
3599
|
-
function projectOnPerimeter(endpoint, neighbor, cx, cy,
|
|
3599
|
+
function projectOnPerimeter(endpoint, neighbor, cx, cy, r5) {
|
|
3600
3600
|
const dx = endpoint.x - neighbor.x;
|
|
3601
3601
|
const dy = endpoint.y - neighbor.y;
|
|
3602
3602
|
if (Math.abs(dx) > Math.abs(dy)) {
|
|
3603
3603
|
const sign2 = dx >= 0 ? 1 : -1;
|
|
3604
|
-
return { x: cx - sign2 *
|
|
3604
|
+
return { x: cx - sign2 * r5, y: cy };
|
|
3605
3605
|
}
|
|
3606
3606
|
const sign = dy >= 0 ? 1 : -1;
|
|
3607
|
-
return { x: cx, y: cy - sign *
|
|
3607
|
+
return { x: cx, y: cy - sign * r5 };
|
|
3608
3608
|
}
|
|
3609
3609
|
function shiftPathX(d, dx) {
|
|
3610
3610
|
return d.replace(/([MLCQ])\s*((?:-?\d+(?:\.\d+)?\s+){1,5}-?\d+(?:\.\d+)?)/g, (_, cmd, args) => {
|
|
@@ -3780,12 +3780,12 @@ function renderPseudo(node) {
|
|
|
3780
3780
|
]
|
|
3781
3781
|
);
|
|
3782
3782
|
case "choice": {
|
|
3783
|
-
const
|
|
3783
|
+
const r5 = 14;
|
|
3784
3784
|
return chunk3WNW5Y7P_cjs.group(
|
|
3785
3785
|
{ class: "lt-state lt-pseudo", "data-id": node.id, "data-kind": "choice" },
|
|
3786
3786
|
[
|
|
3787
3787
|
chunk3WNW5Y7P_cjs.polygon({
|
|
3788
|
-
points: `${cx},${cy -
|
|
3788
|
+
points: `${cx},${cy - r5} ${cx + r5},${cy} ${cx},${cy + r5} ${cx - r5},${cy}`,
|
|
3789
3789
|
class: "lt-ps-choice"
|
|
3790
3790
|
})
|
|
3791
3791
|
]
|
|
@@ -4783,27 +4783,27 @@ function renderEquip(type, label, rawType) {
|
|
|
4783
4783
|
]);
|
|
4784
4784
|
}
|
|
4785
4785
|
case "pump_centrifugal": {
|
|
4786
|
-
const
|
|
4786
|
+
const r5 = 22;
|
|
4787
4787
|
return chunk3WNW5Y7P_cjs.group({}, [
|
|
4788
|
-
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
4788
|
+
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r5, class: "lt-pid-equip" }),
|
|
4789
4789
|
chunk3WNW5Y7P_cjs.polygon({
|
|
4790
|
-
points: `${
|
|
4790
|
+
points: `${r5 * 0.4},${-r5 * 0.9} ${r5 + 6},${-r5 * 0.9} ${r5 * 0.4},${0}`,
|
|
4791
4791
|
class: "lt-pid-equip"
|
|
4792
4792
|
}),
|
|
4793
4793
|
chunk3WNW5Y7P_cjs.text(
|
|
4794
|
-
{ x: 0, y:
|
|
4794
|
+
{ x: 0, y: r5 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
|
|
4795
4795
|
label
|
|
4796
4796
|
)
|
|
4797
4797
|
]);
|
|
4798
4798
|
}
|
|
4799
4799
|
case "pump_pd": {
|
|
4800
|
-
const
|
|
4800
|
+
const r5 = 22;
|
|
4801
4801
|
return chunk3WNW5Y7P_cjs.group({}, [
|
|
4802
|
-
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
4802
|
+
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r5, class: "lt-pid-equip" }),
|
|
4803
4803
|
chunk3WNW5Y7P_cjs.circle({ cx: -8, cy: 0, r: 6, class: "lt-pid-tray-line", fill: "none" }),
|
|
4804
4804
|
chunk3WNW5Y7P_cjs.circle({ cx: 8, cy: 0, r: 6, class: "lt-pid-tray-line", fill: "none" }),
|
|
4805
4805
|
chunk3WNW5Y7P_cjs.text(
|
|
4806
|
-
{ x: 0, y:
|
|
4806
|
+
{ x: 0, y: r5 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
|
|
4807
4807
|
label
|
|
4808
4808
|
)
|
|
4809
4809
|
]);
|
|
@@ -4818,14 +4818,14 @@ function renderEquip(type, label, rawType) {
|
|
|
4818
4818
|
]);
|
|
4819
4819
|
}
|
|
4820
4820
|
case "blower": {
|
|
4821
|
-
const
|
|
4821
|
+
const r5 = 22;
|
|
4822
4822
|
return chunk3WNW5Y7P_cjs.group({}, [
|
|
4823
|
-
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
4823
|
+
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r5, class: "lt-pid-equip" }),
|
|
4824
4824
|
chunk3WNW5Y7P_cjs.path({
|
|
4825
|
-
d: `M 0 0 L ${
|
|
4825
|
+
d: `M 0 0 L ${r5 * 0.8} ${-r5 * 0.5} M 0 0 L ${-r5 * 0.6} ${-r5 * 0.6} M 0 0 L 0 ${r5 * 0.8}`,
|
|
4826
4826
|
class: "lt-pid-tray-line"
|
|
4827
4827
|
}),
|
|
4828
|
-
chunk3WNW5Y7P_cjs.text({ x: 0, y:
|
|
4828
|
+
chunk3WNW5Y7P_cjs.text({ x: 0, y: r5 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" }, label)
|
|
4829
4829
|
]);
|
|
4830
4830
|
}
|
|
4831
4831
|
case "reactor_cstr": {
|
|
@@ -5001,7 +5001,7 @@ function renderEquip(type, label, rawType) {
|
|
|
5001
5001
|
}
|
|
5002
5002
|
}
|
|
5003
5003
|
function renderInstrument(category, letterCode, loopNumber) {
|
|
5004
|
-
const
|
|
5004
|
+
const r5 = 14;
|
|
5005
5005
|
const isComputer = category.endsWith("computer");
|
|
5006
5006
|
const isPlc = category.endsWith("plc");
|
|
5007
5007
|
const isShared = category.endsWith("shared");
|
|
@@ -5009,17 +5009,17 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5009
5009
|
const isLocal = category.startsWith("local_");
|
|
5010
5010
|
const parts = [];
|
|
5011
5011
|
if (isComputer) {
|
|
5012
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5012
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r5, class: "lt-inst-body" }));
|
|
5013
5013
|
parts.push(
|
|
5014
5014
|
chunk3WNW5Y7P_cjs.polygon({
|
|
5015
|
-
points: `0,${-
|
|
5015
|
+
points: `0,${-r5 + 1} ${r5 - 1},0 0,${r5 - 1} ${ -13},0`,
|
|
5016
5016
|
class: "lt-inst-body",
|
|
5017
5017
|
fill: "none"
|
|
5018
5018
|
})
|
|
5019
5019
|
);
|
|
5020
5020
|
} else if (isPlc) {
|
|
5021
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5022
|
-
const side =
|
|
5021
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r5, class: "lt-inst-body" }));
|
|
5022
|
+
const side = r5 * Math.SQRT1_2 * 2 - 2;
|
|
5023
5023
|
parts.push(
|
|
5024
5024
|
chunk3WNW5Y7P_cjs.rect({
|
|
5025
5025
|
x: -side / 2,
|
|
@@ -5031,11 +5031,11 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5031
5031
|
})
|
|
5032
5032
|
);
|
|
5033
5033
|
} else if (isShared) {
|
|
5034
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5034
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r5, class: "lt-inst-body" }));
|
|
5035
5035
|
const hex = [];
|
|
5036
5036
|
for (let i = 0; i < 6; i++) {
|
|
5037
5037
|
const a = Math.PI / 3 * i - Math.PI / 2;
|
|
5038
|
-
hex.push(`${(
|
|
5038
|
+
hex.push(`${(r5 - 2) * Math.cos(a)},${(r5 - 2) * Math.sin(a)}`);
|
|
5039
5039
|
}
|
|
5040
5040
|
parts.push(
|
|
5041
5041
|
chunk3WNW5Y7P_cjs.polygon({
|
|
@@ -5045,12 +5045,12 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5045
5045
|
})
|
|
5046
5046
|
);
|
|
5047
5047
|
} else {
|
|
5048
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5048
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r5, class: "lt-inst-body" }));
|
|
5049
5049
|
}
|
|
5050
5050
|
if (isControlRoom) {
|
|
5051
|
-
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -
|
|
5051
|
+
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r5, y1: 0, x2: r5, y2: 0, class: "lt-inst-cr-line" }));
|
|
5052
5052
|
} else if (isLocal) {
|
|
5053
|
-
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -
|
|
5053
|
+
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r5, y1: 0, x2: r5, y2: 0, class: "lt-inst-local-line" }));
|
|
5054
5054
|
}
|
|
5055
5055
|
parts.push(
|
|
5056
5056
|
chunk3WNW5Y7P_cjs.text(
|
|
@@ -5758,19 +5758,19 @@ function readScalar(map, key) {
|
|
|
5758
5758
|
return { value, line: entry.header.line };
|
|
5759
5759
|
}
|
|
5760
5760
|
function readInt(map, key) {
|
|
5761
|
-
const
|
|
5762
|
-
if (
|
|
5763
|
-
return parseInt10(
|
|
5761
|
+
const r5 = readScalar(map, key);
|
|
5762
|
+
if (r5 === void 0) return void 0;
|
|
5763
|
+
return parseInt10(r5.value, r5.line);
|
|
5764
5764
|
}
|
|
5765
5765
|
function readSources(map, key) {
|
|
5766
|
-
const
|
|
5767
|
-
if (
|
|
5768
|
-
return parsePairs(
|
|
5766
|
+
const r5 = readScalar(map, key);
|
|
5767
|
+
if (r5 === void 0) return void 0;
|
|
5768
|
+
return parsePairs(r5.value, r5.line);
|
|
5769
5769
|
}
|
|
5770
5770
|
function readReasons(map, key) {
|
|
5771
|
-
const
|
|
5772
|
-
if (
|
|
5773
|
-
return parsePairs(
|
|
5771
|
+
const r5 = readScalar(map, key);
|
|
5772
|
+
if (r5 === void 0) return void 0;
|
|
5773
|
+
return parsePairs(r5.value, r5.line);
|
|
5774
5774
|
}
|
|
5775
5775
|
function readBlock(map, key) {
|
|
5776
5776
|
const entry = map.get(key);
|
|
@@ -6098,7 +6098,7 @@ function runArithmeticValidation(ast) {
|
|
|
6098
6098
|
}
|
|
6099
6099
|
}
|
|
6100
6100
|
if (ast.screening.excluded.reasons && ast.screening.excluded.reasons.length > 0) {
|
|
6101
|
-
const sum = ast.screening.excluded.reasons.reduce((a,
|
|
6101
|
+
const sum = ast.screening.excluded.reasons.reduce((a, r5) => a + r5.count, 0);
|
|
6102
6102
|
if (sum !== screenedExcluded) {
|
|
6103
6103
|
issues.push(
|
|
6104
6104
|
`screening.excluded reasons sum to ${formatN(sum)} but n = ${formatN(screenedExcluded)}`
|
|
@@ -6106,7 +6106,7 @@ function runArithmeticValidation(ast) {
|
|
|
6106
6106
|
}
|
|
6107
6107
|
}
|
|
6108
6108
|
if (ast.eligibility.excluded.reasons && ast.eligibility.excluded.reasons.length > 0) {
|
|
6109
|
-
const sum = ast.eligibility.excluded.reasons.reduce((a,
|
|
6109
|
+
const sum = ast.eligibility.excluded.reasons.reduce((a, r5) => a + r5.count, 0);
|
|
6110
6110
|
if (sum !== eligExcluded) {
|
|
6111
6111
|
issues.push(
|
|
6112
6112
|
`eligibility.excluded reasons sum to ${formatN(sum)} but n = ${formatN(eligExcluded)}`
|
|
@@ -6199,7 +6199,7 @@ function aggregateReasons(reasons) {
|
|
|
6199
6199
|
const sorted = [...reasons].sort((a, b) => b.count - a.count);
|
|
6200
6200
|
const head = sorted.slice(0, PRISMA_CONST.MAX_REASON_LINES - 1);
|
|
6201
6201
|
const tail = sorted.slice(PRISMA_CONST.MAX_REASON_LINES - 1);
|
|
6202
|
-
const otherSum = tail.reduce((a,
|
|
6202
|
+
const otherSum = tail.reduce((a, r5) => a + r5.count, 0);
|
|
6203
6203
|
return {
|
|
6204
6204
|
lines: [...head, { name: `Other (${tail.length} reasons)`, count: otherSum }],
|
|
6205
6205
|
truncated: tail.length
|
|
@@ -6256,8 +6256,8 @@ function buildIdentificationRemovedBox(id, kind) {
|
|
|
6256
6256
|
}
|
|
6257
6257
|
if (removed.length === 0) return null;
|
|
6258
6258
|
const lines = [{ text: v.recordsRemovedLabel, style: "label" }];
|
|
6259
|
-
for (const
|
|
6260
|
-
lines.push({ text:
|
|
6259
|
+
for (const r5 of removed) {
|
|
6260
|
+
lines.push({ text: r5, style: "reason", indent: 1 });
|
|
6261
6261
|
}
|
|
6262
6262
|
return {
|
|
6263
6263
|
role: "id-removed",
|
|
@@ -6313,8 +6313,8 @@ function buildScreeningExcludedBox(n, reasons, kind) {
|
|
|
6313
6313
|
{ text: v.recordsExcluded, style: "label" },
|
|
6314
6314
|
{ text: `n = ${nFmt(n)}`, style: "count" }
|
|
6315
6315
|
];
|
|
6316
|
-
for (const
|
|
6317
|
-
out.push({ text: `${
|
|
6316
|
+
for (const r5 of items) {
|
|
6317
|
+
out.push({ text: `${r5.name} (n = ${nFmt(r5.count)})`, style: "reason", indent: 1 });
|
|
6318
6318
|
}
|
|
6319
6319
|
return {
|
|
6320
6320
|
role: "screening-excluded",
|
|
@@ -6344,8 +6344,8 @@ function buildEligibilityExcludedBox(n, reasons, kind) {
|
|
|
6344
6344
|
{ text: v.reportsExcluded, style: "label" },
|
|
6345
6345
|
{ text: `n = ${nFmt(n)}`, style: "count" }
|
|
6346
6346
|
];
|
|
6347
|
-
for (const
|
|
6348
|
-
out.push({ text: `${
|
|
6347
|
+
for (const r5 of items) {
|
|
6348
|
+
out.push({ text: `${r5.name} (n = ${nFmt(r5.count)})`, style: "reason", indent: 1 });
|
|
6349
6349
|
}
|
|
6350
6350
|
return {
|
|
6351
6351
|
role: "eligibility-excluded",
|
|
@@ -6946,7 +6946,7 @@ function classForEdge(kind) {
|
|
|
6946
6946
|
}
|
|
6947
6947
|
}
|
|
6948
6948
|
function renderBand(band) {
|
|
6949
|
-
const
|
|
6949
|
+
const r5 = chunk3WNW5Y7P_cjs.rect({
|
|
6950
6950
|
x: band.x,
|
|
6951
6951
|
y: band.y,
|
|
6952
6952
|
width: band.width,
|
|
@@ -6969,10 +6969,10 @@ function renderBand(band) {
|
|
|
6969
6969
|
},
|
|
6970
6970
|
band.label
|
|
6971
6971
|
);
|
|
6972
|
-
return chunk3WNW5Y7P_cjs.group({ "data-band": band.stage }, [
|
|
6972
|
+
return chunk3WNW5Y7P_cjs.group({ "data-band": band.stage }, [r5, txt]);
|
|
6973
6973
|
}
|
|
6974
6974
|
function renderHeader(h) {
|
|
6975
|
-
const
|
|
6975
|
+
const r5 = chunk3WNW5Y7P_cjs.rect({
|
|
6976
6976
|
x: h.x,
|
|
6977
6977
|
y: h.y,
|
|
6978
6978
|
width: h.width,
|
|
@@ -6997,10 +6997,10 @@ function renderHeader(h) {
|
|
|
6997
6997
|
ln
|
|
6998
6998
|
)
|
|
6999
6999
|
);
|
|
7000
|
-
return chunk3WNW5Y7P_cjs.group({ "data-header": h.column }, [
|
|
7000
|
+
return chunk3WNW5Y7P_cjs.group({ "data-header": h.column }, [r5, ...lines]);
|
|
7001
7001
|
}
|
|
7002
7002
|
function renderBox(box) {
|
|
7003
|
-
const
|
|
7003
|
+
const r5 = chunk3WNW5Y7P_cjs.rect({
|
|
7004
7004
|
x: box.x,
|
|
7005
7005
|
y: box.y,
|
|
7006
7006
|
width: box.width,
|
|
@@ -7058,7 +7058,7 @@ function renderBox(box) {
|
|
|
7058
7058
|
"data-prisma-variant": box.variant,
|
|
7059
7059
|
"data-prisma-stage": box.stage
|
|
7060
7060
|
},
|
|
7061
|
-
[
|
|
7061
|
+
[r5, ...textEls]
|
|
7062
7062
|
);
|
|
7063
7063
|
}
|
|
7064
7064
|
function approxLineWidth(line2) {
|
|
@@ -7066,7 +7066,7 @@ function approxLineWidth(line2) {
|
|
|
7066
7066
|
return line2.text.length * charW;
|
|
7067
7067
|
}
|
|
7068
7068
|
function renderPrismaLayout(layout, config) {
|
|
7069
|
-
const t =
|
|
7069
|
+
const t = chunkNZT5P2XZ_cjs.resolveBaseTheme(config?.theme ?? "default");
|
|
7070
7070
|
const children = [];
|
|
7071
7071
|
children.push(chunk3WNW5Y7P_cjs.title(layout.title ?? "PRISMA 2020 flow diagram"));
|
|
7072
7072
|
children.push(
|
|
@@ -7767,14 +7767,14 @@ function sizeEllipse(uc) {
|
|
|
7767
7767
|
}
|
|
7768
7768
|
function buildDeepEdges(ast, ucIds) {
|
|
7769
7769
|
const edges = [];
|
|
7770
|
-
for (const
|
|
7771
|
-
if (!ucIds.has(
|
|
7772
|
-
if (
|
|
7773
|
-
edges.push({ from:
|
|
7774
|
-
} else if (
|
|
7775
|
-
edges.push({ from:
|
|
7776
|
-
} else if (
|
|
7777
|
-
edges.push({ from:
|
|
7770
|
+
for (const r5 of ast.relations) {
|
|
7771
|
+
if (!ucIds.has(r5.source) || !ucIds.has(r5.target)) continue;
|
|
7772
|
+
if (r5.kind === "include") {
|
|
7773
|
+
edges.push({ from: r5.source, to: r5.target });
|
|
7774
|
+
} else if (r5.kind === "extend") {
|
|
7775
|
+
edges.push({ from: r5.target, to: r5.source });
|
|
7776
|
+
} else if (r5.kind === "generalization") {
|
|
7777
|
+
edges.push({ from: r5.source, to: r5.target });
|
|
7778
7778
|
}
|
|
7779
7779
|
}
|
|
7780
7780
|
return edges;
|
|
@@ -7802,15 +7802,15 @@ function classifyActorSides(ast) {
|
|
|
7802
7802
|
ast.actors.forEach((a, i) => idx.set(a.id, i));
|
|
7803
7803
|
const parent = /* @__PURE__ */ new Map();
|
|
7804
7804
|
const find = (x) => {
|
|
7805
|
-
let
|
|
7806
|
-
while ((parent.get(
|
|
7805
|
+
let r5 = x;
|
|
7806
|
+
while ((parent.get(r5) ?? r5) !== r5) r5 = parent.get(r5) ?? r5;
|
|
7807
7807
|
let c = x;
|
|
7808
7808
|
while ((parent.get(c) ?? c) !== c) {
|
|
7809
7809
|
const next = parent.get(c) ?? c;
|
|
7810
|
-
parent.set(c,
|
|
7810
|
+
parent.set(c, r5);
|
|
7811
7811
|
c = next;
|
|
7812
7812
|
}
|
|
7813
|
-
return
|
|
7813
|
+
return r5;
|
|
7814
7814
|
};
|
|
7815
7815
|
const union = (a, b) => {
|
|
7816
7816
|
const ra = find(a);
|
|
@@ -7820,9 +7820,9 @@ function classifyActorSides(ast) {
|
|
|
7820
7820
|
else parent.set(ra, rb);
|
|
7821
7821
|
};
|
|
7822
7822
|
for (const a of ast.actors) parent.set(a.id, a.id);
|
|
7823
|
-
for (const
|
|
7824
|
-
if (
|
|
7825
|
-
union(
|
|
7823
|
+
for (const r5 of ast.relations) {
|
|
7824
|
+
if (r5.kind === "generalization" && actorIds.has(r5.source) && actorIds.has(r5.target)) {
|
|
7825
|
+
union(r5.source, r5.target);
|
|
7826
7826
|
}
|
|
7827
7827
|
}
|
|
7828
7828
|
const baseSide = (a, i) => a.side === "left" ? "left" : a.side === "right" ? "right" : i === 0 ? "left" : "right";
|
|
@@ -7857,10 +7857,10 @@ function layoutUsecase(ast) {
|
|
|
7857
7857
|
const sides = classifyActorSides(ast);
|
|
7858
7858
|
const connectedActors = /* @__PURE__ */ new Map();
|
|
7859
7859
|
for (const u of ast.usecases) connectedActors.set(u.id, []);
|
|
7860
|
-
for (const
|
|
7861
|
-
if (
|
|
7862
|
-
const aId = actorById.has(
|
|
7863
|
-
const uId = ucIds.has(
|
|
7860
|
+
for (const r5 of ast.relations) {
|
|
7861
|
+
if (r5.kind !== "association" && r5.kind !== "directed") continue;
|
|
7862
|
+
const aId = actorById.has(r5.source) ? r5.source : actorById.has(r5.target) ? r5.target : null;
|
|
7863
|
+
const uId = ucIds.has(r5.source) ? r5.source : ucIds.has(r5.target) ? r5.target : null;
|
|
7864
7864
|
if (aId && uId) connectedActors.get(uId).push(aId);
|
|
7865
7865
|
}
|
|
7866
7866
|
const columns = [];
|
|
@@ -7899,10 +7899,10 @@ function layoutUsecase(ast) {
|
|
|
7899
7899
|
});
|
|
7900
7900
|
let prev = -Infinity;
|
|
7901
7901
|
for (const u of col) {
|
|
7902
|
-
let
|
|
7903
|
-
if (
|
|
7904
|
-
rowPos.set(u.id,
|
|
7905
|
-
prev =
|
|
7902
|
+
let r5 = rowPos.get(u.id);
|
|
7903
|
+
if (r5 <= prev) r5 = prev + 1;
|
|
7904
|
+
rowPos.set(u.id, r5);
|
|
7905
|
+
prev = r5;
|
|
7906
7906
|
}
|
|
7907
7907
|
}
|
|
7908
7908
|
const colMaxRx = columns.map(
|
|
@@ -8048,10 +8048,10 @@ function layoutUsecase(ast) {
|
|
|
8048
8048
|
const edges = [];
|
|
8049
8049
|
const trees = [];
|
|
8050
8050
|
const genByParent = /* @__PURE__ */ new Map();
|
|
8051
|
-
for (const
|
|
8052
|
-
if (
|
|
8053
|
-
if (!genByParent.has(
|
|
8054
|
-
genByParent.get(
|
|
8051
|
+
for (const r5 of ast.relations) {
|
|
8052
|
+
if (r5.kind !== "generalization") continue;
|
|
8053
|
+
if (!genByParent.has(r5.target)) genByParent.set(r5.target, []);
|
|
8054
|
+
genByParent.get(r5.target).push(r5);
|
|
8055
8055
|
}
|
|
8056
8056
|
const handledGen = /* @__PURE__ */ new Set();
|
|
8057
8057
|
function nodeCenter(id) {
|
|
@@ -8085,11 +8085,11 @@ function layoutUsecase(ast) {
|
|
|
8085
8085
|
}
|
|
8086
8086
|
for (const [parentId, rels] of genByParent) {
|
|
8087
8087
|
const useTree = ast.generalizationTree && rels.length >= C2.GEN_TREE_THRESHOLD;
|
|
8088
|
-
const allActors = actorById2.has(parentId) && rels.every((
|
|
8088
|
+
const allActors = actorById2.has(parentId) && rels.every((r5) => actorById2.has(r5.source));
|
|
8089
8089
|
if (allActors) {
|
|
8090
8090
|
const side = sides.get(parentId) ?? "left";
|
|
8091
8091
|
const pAnchor = actorGenAnchor(parentId, side);
|
|
8092
|
-
const childAnchors = rels.map((
|
|
8092
|
+
const childAnchors = rels.map((r5) => ({ r: r5, p: actorGenAnchor(r5.source, side) }));
|
|
8093
8093
|
const xs = [pAnchor.x, ...childAnchors.map((c) => c.p.x)];
|
|
8094
8094
|
const ys = [pAnchor.y, ...childAnchors.map((c) => c.p.y)];
|
|
8095
8095
|
const busX = side === "left" ? Math.min(...xs) - 20 : Math.max(...xs) + 20;
|
|
@@ -8105,7 +8105,7 @@ function layoutUsecase(ast) {
|
|
|
8105
8105
|
}
|
|
8106
8106
|
trees.push({
|
|
8107
8107
|
parentId,
|
|
8108
|
-
childIds: rels.map((
|
|
8108
|
+
childIds: rels.map((r5) => r5.source),
|
|
8109
8109
|
stemX: busX,
|
|
8110
8110
|
stemTop: minY2,
|
|
8111
8111
|
stemBottom: maxY2,
|
|
@@ -8128,7 +8128,7 @@ function layoutUsecase(ast) {
|
|
|
8128
8128
|
if (!useTree) continue;
|
|
8129
8129
|
const parent = nodeCenter(parentId);
|
|
8130
8130
|
if (!parent) continue;
|
|
8131
|
-
const childCenters = rels.map((
|
|
8131
|
+
const childCenters = rels.map((r5) => nodeCenter(r5.source)).filter((c) => c !== null);
|
|
8132
8132
|
if (childCenters.length === 0) continue;
|
|
8133
8133
|
const avgX = childCenters.reduce((s, c) => s + c.cx, 0) / childCenters.length;
|
|
8134
8134
|
const avgY = childCenters.reduce((s, c) => s + c.cy, 0) / childCenters.length;
|
|
@@ -8139,14 +8139,14 @@ function layoutUsecase(ast) {
|
|
|
8139
8139
|
const jx = pPt.x + dirX / len * C2.GEN_JUNCTION_OFFSET;
|
|
8140
8140
|
const jy = pPt.y + dirY / len * C2.GEN_JUNCTION_OFFSET;
|
|
8141
8141
|
const legPaths = [];
|
|
8142
|
-
for (const
|
|
8143
|
-
const cPt = perimeter(
|
|
8142
|
+
for (const r5 of rels) {
|
|
8143
|
+
const cPt = perimeter(r5.source, jx, jy);
|
|
8144
8144
|
legPaths.push(`M ${round(cPt.x)} ${round(cPt.y)} L ${round(jx)} ${round(jy)}`);
|
|
8145
|
-
handledGen.add(
|
|
8145
|
+
handledGen.add(r5);
|
|
8146
8146
|
}
|
|
8147
8147
|
trees.push({
|
|
8148
8148
|
parentId,
|
|
8149
|
-
childIds: rels.map((
|
|
8149
|
+
childIds: rels.map((r5) => r5.source),
|
|
8150
8150
|
stemX: jx,
|
|
8151
8151
|
stemTop: jy,
|
|
8152
8152
|
stemBottom: jy,
|
|
@@ -8154,72 +8154,72 @@ function layoutUsecase(ast) {
|
|
|
8154
8154
|
legPaths
|
|
8155
8155
|
});
|
|
8156
8156
|
}
|
|
8157
|
-
for (const
|
|
8158
|
-
if (handledGen.has(
|
|
8159
|
-
const a = nodeCenter(
|
|
8160
|
-
const b = nodeCenter(
|
|
8157
|
+
for (const r5 of ast.relations) {
|
|
8158
|
+
if (handledGen.has(r5)) continue;
|
|
8159
|
+
const a = nodeCenter(r5.source);
|
|
8160
|
+
const b = nodeCenter(r5.target);
|
|
8161
8161
|
if (!a || !b) continue;
|
|
8162
|
-
if (
|
|
8163
|
-
const side = sides.get(
|
|
8164
|
-
const pAnchor = actorGenAnchor(
|
|
8165
|
-
const cAnchor = actorGenAnchor(
|
|
8162
|
+
if (r5.kind === "generalization" && actorById2.has(r5.source) && actorById2.has(r5.target)) {
|
|
8163
|
+
const side = sides.get(r5.target) ?? "left";
|
|
8164
|
+
const pAnchor = actorGenAnchor(r5.target, side);
|
|
8165
|
+
const cAnchor = actorGenAnchor(r5.source, side);
|
|
8166
8166
|
const busX = side === "left" ? Math.min(pAnchor.x, cAnchor.x) - 20 : Math.max(pAnchor.x, cAnchor.x) + 20;
|
|
8167
8167
|
edges.push({
|
|
8168
|
-
relation:
|
|
8168
|
+
relation: r5,
|
|
8169
8169
|
d: `M ${round(cAnchor.x)} ${round(cAnchor.y)} L ${round(busX)} ${round(cAnchor.y)} L ${round(busX)} ${round(pAnchor.y)} L ${round(pAnchor.x)} ${round(pAnchor.y)}`,
|
|
8170
8170
|
arrowKind: "hollow",
|
|
8171
8171
|
dashed: false
|
|
8172
8172
|
});
|
|
8173
8173
|
continue;
|
|
8174
8174
|
}
|
|
8175
|
-
const srcActor = actorById2.get(
|
|
8176
|
-
const tgtActor = actorById2.get(
|
|
8175
|
+
const srcActor = actorById2.get(r5.source);
|
|
8176
|
+
const tgtActor = actorById2.get(r5.target);
|
|
8177
8177
|
let pa;
|
|
8178
8178
|
let pb;
|
|
8179
8179
|
if (srcActor && !tgtActor) {
|
|
8180
8180
|
pa = { x: srcActor.anchorX, y: srcActor.anchorY };
|
|
8181
|
-
pb = perimeter(
|
|
8181
|
+
pb = perimeter(r5.target, pa.x, pa.y);
|
|
8182
8182
|
} else if (tgtActor && !srcActor) {
|
|
8183
8183
|
pb = { x: tgtActor.anchorX, y: tgtActor.anchorY };
|
|
8184
|
-
pa = perimeter(
|
|
8184
|
+
pa = perimeter(r5.source, pb.x, pb.y);
|
|
8185
8185
|
} else {
|
|
8186
|
-
pa = perimeter(
|
|
8187
|
-
pb = perimeter(
|
|
8186
|
+
pa = perimeter(r5.source, b.cx, b.cy);
|
|
8187
|
+
pb = perimeter(r5.target, a.cx, a.cy);
|
|
8188
8188
|
}
|
|
8189
|
-
const dashed =
|
|
8189
|
+
const dashed = r5.kind === "include" || r5.kind === "extend";
|
|
8190
8190
|
let arrowKind2 = "none";
|
|
8191
|
-
if (
|
|
8192
|
-
else if (
|
|
8191
|
+
if (r5.kind === "directed" || r5.kind === "include" || r5.kind === "extend") arrowKind2 = "open";
|
|
8192
|
+
else if (r5.kind === "generalization") arrowKind2 = "hollow";
|
|
8193
8193
|
const edge = {
|
|
8194
|
-
relation:
|
|
8194
|
+
relation: r5,
|
|
8195
8195
|
d: `M ${round(pa.x)} ${round(pa.y)} L ${round(pb.x)} ${round(pb.y)}`,
|
|
8196
8196
|
arrowKind: arrowKind2,
|
|
8197
8197
|
dashed
|
|
8198
8198
|
};
|
|
8199
|
-
if (
|
|
8199
|
+
if (r5.kind === "include" || r5.kind === "extend") {
|
|
8200
8200
|
const rows = [];
|
|
8201
|
-
const keyword =
|
|
8202
|
-
rows.push(`\xAB${
|
|
8203
|
-
if (
|
|
8204
|
-
if (
|
|
8201
|
+
const keyword = r5.kind === "include" ? "include" : "extend";
|
|
8202
|
+
rows.push(`\xAB${r5.stereotype ?? keyword}\xBB`);
|
|
8203
|
+
if (r5.condition) rows.push(`[${r5.condition}]`);
|
|
8204
|
+
if (r5.extensionPointRef) rows.push(`(extension point: ${r5.extensionPointRef})`);
|
|
8205
8205
|
const label = {
|
|
8206
8206
|
rows,
|
|
8207
8207
|
cx: (pa.x + pb.x) / 2,
|
|
8208
8208
|
cy: (pa.y + pb.y) / 2
|
|
8209
8209
|
};
|
|
8210
8210
|
edge.label = label;
|
|
8211
|
-
} else if ((
|
|
8211
|
+
} else if ((r5.kind === "association" || r5.kind === "directed") && r5.stereotype) {
|
|
8212
8212
|
edge.label = {
|
|
8213
|
-
rows: [`\xAB${
|
|
8213
|
+
rows: [`\xAB${r5.stereotype}\xBB`],
|
|
8214
8214
|
cx: (pa.x + pb.x) / 2,
|
|
8215
8215
|
cy: (pa.y + pb.y) / 2
|
|
8216
8216
|
};
|
|
8217
8217
|
}
|
|
8218
|
-
if (
|
|
8219
|
-
edge.multiplicityFrom = placeMultiplicity(pa, pb,
|
|
8218
|
+
if (r5.sourceMultiplicity) {
|
|
8219
|
+
edge.multiplicityFrom = placeMultiplicity(pa, pb, r5.sourceMultiplicity);
|
|
8220
8220
|
}
|
|
8221
|
-
if (
|
|
8222
|
-
edge.multiplicityTo = placeMultiplicity(pb, pa,
|
|
8221
|
+
if (r5.targetMultiplicity) {
|
|
8222
|
+
edge.multiplicityTo = placeMultiplicity(pb, pa, r5.targetMultiplicity);
|
|
8223
8223
|
}
|
|
8224
8224
|
edges.push(edge);
|
|
8225
8225
|
}
|
|
@@ -8474,7 +8474,7 @@ function renderEdgeLabel(e) {
|
|
|
8474
8474
|
const rows = e.label.rows;
|
|
8475
8475
|
const lineH = 12;
|
|
8476
8476
|
const totalH = rows.length * lineH;
|
|
8477
|
-
const widest = rows.reduce((m,
|
|
8477
|
+
const widest = rows.reduce((m, r5) => Math.max(m, r5.length), 0);
|
|
8478
8478
|
const pillW = widest * 6 + 8;
|
|
8479
8479
|
const pillH = totalH + 4;
|
|
8480
8480
|
const startY = e.label.cy - totalH / 2 + 9;
|
|
@@ -8490,7 +8490,7 @@ function renderEdgeLabel(e) {
|
|
|
8490
8490
|
ry: 4
|
|
8491
8491
|
})
|
|
8492
8492
|
];
|
|
8493
|
-
rows.forEach((
|
|
8493
|
+
rows.forEach((r5, i) => {
|
|
8494
8494
|
parts.push(
|
|
8495
8495
|
chunk3WNW5Y7P_cjs.text(
|
|
8496
8496
|
{
|
|
@@ -8499,7 +8499,7 @@ function renderEdgeLabel(e) {
|
|
|
8499
8499
|
y: startY + i * lineH,
|
|
8500
8500
|
"text-anchor": "middle"
|
|
8501
8501
|
},
|
|
8502
|
-
|
|
8502
|
+
r5
|
|
8503
8503
|
)
|
|
8504
8504
|
);
|
|
8505
8505
|
});
|
|
@@ -8537,10 +8537,10 @@ function renderTree(tr) {
|
|
|
8537
8537
|
);
|
|
8538
8538
|
}
|
|
8539
8539
|
function renderUsecaseLayout(layout, config) {
|
|
8540
|
-
const t =
|
|
8540
|
+
const t = chunkNZT5P2XZ_cjs.resolveBaseTheme(config?.theme ?? "default");
|
|
8541
8541
|
const children = [];
|
|
8542
|
-
const nInclude = layout.ast.relations.filter((
|
|
8543
|
-
const nExtend = layout.ast.relations.filter((
|
|
8542
|
+
const nInclude = layout.ast.relations.filter((r5) => r5.kind === "include").length;
|
|
8543
|
+
const nExtend = layout.ast.relations.filter((r5) => r5.kind === "extend").length;
|
|
8544
8544
|
children.push(chunk3WNW5Y7P_cjs.title(`Use Case Diagram${layout.title ? " \u2014 " + layout.title : ""}`));
|
|
8545
8545
|
children.push(
|
|
8546
8546
|
chunk3WNW5Y7P_cjs.desc(
|
|
@@ -9288,12 +9288,12 @@ function layoutAoa(ast, schedule) {
|
|
|
9288
9288
|
const predEvents = (e) => inAdj[e].map((ai) => arcs[ai].from);
|
|
9289
9289
|
const succEvents = (e) => outAdj[e].map((ai) => arcs[ai].to);
|
|
9290
9290
|
for (let iter = 0; iter < 4; iter++) {
|
|
9291
|
-
for (let
|
|
9292
|
-
layers[
|
|
9291
|
+
for (let r5 = 1; r5 <= maxRank; r5++) {
|
|
9292
|
+
layers[r5] = sortByBary(layers[r5], predEvents, pos);
|
|
9293
9293
|
refresh(layers, pos);
|
|
9294
9294
|
}
|
|
9295
|
-
for (let
|
|
9296
|
-
layers[
|
|
9295
|
+
for (let r5 = maxRank - 1; r5 >= 0; r5--) {
|
|
9296
|
+
layers[r5] = sortByBary(layers[r5], succEvents, pos);
|
|
9297
9297
|
refresh(layers, pos);
|
|
9298
9298
|
}
|
|
9299
9299
|
}
|
|
@@ -9303,12 +9303,12 @@ function layoutAoa(ast, schedule) {
|
|
|
9303
9303
|
const contentH = (maxRows - 1) * AOA.VGAP + 2 * AOA.R;
|
|
9304
9304
|
const cx = new Array(nEvents).fill(0);
|
|
9305
9305
|
const cy = new Array(nEvents).fill(0);
|
|
9306
|
-
for (let
|
|
9307
|
-
const layer = layers[
|
|
9306
|
+
for (let r5 = 0; r5 <= maxRank; r5++) {
|
|
9307
|
+
const layer = layers[r5];
|
|
9308
9308
|
const colH = (layer.length - 1) * AOA.VGAP;
|
|
9309
9309
|
const y0 = topY + AOA.R + (contentH - 2 * AOA.R - colH) / 2;
|
|
9310
9310
|
layer.forEach((e, i) => {
|
|
9311
|
-
cx[e] = AOA.PAD + AOA.R +
|
|
9311
|
+
cx[e] = AOA.PAD + AOA.R + r5 * AOA.COL;
|
|
9312
9312
|
cy[e] = y0 + i * AOA.VGAP;
|
|
9313
9313
|
});
|
|
9314
9314
|
}
|
|
@@ -9370,16 +9370,16 @@ function sortByBary(layer, neighbors, pos) {
|
|
|
9370
9370
|
return { e, i, bary };
|
|
9371
9371
|
}).sort((a, b) => a.bary !== b.bary ? a.bary - b.bary : a.i - b.i).map((x) => x.e);
|
|
9372
9372
|
}
|
|
9373
|
-
function arcGeometry(tx, ty, hx, hy,
|
|
9373
|
+
function arcGeometry(tx, ty, hx, hy, r5) {
|
|
9374
9374
|
const dx = hx - tx;
|
|
9375
9375
|
const dy = hy - ty;
|
|
9376
9376
|
const len = Math.hypot(dx, dy) || 1;
|
|
9377
9377
|
const ux = dx / len;
|
|
9378
9378
|
const uy = dy / len;
|
|
9379
|
-
const sx = tx + ux *
|
|
9380
|
-
const sy = ty + uy *
|
|
9381
|
-
const ex = hx - ux *
|
|
9382
|
-
const ey = hy - uy *
|
|
9379
|
+
const sx = tx + ux * r5;
|
|
9380
|
+
const sy = ty + uy * r5;
|
|
9381
|
+
const ex = hx - ux * r5;
|
|
9382
|
+
const ey = hy - uy * r5;
|
|
9383
9383
|
return { d: `M ${round3(sx)} ${round3(sy)} L ${round3(ex)} ${round3(ey)}`, mx: (sx + ex) / 2, my: (sy + ey) / 2 };
|
|
9384
9384
|
}
|
|
9385
9385
|
function buildAoaSummary(ast, sched) {
|
|
@@ -9452,11 +9452,11 @@ function assignRanks(ast) {
|
|
|
9452
9452
|
if (visiting.has(id)) return 0;
|
|
9453
9453
|
visiting.add(id);
|
|
9454
9454
|
const t = byId.get(id);
|
|
9455
|
-
let
|
|
9456
|
-
for (const dep of t.deps)
|
|
9455
|
+
let r5 = 0;
|
|
9456
|
+
for (const dep of t.deps) r5 = Math.max(r5, compute(dep.pred) + 1);
|
|
9457
9457
|
visiting.delete(id);
|
|
9458
|
-
rank.set(id,
|
|
9459
|
-
return
|
|
9458
|
+
rank.set(id, r5);
|
|
9459
|
+
return r5;
|
|
9460
9460
|
};
|
|
9461
9461
|
let maxRank = 0;
|
|
9462
9462
|
for (const t of ast.tasks) maxRank = Math.max(maxRank, compute(t.id));
|
|
@@ -9502,15 +9502,15 @@ function orderLayers(ast, schedule, rank, maxRank) {
|
|
|
9502
9502
|
return s / neighbors.length;
|
|
9503
9503
|
};
|
|
9504
9504
|
for (let iter = 0; iter < 4; iter++) {
|
|
9505
|
-
for (let
|
|
9506
|
-
layers[
|
|
9505
|
+
for (let r5 = 1; r5 <= maxRank; r5++) {
|
|
9506
|
+
layers[r5] = stableSortByKey(layers[r5], (id) => {
|
|
9507
9507
|
const bc = barycenter(id, pred.get(id));
|
|
9508
9508
|
return crit(id) ? bc - 0.4 : bc;
|
|
9509
9509
|
});
|
|
9510
9510
|
refreshPos();
|
|
9511
9511
|
}
|
|
9512
|
-
for (let
|
|
9513
|
-
layers[
|
|
9512
|
+
for (let r5 = maxRank - 1; r5 >= 0; r5--) {
|
|
9513
|
+
layers[r5] = stableSortByKey(layers[r5], (id) => {
|
|
9514
9514
|
const bc = barycenter(id, succ.get(id));
|
|
9515
9515
|
return crit(id) ? bc - 0.4 : bc;
|
|
9516
9516
|
});
|
|
@@ -9562,9 +9562,9 @@ function layoutNetwork(ast, schedule) {
|
|
|
9562
9562
|
const originCross = dir === "TB" ? C2.PAD : C2.PAD + titleH;
|
|
9563
9563
|
const boxes = [];
|
|
9564
9564
|
const boxById = /* @__PURE__ */ new Map();
|
|
9565
|
-
for (let
|
|
9566
|
-
const layer = layers[
|
|
9567
|
-
const extent = colExtent[
|
|
9565
|
+
for (let r5 = 0; r5 <= maxRank; r5++) {
|
|
9566
|
+
const layer = layers[r5];
|
|
9567
|
+
const extent = colExtent[r5];
|
|
9568
9568
|
const crossStart = originCross + (maxExtent - extent) / 2;
|
|
9569
9569
|
let cursor = crossStart;
|
|
9570
9570
|
for (const id of layer) {
|
|
@@ -9575,12 +9575,12 @@ function layoutNetwork(ast, schedule) {
|
|
|
9575
9575
|
let x;
|
|
9576
9576
|
let y;
|
|
9577
9577
|
if (dir === "TB") {
|
|
9578
|
-
const rankPos = originPrimary +
|
|
9578
|
+
const rankPos = originPrimary + r5 * (C2.BOX_H + C2.H_GAP);
|
|
9579
9579
|
x = cursor + (C2.BOX_W - w) / 2;
|
|
9580
9580
|
y = rankPos;
|
|
9581
9581
|
cursor += C2.BOX_W + C2.H_GAP;
|
|
9582
9582
|
} else {
|
|
9583
|
-
const rankPos = originPrimary +
|
|
9583
|
+
const rankPos = originPrimary + r5 * (C2.BOX_W + C2.H_GAP);
|
|
9584
9584
|
x = rankPos + (C2.BOX_W - w) / 2;
|
|
9585
9585
|
y = cursor;
|
|
9586
9586
|
cursor += C2.BOX_H + C2.V_GAP;
|
|
@@ -9594,7 +9594,7 @@ function layoutNetwork(ast, schedule) {
|
|
|
9594
9594
|
width: w,
|
|
9595
9595
|
height: h,
|
|
9596
9596
|
milestone: t.milestone,
|
|
9597
|
-
rank:
|
|
9597
|
+
rank: r5
|
|
9598
9598
|
};
|
|
9599
9599
|
boxes.push(box);
|
|
9600
9600
|
boxById.set(id, box);
|
|
@@ -9754,7 +9754,7 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
9754
9754
|
const crit = (id) => schedule.computed.get(id).critical;
|
|
9755
9755
|
const es = (id) => schedule.computed.get(id).es;
|
|
9756
9756
|
const cell = /* @__PURE__ */ new Map();
|
|
9757
|
-
const key = (lane,
|
|
9757
|
+
const key = (lane, r5) => `${lane}\0${r5}`;
|
|
9758
9758
|
for (const t of ast.tasks) {
|
|
9759
9759
|
const k = key(laneOf.get(t.id), rank.get(t.id));
|
|
9760
9760
|
if (!cell.has(k)) cell.set(k, []);
|
|
@@ -9771,15 +9771,15 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
9771
9771
|
}
|
|
9772
9772
|
const titleH = ast.title ? C2.TITLE_H : 0;
|
|
9773
9773
|
const topY = C2.PAD + titleH;
|
|
9774
|
-
const colX = (
|
|
9774
|
+
const colX = (r5) => C2.LANE_LABEL_W + C2.PAD + r5 * (C2.BOX_W + C2.H_GAP);
|
|
9775
9775
|
const lanes = [];
|
|
9776
9776
|
const laneY = /* @__PURE__ */ new Map();
|
|
9777
9777
|
const laneH = /* @__PURE__ */ new Map();
|
|
9778
9778
|
let cursor = topY;
|
|
9779
9779
|
laneOrder.forEach((lane, i) => {
|
|
9780
9780
|
let stack = 1;
|
|
9781
|
-
for (let
|
|
9782
|
-
const arr = cell.get(key(lane,
|
|
9781
|
+
for (let r5 = 0; r5 <= maxRank; r5++) {
|
|
9782
|
+
const arr = cell.get(key(lane, r5));
|
|
9783
9783
|
if (arr) stack = Math.max(stack, arr.length);
|
|
9784
9784
|
}
|
|
9785
9785
|
const bandH = stack * C2.BOX_H + (stack - 1) * C2.V_GAP + 2 * C2.LANE_PAD;
|
|
@@ -9794,15 +9794,15 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
9794
9794
|
for (const lane of laneOrder) {
|
|
9795
9795
|
const bandTop = laneY.get(lane);
|
|
9796
9796
|
const bandH = laneH.get(lane);
|
|
9797
|
-
for (let
|
|
9798
|
-
const arr = cell.get(key(lane,
|
|
9797
|
+
for (let r5 = 0; r5 <= maxRank; r5++) {
|
|
9798
|
+
const arr = cell.get(key(lane, r5));
|
|
9799
9799
|
if (!arr) continue;
|
|
9800
9800
|
const colInnerH = arr.length * C2.BOX_H + (arr.length - 1) * C2.V_GAP;
|
|
9801
9801
|
const y0 = bandTop + (bandH - colInnerH) / 2;
|
|
9802
9802
|
arr.forEach((id, idx) => {
|
|
9803
9803
|
const t = byId.get(id);
|
|
9804
9804
|
const w = t.milestone ? C2.MS_W : C2.BOX_W;
|
|
9805
|
-
const x = colX(
|
|
9805
|
+
const x = colX(r5) + (C2.BOX_W - w) / 2;
|
|
9806
9806
|
const y = y0 + idx * (C2.BOX_H + C2.V_GAP);
|
|
9807
9807
|
const box = {
|
|
9808
9808
|
id,
|
|
@@ -9813,7 +9813,7 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
9813
9813
|
width: w,
|
|
9814
9814
|
height: C2.BOX_H,
|
|
9815
9815
|
milestone: t.milestone,
|
|
9816
|
-
rank:
|
|
9816
|
+
rank: r5
|
|
9817
9817
|
};
|
|
9818
9818
|
boxes.push(box);
|
|
9819
9819
|
boxById.set(id, box);
|
|
@@ -10326,7 +10326,7 @@ function summaryText(summary) {
|
|
|
10326
10326
|
return { plain, critPath };
|
|
10327
10327
|
}
|
|
10328
10328
|
function renderPertLayout(layout, config) {
|
|
10329
|
-
const t =
|
|
10329
|
+
const t = chunkNZT5P2XZ_cjs.resolveBaseTheme(config?.theme ?? "default");
|
|
10330
10330
|
const children = [];
|
|
10331
10331
|
const cp = layout.summary.criticalPath;
|
|
10332
10332
|
children.push(chunk3WNW5Y7P_cjs.title(`PERT network${layout.title ? " \u2014 " + layout.title : ""}`));
|
|
@@ -11480,18 +11480,18 @@ function renderFragmentTab(f) {
|
|
|
11480
11480
|
});
|
|
11481
11481
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-fragment-tab-g", "data-op": f.op }, parts);
|
|
11482
11482
|
}
|
|
11483
|
-
function renderRef(
|
|
11483
|
+
function renderRef(r5) {
|
|
11484
11484
|
const tabW = 40;
|
|
11485
11485
|
const tabH = 18;
|
|
11486
11486
|
const fold = 6;
|
|
11487
|
-
const tab = `M ${
|
|
11487
|
+
const tab = `M ${r5.x} ${r5.y} H ${r5.x + tabW} V ${r5.y + tabH - fold} L ${r5.x + tabW - fold} ${r5.y + tabH} H ${r5.x} Z`;
|
|
11488
11488
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-fragment", "data-op": "ref" }, [
|
|
11489
|
-
chunk3WNW5Y7P_cjs.rect({ class: "sx-seq-frame", x:
|
|
11489
|
+
chunk3WNW5Y7P_cjs.rect({ class: "sx-seq-frame", x: r5.x, y: r5.y, width: r5.width, height: r5.height, rx: 2, ry: 2 }),
|
|
11490
11490
|
chunk3WNW5Y7P_cjs.path({ class: "sx-seq-frame-tab", d: tab }),
|
|
11491
|
-
chunk3WNW5Y7P_cjs.text({ class: "sx-seq-frame-op", x:
|
|
11491
|
+
chunk3WNW5Y7P_cjs.text({ class: "sx-seq-frame-op", x: r5.x + 8, y: r5.y + 13 }, "ref"),
|
|
11492
11492
|
chunk3WNW5Y7P_cjs.text(
|
|
11493
|
-
{ class: "sx-seq-ref-name", x:
|
|
11494
|
-
|
|
11493
|
+
{ class: "sx-seq-ref-name", x: r5.x + r5.width / 2, y: r5.y + r5.height / 2 + 8, "text-anchor": "middle" },
|
|
11494
|
+
r5.text
|
|
11495
11495
|
)
|
|
11496
11496
|
]);
|
|
11497
11497
|
}
|
|
@@ -11528,14 +11528,14 @@ function renderInvariant(iv) {
|
|
|
11528
11528
|
]);
|
|
11529
11529
|
}
|
|
11530
11530
|
function renderDestroy(d) {
|
|
11531
|
-
const
|
|
11531
|
+
const r5 = 7;
|
|
11532
11532
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-destroy-g" }, [
|
|
11533
|
-
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x -
|
|
11534
|
-
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x -
|
|
11533
|
+
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r5, y1: d.y - r5, x2: d.x + r5, y2: d.y + r5 }),
|
|
11534
|
+
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r5, y1: d.y + r5, x2: d.x + r5, y2: d.y - r5 })
|
|
11535
11535
|
]);
|
|
11536
11536
|
}
|
|
11537
11537
|
function renderSequenceLayout(layout, config) {
|
|
11538
|
-
const t =
|
|
11538
|
+
const t = chunkNZT5P2XZ_cjs.resolveBaseTheme(config?.theme ?? "default");
|
|
11539
11539
|
const children = [];
|
|
11540
11540
|
const nMsg = layout.messages.length;
|
|
11541
11541
|
const nFrag = layout.fragments.length;
|
|
@@ -12374,10 +12374,10 @@ function renderArc(ag) {
|
|
|
12374
12374
|
const dx = last.x - prev.x;
|
|
12375
12375
|
const dy = last.y - prev.y;
|
|
12376
12376
|
const len = Math.hypot(dx, dy) || 1;
|
|
12377
|
-
const
|
|
12378
|
-
const cx = last.x - dx / len *
|
|
12379
|
-
const cy = last.y - dy / len *
|
|
12380
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-petri-inhibitor-dot", cx, cy, r:
|
|
12377
|
+
const r5 = 4;
|
|
12378
|
+
const cx = last.x - dx / len * r5;
|
|
12379
|
+
const cy = last.y - dy / len * r5;
|
|
12380
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-petri-inhibitor-dot", cx, cy, r: r5 }));
|
|
12381
12381
|
}
|
|
12382
12382
|
if (ag.weight > 1) {
|
|
12383
12383
|
parts.push(
|
|
@@ -12390,7 +12390,7 @@ function renderArc(ag) {
|
|
|
12390
12390
|
);
|
|
12391
12391
|
}
|
|
12392
12392
|
function renderPetriLayout(layout, config) {
|
|
12393
|
-
const t =
|
|
12393
|
+
const t = chunkNZT5P2XZ_cjs.resolvePetriTheme(config?.theme ?? "default");
|
|
12394
12394
|
const children = [];
|
|
12395
12395
|
const marking = layout.places.filter((p) => p.tokens > 0).map((p) => `${p.place.id}:${p.tokens}`).join(", ");
|
|
12396
12396
|
const descParts = [
|
|
@@ -12775,10 +12775,10 @@ function parseNetwork(text2) {
|
|
|
12775
12775
|
if (rest[0]) ast.title = rest[0].value;
|
|
12776
12776
|
break;
|
|
12777
12777
|
case "spines":
|
|
12778
|
-
ast.spines.push(...rest.filter((
|
|
12778
|
+
ast.spines.push(...rest.filter((r5) => !r5.str).map((r5) => r5.value));
|
|
12779
12779
|
break;
|
|
12780
12780
|
case "leaves":
|
|
12781
|
-
ast.leaves.push(...rest.filter((
|
|
12781
|
+
ast.leaves.push(...rest.filter((r5) => !r5.str).map((r5) => r5.value));
|
|
12782
12782
|
break;
|
|
12783
12783
|
case "legend":
|
|
12784
12784
|
break;
|
|
@@ -13347,29 +13347,29 @@ function placeBanded(ast, ranks) {
|
|
|
13347
13347
|
const lr = ast.direction === "lr";
|
|
13348
13348
|
const byRank = /* @__PURE__ */ new Map();
|
|
13349
13349
|
for (const d of ast.devices) {
|
|
13350
|
-
const
|
|
13351
|
-
if (!byRank.has(
|
|
13352
|
-
byRank.get(
|
|
13350
|
+
const r5 = ranks.get(d.id) ?? 0;
|
|
13351
|
+
if (!byRank.has(r5)) byRank.set(r5, []);
|
|
13352
|
+
byRank.get(r5).push(d);
|
|
13353
13353
|
}
|
|
13354
13354
|
const rankValues = [...byRank.keys()].sort((a, b) => a - b);
|
|
13355
13355
|
const pos = /* @__PURE__ */ new Map();
|
|
13356
13356
|
let maxRowSpan = 0;
|
|
13357
13357
|
const rowSpans = /* @__PURE__ */ new Map();
|
|
13358
|
-
for (const
|
|
13359
|
-
const devs = byRank.get(
|
|
13358
|
+
for (const r5 of rankValues) {
|
|
13359
|
+
const devs = byRank.get(r5);
|
|
13360
13360
|
let span = 0;
|
|
13361
13361
|
devs.forEach((d, i) => {
|
|
13362
13362
|
const fp = deviceFootprint(d);
|
|
13363
13363
|
const cross = lr ? fp.h + labelExtra(d) : Math.max(fp.w, labelText(d).length * NET_CONST.CHAR_W + 6);
|
|
13364
13364
|
span += cross + (i > 0 ? NET_CONST.SIBLING_GAP : 0);
|
|
13365
13365
|
});
|
|
13366
|
-
rowSpans.set(
|
|
13366
|
+
rowSpans.set(r5, span);
|
|
13367
13367
|
maxRowSpan = Math.max(maxRowSpan, span);
|
|
13368
13368
|
}
|
|
13369
|
-
rankValues.forEach((
|
|
13370
|
-
const devs = byRank.get(
|
|
13369
|
+
rankValues.forEach((r5, rowIdx) => {
|
|
13370
|
+
const devs = byRank.get(r5);
|
|
13371
13371
|
const along = rowIdx * NET_CONST.TIER_BAND_GAP;
|
|
13372
|
-
let cursor = (maxRowSpan - rowSpans.get(
|
|
13372
|
+
let cursor = (maxRowSpan - rowSpans.get(r5)) / 2;
|
|
13373
13373
|
for (const d of devs) {
|
|
13374
13374
|
const fp = deviceFootprint(d);
|
|
13375
13375
|
const cross = lr ? fp.h + labelExtra(d) : Math.max(fp.w, labelText(d).length * NET_CONST.CHAR_W + 6);
|
|
@@ -13404,8 +13404,8 @@ function tieredRanks(ast, links) {
|
|
|
13404
13404
|
if (rank.has(d.id)) continue;
|
|
13405
13405
|
const known = [];
|
|
13406
13406
|
for (const n of adj.get(d.id) ?? []) {
|
|
13407
|
-
const
|
|
13408
|
-
if (
|
|
13407
|
+
const r5 = rank.get(n);
|
|
13408
|
+
if (r5 !== void 0) known.push(r5);
|
|
13409
13409
|
}
|
|
13410
13410
|
if (known.length === 0) continue;
|
|
13411
13411
|
const next = ENDPOINT_KINDS.has(d.kind) ? Math.max(...known) + 1 : Math.min(...known) + 1;
|
|
@@ -13439,10 +13439,10 @@ function treeRanks(ast, links) {
|
|
|
13439
13439
|
rank.set(root.id, 0);
|
|
13440
13440
|
while (queue.length) {
|
|
13441
13441
|
const id = queue.shift();
|
|
13442
|
-
const
|
|
13442
|
+
const r5 = rank.get(id);
|
|
13443
13443
|
for (const n of adj.get(id) ?? []) {
|
|
13444
13444
|
if (!rank.has(n)) {
|
|
13445
|
-
rank.set(n,
|
|
13445
|
+
rank.set(n, r5 + 1);
|
|
13446
13446
|
queue.push(n);
|
|
13447
13447
|
}
|
|
13448
13448
|
}
|
|
@@ -13626,11 +13626,11 @@ function layoutNetwork2(ast) {
|
|
|
13626
13626
|
};
|
|
13627
13627
|
const groupsByDepth = [...ast.groups].sort((a, b) => depthOf(b.id) - depthOf(a.id));
|
|
13628
13628
|
for (const g of groupsByDepth) {
|
|
13629
|
-
let l = Infinity, t = Infinity,
|
|
13629
|
+
let l = Infinity, t = Infinity, r5 = -Infinity, bm = -Infinity;
|
|
13630
13630
|
const addBox = (e) => {
|
|
13631
13631
|
l = Math.min(l, e.left);
|
|
13632
13632
|
t = Math.min(t, e.top);
|
|
13633
|
-
|
|
13633
|
+
r5 = Math.max(r5, e.right);
|
|
13634
13634
|
bm = Math.max(bm, e.bottom);
|
|
13635
13635
|
};
|
|
13636
13636
|
for (const mid of g.members) {
|
|
@@ -13647,7 +13647,7 @@ function layoutNetwork2(ast) {
|
|
|
13647
13647
|
groupBoxesRaw.set(g.id, {
|
|
13648
13648
|
left: l - pad,
|
|
13649
13649
|
top: t - pad - NET_CONST.GROUP_HEADER,
|
|
13650
|
-
right:
|
|
13650
|
+
right: r5 + pad,
|
|
13651
13651
|
bottom: bm + pad,
|
|
13652
13652
|
depth
|
|
13653
13653
|
});
|
|
@@ -13867,7 +13867,7 @@ function renderDevice(b, t) {
|
|
|
13867
13867
|
return chunk3WNW5Y7P_cjs.group(attrs, parts);
|
|
13868
13868
|
}
|
|
13869
13869
|
function renderNetworkLayout(layout, config) {
|
|
13870
|
-
const t =
|
|
13870
|
+
const t = chunkNZT5P2XZ_cjs.resolveNetworkTheme(config?.theme ?? "default");
|
|
13871
13871
|
const children = [];
|
|
13872
13872
|
const counts = /* @__PURE__ */ new Map();
|
|
13873
13873
|
for (const b of layout.devices) counts.set(b.device.kind, (counts.get(b.device.kind) ?? 0) + 1);
|
|
@@ -14067,10 +14067,10 @@ function parseUmlClass(text2) {
|
|
|
14067
14067
|
}
|
|
14068
14068
|
const rels = tryParseRelationship(t, i + 1);
|
|
14069
14069
|
if (rels) {
|
|
14070
|
-
for (const
|
|
14071
|
-
ast.relationships.push(
|
|
14072
|
-
ensureClassifier(ast,
|
|
14073
|
-
ensureClassifier(ast,
|
|
14070
|
+
for (const r5 of rels) {
|
|
14071
|
+
ast.relationships.push(r5);
|
|
14072
|
+
ensureClassifier(ast, r5.from);
|
|
14073
|
+
ensureClassifier(ast, r5.to);
|
|
14074
14074
|
}
|
|
14075
14075
|
i++;
|
|
14076
14076
|
continue;
|
|
@@ -14625,11 +14625,11 @@ function findConnector(line2, glyph) {
|
|
|
14625
14625
|
}
|
|
14626
14626
|
function validateGeneralizationAcyclicity(ast) {
|
|
14627
14627
|
const adj = /* @__PURE__ */ new Map();
|
|
14628
|
-
for (const
|
|
14629
|
-
if (
|
|
14630
|
-
const list = adj.get(
|
|
14631
|
-
list.push(
|
|
14632
|
-
adj.set(
|
|
14628
|
+
for (const r5 of ast.relationships) {
|
|
14629
|
+
if (r5.kind === "generalization" || r5.kind === "realization") {
|
|
14630
|
+
const list = adj.get(r5.from) ?? [];
|
|
14631
|
+
list.push(r5.to);
|
|
14632
|
+
adj.set(r5.from, list);
|
|
14633
14633
|
}
|
|
14634
14634
|
}
|
|
14635
14635
|
const WHITE = 0, GREY = 1, BLACK = 2;
|
|
@@ -14662,12 +14662,12 @@ function validateGeneralizationAcyclicity(ast) {
|
|
|
14662
14662
|
}
|
|
14663
14663
|
}
|
|
14664
14664
|
function validateRealizationTargets(ast) {
|
|
14665
|
-
for (const
|
|
14666
|
-
if (
|
|
14667
|
-
const target = ast.classifiers.find((c) => c.id ===
|
|
14665
|
+
for (const r5 of ast.relationships) {
|
|
14666
|
+
if (r5.kind !== "realization") continue;
|
|
14667
|
+
const target = ast.classifiers.find((c) => c.id === r5.to);
|
|
14668
14668
|
if (target && target.kind !== "interface") {
|
|
14669
14669
|
ast.warnings.push(
|
|
14670
|
-
`Realization target "${
|
|
14670
|
+
`Realization target "${r5.to}" is not an \xABinterface\xBB \u2014 consider marking it so.`
|
|
14671
14671
|
);
|
|
14672
14672
|
}
|
|
14673
14673
|
}
|
|
@@ -15145,16 +15145,16 @@ function memberLineText(m) {
|
|
|
15145
15145
|
const props = m.properties && m.properties.length > 0 ? ` {${m.properties.join(", ")}}` : "";
|
|
15146
15146
|
return `${v}${m.name}(${params})${ret}${props}`;
|
|
15147
15147
|
}
|
|
15148
|
-
function rankEnds(
|
|
15149
|
-
switch (
|
|
15148
|
+
function rankEnds(r5) {
|
|
15149
|
+
switch (r5.kind) {
|
|
15150
15150
|
case "generalization":
|
|
15151
15151
|
case "realization":
|
|
15152
|
-
return { parent:
|
|
15152
|
+
return { parent: r5.to, child: r5.from };
|
|
15153
15153
|
case "composition":
|
|
15154
15154
|
case "aggregation":
|
|
15155
15155
|
case "directed":
|
|
15156
15156
|
case "dependency":
|
|
15157
|
-
return { parent:
|
|
15157
|
+
return { parent: r5.from, child: r5.to };
|
|
15158
15158
|
case "association":
|
|
15159
15159
|
return null;
|
|
15160
15160
|
}
|
|
@@ -15162,8 +15162,8 @@ function rankEnds(r3) {
|
|
|
15162
15162
|
function computeRanks(ast, boxes) {
|
|
15163
15163
|
const parentsOf = /* @__PURE__ */ new Map();
|
|
15164
15164
|
for (const b of boxes) parentsOf.set(b.classifier.id, /* @__PURE__ */ new Set());
|
|
15165
|
-
for (const
|
|
15166
|
-
const ends = rankEnds(
|
|
15165
|
+
for (const r5 of ast.relationships) {
|
|
15166
|
+
const ends = rankEnds(r5);
|
|
15167
15167
|
if (ends) parentsOf.get(ends.child)?.add(ends.parent);
|
|
15168
15168
|
}
|
|
15169
15169
|
const rank = /* @__PURE__ */ new Map();
|
|
@@ -15205,19 +15205,19 @@ function buildLayeredGraph(rels, boxes, rankByID) {
|
|
|
15205
15205
|
byID.set(n.id, n);
|
|
15206
15206
|
}
|
|
15207
15207
|
const chains = [];
|
|
15208
|
-
for (const
|
|
15209
|
-
const a = byID.get(
|
|
15210
|
-
const b = byID.get(
|
|
15208
|
+
for (const r5 of rels) {
|
|
15209
|
+
const a = byID.get(r5.from);
|
|
15210
|
+
const b = byID.get(r5.to);
|
|
15211
15211
|
if (!a || !b) continue;
|
|
15212
15212
|
if (a.rank === b.rank) {
|
|
15213
|
-
chains.push({ rel:
|
|
15213
|
+
chains.push({ rel: r5, chain: [a.id, b.id], sameRank: true });
|
|
15214
15214
|
continue;
|
|
15215
15215
|
}
|
|
15216
15216
|
const lo = a.rank < b.rank ? a : b;
|
|
15217
15217
|
const hi = a.rank < b.rank ? b : a;
|
|
15218
15218
|
const diff = hi.rank - lo.rank;
|
|
15219
15219
|
if (diff === 1) {
|
|
15220
|
-
chains.push({ rel:
|
|
15220
|
+
chains.push({ rel: r5, chain: [r5.from, r5.to], sameRank: false });
|
|
15221
15221
|
continue;
|
|
15222
15222
|
}
|
|
15223
15223
|
const innerDummies = [];
|
|
@@ -15238,7 +15238,7 @@ function buildLayeredGraph(rels, boxes, rankByID) {
|
|
|
15238
15238
|
}
|
|
15239
15239
|
const lowToHigh = [lo.id, ...innerDummies, hi.id];
|
|
15240
15240
|
const chain = a.rank < b.rank ? lowToHigh : [...lowToHigh].reverse();
|
|
15241
|
-
chains.push({ rel:
|
|
15241
|
+
chains.push({ rel: r5, chain, sameRank: false });
|
|
15242
15242
|
}
|
|
15243
15243
|
return { nodes, chains };
|
|
15244
15244
|
}
|
|
@@ -15278,12 +15278,12 @@ function orderRanks(ranks, chains) {
|
|
|
15278
15278
|
for (let iter = 0; iter < UMLCLASS_CONST.ORDER_ITERATIONS; iter++) {
|
|
15279
15279
|
const downward = iter % 2 === 0;
|
|
15280
15280
|
if (downward) {
|
|
15281
|
-
for (let
|
|
15282
|
-
applyBarycenter(ranks[
|
|
15281
|
+
for (let r5 = 1; r5 < ranks.length; r5++) {
|
|
15282
|
+
applyBarycenter(ranks[r5], ranks[r5 - 1], up);
|
|
15283
15283
|
}
|
|
15284
15284
|
} else {
|
|
15285
|
-
for (let
|
|
15286
|
-
applyBarycenter(ranks[
|
|
15285
|
+
for (let r5 = ranks.length - 2; r5 >= 0; r5--) {
|
|
15286
|
+
applyBarycenter(ranks[r5], ranks[r5 + 1], down);
|
|
15287
15287
|
}
|
|
15288
15288
|
}
|
|
15289
15289
|
}
|
|
@@ -15422,22 +15422,22 @@ function routeEdges(chains, nodes, boxByID, vertical) {
|
|
|
15422
15422
|
const handled = /* @__PURE__ */ new Set();
|
|
15423
15423
|
const groups = /* @__PURE__ */ new Map();
|
|
15424
15424
|
for (const c of chains) {
|
|
15425
|
-
const
|
|
15426
|
-
if (
|
|
15427
|
-
const k = `${
|
|
15428
|
-
if (!groups.has(k)) groups.set(k, { kind:
|
|
15429
|
-
groups.get(k).rels.push(
|
|
15425
|
+
const r5 = c.rel;
|
|
15426
|
+
if (r5.kind !== "generalization" && r5.kind !== "realization") continue;
|
|
15427
|
+
const k = `${r5.kind}::${r5.to}`;
|
|
15428
|
+
if (!groups.has(k)) groups.set(k, { kind: r5.kind, parentId: r5.to, rels: [] });
|
|
15429
|
+
groups.get(k).rels.push(r5);
|
|
15430
15430
|
}
|
|
15431
15431
|
for (const [, group2] of groups) {
|
|
15432
15432
|
if (group2.rels.length < UMLCLASS_CONST.TREE_MERGE_THRESHOLD) continue;
|
|
15433
15433
|
const parent = boxByID.get(group2.parentId);
|
|
15434
15434
|
if (!parent) continue;
|
|
15435
|
-
const children = group2.rels.map((
|
|
15435
|
+
const children = group2.rels.map((r5) => ({ r: r5, box: boxByID.get(r5.from) })).filter((c) => !!c.box);
|
|
15436
15436
|
if (children.length < UMLCLASS_CONST.TREE_MERGE_THRESHOLD) continue;
|
|
15437
15437
|
const tree = buildTree2(group2.kind, parent, children, vertical);
|
|
15438
15438
|
if (tree) {
|
|
15439
15439
|
trees.push(tree);
|
|
15440
|
-
for (const
|
|
15440
|
+
for (const r5 of group2.rels) handled.add(r5);
|
|
15441
15441
|
}
|
|
15442
15442
|
}
|
|
15443
15443
|
const liftLanes = /* @__PURE__ */ new Map();
|
|
@@ -15637,8 +15637,8 @@ function renderUmlClass(text2, config) {
|
|
|
15637
15637
|
return renderUmlClassLayout(layout, config);
|
|
15638
15638
|
}
|
|
15639
15639
|
function renderUmlClassLayout(layout, config) {
|
|
15640
|
-
const theme =
|
|
15641
|
-
const fontFamily = config?.fontFamily ??
|
|
15640
|
+
const theme = chunkNZT5P2XZ_cjs.resolveUmlClassTheme(config?.theme ?? "default");
|
|
15641
|
+
const fontFamily = config?.fontFamily ?? chunkNZT5P2XZ_cjs.DEFAULT_FONT_FAMILY;
|
|
15642
15642
|
const pad = config?.padding ?? 0;
|
|
15643
15643
|
const width = layout.width + pad * 2;
|
|
15644
15644
|
const height = layout.height + pad * 2;
|
|
@@ -15653,25 +15653,25 @@ function renderUmlClassLayout(layout, config) {
|
|
|
15653
15653
|
.sx-umlclass-box-stroke { stroke: ${theme.classifierStroke}; stroke-width: ${BOX_STROKE_W}; fill: none; }
|
|
15654
15654
|
.sx-umlclass-header-fill { fill: ${theme.headerFill}; }
|
|
15655
15655
|
.sx-umlclass-divider { stroke: ${theme.classifierStroke}; stroke-width: ${DIVIDER_STROKE_W}; }
|
|
15656
|
-
.sx-umlclass-classname { fill: ${theme.nameText}; font-size: ${
|
|
15656
|
+
.sx-umlclass-classname { fill: ${theme.nameText}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label + 1}px; font-weight: 700; letter-spacing: -0.01em; }
|
|
15657
15657
|
.sx-umlclass-classname[data-abstract="true"] { font-style: italic; }
|
|
15658
|
-
.sx-umlclass-stereotype { fill: ${theme.stereotypeText}; font-size: ${
|
|
15659
|
-
.sx-umlclass-member { fill: ${theme.memberText}; font-size: ${
|
|
15658
|
+
.sx-umlclass-stereotype { fill: ${theme.stereotypeText}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small + 1}px; font-style: italic; }
|
|
15659
|
+
.sx-umlclass-member { fill: ${theme.memberText}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label}px; font-weight: 500; }
|
|
15660
15660
|
.sx-umlclass-member[data-static] { text-decoration: underline; }
|
|
15661
15661
|
.sx-umlclass-member[data-abstract] { font-style: italic; }
|
|
15662
|
-
.sx-umlclass-visibility { fill: ${theme.visibilityText}; font-size: ${
|
|
15662
|
+
.sx-umlclass-visibility { fill: ${theme.visibilityText}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label}px; font-weight: 500; }
|
|
15663
15663
|
.sx-umlclass-rel-line { stroke: ${theme.relationStroke}; stroke-width: ${REL_STROKE_W}; fill: none; }
|
|
15664
15664
|
.sx-umlclass-rel-line[data-dashed="true"] { stroke-dasharray: 5 4; }
|
|
15665
15665
|
.sx-umlclass-triangle { fill: ${theme.adornmentHollowFill}; stroke: ${theme.relationStroke}; stroke-width: ${REL_STROKE_W}; stroke-linejoin: miter; }
|
|
15666
15666
|
.sx-umlclass-diamond-hollow { fill: ${theme.adornmentHollowFill}; stroke: ${theme.relationStroke}; stroke-width: ${REL_STROKE_W}; stroke-linejoin: miter; }
|
|
15667
15667
|
.sx-umlclass-diamond-filled { fill: ${theme.adornmentFill}; stroke: ${theme.relationStroke}; stroke-width: ${REL_STROKE_W}; stroke-linejoin: miter; }
|
|
15668
15668
|
.sx-umlclass-arrowhead { fill: none; stroke: ${theme.relationStroke}; stroke-width: ${REL_STROKE_W}; stroke-linejoin: miter; }
|
|
15669
|
-
.sx-umlclass-edge-label { fill: ${theme.edgeLabel}; font-size: ${
|
|
15670
|
-
.sx-umlclass-edge-name { fill: ${theme.edgeLabel}; font-size: ${
|
|
15669
|
+
.sx-umlclass-edge-label { fill: ${theme.edgeLabel}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small + 1}px; font-weight: 500; }
|
|
15670
|
+
.sx-umlclass-edge-name { fill: ${theme.edgeLabel}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label}px; font-style: italic; }
|
|
15671
15671
|
.sx-umlclass-edge-name-halo { fill: ${theme.bg}; stroke: ${theme.bg}; stroke-width: ${UMLCLASS_CONST.EDGE_LABEL_HALO}; stroke-linejoin: round; }
|
|
15672
|
-
.sx-umlclass-title { fill: ${theme.nameText}; font-size: ${
|
|
15672
|
+
.sx-umlclass-title { fill: ${theme.nameText}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.title}px; font-weight: 600; }
|
|
15673
15673
|
.sx-umlclass-package { fill: ${theme.packageFill}; stroke: ${theme.packageStroke}; stroke-width: 1; }
|
|
15674
|
-
.sx-umlclass-package-label { fill: ${theme.packageLabel}; font-size: ${
|
|
15674
|
+
.sx-umlclass-package-label { fill: ${theme.packageLabel}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label}px; font-weight: 600; }
|
|
15675
15675
|
`.trim()
|
|
15676
15676
|
);
|
|
15677
15677
|
const children = [
|
|
@@ -15890,8 +15890,8 @@ function escapeXmlText(s) {
|
|
|
15890
15890
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
15891
15891
|
}
|
|
15892
15892
|
function renderEdge4(e) {
|
|
15893
|
-
const
|
|
15894
|
-
const dashed =
|
|
15893
|
+
const r5 = e.rel;
|
|
15894
|
+
const dashed = r5.kind === "realization" || r5.kind === "dependency";
|
|
15895
15895
|
const parts = [];
|
|
15896
15896
|
parts.push(
|
|
15897
15897
|
chunk3WNW5Y7P_cjs.path({
|
|
@@ -15900,15 +15900,15 @@ function renderEdge4(e) {
|
|
|
15900
15900
|
"data-dashed": dashed ? "true" : void 0
|
|
15901
15901
|
})
|
|
15902
15902
|
);
|
|
15903
|
-
parts.push(renderTargetAdornment(
|
|
15904
|
-
if (
|
|
15905
|
-
parts.push(renderSourceDiamond(
|
|
15906
|
-
}
|
|
15907
|
-
if (
|
|
15908
|
-
if (
|
|
15909
|
-
if (
|
|
15910
|
-
if (
|
|
15911
|
-
if (
|
|
15903
|
+
parts.push(renderTargetAdornment(r5.kind, e.targetEnd));
|
|
15904
|
+
if (r5.kind === "composition" || r5.kind === "aggregation") {
|
|
15905
|
+
parts.push(renderSourceDiamond(r5.kind, e.sourceEnd));
|
|
15906
|
+
}
|
|
15907
|
+
if (r5.sourceMult) parts.push(renderEndLabel(e.sourceEnd, r5.sourceMult, false));
|
|
15908
|
+
if (r5.targetMult) parts.push(renderEndLabel(e.targetEnd, r5.targetMult, false));
|
|
15909
|
+
if (r5.sourceRole) parts.push(renderEndLabel(e.sourceEnd, r5.sourceRole, true));
|
|
15910
|
+
if (r5.targetRole) parts.push(renderEndLabel(e.targetEnd, r5.targetRole, true));
|
|
15911
|
+
if (r5.label && e.labelAnchor) {
|
|
15912
15912
|
parts.push(
|
|
15913
15913
|
chunk3WNW5Y7P_cjs.text(
|
|
15914
15914
|
{
|
|
@@ -15917,7 +15917,7 @@ function renderEdge4(e) {
|
|
|
15917
15917
|
class: "sx-umlclass-edge-name sx-umlclass-edge-name-halo",
|
|
15918
15918
|
"text-anchor": "middle"
|
|
15919
15919
|
},
|
|
15920
|
-
|
|
15920
|
+
r5.label
|
|
15921
15921
|
)
|
|
15922
15922
|
);
|
|
15923
15923
|
parts.push(
|
|
@@ -15928,19 +15928,19 @@ function renderEdge4(e) {
|
|
|
15928
15928
|
class: "sx-umlclass-edge-name",
|
|
15929
15929
|
"text-anchor": "middle"
|
|
15930
15930
|
},
|
|
15931
|
-
|
|
15931
|
+
r5.label
|
|
15932
15932
|
)
|
|
15933
15933
|
);
|
|
15934
15934
|
}
|
|
15935
15935
|
return chunk3WNW5Y7P_cjs.group(
|
|
15936
15936
|
{
|
|
15937
15937
|
class: "sx-umlclass-rel",
|
|
15938
|
-
"data-from":
|
|
15939
|
-
"data-to":
|
|
15940
|
-
"data-kind":
|
|
15941
|
-
"data-source-mult":
|
|
15942
|
-
"data-target-mult":
|
|
15943
|
-
"data-name":
|
|
15938
|
+
"data-from": r5.from,
|
|
15939
|
+
"data-to": r5.to,
|
|
15940
|
+
"data-kind": r5.kind,
|
|
15941
|
+
"data-source-mult": r5.sourceMult,
|
|
15942
|
+
"data-target-mult": r5.targetMult,
|
|
15943
|
+
"data-name": r5.label
|
|
15944
15944
|
},
|
|
15945
15945
|
parts
|
|
15946
15946
|
);
|
|
@@ -16095,8 +16095,8 @@ function summariseDiagram(ast, treeCount) {
|
|
|
16095
16095
|
byKind[k] = (byKind[k] ?? 0) + 1;
|
|
16096
16096
|
}
|
|
16097
16097
|
const relsByKind = {};
|
|
16098
|
-
for (const
|
|
16099
|
-
relsByKind[
|
|
16098
|
+
for (const r5 of ast.relationships) {
|
|
16099
|
+
relsByKind[r5.kind] = (relsByKind[r5.kind] ?? 0) + 1;
|
|
16100
16100
|
}
|
|
16101
16101
|
const classifierStr = Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ");
|
|
16102
16102
|
const relStr = Object.entries(relsByKind).map(([k, n]) => `${n} ${k}`).join(", ");
|
|
@@ -16328,9 +16328,9 @@ function validate(ast) {
|
|
|
16328
16328
|
if (!e.gate) continue;
|
|
16329
16329
|
const refs = [...e.gate.inputs];
|
|
16330
16330
|
if (e.gate.condition && isId(e.gate.condition)) refs.push(e.gate.condition);
|
|
16331
|
-
for (const
|
|
16332
|
-
if (!byId.has(
|
|
16333
|
-
throw new FaultTreeParseError(`gate ${e.id} references undefined event '${
|
|
16331
|
+
for (const r5 of refs) {
|
|
16332
|
+
if (!byId.has(r5)) {
|
|
16333
|
+
throw new FaultTreeParseError(`gate ${e.id} references undefined event '${r5}'`);
|
|
16334
16334
|
}
|
|
16335
16335
|
}
|
|
16336
16336
|
if (e.gate.kind === "voting") {
|
|
@@ -16402,9 +16402,9 @@ function parseProb(s, lineNo) {
|
|
|
16402
16402
|
return n;
|
|
16403
16403
|
}
|
|
16404
16404
|
function splitRefs(s, lineNo) {
|
|
16405
|
-
const refs = s.split(",").map((
|
|
16406
|
-
for (const
|
|
16407
|
-
if (!isId(
|
|
16405
|
+
const refs = s.split(",").map((r5) => r5.trim()).filter(Boolean);
|
|
16406
|
+
for (const r5 of refs) {
|
|
16407
|
+
if (!isId(r5)) throw new FaultTreeParseError(`invalid event reference "${r5}"`, lineNo);
|
|
16408
16408
|
}
|
|
16409
16409
|
if (refs.length === 0) throw new FaultTreeParseError(`empty input list`, lineNo);
|
|
16410
16410
|
return refs;
|
|
@@ -17007,8 +17007,8 @@ function renderFaultTree(text2, config) {
|
|
|
17007
17007
|
return renderFaultTreeLayout(layout, config);
|
|
17008
17008
|
}
|
|
17009
17009
|
function renderFaultTreeLayout(layout, config) {
|
|
17010
|
-
const theme =
|
|
17011
|
-
const fontFamily = config?.fontFamily ??
|
|
17010
|
+
const theme = chunkNZT5P2XZ_cjs.resolveReliabilityTheme(config?.theme ?? "default");
|
|
17011
|
+
const fontFamily = config?.fontFamily ?? chunkNZT5P2XZ_cjs.DEFAULT_FONT_FAMILY;
|
|
17012
17012
|
const pad = config?.padding ?? 0;
|
|
17013
17013
|
const { ast, analysis } = layout;
|
|
17014
17014
|
const showProb = ast.analysis.probability;
|
|
@@ -17020,27 +17020,27 @@ function renderFaultTreeLayout(layout, config) {
|
|
|
17020
17020
|
{},
|
|
17021
17021
|
`
|
|
17022
17022
|
.sx-ft-bg { fill: ${theme.bg}; }
|
|
17023
|
-
.sx-ft-event { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${
|
|
17023
|
+
.sx-ft-event { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17024
17024
|
.sx-ft-event[data-role="top"] { stroke: ${theme.topEventStroke}; stroke-width: 2.25; }
|
|
17025
|
-
.sx-ft-basic { fill: ${theme.basicFill}; stroke: ${theme.basicStroke}; stroke-width: ${
|
|
17026
|
-
.sx-ft-undeveloped { fill: ${theme.undevelopedFill}; stroke: ${theme.basicStroke}; stroke-width: ${
|
|
17027
|
-
.sx-ft-house { fill: ${theme.houseFill}; stroke: ${theme.eventStroke}; stroke-width: ${
|
|
17028
|
-
.sx-ft-gate { fill: ${theme.gateFill}; stroke: ${theme.gateStroke}; stroke-width: ${
|
|
17029
|
-
.sx-ft-cond { fill: ${theme.conditionFill}; stroke: ${theme.eventStroke}; stroke-width: ${
|
|
17030
|
-
.sx-ft-pin, .sx-ft-edge { fill: none; stroke: ${theme.edgeStroke}; stroke-width: ${
|
|
17031
|
-
.sx-ft-shared-mark { fill: none; stroke: ${theme.basicStroke}; stroke-width: ${
|
|
17032
|
-
.sx-ft-label { fill: ${theme.eventStroke}; font-size: ${
|
|
17033
|
-
.sx-ft-id { fill: ${theme.eventStroke}; font-size: ${
|
|
17034
|
-
.sx-ft-cap { fill: ${theme.eventStroke}; font-size: ${
|
|
17035
|
-
.sx-ft-prob { fill: ${theme.probText}; font-size: ${
|
|
17036
|
-
.sx-ft-gate-label { fill: ${theme.gateStroke}; font-size: ${
|
|
17037
|
-
.sx-ft-cond-text { fill: ${theme.eventStroke}; font-size: ${
|
|
17038
|
-
.sx-ft-cutset { fill: ${theme.cutsetFill}; stroke: ${theme.cutsetStroke}; stroke-width: ${
|
|
17039
|
-
.sx-ft-cutset[data-spof="true"] { stroke: ${theme.spofStroke}; stroke-width: ${
|
|
17040
|
-
.sx-ft-ptop { fill: ${theme.probText}; font-size: ${
|
|
17041
|
-
.sx-ft-transfer { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${
|
|
17042
|
-
.sx-ft-transfer-label { fill: ${theme.eventStroke}; font-size: ${
|
|
17043
|
-
.sx-ft-title { fill: ${theme.eventStroke}; font-size: ${
|
|
17025
|
+
.sx-ft-basic { fill: ${theme.basicFill}; stroke: ${theme.basicStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17026
|
+
.sx-ft-undeveloped { fill: ${theme.undevelopedFill}; stroke: ${theme.basicStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17027
|
+
.sx-ft-house { fill: ${theme.houseFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17028
|
+
.sx-ft-gate { fill: ${theme.gateFill}; stroke: ${theme.gateStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; stroke-linejoin: round; }
|
|
17029
|
+
.sx-ft-cond { fill: ${theme.conditionFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.thin}; }
|
|
17030
|
+
.sx-ft-pin, .sx-ft-edge { fill: none; stroke: ${theme.edgeStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17031
|
+
.sx-ft-shared-mark { fill: none; stroke: ${theme.basicStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17032
|
+
.sx-ft-label { fill: ${theme.eventStroke}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label}px; font-weight: 600; }
|
|
17033
|
+
.sx-ft-id { fill: ${theme.eventStroke}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small + 1}px; font-weight: 700; }
|
|
17034
|
+
.sx-ft-cap { fill: ${theme.eventStroke}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small}px; }
|
|
17035
|
+
.sx-ft-prob { fill: ${theme.probText}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small}px; font-weight: 600; }
|
|
17036
|
+
.sx-ft-gate-label { fill: ${theme.gateStroke}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small}px; font-weight: 700; }
|
|
17037
|
+
.sx-ft-cond-text { fill: ${theme.eventStroke}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small}px; }
|
|
17038
|
+
.sx-ft-cutset { fill: ${theme.cutsetFill}; stroke: ${theme.cutsetStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17039
|
+
.sx-ft-cutset[data-spof="true"] { stroke: ${theme.spofStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.thick}; }
|
|
17040
|
+
.sx-ft-ptop { fill: ${theme.probText}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label}px; font-weight: 700; }
|
|
17041
|
+
.sx-ft-transfer { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17042
|
+
.sx-ft-transfer-label { fill: ${theme.eventStroke}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small}px; font-weight: 600; }
|
|
17043
|
+
.sx-ft-title { fill: ${theme.eventStroke}; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.title}px; font-weight: 700; }
|
|
17044
17044
|
`.trim()
|
|
17045
17045
|
);
|
|
17046
17046
|
const instById = new Map(layout.events.map((e) => [e.instanceId, e]));
|
|
@@ -17122,10 +17122,10 @@ function renderEvent(e, showProb) {
|
|
|
17122
17122
|
parts.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: cy + 3, class: "sx-ft-id", "text-anchor": "middle" }, e.event.id));
|
|
17123
17123
|
parts.push(...leafCaption(e, cy + FAULTTREE_CONST.BASIC_R, label, showProb));
|
|
17124
17124
|
} else if (e.role === "undeveloped") {
|
|
17125
|
-
const
|
|
17126
|
-
parts.push(chunk3WNW5Y7P_cjs.path({ d: `M ${e.cx} ${cy -
|
|
17125
|
+
const r5 = FAULTTREE_CONST.DIAMOND_W / 2;
|
|
17126
|
+
parts.push(chunk3WNW5Y7P_cjs.path({ d: `M ${e.cx} ${cy - r5} L ${e.cx + r5} ${cy} L ${e.cx} ${cy + r5} L ${e.cx - r5} ${cy} Z`, class: "sx-ft-undeveloped" }));
|
|
17127
17127
|
parts.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: cy + 3, class: "sx-ft-id", "text-anchor": "middle" }, e.event.id));
|
|
17128
|
-
parts.push(...leafCaption(e, cy +
|
|
17128
|
+
parts.push(...leafCaption(e, cy + r5, label, showProb));
|
|
17129
17129
|
} else if (e.role === "house") {
|
|
17130
17130
|
const w = FAULTTREE_CONST.HOUSE_W, h = FAULTTREE_CONST.HOUSE_H, roofH = h * 0.34;
|
|
17131
17131
|
const top = cy - h / 2, bottom = cy + h / 2, L = e.cx - w / 2, R = e.cx + w / 2;
|
|
@@ -17272,6 +17272,619 @@ var faulttree = {
|
|
|
17272
17272
|
}
|
|
17273
17273
|
};
|
|
17274
17274
|
|
|
17275
|
+
// src/diagrams/bowtie/parser.ts
|
|
17276
|
+
var BowtieParseError = class extends Error {
|
|
17277
|
+
constructor(message, line2) {
|
|
17278
|
+
super(line2 ? `Line ${line2}: ${message}` : message);
|
|
17279
|
+
this.line = line2;
|
|
17280
|
+
this.name = "BowtieParseError";
|
|
17281
|
+
}
|
|
17282
|
+
line;
|
|
17283
|
+
};
|
|
17284
|
+
function parseBowtie(text2) {
|
|
17285
|
+
const ast = {
|
|
17286
|
+
type: "bowtie",
|
|
17287
|
+
layout: "symmetric",
|
|
17288
|
+
topEvent: "",
|
|
17289
|
+
threats: [],
|
|
17290
|
+
consequences: [],
|
|
17291
|
+
warnings: []
|
|
17292
|
+
};
|
|
17293
|
+
const rawLines = text2.split(/\r?\n/);
|
|
17294
|
+
let i = 0;
|
|
17295
|
+
let topEventCount = 0;
|
|
17296
|
+
let hazardCount = 0;
|
|
17297
|
+
let headerSeen = false;
|
|
17298
|
+
while (i < rawLines.length) {
|
|
17299
|
+
const t = stripComment5(rawLines[i] ?? "").trim();
|
|
17300
|
+
if (t === "") {
|
|
17301
|
+
i++;
|
|
17302
|
+
continue;
|
|
17303
|
+
}
|
|
17304
|
+
const h = /^bowtie\b(.*)$/i.exec(t);
|
|
17305
|
+
if (h) {
|
|
17306
|
+
const q = matchQuoted3(h[1].trim());
|
|
17307
|
+
if (q) ast.title = q.value;
|
|
17308
|
+
headerSeen = true;
|
|
17309
|
+
i++;
|
|
17310
|
+
break;
|
|
17311
|
+
}
|
|
17312
|
+
headerSeen = true;
|
|
17313
|
+
break;
|
|
17314
|
+
}
|
|
17315
|
+
if (!headerSeen) return ast;
|
|
17316
|
+
let curThreat = null;
|
|
17317
|
+
let curConsequence = null;
|
|
17318
|
+
let curBarrier = null;
|
|
17319
|
+
let curEscalation = null;
|
|
17320
|
+
let tCount = 0, cCount = 0;
|
|
17321
|
+
for (; i < rawLines.length; i++) {
|
|
17322
|
+
const t = stripComment5(rawLines[i] ?? "").trim();
|
|
17323
|
+
if (t === "") continue;
|
|
17324
|
+
const lineNo = i + 1;
|
|
17325
|
+
if (/^layout\s*:/i.test(t)) {
|
|
17326
|
+
const v = afterColon3(t).toLowerCase();
|
|
17327
|
+
if (v === "symmetric" || v === "compact") ast.layout = v;
|
|
17328
|
+
continue;
|
|
17329
|
+
}
|
|
17330
|
+
if (/^legend\s*:/i.test(t)) {
|
|
17331
|
+
const v = afterColon3(t).toLowerCase();
|
|
17332
|
+
if (v === "on" || v === "off" || v === "bottom" || v === "bottom-right" || v === "top") {
|
|
17333
|
+
ast.legend = v;
|
|
17334
|
+
}
|
|
17335
|
+
continue;
|
|
17336
|
+
}
|
|
17337
|
+
if (/^theme\s*:/i.test(t)) {
|
|
17338
|
+
continue;
|
|
17339
|
+
}
|
|
17340
|
+
const kw = /^(hazard|topevent|threat|consequence|prevent|mitigate|escalation|barrier)\b/i.exec(t);
|
|
17341
|
+
if (!kw) {
|
|
17342
|
+
ast.warnings.push(`Line ${lineNo}: unrecognised line: "${truncate4(t, 80)}"`);
|
|
17343
|
+
continue;
|
|
17344
|
+
}
|
|
17345
|
+
const keyword = kw[1].toLowerCase();
|
|
17346
|
+
const label = requireLabel(t.slice(kw[0].length).trim(), keyword, lineNo);
|
|
17347
|
+
switch (keyword) {
|
|
17348
|
+
case "hazard": {
|
|
17349
|
+
hazardCount++;
|
|
17350
|
+
if (hazardCount > 1) throw new BowtieParseError(`a bowtie has at most one hazard header \u2014 found a second: "${label}"`, lineNo);
|
|
17351
|
+
ast.hazard = label;
|
|
17352
|
+
break;
|
|
17353
|
+
}
|
|
17354
|
+
case "topevent": {
|
|
17355
|
+
topEventCount++;
|
|
17356
|
+
if (topEventCount > 1) throw new BowtieParseError(`a bowtie has exactly one top event \u2014 found a second: "${label}"`, lineNo);
|
|
17357
|
+
ast.topEvent = label;
|
|
17358
|
+
break;
|
|
17359
|
+
}
|
|
17360
|
+
case "threat": {
|
|
17361
|
+
curThreat = { id: `T${++tCount}`, label, barriers: [] };
|
|
17362
|
+
ast.threats.push(curThreat);
|
|
17363
|
+
curConsequence = null;
|
|
17364
|
+
curBarrier = null;
|
|
17365
|
+
curEscalation = null;
|
|
17366
|
+
break;
|
|
17367
|
+
}
|
|
17368
|
+
case "consequence": {
|
|
17369
|
+
curConsequence = { id: `C${++cCount}`, label, barriers: [] };
|
|
17370
|
+
ast.consequences.push(curConsequence);
|
|
17371
|
+
curThreat = null;
|
|
17372
|
+
curBarrier = null;
|
|
17373
|
+
curEscalation = null;
|
|
17374
|
+
break;
|
|
17375
|
+
}
|
|
17376
|
+
case "prevent": {
|
|
17377
|
+
if (!curThreat) {
|
|
17378
|
+
throw new BowtieParseError(`preventative barrier "${label}" is not under a threat \u2014 a \`prevent\` line must follow a \`threat\``, lineNo);
|
|
17379
|
+
}
|
|
17380
|
+
curBarrier = {
|
|
17381
|
+
id: `${curThreat.id}-b${curThreat.barriers.length}`,
|
|
17382
|
+
label,
|
|
17383
|
+
side: "prevent",
|
|
17384
|
+
escalations: []
|
|
17385
|
+
};
|
|
17386
|
+
curThreat.barriers.push(curBarrier);
|
|
17387
|
+
curEscalation = null;
|
|
17388
|
+
break;
|
|
17389
|
+
}
|
|
17390
|
+
case "mitigate": {
|
|
17391
|
+
if (!curConsequence) {
|
|
17392
|
+
throw new BowtieParseError(`mitigative barrier "${label}" is not under a consequence \u2014 a \`mitigate\` line must follow a \`consequence\``, lineNo);
|
|
17393
|
+
}
|
|
17394
|
+
curBarrier = {
|
|
17395
|
+
id: `${curConsequence.id}-b${curConsequence.barriers.length}`,
|
|
17396
|
+
label,
|
|
17397
|
+
side: "mitigate",
|
|
17398
|
+
escalations: []
|
|
17399
|
+
};
|
|
17400
|
+
curConsequence.barriers.push(curBarrier);
|
|
17401
|
+
curEscalation = null;
|
|
17402
|
+
break;
|
|
17403
|
+
}
|
|
17404
|
+
case "escalation": {
|
|
17405
|
+
if (!curBarrier) {
|
|
17406
|
+
throw new BowtieParseError(`escalation factor "${label}" is not attached to a barrier \u2014 escalation factors must degrade a specific named barrier (add it under a \`prevent\`/\`mitigate\` line)`, lineNo);
|
|
17407
|
+
}
|
|
17408
|
+
curEscalation = {
|
|
17409
|
+
id: `${curBarrier.id}-x${curBarrier.escalations.length}`,
|
|
17410
|
+
label,
|
|
17411
|
+
barriers: []
|
|
17412
|
+
};
|
|
17413
|
+
curBarrier.escalations.push(curEscalation);
|
|
17414
|
+
break;
|
|
17415
|
+
}
|
|
17416
|
+
case "barrier": {
|
|
17417
|
+
if (!curEscalation) {
|
|
17418
|
+
throw new BowtieParseError(`escalation-factor barrier "${label}" is not under an escalation factor \u2014 a \`barrier\` line must follow an \`escalation\``, lineNo);
|
|
17419
|
+
}
|
|
17420
|
+
const ef = {
|
|
17421
|
+
id: `${curEscalation.id}-b${curEscalation.barriers.length}`,
|
|
17422
|
+
label
|
|
17423
|
+
};
|
|
17424
|
+
curEscalation.barriers.push(ef);
|
|
17425
|
+
break;
|
|
17426
|
+
}
|
|
17427
|
+
}
|
|
17428
|
+
}
|
|
17429
|
+
validate2(ast);
|
|
17430
|
+
return ast;
|
|
17431
|
+
}
|
|
17432
|
+
function validate2(ast) {
|
|
17433
|
+
if (!ast.topEvent) {
|
|
17434
|
+
throw new BowtieParseError(`a bowtie has exactly one top event \u2014 declare it with a \`topevent "\u2026"\` line`);
|
|
17435
|
+
}
|
|
17436
|
+
if (ast.threats.length === 0) {
|
|
17437
|
+
throw new BowtieParseError(`a bowtie needs at least one threat \u2014 a diagram with no left wing is a fault tree (see faulttree), not a bowtie`);
|
|
17438
|
+
}
|
|
17439
|
+
if (ast.consequences.length === 0) {
|
|
17440
|
+
throw new BowtieParseError(`a bowtie needs at least one consequence \u2014 a diagram with no right wing is an event tree, not a bowtie`);
|
|
17441
|
+
}
|
|
17442
|
+
for (const th of ast.threats) {
|
|
17443
|
+
if (th.barriers.length === 0) {
|
|
17444
|
+
throw new BowtieParseError(
|
|
17445
|
+
`Threat "${th.label}" has no preventative barrier \u2014 every threat must reach the top event through at least one barrier (CCPS/EI barrier rule). Add a \`prevent\` line under it.`
|
|
17446
|
+
);
|
|
17447
|
+
}
|
|
17448
|
+
}
|
|
17449
|
+
for (const co of ast.consequences) {
|
|
17450
|
+
if (co.barriers.length === 0) {
|
|
17451
|
+
throw new BowtieParseError(
|
|
17452
|
+
`Consequence "${co.label}" has no mitigative barrier \u2014 every consequence must be limited by at least one barrier (CCPS/EI barrier rule). Add a \`mitigate\` line under it.`
|
|
17453
|
+
);
|
|
17454
|
+
}
|
|
17455
|
+
}
|
|
17456
|
+
}
|
|
17457
|
+
function requireLabel(s, keyword, lineNo) {
|
|
17458
|
+
const q = matchQuoted3(s);
|
|
17459
|
+
if (q) return q.value;
|
|
17460
|
+
const bare = s.trim();
|
|
17461
|
+
if (!bare) throw new BowtieParseError(`\`${keyword}\` needs a label`, lineNo);
|
|
17462
|
+
if (/\s/.test(bare)) {
|
|
17463
|
+
throw new BowtieParseError(`\`${keyword}\` label with spaces must be quoted: ${keyword} "${bare}"`, lineNo);
|
|
17464
|
+
}
|
|
17465
|
+
return bare;
|
|
17466
|
+
}
|
|
17467
|
+
function matchQuoted3(s) {
|
|
17468
|
+
if (!s) return void 0;
|
|
17469
|
+
const open = s[0];
|
|
17470
|
+
if (open !== '"' && open !== "\u300C" && open !== "\u201C" && open !== "\u300E") return void 0;
|
|
17471
|
+
const close = closingQuote3(open);
|
|
17472
|
+
const end = s.indexOf(close, 1);
|
|
17473
|
+
if (end < 0) return void 0;
|
|
17474
|
+
return { value: s.slice(1, end), length: end + 1 };
|
|
17475
|
+
}
|
|
17476
|
+
function closingQuote3(open) {
|
|
17477
|
+
return open === "\u300C" ? "\u300D" : open === "\u300E" ? "\u300F" : open === "\u201C" ? "\u201D" : '"';
|
|
17478
|
+
}
|
|
17479
|
+
function afterColon3(s) {
|
|
17480
|
+
const i = s.indexOf(":");
|
|
17481
|
+
return i < 0 ? "" : s.slice(i + 1).trim();
|
|
17482
|
+
}
|
|
17483
|
+
function stripComment5(line2) {
|
|
17484
|
+
let inQ = false, qc = "";
|
|
17485
|
+
for (let i = 0; i < line2.length; i++) {
|
|
17486
|
+
const ch = line2[i];
|
|
17487
|
+
if (inQ) {
|
|
17488
|
+
if (ch === qc) inQ = false;
|
|
17489
|
+
continue;
|
|
17490
|
+
}
|
|
17491
|
+
if (ch === '"' || ch === "\u300C" || ch === "\u201C" || ch === "\u300E") {
|
|
17492
|
+
inQ = true;
|
|
17493
|
+
qc = closingQuote3(ch);
|
|
17494
|
+
continue;
|
|
17495
|
+
}
|
|
17496
|
+
if (ch === "#") return line2.slice(0, i);
|
|
17497
|
+
if (ch === "/" && line2[i + 1] === "/") return line2.slice(0, i);
|
|
17498
|
+
}
|
|
17499
|
+
return line2;
|
|
17500
|
+
}
|
|
17501
|
+
function truncate4(s, n) {
|
|
17502
|
+
return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
|
|
17503
|
+
}
|
|
17504
|
+
|
|
17505
|
+
// src/diagrams/bowtie/layout.ts
|
|
17506
|
+
var BOWTIE_CONST = {
|
|
17507
|
+
TOPEVENT_R: 52,
|
|
17508
|
+
NODE_W: 132,
|
|
17509
|
+
NODE_H: 44,
|
|
17510
|
+
BARRIER_W: 120,
|
|
17511
|
+
WING_X_STEP: 168,
|
|
17512
|
+
ROW_BAND_H: 96,
|
|
17513
|
+
ROW_GAP: 24,
|
|
17514
|
+
EF_DROP: 72,
|
|
17515
|
+
EF_GAP: 16,
|
|
17516
|
+
CENTER_GUTTER: 40,
|
|
17517
|
+
HAZARD_GAP: 40,
|
|
17518
|
+
HAZARD_W: 220,
|
|
17519
|
+
PAGE_PAD: 32,
|
|
17520
|
+
TITLE_H: 34,
|
|
17521
|
+
LEGEND_H: 30
|
|
17522
|
+
};
|
|
17523
|
+
function dropBottom(barrier) {
|
|
17524
|
+
const C2 = BOWTIE_CONST;
|
|
17525
|
+
if (barrier.escalations.length === 0) return C2.NODE_H / 2;
|
|
17526
|
+
let cursor = C2.EF_DROP;
|
|
17527
|
+
let lastBottom = C2.NODE_H / 2;
|
|
17528
|
+
for (const esc of barrier.escalations) {
|
|
17529
|
+
lastBottom = cursor + C2.NODE_H / 2;
|
|
17530
|
+
cursor += C2.NODE_H + C2.EF_GAP;
|
|
17531
|
+
for (const _ef of esc.barriers) {
|
|
17532
|
+
lastBottom = cursor + C2.NODE_H / 2;
|
|
17533
|
+
cursor += C2.NODE_H + C2.EF_GAP;
|
|
17534
|
+
}
|
|
17535
|
+
}
|
|
17536
|
+
return lastBottom;
|
|
17537
|
+
}
|
|
17538
|
+
function bandLayout(lines) {
|
|
17539
|
+
const C2 = BOWTIE_CONST;
|
|
17540
|
+
const below = lines.map((l) => Math.max(...l.barriers.map(dropBottom), C2.NODE_H / 2));
|
|
17541
|
+
const rel = [];
|
|
17542
|
+
for (let k = 0; k < lines.length; k++) {
|
|
17543
|
+
if (k === 0) {
|
|
17544
|
+
rel.push(0);
|
|
17545
|
+
continue;
|
|
17546
|
+
}
|
|
17547
|
+
const pitch = Math.max(C2.ROW_BAND_H, below[k - 1] + C2.ROW_GAP + C2.NODE_H / 2);
|
|
17548
|
+
rel.push(rel[k - 1] + pitch);
|
|
17549
|
+
}
|
|
17550
|
+
const last = lines.length - 1;
|
|
17551
|
+
const blockMid = lines.length ? rel[last] / 2 : 0;
|
|
17552
|
+
const aboveExtent = lines.length ? blockMid + C2.NODE_H / 2 : 0;
|
|
17553
|
+
const belowExtent = lines.length ? rel[last] - blockMid + below[last] : 0;
|
|
17554
|
+
return { rel, below, blockMid, aboveExtent, belowExtent };
|
|
17555
|
+
}
|
|
17556
|
+
function layoutBowtie(ast) {
|
|
17557
|
+
const C2 = BOWTIE_CONST;
|
|
17558
|
+
const boxes = [];
|
|
17559
|
+
const lines = [];
|
|
17560
|
+
const escalationLines = [];
|
|
17561
|
+
const threatLines = ast.threats.map((t) => ({ id: t.id, label: t.label, barriers: t.barriers }));
|
|
17562
|
+
const conseqLines = ast.consequences.map((c) => ({ id: c.id, label: c.label, barriers: c.barriers }));
|
|
17563
|
+
const left = bandLayout(threatLines);
|
|
17564
|
+
const right = bandLayout(conseqLines);
|
|
17565
|
+
const aboveCy = Math.max(left.aboveExtent, right.aboveExtent, C2.TOPEVENT_R);
|
|
17566
|
+
const maxLeftChain = Math.max(0, ...threatLines.map((l) => l.barriers.length));
|
|
17567
|
+
const innerOffset = C2.TOPEVENT_R + C2.CENTER_GUTTER + C2.BARRIER_W / 2;
|
|
17568
|
+
const cx = C2.PAGE_PAD + C2.NODE_W / 2 + maxLeftChain * C2.WING_X_STEP + innerOffset;
|
|
17569
|
+
const titleZone = ast.title ? C2.TITLE_H : 0;
|
|
17570
|
+
const hazardReserve = ast.hazard ? C2.NODE_H + C2.HAZARD_GAP : 0;
|
|
17571
|
+
const cy = C2.PAGE_PAD + titleZone + hazardReserve + aboveCy;
|
|
17572
|
+
const topEvent = { cx, cy, r: C2.TOPEVENT_R, label: ast.topEvent };
|
|
17573
|
+
let hazardTie;
|
|
17574
|
+
if (ast.hazard) {
|
|
17575
|
+
const hcy = C2.PAGE_PAD + titleZone + C2.NODE_H / 2;
|
|
17576
|
+
boxes.push({ id: "hazard", role: "hazard", label: ast.hazard, cx, cy: hcy, width: C2.HAZARD_W, height: C2.NODE_H });
|
|
17577
|
+
hazardTie = { x: cx, y1: hcy + C2.NODE_H / 2, y2: cy - C2.TOPEVENT_R };
|
|
17578
|
+
}
|
|
17579
|
+
const emitWing = (wing, band, side) => {
|
|
17580
|
+
const innerX = side === "prevent" ? cx - C2.TOPEVENT_R - C2.CENTER_GUTTER - C2.BARRIER_W / 2 : cx + C2.TOPEVENT_R + C2.CENTER_GUTTER + C2.BARRIER_W / 2;
|
|
17581
|
+
wing.forEach((line2, k) => {
|
|
17582
|
+
const by = cy + (band.rel[k] - band.blockMid);
|
|
17583
|
+
const n = line2.barriers.length;
|
|
17584
|
+
const barrierX = line2.barriers.map((_b, j) => {
|
|
17585
|
+
if (side === "prevent") {
|
|
17586
|
+
const stepsFromInner = n - 1 - j;
|
|
17587
|
+
return innerX - stepsFromInner * C2.WING_X_STEP;
|
|
17588
|
+
}
|
|
17589
|
+
return innerX + j * C2.WING_X_STEP;
|
|
17590
|
+
});
|
|
17591
|
+
const outerBarrierX = side === "prevent" ? Math.min(...barrierX) : Math.max(...barrierX);
|
|
17592
|
+
const headX = side === "prevent" ? outerBarrierX - C2.WING_X_STEP : outerBarrierX + C2.WING_X_STEP;
|
|
17593
|
+
boxes.push({
|
|
17594
|
+
id: line2.id,
|
|
17595
|
+
role: side === "prevent" ? "threat" : "consequence",
|
|
17596
|
+
label: line2.label,
|
|
17597
|
+
cx: headX,
|
|
17598
|
+
cy: by,
|
|
17599
|
+
width: C2.NODE_W,
|
|
17600
|
+
height: C2.NODE_H
|
|
17601
|
+
});
|
|
17602
|
+
line2.barriers.forEach((b, j) => {
|
|
17603
|
+
const bx = barrierX[j];
|
|
17604
|
+
boxes.push({
|
|
17605
|
+
id: b.id,
|
|
17606
|
+
role: "barrier",
|
|
17607
|
+
label: b.label,
|
|
17608
|
+
cx: bx,
|
|
17609
|
+
cy: by,
|
|
17610
|
+
width: C2.BARRIER_W,
|
|
17611
|
+
height: C2.NODE_H,
|
|
17612
|
+
side,
|
|
17613
|
+
lineId: line2.id,
|
|
17614
|
+
order: j
|
|
17615
|
+
});
|
|
17616
|
+
if (b.escalations.length) {
|
|
17617
|
+
let cursor = C2.EF_DROP;
|
|
17618
|
+
let connectFromY = by + C2.NODE_H / 2;
|
|
17619
|
+
for (const esc of b.escalations) {
|
|
17620
|
+
const escCy = by + cursor;
|
|
17621
|
+
escalationLines.push({ x: bx, y1: connectFromY, y2: escCy - C2.NODE_H / 2 });
|
|
17622
|
+
boxes.push({
|
|
17623
|
+
id: esc.id,
|
|
17624
|
+
role: "escalation",
|
|
17625
|
+
label: esc.label,
|
|
17626
|
+
cx: bx,
|
|
17627
|
+
cy: escCy,
|
|
17628
|
+
width: C2.NODE_W,
|
|
17629
|
+
height: C2.NODE_H,
|
|
17630
|
+
lineId: line2.id,
|
|
17631
|
+
barrierId: b.id
|
|
17632
|
+
});
|
|
17633
|
+
connectFromY = escCy + C2.NODE_H / 2;
|
|
17634
|
+
cursor += C2.NODE_H + C2.EF_GAP;
|
|
17635
|
+
for (const ef of esc.barriers) {
|
|
17636
|
+
const efCy = by + cursor;
|
|
17637
|
+
escalationLines.push({ x: bx, y1: connectFromY, y2: efCy - C2.NODE_H / 2 });
|
|
17638
|
+
boxes.push({
|
|
17639
|
+
id: ef.id,
|
|
17640
|
+
role: "ef-barrier",
|
|
17641
|
+
label: ef.label,
|
|
17642
|
+
cx: bx,
|
|
17643
|
+
cy: efCy,
|
|
17644
|
+
width: C2.BARRIER_W,
|
|
17645
|
+
height: C2.NODE_H,
|
|
17646
|
+
lineId: line2.id,
|
|
17647
|
+
escalationId: esc.id
|
|
17648
|
+
});
|
|
17649
|
+
connectFromY = efCy + C2.NODE_H / 2;
|
|
17650
|
+
cursor += C2.NODE_H + C2.EF_GAP;
|
|
17651
|
+
}
|
|
17652
|
+
}
|
|
17653
|
+
}
|
|
17654
|
+
});
|
|
17655
|
+
const dy = by - cy;
|
|
17656
|
+
const clampedDy = Math.max(-48, Math.min(C2.TOPEVENT_R - 4, dy));
|
|
17657
|
+
const knotDx = Math.sqrt(Math.max(0, C2.TOPEVENT_R * C2.TOPEVENT_R - clampedDy * clampedDy));
|
|
17658
|
+
const pts = [];
|
|
17659
|
+
if (side === "prevent") {
|
|
17660
|
+
pts.push([headX + C2.NODE_W / 2, by]);
|
|
17661
|
+
const ordered = [...line2.barriers].map((_b, j) => barrierX[j]).sort((a, b) => a - b);
|
|
17662
|
+
for (const bx of ordered) {
|
|
17663
|
+
pts.push([bx - C2.BARRIER_W / 2, by]);
|
|
17664
|
+
pts.push([bx + C2.BARRIER_W / 2, by]);
|
|
17665
|
+
}
|
|
17666
|
+
pts.push([cx - knotDx, cy + clampedDy]);
|
|
17667
|
+
} else {
|
|
17668
|
+
pts.push([cx + knotDx, cy + clampedDy]);
|
|
17669
|
+
const ordered = [...line2.barriers].map((_b, j) => barrierX[j]).sort((a, b) => a - b);
|
|
17670
|
+
for (const bx of ordered) {
|
|
17671
|
+
pts.push([bx - C2.BARRIER_W / 2, by]);
|
|
17672
|
+
pts.push([bx + C2.BARRIER_W / 2, by]);
|
|
17673
|
+
}
|
|
17674
|
+
pts.push([headX - C2.NODE_W / 2, by]);
|
|
17675
|
+
}
|
|
17676
|
+
const path2 = pts.map((p, idx) => `${idx === 0 ? "M" : "L"} ${r3(p[0])} ${r3(p[1])}`).join(" ");
|
|
17677
|
+
const ax = side === "prevent" ? cx - knotDx : cx + knotDx;
|
|
17678
|
+
lines.push({ lineId: line2.id, side, path: path2, arrow: { x: ax, y: cy + clampedDy, angle: 0 } });
|
|
17679
|
+
});
|
|
17680
|
+
};
|
|
17681
|
+
emitWing(threatLines, left, "prevent");
|
|
17682
|
+
emitWing(conseqLines, right, "mitigate");
|
|
17683
|
+
let maxX = 0, maxY = 0;
|
|
17684
|
+
const bump = (x, y) => {
|
|
17685
|
+
maxX = Math.max(maxX, x);
|
|
17686
|
+
maxY = Math.max(maxY, y);
|
|
17687
|
+
};
|
|
17688
|
+
for (const b of boxes) bump(b.cx + b.width / 2, b.cy + b.height / 2);
|
|
17689
|
+
bump(cx + C2.TOPEVENT_R, cy + C2.TOPEVENT_R);
|
|
17690
|
+
if (ast.title) bump(C2.PAGE_PAD + ast.title.length * 9, 0);
|
|
17691
|
+
const legendBand = ast.legend === "off" ? 0 : C2.LEGEND_H;
|
|
17692
|
+
return {
|
|
17693
|
+
ast,
|
|
17694
|
+
topEvent,
|
|
17695
|
+
boxes,
|
|
17696
|
+
lines,
|
|
17697
|
+
escalationLines,
|
|
17698
|
+
...hazardTie ? { hazardTie } : {},
|
|
17699
|
+
width: Math.ceil(maxX + C2.PAGE_PAD),
|
|
17700
|
+
height: Math.ceil(maxY + C2.PAGE_PAD + legendBand)
|
|
17701
|
+
};
|
|
17702
|
+
}
|
|
17703
|
+
function r3(n) {
|
|
17704
|
+
return Math.round(n * 10) / 10;
|
|
17705
|
+
}
|
|
17706
|
+
|
|
17707
|
+
// src/diagrams/bowtie/renderer.ts
|
|
17708
|
+
function renderBowtie(text2, config) {
|
|
17709
|
+
const layout = layoutBowtie(parseBowtie(text2));
|
|
17710
|
+
return renderBowtieLayout(layout, config);
|
|
17711
|
+
}
|
|
17712
|
+
function renderBowtieLayout(layout, config) {
|
|
17713
|
+
const themeName = config?.theme ?? "default";
|
|
17714
|
+
const theme = chunkNZT5P2XZ_cjs.resolveBowtieTheme(themeName);
|
|
17715
|
+
const fontFamily = config?.fontFamily ?? chunkNZT5P2XZ_cjs.DEFAULT_FONT_FAMILY;
|
|
17716
|
+
const pad = config?.padding ?? 0;
|
|
17717
|
+
const { ast, topEvent } = layout;
|
|
17718
|
+
const mono = themeName === "monochrome";
|
|
17719
|
+
const width = layout.width + pad * 2;
|
|
17720
|
+
const height = layout.height + pad * 2;
|
|
17721
|
+
const a11y = ast.title ?? "Bowtie risk diagram";
|
|
17722
|
+
const styleBlock = chunk3WNW5Y7P_cjs.el(
|
|
17723
|
+
"style",
|
|
17724
|
+
{},
|
|
17725
|
+
`
|
|
17726
|
+
.sx-bowtie-bg { fill: ${theme.bg}; }
|
|
17727
|
+
.sx-bowtie-line { fill: none; stroke: ${theme.lineStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17728
|
+
.sx-bowtie-arrow { fill: ${theme.lineStroke}; stroke: none; }
|
|
17729
|
+
.sx-bowtie-escalation-line { fill: none; stroke: ${theme.escalationLineStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.thin};${mono ? " stroke-dasharray: 4 3;" : ""} }
|
|
17730
|
+
.sx-bowtie-hazard { fill: ${theme.hazardFill}; stroke: ${theme.hazardStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17731
|
+
.sx-bowtie-topevent { fill: ${theme.topEventFill}; stroke: ${theme.topEventStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.thick}; }
|
|
17732
|
+
.sx-bowtie-topevent-ring { fill: none; stroke: ${theme.topEventStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.thin}; }
|
|
17733
|
+
.sx-bowtie-threat { fill: ${theme.threatFill}; stroke: ${theme.threatStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17734
|
+
.sx-bowtie-barrier { fill: ${theme.barrierFill}; stroke: ${theme.barrierStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17735
|
+
.sx-bowtie-consequence { fill: ${theme.consequenceFill}; stroke: ${theme.consequenceStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17736
|
+
.sx-bowtie-escalation { fill: ${theme.escalationFill}; stroke: ${theme.escalationStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal};${mono ? " stroke-dasharray: 5 3;" : ""} }
|
|
17737
|
+
.sx-bowtie-ef-barrier { fill: ${theme.efBarrierFill}; stroke: ${theme.barrierStroke}; stroke-width: ${chunkNZT5P2XZ_cjs.STROKE_WIDTH.normal}; }
|
|
17738
|
+
.sx-bowtie-label { fill: ${theme.labelText}; stroke: none; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.label}px; }
|
|
17739
|
+
.sx-bowtie-elabel { fill: ${theme.labelText}; stroke: none; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small}px; }
|
|
17740
|
+
.sx-bowtie-topevent-label { fill: ${theme.labelText}; stroke: none; font-size: 11px; font-weight: 700; }
|
|
17741
|
+
.sx-bowtie-title { fill: ${theme.labelText}; stroke: none; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.title}px; font-weight: 700; }
|
|
17742
|
+
.sx-bowtie-legend-label { fill: ${theme.labelText}; stroke: none; font-size: ${chunkNZT5P2XZ_cjs.FONT_SIZE.small}px; }
|
|
17743
|
+
`.trim()
|
|
17744
|
+
);
|
|
17745
|
+
const children = [
|
|
17746
|
+
chunk3WNW5Y7P_cjs.title(a11y),
|
|
17747
|
+
chunk3WNW5Y7P_cjs.desc(summarise2(layout)),
|
|
17748
|
+
styleBlock,
|
|
17749
|
+
chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-bowtie-bg" })
|
|
17750
|
+
];
|
|
17751
|
+
const inner = [];
|
|
17752
|
+
if (ast.title) {
|
|
17753
|
+
inner.push(chunk3WNW5Y7P_cjs.text({ x: BOWTIE_CONST.PAGE_PAD, y: BOWTIE_CONST.PAGE_PAD + 6, class: "sx-bowtie-title", "font-family": fontFamily }, ast.title));
|
|
17754
|
+
}
|
|
17755
|
+
if (layout.hazardTie) {
|
|
17756
|
+
inner.push(chunk3WNW5Y7P_cjs.line({ x1: layout.hazardTie.x, y1: layout.hazardTie.y1, x2: layout.hazardTie.x, y2: layout.hazardTie.y2, class: "sx-bowtie-line" }));
|
|
17757
|
+
}
|
|
17758
|
+
for (const ln of layout.lines) {
|
|
17759
|
+
inner.push(
|
|
17760
|
+
chunk3WNW5Y7P_cjs.group({ class: "sx-bowtie-line-g", "data-line": ln.lineId, "data-side": ln.side }, [
|
|
17761
|
+
chunk3WNW5Y7P_cjs.path({ d: ln.path, class: "sx-bowtie-line" }),
|
|
17762
|
+
rightArrow(ln.arrow.x, ln.arrow.y)
|
|
17763
|
+
])
|
|
17764
|
+
);
|
|
17765
|
+
}
|
|
17766
|
+
for (const e of layout.escalationLines) {
|
|
17767
|
+
inner.push(chunk3WNW5Y7P_cjs.line({ x1: e.x, y1: e.y1, x2: e.x, y2: e.y2, class: "sx-bowtie-escalation-line" }));
|
|
17768
|
+
}
|
|
17769
|
+
inner.push(
|
|
17770
|
+
chunk3WNW5Y7P_cjs.group({ class: "sx-bowtie-topevent-g", "data-role": "topevent" }, [
|
|
17771
|
+
chunk3WNW5Y7P_cjs.circle({ cx: topEvent.cx, cy: topEvent.cy, r: topEvent.r, class: "sx-bowtie-topevent" }),
|
|
17772
|
+
...mono ? [chunk3WNW5Y7P_cjs.circle({ cx: topEvent.cx, cy: topEvent.cy, r: topEvent.r - 4, class: "sx-bowtie-topevent-ring" })] : [],
|
|
17773
|
+
chunk3WNW5Y7P_cjs.multilineText(
|
|
17774
|
+
{ x: topEvent.cx, y: topEvent.cy, class: "sx-bowtie-topevent-label", "text-anchor": "middle", "dominant-baseline": "middle" },
|
|
17775
|
+
wrap3(topEvent.label, 11, 4).join("<br/>"),
|
|
17776
|
+
12
|
|
17777
|
+
)
|
|
17778
|
+
])
|
|
17779
|
+
);
|
|
17780
|
+
for (const b of layout.boxes) {
|
|
17781
|
+
inner.push(renderBox4(b));
|
|
17782
|
+
}
|
|
17783
|
+
if (ast.legend !== "off") {
|
|
17784
|
+
inner.push(renderLegend2(layout, fontFamily));
|
|
17785
|
+
}
|
|
17786
|
+
children.push(chunk3WNW5Y7P_cjs.group({ transform: pad ? `translate(${pad}, ${pad})` : void 0, "font-family": fontFamily }, inner));
|
|
17787
|
+
return chunk3WNW5Y7P_cjs.svgRoot(
|
|
17788
|
+
{ width, height, viewBox: `0 0 ${width} ${height}`, role: "img", "aria-label": a11y, "data-diagram-type": "bowtie" },
|
|
17789
|
+
children
|
|
17790
|
+
);
|
|
17791
|
+
}
|
|
17792
|
+
function renderBox4(b) {
|
|
17793
|
+
const cls = b.role === "hazard" ? "sx-bowtie-hazard" : b.role === "threat" ? "sx-bowtie-threat" : b.role === "consequence" ? "sx-bowtie-consequence" : b.role === "escalation" ? "sx-bowtie-escalation" : b.role === "ef-barrier" ? "sx-bowtie-ef-barrier" : "sx-bowtie-barrier";
|
|
17794
|
+
const labelCls = b.role === "escalation" || b.role === "ef-barrier" ? "sx-bowtie-elabel" : "sx-bowtie-label";
|
|
17795
|
+
const perLine = b.role === "escalation" ? 18 : b.role === "hazard" ? 30 : 17;
|
|
17796
|
+
const lh = b.role === "escalation" || b.role === "ef-barrier" ? 12 : 14;
|
|
17797
|
+
const attrs = { class: `${cls}-g`, "data-role": b.role, "data-id": b.id };
|
|
17798
|
+
if (b.side) attrs["data-side"] = b.side;
|
|
17799
|
+
if (b.lineId) attrs["data-line"] = b.lineId;
|
|
17800
|
+
if (b.order !== void 0) attrs["data-order"] = String(b.order);
|
|
17801
|
+
if (b.barrierId) attrs["data-barrier"] = b.barrierId;
|
|
17802
|
+
if (b.escalationId) attrs["data-escalation"] = b.escalationId;
|
|
17803
|
+
return chunk3WNW5Y7P_cjs.group(attrs, [
|
|
17804
|
+
chunk3WNW5Y7P_cjs.rect({ x: b.cx - b.width / 2, y: b.cy - b.height / 2, width: b.width, height: b.height, rx: 5, class: cls }),
|
|
17805
|
+
chunk3WNW5Y7P_cjs.multilineText(
|
|
17806
|
+
{ x: b.cx, y: b.cy, class: labelCls, "text-anchor": "middle", "dominant-baseline": "middle" },
|
|
17807
|
+
wrap3(b.label, perLine, 3).join("<br/>"),
|
|
17808
|
+
lh
|
|
17809
|
+
)
|
|
17810
|
+
]);
|
|
17811
|
+
}
|
|
17812
|
+
function rightArrow(tx, ty) {
|
|
17813
|
+
const s = 9, h = 5;
|
|
17814
|
+
return chunk3WNW5Y7P_cjs.path({ d: `M ${r4(tx)} ${r4(ty)} L ${r4(tx - s)} ${r4(ty - h)} L ${r4(tx - s)} ${r4(ty + h)} Z`, class: "sx-bowtie-arrow" });
|
|
17815
|
+
}
|
|
17816
|
+
function renderLegend2(layout, fontFamily) {
|
|
17817
|
+
const hasEscalation = layout.boxes.some((b) => b.role === "escalation");
|
|
17818
|
+
const entries = [
|
|
17819
|
+
{ cls: "sx-bowtie-threat", text: "Threat" },
|
|
17820
|
+
{ cls: "sx-bowtie-barrier", text: "Barrier (prevent / mitigate)" },
|
|
17821
|
+
{ cls: "sx-bowtie-topevent", text: "Top event" },
|
|
17822
|
+
{ cls: "sx-bowtie-consequence", text: "Consequence" }
|
|
17823
|
+
];
|
|
17824
|
+
if (hasEscalation) entries.push({ cls: "sx-bowtie-escalation", text: "Escalation factor" });
|
|
17825
|
+
const sw = 14, gap = 6;
|
|
17826
|
+
let x = BOWTIE_CONST.PAGE_PAD;
|
|
17827
|
+
const y = layout.height - 12;
|
|
17828
|
+
const parts = [];
|
|
17829
|
+
for (const e of entries) {
|
|
17830
|
+
parts.push(chunk3WNW5Y7P_cjs.rect({ x, y: y - sw + 2, width: sw, height: sw, rx: 3, class: e.cls }));
|
|
17831
|
+
const tx = x + sw + gap;
|
|
17832
|
+
parts.push(chunk3WNW5Y7P_cjs.text({ x: tx, y: y - 1, class: "sx-bowtie-legend-label", "font-family": fontFamily }, e.text));
|
|
17833
|
+
x = tx + e.text.length * 6.4 + 22;
|
|
17834
|
+
}
|
|
17835
|
+
return chunk3WNW5Y7P_cjs.group({ class: "sx-bowtie-legend", "data-role": "legend" }, parts);
|
|
17836
|
+
}
|
|
17837
|
+
function summarise2(layout) {
|
|
17838
|
+
const { ast } = layout;
|
|
17839
|
+
const barrierCount = layout.boxes.filter((b) => b.role === "barrier").length;
|
|
17840
|
+
const escCount = layout.boxes.filter((b) => b.role === "escalation").length;
|
|
17841
|
+
const parts = [];
|
|
17842
|
+
parts.push(
|
|
17843
|
+
`Bowtie:${ast.hazard ? ` hazard "${ast.hazard}",` : ""} top event "${ast.topEvent}"; ${ast.threats.length} threat${plural(ast.threats.length)}, ${ast.consequences.length} consequence${plural(ast.consequences.length)}, ${barrierCount} barrier${plural(barrierCount)}${escCount ? `, ${escCount} escalation factor${plural(escCount)}` : ""}.`
|
|
17844
|
+
);
|
|
17845
|
+
for (const w of ast.warnings) parts.push(w);
|
|
17846
|
+
return parts.join(" ");
|
|
17847
|
+
}
|
|
17848
|
+
function plural(n) {
|
|
17849
|
+
return n === 1 ? "" : "s";
|
|
17850
|
+
}
|
|
17851
|
+
function wrap3(s, perLine, maxLines) {
|
|
17852
|
+
const words = s.split(/\s+/).filter(Boolean);
|
|
17853
|
+
const lines = [];
|
|
17854
|
+
let cur = "";
|
|
17855
|
+
for (const w of words) {
|
|
17856
|
+
if (cur && cur.length + 1 + w.length > perLine) {
|
|
17857
|
+
lines.push(cur);
|
|
17858
|
+
cur = w;
|
|
17859
|
+
if (lines.length === maxLines) break;
|
|
17860
|
+
} else {
|
|
17861
|
+
cur = cur ? `${cur} ${w}` : w;
|
|
17862
|
+
}
|
|
17863
|
+
}
|
|
17864
|
+
if (cur && lines.length < maxLines) lines.push(cur);
|
|
17865
|
+
else if (cur && lines.length === maxLines) lines[maxLines - 1] = clip2(`${lines[maxLines - 1]} ${cur}`, perLine);
|
|
17866
|
+
if (lines.length === 0) lines.push(s);
|
|
17867
|
+
return lines;
|
|
17868
|
+
}
|
|
17869
|
+
function clip2(s, n) {
|
|
17870
|
+
return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
|
|
17871
|
+
}
|
|
17872
|
+
function r4(n) {
|
|
17873
|
+
return Math.round(n * 10) / 10;
|
|
17874
|
+
}
|
|
17875
|
+
|
|
17876
|
+
// src/diagrams/bowtie/index.ts
|
|
17877
|
+
var bowtie2 = {
|
|
17878
|
+
type: "bowtie",
|
|
17879
|
+
detect(text2) {
|
|
17880
|
+
return /^\s*bowtie\b/i.test(text2);
|
|
17881
|
+
},
|
|
17882
|
+
parse: parseBowtie,
|
|
17883
|
+
render(text2, config) {
|
|
17884
|
+
return renderBowtie(text2, config);
|
|
17885
|
+
}
|
|
17886
|
+
};
|
|
17887
|
+
|
|
17275
17888
|
// src/core/diagnostics.ts
|
|
17276
17889
|
var ENGINE_BUG_NAMES = /* @__PURE__ */ new Set([
|
|
17277
17890
|
"ReferenceError",
|
|
@@ -17636,14 +18249,23 @@ function parseMindmap(text2) {
|
|
|
17636
18249
|
const lines = allLines;
|
|
17637
18250
|
const directives = { style: "map", maxLabelWidth: DEFAULT_MAX_LABEL_WIDTH };
|
|
17638
18251
|
let root = null;
|
|
18252
|
+
let rootInferred;
|
|
17639
18253
|
let idCounter2 = 0;
|
|
17640
18254
|
const nextId2 = () => `n${idCounter2++}`;
|
|
17641
18255
|
const stack = [];
|
|
17642
18256
|
let lastHeadingDepth = 0;
|
|
17643
|
-
const
|
|
18257
|
+
const ensurePlaceholderRoot = () => {
|
|
18258
|
+
if (root) return root;
|
|
18259
|
+
root = makeNode(nextId2(), "Mindmap", 0);
|
|
18260
|
+
rootInferred = "placeholder";
|
|
18261
|
+
stack.length = 0;
|
|
18262
|
+
stack.push({ node: root, depth: 0 });
|
|
18263
|
+
lastHeadingDepth = 0;
|
|
18264
|
+
return root;
|
|
18265
|
+
};
|
|
18266
|
+
const attach = (node, depth, _lineNo, _source) => {
|
|
17644
18267
|
while (stack.length && stack[stack.length - 1].depth >= depth) stack.pop();
|
|
17645
|
-
const parent = stack[stack.length - 1]?.node;
|
|
17646
|
-
if (!parent) throw new MindmapParseError("orphan node \u2014 expected root # heading first", lineNo, void 0, source);
|
|
18268
|
+
const parent = stack[stack.length - 1]?.node ?? ensurePlaceholderRoot();
|
|
17647
18269
|
node.depth = parent.depth + 1;
|
|
17648
18270
|
parent.children.push(node);
|
|
17649
18271
|
stack.push({ node, depth });
|
|
@@ -17669,7 +18291,7 @@ function parseMindmap(text2) {
|
|
|
17669
18291
|
stack.length = 0;
|
|
17670
18292
|
stack.push({ node, depth: 0 });
|
|
17671
18293
|
} else {
|
|
17672
|
-
attach(node, depth
|
|
18294
|
+
attach(node, depth);
|
|
17673
18295
|
}
|
|
17674
18296
|
lastHeadingDepth = depth;
|
|
17675
18297
|
continue;
|
|
@@ -17680,7 +18302,14 @@ function parseMindmap(text2) {
|
|
|
17680
18302
|
const depth = lastHeadingDepth + 1 + Math.floor(indent / 2);
|
|
17681
18303
|
const label = bullet[2].trim();
|
|
17682
18304
|
const node = makeNode(nextId2(), label, depth);
|
|
17683
|
-
attach(node, depth
|
|
18305
|
+
attach(node, depth);
|
|
18306
|
+
continue;
|
|
18307
|
+
}
|
|
18308
|
+
if (!root && stack.length === 0) {
|
|
18309
|
+
root = makeNode(nextId2(), trimmed, 0);
|
|
18310
|
+
rootInferred = "line";
|
|
18311
|
+
stack.push({ node: root, depth: 0 });
|
|
18312
|
+
lastHeadingDepth = 0;
|
|
17684
18313
|
continue;
|
|
17685
18314
|
}
|
|
17686
18315
|
}
|
|
@@ -17691,10 +18320,40 @@ function parseMindmap(text2) {
|
|
|
17691
18320
|
root,
|
|
17692
18321
|
maxLabelWidth: directives.maxLabelWidth
|
|
17693
18322
|
};
|
|
18323
|
+
if (rootInferred) ast.rootInferred = rootInferred;
|
|
17694
18324
|
if (directives.themeOverride) ast.themeOverride = directives.themeOverride;
|
|
17695
18325
|
return ast;
|
|
17696
18326
|
}
|
|
17697
18327
|
|
|
18328
|
+
// src/diagrams/mindmap/lint.ts
|
|
18329
|
+
function lintMindmap(text2) {
|
|
18330
|
+
let ast;
|
|
18331
|
+
try {
|
|
18332
|
+
ast = parseMindmap(text2);
|
|
18333
|
+
} catch {
|
|
18334
|
+
return [];
|
|
18335
|
+
}
|
|
18336
|
+
const out = [];
|
|
18337
|
+
if (ast.rootInferred === "line") {
|
|
18338
|
+
out.push({
|
|
18339
|
+
severity: "warning",
|
|
18340
|
+
code: "MINDMAP_SYNTHESIZED_ROOT",
|
|
18341
|
+
message: `no \`# Title\` heading found; adopted the first line "${ast.root.label}" as the central topic`,
|
|
18342
|
+
hint: "Mark the central topic explicitly with a single leading `# Title` line, e.g. `# My Topic`.",
|
|
18343
|
+
fatal: false
|
|
18344
|
+
});
|
|
18345
|
+
} else if (ast.rootInferred === "placeholder") {
|
|
18346
|
+
out.push({
|
|
18347
|
+
severity: "warning",
|
|
18348
|
+
code: "MINDMAP_SYNTHESIZED_ROOT",
|
|
18349
|
+
message: "no central topic found; inserted a placeholder root over the top-level branches",
|
|
18350
|
+
hint: "Start the mindmap with a single `# Title` line to name the center, e.g. `# My Topic`, with branches as `- item` bullets below it.",
|
|
18351
|
+
fatal: false
|
|
18352
|
+
});
|
|
18353
|
+
}
|
|
18354
|
+
return out;
|
|
18355
|
+
}
|
|
18356
|
+
|
|
17698
18357
|
// src/diagrams/mindmap/layout.ts
|
|
17699
18358
|
var PADDING2 = 40;
|
|
17700
18359
|
var SIBLING_GAP = 18;
|
|
@@ -17743,7 +18402,7 @@ function computeMaxLW(subtreeRoots, maxLabelWidth) {
|
|
|
17743
18402
|
if (maxLW[n.depth] === void 0 || m.width > maxLW[n.depth]) maxLW[n.depth] = m.width;
|
|
17744
18403
|
for (const c of n.children) walk(c);
|
|
17745
18404
|
};
|
|
17746
|
-
for (const
|
|
18405
|
+
for (const r5 of subtreeRoots) walk(r5);
|
|
17747
18406
|
return maxLW;
|
|
17748
18407
|
}
|
|
17749
18408
|
function buildColumns(maxLW, firstColStartX, rootDepth) {
|
|
@@ -18107,9 +18766,9 @@ function renderNode2(n, color, theme, fontFamily) {
|
|
|
18107
18766
|
for (let i = 0; i < lineCount; i++) {
|
|
18108
18767
|
const line2 = n.lines[i];
|
|
18109
18768
|
const cy = topY + (i + 0.5) * lh;
|
|
18110
|
-
const
|
|
18111
|
-
decorations.push(...
|
|
18112
|
-
children.push(
|
|
18769
|
+
const r5 = renderLine2(line2, textLeft, cy, fs, fontFamily, weight, theme);
|
|
18770
|
+
decorations.push(...r5.decorations);
|
|
18771
|
+
children.push(r5.textElement);
|
|
18113
18772
|
}
|
|
18114
18773
|
const ux1 = n.x - n.labelWidth / 2;
|
|
18115
18774
|
const ux2 = n.x + n.labelWidth / 2;
|
|
@@ -18137,7 +18796,7 @@ function renderNode2(n, color, theme, fontFamily) {
|
|
|
18137
18796
|
);
|
|
18138
18797
|
}
|
|
18139
18798
|
function renderMindmapAST(ast, themeName = "default", fontFamily = "system-ui, -apple-system, sans-serif") {
|
|
18140
|
-
const theme =
|
|
18799
|
+
const theme = chunkNZT5P2XZ_cjs.resolveMindmapTheme(ast.themeOverride ?? themeName);
|
|
18141
18800
|
const layout = layoutMindmap(ast);
|
|
18142
18801
|
const byId = new Map(layout.nodes.map((n) => [n.node.id, n]));
|
|
18143
18802
|
const edgeSvgs = [];
|
|
@@ -18199,6 +18858,7 @@ var mindmap = {
|
|
|
18199
18858
|
return false;
|
|
18200
18859
|
},
|
|
18201
18860
|
parse: parseMindmap,
|
|
18861
|
+
lint: lintMindmap,
|
|
18202
18862
|
render(text2, config) {
|
|
18203
18863
|
return renderMindmap(text2, {
|
|
18204
18864
|
theme: config?.theme,
|
|
@@ -18629,11 +19289,11 @@ function parseMatrix(text2) {
|
|
|
18629
19289
|
const gm = v.match(/^(\d+)\s*x\s*(\d+)$/);
|
|
18630
19290
|
if (gm) {
|
|
18631
19291
|
const c = Number(gm[1]);
|
|
18632
|
-
const
|
|
19292
|
+
const r5 = Number(gm[2]);
|
|
18633
19293
|
st.ast.cols = c;
|
|
18634
|
-
st.ast.rows =
|
|
18635
|
-
if (c === 2 &&
|
|
18636
|
-
else if (c === 3 &&
|
|
19294
|
+
st.ast.rows = r5;
|
|
19295
|
+
if (c === 2 && r5 === 2) st.ast.grid = "2x2";
|
|
19296
|
+
else if (c === 3 && r5 === 3) st.ast.grid = "3x3";
|
|
18637
19297
|
else st.ast.grid = "NxM";
|
|
18638
19298
|
}
|
|
18639
19299
|
continue;
|
|
@@ -18757,8 +19417,8 @@ function computeRadius(p, maxSize, plot, scale) {
|
|
|
18757
19417
|
}
|
|
18758
19418
|
const maxArea = Math.PI * maxRadius * maxRadius;
|
|
18759
19419
|
const area = ratio * maxArea;
|
|
18760
|
-
const
|
|
18761
|
-
return Math.max(minRadius,
|
|
19420
|
+
const r5 = Math.sqrt(area / Math.PI);
|
|
19421
|
+
return Math.max(minRadius, r5);
|
|
18762
19422
|
}
|
|
18763
19423
|
function resolveLabelCollisions(points, plot, mode) {
|
|
18764
19424
|
if (mode === "off") {
|
|
@@ -18852,20 +19512,20 @@ function layoutMatrix(ast) {
|
|
|
18852
19512
|
}
|
|
18853
19513
|
for (const p of ast.points) {
|
|
18854
19514
|
const { px, py } = placePoint(p, plot);
|
|
18855
|
-
const
|
|
19515
|
+
const r5 = computeRadius(p, maxSize, plot, ast.config.bubbleScale);
|
|
18856
19516
|
const width = estimateWidth(p.label);
|
|
18857
19517
|
const label = {
|
|
18858
19518
|
text: p.label,
|
|
18859
19519
|
ax: px,
|
|
18860
19520
|
ay: py,
|
|
18861
|
-
lx: px +
|
|
18862
|
-
ly: py -
|
|
19521
|
+
lx: px + r5 + 4 + width / 2,
|
|
19522
|
+
ly: py - r5 - 4,
|
|
18863
19523
|
width,
|
|
18864
19524
|
height: LABEL_H,
|
|
18865
19525
|
external: false,
|
|
18866
19526
|
textAnchor: "middle"
|
|
18867
19527
|
};
|
|
18868
|
-
points.push({ point: p, px, py, r:
|
|
19528
|
+
points.push({ point: p, px, py, r: r5, label });
|
|
18869
19529
|
if (p.category) categoriesSet.add(p.category);
|
|
18870
19530
|
}
|
|
18871
19531
|
resolveLabelCollisions(points, plot, ast.config.labelCollision);
|
|
@@ -18972,7 +19632,7 @@ function renderQuadrantBackground(ast, lay) {
|
|
|
18972
19632
|
return chunk3WNW5Y7P_cjs.group(
|
|
18973
19633
|
{ id: "sx-matrix-quad-bg" },
|
|
18974
19634
|
rects.map(
|
|
18975
|
-
(
|
|
19635
|
+
(r5) => chunk3WNW5Y7P_cjs.rect({ x: r5.x, y: r5.y, width: r5.w, height: r5.h, fill: r5.fill, "fill-opacity": 0.55 })
|
|
18976
19636
|
)
|
|
18977
19637
|
);
|
|
18978
19638
|
}
|
|
@@ -19624,9 +20284,9 @@ function renderOnePoint(pl, categories) {
|
|
|
19624
20284
|
class: "sx-matrix-bubble"
|
|
19625
20285
|
});
|
|
19626
20286
|
} else if (shape === "diamond") {
|
|
19627
|
-
const
|
|
20287
|
+
const r5 = pl.r;
|
|
19628
20288
|
shapeEl = chunk3WNW5Y7P_cjs.polygon({
|
|
19629
|
-
points: `${pl.px},${pl.py -
|
|
20289
|
+
points: `${pl.px},${pl.py - r5} ${pl.px + r5},${pl.py} ${pl.px},${pl.py + r5} ${pl.px - r5},${pl.py}`,
|
|
19630
20290
|
fill: color,
|
|
19631
20291
|
"fill-opacity": fillOpacity,
|
|
19632
20292
|
stroke,
|
|
@@ -19634,9 +20294,9 @@ function renderOnePoint(pl, categories) {
|
|
|
19634
20294
|
class: "sx-matrix-bubble"
|
|
19635
20295
|
});
|
|
19636
20296
|
} else {
|
|
19637
|
-
const
|
|
20297
|
+
const r5 = pl.r;
|
|
19638
20298
|
shapeEl = chunk3WNW5Y7P_cjs.polygon({
|
|
19639
|
-
points: `${pl.px},${pl.py -
|
|
20299
|
+
points: `${pl.px},${pl.py - r5} ${pl.px + r5},${pl.py + r5 * 0.8} ${pl.px - r5},${pl.py + r5 * 0.8}`,
|
|
19640
20300
|
fill: color,
|
|
19641
20301
|
"fill-opacity": fillOpacity,
|
|
19642
20302
|
stroke,
|
|
@@ -19675,7 +20335,7 @@ function renderOnePoint(pl, categories) {
|
|
|
19675
20335
|
[chunk3WNW5Y7P_cjs.title(titleStr), shapeEl, leader, label, badge].filter((s) => s.length > 0)
|
|
19676
20336
|
);
|
|
19677
20337
|
}
|
|
19678
|
-
function
|
|
20338
|
+
function renderLegend3(ast, lay) {
|
|
19679
20339
|
if (ast.config.legendPosition === "none") return "";
|
|
19680
20340
|
if (ast.mode === "heatmap") {
|
|
19681
20341
|
const x = lay.plot.x0 + lay.plot.w - 220;
|
|
@@ -19735,7 +20395,7 @@ function renderMatrixAST(ast) {
|
|
|
19735
20395
|
renderCorrelation(ast, lay),
|
|
19736
20396
|
renderAxes(ast, lay),
|
|
19737
20397
|
renderPoints(ast, lay),
|
|
19738
|
-
|
|
20398
|
+
renderLegend3(ast, lay),
|
|
19739
20399
|
renderCorrelationLegend(ast, lay)
|
|
19740
20400
|
].filter((s) => s.length > 0);
|
|
19741
20401
|
return chunk3WNW5Y7P_cjs.svgRoot(
|
|
@@ -19785,7 +20445,7 @@ var ErdParseError = class extends Error {
|
|
|
19785
20445
|
}
|
|
19786
20446
|
lineNumber;
|
|
19787
20447
|
};
|
|
19788
|
-
function
|
|
20448
|
+
function stripComment6(s) {
|
|
19789
20449
|
let out = "";
|
|
19790
20450
|
let inQuote = false;
|
|
19791
20451
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -19839,7 +20499,7 @@ function parseCardToken(raw, side) {
|
|
|
19839
20499
|
}
|
|
19840
20500
|
function lex(text2) {
|
|
19841
20501
|
return text2.split(/\r?\n/).map((raw, i) => ({
|
|
19842
|
-
text:
|
|
20502
|
+
text: stripComment6(raw).trim(),
|
|
19843
20503
|
lineNumber: i + 1
|
|
19844
20504
|
})).filter((l) => l.text.length > 0);
|
|
19845
20505
|
}
|
|
@@ -20240,12 +20900,12 @@ function buildColumnAssignment(ast) {
|
|
|
20240
20900
|
const ids = ast.entities.map((e) => e.id);
|
|
20241
20901
|
const idToIdx = new Map(ids.map((id, i) => [id, i]));
|
|
20242
20902
|
const pairs = [];
|
|
20243
|
-
for (const
|
|
20244
|
-
const f = parseRefSide(
|
|
20245
|
-
const t = parseRefSide(
|
|
20903
|
+
for (const r5 of ast.refs) {
|
|
20904
|
+
const f = parseRefSide(r5.from);
|
|
20905
|
+
const t = parseRefSide(r5.to);
|
|
20246
20906
|
if (idToIdx.has(f.table) && idToIdx.has(t.table)) {
|
|
20247
|
-
const oneIsTo = isOne(
|
|
20248
|
-
const oneIsFrom = isOne(
|
|
20907
|
+
const oneIsTo = isOne(r5.toCard) && !isOne(r5.fromCard);
|
|
20908
|
+
const oneIsFrom = isOne(r5.fromCard) && !isOne(r5.toCard);
|
|
20249
20909
|
if (oneIsTo) pairs.push({ from: t.table, to: f.table });
|
|
20250
20910
|
else if (oneIsFrom) pairs.push({ from: f.table, to: t.table });
|
|
20251
20911
|
else pairs.push({ from: f.table, to: t.table });
|
|
@@ -20280,9 +20940,9 @@ function isOne(c) {
|
|
|
20280
20940
|
function reorderByBarycenter(layerToEnts, layers, refs) {
|
|
20281
20941
|
if (layers.length < 2) return;
|
|
20282
20942
|
const neighbors = /* @__PURE__ */ new Map();
|
|
20283
|
-
for (const
|
|
20284
|
-
const a = parseRefSide(
|
|
20285
|
-
const b = parseRefSide(
|
|
20943
|
+
for (const r5 of refs) {
|
|
20944
|
+
const a = parseRefSide(r5.from).table;
|
|
20945
|
+
const b = parseRefSide(r5.to).table;
|
|
20286
20946
|
if (!neighbors.has(a)) neighbors.set(a, /* @__PURE__ */ new Set());
|
|
20287
20947
|
if (!neighbors.has(b)) neighbors.set(b, /* @__PURE__ */ new Set());
|
|
20288
20948
|
neighbors.get(a).add(b);
|
|
@@ -20412,9 +21072,9 @@ function layoutErd(ast) {
|
|
|
20412
21072
|
const layers = Array.from(layerToEnts.keys()).sort((a, b) => a - b);
|
|
20413
21073
|
reorderByBarycenter(layerToEnts, layers, ast.refs);
|
|
20414
21074
|
const neighbors = /* @__PURE__ */ new Map();
|
|
20415
|
-
for (const
|
|
20416
|
-
const a = parseRefSide(
|
|
20417
|
-
const b = parseRefSide(
|
|
21075
|
+
for (const r5 of ast.refs) {
|
|
21076
|
+
const a = parseRefSide(r5.from).table;
|
|
21077
|
+
const b = parseRefSide(r5.to).table;
|
|
20418
21078
|
if (!neighbors.has(a)) neighbors.set(a, /* @__PURE__ */ new Set());
|
|
20419
21079
|
if (!neighbors.has(b)) neighbors.set(b, /* @__PURE__ */ new Set());
|
|
20420
21080
|
neighbors.get(a).add(b);
|
|
@@ -20492,17 +21152,17 @@ function layoutErd(ast) {
|
|
|
20492
21152
|
const placedById = new Map(placed.map((p) => [p.entity.id, p]));
|
|
20493
21153
|
const edges = [];
|
|
20494
21154
|
const bendBucketUses = /* @__PURE__ */ new Map();
|
|
20495
|
-
for (const
|
|
20496
|
-
const fromTable = parseRefSide(
|
|
20497
|
-
const toTable = parseRefSide(
|
|
21155
|
+
for (const r5 of ast.refs) {
|
|
21156
|
+
const fromTable = parseRefSide(r5.from).table;
|
|
21157
|
+
const toTable = parseRefSide(r5.to).table;
|
|
20498
21158
|
const a = placedById.get(fromTable);
|
|
20499
21159
|
const b = placedById.get(toTable);
|
|
20500
21160
|
if (!a || !b) continue;
|
|
20501
|
-
const fromCol = parseRefSide(
|
|
20502
|
-
const toCol = parseRefSide(
|
|
21161
|
+
const fromCol = parseRefSide(r5.from).column;
|
|
21162
|
+
const toCol = parseRefSide(r5.to).column;
|
|
20503
21163
|
const route = routeOrthogonal(a, b, fromCol, toCol, bendBucketUses);
|
|
20504
21164
|
edges.push({
|
|
20505
|
-
ref:
|
|
21165
|
+
ref: r5,
|
|
20506
21166
|
path: route.path,
|
|
20507
21167
|
fromAnchor: route.fromAnchor,
|
|
20508
21168
|
toAnchor: route.toAnchor,
|
|
@@ -20519,7 +21179,7 @@ function layoutErd(ast) {
|
|
|
20519
21179
|
}
|
|
20520
21180
|
function rowYByColumn(e, col) {
|
|
20521
21181
|
if (col) {
|
|
20522
|
-
const idx = e.rows.findIndex((
|
|
21182
|
+
const idx = e.rows.findIndex((r5) => r5.attribute.name.toLowerCase() === col.toLowerCase());
|
|
20523
21183
|
if (idx >= 0) return e.y + e.rows[idx].yCenter;
|
|
20524
21184
|
}
|
|
20525
21185
|
return e.y + e.height / 2;
|
|
@@ -20897,7 +21557,7 @@ function renderEdge5(edge) {
|
|
|
20897
21557
|
return chunk3WNW5Y7P_cjs.group({ class: "lt-erd-edge-group" }, parts);
|
|
20898
21558
|
}
|
|
20899
21559
|
function renderErdAst(result, themeName = "default") {
|
|
20900
|
-
const theme =
|
|
21560
|
+
const theme = chunkNZT5P2XZ_cjs.resolveBaseTheme(themeName);
|
|
20901
21561
|
const { entities, edges, width, height, ast } = result;
|
|
20902
21562
|
const cssBlock = chunk3WNW5Y7P_cjs.el("style", {}, buildCss8(theme));
|
|
20903
21563
|
const titleNode = chunk3WNW5Y7P_cjs.title(ast.title ?? "Schematex ERD");
|
|
@@ -20966,7 +21626,7 @@ var BreadboardParseError = class extends Error {
|
|
|
20966
21626
|
}
|
|
20967
21627
|
lineNumber;
|
|
20968
21628
|
};
|
|
20969
|
-
function
|
|
21629
|
+
function stripComment7(s) {
|
|
20970
21630
|
let out = "";
|
|
20971
21631
|
let inQuote = false;
|
|
20972
21632
|
for (let i = 0; i < s.length; i++) {
|
|
@@ -20987,7 +21647,7 @@ function unquote6(v) {
|
|
|
20987
21647
|
}
|
|
20988
21648
|
function lex2(text2) {
|
|
20989
21649
|
return text2.split(/\r?\n/).map((raw, i) => ({
|
|
20990
|
-
text:
|
|
21650
|
+
text: stripComment7(raw).trimEnd().replace(/^\s+/, ""),
|
|
20991
21651
|
lineNumber: i + 1
|
|
20992
21652
|
})).filter((l) => l.text.length > 0);
|
|
20993
21653
|
}
|
|
@@ -21299,8 +21959,8 @@ var PITCH = 14;
|
|
|
21299
21959
|
function rectShape(x, y, w, h, attrs) {
|
|
21300
21960
|
return chunk3WNW5Y7P_cjs.el("rect", { x, y, width: w, height: h, ...attrs });
|
|
21301
21961
|
}
|
|
21302
|
-
function circShape(cx, cy,
|
|
21303
|
-
return chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r:
|
|
21962
|
+
function circShape(cx, cy, r5, attrs) {
|
|
21963
|
+
return chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r5, ...attrs });
|
|
21304
21964
|
}
|
|
21305
21965
|
function lineShape(x1, y1, x2, y2, attrs) {
|
|
21306
21966
|
return chunk3WNW5Y7P_cjs.el("line", { x1, y1, x2, y2, ...attrs });
|
|
@@ -22021,13 +22681,13 @@ function renderSubstrate(sub) {
|
|
|
22021
22681
|
{ y: sub.y + BB_CONST.BOARD_PAD_Y, type: "top" },
|
|
22022
22682
|
{ y: sub.y + sub.height - BB_CONST.BOARD_PAD_Y - BB_CONST.RAIL_HEIGHT, type: "bottom" }
|
|
22023
22683
|
];
|
|
22024
|
-
for (const
|
|
22684
|
+
for (const r5 of rails) {
|
|
22025
22685
|
elements.push(chunk3WNW5Y7P_cjs.path({
|
|
22026
|
-
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${
|
|
22686
|
+
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r5.y + 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r5.y + 4}`,
|
|
22027
22687
|
class: "lt-bb-rail-stripe-pos"
|
|
22028
22688
|
}));
|
|
22029
22689
|
elements.push(chunk3WNW5Y7P_cjs.path({
|
|
22030
|
-
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${
|
|
22690
|
+
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r5.y + BB_CONST.RAIL_HEIGHT - 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r5.y + BB_CONST.RAIL_HEIGHT - 4}`,
|
|
22031
22691
|
class: "lt-bb-rail-stripe-neg"
|
|
22032
22692
|
}));
|
|
22033
22693
|
if (sub.railsBreak) {
|
|
@@ -22035,7 +22695,7 @@ function renderSubstrate(sub) {
|
|
|
22035
22695
|
const breakX2 = breakX1 + PITCH2;
|
|
22036
22696
|
elements.push(chunk3WNW5Y7P_cjs.rect({
|
|
22037
22697
|
x: breakX1,
|
|
22038
|
-
y:
|
|
22698
|
+
y: r5.y,
|
|
22039
22699
|
width: breakX2 - breakX1,
|
|
22040
22700
|
height: BB_CONST.RAIL_HEIGHT,
|
|
22041
22701
|
fill: "#e7d8b6"
|
|
@@ -22043,8 +22703,8 @@ function renderSubstrate(sub) {
|
|
|
22043
22703
|
}
|
|
22044
22704
|
for (let c = 1; c <= sub.cols; c++) {
|
|
22045
22705
|
const cx = sub.x + BB_CONST.BOARD_PAD_X + BB_CONST.ROW_LABEL_W + PITCH2 / 2 + (c - 1) * PITCH2;
|
|
22046
|
-
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy:
|
|
22047
|
-
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy:
|
|
22706
|
+
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r5.y + 4, r: 1.4, class: "lt-bb-hole-rail" }));
|
|
22707
|
+
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r5.y + BB_CONST.RAIL_HEIGHT - 4, r: 1.4, class: "lt-bb-hole-rail" }));
|
|
22048
22708
|
}
|
|
22049
22709
|
}
|
|
22050
22710
|
}
|
|
@@ -22071,10 +22731,10 @@ function renderSubstrate(sub) {
|
|
|
22071
22731
|
elements.push(chunk3WNW5Y7P_cjs.text({ x: sub.x + sub.width - BB_CONST.BOARD_PAD_X - 4, y: yBot, class: "lt-bb-row-label" }, rowsBot[i]));
|
|
22072
22732
|
}
|
|
22073
22733
|
for (let c = 1; c <= sub.cols; c++) {
|
|
22074
|
-
for (let
|
|
22734
|
+
for (let r5 = 0; r5 < 10; r5++) {
|
|
22075
22735
|
const cx = sub.x + BB_CONST.BOARD_PAD_X + BB_CONST.ROW_LABEL_W + PITCH2 / 2 + (c - 1) * PITCH2;
|
|
22076
|
-
let cy = gridY0 +
|
|
22077
|
-
if (
|
|
22736
|
+
let cy = gridY0 + r5 * PITCH2;
|
|
22737
|
+
if (r5 >= 5) cy += BB_CONST.TROUGH;
|
|
22078
22738
|
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy, r: 1.6, class: "lt-bb-hole" }));
|
|
22079
22739
|
}
|
|
22080
22740
|
}
|
|
@@ -22116,7 +22776,7 @@ function renderWire(lw) {
|
|
|
22116
22776
|
return path2 + dot1 + dot2;
|
|
22117
22777
|
}
|
|
22118
22778
|
function renderBreadboardLayout(layout, config) {
|
|
22119
|
-
const theme =
|
|
22779
|
+
const theme = chunkNZT5P2XZ_cjs.resolveBaseTheme(config?.theme ?? "default");
|
|
22120
22780
|
const css = buildCss9(theme);
|
|
22121
22781
|
const titleStr = layout.ast.title ?? "Breadboard";
|
|
22122
22782
|
const titleNode = layout.ast.title ? chunk3WNW5Y7P_cjs.text({ x: BB_CONST.MARGIN, y: 22, class: "lt-bb-title" }, layout.ast.title) : "";
|
|
@@ -22576,34 +23236,34 @@ function parseFlowLine(ln, flows, objectOwner, poolByLabel) {
|
|
|
22576
23236
|
connectorLen = 3;
|
|
22577
23237
|
} else if (rest.startsWith("--?")) {
|
|
22578
23238
|
kind = "conditional";
|
|
22579
|
-
let
|
|
22580
|
-
const q = takeQuoted(
|
|
23239
|
+
let r5 = rest.slice(3).trimStart();
|
|
23240
|
+
const q = takeQuoted(r5);
|
|
22581
23241
|
if (q) {
|
|
22582
23242
|
connectorLabel = q.value;
|
|
22583
|
-
|
|
23243
|
+
r5 = q.rest.trimStart();
|
|
22584
23244
|
}
|
|
22585
|
-
if (!
|
|
23245
|
+
if (!r5.startsWith("-->")) {
|
|
22586
23246
|
throw new BpmnParseError(
|
|
22587
|
-
`conditional flow must end with --> (got '${
|
|
23247
|
+
`conditional flow must end with --> (got '${r5.slice(0, 20)}')`,
|
|
22588
23248
|
ln.no
|
|
22589
23249
|
);
|
|
22590
23250
|
}
|
|
22591
|
-
connectorLen = rest.length -
|
|
23251
|
+
connectorLen = rest.length - r5.length + 3;
|
|
22592
23252
|
} else if (rest.startsWith("--*")) {
|
|
22593
23253
|
kind = "default";
|
|
22594
|
-
let
|
|
22595
|
-
const q = takeQuoted(
|
|
23254
|
+
let r5 = rest.slice(3).trimStart();
|
|
23255
|
+
const q = takeQuoted(r5);
|
|
22596
23256
|
if (q) {
|
|
22597
23257
|
connectorLabel = q.value;
|
|
22598
|
-
|
|
23258
|
+
r5 = q.rest.trimStart();
|
|
22599
23259
|
}
|
|
22600
|
-
if (!
|
|
23260
|
+
if (!r5.startsWith("-->")) {
|
|
22601
23261
|
throw new BpmnParseError(
|
|
22602
|
-
`default flow must end with --> (got '${
|
|
23262
|
+
`default flow must end with --> (got '${r5.slice(0, 20)}')`,
|
|
22603
23263
|
ln.no
|
|
22604
23264
|
);
|
|
22605
23265
|
}
|
|
22606
|
-
connectorLen = rest.length -
|
|
23266
|
+
connectorLen = rest.length - r5.length + 3;
|
|
22607
23267
|
} else if (rest.startsWith("-->")) {
|
|
22608
23268
|
kind = "sequence";
|
|
22609
23269
|
connectorLen = 3;
|
|
@@ -22696,8 +23356,8 @@ function objBox(o) {
|
|
|
22696
23356
|
if ("gatewayKind" in o) {
|
|
22697
23357
|
return { w: BPMN_CONST.gatewaySize, h: BPMN_CONST.gatewaySize };
|
|
22698
23358
|
}
|
|
22699
|
-
const
|
|
22700
|
-
return { w:
|
|
23359
|
+
const r5 = BPMN_CONST.eventRadius;
|
|
23360
|
+
return { w: r5 * 2, h: r5 * 2 };
|
|
22701
23361
|
}
|
|
22702
23362
|
function layoutBpmn(ast) {
|
|
22703
23363
|
const allObjects = [
|
|
@@ -23315,11 +23975,11 @@ function renderGateway(ol) {
|
|
|
23315
23975
|
const g = ol.obj;
|
|
23316
23976
|
const cx = ol.x + ol.width / 2;
|
|
23317
23977
|
const cy = ol.y + ol.height / 2;
|
|
23318
|
-
const
|
|
23319
|
-
const points = `${cx},${cy -
|
|
23978
|
+
const r5 = ol.width / 2;
|
|
23979
|
+
const points = `${cx},${cy - r5} ${cx + r5},${cy} ${cx},${cy + r5} ${cx - r5},${cy}`;
|
|
23320
23980
|
const inner = [];
|
|
23321
23981
|
if (g.gatewayKind === "xor") {
|
|
23322
|
-
const a =
|
|
23982
|
+
const a = r5 * 0.42;
|
|
23323
23983
|
inner.push(
|
|
23324
23984
|
chunk3WNW5Y7P_cjs.el("path", {
|
|
23325
23985
|
d: `M ${cx - a} ${cy - a} L ${cx + a} ${cy + a} M ${cx + a} ${cy - a} L ${cx - a} ${cy + a}`,
|
|
@@ -23329,7 +23989,7 @@ function renderGateway(ol) {
|
|
|
23329
23989
|
})
|
|
23330
23990
|
);
|
|
23331
23991
|
} else if (g.gatewayKind === "and") {
|
|
23332
|
-
const a =
|
|
23992
|
+
const a = r5 * 0.5;
|
|
23333
23993
|
inner.push(
|
|
23334
23994
|
chunk3WNW5Y7P_cjs.el("path", {
|
|
23335
23995
|
d: `M ${cx - a} ${cy} L ${cx + a} ${cy} M ${cx} ${cy - a} L ${cx} ${cy + a}`,
|
|
@@ -23343,7 +24003,7 @@ function renderGateway(ol) {
|
|
|
23343
24003
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
23344
24004
|
cx,
|
|
23345
24005
|
cy,
|
|
23346
|
-
r:
|
|
24006
|
+
r: r5 * 0.45,
|
|
23347
24007
|
fill: "none",
|
|
23348
24008
|
stroke: STROKE,
|
|
23349
24009
|
"stroke-width": 2
|
|
@@ -23354,13 +24014,13 @@ function renderGateway(ol) {
|
|
|
23354
24014
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
23355
24015
|
cx,
|
|
23356
24016
|
cy,
|
|
23357
|
-
r:
|
|
24017
|
+
r: r5 * 0.55,
|
|
23358
24018
|
fill: "none",
|
|
23359
24019
|
stroke: STROKE,
|
|
23360
24020
|
"stroke-width": 1
|
|
23361
24021
|
})
|
|
23362
24022
|
);
|
|
23363
|
-
const pr =
|
|
24023
|
+
const pr = r5 * 0.32;
|
|
23364
24024
|
const pts = [];
|
|
23365
24025
|
for (let k = 0; k < 5; k++) {
|
|
23366
24026
|
const ang = -Math.PI / 2 + k * 2 * Math.PI / 5;
|
|
@@ -23402,7 +24062,7 @@ function renderEvent2(ol) {
|
|
|
23402
24062
|
const e = ol.obj;
|
|
23403
24063
|
const cx = ol.x + ol.width / 2;
|
|
23404
24064
|
const cy = ol.y + ol.height / 2;
|
|
23405
|
-
const
|
|
24065
|
+
const r5 = ol.width / 2;
|
|
23406
24066
|
const isEnd = e.kind === "end";
|
|
23407
24067
|
const isIntermediate = e.kind === "intermediate";
|
|
23408
24068
|
const strokeW = isEnd ? 3 : 1.2;
|
|
@@ -23411,7 +24071,7 @@ function renderEvent2(ol) {
|
|
|
23411
24071
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
23412
24072
|
cx,
|
|
23413
24073
|
cy,
|
|
23414
|
-
r:
|
|
24074
|
+
r: r5,
|
|
23415
24075
|
fill: EVENT_FILL,
|
|
23416
24076
|
stroke: STROKE,
|
|
23417
24077
|
"stroke-width": strokeW
|
|
@@ -23422,7 +24082,7 @@ function renderEvent2(ol) {
|
|
|
23422
24082
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
23423
24083
|
cx,
|
|
23424
24084
|
cy,
|
|
23425
|
-
r:
|
|
24085
|
+
r: r5 - 3,
|
|
23426
24086
|
fill: "none",
|
|
23427
24087
|
stroke: STROKE,
|
|
23428
24088
|
"stroke-width": 1.2
|
|
@@ -23431,9 +24091,9 @@ function renderEvent2(ol) {
|
|
|
23431
24091
|
}
|
|
23432
24092
|
const filled = e.throwCatch === "throw" && (isIntermediate || isEnd);
|
|
23433
24093
|
if (e.trigger === "message") {
|
|
23434
|
-
children.push(messageGlyph(cx, cy,
|
|
24094
|
+
children.push(messageGlyph(cx, cy, r5 * 0.55, filled));
|
|
23435
24095
|
} else if (e.trigger === "timer") {
|
|
23436
|
-
children.push(timerGlyph(cx, cy,
|
|
24096
|
+
children.push(timerGlyph(cx, cy, r5 * 0.55));
|
|
23437
24097
|
}
|
|
23438
24098
|
if (e.label) {
|
|
23439
24099
|
children.push(
|
|
@@ -23476,22 +24136,22 @@ function messageGlyph(cx, cy, size, filled) {
|
|
|
23476
24136
|
]);
|
|
23477
24137
|
}
|
|
23478
24138
|
function timerGlyph(cx, cy, size) {
|
|
23479
|
-
const
|
|
24139
|
+
const r5 = size / 2;
|
|
23480
24140
|
const ticks = [];
|
|
23481
24141
|
for (let k = 0; k < 12; k++) {
|
|
23482
24142
|
const ang = k * Math.PI / 6 - Math.PI / 2;
|
|
23483
|
-
const t1x = cx + (
|
|
23484
|
-
const t1y = cy + (
|
|
23485
|
-
const t2x = cx +
|
|
23486
|
-
const t2y = cy +
|
|
24143
|
+
const t1x = cx + (r5 - 1.5) * Math.cos(ang);
|
|
24144
|
+
const t1y = cy + (r5 - 1.5) * Math.sin(ang);
|
|
24145
|
+
const t2x = cx + r5 * Math.cos(ang);
|
|
24146
|
+
const t2y = cy + r5 * Math.sin(ang);
|
|
23487
24147
|
ticks.push(`M ${t1x} ${t1y} L ${t2x} ${t2y}`);
|
|
23488
24148
|
}
|
|
23489
24149
|
return chunk3WNW5Y7P_cjs.el("g", { class: "trigger-timer" }, [
|
|
23490
|
-
chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r:
|
|
24150
|
+
chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r5, fill: "none", stroke: STROKE, "stroke-width": 1 }),
|
|
23491
24151
|
chunk3WNW5Y7P_cjs.el("path", { d: ticks.join(" "), stroke: STROKE, "stroke-width": 0.8 }),
|
|
23492
24152
|
// Hands
|
|
23493
24153
|
chunk3WNW5Y7P_cjs.el("path", {
|
|
23494
|
-
d: `M ${cx} ${cy} L ${cx} ${cy -
|
|
24154
|
+
d: `M ${cx} ${cy} L ${cx} ${cy - r5 * 0.7} M ${cx} ${cy} L ${cx + r5 * 0.5} ${cy}`,
|
|
23495
24155
|
stroke: STROKE,
|
|
23496
24156
|
"stroke-width": 1.2,
|
|
23497
24157
|
"stroke-linecap": "round"
|
|
@@ -23562,8 +24222,8 @@ function parseStart(d) {
|
|
|
23562
24222
|
if (!m) return null;
|
|
23563
24223
|
return { x: parseFloat(m[1]), y: parseFloat(m[2]) };
|
|
23564
24224
|
}
|
|
23565
|
-
function diamondPoints(cx, cy,
|
|
23566
|
-
return `${cx -
|
|
24225
|
+
function diamondPoints(cx, cy, r5) {
|
|
24226
|
+
return `${cx - r5},${cy} ${cx},${cy - r5} ${cx + r5},${cy} ${cx},${cy + r5}`;
|
|
23567
24227
|
}
|
|
23568
24228
|
|
|
23569
24229
|
// src/diagrams/bpmn/index.ts
|
|
@@ -25870,24 +26530,24 @@ var sfc = {
|
|
|
25870
26530
|
|
|
25871
26531
|
// src/core/api.ts
|
|
25872
26532
|
var plugins = [
|
|
25873
|
-
|
|
25874
|
-
|
|
25875
|
-
|
|
25876
|
-
|
|
25877
|
-
|
|
26533
|
+
chunkNFZMNKOR_cjs.genogram,
|
|
26534
|
+
chunk2SZJQVPN_cjs.ecomap,
|
|
26535
|
+
chunkKGOZBABH_cjs.pedigree,
|
|
26536
|
+
chunkBL57NQKN_cjs.phylo,
|
|
26537
|
+
chunk5FYPSIGD_cjs.sociogram,
|
|
25878
26538
|
chunk2F45Y2ON_cjs.timing,
|
|
25879
|
-
|
|
25880
|
-
|
|
25881
|
-
|
|
25882
|
-
|
|
25883
|
-
|
|
25884
|
-
|
|
25885
|
-
|
|
25886
|
-
|
|
25887
|
-
|
|
26539
|
+
chunkZ3A2UNK2_cjs.logic,
|
|
26540
|
+
chunkQBS4F44Q_cjs.circuit,
|
|
26541
|
+
chunkSHMG7BVF_cjs.blockdiagram,
|
|
26542
|
+
chunkTACTEF2N_cjs.ladder,
|
|
26543
|
+
chunk34O3C6OC_cjs.sld,
|
|
26544
|
+
chunk77GPD4YQ_cjs.entity,
|
|
26545
|
+
chunkT5KHNJ67_cjs.fishbone,
|
|
26546
|
+
chunkLPAWZYDU_cjs.venn,
|
|
26547
|
+
chunkDR3DDDQY_cjs.flowchart,
|
|
25888
26548
|
mindmap,
|
|
25889
26549
|
matrix,
|
|
25890
|
-
|
|
26550
|
+
chunkUHPGWO77_cjs.orgchart,
|
|
25891
26551
|
decisiontree,
|
|
25892
26552
|
timeline,
|
|
25893
26553
|
state,
|
|
@@ -25904,7 +26564,8 @@ var plugins = [
|
|
|
25904
26564
|
petri,
|
|
25905
26565
|
network,
|
|
25906
26566
|
umlclass,
|
|
25907
|
-
faulttree
|
|
26567
|
+
faulttree,
|
|
26568
|
+
bowtie2
|
|
25908
26569
|
];
|
|
25909
26570
|
function detectPlugin(text2, config) {
|
|
25910
26571
|
if (config?.type) {
|
|
@@ -25915,7 +26576,7 @@ function detectPlugin(text2, config) {
|
|
|
25915
26576
|
if (plugin.detect(text2)) return plugin;
|
|
25916
26577
|
}
|
|
25917
26578
|
throw new Error(
|
|
25918
|
-
"Cannot detect diagram type. Start your text with 'genogram', 'ecomap', 'pedigree', 'phylo', 'sociogram', 'timing', 'logic', 'circuit', 'blockdiagram', 'ladder', 'sld', 'entity-structure', 'fishbone', 'venn', 'flowchart', 'mindmap', 'matrix', 'orgchart', 'state', 'pid', 'erd', 'breadboard', 'bpmn', 'fbd', 'sfc', 'prisma', 'usecase', 'pert', 'sequence', 'petri', 'network', or '
|
|
26579
|
+
"Cannot detect diagram type. Start your text with 'genogram', 'ecomap', 'pedigree', 'phylo', 'sociogram', 'timing', 'logic', 'circuit', 'blockdiagram', 'ladder', 'sld', 'entity-structure', 'fishbone', 'venn', 'flowchart', 'mindmap', 'matrix', 'orgchart', 'state', 'pid', 'erd', 'breadboard', 'bpmn', 'fbd', 'sfc', 'prisma', 'usecase', 'pert', 'sequence', 'petri', 'network', 'umlclass', 'faulttree', or 'bowtie'."
|
|
25919
26580
|
);
|
|
25920
26581
|
}
|
|
25921
26582
|
function preprocess8(text2) {
|
|
@@ -26024,6 +26685,7 @@ function renderWithPlugin(prepared, plugin, config) {
|
|
|
26024
26685
|
}
|
|
26025
26686
|
|
|
26026
26687
|
exports.GEOMETRY = GEOMETRY;
|
|
26688
|
+
exports.bowtie = bowtie2;
|
|
26027
26689
|
exports.decisiontree = decisiontree;
|
|
26028
26690
|
exports.drawDeviceIcon = drawDeviceIcon;
|
|
26029
26691
|
exports.faulttree = faulttree;
|
|
@@ -26044,5 +26706,5 @@ exports.state = state;
|
|
|
26044
26706
|
exports.timeline = timeline;
|
|
26045
26707
|
exports.umlclass = umlclass;
|
|
26046
26708
|
exports.usecase = usecase;
|
|
26047
|
-
//# sourceMappingURL=chunk-
|
|
26048
|
-
//# sourceMappingURL=chunk-
|
|
26709
|
+
//# sourceMappingURL=chunk-LDONE225.cjs.map
|
|
26710
|
+
//# sourceMappingURL=chunk-LDONE225.cjs.map
|