2024-02-24 00:37:31 +08:00

659 lines
19 KiB
JavaScript

"use strict";
exports.id = 445;
exports.ids = [445];
exports.modules = {
/***/ 95350:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ a: () => (/* binding */ addHtmlLabel)
/* harmony export */ });
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(26847);
function addHtmlLabel(root, node) {
var fo = root.append('foreignObject').attr('width', '100000');
var div = fo.append('xhtml:div');
div.attr('xmlns', 'http://www.w3.org/1999/xhtml');
var label = node.label;
switch (typeof label) {
case 'function':
div.insert(label);
break;
case 'object':
// Currently we assume this is a DOM object.
div.insert(function () {
return label;
});
break;
default:
div.html(label);
}
_util_js__WEBPACK_IMPORTED_MODULE_0__/* .applyStyle */ .bg(div, node.labelStyle);
div.style('display', 'inline-block');
// Fix for firefox
div.style('white-space', 'nowrap');
var client = div.node().getBoundingClientRect();
fo.attr('width', client.width).attr('height', client.height);
return fo;
}
/***/ }),
/***/ 26847:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ $p: () => (/* binding */ applyClass),
/* harmony export */ O1: () => (/* binding */ edgeToId),
/* harmony export */ WR: () => (/* binding */ applyTransition),
/* harmony export */ bF: () => (/* binding */ isSubgraph),
/* harmony export */ bg: () => (/* binding */ applyStyle)
/* harmony export */ });
/* harmony import */ var lodash_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(51245);
/* harmony import */ var lodash_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(26395);
// Public utility functions
/*
* Returns true if the specified node in the graph is a subgraph node. A
* subgraph node is one that contains other nodes.
*/
function isSubgraph(g, v) {
return !!g.children(v).length;
}
function edgeToId(e) {
return escapeId(e.v) + ':' + escapeId(e.w) + ':' + escapeId(e.name);
}
var ID_DELIM = /:/g;
function escapeId(str) {
return str ? String(str).replace(ID_DELIM, '\\:') : '';
}
function applyStyle(dom, styleFn) {
if (styleFn) {
dom.attr('style', styleFn);
}
}
function applyClass(dom, classFn, otherClasses) {
if (classFn) {
dom.attr('class', classFn).attr('class', otherClasses + ' ' + dom.attr('class'));
}
}
function applyTransition(selection, g) {
var graph = g.graph();
if (lodash_es__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z(graph)) {
var transition = graph.transition;
if (lodash_es__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z(transition)) {
return transition(selection);
}
}
return selection;
}
/***/ }),
/***/ 30445:
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
a: () => (/* binding */ flowStyles),
f: () => (/* binding */ flowRendererV2)
});
// EXTERNAL MODULE: ./node_modules/dagre-d3-es/src/graphlib/index.js
var graphlib = __webpack_require__(50680);
// EXTERNAL MODULE: ./node_modules/d3/src/index.js + 197 modules
var src = __webpack_require__(92509);
// EXTERNAL MODULE: ./node_modules/mermaid/dist/mermaid-934d9bea.js + 8 modules
var mermaid_934d9bea = __webpack_require__(58810);
// EXTERNAL MODULE: ./node_modules/mermaid/dist/index-67a42d7d.js
var index_67a42d7d = __webpack_require__(98408);
// EXTERNAL MODULE: ./node_modules/dagre-d3-es/src/dagre-js/label/add-html-label.js
var add_html_label = __webpack_require__(95350);
// EXTERNAL MODULE: ./node_modules/khroma/dist/utils/index.js + 3 modules
var utils = __webpack_require__(7411);
// EXTERNAL MODULE: ./node_modules/khroma/dist/color/index.js + 4 modules
var dist_color = __webpack_require__(17911);
;// CONCATENATED MODULE: ./node_modules/khroma/dist/methods/channel.js
/* IMPORT */
/* MAIN */
const channel = (color, channel) => {
return utils/* default */.Z.lang.round(dist_color/* default */.Z.parse(color)[channel]);
};
/* EXPORT */
/* harmony default export */ const methods_channel = (channel);
// EXTERNAL MODULE: ./node_modules/khroma/dist/methods/rgba.js
var rgba = __webpack_require__(85549);
;// CONCATENATED MODULE: ./node_modules/mermaid/dist/styles-b966c4ae.js
const conf = {};
const setConf = function(cnf) {
const keys = Object.keys(cnf);
for (const key of keys) {
conf[key] = cnf[key];
}
};
const addVertices = function(vert, g, svgId, root, doc, diagObj) {
const svg = root.select(`[id="${svgId}"]`);
const keys = Object.keys(vert);
keys.forEach(function(id) {
const vertex = vert[id];
let classStr = "default";
if (vertex.classes.length > 0) {
classStr = vertex.classes.join(" ");
}
classStr = classStr + " flowchart-label";
const styles = (0,mermaid_934d9bea.k)(vertex.styles);
let vertexText = vertex.text !== void 0 ? vertex.text : vertex.id;
let vertexNode;
mermaid_934d9bea.l.info("vertex", vertex, vertex.labelType);
if (vertex.labelType === "markdown") {
mermaid_934d9bea.l.info("vertex", vertex, vertex.labelType);
} else {
if ((0,mermaid_934d9bea.m)((0,mermaid_934d9bea.c)().flowchart.htmlLabels)) {
const node = {
label: vertexText.replace(
/fa[blrs]?:fa-[\w-]+/g,
(s) => `<i class='${s.replace(":", " ")}'></i>`
)
};
vertexNode = (0,add_html_label/* addHtmlLabel */.a)(svg, node).node();
vertexNode.parentNode.removeChild(vertexNode);
} else {
const svgLabel = doc.createElementNS("http://www.w3.org/2000/svg", "text");
svgLabel.setAttribute("style", styles.labelStyle.replace("color:", "fill:"));
const rows = vertexText.split(mermaid_934d9bea.e.lineBreakRegex);
for (const row of rows) {
const tspan = doc.createElementNS("http://www.w3.org/2000/svg", "tspan");
tspan.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve");
tspan.setAttribute("dy", "1em");
tspan.setAttribute("x", "1");
tspan.textContent = row;
svgLabel.appendChild(tspan);
}
vertexNode = svgLabel;
}
}
let radious = 0;
let _shape = "";
switch (vertex.type) {
case "round":
radious = 5;
_shape = "rect";
break;
case "square":
_shape = "rect";
break;
case "diamond":
_shape = "question";
break;
case "hexagon":
_shape = "hexagon";
break;
case "odd":
_shape = "rect_left_inv_arrow";
break;
case "lean_right":
_shape = "lean_right";
break;
case "lean_left":
_shape = "lean_left";
break;
case "trapezoid":
_shape = "trapezoid";
break;
case "inv_trapezoid":
_shape = "inv_trapezoid";
break;
case "odd_right":
_shape = "rect_left_inv_arrow";
break;
case "circle":
_shape = "circle";
break;
case "ellipse":
_shape = "ellipse";
break;
case "stadium":
_shape = "stadium";
break;
case "subroutine":
_shape = "subroutine";
break;
case "cylinder":
_shape = "cylinder";
break;
case "group":
_shape = "rect";
break;
case "doublecircle":
_shape = "doublecircle";
break;
default:
_shape = "rect";
}
g.setNode(vertex.id, {
labelStyle: styles.labelStyle,
shape: _shape,
labelText: vertexText,
labelType: vertex.labelType,
rx: radious,
ry: radious,
class: classStr,
style: styles.style,
id: vertex.id,
link: vertex.link,
linkTarget: vertex.linkTarget,
tooltip: diagObj.db.getTooltip(vertex.id) || "",
domId: diagObj.db.lookUpDomId(vertex.id),
haveCallback: vertex.haveCallback,
width: vertex.type === "group" ? 500 : void 0,
dir: vertex.dir,
type: vertex.type,
props: vertex.props,
padding: (0,mermaid_934d9bea.c)().flowchart.padding
});
mermaid_934d9bea.l.info("setNode", {
labelStyle: styles.labelStyle,
labelType: vertex.labelType,
shape: _shape,
labelText: vertexText,
rx: radious,
ry: radious,
class: classStr,
style: styles.style,
id: vertex.id,
domId: diagObj.db.lookUpDomId(vertex.id),
width: vertex.type === "group" ? 500 : void 0,
type: vertex.type,
dir: vertex.dir,
props: vertex.props,
padding: (0,mermaid_934d9bea.c)().flowchart.padding
});
});
};
const addEdges = function(edges, g, diagObj) {
mermaid_934d9bea.l.info("abc78 edges = ", edges);
let cnt = 0;
let linkIdCnt = {};
let defaultStyle;
let defaultLabelStyle;
if (edges.defaultStyle !== void 0) {
const defaultStyles = (0,mermaid_934d9bea.k)(edges.defaultStyle);
defaultStyle = defaultStyles.style;
defaultLabelStyle = defaultStyles.labelStyle;
}
edges.forEach(function(edge) {
cnt++;
const linkIdBase = "L-" + edge.start + "-" + edge.end;
if (linkIdCnt[linkIdBase] === void 0) {
linkIdCnt[linkIdBase] = 0;
mermaid_934d9bea.l.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]);
} else {
linkIdCnt[linkIdBase]++;
mermaid_934d9bea.l.info("abc78 new entry", linkIdBase, linkIdCnt[linkIdBase]);
}
let linkId = linkIdBase + "-" + linkIdCnt[linkIdBase];
mermaid_934d9bea.l.info("abc78 new link id to be used is", linkIdBase, linkId, linkIdCnt[linkIdBase]);
const linkNameStart = "LS-" + edge.start;
const linkNameEnd = "LE-" + edge.end;
const edgeData = { style: "", labelStyle: "" };
edgeData.minlen = edge.length || 1;
if (edge.type === "arrow_open") {
edgeData.arrowhead = "none";
} else {
edgeData.arrowhead = "normal";
}
edgeData.arrowTypeStart = "arrow_open";
edgeData.arrowTypeEnd = "arrow_open";
switch (edge.type) {
case "double_arrow_cross":
edgeData.arrowTypeStart = "arrow_cross";
case "arrow_cross":
edgeData.arrowTypeEnd = "arrow_cross";
break;
case "double_arrow_point":
edgeData.arrowTypeStart = "arrow_point";
case "arrow_point":
edgeData.arrowTypeEnd = "arrow_point";
break;
case "double_arrow_circle":
edgeData.arrowTypeStart = "arrow_circle";
case "arrow_circle":
edgeData.arrowTypeEnd = "arrow_circle";
break;
}
let style = "";
let labelStyle = "";
switch (edge.stroke) {
case "normal":
style = "fill:none;";
if (defaultStyle !== void 0) {
style = defaultStyle;
}
if (defaultLabelStyle !== void 0) {
labelStyle = defaultLabelStyle;
}
edgeData.thickness = "normal";
edgeData.pattern = "solid";
break;
case "dotted":
edgeData.thickness = "normal";
edgeData.pattern = "dotted";
edgeData.style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
break;
case "thick":
edgeData.thickness = "thick";
edgeData.pattern = "solid";
edgeData.style = "stroke-width: 3.5px;fill:none;";
break;
case "invisible":
edgeData.thickness = "invisible";
edgeData.pattern = "solid";
edgeData.style = "stroke-width: 0;fill:none;";
break;
}
if (edge.style !== void 0) {
const styles = (0,mermaid_934d9bea.k)(edge.style);
style = styles.style;
labelStyle = styles.labelStyle;
}
edgeData.style = edgeData.style += style;
edgeData.labelStyle = edgeData.labelStyle += labelStyle;
if (edge.interpolate !== void 0) {
edgeData.curve = (0,mermaid_934d9bea.n)(edge.interpolate, src/* curveLinear */.c_6);
} else if (edges.defaultInterpolate !== void 0) {
edgeData.curve = (0,mermaid_934d9bea.n)(edges.defaultInterpolate, src/* curveLinear */.c_6);
} else {
edgeData.curve = (0,mermaid_934d9bea.n)(conf.curve, src/* curveLinear */.c_6);
}
if (edge.text === void 0) {
if (edge.style !== void 0) {
edgeData.arrowheadStyle = "fill: #333";
}
} else {
edgeData.arrowheadStyle = "fill: #333";
edgeData.labelpos = "c";
}
edgeData.labelType = edge.labelType;
edgeData.label = edge.text.replace(mermaid_934d9bea.e.lineBreakRegex, "\n");
if (edge.style === void 0) {
edgeData.style = edgeData.style || "stroke: #333; stroke-width: 1.5px;fill:none;";
}
edgeData.labelStyle = edgeData.labelStyle.replace("color:", "fill:");
edgeData.id = linkId;
edgeData.classes = "flowchart-link " + linkNameStart + " " + linkNameEnd;
g.setEdge(edge.start, edge.end, edgeData, cnt);
});
};
const getClasses = function(text, diagObj) {
return diagObj.db.getClasses();
};
const draw = async function(text, id, _version, diagObj) {
mermaid_934d9bea.l.info("Drawing flowchart");
let dir = diagObj.db.getDirection();
if (dir === void 0) {
dir = "TD";
}
const { securityLevel, flowchart: conf2 } = (0,mermaid_934d9bea.c)();
const nodeSpacing = conf2.nodeSpacing || 50;
const rankSpacing = conf2.rankSpacing || 50;
let sandboxElement;
if (securityLevel === "sandbox") {
sandboxElement = (0,src/* select */.Ys)("#i" + id);
}
const root = securityLevel === "sandbox" ? (0,src/* select */.Ys)(sandboxElement.nodes()[0].contentDocument.body) : (0,src/* select */.Ys)("body");
const doc = securityLevel === "sandbox" ? sandboxElement.nodes()[0].contentDocument : document;
const g = new graphlib/* Graph */.k({
multigraph: true,
compound: true
}).setGraph({
rankdir: dir,
nodesep: nodeSpacing,
ranksep: rankSpacing,
marginx: 0,
marginy: 0
}).setDefaultEdgeLabel(function() {
return {};
});
let subG;
const subGraphs = diagObj.db.getSubGraphs();
mermaid_934d9bea.l.info("Subgraphs - ", subGraphs);
for (let i2 = subGraphs.length - 1; i2 >= 0; i2--) {
subG = subGraphs[i2];
mermaid_934d9bea.l.info("Subgraph - ", subG);
diagObj.db.addVertex(
subG.id,
{ text: subG.title, type: subG.labelType },
"group",
void 0,
subG.classes,
subG.dir
);
}
const vert = diagObj.db.getVertices();
const edges = diagObj.db.getEdges();
mermaid_934d9bea.l.info("Edges", edges);
let i = 0;
for (i = subGraphs.length - 1; i >= 0; i--) {
subG = subGraphs[i];
(0,src/* selectAll */.td_)("cluster").append("text");
for (let j = 0; j < subG.nodes.length; j++) {
mermaid_934d9bea.l.info("Setting up subgraphs", subG.nodes[j], subG.id);
g.setParent(subG.nodes[j], subG.id);
}
}
addVertices(vert, g, id, root, doc, diagObj);
addEdges(edges, g);
const svg = root.select(`[id="${id}"]`);
const element = root.select("#" + id + " g");
await (0,index_67a42d7d.r)(element, g, ["point", "circle", "cross"], "flowchart", id);
mermaid_934d9bea.u.insertTitle(svg, "flowchartTitleText", conf2.titleTopMargin, diagObj.db.getDiagramTitle());
(0,mermaid_934d9bea.o)(g, svg, conf2.diagramPadding, conf2.useMaxWidth);
diagObj.db.indexNodes("subGraph" + i);
if (!conf2.htmlLabels) {
const labels = doc.querySelectorAll('[id="' + id + '"] .edgeLabel .label');
for (const label of labels) {
const dim = label.getBBox();
const rect = doc.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.setAttribute("rx", 0);
rect.setAttribute("ry", 0);
rect.setAttribute("width", dim.width);
rect.setAttribute("height", dim.height);
label.insertBefore(rect, label.firstChild);
}
}
const keys = Object.keys(vert);
keys.forEach(function(key) {
const vertex = vert[key];
if (vertex.link) {
const node = (0,src/* select */.Ys)("#" + id + ' [id="' + key + '"]');
if (node) {
const link = doc.createElementNS("http://www.w3.org/2000/svg", "a");
link.setAttributeNS("http://www.w3.org/2000/svg", "class", vertex.classes.join(" "));
link.setAttributeNS("http://www.w3.org/2000/svg", "href", vertex.link);
link.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener");
if (securityLevel === "sandbox") {
link.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top");
} else if (vertex.linkTarget) {
link.setAttributeNS("http://www.w3.org/2000/svg", "target", vertex.linkTarget);
}
const linkNode = node.insert(function() {
return link;
}, ":first-child");
const shape = node.select(".label-container");
if (shape) {
linkNode.append(function() {
return shape.node();
});
}
const label = node.select(".label");
if (label) {
linkNode.append(function() {
return label.node();
});
}
}
}
});
};
const flowRendererV2 = {
setConf,
addVertices,
addEdges,
getClasses,
draw
};
const fade = (color, opacity) => {
const channel = methods_channel;
const r = channel(color, "r");
const g = channel(color, "g");
const b = channel(color, "b");
return rgba/* default */.Z(r, g, b, opacity);
};
const getStyles = (options) => `.label {
font-family: ${options.fontFamily};
color: ${options.nodeTextColor || options.textColor};
}
.cluster-label text {
fill: ${options.titleColor};
}
.cluster-label span,p {
color: ${options.titleColor};
}
.label text,span,p {
fill: ${options.nodeTextColor || options.textColor};
color: ${options.nodeTextColor || options.textColor};
}
.node rect,
.node circle,
.node ellipse,
.node polygon,
.node path {
fill: ${options.mainBkg};
stroke: ${options.nodeBorder};
stroke-width: 1px;
}
.flowchart-label text {
text-anchor: middle;
}
// .flowchart-label .text-outer-tspan {
// text-anchor: middle;
// }
// .flowchart-label .text-inner-tspan {
// text-anchor: start;
// }
.node .label {
text-align: center;
}
.node.clickable {
cursor: pointer;
}
.arrowheadPath {
fill: ${options.arrowheadColor};
}
.edgePath .path {
stroke: ${options.lineColor};
stroke-width: 2.0px;
}
.flowchart-link {
stroke: ${options.lineColor};
fill: none;
}
.edgeLabel {
background-color: ${options.edgeLabelBackground};
rect {
opacity: 0.5;
background-color: ${options.edgeLabelBackground};
fill: ${options.edgeLabelBackground};
}
text-align: center;
}
/* For html labels only */
.labelBkg {
background-color: ${fade(options.edgeLabelBackground, 0.5)};
// background-color:
}
.cluster rect {
fill: ${options.clusterBkg};
stroke: ${options.clusterBorder};
stroke-width: 1px;
}
.cluster text {
fill: ${options.titleColor};
}
.cluster span,p {
color: ${options.titleColor};
}
/* .cluster div {
color: ${options.titleColor};
} */
div.mermaidTooltip {
position: absolute;
text-align: center;
max-width: 200px;
padding: 2px;
font-family: ${options.fontFamily};
font-size: 12px;
background: ${options.tertiaryColor};
border: 1px solid ${options.border2};
border-radius: 2px;
pointer-events: none;
z-index: 100;
}
.flowchartTitleText {
text-anchor: middle;
font-size: 18px;
fill: ${options.textColor};
}
`;
const flowStyles = getStyles;
/***/ })
};
;