schematex 0.9.4 → 0.9.5
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/README.md +26 -0
- package/dist/ai/ai-sdk.cjs +8 -8
- package/dist/ai/ai-sdk.d.cts +3 -3
- package/dist/ai/ai-sdk.d.ts +3 -3
- package/dist/ai/ai-sdk.js +3 -3
- package/dist/ai/index.cjs +17 -17
- package/dist/ai/index.d.cts +4 -4
- package/dist/ai/index.d.ts +4 -4
- package/dist/ai/index.js +4 -4
- package/dist/{api-1xoGiseb.d.cts → api-BOJJlNb1.d.ts} +2 -2
- package/dist/{api-CgXRSnCn.d.ts → api-v9t1T1v6.d.cts} +2 -2
- package/dist/browser.cjs +9 -9
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +3 -3
- package/dist/{chunk-TX3YWZZX.cjs → chunk-7EWP4OD7.cjs} +186 -6
- package/dist/chunk-7EWP4OD7.cjs.map +1 -0
- package/dist/{chunk-PFZKW3HE.js → chunk-II4GLKGF.js} +2 -2
- package/dist/chunk-II4GLKGF.js.map +1 -0
- package/dist/{chunk-UFXDAIDD.js → chunk-LMNWUZMD.js} +1255 -602
- package/dist/chunk-LMNWUZMD.js.map +1 -0
- package/dist/{chunk-WJXLF42K.cjs → chunk-N3HU635X.cjs} +2 -2
- package/dist/chunk-N3HU635X.cjs.map +1 -0
- package/dist/{chunk-NIYB6CHH.js → chunk-N524SY5D.js} +184 -4
- package/dist/chunk-N524SY5D.js.map +1 -0
- package/dist/{chunk-GTCAJPQR.cjs → chunk-Q7CWX6HA.cjs} +1256 -602
- package/dist/chunk-Q7CWX6HA.cjs.map +1 -0
- package/dist/{diagnostics-CDwnQ65n.d.cts → diagnostics-5bVLlGNj.d.cts} +1 -1
- package/dist/{diagnostics-CDwnQ65n.d.ts → diagnostics-5bVLlGNj.d.ts} +1 -1
- package/dist/diagrams/blockdiagram/index.d.cts +1 -1
- package/dist/diagrams/blockdiagram/index.d.ts +1 -1
- package/dist/diagrams/circuit/index.d.cts +1 -1
- package/dist/diagrams/circuit/index.d.ts +1 -1
- package/dist/diagrams/ecomap/index.d.cts +1 -1
- package/dist/diagrams/ecomap/index.d.ts +1 -1
- package/dist/diagrams/entity/index.d.cts +1 -1
- package/dist/diagrams/entity/index.d.ts +1 -1
- package/dist/diagrams/fishbone/index.d.cts +1 -1
- package/dist/diagrams/fishbone/index.d.ts +1 -1
- package/dist/diagrams/flowchart/index.d.cts +2 -2
- package/dist/diagrams/flowchart/index.d.ts +2 -2
- package/dist/diagrams/genogram/index.d.cts +1 -1
- package/dist/diagrams/genogram/index.d.ts +1 -1
- package/dist/diagrams/ladder/index.d.cts +1 -1
- package/dist/diagrams/ladder/index.d.ts +1 -1
- package/dist/diagrams/logic/index.d.cts +1 -1
- package/dist/diagrams/logic/index.d.ts +1 -1
- package/dist/diagrams/orgchart/index.d.cts +1 -1
- package/dist/diagrams/orgchart/index.d.ts +1 -1
- package/dist/diagrams/pedigree/index.d.cts +1 -1
- package/dist/diagrams/pedigree/index.d.ts +1 -1
- package/dist/diagrams/phylo/index.d.cts +1 -1
- package/dist/diagrams/phylo/index.d.ts +1 -1
- package/dist/diagrams/sld/index.cjs +7 -7
- package/dist/diagrams/sld/index.d.cts +1 -1
- package/dist/diagrams/sld/index.d.ts +1 -1
- package/dist/diagrams/sld/index.js +1 -1
- package/dist/diagrams/sociogram/index.d.cts +1 -1
- package/dist/diagrams/sociogram/index.d.ts +1 -1
- package/dist/diagrams/timing/index.d.cts +1 -1
- package/dist/diagrams/timing/index.d.ts +1 -1
- package/dist/diagrams/venn/index.d.cts +1 -1
- package/dist/diagrams/venn/index.d.ts +1 -1
- package/dist/{index-DNOoLmYX.d.cts → index-Cmf4Rcve.d.cts} +1 -1
- package/dist/{index-CYSH3_ca.d.ts → index-syc0E5Ss.d.ts} +1 -1
- package/dist/index.cjs +41 -37
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +4 -4
- package/dist/react.cjs +3 -3
- package/dist/react.d.cts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +2 -2
- package/dist/{tools-CbYmQ3hH.d.cts → tools-B98iarLm.d.cts} +2 -2
- package/dist/{tools-BhTti-oG.d.ts → tools-CCZ1IcIN.d.ts} +2 -2
- package/package.json +1 -1
- package/dist/chunk-GTCAJPQR.cjs.map +0 -1
- package/dist/chunk-NIYB6CHH.js.map +0 -1
- package/dist/chunk-PFZKW3HE.js.map +0 -1
- package/dist/chunk-TX3YWZZX.cjs.map +0 -1
- package/dist/chunk-UFXDAIDD.js.map +0 -1
- package/dist/chunk-WJXLF42K.cjs.map +0 -1
|
@@ -4,7 +4,7 @@ var chunk4OC3CTGE_cjs = require('./chunk-4OC3CTGE.cjs');
|
|
|
4
4
|
var chunk4AC6I7KJ_cjs = require('./chunk-4AC6I7KJ.cjs');
|
|
5
5
|
var chunkC4Y24X3U_cjs = require('./chunk-C4Y24X3U.cjs');
|
|
6
6
|
var chunkINVLJYAE_cjs = require('./chunk-INVLJYAE.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkN3HU635X_cjs = require('./chunk-N3HU635X.cjs');
|
|
8
8
|
var chunkGAQ36VFD_cjs = require('./chunk-GAQ36VFD.cjs');
|
|
9
9
|
var chunk627GHE2N_cjs = require('./chunk-627GHE2N.cjs');
|
|
10
10
|
var chunkITI3STJ6_cjs = require('./chunk-ITI3STJ6.cjs');
|
|
@@ -2756,8 +2756,8 @@ function renderEras(layout, theme) {
|
|
|
2756
2756
|
layout.eras.forEach((e, i) => {
|
|
2757
2757
|
const l = leftmostOnRow.get(e.bandRow);
|
|
2758
2758
|
if (l === void 0 || e.x < layout.eras[l].x) leftmostOnRow.set(e.bandRow, i);
|
|
2759
|
-
const
|
|
2760
|
-
if (
|
|
2759
|
+
const r7 = rightmostOnRow.get(e.bandRow);
|
|
2760
|
+
if (r7 === void 0 || e.x + e.width > layout.eras[r7].x + layout.eras[r7].width) rightmostOnRow.set(e.bandRow, i);
|
|
2761
2761
|
});
|
|
2762
2762
|
const plotEnd = layout.plotX + layout.plotW;
|
|
2763
2763
|
const items = layout.eras.map((e, i) => {
|
|
@@ -2883,20 +2883,20 @@ function renderSwimlanePoints(layout, theme) {
|
|
|
2883
2883
|
function renderMarker(ev, color, shape, isMilestone) {
|
|
2884
2884
|
const x = ev.x;
|
|
2885
2885
|
const y = ev.y;
|
|
2886
|
-
const
|
|
2886
|
+
const r7 = isMilestone ? 8 : 5;
|
|
2887
2887
|
const klass = isMilestone ? "st-milestone" : "st-event-dot";
|
|
2888
2888
|
switch (shape) {
|
|
2889
2889
|
case "square":
|
|
2890
|
-
return chunk3WNW5Y7P_cjs.rect({ x: x -
|
|
2890
|
+
return chunk3WNW5Y7P_cjs.rect({ x: x - r7, y: y - r7, width: r7 * 2, height: r7 * 2, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2891
2891
|
case "diamond":
|
|
2892
|
-
return chunk3WNW5Y7P_cjs.path({ d: `M ${x},${y -
|
|
2892
|
+
return chunk3WNW5Y7P_cjs.path({ d: `M ${x},${y - r7} L ${x + r7},${y} L ${x},${y + r7} L ${x - r7},${y} Z`, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2893
2893
|
case "star":
|
|
2894
|
-
return chunk3WNW5Y7P_cjs.path({ d: starPath(x, y,
|
|
2894
|
+
return chunk3WNW5Y7P_cjs.path({ d: starPath(x, y, r7 + 2, (r7 + 2) / 2.5, 5), fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2895
2895
|
case "flag":
|
|
2896
|
-
return chunk3WNW5Y7P_cjs.path({ d: `M ${x -
|
|
2896
|
+
return chunk3WNW5Y7P_cjs.path({ d: `M ${x - r7},${y + r7} L ${x - r7},${y - r7 - 4} L ${x + r7 + 4},${y - r7 - 1} L ${x - r7},${y + 2}`, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2897
2897
|
case "circle":
|
|
2898
2898
|
default:
|
|
2899
|
-
return chunk3WNW5Y7P_cjs.circle({ cx: x, cy: y, r:
|
|
2899
|
+
return chunk3WNW5Y7P_cjs.circle({ cx: x, cy: y, r: r7, fill: color, class: klass, "data-event-id": ev.event.id });
|
|
2900
2900
|
}
|
|
2901
2901
|
}
|
|
2902
2902
|
function renderLabels(layout) {
|
|
@@ -3152,10 +3152,10 @@ function starPath(cx, cy, rOuter, rInner, points) {
|
|
|
3152
3152
|
const step = Math.PI / points;
|
|
3153
3153
|
let d = "";
|
|
3154
3154
|
for (let i = 0; i < points * 2; i++) {
|
|
3155
|
-
const
|
|
3155
|
+
const r7 = i % 2 === 0 ? rOuter : rInner;
|
|
3156
3156
|
const a = i * step - Math.PI / 2;
|
|
3157
|
-
const x = cx +
|
|
3158
|
-
const y = cy +
|
|
3157
|
+
const x = cx + r7 * Math.cos(a);
|
|
3158
|
+
const y = cy + r7 * Math.sin(a);
|
|
3159
3159
|
d += (i === 0 ? "M" : "L") + x.toFixed(2) + "," + y.toFixed(2) + " ";
|
|
3160
3160
|
}
|
|
3161
3161
|
return d + "Z";
|
|
@@ -3426,7 +3426,7 @@ function parseStateDiagram(src) {
|
|
|
3426
3426
|
}
|
|
3427
3427
|
ctxTop.regionMode = true;
|
|
3428
3428
|
if (!parent.regions) parent.regions = [];
|
|
3429
|
-
const lastIdx = parent.regions.reduce((s,
|
|
3429
|
+
const lastIdx = parent.regions.reduce((s, r7) => s + r7.length, 0);
|
|
3430
3430
|
const slice = parent.children.slice(lastIdx);
|
|
3431
3431
|
parent.regions.push(slice);
|
|
3432
3432
|
i++;
|
|
@@ -3630,7 +3630,7 @@ function parseStateDiagram(src) {
|
|
|
3630
3630
|
}
|
|
3631
3631
|
function finalizeRegions(node) {
|
|
3632
3632
|
if (node.regions) {
|
|
3633
|
-
const consumed = node.regions.reduce((s,
|
|
3633
|
+
const consumed = node.regions.reduce((s, r7) => s + r7.length, 0);
|
|
3634
3634
|
if (node.children.length > consumed) {
|
|
3635
3635
|
node.regions.push(node.children.slice(consumed));
|
|
3636
3636
|
}
|
|
@@ -4075,33 +4075,33 @@ function pointsToPath(pts) {
|
|
|
4075
4075
|
const rest = pts.slice(1).map((p) => `L ${p.x} ${p.y}`).join(" ");
|
|
4076
4076
|
return rest ? `${head} ${rest}` : head;
|
|
4077
4077
|
}
|
|
4078
|
-
function trimPathStart(d, cx, cy,
|
|
4078
|
+
function trimPathStart(d, cx, cy, r7) {
|
|
4079
4079
|
const pts = parsePathPoints(d);
|
|
4080
4080
|
if (!pts || pts.length < 2) return d;
|
|
4081
4081
|
const p0 = pts[0];
|
|
4082
4082
|
const p1 = pts[1];
|
|
4083
|
-
const newP0 = projectOnPerimeter(p0, p1, cx, cy,
|
|
4083
|
+
const newP0 = projectOnPerimeter(p0, p1, cx, cy, r7);
|
|
4084
4084
|
pts[0] = newP0;
|
|
4085
4085
|
return pointsToPath(pts);
|
|
4086
4086
|
}
|
|
4087
|
-
function trimPathEnd(d, cx, cy,
|
|
4087
|
+
function trimPathEnd(d, cx, cy, r7) {
|
|
4088
4088
|
const pts = parsePathPoints(d);
|
|
4089
4089
|
if (!pts || pts.length < 2) return d;
|
|
4090
4090
|
const last = pts[pts.length - 1];
|
|
4091
4091
|
const prev = pts[pts.length - 2];
|
|
4092
|
-
const newLast = projectOnPerimeter(last, prev, cx, cy,
|
|
4092
|
+
const newLast = projectOnPerimeter(last, prev, cx, cy, r7);
|
|
4093
4093
|
pts[pts.length - 1] = newLast;
|
|
4094
4094
|
return pointsToPath(pts);
|
|
4095
4095
|
}
|
|
4096
|
-
function projectOnPerimeter(endpoint, neighbor, cx, cy,
|
|
4096
|
+
function projectOnPerimeter(endpoint, neighbor, cx, cy, r7) {
|
|
4097
4097
|
const dx = endpoint.x - neighbor.x;
|
|
4098
4098
|
const dy = endpoint.y - neighbor.y;
|
|
4099
4099
|
if (Math.abs(dx) > Math.abs(dy)) {
|
|
4100
4100
|
const sign2 = dx >= 0 ? 1 : -1;
|
|
4101
|
-
return { x: cx - sign2 *
|
|
4101
|
+
return { x: cx - sign2 * r7, y: cy };
|
|
4102
4102
|
}
|
|
4103
4103
|
const sign = dy >= 0 ? 1 : -1;
|
|
4104
|
-
return { x: cx, y: cy - sign *
|
|
4104
|
+
return { x: cx, y: cy - sign * r7 };
|
|
4105
4105
|
}
|
|
4106
4106
|
function shiftPathX(d, dx) {
|
|
4107
4107
|
return d.replace(/([MLCQ])\s*((?:-?\d+(?:\.\d+)?\s+){1,5}-?\d+(?:\.\d+)?)/g, (_, cmd, args) => {
|
|
@@ -4279,12 +4279,12 @@ function renderPseudo(node) {
|
|
|
4279
4279
|
]
|
|
4280
4280
|
);
|
|
4281
4281
|
case "choice": {
|
|
4282
|
-
const
|
|
4282
|
+
const r7 = 14;
|
|
4283
4283
|
return chunk3WNW5Y7P_cjs.group(
|
|
4284
4284
|
{ class: "lt-state lt-pseudo", "data-id": node.id, "data-kind": "choice" },
|
|
4285
4285
|
[
|
|
4286
4286
|
chunk3WNW5Y7P_cjs.polygon({
|
|
4287
|
-
points: `${cx},${cy -
|
|
4287
|
+
points: `${cx},${cy - r7} ${cx + r7},${cy} ${cx},${cy + r7} ${cx - r7},${cy}`,
|
|
4288
4288
|
class: "lt-ps-choice"
|
|
4289
4289
|
})
|
|
4290
4290
|
]
|
|
@@ -5282,27 +5282,27 @@ function renderEquip(type, label, rawType) {
|
|
|
5282
5282
|
]);
|
|
5283
5283
|
}
|
|
5284
5284
|
case "pump_centrifugal": {
|
|
5285
|
-
const
|
|
5285
|
+
const r7 = 22;
|
|
5286
5286
|
return chunk3WNW5Y7P_cjs.group({}, [
|
|
5287
|
-
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5287
|
+
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-pid-equip" }),
|
|
5288
5288
|
chunk3WNW5Y7P_cjs.polygon({
|
|
5289
|
-
points: `${
|
|
5289
|
+
points: `${r7 * 0.4},${-r7 * 0.9} ${r7 + 6},${-r7 * 0.9} ${r7 * 0.4},${0}`,
|
|
5290
5290
|
class: "lt-pid-equip"
|
|
5291
5291
|
}),
|
|
5292
5292
|
chunk3WNW5Y7P_cjs.text(
|
|
5293
|
-
{ x: 0, y:
|
|
5293
|
+
{ x: 0, y: r7 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
|
|
5294
5294
|
label
|
|
5295
5295
|
)
|
|
5296
5296
|
]);
|
|
5297
5297
|
}
|
|
5298
5298
|
case "pump_pd": {
|
|
5299
|
-
const
|
|
5299
|
+
const r7 = 22;
|
|
5300
5300
|
return chunk3WNW5Y7P_cjs.group({}, [
|
|
5301
|
-
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5301
|
+
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-pid-equip" }),
|
|
5302
5302
|
chunk3WNW5Y7P_cjs.circle({ cx: -8, cy: 0, r: 6, class: "lt-pid-tray-line", fill: "none" }),
|
|
5303
5303
|
chunk3WNW5Y7P_cjs.circle({ cx: 8, cy: 0, r: 6, class: "lt-pid-tray-line", fill: "none" }),
|
|
5304
5304
|
chunk3WNW5Y7P_cjs.text(
|
|
5305
|
-
{ x: 0, y:
|
|
5305
|
+
{ x: 0, y: r7 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" },
|
|
5306
5306
|
label
|
|
5307
5307
|
)
|
|
5308
5308
|
]);
|
|
@@ -5317,14 +5317,14 @@ function renderEquip(type, label, rawType) {
|
|
|
5317
5317
|
]);
|
|
5318
5318
|
}
|
|
5319
5319
|
case "blower": {
|
|
5320
|
-
const
|
|
5320
|
+
const r7 = 22;
|
|
5321
5321
|
return chunk3WNW5Y7P_cjs.group({}, [
|
|
5322
|
-
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5322
|
+
chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-pid-equip" }),
|
|
5323
5323
|
chunk3WNW5Y7P_cjs.path({
|
|
5324
|
-
d: `M 0 0 L ${
|
|
5324
|
+
d: `M 0 0 L ${r7 * 0.8} ${-r7 * 0.5} M 0 0 L ${-r7 * 0.6} ${-r7 * 0.6} M 0 0 L 0 ${r7 * 0.8}`,
|
|
5325
5325
|
class: "lt-pid-tray-line"
|
|
5326
5326
|
}),
|
|
5327
|
-
chunk3WNW5Y7P_cjs.text({ x: 0, y:
|
|
5327
|
+
chunk3WNW5Y7P_cjs.text({ x: 0, y: r7 + 14, "text-anchor": "middle", class: "lt-pid-equip-tag" }, label)
|
|
5328
5328
|
]);
|
|
5329
5329
|
}
|
|
5330
5330
|
case "reactor_cstr": {
|
|
@@ -5500,7 +5500,7 @@ function renderEquip(type, label, rawType) {
|
|
|
5500
5500
|
}
|
|
5501
5501
|
}
|
|
5502
5502
|
function renderInstrument(category, letterCode, loopNumber) {
|
|
5503
|
-
const
|
|
5503
|
+
const r7 = 14;
|
|
5504
5504
|
const isComputer = category.endsWith("computer");
|
|
5505
5505
|
const isPlc = category.endsWith("plc");
|
|
5506
5506
|
const isShared = category.endsWith("shared");
|
|
@@ -5508,17 +5508,17 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5508
5508
|
const isLocal = category.startsWith("local_");
|
|
5509
5509
|
const parts = [];
|
|
5510
5510
|
if (isComputer) {
|
|
5511
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5511
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
|
|
5512
5512
|
parts.push(
|
|
5513
5513
|
chunk3WNW5Y7P_cjs.polygon({
|
|
5514
|
-
points: `0,${-
|
|
5514
|
+
points: `0,${-r7 + 1} ${r7 - 1},0 0,${r7 - 1} ${ -13},0`,
|
|
5515
5515
|
class: "lt-inst-body",
|
|
5516
5516
|
fill: "none"
|
|
5517
5517
|
})
|
|
5518
5518
|
);
|
|
5519
5519
|
} else if (isPlc) {
|
|
5520
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5521
|
-
const side =
|
|
5520
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
|
|
5521
|
+
const side = r7 * Math.SQRT1_2 * 2 - 2;
|
|
5522
5522
|
parts.push(
|
|
5523
5523
|
chunk3WNW5Y7P_cjs.rect({
|
|
5524
5524
|
x: -side / 2,
|
|
@@ -5530,11 +5530,11 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5530
5530
|
})
|
|
5531
5531
|
);
|
|
5532
5532
|
} else if (isShared) {
|
|
5533
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5533
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
|
|
5534
5534
|
const hex = [];
|
|
5535
5535
|
for (let i = 0; i < 6; i++) {
|
|
5536
5536
|
const a = Math.PI / 3 * i - Math.PI / 2;
|
|
5537
|
-
hex.push(`${(
|
|
5537
|
+
hex.push(`${(r7 - 2) * Math.cos(a)},${(r7 - 2) * Math.sin(a)}`);
|
|
5538
5538
|
}
|
|
5539
5539
|
parts.push(
|
|
5540
5540
|
chunk3WNW5Y7P_cjs.polygon({
|
|
@@ -5544,12 +5544,12 @@ function renderInstrument(category, letterCode, loopNumber) {
|
|
|
5544
5544
|
})
|
|
5545
5545
|
);
|
|
5546
5546
|
} else {
|
|
5547
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r:
|
|
5547
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: 0, cy: 0, r: r7, class: "lt-inst-body" }));
|
|
5548
5548
|
}
|
|
5549
5549
|
if (isControlRoom) {
|
|
5550
|
-
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -
|
|
5550
|
+
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r7, y1: 0, x2: r7, y2: 0, class: "lt-inst-cr-line" }));
|
|
5551
5551
|
} else if (isLocal) {
|
|
5552
|
-
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -
|
|
5552
|
+
parts.push(chunk3WNW5Y7P_cjs.line({ x1: -r7, y1: 0, x2: r7, y2: 0, class: "lt-inst-local-line" }));
|
|
5553
5553
|
}
|
|
5554
5554
|
parts.push(
|
|
5555
5555
|
chunk3WNW5Y7P_cjs.text(
|
|
@@ -6301,19 +6301,19 @@ function readScalar(map, key) {
|
|
|
6301
6301
|
return { value, line: entry.header.line };
|
|
6302
6302
|
}
|
|
6303
6303
|
function readInt(map, key) {
|
|
6304
|
-
const
|
|
6305
|
-
if (
|
|
6306
|
-
return parseInt10(
|
|
6304
|
+
const r7 = readScalar(map, key);
|
|
6305
|
+
if (r7 === void 0) return void 0;
|
|
6306
|
+
return parseInt10(r7.value, r7.line);
|
|
6307
6307
|
}
|
|
6308
6308
|
function readSources(map, key) {
|
|
6309
|
-
const
|
|
6310
|
-
if (
|
|
6311
|
-
return parsePairs(
|
|
6309
|
+
const r7 = readScalar(map, key);
|
|
6310
|
+
if (r7 === void 0) return void 0;
|
|
6311
|
+
return parsePairs(r7.value, r7.line);
|
|
6312
6312
|
}
|
|
6313
6313
|
function readReasons(map, key) {
|
|
6314
|
-
const
|
|
6315
|
-
if (
|
|
6316
|
-
return parsePairs(
|
|
6314
|
+
const r7 = readScalar(map, key);
|
|
6315
|
+
if (r7 === void 0) return void 0;
|
|
6316
|
+
return parsePairs(r7.value, r7.line);
|
|
6317
6317
|
}
|
|
6318
6318
|
function readBlock(map, key) {
|
|
6319
6319
|
const entry = map.get(key);
|
|
@@ -6641,7 +6641,7 @@ function runArithmeticValidation(ast) {
|
|
|
6641
6641
|
}
|
|
6642
6642
|
}
|
|
6643
6643
|
if (ast.screening.excluded.reasons && ast.screening.excluded.reasons.length > 0) {
|
|
6644
|
-
const sum = ast.screening.excluded.reasons.reduce((a,
|
|
6644
|
+
const sum = ast.screening.excluded.reasons.reduce((a, r7) => a + r7.count, 0);
|
|
6645
6645
|
if (sum !== screenedExcluded) {
|
|
6646
6646
|
issues.push(
|
|
6647
6647
|
`screening.excluded reasons sum to ${formatN(sum)} but n = ${formatN(screenedExcluded)}`
|
|
@@ -6649,7 +6649,7 @@ function runArithmeticValidation(ast) {
|
|
|
6649
6649
|
}
|
|
6650
6650
|
}
|
|
6651
6651
|
if (ast.eligibility.excluded.reasons && ast.eligibility.excluded.reasons.length > 0) {
|
|
6652
|
-
const sum = ast.eligibility.excluded.reasons.reduce((a,
|
|
6652
|
+
const sum = ast.eligibility.excluded.reasons.reduce((a, r7) => a + r7.count, 0);
|
|
6653
6653
|
if (sum !== eligExcluded) {
|
|
6654
6654
|
issues.push(
|
|
6655
6655
|
`eligibility.excluded reasons sum to ${formatN(sum)} but n = ${formatN(eligExcluded)}`
|
|
@@ -6742,7 +6742,7 @@ function aggregateReasons(reasons) {
|
|
|
6742
6742
|
const sorted = [...reasons].sort((a, b) => b.count - a.count);
|
|
6743
6743
|
const head = sorted.slice(0, PRISMA_CONST.MAX_REASON_LINES - 1);
|
|
6744
6744
|
const tail = sorted.slice(PRISMA_CONST.MAX_REASON_LINES - 1);
|
|
6745
|
-
const otherSum = tail.reduce((a,
|
|
6745
|
+
const otherSum = tail.reduce((a, r7) => a + r7.count, 0);
|
|
6746
6746
|
return {
|
|
6747
6747
|
lines: [...head, { name: `Other (${tail.length} reasons)`, count: otherSum }],
|
|
6748
6748
|
truncated: tail.length
|
|
@@ -6799,8 +6799,8 @@ function buildIdentificationRemovedBox(id, kind) {
|
|
|
6799
6799
|
}
|
|
6800
6800
|
if (removed.length === 0) return null;
|
|
6801
6801
|
const lines = [{ text: v.recordsRemovedLabel, style: "label" }];
|
|
6802
|
-
for (const
|
|
6803
|
-
lines.push({ text:
|
|
6802
|
+
for (const r7 of removed) {
|
|
6803
|
+
lines.push({ text: r7, style: "reason", indent: 1 });
|
|
6804
6804
|
}
|
|
6805
6805
|
return {
|
|
6806
6806
|
role: "id-removed",
|
|
@@ -6856,8 +6856,8 @@ function buildScreeningExcludedBox(n, reasons, kind) {
|
|
|
6856
6856
|
{ text: v.recordsExcluded, style: "label" },
|
|
6857
6857
|
{ text: `n = ${nFmt(n)}`, style: "count" }
|
|
6858
6858
|
];
|
|
6859
|
-
for (const
|
|
6860
|
-
out.push({ text: `${
|
|
6859
|
+
for (const r7 of items) {
|
|
6860
|
+
out.push({ text: `${r7.name} (n = ${nFmt(r7.count)})`, style: "reason", indent: 1 });
|
|
6861
6861
|
}
|
|
6862
6862
|
return {
|
|
6863
6863
|
role: "screening-excluded",
|
|
@@ -6887,8 +6887,8 @@ function buildEligibilityExcludedBox(n, reasons, kind) {
|
|
|
6887
6887
|
{ text: v.reportsExcluded, style: "label" },
|
|
6888
6888
|
{ text: `n = ${nFmt(n)}`, style: "count" }
|
|
6889
6889
|
];
|
|
6890
|
-
for (const
|
|
6891
|
-
out.push({ text: `${
|
|
6890
|
+
for (const r7 of items) {
|
|
6891
|
+
out.push({ text: `${r7.name} (n = ${nFmt(r7.count)})`, style: "reason", indent: 1 });
|
|
6892
6892
|
}
|
|
6893
6893
|
return {
|
|
6894
6894
|
role: "eligibility-excluded",
|
|
@@ -7489,7 +7489,7 @@ function classForEdge(kind) {
|
|
|
7489
7489
|
}
|
|
7490
7490
|
}
|
|
7491
7491
|
function renderBand(band) {
|
|
7492
|
-
const
|
|
7492
|
+
const r7 = chunk3WNW5Y7P_cjs.rect({
|
|
7493
7493
|
x: band.x,
|
|
7494
7494
|
y: band.y,
|
|
7495
7495
|
width: band.width,
|
|
@@ -7512,10 +7512,10 @@ function renderBand(band) {
|
|
|
7512
7512
|
},
|
|
7513
7513
|
band.label
|
|
7514
7514
|
);
|
|
7515
|
-
return chunk3WNW5Y7P_cjs.group({ "data-band": band.stage }, [
|
|
7515
|
+
return chunk3WNW5Y7P_cjs.group({ "data-band": band.stage }, [r7, txt]);
|
|
7516
7516
|
}
|
|
7517
7517
|
function renderHeader(h) {
|
|
7518
|
-
const
|
|
7518
|
+
const r7 = chunk3WNW5Y7P_cjs.rect({
|
|
7519
7519
|
x: h.x,
|
|
7520
7520
|
y: h.y,
|
|
7521
7521
|
width: h.width,
|
|
@@ -7540,10 +7540,10 @@ function renderHeader(h) {
|
|
|
7540
7540
|
ln
|
|
7541
7541
|
)
|
|
7542
7542
|
);
|
|
7543
|
-
return chunk3WNW5Y7P_cjs.group({ "data-header": h.column }, [
|
|
7543
|
+
return chunk3WNW5Y7P_cjs.group({ "data-header": h.column }, [r7, ...lines]);
|
|
7544
7544
|
}
|
|
7545
7545
|
function renderBox(box2) {
|
|
7546
|
-
const
|
|
7546
|
+
const r7 = chunk3WNW5Y7P_cjs.rect({
|
|
7547
7547
|
x: box2.x,
|
|
7548
7548
|
y: box2.y,
|
|
7549
7549
|
width: box2.width,
|
|
@@ -7601,7 +7601,7 @@ function renderBox(box2) {
|
|
|
7601
7601
|
"data-prisma-variant": box2.variant,
|
|
7602
7602
|
"data-prisma-stage": box2.stage
|
|
7603
7603
|
},
|
|
7604
|
-
[
|
|
7604
|
+
[r7, ...textEls]
|
|
7605
7605
|
);
|
|
7606
7606
|
}
|
|
7607
7607
|
function approxLineWidth(line2) {
|
|
@@ -8310,14 +8310,14 @@ function sizeEllipse(uc) {
|
|
|
8310
8310
|
}
|
|
8311
8311
|
function buildDeepEdges(ast, ucIds) {
|
|
8312
8312
|
const edges = [];
|
|
8313
|
-
for (const
|
|
8314
|
-
if (!ucIds.has(
|
|
8315
|
-
if (
|
|
8316
|
-
edges.push({ from:
|
|
8317
|
-
} else if (
|
|
8318
|
-
edges.push({ from:
|
|
8319
|
-
} else if (
|
|
8320
|
-
edges.push({ from:
|
|
8313
|
+
for (const r7 of ast.relations) {
|
|
8314
|
+
if (!ucIds.has(r7.source) || !ucIds.has(r7.target)) continue;
|
|
8315
|
+
if (r7.kind === "include") {
|
|
8316
|
+
edges.push({ from: r7.source, to: r7.target });
|
|
8317
|
+
} else if (r7.kind === "extend") {
|
|
8318
|
+
edges.push({ from: r7.target, to: r7.source });
|
|
8319
|
+
} else if (r7.kind === "generalization") {
|
|
8320
|
+
edges.push({ from: r7.source, to: r7.target });
|
|
8321
8321
|
}
|
|
8322
8322
|
}
|
|
8323
8323
|
return edges;
|
|
@@ -8345,15 +8345,15 @@ function classifyActorSides(ast) {
|
|
|
8345
8345
|
ast.actors.forEach((a, i) => idx.set(a.id, i));
|
|
8346
8346
|
const parent = /* @__PURE__ */ new Map();
|
|
8347
8347
|
const find = (x) => {
|
|
8348
|
-
let
|
|
8349
|
-
while ((parent.get(
|
|
8348
|
+
let r7 = x;
|
|
8349
|
+
while ((parent.get(r7) ?? r7) !== r7) r7 = parent.get(r7) ?? r7;
|
|
8350
8350
|
let c = x;
|
|
8351
8351
|
while ((parent.get(c) ?? c) !== c) {
|
|
8352
8352
|
const next = parent.get(c) ?? c;
|
|
8353
|
-
parent.set(c,
|
|
8353
|
+
parent.set(c, r7);
|
|
8354
8354
|
c = next;
|
|
8355
8355
|
}
|
|
8356
|
-
return
|
|
8356
|
+
return r7;
|
|
8357
8357
|
};
|
|
8358
8358
|
const union = (a, b) => {
|
|
8359
8359
|
const ra = find(a);
|
|
@@ -8363,9 +8363,9 @@ function classifyActorSides(ast) {
|
|
|
8363
8363
|
else parent.set(ra, rb);
|
|
8364
8364
|
};
|
|
8365
8365
|
for (const a of ast.actors) parent.set(a.id, a.id);
|
|
8366
|
-
for (const
|
|
8367
|
-
if (
|
|
8368
|
-
union(
|
|
8366
|
+
for (const r7 of ast.relations) {
|
|
8367
|
+
if (r7.kind === "generalization" && actorIds.has(r7.source) && actorIds.has(r7.target)) {
|
|
8368
|
+
union(r7.source, r7.target);
|
|
8369
8369
|
}
|
|
8370
8370
|
}
|
|
8371
8371
|
const baseSide = (a, i) => a.side === "left" ? "left" : a.side === "right" ? "right" : i === 0 ? "left" : "right";
|
|
@@ -8400,10 +8400,10 @@ function layoutUsecase(ast) {
|
|
|
8400
8400
|
const sides = classifyActorSides(ast);
|
|
8401
8401
|
const connectedActors = /* @__PURE__ */ new Map();
|
|
8402
8402
|
for (const u of ast.usecases) connectedActors.set(u.id, []);
|
|
8403
|
-
for (const
|
|
8404
|
-
if (
|
|
8405
|
-
const aId = actorById.has(
|
|
8406
|
-
const uId = ucIds.has(
|
|
8403
|
+
for (const r7 of ast.relations) {
|
|
8404
|
+
if (r7.kind !== "association" && r7.kind !== "directed") continue;
|
|
8405
|
+
const aId = actorById.has(r7.source) ? r7.source : actorById.has(r7.target) ? r7.target : null;
|
|
8406
|
+
const uId = ucIds.has(r7.source) ? r7.source : ucIds.has(r7.target) ? r7.target : null;
|
|
8407
8407
|
if (aId && uId) connectedActors.get(uId).push(aId);
|
|
8408
8408
|
}
|
|
8409
8409
|
const columns = [];
|
|
@@ -8442,10 +8442,10 @@ function layoutUsecase(ast) {
|
|
|
8442
8442
|
});
|
|
8443
8443
|
let prev = -Infinity;
|
|
8444
8444
|
for (const u of col) {
|
|
8445
|
-
let
|
|
8446
|
-
if (
|
|
8447
|
-
rowPos.set(u.id,
|
|
8448
|
-
prev =
|
|
8445
|
+
let r7 = rowPos.get(u.id);
|
|
8446
|
+
if (r7 <= prev) r7 = prev + 1;
|
|
8447
|
+
rowPos.set(u.id, r7);
|
|
8448
|
+
prev = r7;
|
|
8449
8449
|
}
|
|
8450
8450
|
}
|
|
8451
8451
|
const colMaxRx = columns.map(
|
|
@@ -8591,10 +8591,10 @@ function layoutUsecase(ast) {
|
|
|
8591
8591
|
const edges = [];
|
|
8592
8592
|
const trees = [];
|
|
8593
8593
|
const genByParent = /* @__PURE__ */ new Map();
|
|
8594
|
-
for (const
|
|
8595
|
-
if (
|
|
8596
|
-
if (!genByParent.has(
|
|
8597
|
-
genByParent.get(
|
|
8594
|
+
for (const r7 of ast.relations) {
|
|
8595
|
+
if (r7.kind !== "generalization") continue;
|
|
8596
|
+
if (!genByParent.has(r7.target)) genByParent.set(r7.target, []);
|
|
8597
|
+
genByParent.get(r7.target).push(r7);
|
|
8598
8598
|
}
|
|
8599
8599
|
const handledGen = /* @__PURE__ */ new Set();
|
|
8600
8600
|
function nodeCenter(id) {
|
|
@@ -8628,11 +8628,11 @@ function layoutUsecase(ast) {
|
|
|
8628
8628
|
}
|
|
8629
8629
|
for (const [parentId, rels] of genByParent) {
|
|
8630
8630
|
const useTree = ast.generalizationTree && rels.length >= C2.GEN_TREE_THRESHOLD;
|
|
8631
|
-
const allActors = actorById2.has(parentId) && rels.every((
|
|
8631
|
+
const allActors = actorById2.has(parentId) && rels.every((r7) => actorById2.has(r7.source));
|
|
8632
8632
|
if (allActors) {
|
|
8633
8633
|
const side = sides.get(parentId) ?? "left";
|
|
8634
8634
|
const pAnchor = actorGenAnchor(parentId, side);
|
|
8635
|
-
const childAnchors = rels.map((
|
|
8635
|
+
const childAnchors = rels.map((r7) => ({ r: r7, p: actorGenAnchor(r7.source, side) }));
|
|
8636
8636
|
const xs = [pAnchor.x, ...childAnchors.map((c) => c.p.x)];
|
|
8637
8637
|
const ys = [pAnchor.y, ...childAnchors.map((c) => c.p.y)];
|
|
8638
8638
|
const busX = side === "left" ? Math.min(...xs) - 20 : Math.max(...xs) + 20;
|
|
@@ -8648,7 +8648,7 @@ function layoutUsecase(ast) {
|
|
|
8648
8648
|
}
|
|
8649
8649
|
trees.push({
|
|
8650
8650
|
parentId,
|
|
8651
|
-
childIds: rels.map((
|
|
8651
|
+
childIds: rels.map((r7) => r7.source),
|
|
8652
8652
|
stemX: busX,
|
|
8653
8653
|
stemTop: minY2,
|
|
8654
8654
|
stemBottom: maxY2,
|
|
@@ -8671,7 +8671,7 @@ function layoutUsecase(ast) {
|
|
|
8671
8671
|
if (!useTree) continue;
|
|
8672
8672
|
const parent = nodeCenter(parentId);
|
|
8673
8673
|
if (!parent) continue;
|
|
8674
|
-
const childCenters = rels.map((
|
|
8674
|
+
const childCenters = rels.map((r7) => nodeCenter(r7.source)).filter((c) => c !== null);
|
|
8675
8675
|
if (childCenters.length === 0) continue;
|
|
8676
8676
|
const avgX = childCenters.reduce((s, c) => s + c.cx, 0) / childCenters.length;
|
|
8677
8677
|
const avgY = childCenters.reduce((s, c) => s + c.cy, 0) / childCenters.length;
|
|
@@ -8682,14 +8682,14 @@ function layoutUsecase(ast) {
|
|
|
8682
8682
|
const jx = pPt.x + dirX / len * C2.GEN_JUNCTION_OFFSET;
|
|
8683
8683
|
const jy = pPt.y + dirY / len * C2.GEN_JUNCTION_OFFSET;
|
|
8684
8684
|
const legPaths = [];
|
|
8685
|
-
for (const
|
|
8686
|
-
const cPt = perimeter(
|
|
8685
|
+
for (const r7 of rels) {
|
|
8686
|
+
const cPt = perimeter(r7.source, jx, jy);
|
|
8687
8687
|
legPaths.push(`M ${round3(cPt.x)} ${round3(cPt.y)} L ${round3(jx)} ${round3(jy)}`);
|
|
8688
|
-
handledGen.add(
|
|
8688
|
+
handledGen.add(r7);
|
|
8689
8689
|
}
|
|
8690
8690
|
trees.push({
|
|
8691
8691
|
parentId,
|
|
8692
|
-
childIds: rels.map((
|
|
8692
|
+
childIds: rels.map((r7) => r7.source),
|
|
8693
8693
|
stemX: jx,
|
|
8694
8694
|
stemTop: jy,
|
|
8695
8695
|
stemBottom: jy,
|
|
@@ -8697,72 +8697,72 @@ function layoutUsecase(ast) {
|
|
|
8697
8697
|
legPaths
|
|
8698
8698
|
});
|
|
8699
8699
|
}
|
|
8700
|
-
for (const
|
|
8701
|
-
if (handledGen.has(
|
|
8702
|
-
const a = nodeCenter(
|
|
8703
|
-
const b = nodeCenter(
|
|
8700
|
+
for (const r7 of ast.relations) {
|
|
8701
|
+
if (handledGen.has(r7)) continue;
|
|
8702
|
+
const a = nodeCenter(r7.source);
|
|
8703
|
+
const b = nodeCenter(r7.target);
|
|
8704
8704
|
if (!a || !b) continue;
|
|
8705
|
-
if (
|
|
8706
|
-
const side = sides.get(
|
|
8707
|
-
const pAnchor = actorGenAnchor(
|
|
8708
|
-
const cAnchor = actorGenAnchor(
|
|
8705
|
+
if (r7.kind === "generalization" && actorById2.has(r7.source) && actorById2.has(r7.target)) {
|
|
8706
|
+
const side = sides.get(r7.target) ?? "left";
|
|
8707
|
+
const pAnchor = actorGenAnchor(r7.target, side);
|
|
8708
|
+
const cAnchor = actorGenAnchor(r7.source, side);
|
|
8709
8709
|
const busX = side === "left" ? Math.min(pAnchor.x, cAnchor.x) - 20 : Math.max(pAnchor.x, cAnchor.x) + 20;
|
|
8710
8710
|
edges.push({
|
|
8711
|
-
relation:
|
|
8711
|
+
relation: r7,
|
|
8712
8712
|
d: `M ${round3(cAnchor.x)} ${round3(cAnchor.y)} L ${round3(busX)} ${round3(cAnchor.y)} L ${round3(busX)} ${round3(pAnchor.y)} L ${round3(pAnchor.x)} ${round3(pAnchor.y)}`,
|
|
8713
8713
|
arrowKind: "hollow",
|
|
8714
8714
|
dashed: false
|
|
8715
8715
|
});
|
|
8716
8716
|
continue;
|
|
8717
8717
|
}
|
|
8718
|
-
const srcActor = actorById2.get(
|
|
8719
|
-
const tgtActor = actorById2.get(
|
|
8718
|
+
const srcActor = actorById2.get(r7.source);
|
|
8719
|
+
const tgtActor = actorById2.get(r7.target);
|
|
8720
8720
|
let pa;
|
|
8721
8721
|
let pb;
|
|
8722
8722
|
if (srcActor && !tgtActor) {
|
|
8723
8723
|
pa = { x: srcActor.anchorX, y: srcActor.anchorY };
|
|
8724
|
-
pb = perimeter(
|
|
8724
|
+
pb = perimeter(r7.target, pa.x, pa.y);
|
|
8725
8725
|
} else if (tgtActor && !srcActor) {
|
|
8726
8726
|
pb = { x: tgtActor.anchorX, y: tgtActor.anchorY };
|
|
8727
|
-
pa = perimeter(
|
|
8727
|
+
pa = perimeter(r7.source, pb.x, pb.y);
|
|
8728
8728
|
} else {
|
|
8729
|
-
pa = perimeter(
|
|
8730
|
-
pb = perimeter(
|
|
8729
|
+
pa = perimeter(r7.source, b.cx, b.cy);
|
|
8730
|
+
pb = perimeter(r7.target, a.cx, a.cy);
|
|
8731
8731
|
}
|
|
8732
|
-
const dashed =
|
|
8732
|
+
const dashed = r7.kind === "include" || r7.kind === "extend";
|
|
8733
8733
|
let arrowKind2 = "none";
|
|
8734
|
-
if (
|
|
8735
|
-
else if (
|
|
8734
|
+
if (r7.kind === "directed" || r7.kind === "include" || r7.kind === "extend") arrowKind2 = "open";
|
|
8735
|
+
else if (r7.kind === "generalization") arrowKind2 = "hollow";
|
|
8736
8736
|
const edge = {
|
|
8737
|
-
relation:
|
|
8737
|
+
relation: r7,
|
|
8738
8738
|
d: `M ${round3(pa.x)} ${round3(pa.y)} L ${round3(pb.x)} ${round3(pb.y)}`,
|
|
8739
8739
|
arrowKind: arrowKind2,
|
|
8740
8740
|
dashed
|
|
8741
8741
|
};
|
|
8742
|
-
if (
|
|
8742
|
+
if (r7.kind === "include" || r7.kind === "extend") {
|
|
8743
8743
|
const rows = [];
|
|
8744
|
-
const keyword =
|
|
8745
|
-
rows.push(`\xAB${
|
|
8746
|
-
if (
|
|
8747
|
-
if (
|
|
8744
|
+
const keyword = r7.kind === "include" ? "include" : "extend";
|
|
8745
|
+
rows.push(`\xAB${r7.stereotype ?? keyword}\xBB`);
|
|
8746
|
+
if (r7.condition) rows.push(`[${r7.condition}]`);
|
|
8747
|
+
if (r7.extensionPointRef) rows.push(`(extension point: ${r7.extensionPointRef})`);
|
|
8748
8748
|
const label = {
|
|
8749
8749
|
rows,
|
|
8750
8750
|
cx: (pa.x + pb.x) / 2,
|
|
8751
8751
|
cy: (pa.y + pb.y) / 2
|
|
8752
8752
|
};
|
|
8753
8753
|
edge.label = label;
|
|
8754
|
-
} else if ((
|
|
8754
|
+
} else if ((r7.kind === "association" || r7.kind === "directed") && r7.stereotype) {
|
|
8755
8755
|
edge.label = {
|
|
8756
|
-
rows: [`\xAB${
|
|
8756
|
+
rows: [`\xAB${r7.stereotype}\xBB`],
|
|
8757
8757
|
cx: (pa.x + pb.x) / 2,
|
|
8758
8758
|
cy: (pa.y + pb.y) / 2
|
|
8759
8759
|
};
|
|
8760
8760
|
}
|
|
8761
|
-
if (
|
|
8762
|
-
edge.multiplicityFrom = placeMultiplicity(pa, pb,
|
|
8761
|
+
if (r7.sourceMultiplicity) {
|
|
8762
|
+
edge.multiplicityFrom = placeMultiplicity(pa, pb, r7.sourceMultiplicity);
|
|
8763
8763
|
}
|
|
8764
|
-
if (
|
|
8765
|
-
edge.multiplicityTo = placeMultiplicity(pb, pa,
|
|
8764
|
+
if (r7.targetMultiplicity) {
|
|
8765
|
+
edge.multiplicityTo = placeMultiplicity(pb, pa, r7.targetMultiplicity);
|
|
8766
8766
|
}
|
|
8767
8767
|
edges.push(edge);
|
|
8768
8768
|
}
|
|
@@ -9017,7 +9017,7 @@ function renderEdgeLabel(e) {
|
|
|
9017
9017
|
const rows = e.label.rows;
|
|
9018
9018
|
const lineH = 12;
|
|
9019
9019
|
const totalH = rows.length * lineH;
|
|
9020
|
-
const widest = rows.reduce((m,
|
|
9020
|
+
const widest = rows.reduce((m, r7) => Math.max(m, r7.length), 0);
|
|
9021
9021
|
const pillW = widest * 6 + 8;
|
|
9022
9022
|
const pillH = totalH + 4;
|
|
9023
9023
|
const startY = e.label.cy - totalH / 2 + 9;
|
|
@@ -9033,7 +9033,7 @@ function renderEdgeLabel(e) {
|
|
|
9033
9033
|
ry: 4
|
|
9034
9034
|
})
|
|
9035
9035
|
];
|
|
9036
|
-
rows.forEach((
|
|
9036
|
+
rows.forEach((r7, i) => {
|
|
9037
9037
|
parts.push(
|
|
9038
9038
|
chunk3WNW5Y7P_cjs.text(
|
|
9039
9039
|
{
|
|
@@ -9042,7 +9042,7 @@ function renderEdgeLabel(e) {
|
|
|
9042
9042
|
y: startY + i * lineH,
|
|
9043
9043
|
"text-anchor": "middle"
|
|
9044
9044
|
},
|
|
9045
|
-
|
|
9045
|
+
r7
|
|
9046
9046
|
)
|
|
9047
9047
|
);
|
|
9048
9048
|
});
|
|
@@ -9082,8 +9082,8 @@ function renderTree(tr) {
|
|
|
9082
9082
|
function renderUsecaseLayout(layout, config) {
|
|
9083
9083
|
const t = chunkENUM7GMZ_cjs.resolveBaseTheme(config?.theme ?? "default");
|
|
9084
9084
|
const children = [];
|
|
9085
|
-
const nInclude = layout.ast.relations.filter((
|
|
9086
|
-
const nExtend = layout.ast.relations.filter((
|
|
9085
|
+
const nInclude = layout.ast.relations.filter((r7) => r7.kind === "include").length;
|
|
9086
|
+
const nExtend = layout.ast.relations.filter((r7) => r7.kind === "extend").length;
|
|
9087
9087
|
children.push(chunk3WNW5Y7P_cjs.title(`Use Case Diagram${layout.title ? " \u2014 " + layout.title : ""}`));
|
|
9088
9088
|
children.push(
|
|
9089
9089
|
chunk3WNW5Y7P_cjs.desc(
|
|
@@ -9831,12 +9831,12 @@ function layoutAoa(ast, schedule) {
|
|
|
9831
9831
|
const predEvents = (e) => inAdj[e].map((ai) => arcs[ai].from);
|
|
9832
9832
|
const succEvents = (e) => outAdj[e].map((ai) => arcs[ai].to);
|
|
9833
9833
|
for (let iter = 0; iter < 4; iter++) {
|
|
9834
|
-
for (let
|
|
9835
|
-
layers[
|
|
9834
|
+
for (let r7 = 1; r7 <= maxRank; r7++) {
|
|
9835
|
+
layers[r7] = sortByBary(layers[r7], predEvents, pos);
|
|
9836
9836
|
refresh(layers, pos);
|
|
9837
9837
|
}
|
|
9838
|
-
for (let
|
|
9839
|
-
layers[
|
|
9838
|
+
for (let r7 = maxRank - 1; r7 >= 0; r7--) {
|
|
9839
|
+
layers[r7] = sortByBary(layers[r7], succEvents, pos);
|
|
9840
9840
|
refresh(layers, pos);
|
|
9841
9841
|
}
|
|
9842
9842
|
}
|
|
@@ -9846,12 +9846,12 @@ function layoutAoa(ast, schedule) {
|
|
|
9846
9846
|
const contentH = (maxRows - 1) * AOA.VGAP + 2 * AOA.R;
|
|
9847
9847
|
const cx = new Array(nEvents).fill(0);
|
|
9848
9848
|
const cy = new Array(nEvents).fill(0);
|
|
9849
|
-
for (let
|
|
9850
|
-
const layer = layers[
|
|
9849
|
+
for (let r7 = 0; r7 <= maxRank; r7++) {
|
|
9850
|
+
const layer = layers[r7];
|
|
9851
9851
|
const colH = (layer.length - 1) * AOA.VGAP;
|
|
9852
9852
|
const y0 = topY + AOA.R + (contentH - 2 * AOA.R - colH) / 2;
|
|
9853
9853
|
layer.forEach((e, i) => {
|
|
9854
|
-
cx[e] = AOA.PAD + AOA.R +
|
|
9854
|
+
cx[e] = AOA.PAD + AOA.R + r7 * AOA.COL;
|
|
9855
9855
|
cy[e] = y0 + i * AOA.VGAP;
|
|
9856
9856
|
});
|
|
9857
9857
|
}
|
|
@@ -9913,16 +9913,16 @@ function sortByBary(layer, neighbors, pos) {
|
|
|
9913
9913
|
return { e, i, bary };
|
|
9914
9914
|
}).sort((a, b) => a.bary !== b.bary ? a.bary - b.bary : a.i - b.i).map((x) => x.e);
|
|
9915
9915
|
}
|
|
9916
|
-
function arcGeometry(tx, ty, hx, hy,
|
|
9916
|
+
function arcGeometry(tx, ty, hx, hy, r7) {
|
|
9917
9917
|
const dx = hx - tx;
|
|
9918
9918
|
const dy = hy - ty;
|
|
9919
9919
|
const len = Math.hypot(dx, dy) || 1;
|
|
9920
9920
|
const ux = dx / len;
|
|
9921
9921
|
const uy = dy / len;
|
|
9922
|
-
const sx = tx + ux *
|
|
9923
|
-
const sy = ty + uy *
|
|
9924
|
-
const ex = hx - ux *
|
|
9925
|
-
const ey = hy - uy *
|
|
9922
|
+
const sx = tx + ux * r7;
|
|
9923
|
+
const sy = ty + uy * r7;
|
|
9924
|
+
const ex = hx - ux * r7;
|
|
9925
|
+
const ey = hy - uy * r7;
|
|
9926
9926
|
return { d: `M ${round5(sx)} ${round5(sy)} L ${round5(ex)} ${round5(ey)}`, mx: (sx + ex) / 2, my: (sy + ey) / 2 };
|
|
9927
9927
|
}
|
|
9928
9928
|
function buildAoaSummary(ast, sched) {
|
|
@@ -9995,11 +9995,11 @@ function assignRanks(ast) {
|
|
|
9995
9995
|
if (visiting.has(id)) return 0;
|
|
9996
9996
|
visiting.add(id);
|
|
9997
9997
|
const t = byId.get(id);
|
|
9998
|
-
let
|
|
9999
|
-
for (const dep of t.deps)
|
|
9998
|
+
let r7 = 0;
|
|
9999
|
+
for (const dep of t.deps) r7 = Math.max(r7, compute(dep.pred) + 1);
|
|
10000
10000
|
visiting.delete(id);
|
|
10001
|
-
rank.set(id,
|
|
10002
|
-
return
|
|
10001
|
+
rank.set(id, r7);
|
|
10002
|
+
return r7;
|
|
10003
10003
|
};
|
|
10004
10004
|
let maxRank = 0;
|
|
10005
10005
|
for (const t of ast.tasks) maxRank = Math.max(maxRank, compute(t.id));
|
|
@@ -10045,15 +10045,15 @@ function orderLayers(ast, schedule, rank, maxRank) {
|
|
|
10045
10045
|
return s / neighbors.length;
|
|
10046
10046
|
};
|
|
10047
10047
|
for (let iter = 0; iter < 4; iter++) {
|
|
10048
|
-
for (let
|
|
10049
|
-
layers[
|
|
10048
|
+
for (let r7 = 1; r7 <= maxRank; r7++) {
|
|
10049
|
+
layers[r7] = stableSortByKey(layers[r7], (id) => {
|
|
10050
10050
|
const bc = barycenter(id, pred.get(id));
|
|
10051
10051
|
return crit(id) ? bc - 0.4 : bc;
|
|
10052
10052
|
});
|
|
10053
10053
|
refreshPos();
|
|
10054
10054
|
}
|
|
10055
|
-
for (let
|
|
10056
|
-
layers[
|
|
10055
|
+
for (let r7 = maxRank - 1; r7 >= 0; r7--) {
|
|
10056
|
+
layers[r7] = stableSortByKey(layers[r7], (id) => {
|
|
10057
10057
|
const bc = barycenter(id, succ.get(id));
|
|
10058
10058
|
return crit(id) ? bc - 0.4 : bc;
|
|
10059
10059
|
});
|
|
@@ -10105,9 +10105,9 @@ function layoutNetwork(ast, schedule) {
|
|
|
10105
10105
|
const originCross = dir === "TB" ? C2.PAD : C2.PAD + titleH;
|
|
10106
10106
|
const boxes = [];
|
|
10107
10107
|
const boxById = /* @__PURE__ */ new Map();
|
|
10108
|
-
for (let
|
|
10109
|
-
const layer = layers[
|
|
10110
|
-
const extent = colExtent[
|
|
10108
|
+
for (let r7 = 0; r7 <= maxRank; r7++) {
|
|
10109
|
+
const layer = layers[r7];
|
|
10110
|
+
const extent = colExtent[r7];
|
|
10111
10111
|
const crossStart = originCross + (maxExtent - extent) / 2;
|
|
10112
10112
|
let cursor = crossStart;
|
|
10113
10113
|
for (const id of layer) {
|
|
@@ -10118,12 +10118,12 @@ function layoutNetwork(ast, schedule) {
|
|
|
10118
10118
|
let x;
|
|
10119
10119
|
let y;
|
|
10120
10120
|
if (dir === "TB") {
|
|
10121
|
-
const rankPos = originPrimary +
|
|
10121
|
+
const rankPos = originPrimary + r7 * (C2.BOX_H + C2.H_GAP);
|
|
10122
10122
|
x = cursor + (C2.BOX_W - w) / 2;
|
|
10123
10123
|
y = rankPos;
|
|
10124
10124
|
cursor += C2.BOX_W + C2.H_GAP;
|
|
10125
10125
|
} else {
|
|
10126
|
-
const rankPos = originPrimary +
|
|
10126
|
+
const rankPos = originPrimary + r7 * (C2.BOX_W + C2.H_GAP);
|
|
10127
10127
|
x = rankPos + (C2.BOX_W - w) / 2;
|
|
10128
10128
|
y = cursor;
|
|
10129
10129
|
cursor += C2.BOX_H + C2.V_GAP;
|
|
@@ -10137,7 +10137,7 @@ function layoutNetwork(ast, schedule) {
|
|
|
10137
10137
|
width: w,
|
|
10138
10138
|
height: h,
|
|
10139
10139
|
milestone: t.milestone,
|
|
10140
|
-
rank:
|
|
10140
|
+
rank: r7
|
|
10141
10141
|
};
|
|
10142
10142
|
boxes.push(box2);
|
|
10143
10143
|
boxById.set(id, box2);
|
|
@@ -10297,7 +10297,7 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
10297
10297
|
const crit = (id) => schedule.computed.get(id).critical;
|
|
10298
10298
|
const es = (id) => schedule.computed.get(id).es;
|
|
10299
10299
|
const cell = /* @__PURE__ */ new Map();
|
|
10300
|
-
const key = (lane,
|
|
10300
|
+
const key = (lane, r7) => `${lane}\0${r7}`;
|
|
10301
10301
|
for (const t of ast.tasks) {
|
|
10302
10302
|
const k = key(laneOf.get(t.id), rank.get(t.id));
|
|
10303
10303
|
if (!cell.has(k)) cell.set(k, []);
|
|
@@ -10314,15 +10314,15 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
10314
10314
|
}
|
|
10315
10315
|
const titleH = ast.title ? C2.TITLE_H : 0;
|
|
10316
10316
|
const topY = C2.PAD + titleH;
|
|
10317
|
-
const colX = (
|
|
10317
|
+
const colX = (r7) => C2.LANE_LABEL_W + C2.PAD + r7 * (C2.BOX_W + C2.H_GAP);
|
|
10318
10318
|
const lanes = [];
|
|
10319
10319
|
const laneY = /* @__PURE__ */ new Map();
|
|
10320
10320
|
const laneH = /* @__PURE__ */ new Map();
|
|
10321
10321
|
let cursor = topY;
|
|
10322
10322
|
laneOrder.forEach((lane, i) => {
|
|
10323
10323
|
let stack = 1;
|
|
10324
|
-
for (let
|
|
10325
|
-
const arr = cell.get(key(lane,
|
|
10324
|
+
for (let r7 = 0; r7 <= maxRank; r7++) {
|
|
10325
|
+
const arr = cell.get(key(lane, r7));
|
|
10326
10326
|
if (arr) stack = Math.max(stack, arr.length);
|
|
10327
10327
|
}
|
|
10328
10328
|
const bandH = stack * C2.BOX_H + (stack - 1) * C2.V_GAP + 2 * C2.LANE_PAD;
|
|
@@ -10337,15 +10337,15 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
10337
10337
|
for (const lane of laneOrder) {
|
|
10338
10338
|
const bandTop = laneY.get(lane);
|
|
10339
10339
|
const bandH = laneH.get(lane);
|
|
10340
|
-
for (let
|
|
10341
|
-
const arr = cell.get(key(lane,
|
|
10340
|
+
for (let r7 = 0; r7 <= maxRank; r7++) {
|
|
10341
|
+
const arr = cell.get(key(lane, r7));
|
|
10342
10342
|
if (!arr) continue;
|
|
10343
10343
|
const colInnerH = arr.length * C2.BOX_H + (arr.length - 1) * C2.V_GAP;
|
|
10344
10344
|
const y0 = bandTop + (bandH - colInnerH) / 2;
|
|
10345
10345
|
arr.forEach((id, idx) => {
|
|
10346
10346
|
const t = byId.get(id);
|
|
10347
10347
|
const w = t.milestone ? C2.MS_W : C2.BOX_W;
|
|
10348
|
-
const x = colX(
|
|
10348
|
+
const x = colX(r7) + (C2.BOX_W - w) / 2;
|
|
10349
10349
|
const y = y0 + idx * (C2.BOX_H + C2.V_GAP);
|
|
10350
10350
|
const box2 = {
|
|
10351
10351
|
id,
|
|
@@ -10356,7 +10356,7 @@ function layoutSwimlane2(ast, schedule) {
|
|
|
10356
10356
|
width: w,
|
|
10357
10357
|
height: C2.BOX_H,
|
|
10358
10358
|
milestone: t.milestone,
|
|
10359
|
-
rank:
|
|
10359
|
+
rank: r7
|
|
10360
10360
|
};
|
|
10361
10361
|
boxes.push(box2);
|
|
10362
10362
|
boxById.set(id, box2);
|
|
@@ -12023,18 +12023,18 @@ function renderFragmentTab(f) {
|
|
|
12023
12023
|
});
|
|
12024
12024
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-fragment-tab-g", "data-op": f.op }, parts);
|
|
12025
12025
|
}
|
|
12026
|
-
function renderRef(
|
|
12026
|
+
function renderRef(r7) {
|
|
12027
12027
|
const tabW = 40;
|
|
12028
12028
|
const tabH = 18;
|
|
12029
12029
|
const fold = 6;
|
|
12030
|
-
const tab = `M ${
|
|
12030
|
+
const tab = `M ${r7.x} ${r7.y} H ${r7.x + tabW} V ${r7.y + tabH - fold} L ${r7.x + tabW - fold} ${r7.y + tabH} H ${r7.x} Z`;
|
|
12031
12031
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-fragment", "data-op": "ref" }, [
|
|
12032
|
-
chunk3WNW5Y7P_cjs.rect({ class: "sx-seq-frame", x:
|
|
12032
|
+
chunk3WNW5Y7P_cjs.rect({ class: "sx-seq-frame", x: r7.x, y: r7.y, width: r7.width, height: r7.height, rx: 2, ry: 2 }),
|
|
12033
12033
|
chunk3WNW5Y7P_cjs.path({ class: "sx-seq-frame-tab", d: tab }),
|
|
12034
|
-
chunk3WNW5Y7P_cjs.text({ class: "sx-seq-frame-op", x:
|
|
12034
|
+
chunk3WNW5Y7P_cjs.text({ class: "sx-seq-frame-op", x: r7.x + 8, y: r7.y + 13 }, "ref"),
|
|
12035
12035
|
chunk3WNW5Y7P_cjs.text(
|
|
12036
|
-
{ class: "sx-seq-ref-name", x:
|
|
12037
|
-
|
|
12036
|
+
{ class: "sx-seq-ref-name", x: r7.x + r7.width / 2, y: r7.y + r7.height / 2 + 8, "text-anchor": "middle" },
|
|
12037
|
+
r7.text
|
|
12038
12038
|
)
|
|
12039
12039
|
]);
|
|
12040
12040
|
}
|
|
@@ -12071,10 +12071,10 @@ function renderInvariant(iv) {
|
|
|
12071
12071
|
]);
|
|
12072
12072
|
}
|
|
12073
12073
|
function renderDestroy(d) {
|
|
12074
|
-
const
|
|
12074
|
+
const r7 = 7;
|
|
12075
12075
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-seq-destroy-g" }, [
|
|
12076
|
-
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x -
|
|
12077
|
-
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x -
|
|
12076
|
+
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r7, y1: d.y - r7, x2: d.x + r7, y2: d.y + r7 }),
|
|
12077
|
+
chunk3WNW5Y7P_cjs.line({ class: "sx-seq-destroy", x1: d.x - r7, y1: d.y + r7, x2: d.x + r7, y2: d.y - r7 })
|
|
12078
12078
|
]);
|
|
12079
12079
|
}
|
|
12080
12080
|
function renderSequenceLayout(layout, config) {
|
|
@@ -12917,10 +12917,10 @@ function renderArc2(ag) {
|
|
|
12917
12917
|
const dx = last.x - prev.x;
|
|
12918
12918
|
const dy = last.y - prev.y;
|
|
12919
12919
|
const len = Math.hypot(dx, dy) || 1;
|
|
12920
|
-
const
|
|
12921
|
-
const cx = last.x - dx / len *
|
|
12922
|
-
const cy = last.y - dy / len *
|
|
12923
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-petri-inhibitor-dot", cx, cy, r:
|
|
12920
|
+
const r7 = 4;
|
|
12921
|
+
const cx = last.x - dx / len * r7;
|
|
12922
|
+
const cy = last.y - dy / len * r7;
|
|
12923
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-petri-inhibitor-dot", cx, cy, r: r7 }));
|
|
12924
12924
|
}
|
|
12925
12925
|
if (ag.weight > 1) {
|
|
12926
12926
|
parts.push(
|
|
@@ -13318,10 +13318,10 @@ function parseNetwork(text2) {
|
|
|
13318
13318
|
if (rest[0]) ast.title = rest[0].value;
|
|
13319
13319
|
break;
|
|
13320
13320
|
case "spines":
|
|
13321
|
-
ast.spines.push(...rest.filter((
|
|
13321
|
+
ast.spines.push(...rest.filter((r7) => !r7.str).map((r7) => r7.value));
|
|
13322
13322
|
break;
|
|
13323
13323
|
case "leaves":
|
|
13324
|
-
ast.leaves.push(...rest.filter((
|
|
13324
|
+
ast.leaves.push(...rest.filter((r7) => !r7.str).map((r7) => r7.value));
|
|
13325
13325
|
break;
|
|
13326
13326
|
case "legend":
|
|
13327
13327
|
break;
|
|
@@ -13891,29 +13891,29 @@ function placeBanded(ast, ranks) {
|
|
|
13891
13891
|
const lr = ast.direction === "lr";
|
|
13892
13892
|
const byRank = /* @__PURE__ */ new Map();
|
|
13893
13893
|
for (const d of ast.devices) {
|
|
13894
|
-
const
|
|
13895
|
-
if (!byRank.has(
|
|
13896
|
-
byRank.get(
|
|
13894
|
+
const r7 = ranks.get(d.id) ?? 0;
|
|
13895
|
+
if (!byRank.has(r7)) byRank.set(r7, []);
|
|
13896
|
+
byRank.get(r7).push(d);
|
|
13897
13897
|
}
|
|
13898
13898
|
const rankValues = [...byRank.keys()].sort((a, b) => a - b);
|
|
13899
13899
|
const pos = /* @__PURE__ */ new Map();
|
|
13900
13900
|
let maxRowSpan = 0;
|
|
13901
13901
|
const rowSpans = /* @__PURE__ */ new Map();
|
|
13902
|
-
for (const
|
|
13903
|
-
const devs = byRank.get(
|
|
13902
|
+
for (const r7 of rankValues) {
|
|
13903
|
+
const devs = byRank.get(r7);
|
|
13904
13904
|
let span = 0;
|
|
13905
13905
|
devs.forEach((d, i) => {
|
|
13906
13906
|
const fp = deviceFootprint(d);
|
|
13907
13907
|
const cross = lr ? fp.h + labelExtra(d) : Math.max(fp.w, labelText(d).length * NET_CONST.CHAR_W + 6);
|
|
13908
13908
|
span += cross + (i > 0 ? NET_CONST.SIBLING_GAP : 0);
|
|
13909
13909
|
});
|
|
13910
|
-
rowSpans.set(
|
|
13910
|
+
rowSpans.set(r7, span);
|
|
13911
13911
|
maxRowSpan = Math.max(maxRowSpan, span);
|
|
13912
13912
|
}
|
|
13913
|
-
rankValues.forEach((
|
|
13914
|
-
const devs = byRank.get(
|
|
13913
|
+
rankValues.forEach((r7, rowIdx) => {
|
|
13914
|
+
const devs = byRank.get(r7);
|
|
13915
13915
|
const along = rowIdx * NET_CONST.TIER_BAND_GAP;
|
|
13916
|
-
let cursor = (maxRowSpan - rowSpans.get(
|
|
13916
|
+
let cursor = (maxRowSpan - rowSpans.get(r7)) / 2;
|
|
13917
13917
|
for (const d of devs) {
|
|
13918
13918
|
const fp = deviceFootprint(d);
|
|
13919
13919
|
const cross = lr ? fp.h + labelExtra(d) : Math.max(fp.w, labelText(d).length * NET_CONST.CHAR_W + 6);
|
|
@@ -13948,8 +13948,8 @@ function tieredRanks(ast, links) {
|
|
|
13948
13948
|
if (rank.has(d.id)) continue;
|
|
13949
13949
|
const known = [];
|
|
13950
13950
|
for (const n of adj.get(d.id) ?? []) {
|
|
13951
|
-
const
|
|
13952
|
-
if (
|
|
13951
|
+
const r7 = rank.get(n);
|
|
13952
|
+
if (r7 !== void 0) known.push(r7);
|
|
13953
13953
|
}
|
|
13954
13954
|
if (known.length === 0) continue;
|
|
13955
13955
|
const next = ENDPOINT_KINDS.has(d.kind) ? Math.max(...known) + 1 : Math.min(...known) + 1;
|
|
@@ -13983,10 +13983,10 @@ function treeRanks(ast, links) {
|
|
|
13983
13983
|
rank.set(root.id, 0);
|
|
13984
13984
|
while (queue.length) {
|
|
13985
13985
|
const id = queue.shift();
|
|
13986
|
-
const
|
|
13986
|
+
const r7 = rank.get(id);
|
|
13987
13987
|
for (const n of adj.get(id) ?? []) {
|
|
13988
13988
|
if (!rank.has(n)) {
|
|
13989
|
-
rank.set(n,
|
|
13989
|
+
rank.set(n, r7 + 1);
|
|
13990
13990
|
queue.push(n);
|
|
13991
13991
|
}
|
|
13992
13992
|
}
|
|
@@ -14170,11 +14170,11 @@ function layoutNetwork2(ast) {
|
|
|
14170
14170
|
};
|
|
14171
14171
|
const groupsByDepth = [...ast.groups].sort((a, b) => depthOf(b.id) - depthOf(a.id));
|
|
14172
14172
|
for (const g of groupsByDepth) {
|
|
14173
|
-
let l = Infinity, t = Infinity,
|
|
14173
|
+
let l = Infinity, t = Infinity, r7 = -Infinity, bm = -Infinity;
|
|
14174
14174
|
const addBox = (e) => {
|
|
14175
14175
|
l = Math.min(l, e.left);
|
|
14176
14176
|
t = Math.min(t, e.top);
|
|
14177
|
-
|
|
14177
|
+
r7 = Math.max(r7, e.right);
|
|
14178
14178
|
bm = Math.max(bm, e.bottom);
|
|
14179
14179
|
};
|
|
14180
14180
|
for (const mid of g.members) {
|
|
@@ -14191,7 +14191,7 @@ function layoutNetwork2(ast) {
|
|
|
14191
14191
|
groupBoxesRaw.set(g.id, {
|
|
14192
14192
|
left: l - pad,
|
|
14193
14193
|
top: t - pad - NET_CONST.GROUP_HEADER,
|
|
14194
|
-
right:
|
|
14194
|
+
right: r7 + pad,
|
|
14195
14195
|
bottom: bm + pad,
|
|
14196
14196
|
depth
|
|
14197
14197
|
});
|
|
@@ -14650,10 +14650,10 @@ function parseUmlClass(text2) {
|
|
|
14650
14650
|
}
|
|
14651
14651
|
const rels = tryParseRelationship(t, i + 1);
|
|
14652
14652
|
if (rels) {
|
|
14653
|
-
for (const
|
|
14654
|
-
ast.relationships.push(
|
|
14655
|
-
ensureClassifier(ast,
|
|
14656
|
-
ensureClassifier(ast,
|
|
14653
|
+
for (const r7 of rels) {
|
|
14654
|
+
ast.relationships.push(r7);
|
|
14655
|
+
ensureClassifier(ast, r7.from);
|
|
14656
|
+
ensureClassifier(ast, r7.to);
|
|
14657
14657
|
}
|
|
14658
14658
|
i++;
|
|
14659
14659
|
continue;
|
|
@@ -15208,11 +15208,11 @@ function findConnector(line2, glyph) {
|
|
|
15208
15208
|
}
|
|
15209
15209
|
function validateGeneralizationAcyclicity(ast) {
|
|
15210
15210
|
const adj = /* @__PURE__ */ new Map();
|
|
15211
|
-
for (const
|
|
15212
|
-
if (
|
|
15213
|
-
const list = adj.get(
|
|
15214
|
-
list.push(
|
|
15215
|
-
adj.set(
|
|
15211
|
+
for (const r7 of ast.relationships) {
|
|
15212
|
+
if (r7.kind === "generalization" || r7.kind === "realization") {
|
|
15213
|
+
const list = adj.get(r7.from) ?? [];
|
|
15214
|
+
list.push(r7.to);
|
|
15215
|
+
adj.set(r7.from, list);
|
|
15216
15216
|
}
|
|
15217
15217
|
}
|
|
15218
15218
|
const WHITE = 0, GREY = 1, BLACK = 2;
|
|
@@ -15245,12 +15245,12 @@ function validateGeneralizationAcyclicity(ast) {
|
|
|
15245
15245
|
}
|
|
15246
15246
|
}
|
|
15247
15247
|
function validateRealizationTargets(ast) {
|
|
15248
|
-
for (const
|
|
15249
|
-
if (
|
|
15250
|
-
const target = ast.classifiers.find((c) => c.id ===
|
|
15248
|
+
for (const r7 of ast.relationships) {
|
|
15249
|
+
if (r7.kind !== "realization") continue;
|
|
15250
|
+
const target = ast.classifiers.find((c) => c.id === r7.to);
|
|
15251
15251
|
if (target && target.kind !== "interface") {
|
|
15252
15252
|
ast.warnings.push(
|
|
15253
|
-
`Realization target "${
|
|
15253
|
+
`Realization target "${r7.to}" is not an \xABinterface\xBB \u2014 consider marking it so.`
|
|
15254
15254
|
);
|
|
15255
15255
|
}
|
|
15256
15256
|
}
|
|
@@ -15728,16 +15728,16 @@ function memberLineText(m) {
|
|
|
15728
15728
|
const props = m.properties && m.properties.length > 0 ? ` {${m.properties.join(", ")}}` : "";
|
|
15729
15729
|
return `${v}${m.name}(${params})${ret}${props}`;
|
|
15730
15730
|
}
|
|
15731
|
-
function rankEnds(
|
|
15732
|
-
switch (
|
|
15731
|
+
function rankEnds(r7) {
|
|
15732
|
+
switch (r7.kind) {
|
|
15733
15733
|
case "generalization":
|
|
15734
15734
|
case "realization":
|
|
15735
|
-
return { parent:
|
|
15735
|
+
return { parent: r7.to, child: r7.from };
|
|
15736
15736
|
case "composition":
|
|
15737
15737
|
case "aggregation":
|
|
15738
15738
|
case "directed":
|
|
15739
15739
|
case "dependency":
|
|
15740
|
-
return { parent:
|
|
15740
|
+
return { parent: r7.from, child: r7.to };
|
|
15741
15741
|
case "association":
|
|
15742
15742
|
return null;
|
|
15743
15743
|
}
|
|
@@ -15745,8 +15745,8 @@ function rankEnds(r6) {
|
|
|
15745
15745
|
function computeRanks(ast, boxes) {
|
|
15746
15746
|
const parentsOf = /* @__PURE__ */ new Map();
|
|
15747
15747
|
for (const b of boxes) parentsOf.set(b.classifier.id, /* @__PURE__ */ new Set());
|
|
15748
|
-
for (const
|
|
15749
|
-
const ends = rankEnds(
|
|
15748
|
+
for (const r7 of ast.relationships) {
|
|
15749
|
+
const ends = rankEnds(r7);
|
|
15750
15750
|
if (ends) parentsOf.get(ends.child)?.add(ends.parent);
|
|
15751
15751
|
}
|
|
15752
15752
|
const rank = /* @__PURE__ */ new Map();
|
|
@@ -15788,19 +15788,19 @@ function buildLayeredGraph(rels, boxes, rankByID) {
|
|
|
15788
15788
|
byID.set(n.id, n);
|
|
15789
15789
|
}
|
|
15790
15790
|
const chains = [];
|
|
15791
|
-
for (const
|
|
15792
|
-
const a = byID.get(
|
|
15793
|
-
const b = byID.get(
|
|
15791
|
+
for (const r7 of rels) {
|
|
15792
|
+
const a = byID.get(r7.from);
|
|
15793
|
+
const b = byID.get(r7.to);
|
|
15794
15794
|
if (!a || !b) continue;
|
|
15795
15795
|
if (a.rank === b.rank) {
|
|
15796
|
-
chains.push({ rel:
|
|
15796
|
+
chains.push({ rel: r7, chain: [a.id, b.id], sameRank: true });
|
|
15797
15797
|
continue;
|
|
15798
15798
|
}
|
|
15799
15799
|
const lo = a.rank < b.rank ? a : b;
|
|
15800
15800
|
const hi = a.rank < b.rank ? b : a;
|
|
15801
15801
|
const diff = hi.rank - lo.rank;
|
|
15802
15802
|
if (diff === 1) {
|
|
15803
|
-
chains.push({ rel:
|
|
15803
|
+
chains.push({ rel: r7, chain: [r7.from, r7.to], sameRank: false });
|
|
15804
15804
|
continue;
|
|
15805
15805
|
}
|
|
15806
15806
|
const innerDummies = [];
|
|
@@ -15821,7 +15821,7 @@ function buildLayeredGraph(rels, boxes, rankByID) {
|
|
|
15821
15821
|
}
|
|
15822
15822
|
const lowToHigh = [lo.id, ...innerDummies, hi.id];
|
|
15823
15823
|
const chain = a.rank < b.rank ? lowToHigh : [...lowToHigh].reverse();
|
|
15824
|
-
chains.push({ rel:
|
|
15824
|
+
chains.push({ rel: r7, chain, sameRank: false });
|
|
15825
15825
|
}
|
|
15826
15826
|
return { nodes, chains };
|
|
15827
15827
|
}
|
|
@@ -15861,12 +15861,12 @@ function orderRanks(ranks, chains) {
|
|
|
15861
15861
|
for (let iter = 0; iter < UMLCLASS_CONST.ORDER_ITERATIONS; iter++) {
|
|
15862
15862
|
const downward = iter % 2 === 0;
|
|
15863
15863
|
if (downward) {
|
|
15864
|
-
for (let
|
|
15865
|
-
applyBarycenter(ranks[
|
|
15864
|
+
for (let r7 = 1; r7 < ranks.length; r7++) {
|
|
15865
|
+
applyBarycenter(ranks[r7], ranks[r7 - 1], up);
|
|
15866
15866
|
}
|
|
15867
15867
|
} else {
|
|
15868
|
-
for (let
|
|
15869
|
-
applyBarycenter(ranks[
|
|
15868
|
+
for (let r7 = ranks.length - 2; r7 >= 0; r7--) {
|
|
15869
|
+
applyBarycenter(ranks[r7], ranks[r7 + 1], down);
|
|
15870
15870
|
}
|
|
15871
15871
|
}
|
|
15872
15872
|
}
|
|
@@ -16005,22 +16005,22 @@ function routeEdges(chains, nodes, boxByID, vertical) {
|
|
|
16005
16005
|
const handled = /* @__PURE__ */ new Set();
|
|
16006
16006
|
const groups = /* @__PURE__ */ new Map();
|
|
16007
16007
|
for (const c of chains) {
|
|
16008
|
-
const
|
|
16009
|
-
if (
|
|
16010
|
-
const k = `${
|
|
16011
|
-
if (!groups.has(k)) groups.set(k, { kind:
|
|
16012
|
-
groups.get(k).rels.push(
|
|
16008
|
+
const r7 = c.rel;
|
|
16009
|
+
if (r7.kind !== "generalization" && r7.kind !== "realization") continue;
|
|
16010
|
+
const k = `${r7.kind}::${r7.to}`;
|
|
16011
|
+
if (!groups.has(k)) groups.set(k, { kind: r7.kind, parentId: r7.to, rels: [] });
|
|
16012
|
+
groups.get(k).rels.push(r7);
|
|
16013
16013
|
}
|
|
16014
16014
|
for (const [, group2] of groups) {
|
|
16015
16015
|
if (group2.rels.length < UMLCLASS_CONST.TREE_MERGE_THRESHOLD) continue;
|
|
16016
16016
|
const parent = boxByID.get(group2.parentId);
|
|
16017
16017
|
if (!parent) continue;
|
|
16018
|
-
const children = group2.rels.map((
|
|
16018
|
+
const children = group2.rels.map((r7) => ({ r: r7, box: boxByID.get(r7.from) })).filter((c) => !!c.box);
|
|
16019
16019
|
if (children.length < UMLCLASS_CONST.TREE_MERGE_THRESHOLD) continue;
|
|
16020
16020
|
const tree = buildTree2(group2.kind, parent, children, vertical);
|
|
16021
16021
|
if (tree) {
|
|
16022
16022
|
trees.push(tree);
|
|
16023
|
-
for (const
|
|
16023
|
+
for (const r7 of group2.rels) handled.add(r7);
|
|
16024
16024
|
}
|
|
16025
16025
|
}
|
|
16026
16026
|
const liftLanes = /* @__PURE__ */ new Map();
|
|
@@ -16473,8 +16473,8 @@ function escapeXmlText(s) {
|
|
|
16473
16473
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
16474
16474
|
}
|
|
16475
16475
|
function renderEdge4(e) {
|
|
16476
|
-
const
|
|
16477
|
-
const dashed =
|
|
16476
|
+
const r7 = e.rel;
|
|
16477
|
+
const dashed = r7.kind === "realization" || r7.kind === "dependency";
|
|
16478
16478
|
const parts = [];
|
|
16479
16479
|
parts.push(
|
|
16480
16480
|
chunk3WNW5Y7P_cjs.path({
|
|
@@ -16483,15 +16483,15 @@ function renderEdge4(e) {
|
|
|
16483
16483
|
"data-dashed": dashed ? "true" : void 0
|
|
16484
16484
|
})
|
|
16485
16485
|
);
|
|
16486
|
-
parts.push(renderTargetAdornment(
|
|
16487
|
-
if (
|
|
16488
|
-
parts.push(renderSourceDiamond(
|
|
16489
|
-
}
|
|
16490
|
-
if (
|
|
16491
|
-
if (
|
|
16492
|
-
if (
|
|
16493
|
-
if (
|
|
16494
|
-
if (
|
|
16486
|
+
parts.push(renderTargetAdornment(r7.kind, e.targetEnd));
|
|
16487
|
+
if (r7.kind === "composition" || r7.kind === "aggregation") {
|
|
16488
|
+
parts.push(renderSourceDiamond(r7.kind, e.sourceEnd));
|
|
16489
|
+
}
|
|
16490
|
+
if (r7.sourceMult) parts.push(renderEndLabel(e.sourceEnd, r7.sourceMult, false));
|
|
16491
|
+
if (r7.targetMult) parts.push(renderEndLabel(e.targetEnd, r7.targetMult, false));
|
|
16492
|
+
if (r7.sourceRole) parts.push(renderEndLabel(e.sourceEnd, r7.sourceRole, true));
|
|
16493
|
+
if (r7.targetRole) parts.push(renderEndLabel(e.targetEnd, r7.targetRole, true));
|
|
16494
|
+
if (r7.label && e.labelAnchor) {
|
|
16495
16495
|
parts.push(
|
|
16496
16496
|
chunk3WNW5Y7P_cjs.text(
|
|
16497
16497
|
{
|
|
@@ -16500,7 +16500,7 @@ function renderEdge4(e) {
|
|
|
16500
16500
|
class: "sx-umlclass-edge-name sx-umlclass-edge-name-halo",
|
|
16501
16501
|
"text-anchor": "middle"
|
|
16502
16502
|
},
|
|
16503
|
-
|
|
16503
|
+
r7.label
|
|
16504
16504
|
)
|
|
16505
16505
|
);
|
|
16506
16506
|
parts.push(
|
|
@@ -16511,19 +16511,19 @@ function renderEdge4(e) {
|
|
|
16511
16511
|
class: "sx-umlclass-edge-name",
|
|
16512
16512
|
"text-anchor": "middle"
|
|
16513
16513
|
},
|
|
16514
|
-
|
|
16514
|
+
r7.label
|
|
16515
16515
|
)
|
|
16516
16516
|
);
|
|
16517
16517
|
}
|
|
16518
16518
|
return chunk3WNW5Y7P_cjs.group(
|
|
16519
16519
|
{
|
|
16520
16520
|
class: "sx-umlclass-rel",
|
|
16521
|
-
"data-from":
|
|
16522
|
-
"data-to":
|
|
16523
|
-
"data-kind":
|
|
16524
|
-
"data-source-mult":
|
|
16525
|
-
"data-target-mult":
|
|
16526
|
-
"data-name":
|
|
16521
|
+
"data-from": r7.from,
|
|
16522
|
+
"data-to": r7.to,
|
|
16523
|
+
"data-kind": r7.kind,
|
|
16524
|
+
"data-source-mult": r7.sourceMult,
|
|
16525
|
+
"data-target-mult": r7.targetMult,
|
|
16526
|
+
"data-name": r7.label
|
|
16527
16527
|
},
|
|
16528
16528
|
parts
|
|
16529
16529
|
);
|
|
@@ -16678,8 +16678,8 @@ function summariseDiagram(ast, treeCount) {
|
|
|
16678
16678
|
byKind[k] = (byKind[k] ?? 0) + 1;
|
|
16679
16679
|
}
|
|
16680
16680
|
const relsByKind = {};
|
|
16681
|
-
for (const
|
|
16682
|
-
relsByKind[
|
|
16681
|
+
for (const r7 of ast.relationships) {
|
|
16682
|
+
relsByKind[r7.kind] = (relsByKind[r7.kind] ?? 0) + 1;
|
|
16683
16683
|
}
|
|
16684
16684
|
const classifierStr = Object.entries(byKind).map(([k, n]) => `${n} ${k}`).join(", ");
|
|
16685
16685
|
const relStr = Object.entries(relsByKind).map(([k, n]) => `${n} ${k}`).join(", ");
|
|
@@ -16911,9 +16911,9 @@ function validate(ast) {
|
|
|
16911
16911
|
if (!e.gate) continue;
|
|
16912
16912
|
const refs = [...e.gate.inputs];
|
|
16913
16913
|
if (e.gate.condition && isId(e.gate.condition)) refs.push(e.gate.condition);
|
|
16914
|
-
for (const
|
|
16915
|
-
if (!byId.has(
|
|
16916
|
-
throw new FaultTreeParseError(`gate ${e.id} references undefined event '${
|
|
16914
|
+
for (const r7 of refs) {
|
|
16915
|
+
if (!byId.has(r7)) {
|
|
16916
|
+
throw new FaultTreeParseError(`gate ${e.id} references undefined event '${r7}'`);
|
|
16917
16917
|
}
|
|
16918
16918
|
}
|
|
16919
16919
|
if (e.gate.kind === "voting") {
|
|
@@ -16985,9 +16985,9 @@ function parseProb(s, lineNo) {
|
|
|
16985
16985
|
return n;
|
|
16986
16986
|
}
|
|
16987
16987
|
function splitRefs(s, lineNo) {
|
|
16988
|
-
const refs = s.split(",").map((
|
|
16989
|
-
for (const
|
|
16990
|
-
if (!isId(
|
|
16988
|
+
const refs = s.split(",").map((r7) => r7.trim()).filter(Boolean);
|
|
16989
|
+
for (const r7 of refs) {
|
|
16990
|
+
if (!isId(r7)) throw new FaultTreeParseError(`invalid event reference "${r7}"`, lineNo);
|
|
16991
16991
|
}
|
|
16992
16992
|
if (refs.length === 0) throw new FaultTreeParseError(`empty input list`, lineNo);
|
|
16993
16993
|
return refs;
|
|
@@ -17705,10 +17705,10 @@ function renderEvent(e, showProb) {
|
|
|
17705
17705
|
parts.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: cy + 3, class: "sx-ft-id", "text-anchor": "middle" }, e.event.id));
|
|
17706
17706
|
parts.push(...leafCaption(e, cy + FAULTTREE_CONST.BASIC_R, label, showProb));
|
|
17707
17707
|
} else if (e.role === "undeveloped") {
|
|
17708
|
-
const
|
|
17709
|
-
parts.push(chunk3WNW5Y7P_cjs.path({ d: `M ${e.cx} ${cy -
|
|
17708
|
+
const r7 = FAULTTREE_CONST.DIAMOND_W / 2;
|
|
17709
|
+
parts.push(chunk3WNW5Y7P_cjs.path({ d: `M ${e.cx} ${cy - r7} L ${e.cx + r7} ${cy} L ${e.cx} ${cy + r7} L ${e.cx - r7} ${cy} Z`, class: "sx-ft-undeveloped" }));
|
|
17710
17710
|
parts.push(chunk3WNW5Y7P_cjs.text({ x: e.cx, y: cy + 3, class: "sx-ft-id", "text-anchor": "middle" }, e.event.id));
|
|
17711
|
-
parts.push(...leafCaption(e, cy +
|
|
17711
|
+
parts.push(...leafCaption(e, cy + r7, label, showProb));
|
|
17712
17712
|
} else if (e.role === "house") {
|
|
17713
17713
|
const w = FAULTTREE_CONST.HOUSE_W, h = FAULTTREE_CONST.HOUSE_H, roofH = h * 0.34;
|
|
17714
17714
|
const top = cy - h / 2, bottom = cy + h / 2, L = e.cx - w / 2, R = e.cx + w / 2;
|
|
@@ -19530,7 +19530,7 @@ function analyseFmea(ast) {
|
|
|
19530
19530
|
}
|
|
19531
19531
|
for (const act of ast.actions) {
|
|
19532
19532
|
const target = flat.find(
|
|
19533
|
-
(
|
|
19533
|
+
(r7) => r7.mode === act.mode && (act.cause === void 0 || r7.cause === act.cause)
|
|
19534
19534
|
);
|
|
19535
19535
|
if (!target) {
|
|
19536
19536
|
notes.push(`Action references unknown mode/cause "${act.mode}"${act.cause ? ` / "${act.cause}"` : ""}.`);
|
|
@@ -19553,41 +19553,41 @@ function analyseFmea(ast) {
|
|
|
19553
19553
|
rpnDelta: rpn(target.sev, target.occ, target.det) - afterRpn
|
|
19554
19554
|
};
|
|
19555
19555
|
}
|
|
19556
|
-
const rows = flat.map((
|
|
19557
|
-
const r0 = rpn(
|
|
19558
|
-
const ap = actionPriority(
|
|
19556
|
+
const rows = flat.map((r7) => {
|
|
19557
|
+
const r0 = rpn(r7.sev, r7.occ, r7.det);
|
|
19558
|
+
const ap = actionPriority(r7.sev, r7.occ, r7.det);
|
|
19559
19559
|
const flagged = ast.flag ? meetsThreshold(ast.flag, r0, ap) : false;
|
|
19560
19560
|
return {
|
|
19561
19561
|
index: 0,
|
|
19562
|
-
item:
|
|
19563
|
-
fn:
|
|
19564
|
-
mode:
|
|
19565
|
-
effect:
|
|
19566
|
-
effects:
|
|
19567
|
-
sev:
|
|
19568
|
-
cause:
|
|
19569
|
-
occ:
|
|
19570
|
-
det:
|
|
19571
|
-
controls:
|
|
19562
|
+
item: r7.item,
|
|
19563
|
+
fn: r7.fn,
|
|
19564
|
+
mode: r7.mode,
|
|
19565
|
+
effect: r7.effect,
|
|
19566
|
+
effects: r7.effects,
|
|
19567
|
+
sev: r7.sev,
|
|
19568
|
+
cause: r7.cause,
|
|
19569
|
+
occ: r7.occ,
|
|
19570
|
+
det: r7.det,
|
|
19571
|
+
controls: r7.controls,
|
|
19572
19572
|
rpn: r0,
|
|
19573
19573
|
ap,
|
|
19574
19574
|
flagged,
|
|
19575
|
-
action:
|
|
19575
|
+
action: r7.action,
|
|
19576
19576
|
itemFirst: false,
|
|
19577
19577
|
itemSpan: 1,
|
|
19578
19578
|
modeFirst: false,
|
|
19579
19579
|
modeSpan: 1
|
|
19580
19580
|
};
|
|
19581
19581
|
});
|
|
19582
|
-
const orig = new Map(rows.map((
|
|
19582
|
+
const orig = new Map(rows.map((r7, i) => [r7, i]));
|
|
19583
19583
|
rows.sort((a, b) => compareRows(a, b, ast.rank, orig));
|
|
19584
|
-
rows.forEach((
|
|
19585
|
-
|
|
19584
|
+
rows.forEach((r7, i) => {
|
|
19585
|
+
r7.index = i + 1;
|
|
19586
19586
|
});
|
|
19587
19587
|
computeSpans(rows);
|
|
19588
|
-
const flaggedCount = rows.filter((
|
|
19589
|
-
const maxRpn = rows.reduce((m,
|
|
19590
|
-
const hasActions = rows.some((
|
|
19588
|
+
const flaggedCount = rows.filter((r7) => r7.flagged).length;
|
|
19589
|
+
const maxRpn = rows.reduce((m, r7) => Math.max(m, r7.rpn), 0);
|
|
19590
|
+
const hasActions = rows.some((r7) => r7.action !== void 0);
|
|
19591
19591
|
return { rank: ast.rank, rows, flaggedCount, maxRpn, hasActions, notes };
|
|
19592
19592
|
}
|
|
19593
19593
|
function compareRows(a, b, rank, orig) {
|
|
@@ -19651,39 +19651,39 @@ var FMEA_CONST = {
|
|
|
19651
19651
|
function buildColumnSpecs(hasActions, rank) {
|
|
19652
19652
|
const C2 = FMEA_CONST;
|
|
19653
19653
|
const specs = [
|
|
19654
|
-
{ key: "no", label: "#", width: 28, align: "middle", numeric: true, field: (
|
|
19654
|
+
{ key: "no", label: "#", width: 28, align: "middle", numeric: true, field: (r7) => String(r7.index) },
|
|
19655
19655
|
{
|
|
19656
19656
|
key: "item",
|
|
19657
19657
|
label: "Item / Function",
|
|
19658
19658
|
width: 130,
|
|
19659
19659
|
align: "start",
|
|
19660
19660
|
numeric: false,
|
|
19661
|
-
field: (
|
|
19662
|
-
\u2014 ${
|
|
19661
|
+
field: (r7) => r7.fn ? `${r7.item}
|
|
19662
|
+
\u2014 ${r7.fn}` : r7.item
|
|
19663
19663
|
},
|
|
19664
|
-
{ key: "mode", label: "Failure Mode", width: 120, align: "start", numeric: false, field: (
|
|
19664
|
+
{ key: "mode", label: "Failure Mode", width: 120, align: "start", numeric: false, field: (r7) => r7.mode },
|
|
19665
19665
|
{
|
|
19666
19666
|
key: "effect",
|
|
19667
19667
|
label: "Effect(s)",
|
|
19668
19668
|
width: 120,
|
|
19669
19669
|
align: "start",
|
|
19670
19670
|
numeric: false,
|
|
19671
|
-
field: (
|
|
19671
|
+
field: (r7) => r7.effects.length > 1 ? r7.effects.join("; ") : r7.effect
|
|
19672
19672
|
},
|
|
19673
|
-
{ key: "sev", label: "S", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (
|
|
19674
|
-
{ key: "cause", label: "Cause(s)", width: 120, align: "start", numeric: false, field: (
|
|
19675
|
-
{ key: "occ", label: "O", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (
|
|
19673
|
+
{ key: "sev", label: "S", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.sev) },
|
|
19674
|
+
{ key: "cause", label: "Cause(s)", width: 120, align: "start", numeric: false, field: (r7) => r7.cause },
|
|
19675
|
+
{ key: "occ", label: "O", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.occ) },
|
|
19676
19676
|
{
|
|
19677
19677
|
key: "controls",
|
|
19678
19678
|
label: "Current Controls",
|
|
19679
19679
|
width: 120,
|
|
19680
19680
|
align: "start",
|
|
19681
19681
|
numeric: false,
|
|
19682
|
-
field: (
|
|
19682
|
+
field: (r7) => controlsText(r7)
|
|
19683
19683
|
},
|
|
19684
|
-
{ key: "det", label: "D", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (
|
|
19685
|
-
{ key: "rpn", label: "RPN", width: C2.RPN_COL_W, align: "middle", band: "before", numeric: true, field: (
|
|
19686
|
-
{ key: "ap", label: "AP", width: C2.AP_COL_W, align: "middle", band: "before", numeric: true, field: (
|
|
19684
|
+
{ key: "det", label: "D", width: C2.NUM_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.det) },
|
|
19685
|
+
{ key: "rpn", label: "RPN", width: C2.RPN_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => String(r7.rpn) },
|
|
19686
|
+
{ key: "ap", label: "AP", width: C2.AP_COL_W, align: "middle", band: "before", numeric: true, field: (r7) => r7.ap }
|
|
19687
19687
|
];
|
|
19688
19688
|
if (hasActions) {
|
|
19689
19689
|
specs.push(
|
|
@@ -19694,7 +19694,7 @@ function buildColumnSpecs(hasActions, rank) {
|
|
|
19694
19694
|
align: "start",
|
|
19695
19695
|
numeric: false,
|
|
19696
19696
|
afterOnly: true,
|
|
19697
|
-
field: (
|
|
19697
|
+
field: (r7) => actionText(r7)
|
|
19698
19698
|
},
|
|
19699
19699
|
{
|
|
19700
19700
|
key: "rsev",
|
|
@@ -19704,7 +19704,7 @@ function buildColumnSpecs(hasActions, rank) {
|
|
|
19704
19704
|
band: "after",
|
|
19705
19705
|
numeric: true,
|
|
19706
19706
|
afterOnly: true,
|
|
19707
|
-
field: (
|
|
19707
|
+
field: (r7) => r7.action ? String(r7.action.sev) : ""
|
|
19708
19708
|
},
|
|
19709
19709
|
{
|
|
19710
19710
|
key: "rocc",
|
|
@@ -19714,7 +19714,7 @@ function buildColumnSpecs(hasActions, rank) {
|
|
|
19714
19714
|
band: "after",
|
|
19715
19715
|
numeric: true,
|
|
19716
19716
|
afterOnly: true,
|
|
19717
|
-
field: (
|
|
19717
|
+
field: (r7) => r7.action ? String(r7.action.occ) : ""
|
|
19718
19718
|
},
|
|
19719
19719
|
{
|
|
19720
19720
|
key: "rdet",
|
|
@@ -19724,7 +19724,7 @@ function buildColumnSpecs(hasActions, rank) {
|
|
|
19724
19724
|
band: "after",
|
|
19725
19725
|
numeric: true,
|
|
19726
19726
|
afterOnly: true,
|
|
19727
|
-
field: (
|
|
19727
|
+
field: (r7) => r7.action ? String(r7.action.det) : ""
|
|
19728
19728
|
},
|
|
19729
19729
|
{
|
|
19730
19730
|
key: "rrpn",
|
|
@@ -19734,7 +19734,7 @@ function buildColumnSpecs(hasActions, rank) {
|
|
|
19734
19734
|
band: "after",
|
|
19735
19735
|
numeric: true,
|
|
19736
19736
|
afterOnly: true,
|
|
19737
|
-
field: (
|
|
19737
|
+
field: (r7) => r7.action ? String(r7.action.rpn) : ""
|
|
19738
19738
|
},
|
|
19739
19739
|
{
|
|
19740
19740
|
key: "rap",
|
|
@@ -19744,26 +19744,26 @@ function buildColumnSpecs(hasActions, rank) {
|
|
|
19744
19744
|
band: "after",
|
|
19745
19745
|
numeric: true,
|
|
19746
19746
|
afterOnly: true,
|
|
19747
|
-
field: (
|
|
19747
|
+
field: (r7) => r7.action ? r7.action.ap : ""
|
|
19748
19748
|
}
|
|
19749
19749
|
);
|
|
19750
19750
|
}
|
|
19751
19751
|
return specs;
|
|
19752
19752
|
}
|
|
19753
|
-
function controlsText(
|
|
19753
|
+
function controlsText(r7) {
|
|
19754
19754
|
const parts = [];
|
|
19755
|
-
if (
|
|
19756
|
-
if (
|
|
19755
|
+
if (r7.controls?.prevention) parts.push(`P: ${r7.controls.prevention}`);
|
|
19756
|
+
if (r7.controls?.detection) parts.push(`D: ${r7.controls.detection}`);
|
|
19757
19757
|
return parts.join("\n");
|
|
19758
19758
|
}
|
|
19759
|
-
function actionText(
|
|
19760
|
-
if (!
|
|
19759
|
+
function actionText(r7) {
|
|
19760
|
+
if (!r7.action) return "";
|
|
19761
19761
|
const parts = [];
|
|
19762
|
-
if (
|
|
19762
|
+
if (r7.action.recommendation) parts.push(r7.action.recommendation);
|
|
19763
19763
|
const meta = [];
|
|
19764
|
-
if (
|
|
19765
|
-
if (
|
|
19766
|
-
if (
|
|
19764
|
+
if (r7.action.owner) meta.push(r7.action.owner);
|
|
19765
|
+
if (r7.action.target) meta.push(r7.action.target);
|
|
19766
|
+
if (r7.action.status) meta.push(`[${r7.action.status}]`);
|
|
19767
19767
|
if (meta.length) parts.push(meta.join(" \xB7 "));
|
|
19768
19768
|
return parts.join("\n");
|
|
19769
19769
|
}
|
|
@@ -20237,6 +20237,658 @@ var fmea = {
|
|
|
20237
20237
|
}
|
|
20238
20238
|
};
|
|
20239
20239
|
|
|
20240
|
+
// src/diagrams/rbd/parser.ts
|
|
20241
|
+
function normalizeQuotes2(text2) {
|
|
20242
|
+
return text2.replace(/[“”„«»「」『』"]/g, '"').replace(/[‘’‚']/g, "'");
|
|
20243
|
+
}
|
|
20244
|
+
var RbdParseError = class extends Error {
|
|
20245
|
+
constructor(message) {
|
|
20246
|
+
super(message);
|
|
20247
|
+
this.name = "RbdParseError";
|
|
20248
|
+
}
|
|
20249
|
+
};
|
|
20250
|
+
var HEADER_RE = /^\s*(rbd|reliability(?:blockdiagram)?|reliability-block-diagram)\b/i;
|
|
20251
|
+
var GROUP_KW = /* @__PURE__ */ new Set(["series", "parallel", "kofn", "k-of-n", "voting"]);
|
|
20252
|
+
function parseRbd(text2) {
|
|
20253
|
+
const normalized = normalizeQuotes2(text2);
|
|
20254
|
+
const lines = normalized.split("\n");
|
|
20255
|
+
let headerIdx = -1;
|
|
20256
|
+
for (let i = 0; i < lines.length; i++) {
|
|
20257
|
+
if (lines[i].trim() === "") continue;
|
|
20258
|
+
if (!HEADER_RE.test(lines[i])) {
|
|
20259
|
+
throw new RbdParseError(
|
|
20260
|
+
`RBD must start with 'rbd' (or 'reliability'). Example: rbd "My System"`
|
|
20261
|
+
);
|
|
20262
|
+
}
|
|
20263
|
+
headerIdx = i;
|
|
20264
|
+
break;
|
|
20265
|
+
}
|
|
20266
|
+
if (headerIdx < 0) throw new RbdParseError("Empty RBD input.");
|
|
20267
|
+
const warnings = [];
|
|
20268
|
+
const metadata = {};
|
|
20269
|
+
const headerRest = lines[headerIdx].replace(HEADER_RE, "").trim();
|
|
20270
|
+
const title2 = extractQuoted(headerRest);
|
|
20271
|
+
const body = lines.slice(headerIdx + 1).join("\n");
|
|
20272
|
+
const tokens = tokenize6(stripBodyDirectives(body, metadata));
|
|
20273
|
+
const seenIds = /* @__PURE__ */ new Set();
|
|
20274
|
+
let pos = 0;
|
|
20275
|
+
const peek = () => tokens[pos];
|
|
20276
|
+
const parseBlock = () => {
|
|
20277
|
+
const idTok = tokens[pos++];
|
|
20278
|
+
if (idTok.t !== "word") throw new RbdParseError("Expected a block id.");
|
|
20279
|
+
const id = idTok.v;
|
|
20280
|
+
if (seenIds.has(id)) warnings.push(`Duplicate block id "${id}" \u2014 later definition rendered, ids should be unique.`);
|
|
20281
|
+
seenIds.add(id);
|
|
20282
|
+
let label;
|
|
20283
|
+
let R;
|
|
20284
|
+
if (peek()?.t === "string") {
|
|
20285
|
+
label = tokens[pos++].v;
|
|
20286
|
+
}
|
|
20287
|
+
while (peek()?.t === "word") {
|
|
20288
|
+
const w = peek().v;
|
|
20289
|
+
const attr = parseAttr(w);
|
|
20290
|
+
if (!attr) break;
|
|
20291
|
+
pos++;
|
|
20292
|
+
if (attr.key === "p") R = clamp01(1 - attr.value, w, warnings);
|
|
20293
|
+
else R = clamp01(attr.value, w, warnings);
|
|
20294
|
+
}
|
|
20295
|
+
return { kind: "block", id, ...label !== void 0 ? { label } : {}, ...R !== void 0 ? { R } : {} };
|
|
20296
|
+
};
|
|
20297
|
+
const parseGroup = (kwRaw) => {
|
|
20298
|
+
const kw = kwRaw.toLowerCase();
|
|
20299
|
+
let k;
|
|
20300
|
+
let n;
|
|
20301
|
+
if (kw === "kofn" || kw === "k-of-n" || kw === "voting") {
|
|
20302
|
+
const spec = peek();
|
|
20303
|
+
if (spec?.t === "word" && /^\d+\s*\/\s*\d+$/.test(spec.v)) {
|
|
20304
|
+
pos++;
|
|
20305
|
+
const [ks, ns] = spec.v.split("/");
|
|
20306
|
+
k = parseInt(ks, 10);
|
|
20307
|
+
n = parseInt(ns, 10);
|
|
20308
|
+
} else {
|
|
20309
|
+
throw new RbdParseError(`'${kwRaw}' needs a k/n threshold, e.g. 'kofn 2/3 { \u2026 }'.`);
|
|
20310
|
+
}
|
|
20311
|
+
}
|
|
20312
|
+
if (peek()?.t !== "lbrace") throw new RbdParseError(`Expected '{' after '${kwRaw}'.`);
|
|
20313
|
+
pos++;
|
|
20314
|
+
const children = parseList();
|
|
20315
|
+
if (peek()?.t !== "rbrace") throw new RbdParseError(`Unclosed '${kwRaw}' group \u2014 missing '}'.`);
|
|
20316
|
+
pos++;
|
|
20317
|
+
if (children.length === 0) warnings.push(`Empty '${kwRaw}' group ignored.`);
|
|
20318
|
+
const kind = kw === "series" ? "series" : "parallel";
|
|
20319
|
+
const isKofn = kw === "kofn" || kw === "k-of-n" || kw === "voting";
|
|
20320
|
+
if (isKofn) {
|
|
20321
|
+
const total = n ?? children.length;
|
|
20322
|
+
let thr = k ?? total;
|
|
20323
|
+
if (thr > total) {
|
|
20324
|
+
warnings.push(`k-of-n threshold k=${thr} exceeds n=${total} \u2014 clamped to ${total}.`);
|
|
20325
|
+
thr = total;
|
|
20326
|
+
}
|
|
20327
|
+
if (thr < 1) {
|
|
20328
|
+
warnings.push(`k-of-n threshold k=${thr} < 1 \u2014 clamped to 1.`);
|
|
20329
|
+
thr = 1;
|
|
20330
|
+
}
|
|
20331
|
+
return { kind: "kofn", k: thr, n: total, children };
|
|
20332
|
+
}
|
|
20333
|
+
return { kind, children };
|
|
20334
|
+
};
|
|
20335
|
+
const parseStructure = () => {
|
|
20336
|
+
const tok = peek();
|
|
20337
|
+
if (!tok) throw new RbdParseError("Unexpected end of input.");
|
|
20338
|
+
if (tok.t === "rbrace") throw new RbdParseError("Unexpected '}'.");
|
|
20339
|
+
if (tok.t === "string") throw new RbdParseError(`Unexpected quoted text "${tok.v}" \u2014 labels attach to a block.`);
|
|
20340
|
+
if (tok.t === "lbrace") throw new RbdParseError("Unexpected '{' \u2014 a group keyword (series/parallel/kofn) must precede it.");
|
|
20341
|
+
const w = tok.v;
|
|
20342
|
+
if (GROUP_KW.has(w.toLowerCase())) {
|
|
20343
|
+
pos++;
|
|
20344
|
+
return parseGroup(w);
|
|
20345
|
+
}
|
|
20346
|
+
if (w.toLowerCase() === "block") {
|
|
20347
|
+
pos++;
|
|
20348
|
+
return parseBlock();
|
|
20349
|
+
}
|
|
20350
|
+
return parseBlock();
|
|
20351
|
+
};
|
|
20352
|
+
function parseList() {
|
|
20353
|
+
const items = [];
|
|
20354
|
+
while (pos < tokens.length && peek()?.t !== "rbrace") {
|
|
20355
|
+
items.push(parseStructure());
|
|
20356
|
+
}
|
|
20357
|
+
return items;
|
|
20358
|
+
}
|
|
20359
|
+
const top = parseList();
|
|
20360
|
+
if (pos < tokens.length) throw new RbdParseError("Unbalanced '}' in RBD body.");
|
|
20361
|
+
let root;
|
|
20362
|
+
if (top.length === 0) {
|
|
20363
|
+
throw new RbdParseError("RBD has no blocks. Add at least one `block ID R=\u2026`.");
|
|
20364
|
+
} else if (top.length === 1 && top[0].kind !== "block") {
|
|
20365
|
+
root = top[0];
|
|
20366
|
+
} else {
|
|
20367
|
+
root = { kind: "series", children: top };
|
|
20368
|
+
}
|
|
20369
|
+
return {
|
|
20370
|
+
type: "rbd",
|
|
20371
|
+
...title2 ? { title: title2 } : {},
|
|
20372
|
+
root,
|
|
20373
|
+
warnings,
|
|
20374
|
+
...Object.keys(metadata).length > 0 ? { metadata } : {}
|
|
20375
|
+
};
|
|
20376
|
+
}
|
|
20377
|
+
function tokenize6(src) {
|
|
20378
|
+
const out = [];
|
|
20379
|
+
let i = 0;
|
|
20380
|
+
const n = src.length;
|
|
20381
|
+
const isQuote2 = (c) => c === '"' || c === "'";
|
|
20382
|
+
while (i < n) {
|
|
20383
|
+
const c = src[i];
|
|
20384
|
+
if (c === "#") {
|
|
20385
|
+
while (i < n && src[i] !== "\n") i++;
|
|
20386
|
+
continue;
|
|
20387
|
+
}
|
|
20388
|
+
if (/\s/.test(c)) {
|
|
20389
|
+
i++;
|
|
20390
|
+
continue;
|
|
20391
|
+
}
|
|
20392
|
+
if (c === "{") {
|
|
20393
|
+
out.push({ t: "lbrace" });
|
|
20394
|
+
i++;
|
|
20395
|
+
continue;
|
|
20396
|
+
}
|
|
20397
|
+
if (c === "}") {
|
|
20398
|
+
out.push({ t: "rbrace" });
|
|
20399
|
+
i++;
|
|
20400
|
+
continue;
|
|
20401
|
+
}
|
|
20402
|
+
if (isQuote2(c)) {
|
|
20403
|
+
const close = c;
|
|
20404
|
+
let v2 = "";
|
|
20405
|
+
i++;
|
|
20406
|
+
while (i < n && src[i] !== close) {
|
|
20407
|
+
v2 += src[i];
|
|
20408
|
+
i++;
|
|
20409
|
+
}
|
|
20410
|
+
i++;
|
|
20411
|
+
out.push({ t: "string", v: v2.trim() });
|
|
20412
|
+
continue;
|
|
20413
|
+
}
|
|
20414
|
+
let v = "";
|
|
20415
|
+
while (i < n && !/\s/.test(src[i]) && src[i] !== "{" && src[i] !== "}" && !isQuote2(src[i])) {
|
|
20416
|
+
v += src[i];
|
|
20417
|
+
i++;
|
|
20418
|
+
}
|
|
20419
|
+
out.push({ t: "word", v });
|
|
20420
|
+
}
|
|
20421
|
+
return out;
|
|
20422
|
+
}
|
|
20423
|
+
function stripBodyDirectives(body, metadata) {
|
|
20424
|
+
return body.split("\n").filter((line2) => {
|
|
20425
|
+
const m = line2.match(/^\s*(title|standard|note)\s*:\s*(.+)$/i);
|
|
20426
|
+
if (m) {
|
|
20427
|
+
const key = m[1].toLowerCase();
|
|
20428
|
+
if (key !== "title") metadata[key] = m[2].trim();
|
|
20429
|
+
else metadata.title = m[2].trim();
|
|
20430
|
+
return false;
|
|
20431
|
+
}
|
|
20432
|
+
return true;
|
|
20433
|
+
}).join("\n");
|
|
20434
|
+
}
|
|
20435
|
+
function extractQuoted(s) {
|
|
20436
|
+
const m = s.match(/^["']([^"']*)["']/);
|
|
20437
|
+
if (m) return m[1].trim();
|
|
20438
|
+
return s.length > 0 ? s.trim() : void 0;
|
|
20439
|
+
}
|
|
20440
|
+
function parseAttr(w) {
|
|
20441
|
+
const m = w.match(/^(R|r|p|prob|q)\s*[=:]\s*(.+)$/);
|
|
20442
|
+
if (m) {
|
|
20443
|
+
const key = m[1].toLowerCase();
|
|
20444
|
+
const value = parseNum(m[2]);
|
|
20445
|
+
if (value === void 0) return null;
|
|
20446
|
+
return { key: key === "p" || key === "q" ? "p" : "R", value };
|
|
20447
|
+
}
|
|
20448
|
+
const bare = parseNum(w);
|
|
20449
|
+
if (bare !== void 0) return { key: "R", value: bare };
|
|
20450
|
+
return null;
|
|
20451
|
+
}
|
|
20452
|
+
function parseNum(s) {
|
|
20453
|
+
const t = s.trim();
|
|
20454
|
+
if (/%$/.test(t)) {
|
|
20455
|
+
const v2 = parseFloat(t.slice(0, -1));
|
|
20456
|
+
return Number.isFinite(v2) ? v2 / 100 : void 0;
|
|
20457
|
+
}
|
|
20458
|
+
const v = parseFloat(t);
|
|
20459
|
+
return Number.isFinite(v) ? v : void 0;
|
|
20460
|
+
}
|
|
20461
|
+
function clamp01(v, raw, warnings) {
|
|
20462
|
+
if (v < 0) {
|
|
20463
|
+
warnings.push(`Reliability ${raw} < 0 \u2014 clamped to 0.`);
|
|
20464
|
+
return 0;
|
|
20465
|
+
}
|
|
20466
|
+
if (v > 1) {
|
|
20467
|
+
warnings.push(`Reliability ${raw} > 1 \u2014 clamped to 1.`);
|
|
20468
|
+
return 1;
|
|
20469
|
+
}
|
|
20470
|
+
return v;
|
|
20471
|
+
}
|
|
20472
|
+
|
|
20473
|
+
// src/diagrams/rbd/analysis.ts
|
|
20474
|
+
var KOFN_ENUM_CAP = 18;
|
|
20475
|
+
function analyseRbd(ast) {
|
|
20476
|
+
const notes = [];
|
|
20477
|
+
const warnings = [...ast.warnings];
|
|
20478
|
+
const blocks = [];
|
|
20479
|
+
collectBlocks(ast.root, blocks);
|
|
20480
|
+
const missing = blocks.filter((b) => b.R === void 0).map((b) => b.id);
|
|
20481
|
+
const baseEnv = new Map(blocks.map((b) => [b.id, b.R]));
|
|
20482
|
+
const systemReliability = evalStructure(ast.root, baseEnv, notes);
|
|
20483
|
+
const results = blocks.map((b) => {
|
|
20484
|
+
if (systemReliability === void 0) {
|
|
20485
|
+
return { id: b.id, ...b.R !== void 0 ? { R: b.R } : {}, isSpof: false };
|
|
20486
|
+
}
|
|
20487
|
+
const up = new Map(baseEnv);
|
|
20488
|
+
up.set(b.id, 1);
|
|
20489
|
+
const down = new Map(baseEnv);
|
|
20490
|
+
down.set(b.id, 0);
|
|
20491
|
+
const rUp = evalStructure(ast.root, up, notes);
|
|
20492
|
+
const rDown = evalStructure(ast.root, down, notes);
|
|
20493
|
+
const importance = rUp !== void 0 && rDown !== void 0 ? rUp - rDown : void 0;
|
|
20494
|
+
const isSpof = rDown === 0;
|
|
20495
|
+
return {
|
|
20496
|
+
id: b.id,
|
|
20497
|
+
...b.R !== void 0 ? { R: b.R } : {},
|
|
20498
|
+
...importance !== void 0 ? { importance } : {},
|
|
20499
|
+
isSpof
|
|
20500
|
+
};
|
|
20501
|
+
});
|
|
20502
|
+
let criticalBlock;
|
|
20503
|
+
let best = -Infinity;
|
|
20504
|
+
for (const r7 of results) {
|
|
20505
|
+
if (r7.importance !== void 0 && r7.importance > best) {
|
|
20506
|
+
best = r7.importance;
|
|
20507
|
+
criticalBlock = r7.id;
|
|
20508
|
+
}
|
|
20509
|
+
}
|
|
20510
|
+
if (systemReliability !== void 0) {
|
|
20511
|
+
const spofs = results.filter((r7) => r7.isSpof).map((r7) => r7.id);
|
|
20512
|
+
if (spofs.length === 0) notes.push("No single point of failure \u2014 every block has redundancy in the success path.");
|
|
20513
|
+
}
|
|
20514
|
+
return {
|
|
20515
|
+
...systemReliability !== void 0 ? { systemReliability } : {},
|
|
20516
|
+
blocks: results,
|
|
20517
|
+
missing,
|
|
20518
|
+
...criticalBlock ? { criticalBlock } : {},
|
|
20519
|
+
warnings,
|
|
20520
|
+
notes
|
|
20521
|
+
};
|
|
20522
|
+
}
|
|
20523
|
+
function collectBlocks(s, out) {
|
|
20524
|
+
if (s.kind === "block") {
|
|
20525
|
+
out.push({ id: s.id, ...s.R !== void 0 ? { R: s.R } : {} });
|
|
20526
|
+
return;
|
|
20527
|
+
}
|
|
20528
|
+
for (const c of s.children) collectBlocks(c, out);
|
|
20529
|
+
}
|
|
20530
|
+
function evalStructure(s, env, notes) {
|
|
20531
|
+
if (s.kind === "block") return env.get(s.id);
|
|
20532
|
+
const childR = s.children.map((c) => evalStructure(c, env, notes));
|
|
20533
|
+
if (childR.some((r7) => r7 === void 0)) return void 0;
|
|
20534
|
+
const rs = childR;
|
|
20535
|
+
if (rs.length === 0) return 1;
|
|
20536
|
+
if (s.kind === "series") {
|
|
20537
|
+
return rs.reduce((p, r7) => p * r7, 1);
|
|
20538
|
+
}
|
|
20539
|
+
if (s.kind === "parallel") {
|
|
20540
|
+
return 1 - rs.reduce((p, r7) => p * (1 - r7), 1);
|
|
20541
|
+
}
|
|
20542
|
+
const n = rs.length;
|
|
20543
|
+
const k = Math.min(Math.max(s.k ?? n, 1), n);
|
|
20544
|
+
if (n > KOFN_ENUM_CAP) {
|
|
20545
|
+
notes.push(`k-of-n group with n=${n} exceeds the exact-enumeration cap (${KOFN_ENUM_CAP}); reported as a parallel bound.`);
|
|
20546
|
+
return 1 - rs.reduce((p, r7) => p * (1 - r7), 1);
|
|
20547
|
+
}
|
|
20548
|
+
return kofnReliability(rs, k);
|
|
20549
|
+
}
|
|
20550
|
+
function kofnReliability(rs, k) {
|
|
20551
|
+
const n = rs.length;
|
|
20552
|
+
let total = 0;
|
|
20553
|
+
for (let mask = 0; mask < 1 << n; mask++) {
|
|
20554
|
+
let working = 0;
|
|
20555
|
+
let prob = 1;
|
|
20556
|
+
for (let i = 0; i < n; i++) {
|
|
20557
|
+
if (mask & 1 << i) {
|
|
20558
|
+
working++;
|
|
20559
|
+
prob *= rs[i];
|
|
20560
|
+
} else prob *= 1 - rs[i];
|
|
20561
|
+
}
|
|
20562
|
+
if (working >= k) total += prob;
|
|
20563
|
+
}
|
|
20564
|
+
return total;
|
|
20565
|
+
}
|
|
20566
|
+
|
|
20567
|
+
// src/diagrams/rbd/layout.ts
|
|
20568
|
+
var RBD_CONST = {
|
|
20569
|
+
BLOCK_H: 46,
|
|
20570
|
+
BLOCK_MIN_W: 96,
|
|
20571
|
+
BLOCK_MAX_W: 200,
|
|
20572
|
+
BLOCK_RX: 5,
|
|
20573
|
+
CHAR_W: 6.9,
|
|
20574
|
+
PAD_X: 14,
|
|
20575
|
+
/** Horizontal wire length between series members. */
|
|
20576
|
+
H_GAP: 44,
|
|
20577
|
+
/** Vertical gap between parallel rails. */
|
|
20578
|
+
V_GAP: 26,
|
|
20579
|
+
/** Fan-out / merge horizontal stub flanking a parallel group. */
|
|
20580
|
+
SPLIT_STUB: 30,
|
|
20581
|
+
NODE_R: 3.5,
|
|
20582
|
+
/** Input/output terminal stub at the network ends. */
|
|
20583
|
+
TERM_STUB: 30,
|
|
20584
|
+
CAP_GAP: 15,
|
|
20585
|
+
CAP_LINE_H: 13,
|
|
20586
|
+
CANVAS_PAD: 28,
|
|
20587
|
+
TITLE_H: 32,
|
|
20588
|
+
HEADER_H: 26
|
|
20589
|
+
};
|
|
20590
|
+
function blockWidth(label) {
|
|
20591
|
+
const C2 = RBD_CONST;
|
|
20592
|
+
return Math.min(C2.BLOCK_MAX_W, Math.max(C2.BLOCK_MIN_W, Math.ceil(label.length * C2.CHAR_W) + 2 * C2.PAD_X));
|
|
20593
|
+
}
|
|
20594
|
+
function layoutRbd(ast) {
|
|
20595
|
+
const C2 = RBD_CONST;
|
|
20596
|
+
const analysis = analyseRbd(ast);
|
|
20597
|
+
const spof = new Set(analysis.blocks.filter((b) => b.isSpof).map((b) => b.id));
|
|
20598
|
+
const rById = new Map(analysis.blocks.map((b) => [b.id, b.R]));
|
|
20599
|
+
const blocks = [];
|
|
20600
|
+
const nodes = [];
|
|
20601
|
+
const wires = [];
|
|
20602
|
+
const marks = [];
|
|
20603
|
+
const measure = (s) => {
|
|
20604
|
+
if (s.kind === "block") {
|
|
20605
|
+
return { s, w: blockWidth(s.label ?? s.id), h: C2.BLOCK_H, children: [] };
|
|
20606
|
+
}
|
|
20607
|
+
const children = s.children.map(measure);
|
|
20608
|
+
if (children.length === 0) return { s, w: C2.BLOCK_MIN_W, h: C2.BLOCK_H, children };
|
|
20609
|
+
if (s.kind === "series") {
|
|
20610
|
+
const w2 = children.reduce((acc, c) => acc + c.w, 0) + C2.H_GAP * (children.length - 1);
|
|
20611
|
+
const h2 = Math.max(...children.map((c) => c.h));
|
|
20612
|
+
return { s, w: w2, h: h2, children };
|
|
20613
|
+
}
|
|
20614
|
+
const innerW = Math.max(...children.map((c) => c.w));
|
|
20615
|
+
const w = innerW + 2 * C2.SPLIT_STUB;
|
|
20616
|
+
const h = children.reduce((acc, c) => acc + c.h, 0) + C2.V_GAP * (children.length - 1);
|
|
20617
|
+
return { s, w, h, children };
|
|
20618
|
+
};
|
|
20619
|
+
const place = (m, x, yc2) => {
|
|
20620
|
+
const s = m.s;
|
|
20621
|
+
if (s.kind === "block") {
|
|
20622
|
+
const r7 = rById.get(s.id);
|
|
20623
|
+
blocks.push({
|
|
20624
|
+
block: s,
|
|
20625
|
+
x,
|
|
20626
|
+
y: yc2 - C2.BLOCK_H / 2,
|
|
20627
|
+
width: m.w,
|
|
20628
|
+
height: C2.BLOCK_H,
|
|
20629
|
+
...r7 !== void 0 ? { R: r7 } : {},
|
|
20630
|
+
isSpof: spof.has(s.id),
|
|
20631
|
+
critical: analysis.criticalBlock === s.id
|
|
20632
|
+
});
|
|
20633
|
+
return { entryX: x, exitX: x + m.w };
|
|
20634
|
+
}
|
|
20635
|
+
if (s.kind === "series") {
|
|
20636
|
+
let cursor = x;
|
|
20637
|
+
let prevExit = null;
|
|
20638
|
+
let firstEntry = x;
|
|
20639
|
+
let lastExit = x;
|
|
20640
|
+
m.children.forEach((cm, i) => {
|
|
20641
|
+
const ep2 = place(cm, cursor, yc2);
|
|
20642
|
+
if (i === 0) firstEntry = ep2.entryX;
|
|
20643
|
+
if (prevExit !== null) wires.push({ path: `M ${r6(prevExit)} ${r6(yc2)} L ${r6(ep2.entryX)} ${r6(yc2)}` });
|
|
20644
|
+
prevExit = ep2.exitX;
|
|
20645
|
+
lastExit = ep2.exitX;
|
|
20646
|
+
cursor = ep2.exitX + C2.H_GAP;
|
|
20647
|
+
});
|
|
20648
|
+
return { entryX: firstEntry, exitX: lastExit };
|
|
20649
|
+
}
|
|
20650
|
+
const innerW = Math.max(...m.children.map((c) => c.w));
|
|
20651
|
+
const splitX = x + C2.NODE_R;
|
|
20652
|
+
const mergeX = x + m.w - C2.NODE_R;
|
|
20653
|
+
const childBandX = x + C2.SPLIT_STUB;
|
|
20654
|
+
nodes.push({ kind: "split", x: splitX, y: yc2 });
|
|
20655
|
+
nodes.push({ kind: "join", x: mergeX, y: yc2 });
|
|
20656
|
+
let runY = yc2 - m.h / 2;
|
|
20657
|
+
for (const cm of m.children) {
|
|
20658
|
+
const childYc = runY + cm.h / 2;
|
|
20659
|
+
const childStartX = childBandX + (innerW - cm.w) / 2;
|
|
20660
|
+
const ep2 = place(cm, childStartX, childYc);
|
|
20661
|
+
wires.push({ path: `M ${r6(splitX)} ${r6(yc2)} L ${r6(splitX)} ${r6(childYc)} L ${r6(ep2.entryX)} ${r6(childYc)}` });
|
|
20662
|
+
wires.push({ path: `M ${r6(ep2.exitX)} ${r6(childYc)} L ${r6(mergeX)} ${r6(childYc)} L ${r6(mergeX)} ${r6(yc2)}` });
|
|
20663
|
+
runY += cm.h + C2.V_GAP;
|
|
20664
|
+
}
|
|
20665
|
+
if (s.kind === "kofn") {
|
|
20666
|
+
marks.push({ x: mergeX + 6, y: yc2 - m.h / 2 - 6, text: `${s.k}/${s.n ?? m.children.length}` });
|
|
20667
|
+
}
|
|
20668
|
+
return { entryX: splitX, exitX: mergeX };
|
|
20669
|
+
};
|
|
20670
|
+
const rootM = measure(ast.root);
|
|
20671
|
+
const headerH = (ast.title ? C2.TITLE_H : 0) + C2.HEADER_H;
|
|
20672
|
+
const yc = C2.CANVAS_PAD + headerH + rootM.h / 2;
|
|
20673
|
+
const originX = C2.CANVAS_PAD + C2.TERM_STUB;
|
|
20674
|
+
const ep = place(rootM, originX, yc);
|
|
20675
|
+
const inX = C2.CANVAS_PAD;
|
|
20676
|
+
const outX = ep.exitX + C2.TERM_STUB;
|
|
20677
|
+
nodes.push({ kind: "in", x: inX, y: yc });
|
|
20678
|
+
nodes.push({ kind: "out", x: outX, y: yc });
|
|
20679
|
+
wires.push({ path: `M ${r6(inX)} ${r6(yc)} L ${r6(ep.entryX)} ${r6(yc)}` });
|
|
20680
|
+
wires.push({ path: `M ${r6(ep.exitX)} ${r6(yc)} L ${r6(outX)} ${r6(yc)}` });
|
|
20681
|
+
let maxX = outX;
|
|
20682
|
+
let maxY = yc + rootM.h / 2;
|
|
20683
|
+
for (const b of blocks) {
|
|
20684
|
+
maxX = Math.max(maxX, b.x + b.width);
|
|
20685
|
+
const capLines = (b.R !== void 0 ? 1 : 0) + (b.block.label && b.block.label !== b.block.id ? 1 : 0);
|
|
20686
|
+
maxY = Math.max(maxY, b.y + b.height + (capLines > 0 ? C2.CAP_GAP + capLines * C2.CAP_LINE_H : 0));
|
|
20687
|
+
}
|
|
20688
|
+
for (const mk of marks) maxX = Math.max(maxX, mk.x + 24);
|
|
20689
|
+
return {
|
|
20690
|
+
ast,
|
|
20691
|
+
analysis,
|
|
20692
|
+
blocks,
|
|
20693
|
+
nodes,
|
|
20694
|
+
wires,
|
|
20695
|
+
marks,
|
|
20696
|
+
width: Math.ceil(maxX + C2.CANVAS_PAD),
|
|
20697
|
+
height: Math.ceil(maxY + C2.CANVAS_PAD)
|
|
20698
|
+
};
|
|
20699
|
+
}
|
|
20700
|
+
function r6(n) {
|
|
20701
|
+
return Math.round(n * 10) / 10;
|
|
20702
|
+
}
|
|
20703
|
+
|
|
20704
|
+
// src/diagrams/rbd/renderer.ts
|
|
20705
|
+
function renderRbd(text2, config) {
|
|
20706
|
+
const ast = parseRbd(text2);
|
|
20707
|
+
const layout = layoutRbd(ast);
|
|
20708
|
+
return renderRbdLayout(layout, config);
|
|
20709
|
+
}
|
|
20710
|
+
function renderRbdLayout(layout, config) {
|
|
20711
|
+
const theme = chunkENUM7GMZ_cjs.resolveReliabilityTheme(config?.theme ?? "default");
|
|
20712
|
+
const fontFamily = config?.fontFamily ?? chunkENUM7GMZ_cjs.DEFAULT_FONT_FAMILY;
|
|
20713
|
+
const pad = config?.padding ?? 0;
|
|
20714
|
+
const { ast, analysis } = layout;
|
|
20715
|
+
const width = layout.width + pad * 2;
|
|
20716
|
+
const height = layout.height + pad * 2;
|
|
20717
|
+
const a11y = ast.title ?? "Reliability block diagram";
|
|
20718
|
+
const styleBlock = chunk3WNW5Y7P_cjs.el(
|
|
20719
|
+
"style",
|
|
20720
|
+
{},
|
|
20721
|
+
`
|
|
20722
|
+
.sx-rbd-bg { fill: ${theme.bg}; }
|
|
20723
|
+
.sx-rbd-wire { fill: none; stroke: ${theme.edgeStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.normal}; }
|
|
20724
|
+
.sx-rbd-node { fill: ${theme.edgeStroke}; stroke: none; }
|
|
20725
|
+
.sx-rbd-term { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.normal}; }
|
|
20726
|
+
.sx-rbd-block { fill: ${theme.eventFill}; stroke: ${theme.eventStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.normal}; }
|
|
20727
|
+
.sx-rbd-block[data-spof="true"] { stroke: ${theme.spofStroke}; stroke-width: ${chunkENUM7GMZ_cjs.STROKE_WIDTH.thick}; }
|
|
20728
|
+
.sx-rbd-block[data-critical="true"] { stroke: ${theme.gateStroke}; stroke-width: 2.25; }
|
|
20729
|
+
.sx-rbd-label { fill: ${theme.eventStroke}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.label}px; font-weight: 600; }
|
|
20730
|
+
.sx-rbd-r { fill: ${theme.probText}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.small}px; font-weight: 600; }
|
|
20731
|
+
.sx-rbd-mark { fill: ${theme.gateStroke}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.small}px; font-weight: 700; }
|
|
20732
|
+
.sx-rbd-rsys { fill: ${theme.probText}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.label + 1}px; font-weight: 700; }
|
|
20733
|
+
.sx-rbd-title { fill: ${theme.eventStroke}; font-size: ${chunkENUM7GMZ_cjs.FONT_SIZE.title}px; font-weight: 700; }
|
|
20734
|
+
`.trim()
|
|
20735
|
+
);
|
|
20736
|
+
const children = [
|
|
20737
|
+
chunk3WNW5Y7P_cjs.title(a11y),
|
|
20738
|
+
chunk3WNW5Y7P_cjs.desc(summarise5(layout)),
|
|
20739
|
+
styleBlock,
|
|
20740
|
+
chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-rbd-bg" })
|
|
20741
|
+
];
|
|
20742
|
+
const inner = [];
|
|
20743
|
+
if (ast.title) {
|
|
20744
|
+
inner.push(
|
|
20745
|
+
chunk3WNW5Y7P_cjs.text(
|
|
20746
|
+
{ x: RBD_CONST.CANVAS_PAD, y: 22, class: "sx-rbd-title", "font-family": fontFamily },
|
|
20747
|
+
ast.title
|
|
20748
|
+
)
|
|
20749
|
+
);
|
|
20750
|
+
}
|
|
20751
|
+
inner.push(
|
|
20752
|
+
chunk3WNW5Y7P_cjs.text(
|
|
20753
|
+
{
|
|
20754
|
+
x: layout.width / 2,
|
|
20755
|
+
y: (ast.title ? RBD_CONST.TITLE_H : 0) + 18,
|
|
20756
|
+
class: "sx-rbd-rsys",
|
|
20757
|
+
"text-anchor": "middle"
|
|
20758
|
+
},
|
|
20759
|
+
systemLabel(analysis)
|
|
20760
|
+
)
|
|
20761
|
+
);
|
|
20762
|
+
for (const w of layout.wires) inner.push(chunk3WNW5Y7P_cjs.path({ d: w.path, class: "sx-rbd-wire" }));
|
|
20763
|
+
for (const n of layout.nodes) {
|
|
20764
|
+
if (n.kind === "in" || n.kind === "out") {
|
|
20765
|
+
inner.push(chunk3WNW5Y7P_cjs.circle({ cx: n.x, cy: n.y, r: 6, class: "sx-rbd-term", "data-node": n.kind }));
|
|
20766
|
+
} else {
|
|
20767
|
+
inner.push(chunk3WNW5Y7P_cjs.circle({ cx: n.x, cy: n.y, r: RBD_CONST.NODE_R, class: "sx-rbd-node", "data-node": n.kind }));
|
|
20768
|
+
}
|
|
20769
|
+
}
|
|
20770
|
+
for (const mk of layout.marks) {
|
|
20771
|
+
inner.push(chunk3WNW5Y7P_cjs.text({ x: mk.x, y: mk.y, class: "sx-rbd-mark" }, mk.text));
|
|
20772
|
+
}
|
|
20773
|
+
for (const b of layout.blocks) inner.push(renderBlock(b));
|
|
20774
|
+
children.push(
|
|
20775
|
+
chunk3WNW5Y7P_cjs.group({ transform: pad ? `translate(${pad}, ${pad})` : void 0, "font-family": fontFamily }, inner)
|
|
20776
|
+
);
|
|
20777
|
+
return chunk3WNW5Y7P_cjs.svgRoot(
|
|
20778
|
+
{
|
|
20779
|
+
width,
|
|
20780
|
+
height,
|
|
20781
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
20782
|
+
role: "img",
|
|
20783
|
+
"aria-label": a11y,
|
|
20784
|
+
"data-diagram-type": "rbd"
|
|
20785
|
+
},
|
|
20786
|
+
children
|
|
20787
|
+
);
|
|
20788
|
+
}
|
|
20789
|
+
function renderBlock(b) {
|
|
20790
|
+
const cx = b.x + b.width / 2;
|
|
20791
|
+
const cy = b.y + b.height / 2;
|
|
20792
|
+
const label = b.block.label ?? b.block.id;
|
|
20793
|
+
const parts = [
|
|
20794
|
+
chunk3WNW5Y7P_cjs.rect({
|
|
20795
|
+
x: b.x,
|
|
20796
|
+
y: b.y,
|
|
20797
|
+
width: b.width,
|
|
20798
|
+
height: b.height,
|
|
20799
|
+
rx: RBD_CONST.BLOCK_RX,
|
|
20800
|
+
class: "sx-rbd-block",
|
|
20801
|
+
...b.isSpof ? { "data-spof": "true" } : {},
|
|
20802
|
+
...b.critical && !b.isSpof ? { "data-critical": "true" } : {}
|
|
20803
|
+
}),
|
|
20804
|
+
chunk3WNW5Y7P_cjs.multilineText(
|
|
20805
|
+
{ x: cx, y: cy, class: "sx-rbd-label", "text-anchor": "middle", "dominant-baseline": "middle" },
|
|
20806
|
+
wrap4(label, 18),
|
|
20807
|
+
13
|
|
20808
|
+
)
|
|
20809
|
+
];
|
|
20810
|
+
if (b.R !== void 0) {
|
|
20811
|
+
parts.push(
|
|
20812
|
+
chunk3WNW5Y7P_cjs.text(
|
|
20813
|
+
{ x: cx, y: b.y + b.height + RBD_CONST.CAP_GAP, class: "sx-rbd-r", "text-anchor": "middle" },
|
|
20814
|
+
`R=${fmtR(b.R)}`
|
|
20815
|
+
)
|
|
20816
|
+
);
|
|
20817
|
+
}
|
|
20818
|
+
return chunk3WNW5Y7P_cjs.group(
|
|
20819
|
+
{
|
|
20820
|
+
class: "sx-rbd-block-g",
|
|
20821
|
+
"data-id": b.block.id,
|
|
20822
|
+
...b.R !== void 0 ? { "data-r": String(b.R) } : {},
|
|
20823
|
+
...b.isSpof ? { "data-spof": "true" } : {},
|
|
20824
|
+
...b.critical ? { "data-critical": "true" } : {}
|
|
20825
|
+
},
|
|
20826
|
+
parts
|
|
20827
|
+
);
|
|
20828
|
+
}
|
|
20829
|
+
function systemLabel(analysis) {
|
|
20830
|
+
if (analysis.systemReliability === void 0) {
|
|
20831
|
+
const miss = analysis.missing.length > 0 ? ` \u2014 missing R on ${analysis.missing.join(", ")}` : "";
|
|
20832
|
+
return `System reliability: n/a${miss}`;
|
|
20833
|
+
}
|
|
20834
|
+
return `System reliability R = ${fmtR(analysis.systemReliability)}`;
|
|
20835
|
+
}
|
|
20836
|
+
function fmtR(n) {
|
|
20837
|
+
if (n >= 1) return "1";
|
|
20838
|
+
if (n <= 0) return "0";
|
|
20839
|
+
for (let p = 5; p <= 9; p++) {
|
|
20840
|
+
const s = parseFloat(n.toPrecision(p));
|
|
20841
|
+
if (s < 1) return String(s);
|
|
20842
|
+
}
|
|
20843
|
+
return String(parseFloat(n.toPrecision(9)));
|
|
20844
|
+
}
|
|
20845
|
+
function summarise5(layout) {
|
|
20846
|
+
const { analysis } = layout;
|
|
20847
|
+
const n = layout.blocks.length;
|
|
20848
|
+
const parts = [`Reliability block diagram: ${n} block${n === 1 ? "" : "s"}.`];
|
|
20849
|
+
if (analysis.systemReliability !== void 0) {
|
|
20850
|
+
parts.push(`System reliability R = ${fmtR(analysis.systemReliability)}.`);
|
|
20851
|
+
} else if (analysis.missing.length > 0) {
|
|
20852
|
+
parts.push(`System reliability n/a \u2014 missing R on ${analysis.missing.join(", ")}.`);
|
|
20853
|
+
}
|
|
20854
|
+
const spofs = analysis.blocks.filter((b) => b.isSpof).map((b) => b.id);
|
|
20855
|
+
if (spofs.length > 0) parts.push(`Single point${spofs.length > 1 ? "s" : ""} of failure: ${spofs.join(", ")}.`);
|
|
20856
|
+
if (analysis.criticalBlock) parts.push(`Highest reliability-importance block: ${analysis.criticalBlock}.`);
|
|
20857
|
+
for (const note of analysis.notes) parts.push(note);
|
|
20858
|
+
for (const w of analysis.warnings) parts.push(w);
|
|
20859
|
+
return parts.join(" ");
|
|
20860
|
+
}
|
|
20861
|
+
function wrap4(s, perLine) {
|
|
20862
|
+
if (s.length <= perLine) return s;
|
|
20863
|
+
const words = s.split(/\s+/);
|
|
20864
|
+
const lines = [];
|
|
20865
|
+
let cur = "";
|
|
20866
|
+
for (const w of words) {
|
|
20867
|
+
if (cur && cur.length + 1 + w.length > perLine) {
|
|
20868
|
+
lines.push(cur);
|
|
20869
|
+
cur = w;
|
|
20870
|
+
} else cur = cur ? `${cur} ${w}` : w;
|
|
20871
|
+
}
|
|
20872
|
+
if (cur) lines.push(cur);
|
|
20873
|
+
if (lines.length > 2) {
|
|
20874
|
+
lines.length = 2;
|
|
20875
|
+
lines[1] = lines[1].slice(0, perLine - 1) + "\u2026";
|
|
20876
|
+
}
|
|
20877
|
+
return lines.join("<br/>");
|
|
20878
|
+
}
|
|
20879
|
+
|
|
20880
|
+
// src/diagrams/rbd/index.ts
|
|
20881
|
+
var rbd = {
|
|
20882
|
+
type: "rbd",
|
|
20883
|
+
detect(text2) {
|
|
20884
|
+
return /^\s*(rbd|reliability(?:blockdiagram)?|reliability-block-diagram)\b/i.test(text2);
|
|
20885
|
+
},
|
|
20886
|
+
parse: parseRbd,
|
|
20887
|
+
render(text2, config) {
|
|
20888
|
+
return renderRbd(text2, config);
|
|
20889
|
+
}
|
|
20890
|
+
};
|
|
20891
|
+
|
|
20240
20892
|
// src/diagrams/causalloop/parser.ts
|
|
20241
20893
|
var CausalLoopParseError = class extends Error {
|
|
20242
20894
|
constructor(message, line2) {
|
|
@@ -20930,7 +21582,7 @@ function renderCausalLoopLayout(layout, config) {
|
|
|
20930
21582
|
);
|
|
20931
21583
|
const children = [
|
|
20932
21584
|
chunk3WNW5Y7P_cjs.title(a11y),
|
|
20933
|
-
chunk3WNW5Y7P_cjs.desc(
|
|
21585
|
+
chunk3WNW5Y7P_cjs.desc(summarise6(layout)),
|
|
20934
21586
|
styleBlock,
|
|
20935
21587
|
chunk3WNW5Y7P_cjs.el("rect", { x: 0, y: 0, width, height, class: "sx-cld-bg" })
|
|
20936
21588
|
];
|
|
@@ -21044,17 +21696,17 @@ function arrowhead(x, y, tx, ty) {
|
|
|
21044
21696
|
return chunk3WNW5Y7P_cjs.polygon({ points: `${tip} ${p1} ${p2}`, class: "sx-cld-arrow" });
|
|
21045
21697
|
}
|
|
21046
21698
|
function renderGlyph(g) {
|
|
21047
|
-
const
|
|
21699
|
+
const r7 = g.r;
|
|
21048
21700
|
const startAng = -Math.PI / 2;
|
|
21049
21701
|
const sweep = 300 * Math.PI / 180;
|
|
21050
21702
|
const endAng = g.clockwise ? startAng + sweep : startAng - sweep;
|
|
21051
|
-
const sx = g.cx +
|
|
21052
|
-
const sy = g.cy +
|
|
21053
|
-
const ex = g.cx +
|
|
21054
|
-
const ey = g.cy +
|
|
21703
|
+
const sx = g.cx + r7 * Math.cos(startAng);
|
|
21704
|
+
const sy = g.cy + r7 * Math.sin(startAng);
|
|
21705
|
+
const ex = g.cx + r7 * Math.cos(endAng);
|
|
21706
|
+
const ey = g.cy + r7 * Math.sin(endAng);
|
|
21055
21707
|
const largeArc = 1;
|
|
21056
21708
|
const sweepFlag = g.clockwise ? 1 : 0;
|
|
21057
|
-
const arc = `M ${fmt4(sx)} ${fmt4(sy)} A ${
|
|
21709
|
+
const arc = `M ${fmt4(sx)} ${fmt4(sy)} A ${r7} ${r7} 0 ${largeArc} ${sweepFlag} ${fmt4(ex)} ${fmt4(ey)}`;
|
|
21058
21710
|
const dir = g.clockwise ? 1 : -1;
|
|
21059
21711
|
const tx = -Math.sin(endAng) * dir;
|
|
21060
21712
|
const ty = Math.cos(endAng) * dir;
|
|
@@ -21099,7 +21751,7 @@ function glyphArrow(x, y, tx, ty) {
|
|
|
21099
21751
|
const p2 = `${fmt4(bx - px * wide)},${fmt4(by - py * wide)}`;
|
|
21100
21752
|
return chunk3WNW5Y7P_cjs.polygon({ points: `${fmt4(x)},${fmt4(y)} ${p1} ${p2}`, class: "sx-cld-glyph-head" });
|
|
21101
21753
|
}
|
|
21102
|
-
function
|
|
21754
|
+
function summarise6(layout) {
|
|
21103
21755
|
const { ast, analysis } = layout;
|
|
21104
21756
|
const parts = [
|
|
21105
21757
|
`Causal loop diagram${ast.title ? ` "${ast.title}"` : ""}: ${ast.variables.length} variable${ast.variables.length === 1 ? "" : "s"}, ${ast.links.length} causal link${ast.links.length === 1 ? "" : "s"}.`
|
|
@@ -21148,7 +21800,7 @@ var MarkovParseError = class extends Error {
|
|
|
21148
21800
|
};
|
|
21149
21801
|
var OPENERS2 = ['"', "\u201C", "\u300C", "\u300E", "\xAB"];
|
|
21150
21802
|
var CLOSERS2 = ['"', "\u201D", "\u300D", "\u300F", "\xBB"];
|
|
21151
|
-
function
|
|
21803
|
+
function tokenize7(s) {
|
|
21152
21804
|
const out = [];
|
|
21153
21805
|
let i = 0;
|
|
21154
21806
|
while (i < s.length) {
|
|
@@ -21233,7 +21885,7 @@ function parseMarkov(text2) {
|
|
|
21233
21885
|
if (trimmed.startsWith("#") || trimmed.startsWith("//")) continue;
|
|
21234
21886
|
if (!sawHeader && /^(markov|markovchain)\b/i.test(trimmed)) {
|
|
21235
21887
|
sawHeader = true;
|
|
21236
|
-
const toks =
|
|
21888
|
+
const toks = tokenize7(trimmed);
|
|
21237
21889
|
const titleTok = toks.find((t, idx) => idx > 0 && t.quoted);
|
|
21238
21890
|
if (titleTok) ast.title = titleTok.text;
|
|
21239
21891
|
else if (toks[1] && !toks[1].quoted) ast.title = toks.slice(1).map((t) => t.text).join(" ");
|
|
@@ -21291,7 +21943,7 @@ function parseMarkov(text2) {
|
|
|
21291
21943
|
return ast;
|
|
21292
21944
|
}
|
|
21293
21945
|
function parseStateDecl(line2, lineNo, ensureState) {
|
|
21294
|
-
const toks =
|
|
21946
|
+
const toks = tokenize7(normalizeKeyNums2(line2));
|
|
21295
21947
|
const idTok = toks[1];
|
|
21296
21948
|
if (!idTok || idTok.quoted) throw new MarkovParseError(`state is missing an id`, lineNo);
|
|
21297
21949
|
const id = idTok.text;
|
|
@@ -21565,22 +22217,22 @@ function computeAbsorbing(P, order, classification) {
|
|
|
21565
22217
|
const absorbing = order.filter((id) => absorbingSet.has(id));
|
|
21566
22218
|
const pos = new Map(order.map((id, i) => [id, i]));
|
|
21567
22219
|
const t = transient.length;
|
|
21568
|
-
const
|
|
22220
|
+
const r7 = absorbing.length;
|
|
21569
22221
|
const Q = Array.from({ length: t }, () => new Array(t).fill(0));
|
|
21570
|
-
const R = Array.from({ length: t }, () => new Array(
|
|
22222
|
+
const R = Array.from({ length: t }, () => new Array(r7).fill(0));
|
|
21571
22223
|
for (let a = 0; a < t; a++) {
|
|
21572
22224
|
const fi = pos.get(transient[a]);
|
|
21573
22225
|
for (let b = 0; b < t; b++) Q[a][b] = P[fi][pos.get(transient[b])];
|
|
21574
|
-
for (let b = 0; b <
|
|
22226
|
+
for (let b = 0; b < r7; b++) R[a][b] = P[fi][pos.get(absorbing[b])];
|
|
21575
22227
|
}
|
|
21576
22228
|
const ImQ = Array.from(
|
|
21577
22229
|
{ length: t },
|
|
21578
22230
|
(_, a) => Array.from({ length: t }, (_2, b) => (a === b ? 1 : 0) - Q[a][b])
|
|
21579
22231
|
);
|
|
21580
22232
|
const N = invert(ImQ);
|
|
21581
|
-
const B = Array.from({ length: t }, () => new Array(
|
|
22233
|
+
const B = Array.from({ length: t }, () => new Array(r7).fill(0));
|
|
21582
22234
|
for (let a = 0; a < t; a++) {
|
|
21583
|
-
for (let b = 0; b <
|
|
22235
|
+
for (let b = 0; b < r7; b++) {
|
|
21584
22236
|
let s = 0;
|
|
21585
22237
|
for (let c = 0; c < t; c++) s += N[a][c] * R[c][b];
|
|
21586
22238
|
B[a][b] = s;
|
|
@@ -21852,11 +22504,11 @@ function curvedArcGeom(tr, a, b, bow, C2) {
|
|
|
21852
22504
|
labelY: mid.y
|
|
21853
22505
|
};
|
|
21854
22506
|
}
|
|
21855
|
-
function aimToBoundary(centre, target,
|
|
22507
|
+
function aimToBoundary(centre, target, r7) {
|
|
21856
22508
|
const dx = target.x - centre.x;
|
|
21857
22509
|
const dy = target.y - centre.y;
|
|
21858
22510
|
const len = Math.hypot(dx, dy) || 1;
|
|
21859
|
-
return { x: centre.x + dx / len *
|
|
22511
|
+
return { x: centre.x + dx / len * r7, y: centre.y + dy / len * r7 };
|
|
21860
22512
|
}
|
|
21861
22513
|
function selfLoopGeom(tr, c, ringCenter, layout, C2) {
|
|
21862
22514
|
let ox = c.x - ringCenter.x;
|
|
@@ -22090,8 +22742,8 @@ function renderMarkov(textOrAst, config) {
|
|
|
22090
22742
|
}
|
|
22091
22743
|
function fmt5(x) {
|
|
22092
22744
|
if (!Number.isFinite(x)) return String(x);
|
|
22093
|
-
const
|
|
22094
|
-
return String(
|
|
22745
|
+
const r7 = Math.round(x * 1e3) / 1e3;
|
|
22746
|
+
return String(r7);
|
|
22095
22747
|
}
|
|
22096
22748
|
function num(x) {
|
|
22097
22749
|
return Math.round(x * 100) / 100;
|
|
@@ -22768,7 +23420,7 @@ function renderGitGraphLayout(layout, config) {
|
|
|
22768
23420
|
const styleBlock = buildStyle2(pal, ast.showBranches);
|
|
22769
23421
|
const children = [
|
|
22770
23422
|
chunk3WNW5Y7P_cjs.title(a11y),
|
|
22771
|
-
chunk3WNW5Y7P_cjs.desc(
|
|
23423
|
+
chunk3WNW5Y7P_cjs.desc(summarise7(layout)),
|
|
22772
23424
|
styleBlock,
|
|
22773
23425
|
chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-gg-bg" })
|
|
22774
23426
|
];
|
|
@@ -22891,13 +23543,13 @@ function renderCommit(lc, ast, pal, fontFamily) {
|
|
|
22891
23543
|
if (node.commitType !== "NORMAL") dataAttrs2["data-type"] = node.commitType;
|
|
22892
23544
|
if (node.tag) dataAttrs2["data-tag"] = node.tag;
|
|
22893
23545
|
if (node.commitType === "HIGHLIGHT") {
|
|
22894
|
-
const
|
|
23546
|
+
const r7 = GITGRAPH_CONST.SQUARE_R;
|
|
22895
23547
|
parts.push(
|
|
22896
23548
|
chunk3WNW5Y7P_cjs.rect({
|
|
22897
|
-
x: x -
|
|
22898
|
-
y: y -
|
|
22899
|
-
width:
|
|
22900
|
-
height:
|
|
23549
|
+
x: x - r7,
|
|
23550
|
+
y: y - r7,
|
|
23551
|
+
width: r7 * 2,
|
|
23552
|
+
height: r7 * 2,
|
|
22901
23553
|
rx: 2,
|
|
22902
23554
|
class: `sx-gg-node sx-gg-highlight sx-gg-stroke-c${ci}`
|
|
22903
23555
|
})
|
|
@@ -23018,7 +23670,7 @@ ${laneRules}
|
|
|
23018
23670
|
function num2(n) {
|
|
23019
23671
|
return Number.isInteger(n) ? String(n) : n.toFixed(2);
|
|
23020
23672
|
}
|
|
23021
|
-
function
|
|
23673
|
+
function summarise7(layout) {
|
|
23022
23674
|
const c = layout.replay.commits.length;
|
|
23023
23675
|
const b = layout.replay.branches.length;
|
|
23024
23676
|
const merges = layout.replay.commits.filter((n) => n.isMerge).length;
|
|
@@ -23575,33 +24227,33 @@ function layoutEpc(ast) {
|
|
|
23575
24227
|
const isLR = ast.direction === "lr";
|
|
23576
24228
|
const layerCenter = [];
|
|
23577
24229
|
let primary = EPC_CONST.CANVAS_PAD + (ast.title ? EPC_CONST.TITLE_H : 0);
|
|
23578
|
-
for (let
|
|
24230
|
+
for (let r7 = 0; r7 <= maxLayer; r7++) {
|
|
23579
24231
|
const bandThickness = Math.max(
|
|
23580
24232
|
0,
|
|
23581
|
-
...ranks[
|
|
24233
|
+
...ranks[r7].map((id) => isLR ? sized.get(id).w : sized.get(id).h)
|
|
23582
24234
|
);
|
|
23583
|
-
layerCenter[
|
|
24235
|
+
layerCenter[r7] = primary + bandThickness / 2;
|
|
23584
24236
|
primary += bandThickness + EPC_CONST.LAYER_GAP;
|
|
23585
24237
|
}
|
|
23586
24238
|
const primaryExtent = primary - EPC_CONST.LAYER_GAP + EPC_CONST.CANVAS_PAD;
|
|
23587
24239
|
const crossPos = /* @__PURE__ */ new Map();
|
|
23588
24240
|
let maxCrossExtent = 0;
|
|
23589
24241
|
const rankWidths = [];
|
|
23590
|
-
for (let
|
|
24242
|
+
for (let r7 = 0; r7 <= maxLayer; r7++) {
|
|
23591
24243
|
let cursor = 0;
|
|
23592
|
-
for (const id of ranks[
|
|
24244
|
+
for (const id of ranks[r7]) {
|
|
23593
24245
|
const s = sized.get(id);
|
|
23594
24246
|
const span = isLR ? s.h : s.w;
|
|
23595
24247
|
crossPos.set(id, cursor + span / 2);
|
|
23596
24248
|
cursor += span + EPC_CONST.NODE_GAP;
|
|
23597
24249
|
}
|
|
23598
24250
|
const total = Math.max(0, cursor - EPC_CONST.NODE_GAP);
|
|
23599
|
-
rankWidths[
|
|
24251
|
+
rankWidths[r7] = total;
|
|
23600
24252
|
maxCrossExtent = Math.max(maxCrossExtent, total);
|
|
23601
24253
|
}
|
|
23602
|
-
for (let
|
|
23603
|
-
const shift = (maxCrossExtent - rankWidths[
|
|
23604
|
-
for (const id of ranks[
|
|
24254
|
+
for (let r7 = 0; r7 <= maxLayer; r7++) {
|
|
24255
|
+
const shift = (maxCrossExtent - rankWidths[r7]) / 2 + EPC_CONST.CANVAS_PAD;
|
|
24256
|
+
for (const id of ranks[r7]) crossPos.set(id, crossPos.get(id) + shift);
|
|
23605
24257
|
}
|
|
23606
24258
|
const backMargin = backSet.size > 0 ? EPC_CONST.BACK_MARGIN : 0;
|
|
23607
24259
|
const crossExtent = maxCrossExtent + EPC_CONST.CANVAS_PAD * 2 + backMargin;
|
|
@@ -23679,15 +24331,15 @@ function longestPathLayers(ast, dagOut, dagIn) {
|
|
|
23679
24331
|
}
|
|
23680
24332
|
function orderRanks2(ranks, dagIn, ast) {
|
|
23681
24333
|
const declIndex = new Map(ast.nodes.map((n, i) => [n.id, i]));
|
|
23682
|
-
for (let
|
|
24334
|
+
for (let r7 = 1; r7 < ranks.length; r7++) {
|
|
23683
24335
|
const prevIndex = /* @__PURE__ */ new Map();
|
|
23684
|
-
ranks[
|
|
24336
|
+
ranks[r7 - 1].forEach((id, i) => prevIndex.set(id, i));
|
|
23685
24337
|
const bary = /* @__PURE__ */ new Map();
|
|
23686
|
-
for (const id of ranks[
|
|
24338
|
+
for (const id of ranks[r7]) {
|
|
23687
24339
|
const preds = (dagIn.get(id) ?? []).map((p) => prevIndex.get(p)).filter((v) => v !== void 0);
|
|
23688
24340
|
bary.set(id, preds.length ? preds.reduce((a, b) => a + b, 0) / preds.length : declIndex.get(id) ?? 0);
|
|
23689
24341
|
}
|
|
23690
|
-
ranks[
|
|
24342
|
+
ranks[r7].sort((a, b) => {
|
|
23691
24343
|
const d = (bary.get(a) ?? 0) - (bary.get(b) ?? 0);
|
|
23692
24344
|
if (Math.abs(d) > 1e-9) return d;
|
|
23693
24345
|
return (declIndex.get(a) ?? 0) - (declIndex.get(b) ?? 0);
|
|
@@ -23718,7 +24370,7 @@ function detectBackEdges(ast, out) {
|
|
|
23718
24370
|
}
|
|
23719
24371
|
colour.set(id, BLACK);
|
|
23720
24372
|
};
|
|
23721
|
-
for (const
|
|
24373
|
+
for (const r7 of visitOrder) if ((colour.get(r7) ?? WHITE) === WHITE) dfs(r7);
|
|
23722
24374
|
return back;
|
|
23723
24375
|
}
|
|
23724
24376
|
function routeEdge3(e, nodePos, crossExtent, back, isLR) {
|
|
@@ -23755,9 +24407,9 @@ function borderPoint(from, to, _isLR) {
|
|
|
23755
24407
|
const dx = to.cx - from.cx;
|
|
23756
24408
|
const dy = to.cy - from.cy;
|
|
23757
24409
|
if (from.node.kind === "connector") {
|
|
23758
|
-
const
|
|
24410
|
+
const r7 = EPC_CONST.CONN_R;
|
|
23759
24411
|
const len = Math.hypot(dx, dy) || 1;
|
|
23760
|
-
return { x: from.cx + dx / len *
|
|
24412
|
+
return { x: from.cx + dx / len * r7, y: from.cy + dy / len * r7 };
|
|
23761
24413
|
}
|
|
23762
24414
|
const hw = from.width / 2;
|
|
23763
24415
|
const hh = from.height / 2;
|
|
@@ -23859,7 +24511,7 @@ function renderEpcLayout(layout, config) {
|
|
|
23859
24511
|
);
|
|
23860
24512
|
const children = [
|
|
23861
24513
|
chunk3WNW5Y7P_cjs.title(a11y),
|
|
23862
|
-
chunk3WNW5Y7P_cjs.desc(
|
|
24514
|
+
chunk3WNW5Y7P_cjs.desc(summarise8(layout)),
|
|
23863
24515
|
styleBlock,
|
|
23864
24516
|
chunk3WNW5Y7P_cjs.defs([
|
|
23865
24517
|
chunk3WNW5Y7P_cjs.el("marker", {
|
|
@@ -23912,7 +24564,7 @@ function renderNode3(n) {
|
|
|
23912
24564
|
parts.push(hexagon(n.cx, n.cy, n.width, n.height, "sx-epc-event"));
|
|
23913
24565
|
parts.push(chunk3WNW5Y7P_cjs.multilineText(
|
|
23914
24566
|
{ x: n.cx, y: n.cy, class: "sx-epc-label", "text-anchor": "middle", "dominant-baseline": "middle" },
|
|
23915
|
-
|
|
24567
|
+
wrap5(label, 18),
|
|
23916
24568
|
14
|
|
23917
24569
|
));
|
|
23918
24570
|
} else if (node.kind === "function") {
|
|
@@ -23927,7 +24579,7 @@ function renderNode3(n) {
|
|
|
23927
24579
|
}));
|
|
23928
24580
|
parts.push(chunk3WNW5Y7P_cjs.multilineText(
|
|
23929
24581
|
{ x: n.cx, y: n.cy, class: "sx-epc-label", "text-anchor": "middle", "dominant-baseline": "middle" },
|
|
23930
|
-
|
|
24582
|
+
wrap5(label, 18),
|
|
23931
24583
|
14
|
|
23932
24584
|
));
|
|
23933
24585
|
} else {
|
|
@@ -23938,9 +24590,9 @@ function renderNode3(n) {
|
|
|
23938
24590
|
));
|
|
23939
24591
|
}
|
|
23940
24592
|
if (n.flagged) {
|
|
23941
|
-
const
|
|
24593
|
+
const r7 = node.kind === "connector" ? EPC_CONST.CONN_R + 5 : 0;
|
|
23942
24594
|
if (node.kind === "connector") {
|
|
23943
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: n.cx, cy: n.cy, r:
|
|
24595
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ cx: n.cx, cy: n.cy, r: r7, class: "sx-epc-flagring" }));
|
|
23944
24596
|
} else {
|
|
23945
24597
|
parts.push(chunk3WNW5Y7P_cjs.rect({
|
|
23946
24598
|
x: n.cx - n.width / 2 - 5,
|
|
@@ -24003,7 +24655,7 @@ function renderEdge6(e) {
|
|
|
24003
24655
|
parts
|
|
24004
24656
|
);
|
|
24005
24657
|
}
|
|
24006
|
-
function
|
|
24658
|
+
function summarise8(layout) {
|
|
24007
24659
|
const { ast, analysis } = layout;
|
|
24008
24660
|
const counts = { event: 0, function: 0, connector: 0 };
|
|
24009
24661
|
for (const n of ast.nodes) counts[n.kind]++;
|
|
@@ -24026,7 +24678,7 @@ function describeWellFormed(analysis) {
|
|
|
24026
24678
|
function clip4(s, n) {
|
|
24027
24679
|
return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
|
|
24028
24680
|
}
|
|
24029
|
-
function
|
|
24681
|
+
function wrap5(s, perLine) {
|
|
24030
24682
|
if (s.length <= perLine) return s;
|
|
24031
24683
|
const words = s.split(/\s+/);
|
|
24032
24684
|
const lines = [];
|
|
@@ -24616,7 +25268,7 @@ function renderIdef0Layout(layout, config) {
|
|
|
24616
25268
|
);
|
|
24617
25269
|
const children = [
|
|
24618
25270
|
chunk3WNW5Y7P_cjs.title(a11y),
|
|
24619
|
-
chunk3WNW5Y7P_cjs.desc(
|
|
25271
|
+
chunk3WNW5Y7P_cjs.desc(summarise9(layout)),
|
|
24620
25272
|
styleBlock,
|
|
24621
25273
|
chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-idef0-bg" })
|
|
24622
25274
|
];
|
|
@@ -24667,7 +25319,7 @@ function renderBox5(b) {
|
|
|
24667
25319
|
"text-anchor": "middle",
|
|
24668
25320
|
"dominant-baseline": "middle"
|
|
24669
25321
|
},
|
|
24670
|
-
|
|
25322
|
+
wrap6(b.box.name, 18),
|
|
24671
25323
|
14
|
|
24672
25324
|
),
|
|
24673
25325
|
// Box number in the lower-right interior corner.
|
|
@@ -24774,7 +25426,7 @@ function renderTitleBlock(width, height, node, title2) {
|
|
|
24774
25426
|
chunk3WNW5Y7P_cjs.text({ x: c2 + 6, y: y + 13, class: "sx-idef0-tb-key" }, "NUMBER")
|
|
24775
25427
|
]);
|
|
24776
25428
|
}
|
|
24777
|
-
function
|
|
25429
|
+
function summarise9(layout) {
|
|
24778
25430
|
const { ast } = layout;
|
|
24779
25431
|
const counts = {};
|
|
24780
25432
|
for (const a of ast.arrows) counts[a.role] = (counts[a.role] ?? 0) + 1;
|
|
@@ -24792,7 +25444,7 @@ function summarise8(layout) {
|
|
|
24792
25444
|
function clip5(s, n) {
|
|
24793
25445
|
return s.length <= n ? s : s.slice(0, n - 1) + "\u2026";
|
|
24794
25446
|
}
|
|
24795
|
-
function
|
|
25447
|
+
function wrap6(s, perLine) {
|
|
24796
25448
|
if (s.length <= perLine) return s;
|
|
24797
25449
|
const words = s.split(/\s+/);
|
|
24798
25450
|
const lines = [];
|
|
@@ -24839,7 +25491,7 @@ for (const [open, close] of Object.entries(chunkVHDSPI6A_cjs.QUOTE_PAIRS)) {
|
|
|
24839
25491
|
QUOTE_FOLD.set(close, '"');
|
|
24840
25492
|
}
|
|
24841
25493
|
}
|
|
24842
|
-
function
|
|
25494
|
+
function normalizeQuotes3(text2) {
|
|
24843
25495
|
let out = "";
|
|
24844
25496
|
for (const ch of text2) out += QUOTE_FOLD.get(ch) ?? ch;
|
|
24845
25497
|
return out;
|
|
@@ -24870,7 +25522,7 @@ function parseThreatModel(text2) {
|
|
|
24870
25522
|
flows: [],
|
|
24871
25523
|
boundaries: []
|
|
24872
25524
|
};
|
|
24873
|
-
const rawLines =
|
|
25525
|
+
const rawLines = normalizeQuotes3(text2).split(/\r?\n/);
|
|
24874
25526
|
const byId = /* @__PURE__ */ new Map();
|
|
24875
25527
|
const declareNode = (id, kind, label, lineNo, logStore) => {
|
|
24876
25528
|
if (byId.has(id)) {
|
|
@@ -25329,13 +25981,13 @@ function layoutThreatModel(ast) {
|
|
|
25329
25981
|
}
|
|
25330
25982
|
const boundaries = [];
|
|
25331
25983
|
for (const b of ast.boundaries) {
|
|
25332
|
-
let l = Infinity, t = Infinity,
|
|
25984
|
+
let l = Infinity, t = Infinity, r7 = -Infinity, bm = -Infinity;
|
|
25333
25985
|
for (const m of b.members) {
|
|
25334
25986
|
const mn = nodeMap.get(m);
|
|
25335
25987
|
if (!mn) continue;
|
|
25336
25988
|
l = Math.min(l, mn.x);
|
|
25337
25989
|
t = Math.min(t, mn.y);
|
|
25338
|
-
|
|
25990
|
+
r7 = Math.max(r7, mn.x + mn.w);
|
|
25339
25991
|
bm = Math.max(bm, mn.y + mn.h);
|
|
25340
25992
|
}
|
|
25341
25993
|
if (!Number.isFinite(l)) continue;
|
|
@@ -25344,7 +25996,7 @@ function layoutThreatModel(ast) {
|
|
|
25344
25996
|
name: b.name,
|
|
25345
25997
|
x: l - p,
|
|
25346
25998
|
y: t - p - TM_CONST.BOUNDARY_HEADER,
|
|
25347
|
-
w:
|
|
25999
|
+
w: r7 - l + p * 2,
|
|
25348
26000
|
h: bm - t + p * 2 + TM_CONST.BOUNDARY_HEADER
|
|
25349
26001
|
});
|
|
25350
26002
|
}
|
|
@@ -25378,9 +26030,9 @@ function edgePoint2(n, tx, ty) {
|
|
|
25378
26030
|
const dy = ty - n.cy;
|
|
25379
26031
|
if (dx === 0 && dy === 0) return { x: n.cx, y: n.cy };
|
|
25380
26032
|
if (n.kind === "process") {
|
|
25381
|
-
const
|
|
26033
|
+
const r7 = TM_CONST.PROCESS_R;
|
|
25382
26034
|
const len = Math.hypot(dx, dy);
|
|
25383
|
-
return { x: n.cx + dx / len *
|
|
26035
|
+
return { x: n.cx + dx / len * r7, y: n.cy + dy / len * r7 };
|
|
25384
26036
|
}
|
|
25385
26037
|
const hw = n.w / 2;
|
|
25386
26038
|
const hh = n.h / 2;
|
|
@@ -25435,7 +26087,7 @@ function renderThreatModelLayout(layout, config) {
|
|
|
25435
26087
|
]);
|
|
25436
26088
|
const children = [
|
|
25437
26089
|
chunk3WNW5Y7P_cjs.title(a11y),
|
|
25438
|
-
chunk3WNW5Y7P_cjs.desc(
|
|
26090
|
+
chunk3WNW5Y7P_cjs.desc(summarise10(layout)),
|
|
25439
26091
|
styleBlock,
|
|
25440
26092
|
markerDefs,
|
|
25441
26093
|
chunk3WNW5Y7P_cjs.rect({ x: 0, y: 0, width, height, class: "sx-tm-bg" })
|
|
@@ -25652,7 +26304,7 @@ function arrowMarker2(id, cls, crossing) {
|
|
|
25652
26304
|
function round8(n) {
|
|
25653
26305
|
return Math.round(n * 100) / 100;
|
|
25654
26306
|
}
|
|
25655
|
-
function
|
|
26307
|
+
function summarise10(layout) {
|
|
25656
26308
|
const a = layout.analysis;
|
|
25657
26309
|
const counts = {
|
|
25658
26310
|
external: layout.nodes.filter((n) => n.kind === "external").length,
|
|
@@ -26030,9 +26682,9 @@ function weldGlyph(type, cx, y, dir, cls) {
|
|
|
26030
26682
|
return [chunk3WNW5Y7P_cjs.path({ d: `M ${round9(cx - rr)} ${round9(y)} A ${round9(rr)} ${round9(rr)} 0 0 ${sweep} ${round9(cx + rr)} ${round9(y)}`, class: cls, fill: "none" })];
|
|
26031
26683
|
}
|
|
26032
26684
|
case "surfacing": {
|
|
26033
|
-
const
|
|
26685
|
+
const r7 = W / 4;
|
|
26034
26686
|
const yy = y + dir * 3;
|
|
26035
|
-
const bump = (off) => chunk3WNW5Y7P_cjs.path({ d: `M ${round9(cx - W / 2)} ${round9(off)} a ${round9(
|
|
26687
|
+
const bump = (off) => chunk3WNW5Y7P_cjs.path({ d: `M ${round9(cx - W / 2)} ${round9(off)} a ${round9(r7)} ${round9(r7)} 0 0 ${dir > 0 ? 1 : 0} ${round9(W / 2)} 0 a ${round9(r7)} ${round9(r7)} 0 0 ${dir > 0 ? 1 : 0} ${round9(W / 2)} 0`, class: cls, fill: "none" });
|
|
26036
26688
|
return [bump(y), bump(yy)];
|
|
26037
26689
|
}
|
|
26038
26690
|
case "edge":
|
|
@@ -26904,7 +27556,7 @@ function computeMaxLW(subtreeRoots, maxLabelWidth) {
|
|
|
26904
27556
|
if (maxLW[n.depth] === void 0 || m.width > maxLW[n.depth]) maxLW[n.depth] = m.width;
|
|
26905
27557
|
for (const c of n.children) walk(c);
|
|
26906
27558
|
};
|
|
26907
|
-
for (const
|
|
27559
|
+
for (const r7 of subtreeRoots) walk(r7);
|
|
26908
27560
|
return maxLW;
|
|
26909
27561
|
}
|
|
26910
27562
|
function buildColumns(maxLW, firstColStartX, rootDepth) {
|
|
@@ -27271,9 +27923,9 @@ function renderNode5(n, color, theme, fontFamily, orderClass) {
|
|
|
27271
27923
|
for (let i = 0; i < lineCount; i++) {
|
|
27272
27924
|
const line2 = n.lines[i];
|
|
27273
27925
|
const cy = topY + (i + 0.5) * lh;
|
|
27274
|
-
const
|
|
27275
|
-
decorations.push(...
|
|
27276
|
-
children.push(
|
|
27926
|
+
const r7 = renderLine2(line2, textLeft, cy, fs, fontFamily, weight, theme);
|
|
27927
|
+
decorations.push(...r7.decorations);
|
|
27928
|
+
children.push(r7.textElement);
|
|
27277
27929
|
}
|
|
27278
27930
|
const ux1 = n.x - n.labelWidth / 2;
|
|
27279
27931
|
const ux2 = n.x + n.labelWidth / 2;
|
|
@@ -27997,11 +28649,11 @@ function parseMatrix(text2) {
|
|
|
27997
28649
|
const gm = v.match(/^(\d+)\s*x\s*(\d+)$/);
|
|
27998
28650
|
if (gm) {
|
|
27999
28651
|
const c = Number(gm[1]);
|
|
28000
|
-
const
|
|
28652
|
+
const r7 = Number(gm[2]);
|
|
28001
28653
|
st.ast.cols = c;
|
|
28002
|
-
st.ast.rows =
|
|
28003
|
-
if (c === 2 &&
|
|
28004
|
-
else if (c === 3 &&
|
|
28654
|
+
st.ast.rows = r7;
|
|
28655
|
+
if (c === 2 && r7 === 2) st.ast.grid = "2x2";
|
|
28656
|
+
else if (c === 3 && r7 === 3) st.ast.grid = "3x3";
|
|
28005
28657
|
else st.ast.grid = "NxM";
|
|
28006
28658
|
}
|
|
28007
28659
|
continue;
|
|
@@ -28214,11 +28866,11 @@ function punnettFooter(result) {
|
|
|
28214
28866
|
}
|
|
28215
28867
|
function computeQfdImportance(qfd) {
|
|
28216
28868
|
const raw = qfd.hows.map(() => 0);
|
|
28217
|
-
for (const
|
|
28218
|
-
if (
|
|
28219
|
-
if (
|
|
28220
|
-
const w = qfd.whats[
|
|
28221
|
-
raw[
|
|
28869
|
+
for (const r7 of qfd.relationships) {
|
|
28870
|
+
if (r7.how < 0 || r7.how >= qfd.hows.length) continue;
|
|
28871
|
+
if (r7.what < 0 || r7.what >= qfd.whats.length) continue;
|
|
28872
|
+
const w = qfd.whats[r7.what].weight;
|
|
28873
|
+
raw[r7.how] += w * r7.strength;
|
|
28222
28874
|
}
|
|
28223
28875
|
const total = raw.reduce((acc, v) => acc + v, 0);
|
|
28224
28876
|
return raw.map((importance, how) => ({
|
|
@@ -28239,12 +28891,12 @@ function estimateWidth(text2) {
|
|
|
28239
28891
|
const cjk = (text2.match(/[\u3000-\u9fff]/g) ?? []).length;
|
|
28240
28892
|
return (text2.length - cjk) * CHAR_W2 + cjk * 12 + 8;
|
|
28241
28893
|
}
|
|
28242
|
-
function
|
|
28894
|
+
function clamp012(v) {
|
|
28243
28895
|
return Math.max(0.02, Math.min(0.98, v));
|
|
28244
28896
|
}
|
|
28245
28897
|
function placePoint(p, plot) {
|
|
28246
|
-
const nx =
|
|
28247
|
-
const ny =
|
|
28898
|
+
const nx = clamp012(p.x);
|
|
28899
|
+
const ny = clamp012(p.y);
|
|
28248
28900
|
const px = plot.x0 + nx * plot.w;
|
|
28249
28901
|
const py = plot.y0 + (1 - ny) * plot.h;
|
|
28250
28902
|
return { px, py };
|
|
@@ -28260,8 +28912,8 @@ function computeRadius(p, maxSize, plot, scale) {
|
|
|
28260
28912
|
}
|
|
28261
28913
|
const maxArea = Math.PI * maxRadius * maxRadius;
|
|
28262
28914
|
const area = ratio * maxArea;
|
|
28263
|
-
const
|
|
28264
|
-
return Math.max(minRadius,
|
|
28915
|
+
const r7 = Math.sqrt(area / Math.PI);
|
|
28916
|
+
return Math.max(minRadius, r7);
|
|
28265
28917
|
}
|
|
28266
28918
|
function resolveLabelCollisions(points, plot, mode) {
|
|
28267
28919
|
if (mode === "off") {
|
|
@@ -28462,20 +29114,20 @@ function layoutMatrix(ast) {
|
|
|
28462
29114
|
}
|
|
28463
29115
|
for (const p of ast.points) {
|
|
28464
29116
|
const { px, py } = placePoint(p, plot);
|
|
28465
|
-
const
|
|
29117
|
+
const r7 = computeRadius(p, maxSize, plot, ast.config.bubbleScale);
|
|
28466
29118
|
const width = estimateWidth(p.label);
|
|
28467
29119
|
const label = {
|
|
28468
29120
|
text: p.label,
|
|
28469
29121
|
ax: px,
|
|
28470
29122
|
ay: py,
|
|
28471
|
-
lx: px +
|
|
28472
|
-
ly: py -
|
|
29123
|
+
lx: px + r7 + 4 + width / 2,
|
|
29124
|
+
ly: py - r7 - 4,
|
|
28473
29125
|
width,
|
|
28474
29126
|
height: LABEL_H,
|
|
28475
29127
|
external: false,
|
|
28476
29128
|
textAnchor: "middle"
|
|
28477
29129
|
};
|
|
28478
|
-
points.push({ point: p, px, py, r:
|
|
29130
|
+
points.push({ point: p, px, py, r: r7, label });
|
|
28479
29131
|
if (p.category) categoriesSet.add(p.category);
|
|
28480
29132
|
}
|
|
28481
29133
|
resolveLabelCollisions(points, plot, ast.config.labelCollision);
|
|
@@ -28625,7 +29277,7 @@ function renderQuadrantBackground(ast, lay) {
|
|
|
28625
29277
|
return chunk3WNW5Y7P_cjs.group(
|
|
28626
29278
|
{ id: "sx-matrix-quad-bg" },
|
|
28627
29279
|
rects.map(
|
|
28628
|
-
(
|
|
29280
|
+
(r7) => chunk3WNW5Y7P_cjs.rect({ x: r7.x, y: r7.y, width: r7.w, height: r7.h, fill: r7.fill, "fill-opacity": 0.55 })
|
|
28629
29281
|
)
|
|
28630
29282
|
);
|
|
28631
29283
|
}
|
|
@@ -29277,9 +29929,9 @@ function renderOnePoint(pl2, categories) {
|
|
|
29277
29929
|
class: "sx-matrix-bubble"
|
|
29278
29930
|
});
|
|
29279
29931
|
} else if (shape === "diamond") {
|
|
29280
|
-
const
|
|
29932
|
+
const r7 = pl2.r;
|
|
29281
29933
|
shapeEl = chunk3WNW5Y7P_cjs.polygon({
|
|
29282
|
-
points: `${pl2.px},${pl2.py -
|
|
29934
|
+
points: `${pl2.px},${pl2.py - r7} ${pl2.px + r7},${pl2.py} ${pl2.px},${pl2.py + r7} ${pl2.px - r7},${pl2.py}`,
|
|
29283
29935
|
fill: color,
|
|
29284
29936
|
"fill-opacity": fillOpacity,
|
|
29285
29937
|
stroke,
|
|
@@ -29287,9 +29939,9 @@ function renderOnePoint(pl2, categories) {
|
|
|
29287
29939
|
class: "sx-matrix-bubble"
|
|
29288
29940
|
});
|
|
29289
29941
|
} else {
|
|
29290
|
-
const
|
|
29942
|
+
const r7 = pl2.r;
|
|
29291
29943
|
shapeEl = chunk3WNW5Y7P_cjs.polygon({
|
|
29292
|
-
points: `${pl2.px},${pl2.py -
|
|
29944
|
+
points: `${pl2.px},${pl2.py - r7} ${pl2.px + r7},${pl2.py + r7 * 0.8} ${pl2.px - r7},${pl2.py + r7 * 0.8}`,
|
|
29293
29945
|
fill: color,
|
|
29294
29946
|
"fill-opacity": fillOpacity,
|
|
29295
29947
|
stroke,
|
|
@@ -29421,15 +30073,15 @@ function renderSipocAST(ast, config) {
|
|
|
29421
30073
|
const items = sipoc[def.key];
|
|
29422
30074
|
const isProcess = def.key === "process";
|
|
29423
30075
|
const cellNodes = [];
|
|
29424
|
-
for (let
|
|
29425
|
-
const cellY = lay.y0 + lay.headerH +
|
|
29426
|
-
const item = items[
|
|
29427
|
-
const cellClass = isProcess ? "sx-sipoc-process" :
|
|
30076
|
+
for (let r7 = 0; r7 < lay.rows; r7++) {
|
|
30077
|
+
const cellY = lay.y0 + lay.headerH + r7 * lay.rowH;
|
|
30078
|
+
const item = items[r7];
|
|
30079
|
+
const cellClass = isProcess ? "sx-sipoc-process" : r7 % 2 === 0 ? "sx-sipoc-cell" : "sx-sipoc-cell-alt";
|
|
29428
30080
|
cellNodes.push(
|
|
29429
30081
|
chunk3WNW5Y7P_cjs.rect({ x: colX, y: cellY, width: lay.colW, height: lay.rowH, class: cellClass })
|
|
29430
30082
|
);
|
|
29431
30083
|
if (item) {
|
|
29432
|
-
const label = isProcess ? `${
|
|
30084
|
+
const label = isProcess ? `${r7 + 1}. ${item}` : item;
|
|
29433
30085
|
const lines = wrapToLines(label, maxChars, 2);
|
|
29434
30086
|
const lineH = 14;
|
|
29435
30087
|
const startY = cellY + lay.rowH / 2 - (lines.length - 1) * lineH / 2;
|
|
@@ -29492,17 +30144,17 @@ var CORR_LABEL = {
|
|
|
29492
30144
|
"-": "negative",
|
|
29493
30145
|
"--": "strong negative"
|
|
29494
30146
|
};
|
|
29495
|
-
function renderQfdRelationshipSymbol(strength, cx, cy,
|
|
30147
|
+
function renderQfdRelationshipSymbol(strength, cx, cy, r7) {
|
|
29496
30148
|
if (strength === 9) {
|
|
29497
30149
|
return chunk3WNW5Y7P_cjs.group({}, [
|
|
29498
|
-
chunk3WNW5Y7P_cjs.circle({ cx, cy, r:
|
|
29499
|
-
chunk3WNW5Y7P_cjs.circle({ cx, cy, r:
|
|
30150
|
+
chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r7, fill: "none", stroke: "#2563eb", "stroke-width": 1.4 }),
|
|
30151
|
+
chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r7 * 0.5, class: "sx-qfd-rel-strong" })
|
|
29500
30152
|
]);
|
|
29501
30153
|
}
|
|
29502
30154
|
if (strength === 3) {
|
|
29503
|
-
return chunk3WNW5Y7P_cjs.circle({ cx, cy, r:
|
|
30155
|
+
return chunk3WNW5Y7P_cjs.circle({ cx, cy, r: r7, class: "sx-qfd-rel-medium" });
|
|
29504
30156
|
}
|
|
29505
|
-
const t =
|
|
30157
|
+
const t = r7 * 0.95;
|
|
29506
30158
|
return chunk3WNW5Y7P_cjs.polygon({
|
|
29507
30159
|
points: `${cx},${cy - t} ${cx + t},${cy + t * 0.85} ${cx - t},${cy + t * 0.85}`,
|
|
29508
30160
|
class: "sx-qfd-rel-weak"
|
|
@@ -29600,15 +30252,15 @@ function renderQfdAST(ast, config) {
|
|
|
29600
30252
|
)
|
|
29601
30253
|
);
|
|
29602
30254
|
const gridNodes = [];
|
|
29603
|
-
for (let
|
|
29604
|
-
const y = lay.gridY0 +
|
|
30255
|
+
for (let r7 = 0; r7 < lay.rows; r7++) {
|
|
30256
|
+
const y = lay.gridY0 + r7 * lay.cellH;
|
|
29605
30257
|
gridNodes.push(
|
|
29606
30258
|
chunk3WNW5Y7P_cjs.rect({
|
|
29607
30259
|
x: lay.gridX0,
|
|
29608
30260
|
y,
|
|
29609
30261
|
width: lay.cols * lay.cellW,
|
|
29610
30262
|
height: lay.cellH,
|
|
29611
|
-
class:
|
|
30263
|
+
class: r7 % 2 === 0 ? "sx-qfd-cellbg" : "sx-qfd-cellbg-alt"
|
|
29612
30264
|
})
|
|
29613
30265
|
);
|
|
29614
30266
|
}
|
|
@@ -29786,18 +30438,18 @@ function renderPunnettAST(ast, config) {
|
|
|
29786
30438
|
nodes.push(chunk3WNW5Y7P_cjs.rect({ x: cx, y: lay.y0, width: lay.cellW, height: lay.headerH, class: "sx-punnett-header" }));
|
|
29787
30439
|
nodes.push(chunk3WNW5Y7P_cjs.text({ x: cx + lay.cellW / 2, y: lay.y0 + lay.headerH / 2, class: "sx-punnett-gamete" }, g));
|
|
29788
30440
|
});
|
|
29789
|
-
result.gametes2.forEach((g,
|
|
29790
|
-
const cy = gy0 +
|
|
30441
|
+
result.gametes2.forEach((g, r7) => {
|
|
30442
|
+
const cy = gy0 + r7 * lay.cellH;
|
|
29791
30443
|
nodes.push(chunk3WNW5Y7P_cjs.rect({ x: lay.x0, y: cy, width: lay.headerW, height: lay.cellH, class: "sx-punnett-header" }));
|
|
29792
30444
|
nodes.push(chunk3WNW5Y7P_cjs.text({ x: lay.x0 + lay.headerW / 2, y: cy + lay.cellH / 2, class: "sx-punnett-gamete" }, g));
|
|
29793
30445
|
});
|
|
29794
|
-
for (let
|
|
29795
|
-
const row = result.grid[
|
|
30446
|
+
for (let r7 = 0; r7 < result.grid.length; r7++) {
|
|
30447
|
+
const row = result.grid[r7];
|
|
29796
30448
|
for (let c = 0; c < row.length; c++) {
|
|
29797
30449
|
const cell = row[c];
|
|
29798
30450
|
const color = phenoColor.get(cell.phenotypeKey);
|
|
29799
30451
|
const cx = gx0 + c * lay.cellW;
|
|
29800
|
-
const cy = gy0 +
|
|
30452
|
+
const cy = gy0 + r7 * lay.cellH;
|
|
29801
30453
|
nodes.push(chunk3WNW5Y7P_cjs.rect({ x: cx, y: cy, width: lay.cellW, height: lay.cellH, fill: color.tint, class: "sx-punnett-cell" }));
|
|
29802
30454
|
nodes.push(chunk3WNW5Y7P_cjs.text({ x: cx + lay.cellW / 2, y: cy + lay.cellH / 2, class: "sx-punnett-genotype" }, cell.genotype));
|
|
29803
30455
|
}
|
|
@@ -30350,12 +31002,12 @@ function buildColumnAssignment(ast) {
|
|
|
30350
31002
|
const ids = ast.entities.map((e) => e.id);
|
|
30351
31003
|
const idToIdx = new Map(ids.map((id, i) => [id, i]));
|
|
30352
31004
|
const pairs = [];
|
|
30353
|
-
for (const
|
|
30354
|
-
const f = parseRefSide(
|
|
30355
|
-
const t = parseRefSide(
|
|
31005
|
+
for (const r7 of ast.refs) {
|
|
31006
|
+
const f = parseRefSide(r7.from);
|
|
31007
|
+
const t = parseRefSide(r7.to);
|
|
30356
31008
|
if (idToIdx.has(f.table) && idToIdx.has(t.table)) {
|
|
30357
|
-
const oneIsTo = isOne(
|
|
30358
|
-
const oneIsFrom = isOne(
|
|
31009
|
+
const oneIsTo = isOne(r7.toCard) && !isOne(r7.fromCard);
|
|
31010
|
+
const oneIsFrom = isOne(r7.fromCard) && !isOne(r7.toCard);
|
|
30359
31011
|
if (oneIsTo) pairs.push({ from: t.table, to: f.table });
|
|
30360
31012
|
else if (oneIsFrom) pairs.push({ from: f.table, to: t.table });
|
|
30361
31013
|
else pairs.push({ from: f.table, to: t.table });
|
|
@@ -30390,9 +31042,9 @@ function isOne(c) {
|
|
|
30390
31042
|
function reorderByBarycenter(layerToEnts, layers, refs) {
|
|
30391
31043
|
if (layers.length < 2) return;
|
|
30392
31044
|
const neighbors = /* @__PURE__ */ new Map();
|
|
30393
|
-
for (const
|
|
30394
|
-
const a = parseRefSide(
|
|
30395
|
-
const b = parseRefSide(
|
|
31045
|
+
for (const r7 of refs) {
|
|
31046
|
+
const a = parseRefSide(r7.from).table;
|
|
31047
|
+
const b = parseRefSide(r7.to).table;
|
|
30396
31048
|
if (!neighbors.has(a)) neighbors.set(a, /* @__PURE__ */ new Set());
|
|
30397
31049
|
if (!neighbors.has(b)) neighbors.set(b, /* @__PURE__ */ new Set());
|
|
30398
31050
|
neighbors.get(a).add(b);
|
|
@@ -30522,9 +31174,9 @@ function layoutErd(ast) {
|
|
|
30522
31174
|
const layers = Array.from(layerToEnts.keys()).sort((a, b) => a - b);
|
|
30523
31175
|
reorderByBarycenter(layerToEnts, layers, ast.refs);
|
|
30524
31176
|
const neighbors = /* @__PURE__ */ new Map();
|
|
30525
|
-
for (const
|
|
30526
|
-
const a = parseRefSide(
|
|
30527
|
-
const b = parseRefSide(
|
|
31177
|
+
for (const r7 of ast.refs) {
|
|
31178
|
+
const a = parseRefSide(r7.from).table;
|
|
31179
|
+
const b = parseRefSide(r7.to).table;
|
|
30528
31180
|
if (!neighbors.has(a)) neighbors.set(a, /* @__PURE__ */ new Set());
|
|
30529
31181
|
if (!neighbors.has(b)) neighbors.set(b, /* @__PURE__ */ new Set());
|
|
30530
31182
|
neighbors.get(a).add(b);
|
|
@@ -30602,17 +31254,17 @@ function layoutErd(ast) {
|
|
|
30602
31254
|
const placedById = new Map(placed.map((p) => [p.entity.id, p]));
|
|
30603
31255
|
const edges = [];
|
|
30604
31256
|
const bendBucketUses = /* @__PURE__ */ new Map();
|
|
30605
|
-
for (const
|
|
30606
|
-
const fromTable = parseRefSide(
|
|
30607
|
-
const toTable = parseRefSide(
|
|
31257
|
+
for (const r7 of ast.refs) {
|
|
31258
|
+
const fromTable = parseRefSide(r7.from).table;
|
|
31259
|
+
const toTable = parseRefSide(r7.to).table;
|
|
30608
31260
|
const a = placedById.get(fromTable);
|
|
30609
31261
|
const b = placedById.get(toTable);
|
|
30610
31262
|
if (!a || !b) continue;
|
|
30611
|
-
const fromCol = parseRefSide(
|
|
30612
|
-
const toCol = parseRefSide(
|
|
31263
|
+
const fromCol = parseRefSide(r7.from).column;
|
|
31264
|
+
const toCol = parseRefSide(r7.to).column;
|
|
30613
31265
|
const route = routeOrthogonal(a, b, fromCol, toCol, bendBucketUses);
|
|
30614
31266
|
edges.push({
|
|
30615
|
-
ref:
|
|
31267
|
+
ref: r7,
|
|
30616
31268
|
path: route.path,
|
|
30617
31269
|
fromAnchor: route.fromAnchor,
|
|
30618
31270
|
toAnchor: route.toAnchor,
|
|
@@ -30629,7 +31281,7 @@ function layoutErd(ast) {
|
|
|
30629
31281
|
}
|
|
30630
31282
|
function rowYByColumn(e, col) {
|
|
30631
31283
|
if (col) {
|
|
30632
|
-
const idx = e.rows.findIndex((
|
|
31284
|
+
const idx = e.rows.findIndex((r7) => r7.attribute.name.toLowerCase() === col.toLowerCase());
|
|
30633
31285
|
if (idx >= 0) return e.y + e.rows[idx].yCenter;
|
|
30634
31286
|
}
|
|
30635
31287
|
return e.y + e.height / 2;
|
|
@@ -31409,8 +32061,8 @@ var PITCH = 14;
|
|
|
31409
32061
|
function rectShape(x, y, w, h, attrs) {
|
|
31410
32062
|
return chunk3WNW5Y7P_cjs.el("rect", { x, y, width: w, height: h, ...attrs });
|
|
31411
32063
|
}
|
|
31412
|
-
function circShape(cx, cy,
|
|
31413
|
-
return chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r:
|
|
32064
|
+
function circShape(cx, cy, r7, attrs) {
|
|
32065
|
+
return chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r7, ...attrs });
|
|
31414
32066
|
}
|
|
31415
32067
|
function lineShape(x1, y1, x2, y2, attrs) {
|
|
31416
32068
|
return chunk3WNW5Y7P_cjs.el("line", { x1, y1, x2, y2, ...attrs });
|
|
@@ -32131,13 +32783,13 @@ function renderSubstrate(sub) {
|
|
|
32131
32783
|
{ y: sub.y + BB_CONST.BOARD_PAD_Y, type: "top" },
|
|
32132
32784
|
{ y: sub.y + sub.height - BB_CONST.BOARD_PAD_Y - BB_CONST.RAIL_HEIGHT, type: "bottom" }
|
|
32133
32785
|
];
|
|
32134
|
-
for (const
|
|
32786
|
+
for (const r7 of rails) {
|
|
32135
32787
|
elements.push(chunk3WNW5Y7P_cjs.path({
|
|
32136
|
-
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${
|
|
32788
|
+
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r7.y + 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r7.y + 4}`,
|
|
32137
32789
|
class: "lt-bb-rail-stripe-pos"
|
|
32138
32790
|
}));
|
|
32139
32791
|
elements.push(chunk3WNW5Y7P_cjs.path({
|
|
32140
|
-
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${
|
|
32792
|
+
d: `M ${sub.x + BB_CONST.BOARD_PAD_X} ${r7.y + BB_CONST.RAIL_HEIGHT - 4} L ${sub.x + sub.width - BB_CONST.BOARD_PAD_X} ${r7.y + BB_CONST.RAIL_HEIGHT - 4}`,
|
|
32141
32793
|
class: "lt-bb-rail-stripe-neg"
|
|
32142
32794
|
}));
|
|
32143
32795
|
if (sub.railsBreak) {
|
|
@@ -32145,7 +32797,7 @@ function renderSubstrate(sub) {
|
|
|
32145
32797
|
const breakX2 = breakX1 + PITCH2;
|
|
32146
32798
|
elements.push(chunk3WNW5Y7P_cjs.rect({
|
|
32147
32799
|
x: breakX1,
|
|
32148
|
-
y:
|
|
32800
|
+
y: r7.y,
|
|
32149
32801
|
width: breakX2 - breakX1,
|
|
32150
32802
|
height: BB_CONST.RAIL_HEIGHT,
|
|
32151
32803
|
fill: "#e7d8b6"
|
|
@@ -32153,8 +32805,8 @@ function renderSubstrate(sub) {
|
|
|
32153
32805
|
}
|
|
32154
32806
|
for (let c = 1; c <= sub.cols; c++) {
|
|
32155
32807
|
const cx = sub.x + BB_CONST.BOARD_PAD_X + BB_CONST.ROW_LABEL_W + PITCH2 / 2 + (c - 1) * PITCH2;
|
|
32156
|
-
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy:
|
|
32157
|
-
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy:
|
|
32808
|
+
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r7.y + 4, r: 1.4, class: "lt-bb-hole-rail" }));
|
|
32809
|
+
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy: r7.y + BB_CONST.RAIL_HEIGHT - 4, r: 1.4, class: "lt-bb-hole-rail" }));
|
|
32158
32810
|
}
|
|
32159
32811
|
}
|
|
32160
32812
|
}
|
|
@@ -32181,10 +32833,10 @@ function renderSubstrate(sub) {
|
|
|
32181
32833
|
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]));
|
|
32182
32834
|
}
|
|
32183
32835
|
for (let c = 1; c <= sub.cols; c++) {
|
|
32184
|
-
for (let
|
|
32836
|
+
for (let r7 = 0; r7 < 10; r7++) {
|
|
32185
32837
|
const cx = sub.x + BB_CONST.BOARD_PAD_X + BB_CONST.ROW_LABEL_W + PITCH2 / 2 + (c - 1) * PITCH2;
|
|
32186
|
-
let cy = gridY0 +
|
|
32187
|
-
if (
|
|
32838
|
+
let cy = gridY0 + r7 * PITCH2;
|
|
32839
|
+
if (r7 >= 5) cy += BB_CONST.TROUGH;
|
|
32188
32840
|
elements.push(chunk3WNW5Y7P_cjs.circle({ cx, cy, r: 1.6, class: "lt-bb-hole" }));
|
|
32189
32841
|
}
|
|
32190
32842
|
}
|
|
@@ -32686,34 +33338,34 @@ function parseFlowLine(ln, flows, objectOwner, poolByLabel) {
|
|
|
32686
33338
|
connectorLen = 3;
|
|
32687
33339
|
} else if (rest.startsWith("--?")) {
|
|
32688
33340
|
kind = "conditional";
|
|
32689
|
-
let
|
|
32690
|
-
const q = takeQuoted(
|
|
33341
|
+
let r7 = rest.slice(3).trimStart();
|
|
33342
|
+
const q = takeQuoted(r7);
|
|
32691
33343
|
if (q) {
|
|
32692
33344
|
connectorLabel = q.value;
|
|
32693
|
-
|
|
33345
|
+
r7 = q.rest.trimStart();
|
|
32694
33346
|
}
|
|
32695
|
-
if (!
|
|
33347
|
+
if (!r7.startsWith("-->")) {
|
|
32696
33348
|
throw new BpmnParseError(
|
|
32697
|
-
`conditional flow must end with --> (got '${
|
|
33349
|
+
`conditional flow must end with --> (got '${r7.slice(0, 20)}')`,
|
|
32698
33350
|
ln.no
|
|
32699
33351
|
);
|
|
32700
33352
|
}
|
|
32701
|
-
connectorLen = rest.length -
|
|
33353
|
+
connectorLen = rest.length - r7.length + 3;
|
|
32702
33354
|
} else if (rest.startsWith("--*")) {
|
|
32703
33355
|
kind = "default";
|
|
32704
|
-
let
|
|
32705
|
-
const q = takeQuoted(
|
|
33356
|
+
let r7 = rest.slice(3).trimStart();
|
|
33357
|
+
const q = takeQuoted(r7);
|
|
32706
33358
|
if (q) {
|
|
32707
33359
|
connectorLabel = q.value;
|
|
32708
|
-
|
|
33360
|
+
r7 = q.rest.trimStart();
|
|
32709
33361
|
}
|
|
32710
|
-
if (!
|
|
33362
|
+
if (!r7.startsWith("-->")) {
|
|
32711
33363
|
throw new BpmnParseError(
|
|
32712
|
-
`default flow must end with --> (got '${
|
|
33364
|
+
`default flow must end with --> (got '${r7.slice(0, 20)}')`,
|
|
32713
33365
|
ln.no
|
|
32714
33366
|
);
|
|
32715
33367
|
}
|
|
32716
|
-
connectorLen = rest.length -
|
|
33368
|
+
connectorLen = rest.length - r7.length + 3;
|
|
32717
33369
|
} else if (rest.startsWith("-->")) {
|
|
32718
33370
|
kind = "sequence";
|
|
32719
33371
|
connectorLen = 3;
|
|
@@ -32806,8 +33458,8 @@ function objBox(o) {
|
|
|
32806
33458
|
if ("gatewayKind" in o) {
|
|
32807
33459
|
return { w: BPMN_CONST.gatewaySize, h: BPMN_CONST.gatewaySize };
|
|
32808
33460
|
}
|
|
32809
|
-
const
|
|
32810
|
-
return { w:
|
|
33461
|
+
const r7 = BPMN_CONST.eventRadius;
|
|
33462
|
+
return { w: r7 * 2, h: r7 * 2 };
|
|
32811
33463
|
}
|
|
32812
33464
|
function layoutBpmn(ast) {
|
|
32813
33465
|
const allObjects = [
|
|
@@ -33418,11 +34070,11 @@ function renderGateway(ol, t) {
|
|
|
33418
34070
|
const g = ol.obj;
|
|
33419
34071
|
const cx = ol.x + ol.width / 2;
|
|
33420
34072
|
const cy = ol.y + ol.height / 2;
|
|
33421
|
-
const
|
|
33422
|
-
const points = `${cx},${cy -
|
|
34073
|
+
const r7 = ol.width / 2;
|
|
34074
|
+
const points = `${cx},${cy - r7} ${cx + r7},${cy} ${cx},${cy + r7} ${cx - r7},${cy}`;
|
|
33423
34075
|
const inner = [];
|
|
33424
34076
|
if (g.gatewayKind === "xor") {
|
|
33425
|
-
const a =
|
|
34077
|
+
const a = r7 * 0.42;
|
|
33426
34078
|
inner.push(
|
|
33427
34079
|
chunk3WNW5Y7P_cjs.el("path", {
|
|
33428
34080
|
d: `M ${cx - a} ${cy - a} L ${cx + a} ${cy + a} M ${cx + a} ${cy - a} L ${cx - a} ${cy + a}`,
|
|
@@ -33432,7 +34084,7 @@ function renderGateway(ol, t) {
|
|
|
33432
34084
|
})
|
|
33433
34085
|
);
|
|
33434
34086
|
} else if (g.gatewayKind === "and") {
|
|
33435
|
-
const a =
|
|
34087
|
+
const a = r7 * 0.5;
|
|
33436
34088
|
inner.push(
|
|
33437
34089
|
chunk3WNW5Y7P_cjs.el("path", {
|
|
33438
34090
|
d: `M ${cx - a} ${cy} L ${cx + a} ${cy} M ${cx} ${cy - a} L ${cx} ${cy + a}`,
|
|
@@ -33446,7 +34098,7 @@ function renderGateway(ol, t) {
|
|
|
33446
34098
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
33447
34099
|
cx,
|
|
33448
34100
|
cy,
|
|
33449
|
-
r:
|
|
34101
|
+
r: r7 * 0.45,
|
|
33450
34102
|
fill: "none",
|
|
33451
34103
|
stroke: t.gatewayGlyph,
|
|
33452
34104
|
"stroke-width": 2
|
|
@@ -33457,13 +34109,13 @@ function renderGateway(ol, t) {
|
|
|
33457
34109
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
33458
34110
|
cx,
|
|
33459
34111
|
cy,
|
|
33460
|
-
r:
|
|
34112
|
+
r: r7 * 0.55,
|
|
33461
34113
|
fill: "none",
|
|
33462
34114
|
stroke: t.gatewayGlyph,
|
|
33463
34115
|
"stroke-width": 1
|
|
33464
34116
|
})
|
|
33465
34117
|
);
|
|
33466
|
-
const pr =
|
|
34118
|
+
const pr = r7 * 0.32;
|
|
33467
34119
|
const pts = [];
|
|
33468
34120
|
for (let k = 0; k < 5; k++) {
|
|
33469
34121
|
const ang = -Math.PI / 2 + k * 2 * Math.PI / 5;
|
|
@@ -33505,7 +34157,7 @@ function renderEvent2(ol, t) {
|
|
|
33505
34157
|
const e = ol.obj;
|
|
33506
34158
|
const cx = ol.x + ol.width / 2;
|
|
33507
34159
|
const cy = ol.y + ol.height / 2;
|
|
33508
|
-
const
|
|
34160
|
+
const r7 = ol.width / 2;
|
|
33509
34161
|
const isEnd = e.kind === "end";
|
|
33510
34162
|
const isIntermediate = e.kind === "intermediate";
|
|
33511
34163
|
const strokeW = isEnd ? 3 : 1.2;
|
|
@@ -33516,7 +34168,7 @@ function renderEvent2(ol, t) {
|
|
|
33516
34168
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
33517
34169
|
cx,
|
|
33518
34170
|
cy,
|
|
33519
|
-
r:
|
|
34171
|
+
r: r7,
|
|
33520
34172
|
fill,
|
|
33521
34173
|
stroke: ring,
|
|
33522
34174
|
"stroke-width": strokeW
|
|
@@ -33527,7 +34179,7 @@ function renderEvent2(ol, t) {
|
|
|
33527
34179
|
chunk3WNW5Y7P_cjs.el("circle", {
|
|
33528
34180
|
cx,
|
|
33529
34181
|
cy,
|
|
33530
|
-
r:
|
|
34182
|
+
r: r7 - 3,
|
|
33531
34183
|
fill: "none",
|
|
33532
34184
|
stroke: ring,
|
|
33533
34185
|
"stroke-width": 1.2
|
|
@@ -33536,9 +34188,9 @@ function renderEvent2(ol, t) {
|
|
|
33536
34188
|
}
|
|
33537
34189
|
const filled = e.throwCatch === "throw" && (isIntermediate || isEnd);
|
|
33538
34190
|
if (e.trigger === "message") {
|
|
33539
|
-
children.push(messageGlyph(cx, cy,
|
|
34191
|
+
children.push(messageGlyph(cx, cy, r7 * 0.55, filled, t));
|
|
33540
34192
|
} else if (e.trigger === "timer") {
|
|
33541
|
-
children.push(timerGlyph(cx, cy,
|
|
34193
|
+
children.push(timerGlyph(cx, cy, r7 * 0.55, t));
|
|
33542
34194
|
}
|
|
33543
34195
|
if (e.label) {
|
|
33544
34196
|
children.push(
|
|
@@ -33581,22 +34233,22 @@ function messageGlyph(cx, cy, size, filled, t) {
|
|
|
33581
34233
|
]);
|
|
33582
34234
|
}
|
|
33583
34235
|
function timerGlyph(cx, cy, size, t) {
|
|
33584
|
-
const
|
|
34236
|
+
const r7 = size / 2;
|
|
33585
34237
|
const ticks = [];
|
|
33586
34238
|
for (let k = 0; k < 12; k++) {
|
|
33587
34239
|
const ang = k * Math.PI / 6 - Math.PI / 2;
|
|
33588
|
-
const t1x = cx + (
|
|
33589
|
-
const t1y = cy + (
|
|
33590
|
-
const t2x = cx +
|
|
33591
|
-
const t2y = cy +
|
|
34240
|
+
const t1x = cx + (r7 - 1.5) * Math.cos(ang);
|
|
34241
|
+
const t1y = cy + (r7 - 1.5) * Math.sin(ang);
|
|
34242
|
+
const t2x = cx + r7 * Math.cos(ang);
|
|
34243
|
+
const t2y = cy + r7 * Math.sin(ang);
|
|
33592
34244
|
ticks.push(`M ${t1x} ${t1y} L ${t2x} ${t2y}`);
|
|
33593
34245
|
}
|
|
33594
34246
|
return chunk3WNW5Y7P_cjs.el("g", { class: "trigger-timer" }, [
|
|
33595
|
-
chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r:
|
|
34247
|
+
chunk3WNW5Y7P_cjs.el("circle", { cx, cy, r: r7, fill: "none", stroke: t.bpmnStroke, "stroke-width": 1 }),
|
|
33596
34248
|
chunk3WNW5Y7P_cjs.el("path", { d: ticks.join(" "), stroke: t.bpmnStroke, "stroke-width": 0.8 }),
|
|
33597
34249
|
// Hands
|
|
33598
34250
|
chunk3WNW5Y7P_cjs.el("path", {
|
|
33599
|
-
d: `M ${cx} ${cy} L ${cx} ${cy -
|
|
34251
|
+
d: `M ${cx} ${cy} L ${cx} ${cy - r7 * 0.7} M ${cx} ${cy} L ${cx + r7 * 0.5} ${cy}`,
|
|
33600
34252
|
stroke: t.bpmnStroke,
|
|
33601
34253
|
"stroke-width": 1.2,
|
|
33602
34254
|
"stroke-linecap": "round"
|
|
@@ -33667,8 +34319,8 @@ function parseStart(d) {
|
|
|
33667
34319
|
if (!m) return null;
|
|
33668
34320
|
return { x: parseFloat(m[1]), y: parseFloat(m[2]) };
|
|
33669
34321
|
}
|
|
33670
|
-
function diamondPoints(cx, cy,
|
|
33671
|
-
return `${cx -
|
|
34322
|
+
function diamondPoints(cx, cy, r7) {
|
|
34323
|
+
return `${cx - r7},${cy} ${cx},${cy - r7} ${cx + r7},${cy} ${cx},${cy + r7}`;
|
|
33672
34324
|
}
|
|
33673
34325
|
|
|
33674
34326
|
// src/diagrams/bpmn/index.ts
|
|
@@ -34871,7 +35523,7 @@ function wireClass(t) {
|
|
|
34871
35523
|
return "lt-fbd-wire-any";
|
|
34872
35524
|
}
|
|
34873
35525
|
}
|
|
34874
|
-
function
|
|
35526
|
+
function renderBlock2(lb) {
|
|
34875
35527
|
const { x, y, width, height, block } = lb;
|
|
34876
35528
|
const headerH = FBD_CONST.block_header_h;
|
|
34877
35529
|
const parts = [];
|
|
@@ -35007,7 +35659,7 @@ function renderNetwork2(ln) {
|
|
|
35007
35659
|
for (const j of ln.junctions) {
|
|
35008
35660
|
parts.push(chunk3WNW5Y7P_cjs.circle({ class: "lt-fbd-junction", cx: j.x, cy: j.y, r: 3 }));
|
|
35009
35661
|
}
|
|
35010
|
-
for (const b of ln.blocks) parts.push(
|
|
35662
|
+
for (const b of ln.blocks) parts.push(renderBlock2(b));
|
|
35011
35663
|
return chunk3WNW5Y7P_cjs.group({ class: "lt-fbd-network", "data-network": ln.network.index }, parts);
|
|
35012
35664
|
}
|
|
35013
35665
|
function renderFbdLayout(layout) {
|
|
@@ -36077,14 +36729,14 @@ function roundTable(seats, diaM) {
|
|
|
36077
36729
|
draw: (c) => {
|
|
36078
36730
|
const half = Math.min(c.w, c.h) / 2;
|
|
36079
36731
|
const ring = Math.min(RING, half * 0.37);
|
|
36080
|
-
const
|
|
36732
|
+
const r7 = half - ring;
|
|
36081
36733
|
const cx = c.w / 2;
|
|
36082
36734
|
const cy = c.h / 2;
|
|
36083
|
-
const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(
|
|
36735
|
+
const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) })];
|
|
36084
36736
|
for (let i = 0; i < seats; i++) {
|
|
36085
36737
|
const a = i / seats * 2 * Math.PI - Math.PI / 2;
|
|
36086
|
-
const px0 = cx + (
|
|
36087
|
-
const py0 = cy + (
|
|
36738
|
+
const px0 = cx + (r7 + ring * 0.55) * Math.cos(a);
|
|
36739
|
+
const py0 = cy + (r7 + ring * 0.55) * Math.sin(a);
|
|
36088
36740
|
parts.push(chairAt(c.px, px0, py0, a * 180 / Math.PI + 90));
|
|
36089
36741
|
}
|
|
36090
36742
|
return parts.join("");
|
|
@@ -36234,11 +36886,11 @@ function uStairs(c) {
|
|
|
36234
36886
|
return parts.join("");
|
|
36235
36887
|
}
|
|
36236
36888
|
function spiralStairs(c) {
|
|
36237
|
-
const
|
|
36889
|
+
const r7 = Math.min(c.w, c.h) / 2 - 0.02;
|
|
36238
36890
|
const cx = c.w / 2;
|
|
36239
36891
|
const cy = c.h / 2;
|
|
36240
36892
|
const parts = [
|
|
36241
|
-
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(
|
|
36893
|
+
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) }),
|
|
36242
36894
|
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-line", cx: c.px(cx), cy: c.px(cy), r: c.px(0.08) })
|
|
36243
36895
|
];
|
|
36244
36896
|
for (let i = 0; i < 12; i++) {
|
|
@@ -36248,12 +36900,12 @@ function spiralStairs(c) {
|
|
|
36248
36900
|
class: "sx-fp-furn-line",
|
|
36249
36901
|
x1: c.px(cx + 0.08 * Math.cos(a)),
|
|
36250
36902
|
y1: c.px(cy + 0.08 * Math.sin(a)),
|
|
36251
|
-
x2: c.px(cx +
|
|
36252
|
-
y2: c.px(cy +
|
|
36903
|
+
x2: c.px(cx + r7 * Math.cos(a)),
|
|
36904
|
+
y2: c.px(cy + r7 * Math.sin(a))
|
|
36253
36905
|
})
|
|
36254
36906
|
);
|
|
36255
36907
|
}
|
|
36256
|
-
const wr =
|
|
36908
|
+
const wr = r7 * 0.62;
|
|
36257
36909
|
const a0 = Math.PI * 0.75;
|
|
36258
36910
|
const a1 = Math.PI * 1.9;
|
|
36259
36911
|
const steps = 5;
|
|
@@ -36325,8 +36977,8 @@ var FLOORPLAN_SYMBOLS = {
|
|
|
36325
36977
|
w: 0.5,
|
|
36326
36978
|
h: 0.5,
|
|
36327
36979
|
draw: (c) => {
|
|
36328
|
-
const
|
|
36329
|
-
const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(
|
|
36980
|
+
const r7 = Math.min(c.w, c.h) / 2;
|
|
36981
|
+
const parts = [chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7) })];
|
|
36330
36982
|
for (const a of [0, 60, 120, 180, 240, 300]) {
|
|
36331
36983
|
const rad = a * Math.PI / 180;
|
|
36332
36984
|
parts.push(
|
|
@@ -36334,8 +36986,8 @@ var FLOORPLAN_SYMBOLS = {
|
|
|
36334
36986
|
class: "sx-fp-furn-line",
|
|
36335
36987
|
x1: c.px(c.w / 2),
|
|
36336
36988
|
y1: c.px(c.h / 2),
|
|
36337
|
-
x2: c.px(c.w / 2 + (
|
|
36338
|
-
y2: c.px(c.h / 2 + (
|
|
36989
|
+
x2: c.px(c.w / 2 + (r7 - 0.03) * Math.cos(rad)),
|
|
36990
|
+
y2: c.px(c.h / 2 + (r7 - 0.03) * Math.sin(rad))
|
|
36339
36991
|
})
|
|
36340
36992
|
);
|
|
36341
36993
|
}
|
|
@@ -36395,11 +37047,11 @@ var FLOORPLAN_SYMBOLS = {
|
|
|
36395
37047
|
w: 0.35,
|
|
36396
37048
|
h: 0.35,
|
|
36397
37049
|
draw: (c) => {
|
|
36398
|
-
const
|
|
37050
|
+
const r7 = Math.min(c.w, c.h) / 2;
|
|
36399
37051
|
return [
|
|
36400
|
-
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(
|
|
36401
|
-
chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2 -
|
|
36402
|
-
chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2), y1: c.px(c.h / 2 -
|
|
37052
|
+
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7) }),
|
|
37053
|
+
chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2 - r7), y1: c.px(c.h / 2), x2: c.px(c.w / 2 + r7), y2: c.px(c.h / 2) }),
|
|
37054
|
+
chunk3WNW5Y7P_cjs.line({ class: "sx-fp-furn-line", x1: c.px(c.w / 2), y1: c.px(c.h / 2 - r7), x2: c.px(c.w / 2), y2: c.px(c.h / 2 + r7) })
|
|
36403
37055
|
].join("");
|
|
36404
37056
|
}
|
|
36405
37057
|
},
|
|
@@ -36475,23 +37127,23 @@ var FLOORPLAN_SYMBOLS = {
|
|
|
36475
37127
|
underlay: true,
|
|
36476
37128
|
// overhead fixture — never collides with floor furniture
|
|
36477
37129
|
draw: (c) => {
|
|
36478
|
-
const
|
|
37130
|
+
const r7 = Math.min(c.w, c.h) / 2;
|
|
36479
37131
|
const cx = c.w / 2;
|
|
36480
37132
|
const cy = c.h / 2;
|
|
36481
37133
|
const parts = [
|
|
36482
|
-
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dash", cx: c.px(cx), cy: c.px(cy), r: c.px(
|
|
36483
|
-
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(
|
|
37134
|
+
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dash", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) }),
|
|
37135
|
+
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(cx), cy: c.px(cy), r: c.px(r7 * 0.18) })
|
|
36484
37136
|
];
|
|
36485
37137
|
for (const a of [20, 110, 200, 290]) {
|
|
36486
37138
|
const rad = a * Math.PI / 180;
|
|
36487
37139
|
parts.push(
|
|
36488
37140
|
chunk3WNW5Y7P_cjs.el("ellipse", {
|
|
36489
37141
|
class: "sx-fp-furn-line",
|
|
36490
|
-
cx: c.px(cx +
|
|
36491
|
-
cy: c.px(cy +
|
|
36492
|
-
rx: c.px(
|
|
36493
|
-
ry: c.px(
|
|
36494
|
-
transform: `rotate(${a} ${c.px(cx +
|
|
37142
|
+
cx: c.px(cx + r7 * 0.55 * Math.cos(rad)),
|
|
37143
|
+
cy: c.px(cy + r7 * 0.55 * Math.sin(rad)),
|
|
37144
|
+
rx: c.px(r7 * 0.42),
|
|
37145
|
+
ry: c.px(r7 * 0.15),
|
|
37146
|
+
transform: `rotate(${a} ${c.px(cx + r7 * 0.55 * Math.cos(rad))} ${c.px(cy + r7 * 0.55 * Math.sin(rad))})`
|
|
36495
37147
|
})
|
|
36496
37148
|
);
|
|
36497
37149
|
}
|
|
@@ -36868,11 +37520,11 @@ var FLOORPLAN_SYMBOLS = {
|
|
|
36868
37520
|
w: 1,
|
|
36869
37521
|
h: 1,
|
|
36870
37522
|
draw: (c) => {
|
|
36871
|
-
const
|
|
37523
|
+
const r7 = Math.min(c.w, c.h) / 2;
|
|
36872
37524
|
const cx = c.w / 2;
|
|
36873
37525
|
const cy = c.h / 2;
|
|
36874
37526
|
const parts = [
|
|
36875
|
-
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-nofill", cx: c.px(cx), cy: c.px(cy), r: c.px(
|
|
37527
|
+
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-nofill", cx: c.px(cx), cy: c.px(cy), r: c.px(r7) }),
|
|
36876
37528
|
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dot", cx: c.px(cx), cy: c.px(cy), r: c.px(0.04) })
|
|
36877
37529
|
];
|
|
36878
37530
|
for (const a of [0, 45, 90, 135, 180, 225, 270, 315]) {
|
|
@@ -36880,10 +37532,10 @@ var FLOORPLAN_SYMBOLS = {
|
|
|
36880
37532
|
parts.push(
|
|
36881
37533
|
chunk3WNW5Y7P_cjs.line({
|
|
36882
37534
|
class: "sx-fp-furn-line",
|
|
36883
|
-
x1: c.px(cx + (
|
|
36884
|
-
y1: c.px(cy + (
|
|
36885
|
-
x2: c.px(cx +
|
|
36886
|
-
y2: c.px(cy +
|
|
37535
|
+
x1: c.px(cx + (r7 - 0.09) * Math.cos(rad)),
|
|
37536
|
+
y1: c.px(cy + (r7 - 0.09) * Math.sin(rad)),
|
|
37537
|
+
x2: c.px(cx + r7 * Math.cos(rad)),
|
|
37538
|
+
y2: c.px(cy + r7 * Math.sin(rad))
|
|
36887
37539
|
})
|
|
36888
37540
|
);
|
|
36889
37541
|
}
|
|
@@ -37033,10 +37685,10 @@ var FLOORPLAN_SYMBOLS = {
|
|
|
37033
37685
|
w: 2,
|
|
37034
37686
|
h: 2,
|
|
37035
37687
|
draw: (c) => {
|
|
37036
|
-
const
|
|
37688
|
+
const r7 = Math.min(c.w, c.h) / 2;
|
|
37037
37689
|
return [
|
|
37038
|
-
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(
|
|
37039
|
-
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-line", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(
|
|
37690
|
+
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7) }),
|
|
37691
|
+
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-line", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(r7 * 0.6) }),
|
|
37040
37692
|
chunk3WNW5Y7P_cjs.circle({ class: "sx-fp-furn-dot", cx: c.px(c.w / 2), cy: c.px(c.h / 2), r: c.px(0.07) })
|
|
37041
37693
|
].join("");
|
|
37042
37694
|
}
|
|
@@ -37070,10 +37722,10 @@ var FloorplanParseError = class extends Error {
|
|
|
37070
37722
|
};
|
|
37071
37723
|
var isStr = (t) => t !== void 0 && "str" in t;
|
|
37072
37724
|
var isWord = (t, w) => t !== void 0 && "word" in t && (w === void 0 || t.word === w);
|
|
37073
|
-
function
|
|
37725
|
+
function normalizeQuotes4(line2) {
|
|
37074
37726
|
return line2.replace(/[“”「」『』]/g, '"').replace(/[‘’]/g, "'");
|
|
37075
37727
|
}
|
|
37076
|
-
function
|
|
37728
|
+
function tokenize8(line2) {
|
|
37077
37729
|
const out = [];
|
|
37078
37730
|
const re = /"([^"]*)"|(\S+)/g;
|
|
37079
37731
|
let m;
|
|
@@ -37083,7 +37735,7 @@ function tokenize7(line2) {
|
|
|
37083
37735
|
}
|
|
37084
37736
|
return out;
|
|
37085
37737
|
}
|
|
37086
|
-
function
|
|
37738
|
+
function parseNum2(t, what, ln) {
|
|
37087
37739
|
if (!isWord(t)) throw new FloorplanParseError(`expected a number for ${what}`, ln);
|
|
37088
37740
|
const v = Number(t.word);
|
|
37089
37741
|
if (!Number.isFinite(v)) throw new FloorplanParseError(`expected a number for ${what}, got "${t.word}"`, ln);
|
|
@@ -37136,7 +37788,7 @@ function parseHeader3(tok, ast, ln) {
|
|
|
37136
37788
|
}
|
|
37137
37789
|
function parseRoom(tok, ast, ln) {
|
|
37138
37790
|
const id = parseId(tok.shift(), "a room id", ln);
|
|
37139
|
-
if (ast.rooms.some((
|
|
37791
|
+
if (ast.rooms.some((r7) => r7.id === id)) {
|
|
37140
37792
|
throw new FloorplanParseError(`duplicate room id "${id}"`, ln);
|
|
37141
37793
|
}
|
|
37142
37794
|
const room = { id, label: id, w: 4, h: 3, line: ln };
|
|
@@ -37153,7 +37805,7 @@ function parseRoom(tok, ast, ln) {
|
|
|
37153
37805
|
};
|
|
37154
37806
|
} else if (t.word === "offset") {
|
|
37155
37807
|
if (!room.rel) throw new FloorplanParseError(`"offset" requires a relative placement (right-of/left-of/above/below)`, ln);
|
|
37156
|
-
room.rel.offset =
|
|
37808
|
+
room.rel.offset = parseNum2(tok.shift(), "offset", ln);
|
|
37157
37809
|
} else if (t.word === "align") {
|
|
37158
37810
|
if (!room.rel) throw new FloorplanParseError(`"align" requires a relative placement (right-of/left-of/above/below)`, ln);
|
|
37159
37811
|
const a = parseId(tok.shift(), "align (start|center|end)", ln);
|
|
@@ -37187,7 +37839,7 @@ function parseExtend(tok, ast, ln) {
|
|
|
37187
37839
|
};
|
|
37188
37840
|
} else if (t.word === "offset") {
|
|
37189
37841
|
if (!ext.rel) throw new FloorplanParseError(`"offset" requires a relative placement (right-of/left-of/above/below)`, ln);
|
|
37190
|
-
ext.rel.offset =
|
|
37842
|
+
ext.rel.offset = parseNum2(tok.shift(), "offset", ln);
|
|
37191
37843
|
} else if (t.word === "align") {
|
|
37192
37844
|
if (!ext.rel) throw new FloorplanParseError(`"align" requires a relative placement (right-of/left-of/above/below)`, ln);
|
|
37193
37845
|
const a = parseId(tok.shift(), "align (start|center|end)", ln);
|
|
@@ -37232,7 +37884,7 @@ function parseOpening(kind, tok, ast, ln) {
|
|
|
37232
37884
|
const t = tok.shift();
|
|
37233
37885
|
if (!isWord(t)) throw new FloorplanParseError(`${kind}: unexpected string "${t.str}"`, ln);
|
|
37234
37886
|
else if (t.word === "at") op.pct = parsePct(tok.shift(), ln);
|
|
37235
|
-
else if (t.word === "width") op.width =
|
|
37887
|
+
else if (t.word === "width") op.width = parseNum2(tok.shift(), "width", ln);
|
|
37236
37888
|
else if (t.word === "hinge") {
|
|
37237
37889
|
const h = parseId(tok.shift(), "hinge (left|right)", ln);
|
|
37238
37890
|
if (h !== "left" && h !== "right") throw new FloorplanParseError(`hinge must be left|right, got "${h}"`, ln);
|
|
@@ -37273,7 +37925,7 @@ function parseFurniture(tok, ast, ln) {
|
|
|
37273
37925
|
f.x = c.x;
|
|
37274
37926
|
f.y = c.y;
|
|
37275
37927
|
} else if (t.word === "size") f.size = parseDims(tok.shift(), "size", ln);
|
|
37276
|
-
else if (t.word === "rotate") f.rotate =
|
|
37928
|
+
else if (t.word === "rotate") f.rotate = parseNum2(tok.shift(), "rotate", ln);
|
|
37277
37929
|
else throw new FloorplanParseError(`furniture: unexpected token "${t.word}"`, ln);
|
|
37278
37930
|
}
|
|
37279
37931
|
ast.furniture.push(f);
|
|
@@ -37293,18 +37945,18 @@ function parseArray(mode, tok, ast, ln) {
|
|
|
37293
37945
|
const t = tok.shift();
|
|
37294
37946
|
if (!isWord(t)) throw new FloorplanParseError(`${mode}: unexpected string "${t.str}"`, ln);
|
|
37295
37947
|
else if (t.word === "in") a.room = parseId(tok.shift(), `a room id after "in"`, ln);
|
|
37296
|
-
else if (t.word === "rows") a.rows =
|
|
37297
|
-
else if (t.word === "cols") a.cols =
|
|
37298
|
-
else if (t.word === "count") a.count =
|
|
37948
|
+
else if (t.word === "rows") a.rows = parseNum2(tok.shift(), "rows", ln);
|
|
37949
|
+
else if (t.word === "cols") a.cols = parseNum2(tok.shift(), "cols", ln);
|
|
37950
|
+
else if (t.word === "count") a.count = parseNum2(tok.shift(), "count", ln);
|
|
37299
37951
|
else if (t.word === "area") {
|
|
37300
37952
|
a.p1 = parseCoord2(tok.shift(), "area p1", ln);
|
|
37301
37953
|
a.p2 = parseCoord2(tok.shift(), "area p2", ln);
|
|
37302
37954
|
} else if (t.word === "itemsize") a.itemsize = parseDims(tok.shift(), "itemsize", ln);
|
|
37303
|
-
else if (t.word === "rotate") a.rotate =
|
|
37955
|
+
else if (t.word === "rotate") a.rotate = parseNum2(tok.shift(), "rotate", ln);
|
|
37304
37956
|
else if (t.word === "center") a.center = parseCoord2(tok.shift(), "center", ln);
|
|
37305
|
-
else if (t.word === "radius") a.radius =
|
|
37306
|
-
else if (t.word === "from") a.fromDeg =
|
|
37307
|
-
else if (t.word === "to") a.toDeg =
|
|
37957
|
+
else if (t.word === "radius") a.radius = parseNum2(tok.shift(), "radius", ln);
|
|
37958
|
+
else if (t.word === "from") a.fromDeg = parseNum2(tok.shift(), "from", ln);
|
|
37959
|
+
else if (t.word === "to") a.toDeg = parseNum2(tok.shift(), "to", ln);
|
|
37308
37960
|
else throw new FloorplanParseError(`${mode}: unexpected token "${t.word}"`, ln);
|
|
37309
37961
|
}
|
|
37310
37962
|
ast.arrays.push(a);
|
|
@@ -37324,9 +37976,9 @@ function parseFloorplan(text2) {
|
|
|
37324
37976
|
const lines = text2.split(/\r?\n/);
|
|
37325
37977
|
for (let i = 0; i < lines.length; i++) {
|
|
37326
37978
|
const ln = i + 1;
|
|
37327
|
-
const raw =
|
|
37979
|
+
const raw = normalizeQuotes4(lines[i]).trim();
|
|
37328
37980
|
if (!raw) continue;
|
|
37329
|
-
const all =
|
|
37981
|
+
const all = tokenize8(raw);
|
|
37330
37982
|
const tok = [];
|
|
37331
37983
|
for (let k = 0; k < all.length; k++) {
|
|
37332
37984
|
const t = all[k];
|
|
@@ -37351,7 +38003,7 @@ function parseFloorplan(text2) {
|
|
|
37351
38003
|
throw new FloorplanParseError(`the first statement must be the "floorplan" header`, ln);
|
|
37352
38004
|
} else if (kw === "room") parseRoom(tok, ast, ln);
|
|
37353
38005
|
else if (kw === "north") {
|
|
37354
|
-
ast.north = tok.length ?
|
|
38006
|
+
ast.north = tok.length ? parseNum2(tok.shift(), "north rotation (degrees)", ln) : 0;
|
|
37355
38007
|
if (tok.length) throw new FloorplanParseError(`north: unexpected trailing tokens`, ln);
|
|
37356
38008
|
} else if (kw === "extend") parseExtend(tok, ast, ln);
|
|
37357
38009
|
else if (kw === "door" || kw === "window" || kw === "opening") parseOpening(kw, tok, ast, ln);
|
|
@@ -37614,14 +38266,14 @@ function layoutFloorplan(ast) {
|
|
|
37614
38266
|
].sort((a, b) => a.line - b.line);
|
|
37615
38267
|
for (const stmt of stmts) {
|
|
37616
38268
|
if (stmt.room) {
|
|
37617
|
-
const
|
|
37618
|
-
const w =
|
|
37619
|
-
const h =
|
|
37620
|
-
const pos = resolvePlacement(
|
|
38269
|
+
const r7 = stmt.room;
|
|
38270
|
+
const w = r7.w * u;
|
|
38271
|
+
const h = r7.h * u;
|
|
38272
|
+
const pos = resolvePlacement(r7, w, h, byId, rooms, u, `room "${r7.id}"`, errors) ?? { x: 0, y: 0 };
|
|
37621
38273
|
const part = { x: pos.x, y: pos.y, w, h };
|
|
37622
38274
|
const room = {
|
|
37623
|
-
id:
|
|
37624
|
-
label:
|
|
38275
|
+
id: r7.id,
|
|
38276
|
+
label: r7.label,
|
|
37625
38277
|
x: part.x,
|
|
37626
38278
|
y: part.y,
|
|
37627
38279
|
w,
|
|
@@ -37629,11 +38281,11 @@ function layoutFloorplan(ast) {
|
|
|
37629
38281
|
parts: [part],
|
|
37630
38282
|
areaM2: 0,
|
|
37631
38283
|
areaText: "",
|
|
37632
|
-
fill:
|
|
37633
|
-
nolabel:
|
|
38284
|
+
fill: r7.fill,
|
|
38285
|
+
nolabel: r7.nolabel ?? false
|
|
37634
38286
|
};
|
|
37635
38287
|
refreshRoomBounds(room, ast.unit);
|
|
37636
|
-
byId.set(
|
|
38288
|
+
byId.set(r7.id, rooms.length);
|
|
37637
38289
|
rooms.push(room);
|
|
37638
38290
|
} else if (stmt.ext) {
|
|
37639
38291
|
const e = stmt.ext;
|
|
@@ -37746,10 +38398,10 @@ function layoutFloorplan(ast) {
|
|
|
37746
38398
|
const spanW = p2.x - p1.x;
|
|
37747
38399
|
const spanH = p2.y - p1.y;
|
|
37748
38400
|
let placed = 0;
|
|
37749
|
-
for (let
|
|
38401
|
+
for (let r7 = 0; r7 < nRows && placed < cap2; r7++) {
|
|
37750
38402
|
for (let col = 0; col < nCols && placed < cap2; col++) {
|
|
37751
38403
|
const cx = p1.x + (nCols === 1 ? spanW / 2 : col * spanW / (nCols - 1));
|
|
37752
|
-
const cy = p1.y + (nRows === 1 ? spanH / 2 :
|
|
38404
|
+
const cy = p1.y + (nRows === 1 ? spanH / 2 : r7 * spanH / (nRows - 1));
|
|
37753
38405
|
place(a.type, idx, cx - iw / 2, cy - ih / 2, iw, ih, a.rotate);
|
|
37754
38406
|
placed++;
|
|
37755
38407
|
}
|
|
@@ -37770,7 +38422,7 @@ function layoutFloorplan(ast) {
|
|
|
37770
38422
|
}
|
|
37771
38423
|
}
|
|
37772
38424
|
const roomOf = /* @__PURE__ */ new Map();
|
|
37773
|
-
for (const
|
|
38425
|
+
for (const r7 of rooms) roomOf.set(r7.id, r7);
|
|
37774
38426
|
const warnItems = /* @__PURE__ */ new Set();
|
|
37775
38427
|
for (const it of items) {
|
|
37776
38428
|
const room = roomOf.get(it.roomId);
|
|
@@ -37829,11 +38481,11 @@ function layoutFloorplan(ast) {
|
|
|
37829
38481
|
let minY = Infinity;
|
|
37830
38482
|
let maxX = -Infinity;
|
|
37831
38483
|
let maxY = -Infinity;
|
|
37832
|
-
for (const
|
|
37833
|
-
minX = Math.min(minX,
|
|
37834
|
-
minY = Math.min(minY,
|
|
37835
|
-
maxX = Math.max(maxX,
|
|
37836
|
-
maxY = Math.max(maxY,
|
|
38484
|
+
for (const r7 of rooms) {
|
|
38485
|
+
minX = Math.min(minX, r7.x);
|
|
38486
|
+
minY = Math.min(minY, r7.y);
|
|
38487
|
+
maxX = Math.max(maxX, r7.x + r7.w);
|
|
38488
|
+
maxY = Math.max(maxY, r7.y + r7.h);
|
|
37837
38489
|
}
|
|
37838
38490
|
if (rooms.length === 0) {
|
|
37839
38491
|
minX = minY = 0;
|
|
@@ -37859,8 +38511,8 @@ function layoutFloorplan(ast) {
|
|
|
37859
38511
|
minor: false
|
|
37860
38512
|
});
|
|
37861
38513
|
const topSegs = [];
|
|
37862
|
-
for (const
|
|
37863
|
-
for (const sg of sideSegments(
|
|
38514
|
+
for (const r7 of rooms) {
|
|
38515
|
+
for (const sg of sideSegments(r7, "north")) {
|
|
37864
38516
|
if (Math.abs(sg.along - minY) < 0.01) topSegs.push({ lo: sg.lo, hi: sg.hi });
|
|
37865
38517
|
}
|
|
37866
38518
|
}
|
|
@@ -37877,8 +38529,8 @@ function layoutFloorplan(ast) {
|
|
|
37877
38529
|
}
|
|
37878
38530
|
}
|
|
37879
38531
|
const leftSegs = [];
|
|
37880
|
-
for (const
|
|
37881
|
-
for (const sg of sideSegments(
|
|
38532
|
+
for (const r7 of rooms) {
|
|
38533
|
+
for (const sg of sideSegments(r7, "west")) {
|
|
37882
38534
|
if (Math.abs(sg.along - minX) < 0.01) leftSegs.push({ lo: sg.lo, hi: sg.hi });
|
|
37883
38535
|
}
|
|
37884
38536
|
}
|
|
@@ -37906,7 +38558,7 @@ function layoutFloorplan(ast) {
|
|
|
37906
38558
|
dims,
|
|
37907
38559
|
bounds: { minX, minY, maxX, maxY },
|
|
37908
38560
|
wallT: FLOORPLAN_CONST.wallT,
|
|
37909
|
-
totalAreaM2: rooms.reduce((s,
|
|
38561
|
+
totalAreaM2: rooms.reduce((s, r7) => s + r7.areaM2, 0),
|
|
37910
38562
|
errors,
|
|
37911
38563
|
warnings,
|
|
37912
38564
|
warnItems: [...warnItems]
|
|
@@ -37958,11 +38610,11 @@ function resolveOpening(op, rooms, byId, u, unit, errors, warnings) {
|
|
|
37958
38610
|
return null;
|
|
37959
38611
|
}
|
|
37960
38612
|
owner = idx;
|
|
37961
|
-
const
|
|
38613
|
+
const r7 = rooms[idx];
|
|
37962
38614
|
const side = op.side;
|
|
37963
|
-
const segs = sideSegments(
|
|
38615
|
+
const segs = sideSegments(r7, side);
|
|
37964
38616
|
if (segs.length === 0) {
|
|
37965
|
-
errors.push(`${op.kind} on "${
|
|
38617
|
+
errors.push(`${op.kind} on "${r7.id}" ${side}: that side has no exterior wall segment`);
|
|
37966
38618
|
return null;
|
|
37967
38619
|
}
|
|
37968
38620
|
const total = segs.reduce((s, sg) => s + (sg.hi - sg.lo), 0);
|
|
@@ -38303,13 +38955,13 @@ function renderFloorplanLayout(lay, config) {
|
|
|
38303
38955
|
const openings = [];
|
|
38304
38956
|
const labels = [];
|
|
38305
38957
|
const dims = [];
|
|
38306
|
-
for (const
|
|
38958
|
+
for (const r7 of lay.rooms) {
|
|
38307
38959
|
floors.push(
|
|
38308
38960
|
chunk3WNW5Y7P_cjs.group(
|
|
38309
|
-
{ class: "sx-fp-floor", "data-room":
|
|
38310
|
-
|
|
38961
|
+
{ class: "sx-fp-floor", "data-room": r7.id },
|
|
38962
|
+
r7.parts.map(
|
|
38311
38963
|
(p) => chunk3WNW5Y7P_cjs.rect({
|
|
38312
|
-
fill:
|
|
38964
|
+
fill: r7.fill ?? t.floorFill,
|
|
38313
38965
|
x: X(p.x),
|
|
38314
38966
|
y: Y(p.y),
|
|
38315
38967
|
width: px(p.w),
|
|
@@ -38318,12 +38970,12 @@ function renderFloorplanLayout(lay, config) {
|
|
|
38318
38970
|
)
|
|
38319
38971
|
)
|
|
38320
38972
|
);
|
|
38321
|
-
if (!
|
|
38322
|
-
const main =
|
|
38973
|
+
if (!r7.nolabel) {
|
|
38974
|
+
const main = r7.parts.reduce((a, b) => b.w * b.h > a.w * a.h ? b : a);
|
|
38323
38975
|
const cx = X(main.x + main.w / 2);
|
|
38324
38976
|
const cy = Y(main.y + main.h / 2);
|
|
38325
|
-
labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-name", x: cx, y: r24(cy - 3), "text-anchor": "middle" },
|
|
38326
|
-
labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-area", x: cx, y: r24(cy + 13), "text-anchor": "middle" },
|
|
38977
|
+
labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-name", x: cx, y: r24(cy - 3), "text-anchor": "middle" }, r7.label));
|
|
38978
|
+
labels.push(chunk3WNW5Y7P_cjs.text({ class: "sx-fp-room-area", x: cx, y: r24(cy + 13), "text-anchor": "middle" }, r7.areaText));
|
|
38327
38979
|
}
|
|
38328
38980
|
}
|
|
38329
38981
|
const warnSet = new Set(lay.warnItems);
|
|
@@ -38353,8 +39005,8 @@ function renderFloorplanLayout(lay, config) {
|
|
|
38353
39005
|
}
|
|
38354
39006
|
});
|
|
38355
39007
|
const tw = lay.wallT;
|
|
38356
|
-
for (const
|
|
38357
|
-
for (const p of
|
|
39008
|
+
for (const r7 of lay.rooms) {
|
|
39009
|
+
for (const p of r7.parts) {
|
|
38358
39010
|
walls.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-fp-wall", x: r24(X(p.x) - px(tw / 2)), y: r24(Y(p.y) - px(tw / 2)), width: r24(px(p.w + tw)), height: px(tw) }));
|
|
38359
39011
|
walls.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-fp-wall", x: r24(X(p.x) - px(tw / 2)), y: r24(Y(p.y + p.h) - px(tw / 2)), width: r24(px(p.w + tw)), height: px(tw) }));
|
|
38360
39012
|
walls.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-fp-wall", x: r24(X(p.x) - px(tw / 2)), y: r24(Y(p.y) - px(tw / 2)), width: px(tw), height: r24(px(p.h + tw)) }));
|
|
@@ -38487,8 +39139,8 @@ var PlaybookParseError = class extends Error {
|
|
|
38487
39139
|
var isStr2 = (t) => t !== void 0 && "str" in t;
|
|
38488
39140
|
var isWord2 = (t, w) => t !== void 0 && "word" in t && (w === void 0 || t.word.toLowerCase() === w);
|
|
38489
39141
|
var tokDisplay = (t) => "word" in t ? t.word : `"${t.str}"`;
|
|
38490
|
-
var
|
|
38491
|
-
function
|
|
39142
|
+
var normalizeQuotes5 = (s) => s.replace(/[“”「」『』]/g, '"').replace(/[‘’]/g, "'");
|
|
39143
|
+
function tokenize9(line2) {
|
|
38492
39144
|
const out = [];
|
|
38493
39145
|
const re = /"([^"]*)"|(\S+)/g;
|
|
38494
39146
|
let m;
|
|
@@ -38498,7 +39150,7 @@ function tokenize8(line2) {
|
|
|
38498
39150
|
}
|
|
38499
39151
|
return out;
|
|
38500
39152
|
}
|
|
38501
|
-
function
|
|
39153
|
+
function parseNum3(t, what, ln) {
|
|
38502
39154
|
if (!isWord2(t)) throw new PlaybookParseError(`expected a number for ${what}`, ln);
|
|
38503
39155
|
const v = Number(t.word);
|
|
38504
39156
|
if (!Number.isFinite(v)) throw new PlaybookParseError(`expected a number for ${what}, got "${t.word}"`, ln);
|
|
@@ -38605,10 +39257,10 @@ function parseHeader4(tok, ast, ln) {
|
|
|
38605
39257
|
function parseField(tok, ast, ln) {
|
|
38606
39258
|
while (tok.length) {
|
|
38607
39259
|
const t = tok.shift();
|
|
38608
|
-
if (isWord2(t, "down")) ast.down =
|
|
38609
|
-
else if (isWord2(t, "distance") || isWord2(t, "togo")) ast.distance =
|
|
38610
|
-
else if (isWord2(t, "los") || isWord2(t, "ball")) ast.losYard =
|
|
38611
|
-
else if (isWord2(t, "goal") || isWord2(t, "togoal")) ast.toGoal =
|
|
39260
|
+
if (isWord2(t, "down")) ast.down = parseNum3(tok.shift(), "down", ln);
|
|
39261
|
+
else if (isWord2(t, "distance") || isWord2(t, "togo")) ast.distance = parseNum3(tok.shift(), "distance", ln);
|
|
39262
|
+
else if (isWord2(t, "los") || isWord2(t, "ball")) ast.losYard = parseNum3(tok.shift(), "los", ln);
|
|
39263
|
+
else if (isWord2(t, "goal") || isWord2(t, "togoal")) ast.toGoal = parseNum3(tok.shift(), "goal", ln);
|
|
38612
39264
|
else if (isWord2(t, "view")) {
|
|
38613
39265
|
const v = parseId2(tok.shift(), "view (full|half)", ln).toLowerCase();
|
|
38614
39266
|
if (v !== "full" && v !== "half" && v !== "auto") throw new PlaybookParseError(`view must be full|half`, ln);
|
|
@@ -38712,7 +39364,7 @@ function parseRouteRun(kind, tok, ast, ln) {
|
|
|
38712
39364
|
const t = tok.shift();
|
|
38713
39365
|
if (isWord2(t) && DIRS.includes(t.word.toLowerCase())) m.dir = t.word.toLowerCase();
|
|
38714
39366
|
else if (isWord2(t) && Number.isFinite(Number(t.word))) m.depth = Number(t.word);
|
|
38715
|
-
else if (isWord2(t, "depth")) m.depth =
|
|
39367
|
+
else if (isWord2(t, "depth")) m.depth = parseNum3(tok.shift(), "depth", ln);
|
|
38716
39368
|
else throw new PlaybookParseError(`${kind}: unexpected token "${tokDisplay(t)}"`, ln);
|
|
38717
39369
|
}
|
|
38718
39370
|
ast.moves.push(m);
|
|
@@ -38817,9 +39469,9 @@ function parsePlaybook(text2) {
|
|
|
38817
39469
|
const lines = text2.split(/\r?\n/);
|
|
38818
39470
|
for (let i = 0; i < lines.length; i++) {
|
|
38819
39471
|
const ln = i + 1;
|
|
38820
|
-
const raw =
|
|
39472
|
+
const raw = normalizeQuotes5(lines[i]).trim();
|
|
38821
39473
|
if (!raw) continue;
|
|
38822
|
-
const all =
|
|
39474
|
+
const all = tokenize9(raw);
|
|
38823
39475
|
const tok = [];
|
|
38824
39476
|
for (const t of all) {
|
|
38825
39477
|
if (isWord2(t) && (t.word.startsWith("#") || t.word.startsWith("//"))) break;
|
|
@@ -39665,12 +40317,12 @@ function resolveGeneric(m, src, byId, players, mod, sport, warnings) {
|
|
|
39665
40317
|
let cur = { x: src.x, y: src.y };
|
|
39666
40318
|
for (const p of m.points) {
|
|
39667
40319
|
if (p.ref) {
|
|
39668
|
-
const
|
|
39669
|
-
if (!
|
|
40320
|
+
const r7 = resolveRef(p.ref, byId, players, mod);
|
|
40321
|
+
if (!r7) {
|
|
39670
40322
|
warnings.push(`${m.kind} ${m.player}: unknown destination "${p.ref}" \u2014 skipped`);
|
|
39671
40323
|
return null;
|
|
39672
40324
|
}
|
|
39673
|
-
cur =
|
|
40325
|
+
cur = r7;
|
|
39674
40326
|
} else if (p.rel) {
|
|
39675
40327
|
cur = { x: cur.x + (p.x ?? 0), y: cur.y + (p.y ?? 0) };
|
|
39676
40328
|
} else {
|
|
@@ -39813,22 +40465,22 @@ function renderMove(mv, ctx) {
|
|
|
39813
40465
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-pb-move-g", "data-kind": mv.kind, "data-player": mv.player }, parts);
|
|
39814
40466
|
}
|
|
39815
40467
|
function playerSymbol(p, ctx) {
|
|
39816
|
-
const cx = ctx.X(p.x), cy = ctx.Y(p.y),
|
|
40468
|
+
const cx = ctx.X(p.x), cy = ctx.Y(p.y), r7 = 10;
|
|
39817
40469
|
const parts = [];
|
|
39818
40470
|
if (p.side === "defense" || p.pos === "x") {
|
|
39819
|
-
const k =
|
|
40471
|
+
const k = r7 * 0.78;
|
|
39820
40472
|
parts.push(chunk3WNW5Y7P_cjs.line({ class: "sx-pb-x", x1: r28(cx - k), y1: r28(cy - k), x2: r28(cx + k), y2: r28(cy + k) }));
|
|
39821
40473
|
parts.push(chunk3WNW5Y7P_cjs.line({ class: "sx-pb-x", x1: r28(cx - k), y1: r28(cy + k), x2: r28(cx + k), y2: r28(cy - k) }));
|
|
39822
40474
|
if (p.label) parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-x-text", x: r28(cx + k + 5), y: r28(cy - k + 2), "text-anchor": "middle" }, p.label));
|
|
39823
40475
|
} else if (p.pos === "gk") {
|
|
39824
|
-
const h =
|
|
40476
|
+
const h = r7 * 1.15;
|
|
39825
40477
|
parts.push(chunk3WNW5Y7P_cjs.polygon({ class: "sx-pb-gk", points: `${r28(cx)},${r28(cy - h)} ${r28(cx + h)},${r28(cy + h * 0.8)} ${r28(cx - h)},${r28(cy + h * 0.8)}` }));
|
|
39826
40478
|
parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-o-text", x: r28(cx), y: r28(cy + 6), "text-anchor": "middle" }, p.label));
|
|
39827
40479
|
} else if (p.pos === "c") {
|
|
39828
|
-
parts.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-pb-o", x: r28(cx -
|
|
40480
|
+
parts.push(chunk3WNW5Y7P_cjs.rect({ class: "sx-pb-o", x: r28(cx - r7 * 0.82), y: r28(cy - r7 * 0.82), width: r28(r7 * 1.64), height: r28(r7 * 1.64) }));
|
|
39829
40481
|
parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-o-text", x: r28(cx), y: r28(cy + 3.6), "text-anchor": "middle" }, p.label));
|
|
39830
40482
|
} else {
|
|
39831
|
-
parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-pb-o", cx: r28(cx), cy: r28(cy), r:
|
|
40483
|
+
parts.push(chunk3WNW5Y7P_cjs.circle({ class: "sx-pb-o", cx: r28(cx), cy: r28(cy), r: r7 }));
|
|
39832
40484
|
parts.push(chunk3WNW5Y7P_cjs.text({ class: "sx-pb-o-text", x: r28(cx), y: r28(cy + 3.6), "text-anchor": "middle" }, p.label));
|
|
39833
40485
|
}
|
|
39834
40486
|
return chunk3WNW5Y7P_cjs.group({ class: "sx-pb-player", "data-side": p.side, "data-id": p.id }, parts);
|
|
@@ -40007,7 +40659,7 @@ var plugins = [
|
|
|
40007
40659
|
chunk4AC6I7KJ_cjs.circuit,
|
|
40008
40660
|
chunkC4Y24X3U_cjs.blockdiagram,
|
|
40009
40661
|
chunkINVLJYAE_cjs.ladder,
|
|
40010
|
-
|
|
40662
|
+
chunkN3HU635X_cjs.sld,
|
|
40011
40663
|
chunkGAQ36VFD_cjs.entity,
|
|
40012
40664
|
chunk627GHE2N_cjs.fishbone,
|
|
40013
40665
|
chunkITI3STJ6_cjs.venn,
|
|
@@ -40035,6 +40687,7 @@ var plugins = [
|
|
|
40035
40687
|
bowtie2,
|
|
40036
40688
|
eventtree,
|
|
40037
40689
|
fmea,
|
|
40690
|
+
rbd,
|
|
40038
40691
|
causalloop,
|
|
40039
40692
|
markov,
|
|
40040
40693
|
gitgraph,
|
|
@@ -40054,7 +40707,7 @@ function detectPlugin(text2, config) {
|
|
|
40054
40707
|
if (plugin.detect(text2)) return plugin;
|
|
40055
40708
|
}
|
|
40056
40709
|
throw new Error(
|
|
40057
|
-
"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', 'bowtie', 'floorplan', or 'playbook'."
|
|
40710
|
+
"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', 'bowtie', 'rbd', 'floorplan', or 'playbook'."
|
|
40058
40711
|
);
|
|
40059
40712
|
}
|
|
40060
40713
|
function stripCodeFences(text2) {
|
|
@@ -40212,6 +40865,7 @@ exports.pert = pert;
|
|
|
40212
40865
|
exports.petri = petri;
|
|
40213
40866
|
exports.pid = pid;
|
|
40214
40867
|
exports.prisma = prisma;
|
|
40868
|
+
exports.rbd = rbd;
|
|
40215
40869
|
exports.render = render;
|
|
40216
40870
|
exports.renderEquip = renderEquip;
|
|
40217
40871
|
exports.renderPreview = renderPreview;
|
|
@@ -40223,5 +40877,5 @@ exports.timeline = timeline;
|
|
|
40223
40877
|
exports.umlclass = umlclass;
|
|
40224
40878
|
exports.usecase = usecase;
|
|
40225
40879
|
exports.welding = welding;
|
|
40226
|
-
//# sourceMappingURL=chunk-
|
|
40227
|
-
//# sourceMappingURL=chunk-
|
|
40880
|
+
//# sourceMappingURL=chunk-Q7CWX6HA.cjs.map
|
|
40881
|
+
//# sourceMappingURL=chunk-Q7CWX6HA.cjs.map
|