cerebrate/webroot/js/node_modules/mermaid/dist/mermaid-0d192ec3.js

6232 lines
221 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

import { dedent } from "ts-dedent";
import dayjs from "dayjs";
import { sanitizeUrl } from "@braintree/sanitize-url";
import { select, curveBasis, curveBasisClosed, curveBasisOpen, curveBumpX, curveBumpY, curveBundle, curveCardinalClosed, curveCardinalOpen, curveCardinal, curveCatmullRomClosed, curveCatmullRomOpen, curveCatmullRom, curveLinear, curveLinearClosed, curveMonotoneX, curveMonotoneY, curveNatural, curveStep, curveStepAfter, curveStepBefore } from "d3";
import DOMPurify from "dompurify";
import { adjust, invert, darken, lighten, isDark, rgba } from "khroma";
import memoize from "lodash-es/memoize.js";
import merge$1 from "lodash-es/merge.js";
import { serialize, compile, stringify } from "stylis";
import isEmpty from "lodash-es/isEmpty.js";
const LEVELS = {
trace: 0,
debug: 1,
info: 2,
warn: 3,
error: 4,
fatal: 5
};
const log$1 = {
trace: (..._args) => {
},
debug: (..._args) => {
},
info: (..._args) => {
},
warn: (..._args) => {
},
error: (..._args) => {
},
fatal: (..._args) => {
}
};
const setLogLevel$1 = function(level = "fatal") {
let numericLevel = LEVELS.fatal;
if (typeof level === "string") {
level = level.toLowerCase();
if (level in LEVELS) {
numericLevel = LEVELS[level];
}
} else if (typeof level === "number") {
numericLevel = level;
}
log$1.trace = () => {
};
log$1.debug = () => {
};
log$1.info = () => {
};
log$1.warn = () => {
};
log$1.error = () => {
};
log$1.fatal = () => {
};
if (numericLevel <= LEVELS.fatal) {
log$1.fatal = console.error ? console.error.bind(console, format("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format("FATAL"));
}
if (numericLevel <= LEVELS.error) {
log$1.error = console.error ? console.error.bind(console, format("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format("ERROR"));
}
if (numericLevel <= LEVELS.warn) {
log$1.warn = console.warn ? console.warn.bind(console, format("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format("WARN"));
}
if (numericLevel <= LEVELS.info) {
log$1.info = console.info ? console.info.bind(console, format("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format("INFO"));
}
if (numericLevel <= LEVELS.debug) {
log$1.debug = console.debug ? console.debug.bind(console, format("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("DEBUG"));
}
if (numericLevel <= LEVELS.trace) {
log$1.trace = console.debug ? console.debug.bind(console, format("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format("TRACE"));
}
};
const format = (level) => {
const time = dayjs().format("ss.SSS");
return `%c${time} : ${level} : `;
};
const lineBreakRegex = /<br\s*\/?>/gi;
const getRows = (s) => {
if (!s) {
return [""];
}
const str2 = breakToPlaceholder(s).replace(/\\n/g, "#br#");
return str2.split("#br#");
};
const removeScript = (txt) => {
return DOMPurify.sanitize(txt);
};
const sanitizeMore = (text, config2) => {
var _a;
if (((_a = config2.flowchart) == null ? void 0 : _a.htmlLabels) !== false) {
const level = config2.securityLevel;
if (level === "antiscript" || level === "strict") {
text = removeScript(text);
} else if (level !== "loose") {
text = breakToPlaceholder(text);
text = text.replace(/</g, "&lt;").replace(/>/g, "&gt;");
text = text.replace(/=/g, "&equals;");
text = placeholderToBreak(text);
}
}
return text;
};
const sanitizeText$2 = (text, config2) => {
if (!text) {
return text;
}
if (config2.dompurifyConfig) {
text = DOMPurify.sanitize(sanitizeMore(text, config2), config2.dompurifyConfig).toString();
} else {
text = DOMPurify.sanitize(sanitizeMore(text, config2), {
FORBID_TAGS: ["style"]
}).toString();
}
return text;
};
const sanitizeTextOrArray = (a, config2) => {
if (typeof a === "string") {
return sanitizeText$2(a, config2);
}
return a.flat().map((x) => sanitizeText$2(x, config2));
};
const hasBreaks = (text) => {
return lineBreakRegex.test(text);
};
const splitBreaks = (text) => {
return text.split(lineBreakRegex);
};
const placeholderToBreak = (s) => {
return s.replace(/#br#/g, "<br/>");
};
const breakToPlaceholder = (s) => {
return s.replace(lineBreakRegex, "#br#");
};
const getUrl = (useAbsolute) => {
let url = "";
if (useAbsolute) {
url = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search;
url = url.replaceAll(/\(/g, "\\(");
url = url.replaceAll(/\)/g, "\\)");
}
return url;
};
const evaluate = (val) => val === false || ["false", "null", "0"].includes(String(val).trim().toLowerCase()) ? false : true;
const getMax = function(...values) {
const newValues = values.filter((value) => {
return !isNaN(value);
});
return Math.max(...newValues);
};
const getMin = function(...values) {
const newValues = values.filter((value) => {
return !isNaN(value);
});
return Math.min(...newValues);
};
const parseGenericTypes = function(input) {
const inputSets = input.split(/(,)/);
const output = [];
for (let i = 0; i < inputSets.length; i++) {
let thisSet = inputSets[i];
if (thisSet === "," && i > 0 && i + 1 < inputSets.length) {
const previousSet = inputSets[i - 1];
const nextSet = inputSets[i + 1];
if (shouldCombineSets(previousSet, nextSet)) {
thisSet = previousSet + "," + nextSet;
i++;
output.pop();
}
}
output.push(processSet(thisSet));
}
return output.join("");
};
const countOccurrence = (string, substring) => {
return Math.max(0, string.split(substring).length - 1);
};
const shouldCombineSets = (previousSet, nextSet) => {
const prevCount = countOccurrence(previousSet, "~");
const nextCount = countOccurrence(nextSet, "~");
return prevCount === 1 && nextCount === 1;
};
const processSet = (input) => {
const tildeCount = countOccurrence(input, "~");
let hasStartingTilde = false;
if (tildeCount <= 1) {
return input;
}
if (tildeCount % 2 !== 0 && input.startsWith("~")) {
input = input.substring(1);
hasStartingTilde = true;
}
const chars = [...input];
let first = chars.indexOf("~");
let last = chars.lastIndexOf("~");
while (first !== -1 && last !== -1 && first !== last) {
chars[first] = "<";
chars[last] = ">";
first = chars.indexOf("~");
last = chars.lastIndexOf("~");
}
if (hasStartingTilde) {
chars.unshift("~");
}
return chars.join("");
};
const common$1 = {
getRows,
sanitizeText: sanitizeText$2,
sanitizeTextOrArray,
hasBreaks,
splitBreaks,
lineBreakRegex,
removeScript,
getUrl,
evaluate,
getMax,
getMin
};
const mkBorder = (col, darkMode) => darkMode ? adjust(col, { s: -40, l: 10 }) : adjust(col, { s: -40, l: -10 });
const oldAttributeBackgroundColorOdd = "#ffffff";
const oldAttributeBackgroundColorEven = "#f2f2f2";
let Theme$4 = class Theme {
constructor() {
this.background = "#f4f4f4";
this.primaryColor = "#fff4dd";
this.noteBkgColor = "#fff5ad";
this.noteTextColor = "#333";
this.THEME_COLOR_LIMIT = 12;
this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
this.fontSize = "16px";
}
updateColors() {
this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333");
this.secondaryColor = this.secondaryColor || adjust(this.primaryColor, { h: -120 });
this.tertiaryColor = this.tertiaryColor || adjust(this.primaryColor, { h: 180, l: 5 });
this.primaryBorderColor = this.primaryBorderColor || mkBorder(this.primaryColor, this.darkMode);
this.secondaryBorderColor = this.secondaryBorderColor || mkBorder(this.secondaryColor, this.darkMode);
this.tertiaryBorderColor = this.tertiaryBorderColor || mkBorder(this.tertiaryColor, this.darkMode);
this.noteBorderColor = this.noteBorderColor || mkBorder(this.noteBkgColor, this.darkMode);
this.noteBkgColor = this.noteBkgColor || "#fff5ad";
this.noteTextColor = this.noteTextColor || "#333";
this.secondaryTextColor = this.secondaryTextColor || invert(this.secondaryColor);
this.tertiaryTextColor = this.tertiaryTextColor || invert(this.tertiaryColor);
this.lineColor = this.lineColor || invert(this.background);
this.arrowheadColor = this.arrowheadColor || invert(this.background);
this.textColor = this.textColor || this.primaryTextColor;
this.border2 = this.border2 || this.tertiaryBorderColor;
this.nodeBkg = this.nodeBkg || this.primaryColor;
this.mainBkg = this.mainBkg || this.primaryColor;
this.nodeBorder = this.nodeBorder || this.primaryBorderColor;
this.clusterBkg = this.clusterBkg || this.tertiaryColor;
this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor;
this.defaultLinkColor = this.defaultLinkColor || this.lineColor;
this.titleColor = this.titleColor || this.tertiaryTextColor;
this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
this.nodeTextColor = this.nodeTextColor || this.primaryTextColor;
this.actorBorder = this.actorBorder || this.primaryBorderColor;
this.actorBkg = this.actorBkg || this.mainBkg;
this.actorTextColor = this.actorTextColor || this.primaryTextColor;
this.actorLineColor = this.actorLineColor || "grey";
this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg;
this.signalColor = this.signalColor || this.textColor;
this.signalTextColor = this.signalTextColor || this.textColor;
this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder;
this.labelTextColor = this.labelTextColor || this.actorTextColor;
this.loopTextColor = this.loopTextColor || this.actorTextColor;
this.activationBorderColor = this.activationBorderColor || darken(this.secondaryColor, 10);
this.activationBkgColor = this.activationBkgColor || this.secondaryColor;
this.sequenceNumberColor = this.sequenceNumberColor || invert(this.lineColor);
this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor;
this.altSectionBkgColor = this.altSectionBkgColor || "white";
this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor;
this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor;
this.excludeBkgColor = this.excludeBkgColor || "#eeeeee";
this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor;
this.taskBkgColor = this.taskBkgColor || this.primaryColor;
this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor;
this.activeTaskBkgColor = this.activeTaskBkgColor || lighten(this.primaryColor, 23);
this.gridColor = this.gridColor || "lightgrey";
this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey";
this.doneTaskBorderColor = this.doneTaskBorderColor || "grey";
this.critBorderColor = this.critBorderColor || "#ff8888";
this.critBkgColor = this.critBkgColor || "red";
this.todayLineColor = this.todayLineColor || "red";
this.taskTextColor = this.taskTextColor || this.textColor;
this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor;
this.taskTextLightColor = this.taskTextLightColor || this.textColor;
this.taskTextColor = this.taskTextColor || this.primaryTextColor;
this.taskTextDarkColor = this.taskTextDarkColor || this.textColor;
this.taskTextClickableColor = this.taskTextClickableColor || "#003163";
this.personBorder = this.personBorder || this.primaryBorderColor;
this.personBkg = this.personBkg || this.mainBkg;
this.transitionColor = this.transitionColor || this.lineColor;
this.transitionLabelColor = this.transitionLabelColor || this.textColor;
this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
this.stateBkg = this.stateBkg || this.mainBkg;
this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
this.altBackground = this.altBackground || this.tertiaryColor;
this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
this.compositeBorder = this.compositeBorder || this.nodeBorder;
this.innerEndBackground = this.nodeBorder;
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
this.transitionColor = this.transitionColor || this.lineColor;
this.specialStateColor = this.lineColor;
this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor;
this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210, l: 150 });
this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
if (this.darkMode) {
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScale" + i] = darken(this["cScale" + i], 75);
}
} else {
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScale" + i] = darken(this["cScale" + i], 25);
}
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleInv" + i] = this["cScaleInv" + i] || invert(this["cScale" + i]);
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
if (this.darkMode) {
this["cScalePeer" + i] = this["cScalePeer" + i] || lighten(this["cScale" + i], 10);
} else {
this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 10);
}
}
this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
}
const multiplier = this.darkMode ? -4 : -1;
for (let i = 0; i < 5; i++) {
this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 180, s: -15, l: multiplier * (5 + i * 3) });
this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 180, s: -15, l: multiplier * (8 + i * 3) });
}
this.classText = this.classText || this.textColor;
this.fillType0 = this.fillType0 || this.primaryColor;
this.fillType1 = this.fillType1 || this.secondaryColor;
this.fillType2 = this.fillType2 || adjust(this.primaryColor, { h: 64 });
this.fillType3 = this.fillType3 || adjust(this.secondaryColor, { h: 64 });
this.fillType4 = this.fillType4 || adjust(this.primaryColor, { h: -64 });
this.fillType5 = this.fillType5 || adjust(this.secondaryColor, { h: -64 });
this.fillType6 = this.fillType6 || adjust(this.primaryColor, { h: 128 });
this.fillType7 = this.fillType7 || adjust(this.secondaryColor, { h: 128 });
this.pie1 = this.pie1 || this.primaryColor;
this.pie2 = this.pie2 || this.secondaryColor;
this.pie3 = this.pie3 || this.tertiaryColor;
this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -10 });
this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -10 });
this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -10 });
this.pie7 = this.pie7 || adjust(this.primaryColor, { h: 60, l: -10 });
this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });
this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });
this.pie10 = this.pie10 || adjust(this.primaryColor, { h: 60, l: -20 });
this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -20 });
this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -10 });
this.pieTitleTextSize = this.pieTitleTextSize || "25px";
this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
this.pieSectionTextSize = this.pieSectionTextSize || "17px";
this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
this.pieLegendTextSize = this.pieLegendTextSize || "17px";
this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
this.pieStrokeColor = this.pieStrokeColor || "black";
this.pieStrokeWidth = this.pieStrokeWidth || "2px";
this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
this.pieOpacity = this.pieOpacity || "0.7";
this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
this.requirementBackground = this.requirementBackground || this.primaryColor;
this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
this.requirementBorderSize = this.requirementBorderSize || "1";
this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
this.relationColor = this.relationColor || this.lineColor;
this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
this.git0 = this.git0 || this.primaryColor;
this.git1 = this.git1 || this.secondaryColor;
this.git2 = this.git2 || this.tertiaryColor;
this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });
this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });
this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });
this.git6 = this.git6 || adjust(this.primaryColor, { h: 60 });
this.git7 = this.git7 || adjust(this.primaryColor, { h: 120 });
if (this.darkMode) {
this.git0 = lighten(this.git0, 25);
this.git1 = lighten(this.git1, 25);
this.git2 = lighten(this.git2, 25);
this.git3 = lighten(this.git3, 25);
this.git4 = lighten(this.git4, 25);
this.git5 = lighten(this.git5, 25);
this.git6 = lighten(this.git6, 25);
this.git7 = lighten(this.git7, 25);
} else {
this.git0 = darken(this.git0, 25);
this.git1 = darken(this.git1, 25);
this.git2 = darken(this.git2, 25);
this.git3 = darken(this.git3, 25);
this.git4 = darken(this.git4, 25);
this.git5 = darken(this.git5, 25);
this.git6 = darken(this.git6, 25);
this.git7 = darken(this.git7, 25);
}
this.gitInv0 = this.gitInv0 || invert(this.git0);
this.gitInv1 = this.gitInv1 || invert(this.git1);
this.gitInv2 = this.gitInv2 || invert(this.git2);
this.gitInv3 = this.gitInv3 || invert(this.git3);
this.gitInv4 = this.gitInv4 || invert(this.git4);
this.gitInv5 = this.gitInv5 || invert(this.git5);
this.gitInv6 = this.gitInv6 || invert(this.git6);
this.gitInv7 = this.gitInv7 || invert(this.git7);
this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor);
this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor;
this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor;
this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor;
this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor;
this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor;
this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor;
this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor;
this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor;
this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
this.tagLabelFontSize = this.tagLabelFontSize || "10px";
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || "10px";
this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
}
calculate(overrides) {
if (typeof overrides !== "object") {
this.updateColors();
return;
}
const keys = Object.keys(overrides);
keys.forEach((k) => {
this[k] = overrides[k];
});
this.updateColors();
keys.forEach((k) => {
this[k] = overrides[k];
});
}
};
const getThemeVariables$4 = (userOverrides) => {
const theme2 = new Theme$4();
theme2.calculate(userOverrides);
return theme2;
};
let Theme$3 = class Theme2 {
constructor() {
this.background = "#333";
this.primaryColor = "#1f2020";
this.secondaryColor = lighten(this.primaryColor, 16);
this.tertiaryColor = adjust(this.primaryColor, { h: -160 });
this.primaryBorderColor = invert(this.background);
this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
this.primaryTextColor = invert(this.primaryColor);
this.secondaryTextColor = invert(this.secondaryColor);
this.tertiaryTextColor = invert(this.tertiaryColor);
this.lineColor = invert(this.background);
this.textColor = invert(this.background);
this.mainBkg = "#1f2020";
this.secondBkg = "calculated";
this.mainContrastColor = "lightgrey";
this.darkTextColor = lighten(invert("#323D47"), 10);
this.lineColor = "calculated";
this.border1 = "#81B1DB";
this.border2 = rgba(255, 255, 255, 0.25);
this.arrowheadColor = "calculated";
this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
this.fontSize = "16px";
this.labelBackground = "#181818";
this.textColor = "#ccc";
this.THEME_COLOR_LIMIT = 12;
this.nodeBkg = "calculated";
this.nodeBorder = "calculated";
this.clusterBkg = "calculated";
this.clusterBorder = "calculated";
this.defaultLinkColor = "calculated";
this.titleColor = "#F9FFFE";
this.edgeLabelBackground = "calculated";
this.actorBorder = "calculated";
this.actorBkg = "calculated";
this.actorTextColor = "calculated";
this.actorLineColor = "calculated";
this.signalColor = "calculated";
this.signalTextColor = "calculated";
this.labelBoxBkgColor = "calculated";
this.labelBoxBorderColor = "calculated";
this.labelTextColor = "calculated";
this.loopTextColor = "calculated";
this.noteBorderColor = "calculated";
this.noteBkgColor = "#fff5ad";
this.noteTextColor = "calculated";
this.activationBorderColor = "calculated";
this.activationBkgColor = "calculated";
this.sequenceNumberColor = "black";
this.sectionBkgColor = darken("#EAE8D9", 30);
this.altSectionBkgColor = "calculated";
this.sectionBkgColor2 = "#EAE8D9";
this.excludeBkgColor = darken(this.sectionBkgColor, 10);
this.taskBorderColor = rgba(255, 255, 255, 70);
this.taskBkgColor = "calculated";
this.taskTextColor = "calculated";
this.taskTextLightColor = "calculated";
this.taskTextOutsideColor = "calculated";
this.taskTextClickableColor = "#003163";
this.activeTaskBorderColor = rgba(255, 255, 255, 50);
this.activeTaskBkgColor = "#81B1DB";
this.gridColor = "calculated";
this.doneTaskBkgColor = "calculated";
this.doneTaskBorderColor = "grey";
this.critBorderColor = "#E83737";
this.critBkgColor = "#E83737";
this.taskTextDarkColor = "calculated";
this.todayLineColor = "#DB5757";
this.personBorder = this.primaryBorderColor;
this.personBkg = this.mainBkg;
this.labelColor = "calculated";
this.errorBkgColor = "#a44141";
this.errorTextColor = "#ddd";
}
updateColors() {
this.secondBkg = lighten(this.mainBkg, 16);
this.lineColor = this.mainContrastColor;
this.arrowheadColor = this.mainContrastColor;
this.nodeBkg = this.mainBkg;
this.nodeBorder = this.border1;
this.clusterBkg = this.secondBkg;
this.clusterBorder = this.border2;
this.defaultLinkColor = this.lineColor;
this.edgeLabelBackground = lighten(this.labelBackground, 25);
this.actorBorder = this.border1;
this.actorBkg = this.mainBkg;
this.actorTextColor = this.mainContrastColor;
this.actorLineColor = this.mainContrastColor;
this.signalColor = this.mainContrastColor;
this.signalTextColor = this.mainContrastColor;
this.labelBoxBkgColor = this.actorBkg;
this.labelBoxBorderColor = this.actorBorder;
this.labelTextColor = this.mainContrastColor;
this.loopTextColor = this.mainContrastColor;
this.noteBorderColor = this.secondaryBorderColor;
this.noteBkgColor = this.secondBkg;
this.noteTextColor = this.secondaryTextColor;
this.activationBorderColor = this.border1;
this.activationBkgColor = this.secondBkg;
this.altSectionBkgColor = this.background;
this.taskBkgColor = lighten(this.mainBkg, 23);
this.taskTextColor = this.darkTextColor;
this.taskTextLightColor = this.mainContrastColor;
this.taskTextOutsideColor = this.taskTextLightColor;
this.gridColor = this.mainContrastColor;
this.doneTaskBkgColor = this.mainContrastColor;
this.taskTextDarkColor = this.darkTextColor;
this.transitionColor = this.transitionColor || this.lineColor;
this.transitionLabelColor = this.transitionLabelColor || this.textColor;
this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
this.stateBkg = this.stateBkg || this.mainBkg;
this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
this.altBackground = this.altBackground || "#555";
this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
this.compositeBorder = this.compositeBorder || this.nodeBorder;
this.innerEndBackground = this.primaryBorderColor;
this.specialStateColor = "#f4f4f4";
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
this.fillType0 = this.primaryColor;
this.fillType1 = this.secondaryColor;
this.fillType2 = adjust(this.primaryColor, { h: 64 });
this.fillType3 = adjust(this.secondaryColor, { h: 64 });
this.fillType4 = adjust(this.primaryColor, { h: -64 });
this.fillType5 = adjust(this.secondaryColor, { h: -64 });
this.fillType6 = adjust(this.primaryColor, { h: 128 });
this.fillType7 = adjust(this.secondaryColor, { h: 128 });
this.cScale1 = this.cScale1 || "#0b0000";
this.cScale2 = this.cScale2 || "#4d1037";
this.cScale3 = this.cScale3 || "#3f5258";
this.cScale4 = this.cScale4 || "#4f2f1b";
this.cScale5 = this.cScale5 || "#6e0a0a";
this.cScale6 = this.cScale6 || "#3b0048";
this.cScale7 = this.cScale7 || "#995a01";
this.cScale8 = this.cScale8 || "#154706";
this.cScale9 = this.cScale9 || "#161722";
this.cScale10 = this.cScale10 || "#00296f";
this.cScale11 = this.cScale11 || "#01629c";
this.cScale12 = this.cScale12 || "#010029";
this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor;
this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });
this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleInv" + i] = this["cScaleInv" + i] || invert(this["cScale" + i]);
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScalePeer" + i] = this["cScalePeer" + i] || lighten(this["cScale" + i], 10);
}
for (let i = 0; i < 5; i++) {
this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(-10 + i * 4) });
this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(-7 + i * 4) });
}
this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["pie" + i] = this["cScale" + i];
}
this.pieTitleTextSize = this.pieTitleTextSize || "25px";
this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
this.pieSectionTextSize = this.pieSectionTextSize || "17px";
this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
this.pieLegendTextSize = this.pieLegendTextSize || "17px";
this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
this.pieStrokeColor = this.pieStrokeColor || "black";
this.pieStrokeWidth = this.pieStrokeWidth || "2px";
this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
this.pieOpacity = this.pieOpacity || "0.7";
this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
this.classText = this.primaryTextColor;
this.requirementBackground = this.requirementBackground || this.primaryColor;
this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
this.requirementBorderSize = this.requirementBorderSize || "1";
this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
this.relationColor = this.relationColor || this.lineColor;
this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? darken(this.secondaryColor, 30) : this.secondaryColor);
this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
this.git0 = lighten(this.secondaryColor, 20);
this.git1 = lighten(this.pie2 || this.secondaryColor, 20);
this.git2 = lighten(this.pie3 || this.tertiaryColor, 20);
this.git3 = lighten(this.pie4 || adjust(this.primaryColor, { h: -30 }), 20);
this.git4 = lighten(this.pie5 || adjust(this.primaryColor, { h: -60 }), 20);
this.git5 = lighten(this.pie6 || adjust(this.primaryColor, { h: -90 }), 10);
this.git6 = lighten(this.pie7 || adjust(this.primaryColor, { h: 60 }), 10);
this.git7 = lighten(this.pie8 || adjust(this.primaryColor, { h: 120 }), 20);
this.gitInv0 = this.gitInv0 || invert(this.git0);
this.gitInv1 = this.gitInv1 || invert(this.git1);
this.gitInv2 = this.gitInv2 || invert(this.git2);
this.gitInv3 = this.gitInv3 || invert(this.git3);
this.gitInv4 = this.gitInv4 || invert(this.git4);
this.gitInv5 = this.gitInv5 || invert(this.git5);
this.gitInv6 = this.gitInv6 || invert(this.git6);
this.gitInv7 = this.gitInv7 || invert(this.git7);
this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);
this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);
this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
this.tagLabelFontSize = this.tagLabelFontSize || "10px";
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || "10px";
this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || lighten(this.background, 12);
this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || lighten(this.background, 2);
}
calculate(overrides) {
if (typeof overrides !== "object") {
this.updateColors();
return;
}
const keys = Object.keys(overrides);
keys.forEach((k) => {
this[k] = overrides[k];
});
this.updateColors();
keys.forEach((k) => {
this[k] = overrides[k];
});
}
};
const getThemeVariables$3 = (userOverrides) => {
const theme2 = new Theme$3();
theme2.calculate(userOverrides);
return theme2;
};
let Theme$2 = class Theme3 {
constructor() {
this.background = "#f4f4f4";
this.primaryColor = "#ECECFF";
this.secondaryColor = adjust(this.primaryColor, { h: 120 });
this.secondaryColor = "#ffffde";
this.tertiaryColor = adjust(this.primaryColor, { h: -160 });
this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
this.primaryTextColor = invert(this.primaryColor);
this.secondaryTextColor = invert(this.secondaryColor);
this.tertiaryTextColor = invert(this.tertiaryColor);
this.lineColor = invert(this.background);
this.textColor = invert(this.background);
this.background = "white";
this.mainBkg = "#ECECFF";
this.secondBkg = "#ffffde";
this.lineColor = "#333333";
this.border1 = "#9370DB";
this.border2 = "#aaaa33";
this.arrowheadColor = "#333333";
this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
this.fontSize = "16px";
this.labelBackground = "#e8e8e8";
this.textColor = "#333";
this.THEME_COLOR_LIMIT = 12;
this.nodeBkg = "calculated";
this.nodeBorder = "calculated";
this.clusterBkg = "calculated";
this.clusterBorder = "calculated";
this.defaultLinkColor = "calculated";
this.titleColor = "calculated";
this.edgeLabelBackground = "calculated";
this.actorBorder = "calculated";
this.actorBkg = "calculated";
this.actorTextColor = "black";
this.actorLineColor = "grey";
this.signalColor = "calculated";
this.signalTextColor = "calculated";
this.labelBoxBkgColor = "calculated";
this.labelBoxBorderColor = "calculated";
this.labelTextColor = "calculated";
this.loopTextColor = "calculated";
this.noteBorderColor = "calculated";
this.noteBkgColor = "#fff5ad";
this.noteTextColor = "calculated";
this.activationBorderColor = "#666";
this.activationBkgColor = "#f4f4f4";
this.sequenceNumberColor = "white";
this.sectionBkgColor = "calculated";
this.altSectionBkgColor = "calculated";
this.sectionBkgColor2 = "calculated";
this.excludeBkgColor = "#eeeeee";
this.taskBorderColor = "calculated";
this.taskBkgColor = "calculated";
this.taskTextLightColor = "calculated";
this.taskTextColor = this.taskTextLightColor;
this.taskTextDarkColor = "calculated";
this.taskTextOutsideColor = this.taskTextDarkColor;
this.taskTextClickableColor = "calculated";
this.activeTaskBorderColor = "calculated";
this.activeTaskBkgColor = "calculated";
this.gridColor = "calculated";
this.doneTaskBkgColor = "calculated";
this.doneTaskBorderColor = "calculated";
this.critBorderColor = "calculated";
this.critBkgColor = "calculated";
this.todayLineColor = "calculated";
this.sectionBkgColor = rgba(102, 102, 255, 0.49);
this.altSectionBkgColor = "white";
this.sectionBkgColor2 = "#fff400";
this.taskBorderColor = "#534fbc";
this.taskBkgColor = "#8a90dd";
this.taskTextLightColor = "white";
this.taskTextColor = "calculated";
this.taskTextDarkColor = "black";
this.taskTextOutsideColor = "calculated";
this.taskTextClickableColor = "#003163";
this.activeTaskBorderColor = "#534fbc";
this.activeTaskBkgColor = "#bfc7ff";
this.gridColor = "lightgrey";
this.doneTaskBkgColor = "lightgrey";
this.doneTaskBorderColor = "grey";
this.critBorderColor = "#ff8888";
this.critBkgColor = "red";
this.todayLineColor = "red";
this.personBorder = this.primaryBorderColor;
this.personBkg = this.mainBkg;
this.labelColor = "black";
this.errorBkgColor = "#552222";
this.errorTextColor = "#552222";
this.updateColors();
}
updateColors() {
this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor;
this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });
this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
this["cScalePeer1"] = this["cScalePeer1"] || darken(this.secondaryColor, 45);
this["cScalePeer2"] = this["cScalePeer2"] || darken(this.tertiaryColor, 40);
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScale" + i] = darken(this["cScale" + i], 10);
this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 25);
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleInv" + i] = this["cScaleInv" + i] || adjust(this["cScale" + i], { h: 180 });
}
for (let i = 0; i < 5; i++) {
this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 30, l: -(5 + i * 5) });
this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 30, l: -(7 + i * 5) });
}
this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
if (this.labelTextColor !== "calculated") {
this.cScaleLabel0 = this.cScaleLabel0 || invert(this.labelTextColor);
this.cScaleLabel3 = this.cScaleLabel3 || invert(this.labelTextColor);
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.labelTextColor;
}
}
this.nodeBkg = this.mainBkg;
this.nodeBorder = this.border1;
this.clusterBkg = this.secondBkg;
this.clusterBorder = this.border2;
this.defaultLinkColor = this.lineColor;
this.titleColor = this.textColor;
this.edgeLabelBackground = this.labelBackground;
this.actorBorder = lighten(this.border1, 23);
this.actorBkg = this.mainBkg;
this.labelBoxBkgColor = this.actorBkg;
this.signalColor = this.textColor;
this.signalTextColor = this.textColor;
this.labelBoxBorderColor = this.actorBorder;
this.labelTextColor = this.actorTextColor;
this.loopTextColor = this.actorTextColor;
this.noteBorderColor = this.border2;
this.noteTextColor = this.actorTextColor;
this.taskTextColor = this.taskTextLightColor;
this.taskTextOutsideColor = this.taskTextDarkColor;
this.transitionColor = this.transitionColor || this.lineColor;
this.transitionLabelColor = this.transitionLabelColor || this.textColor;
this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
this.stateBkg = this.stateBkg || this.mainBkg;
this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
this.altBackground = this.altBackground || "#f0f0f0";
this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
this.compositeBorder = this.compositeBorder || this.nodeBorder;
this.innerEndBackground = this.nodeBorder;
this.specialStateColor = this.lineColor;
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
this.transitionColor = this.transitionColor || this.lineColor;
this.classText = this.primaryTextColor;
this.fillType0 = this.primaryColor;
this.fillType1 = this.secondaryColor;
this.fillType2 = adjust(this.primaryColor, { h: 64 });
this.fillType3 = adjust(this.secondaryColor, { h: 64 });
this.fillType4 = adjust(this.primaryColor, { h: -64 });
this.fillType5 = adjust(this.secondaryColor, { h: -64 });
this.fillType6 = adjust(this.primaryColor, { h: 128 });
this.fillType7 = adjust(this.secondaryColor, { h: 128 });
this.pie1 = this.pie1 || this.primaryColor;
this.pie2 = this.pie2 || this.secondaryColor;
this.pie3 = this.pie3 || adjust(this.tertiaryColor, { l: -40 });
this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -10 });
this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -30 });
this.pie6 = this.pie6 || adjust(this.tertiaryColor, { l: -20 });
this.pie7 = this.pie7 || adjust(this.primaryColor, { h: 60, l: -20 });
this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -40 });
this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: -40 });
this.pie10 = this.pie10 || adjust(this.primaryColor, { h: 60, l: -40 });
this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -90, l: -40 });
this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -30 });
this.pieTitleTextSize = this.pieTitleTextSize || "25px";
this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
this.pieSectionTextSize = this.pieSectionTextSize || "17px";
this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
this.pieLegendTextSize = this.pieLegendTextSize || "17px";
this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
this.pieStrokeColor = this.pieStrokeColor || "black";
this.pieStrokeWidth = this.pieStrokeWidth || "2px";
this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
this.pieOpacity = this.pieOpacity || "0.7";
this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
this.requirementBackground = this.requirementBackground || this.primaryColor;
this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
this.requirementBorderSize = this.requirementBorderSize || "1";
this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
this.relationColor = this.relationColor || this.lineColor;
this.relationLabelBackground = this.relationLabelBackground || this.labelBackground;
this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
this.git0 = this.git0 || this.primaryColor;
this.git1 = this.git1 || this.secondaryColor;
this.git2 = this.git2 || this.tertiaryColor;
this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });
this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });
this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });
this.git6 = this.git6 || adjust(this.primaryColor, { h: 60 });
this.git7 = this.git7 || adjust(this.primaryColor, { h: 120 });
if (this.darkMode) {
this.git0 = lighten(this.git0, 25);
this.git1 = lighten(this.git1, 25);
this.git2 = lighten(this.git2, 25);
this.git3 = lighten(this.git3, 25);
this.git4 = lighten(this.git4, 25);
this.git5 = lighten(this.git5, 25);
this.git6 = lighten(this.git6, 25);
this.git7 = lighten(this.git7, 25);
} else {
this.git0 = darken(this.git0, 25);
this.git1 = darken(this.git1, 25);
this.git2 = darken(this.git2, 25);
this.git3 = darken(this.git3, 25);
this.git4 = darken(this.git4, 25);
this.git5 = darken(this.git5, 25);
this.git6 = darken(this.git6, 25);
this.git7 = darken(this.git7, 25);
}
this.gitInv0 = this.gitInv0 || darken(invert(this.git0), 25);
this.gitInv1 = this.gitInv1 || invert(this.git1);
this.gitInv2 = this.gitInv2 || invert(this.git2);
this.gitInv3 = this.gitInv3 || invert(this.git3);
this.gitInv4 = this.gitInv4 || invert(this.git4);
this.gitInv5 = this.gitInv5 || invert(this.git5);
this.gitInv6 = this.gitInv6 || invert(this.git6);
this.gitInv7 = this.gitInv7 || invert(this.git7);
this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);
this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);
this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
this.tagLabelFontSize = this.tagLabelFontSize || "10px";
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || "10px";
this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
}
calculate(overrides) {
if (typeof overrides !== "object") {
this.updateColors();
return;
}
const keys = Object.keys(overrides);
keys.forEach((k) => {
this[k] = overrides[k];
});
this.updateColors();
keys.forEach((k) => {
this[k] = overrides[k];
});
}
};
const getThemeVariables$2 = (userOverrides) => {
const theme2 = new Theme$2();
theme2.calculate(userOverrides);
return theme2;
};
let Theme$1 = class Theme4 {
constructor() {
this.background = "#f4f4f4";
this.primaryColor = "#cde498";
this.secondaryColor = "#cdffb2";
this.background = "white";
this.mainBkg = "#cde498";
this.secondBkg = "#cdffb2";
this.lineColor = "green";
this.border1 = "#13540c";
this.border2 = "#6eaa49";
this.arrowheadColor = "green";
this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
this.fontSize = "16px";
this.tertiaryColor = lighten("#cde498", 10);
this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
this.primaryTextColor = invert(this.primaryColor);
this.secondaryTextColor = invert(this.secondaryColor);
this.tertiaryTextColor = invert(this.primaryColor);
this.lineColor = invert(this.background);
this.textColor = invert(this.background);
this.THEME_COLOR_LIMIT = 12;
this.nodeBkg = "calculated";
this.nodeBorder = "calculated";
this.clusterBkg = "calculated";
this.clusterBorder = "calculated";
this.defaultLinkColor = "calculated";
this.titleColor = "#333";
this.edgeLabelBackground = "#e8e8e8";
this.actorBorder = "calculated";
this.actorBkg = "calculated";
this.actorTextColor = "black";
this.actorLineColor = "grey";
this.signalColor = "#333";
this.signalTextColor = "#333";
this.labelBoxBkgColor = "calculated";
this.labelBoxBorderColor = "#326932";
this.labelTextColor = "calculated";
this.loopTextColor = "calculated";
this.noteBorderColor = "calculated";
this.noteBkgColor = "#fff5ad";
this.noteTextColor = "calculated";
this.activationBorderColor = "#666";
this.activationBkgColor = "#f4f4f4";
this.sequenceNumberColor = "white";
this.sectionBkgColor = "#6eaa49";
this.altSectionBkgColor = "white";
this.sectionBkgColor2 = "#6eaa49";
this.excludeBkgColor = "#eeeeee";
this.taskBorderColor = "calculated";
this.taskBkgColor = "#487e3a";
this.taskTextLightColor = "white";
this.taskTextColor = "calculated";
this.taskTextDarkColor = "black";
this.taskTextOutsideColor = "calculated";
this.taskTextClickableColor = "#003163";
this.activeTaskBorderColor = "calculated";
this.activeTaskBkgColor = "calculated";
this.gridColor = "lightgrey";
this.doneTaskBkgColor = "lightgrey";
this.doneTaskBorderColor = "grey";
this.critBorderColor = "#ff8888";
this.critBkgColor = "red";
this.todayLineColor = "red";
this.personBorder = this.primaryBorderColor;
this.personBkg = this.mainBkg;
this.labelColor = "black";
this.errorBkgColor = "#552222";
this.errorTextColor = "#552222";
}
updateColors() {
this.actorBorder = darken(this.mainBkg, 20);
this.actorBkg = this.mainBkg;
this.labelBoxBkgColor = this.actorBkg;
this.labelTextColor = this.actorTextColor;
this.loopTextColor = this.actorTextColor;
this.noteBorderColor = this.border2;
this.noteTextColor = this.actorTextColor;
this.cScale0 = this.cScale0 || this.primaryColor;
this.cScale1 = this.cScale1 || this.secondaryColor;
this.cScale2 = this.cScale2 || this.tertiaryColor;
this.cScale3 = this.cScale3 || adjust(this.primaryColor, { h: 30 });
this.cScale4 = this.cScale4 || adjust(this.primaryColor, { h: 60 });
this.cScale5 = this.cScale5 || adjust(this.primaryColor, { h: 90 });
this.cScale6 = this.cScale6 || adjust(this.primaryColor, { h: 120 });
this.cScale7 = this.cScale7 || adjust(this.primaryColor, { h: 150 });
this.cScale8 = this.cScale8 || adjust(this.primaryColor, { h: 210 });
this.cScale9 = this.cScale9 || adjust(this.primaryColor, { h: 270 });
this.cScale10 = this.cScale10 || adjust(this.primaryColor, { h: 300 });
this.cScale11 = this.cScale11 || adjust(this.primaryColor, { h: 330 });
this["cScalePeer1"] = this["cScalePeer1"] || darken(this.secondaryColor, 45);
this["cScalePeer2"] = this["cScalePeer2"] || darken(this.tertiaryColor, 40);
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScale" + i] = darken(this["cScale" + i], 10);
this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 25);
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleInv" + i] = this["cScaleInv" + i] || adjust(this["cScale" + i], { h: 180 });
}
this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
}
for (let i = 0; i < 5; i++) {
this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(5 + i * 5) });
this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { h: 30, s: -30, l: -(8 + i * 5) });
}
this.nodeBkg = this.mainBkg;
this.nodeBorder = this.border1;
this.clusterBkg = this.secondBkg;
this.clusterBorder = this.border2;
this.defaultLinkColor = this.lineColor;
this.taskBorderColor = this.border1;
this.taskTextColor = this.taskTextLightColor;
this.taskTextOutsideColor = this.taskTextDarkColor;
this.activeTaskBorderColor = this.taskBorderColor;
this.activeTaskBkgColor = this.mainBkg;
this.transitionColor = this.transitionColor || this.lineColor;
this.transitionLabelColor = this.transitionLabelColor || this.textColor;
this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
this.stateBkg = this.stateBkg || this.mainBkg;
this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
this.altBackground = this.altBackground || "#f0f0f0";
this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
this.compositeBorder = this.compositeBorder || this.nodeBorder;
this.innerEndBackground = this.primaryBorderColor;
this.specialStateColor = this.lineColor;
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
this.transitionColor = this.transitionColor || this.lineColor;
this.classText = this.primaryTextColor;
this.fillType0 = this.primaryColor;
this.fillType1 = this.secondaryColor;
this.fillType2 = adjust(this.primaryColor, { h: 64 });
this.fillType3 = adjust(this.secondaryColor, { h: 64 });
this.fillType4 = adjust(this.primaryColor, { h: -64 });
this.fillType5 = adjust(this.secondaryColor, { h: -64 });
this.fillType6 = adjust(this.primaryColor, { h: 128 });
this.fillType7 = adjust(this.secondaryColor, { h: 128 });
this.pie1 = this.pie1 || this.primaryColor;
this.pie2 = this.pie2 || this.secondaryColor;
this.pie3 = this.pie3 || this.tertiaryColor;
this.pie4 = this.pie4 || adjust(this.primaryColor, { l: -30 });
this.pie5 = this.pie5 || adjust(this.secondaryColor, { l: -30 });
this.pie6 = this.pie6 || adjust(this.tertiaryColor, { h: 40, l: -40 });
this.pie7 = this.pie7 || adjust(this.primaryColor, { h: 60, l: -10 });
this.pie8 = this.pie8 || adjust(this.primaryColor, { h: -60, l: -10 });
this.pie9 = this.pie9 || adjust(this.primaryColor, { h: 120, l: 0 });
this.pie10 = this.pie10 || adjust(this.primaryColor, { h: 60, l: -50 });
this.pie11 = this.pie11 || adjust(this.primaryColor, { h: -60, l: -50 });
this.pie12 = this.pie12 || adjust(this.primaryColor, { h: 120, l: -50 });
this.pieTitleTextSize = this.pieTitleTextSize || "25px";
this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
this.pieSectionTextSize = this.pieSectionTextSize || "17px";
this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
this.pieLegendTextSize = this.pieLegendTextSize || "17px";
this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
this.pieStrokeColor = this.pieStrokeColor || "black";
this.pieStrokeWidth = this.pieStrokeWidth || "2px";
this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
this.pieOpacity = this.pieOpacity || "0.7";
this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
this.requirementBackground = this.requirementBackground || this.primaryColor;
this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
this.requirementBorderSize = this.requirementBorderSize || "1";
this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
this.relationColor = this.relationColor || this.lineColor;
this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
this.git0 = this.git0 || this.primaryColor;
this.git1 = this.git1 || this.secondaryColor;
this.git2 = this.git2 || this.tertiaryColor;
this.git3 = this.git3 || adjust(this.primaryColor, { h: -30 });
this.git4 = this.git4 || adjust(this.primaryColor, { h: -60 });
this.git5 = this.git5 || adjust(this.primaryColor, { h: -90 });
this.git6 = this.git6 || adjust(this.primaryColor, { h: 60 });
this.git7 = this.git7 || adjust(this.primaryColor, { h: 120 });
if (this.darkMode) {
this.git0 = lighten(this.git0, 25);
this.git1 = lighten(this.git1, 25);
this.git2 = lighten(this.git2, 25);
this.git3 = lighten(this.git3, 25);
this.git4 = lighten(this.git4, 25);
this.git5 = lighten(this.git5, 25);
this.git6 = lighten(this.git6, 25);
this.git7 = lighten(this.git7, 25);
} else {
this.git0 = darken(this.git0, 25);
this.git1 = darken(this.git1, 25);
this.git2 = darken(this.git2, 25);
this.git3 = darken(this.git3, 25);
this.git4 = darken(this.git4, 25);
this.git5 = darken(this.git5, 25);
this.git6 = darken(this.git6, 25);
this.git7 = darken(this.git7, 25);
}
this.gitInv0 = this.gitInv0 || invert(this.git0);
this.gitInv1 = this.gitInv1 || invert(this.git1);
this.gitInv2 = this.gitInv2 || invert(this.git2);
this.gitInv3 = this.gitInv3 || invert(this.git3);
this.gitInv4 = this.gitInv4 || invert(this.git4);
this.gitInv5 = this.gitInv5 || invert(this.git5);
this.gitInv6 = this.gitInv6 || invert(this.git6);
this.gitInv7 = this.gitInv7 || invert(this.git7);
this.gitBranchLabel0 = this.gitBranchLabel0 || invert(this.labelTextColor);
this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor;
this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor;
this.gitBranchLabel3 = this.gitBranchLabel3 || invert(this.labelTextColor);
this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor;
this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor;
this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor;
this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor;
this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
this.tagLabelFontSize = this.tagLabelFontSize || "10px";
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || "10px";
this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
}
calculate(overrides) {
if (typeof overrides !== "object") {
this.updateColors();
return;
}
const keys = Object.keys(overrides);
keys.forEach((k) => {
this[k] = overrides[k];
});
this.updateColors();
keys.forEach((k) => {
this[k] = overrides[k];
});
}
};
const getThemeVariables$1 = (userOverrides) => {
const theme2 = new Theme$1();
theme2.calculate(userOverrides);
return theme2;
};
class Theme5 {
constructor() {
this.primaryColor = "#eee";
this.contrast = "#707070";
this.secondaryColor = lighten(this.contrast, 55);
this.background = "#ffffff";
this.tertiaryColor = adjust(this.primaryColor, { h: -160 });
this.primaryBorderColor = mkBorder(this.primaryColor, this.darkMode);
this.secondaryBorderColor = mkBorder(this.secondaryColor, this.darkMode);
this.tertiaryBorderColor = mkBorder(this.tertiaryColor, this.darkMode);
this.primaryTextColor = invert(this.primaryColor);
this.secondaryTextColor = invert(this.secondaryColor);
this.tertiaryTextColor = invert(this.tertiaryColor);
this.lineColor = invert(this.background);
this.textColor = invert(this.background);
this.mainBkg = "#eee";
this.secondBkg = "calculated";
this.lineColor = "#666";
this.border1 = "#999";
this.border2 = "calculated";
this.note = "#ffa";
this.text = "#333";
this.critical = "#d42";
this.done = "#bbb";
this.arrowheadColor = "#333333";
this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif';
this.fontSize = "16px";
this.THEME_COLOR_LIMIT = 12;
this.nodeBkg = "calculated";
this.nodeBorder = "calculated";
this.clusterBkg = "calculated";
this.clusterBorder = "calculated";
this.defaultLinkColor = "calculated";
this.titleColor = "calculated";
this.edgeLabelBackground = "white";
this.actorBorder = "calculated";
this.actorBkg = "calculated";
this.actorTextColor = "calculated";
this.actorLineColor = "calculated";
this.signalColor = "calculated";
this.signalTextColor = "calculated";
this.labelBoxBkgColor = "calculated";
this.labelBoxBorderColor = "calculated";
this.labelTextColor = "calculated";
this.loopTextColor = "calculated";
this.noteBorderColor = "calculated";
this.noteBkgColor = "calculated";
this.noteTextColor = "calculated";
this.activationBorderColor = "#666";
this.activationBkgColor = "#f4f4f4";
this.sequenceNumberColor = "white";
this.sectionBkgColor = "calculated";
this.altSectionBkgColor = "white";
this.sectionBkgColor2 = "calculated";
this.excludeBkgColor = "#eeeeee";
this.taskBorderColor = "calculated";
this.taskBkgColor = "calculated";
this.taskTextLightColor = "white";
this.taskTextColor = "calculated";
this.taskTextDarkColor = "calculated";
this.taskTextOutsideColor = "calculated";
this.taskTextClickableColor = "#003163";
this.activeTaskBorderColor = "calculated";
this.activeTaskBkgColor = "calculated";
this.gridColor = "calculated";
this.doneTaskBkgColor = "calculated";
this.doneTaskBorderColor = "calculated";
this.critBkgColor = "calculated";
this.critBorderColor = "calculated";
this.todayLineColor = "calculated";
this.personBorder = this.primaryBorderColor;
this.personBkg = this.mainBkg;
this.labelColor = "black";
this.errorBkgColor = "#552222";
this.errorTextColor = "#552222";
}
updateColors() {
this.secondBkg = lighten(this.contrast, 55);
this.border2 = this.contrast;
this.actorBorder = lighten(this.border1, 23);
this.actorBkg = this.mainBkg;
this.actorTextColor = this.text;
this.actorLineColor = this.lineColor;
this.signalColor = this.text;
this.signalTextColor = this.text;
this.labelBoxBkgColor = this.actorBkg;
this.labelBoxBorderColor = this.actorBorder;
this.labelTextColor = this.text;
this.loopTextColor = this.text;
this.noteBorderColor = "#999";
this.noteBkgColor = "#666";
this.noteTextColor = "#fff";
this.cScale0 = this.cScale0 || "#555";
this.cScale1 = this.cScale1 || "#F4F4F4";
this.cScale2 = this.cScale2 || "#555";
this.cScale3 = this.cScale3 || "#BBB";
this.cScale4 = this.cScale4 || "#777";
this.cScale5 = this.cScale5 || "#999";
this.cScale6 = this.cScale6 || "#DDD";
this.cScale7 = this.cScale7 || "#FFF";
this.cScale8 = this.cScale8 || "#DDD";
this.cScale9 = this.cScale9 || "#BBB";
this.cScale10 = this.cScale10 || "#999";
this.cScale11 = this.cScale11 || "#777";
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleInv" + i] = this["cScaleInv" + i] || invert(this["cScale" + i]);
}
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
if (this.darkMode) {
this["cScalePeer" + i] = this["cScalePeer" + i] || lighten(this["cScale" + i], 10);
} else {
this["cScalePeer" + i] = this["cScalePeer" + i] || darken(this["cScale" + i], 10);
}
}
this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
this["cScaleLabel0"] = this["cScaleLabel0"] || this.cScale1;
this["cScaleLabel2"] = this["cScaleLabel2"] || this.cScale1;
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["cScaleLabel" + i] = this["cScaleLabel" + i] || this.scaleLabelColor;
}
for (let i = 0; i < 5; i++) {
this["surface" + i] = this["surface" + i] || adjust(this.mainBkg, { l: -(5 + i * 5) });
this["surfacePeer" + i] = this["surfacePeer" + i] || adjust(this.mainBkg, { l: -(8 + i * 5) });
}
this.nodeBkg = this.mainBkg;
this.nodeBorder = this.border1;
this.clusterBkg = this.secondBkg;
this.clusterBorder = this.border2;
this.defaultLinkColor = this.lineColor;
this.titleColor = this.text;
this.sectionBkgColor = lighten(this.contrast, 30);
this.sectionBkgColor2 = lighten(this.contrast, 30);
this.taskBorderColor = darken(this.contrast, 10);
this.taskBkgColor = this.contrast;
this.taskTextColor = this.taskTextLightColor;
this.taskTextDarkColor = this.text;
this.taskTextOutsideColor = this.taskTextDarkColor;
this.activeTaskBorderColor = this.taskBorderColor;
this.activeTaskBkgColor = this.mainBkg;
this.gridColor = lighten(this.border1, 30);
this.doneTaskBkgColor = this.done;
this.doneTaskBorderColor = this.lineColor;
this.critBkgColor = this.critical;
this.critBorderColor = darken(this.critBkgColor, 10);
this.todayLineColor = this.critBkgColor;
this.transitionColor = this.transitionColor || "#000";
this.transitionLabelColor = this.transitionLabelColor || this.textColor;
this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
this.stateBkg = this.stateBkg || this.mainBkg;
this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg;
this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor;
this.altBackground = this.altBackground || "#f4f4f4";
this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg;
this.stateBorder = this.stateBorder || "#000";
this.innerEndBackground = this.primaryBorderColor;
this.specialStateColor = "#222";
this.errorBkgColor = this.errorBkgColor || this.tertiaryColor;
this.errorTextColor = this.errorTextColor || this.tertiaryTextColor;
this.classText = this.primaryTextColor;
this.fillType0 = this.primaryColor;
this.fillType1 = this.secondaryColor;
this.fillType2 = adjust(this.primaryColor, { h: 64 });
this.fillType3 = adjust(this.secondaryColor, { h: 64 });
this.fillType4 = adjust(this.primaryColor, { h: -64 });
this.fillType5 = adjust(this.secondaryColor, { h: -64 });
this.fillType6 = adjust(this.primaryColor, { h: 128 });
this.fillType7 = adjust(this.secondaryColor, { h: 128 });
for (let i = 0; i < this.THEME_COLOR_LIMIT; i++) {
this["pie" + i] = this["cScale" + i];
}
this.pie12 = this.pie0;
this.pieTitleTextSize = this.pieTitleTextSize || "25px";
this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor;
this.pieSectionTextSize = this.pieSectionTextSize || "17px";
this.pieSectionTextColor = this.pieSectionTextColor || this.textColor;
this.pieLegendTextSize = this.pieLegendTextSize || "17px";
this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor;
this.pieStrokeColor = this.pieStrokeColor || "black";
this.pieStrokeWidth = this.pieStrokeWidth || "2px";
this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px";
this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black";
this.pieOpacity = this.pieOpacity || "0.7";
this.quadrant1Fill = this.quadrant1Fill || this.primaryColor;
this.quadrant2Fill = this.quadrant2Fill || adjust(this.primaryColor, { r: 5, g: 5, b: 5 });
this.quadrant3Fill = this.quadrant3Fill || adjust(this.primaryColor, { r: 10, g: 10, b: 10 });
this.quadrant4Fill = this.quadrant4Fill || adjust(this.primaryColor, { r: 15, g: 15, b: 15 });
this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor;
this.quadrant2TextFill = this.quadrant2TextFill || adjust(this.primaryTextColor, { r: -5, g: -5, b: -5 });
this.quadrant3TextFill = this.quadrant3TextFill || adjust(this.primaryTextColor, { r: -10, g: -10, b: -10 });
this.quadrant4TextFill = this.quadrant4TextFill || adjust(this.primaryTextColor, { r: -15, g: -15, b: -15 });
this.quadrantPointFill = this.quadrantPointFill || isDark(this.quadrant1Fill) ? lighten(this.quadrant1Fill) : darken(this.quadrant1Fill);
this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor;
this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor;
this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor;
this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor;
this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor;
this.requirementBackground = this.requirementBackground || this.primaryColor;
this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor;
this.requirementBorderSize = this.requirementBorderSize || "1";
this.requirementTextColor = this.requirementTextColor || this.primaryTextColor;
this.relationColor = this.relationColor || this.lineColor;
this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground;
this.relationLabelColor = this.relationLabelColor || this.actorTextColor;
this.git0 = darken(this.pie1, 25) || this.primaryColor;
this.git1 = this.pie2 || this.secondaryColor;
this.git2 = this.pie3 || this.tertiaryColor;
this.git3 = this.pie4 || adjust(this.primaryColor, { h: -30 });
this.git4 = this.pie5 || adjust(this.primaryColor, { h: -60 });
this.git5 = this.pie6 || adjust(this.primaryColor, { h: -90 });
this.git6 = this.pie7 || adjust(this.primaryColor, { h: 60 });
this.git7 = this.pie8 || adjust(this.primaryColor, { h: 120 });
this.gitInv0 = this.gitInv0 || invert(this.git0);
this.gitInv1 = this.gitInv1 || invert(this.git1);
this.gitInv2 = this.gitInv2 || invert(this.git2);
this.gitInv3 = this.gitInv3 || invert(this.git3);
this.gitInv4 = this.gitInv4 || invert(this.git4);
this.gitInv5 = this.gitInv5 || invert(this.git5);
this.gitInv6 = this.gitInv6 || invert(this.git6);
this.gitInv7 = this.gitInv7 || invert(this.git7);
this.branchLabelColor = this.branchLabelColor || this.labelTextColor;
this.gitBranchLabel0 = this.branchLabelColor;
this.gitBranchLabel1 = "white";
this.gitBranchLabel2 = this.branchLabelColor;
this.gitBranchLabel3 = "white";
this.gitBranchLabel4 = this.branchLabelColor;
this.gitBranchLabel5 = this.branchLabelColor;
this.gitBranchLabel6 = this.branchLabelColor;
this.gitBranchLabel7 = this.branchLabelColor;
this.tagLabelColor = this.tagLabelColor || this.primaryTextColor;
this.tagLabelBackground = this.tagLabelBackground || this.primaryColor;
this.tagLabelBorder = this.tagBorder || this.primaryBorderColor;
this.tagLabelFontSize = this.tagLabelFontSize || "10px";
this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor;
this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor;
this.commitLabelFontSize = this.commitLabelFontSize || "10px";
this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || oldAttributeBackgroundColorOdd;
this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || oldAttributeBackgroundColorEven;
}
calculate(overrides) {
if (typeof overrides !== "object") {
this.updateColors();
return;
}
const keys = Object.keys(overrides);
keys.forEach((k) => {
this[k] = overrides[k];
});
this.updateColors();
keys.forEach((k) => {
this[k] = overrides[k];
});
}
}
const getThemeVariables = (userOverrides) => {
const theme2 = new Theme5();
theme2.calculate(userOverrides);
return theme2;
};
const theme = {
base: {
getThemeVariables: getThemeVariables$4
},
dark: {
getThemeVariables: getThemeVariables$3
},
default: {
getThemeVariables: getThemeVariables$2
},
forest: {
getThemeVariables: getThemeVariables$1
},
neutral: {
getThemeVariables
}
};
const defaultConfigJson = {
"flowchart": {
"useMaxWidth": true,
"titleTopMargin": 25,
"diagramPadding": 8,
"htmlLabels": true,
"nodeSpacing": 50,
"rankSpacing": 50,
"curve": "basis",
"padding": 15,
"defaultRenderer": "dagre-wrapper",
"wrappingWidth": 200
},
"sequence": {
"useMaxWidth": true,
"hideUnusedParticipants": false,
"activationWidth": 10,
"diagramMarginX": 50,
"diagramMarginY": 10,
"actorMargin": 50,
"width": 150,
"height": 65,
"boxMargin": 10,
"boxTextMargin": 5,
"noteMargin": 10,
"messageMargin": 35,
"messageAlign": "center",
"mirrorActors": true,
"forceMenus": false,
"bottomMarginAdj": 1,
"rightAngles": false,
"showSequenceNumbers": false,
"actorFontSize": 14,
"actorFontFamily": '"Open Sans", sans-serif',
"actorFontWeight": 400,
"noteFontSize": 14,
"noteFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
"noteFontWeight": 400,
"noteAlign": "center",
"messageFontSize": 16,
"messageFontFamily": '"trebuchet ms", verdana, arial, sans-serif',
"messageFontWeight": 400,
"wrap": false,
"wrapPadding": 10,
"labelBoxWidth": 50,
"labelBoxHeight": 20
},
"gantt": {
"useMaxWidth": true,
"titleTopMargin": 25,
"barHeight": 20,
"barGap": 4,
"topPadding": 50,
"rightPadding": 75,
"leftPadding": 75,
"gridLineStartPadding": 35,
"fontSize": 11,
"sectionFontSize": 11,
"numberSectionStyles": 4,
"axisFormat": "%Y-%m-%d",
"topAxis": false,
"displayMode": "",
"weekday": "sunday"
},
"journey": {
"useMaxWidth": true,
"diagramMarginX": 50,
"diagramMarginY": 10,
"leftMargin": 150,
"width": 150,
"height": 50,
"boxMargin": 10,
"boxTextMargin": 5,
"noteMargin": 10,
"messageMargin": 35,
"messageAlign": "center",
"bottomMarginAdj": 1,
"rightAngles": false,
"taskFontSize": 14,
"taskFontFamily": '"Open Sans", sans-serif',
"taskMargin": 50,
"activationWidth": 10,
"textPlacement": "fo",
"actorColours": [
"#8FBC8F",
"#7CFC00",
"#00FFFF",
"#20B2AA",
"#B0E0E6",
"#FFFFE0"
],
"sectionFills": [
"#191970",
"#8B008B",
"#4B0082",
"#2F4F4F",
"#800000",
"#8B4513",
"#00008B"
],
"sectionColours": [
"#fff"
]
},
"class": {
"useMaxWidth": true,
"titleTopMargin": 25,
"arrowMarkerAbsolute": false,
"dividerMargin": 10,
"padding": 5,
"textHeight": 10,
"defaultRenderer": "dagre-wrapper",
"htmlLabels": false
},
"state": {
"useMaxWidth": true,
"titleTopMargin": 25,
"dividerMargin": 10,
"sizeUnit": 5,
"padding": 8,
"textHeight": 10,
"titleShift": -15,
"noteMargin": 10,
"forkWidth": 70,
"forkHeight": 7,
"miniPadding": 2,
"fontSizeFactor": 5.02,
"fontSize": 24,
"labelHeight": 16,
"edgeLengthFactor": "20",
"compositTitleSize": 35,
"radius": 5,
"defaultRenderer": "dagre-wrapper"
},
"er": {
"useMaxWidth": true,
"titleTopMargin": 25,
"diagramPadding": 20,
"layoutDirection": "TB",
"minEntityWidth": 100,
"minEntityHeight": 75,
"entityPadding": 15,
"stroke": "gray",
"fill": "honeydew",
"fontSize": 12
},
"pie": {
"useMaxWidth": true,
"textPosition": 0.75
},
"quadrantChart": {
"useMaxWidth": true,
"chartWidth": 500,
"chartHeight": 500,
"titleFontSize": 20,
"titlePadding": 10,
"quadrantPadding": 5,
"xAxisLabelPadding": 5,
"yAxisLabelPadding": 5,
"xAxisLabelFontSize": 16,
"yAxisLabelFontSize": 16,
"quadrantLabelFontSize": 16,
"quadrantTextTopPadding": 5,
"pointTextPadding": 5,
"pointLabelFontSize": 12,
"pointRadius": 5,
"xAxisPosition": "top",
"yAxisPosition": "left",
"quadrantInternalBorderStrokeWidth": 1,
"quadrantExternalBorderStrokeWidth": 2
},
"requirement": {
"useMaxWidth": true,
"rect_fill": "#f9f9f9",
"text_color": "#333",
"rect_border_size": "0.5px",
"rect_border_color": "#bbb",
"rect_min_width": 200,
"rect_min_height": 200,
"fontSize": 14,
"rect_padding": 10,
"line_height": 20
},
"mindmap": {
"useMaxWidth": true,
"padding": 10,
"maxNodeWidth": 200
},
"timeline": {
"useMaxWidth": true,
"diagramMarginX": 50,
"diagramMarginY": 10,
"leftMargin": 150,
"width": 150,
"height": 50,
"boxMargin": 10,
"boxTextMargin": 5,
"noteMargin": 10,
"messageMargin": 35,
"messageAlign": "center",
"bottomMarginAdj": 1,
"rightAngles": false,
"taskFontSize": 14,
"taskFontFamily": '"Open Sans", sans-serif',
"taskMargin": 50,
"activationWidth": 10,
"textPlacement": "fo",
"actorColours": [
"#8FBC8F",
"#7CFC00",
"#00FFFF",
"#20B2AA",
"#B0E0E6",
"#FFFFE0"
],
"sectionFills": [
"#191970",
"#8B008B",
"#4B0082",
"#2F4F4F",
"#800000",
"#8B4513",
"#00008B"
],
"sectionColours": [
"#fff"
],
"disableMulticolor": false
},
"gitGraph": {
"useMaxWidth": true,
"titleTopMargin": 25,
"diagramPadding": 8,
"nodeLabel": {
"width": 75,
"height": 100,
"x": -25,
"y": 0
},
"mainBranchName": "main",
"mainBranchOrder": 0,
"showCommitLabel": true,
"showBranches": true,
"rotateCommitLabel": true,
"arrowMarkerAbsolute": false
},
"c4": {
"useMaxWidth": true,
"diagramMarginX": 50,
"diagramMarginY": 10,
"c4ShapeMargin": 50,
"c4ShapePadding": 20,
"width": 216,
"height": 60,
"boxMargin": 10,
"c4ShapeInRow": 4,
"nextLinePaddingX": 0,
"c4BoundaryInRow": 2,
"personFontSize": 14,
"personFontFamily": '"Open Sans", sans-serif',
"personFontWeight": "normal",
"external_personFontSize": 14,
"external_personFontFamily": '"Open Sans", sans-serif',
"external_personFontWeight": "normal",
"systemFontSize": 14,
"systemFontFamily": '"Open Sans", sans-serif',
"systemFontWeight": "normal",
"external_systemFontSize": 14,
"external_systemFontFamily": '"Open Sans", sans-serif',
"external_systemFontWeight": "normal",
"system_dbFontSize": 14,
"system_dbFontFamily": '"Open Sans", sans-serif',
"system_dbFontWeight": "normal",
"external_system_dbFontSize": 14,
"external_system_dbFontFamily": '"Open Sans", sans-serif',
"external_system_dbFontWeight": "normal",
"system_queueFontSize": 14,
"system_queueFontFamily": '"Open Sans", sans-serif',
"system_queueFontWeight": "normal",
"external_system_queueFontSize": 14,
"external_system_queueFontFamily": '"Open Sans", sans-serif',
"external_system_queueFontWeight": "normal",
"boundaryFontSize": 14,
"boundaryFontFamily": '"Open Sans", sans-serif',
"boundaryFontWeight": "normal",
"messageFontSize": 12,
"messageFontFamily": '"Open Sans", sans-serif',
"messageFontWeight": "normal",
"containerFontSize": 14,
"containerFontFamily": '"Open Sans", sans-serif',
"containerFontWeight": "normal",
"external_containerFontSize": 14,
"external_containerFontFamily": '"Open Sans", sans-serif',
"external_containerFontWeight": "normal",
"container_dbFontSize": 14,
"container_dbFontFamily": '"Open Sans", sans-serif',
"container_dbFontWeight": "normal",
"external_container_dbFontSize": 14,
"external_container_dbFontFamily": '"Open Sans", sans-serif',
"external_container_dbFontWeight": "normal",
"container_queueFontSize": 14,
"container_queueFontFamily": '"Open Sans", sans-serif',
"container_queueFontWeight": "normal",
"external_container_queueFontSize": 14,
"external_container_queueFontFamily": '"Open Sans", sans-serif',
"external_container_queueFontWeight": "normal",
"componentFontSize": 14,
"componentFontFamily": '"Open Sans", sans-serif',
"componentFontWeight": "normal",
"external_componentFontSize": 14,
"external_componentFontFamily": '"Open Sans", sans-serif',
"external_componentFontWeight": "normal",
"component_dbFontSize": 14,
"component_dbFontFamily": '"Open Sans", sans-serif',
"component_dbFontWeight": "normal",
"external_component_dbFontSize": 14,
"external_component_dbFontFamily": '"Open Sans", sans-serif',
"external_component_dbFontWeight": "normal",
"component_queueFontSize": 14,
"component_queueFontFamily": '"Open Sans", sans-serif',
"component_queueFontWeight": "normal",
"external_component_queueFontSize": 14,
"external_component_queueFontFamily": '"Open Sans", sans-serif',
"external_component_queueFontWeight": "normal",
"wrap": true,
"wrapPadding": 10,
"person_bg_color": "#08427B",
"person_border_color": "#073B6F",
"external_person_bg_color": "#686868",
"external_person_border_color": "#8A8A8A",
"system_bg_color": "#1168BD",
"system_border_color": "#3C7FC0",
"system_db_bg_color": "#1168BD",
"system_db_border_color": "#3C7FC0",
"system_queue_bg_color": "#1168BD",
"system_queue_border_color": "#3C7FC0",
"external_system_bg_color": "#999999",
"external_system_border_color": "#8A8A8A",
"external_system_db_bg_color": "#999999",
"external_system_db_border_color": "#8A8A8A",
"external_system_queue_bg_color": "#999999",
"external_system_queue_border_color": "#8A8A8A",
"container_bg_color": "#438DD5",
"container_border_color": "#3C7FC0",
"container_db_bg_color": "#438DD5",
"container_db_border_color": "#3C7FC0",
"container_queue_bg_color": "#438DD5",
"container_queue_border_color": "#3C7FC0",
"external_container_bg_color": "#B3B3B3",
"external_container_border_color": "#A6A6A6",
"external_container_db_bg_color": "#B3B3B3",
"external_container_db_border_color": "#A6A6A6",
"external_container_queue_bg_color": "#B3B3B3",
"external_container_queue_border_color": "#A6A6A6",
"component_bg_color": "#85BBF0",
"component_border_color": "#78A8D8",
"component_db_bg_color": "#85BBF0",
"component_db_border_color": "#78A8D8",
"component_queue_bg_color": "#85BBF0",
"component_queue_border_color": "#78A8D8",
"external_component_bg_color": "#CCCCCC",
"external_component_border_color": "#BFBFBF",
"external_component_db_bg_color": "#CCCCCC",
"external_component_db_border_color": "#BFBFBF",
"external_component_queue_bg_color": "#CCCCCC",
"external_component_queue_border_color": "#BFBFBF"
},
"sankey": {
"useMaxWidth": true,
"width": 600,
"height": 400,
"linkColor": "gradient",
"nodeAlignment": "justify",
"showValues": true,
"prefix": "",
"suffix": ""
},
"theme": "default",
"maxTextSize": 5e4,
"darkMode": false,
"fontFamily": '"trebuchet ms", verdana, arial, sans-serif;',
"logLevel": 5,
"securityLevel": "strict",
"startOnLoad": true,
"arrowMarkerAbsolute": false,
"secure": [
"secure",
"securityLevel",
"startOnLoad",
"maxTextSize"
],
"deterministicIds": false,
"fontSize": 16
};
const config = {
...defaultConfigJson,
// Set, even though they're `undefined` so that `configKeys` finds these keys
// TODO: Should we replace these with `null` so that they can go in the JSON Schema?
deterministicIDSeed: void 0,
themeCSS: void 0,
// add non-JSON default config values
themeVariables: theme["default"].getThemeVariables(),
sequence: {
...defaultConfigJson.sequence,
messageFont: function() {
return {
fontFamily: this.messageFontFamily,
fontSize: this.messageFontSize,
fontWeight: this.messageFontWeight
};
},
noteFont: function() {
return {
fontFamily: this.noteFontFamily,
fontSize: this.noteFontSize,
fontWeight: this.noteFontWeight
};
},
actorFont: function() {
return {
fontFamily: this.actorFontFamily,
fontSize: this.actorFontSize,
fontWeight: this.actorFontWeight
};
}
},
gantt: {
...defaultConfigJson.gantt,
tickInterval: void 0,
useWidth: void 0
// can probably be removed since `configKeys` already includes this
},
c4: {
...defaultConfigJson.c4,
useWidth: void 0,
personFont: function() {
return {
fontFamily: this.personFontFamily,
fontSize: this.personFontSize,
fontWeight: this.personFontWeight
};
},
external_personFont: function() {
return {
fontFamily: this.external_personFontFamily,
fontSize: this.external_personFontSize,
fontWeight: this.external_personFontWeight
};
},
systemFont: function() {
return {
fontFamily: this.systemFontFamily,
fontSize: this.systemFontSize,
fontWeight: this.systemFontWeight
};
},
external_systemFont: function() {
return {
fontFamily: this.external_systemFontFamily,
fontSize: this.external_systemFontSize,
fontWeight: this.external_systemFontWeight
};
},
system_dbFont: function() {
return {
fontFamily: this.system_dbFontFamily,
fontSize: this.system_dbFontSize,
fontWeight: this.system_dbFontWeight
};
},
external_system_dbFont: function() {
return {
fontFamily: this.external_system_dbFontFamily,
fontSize: this.external_system_dbFontSize,
fontWeight: this.external_system_dbFontWeight
};
},
system_queueFont: function() {
return {
fontFamily: this.system_queueFontFamily,
fontSize: this.system_queueFontSize,
fontWeight: this.system_queueFontWeight
};
},
external_system_queueFont: function() {
return {
fontFamily: this.external_system_queueFontFamily,
fontSize: this.external_system_queueFontSize,
fontWeight: this.external_system_queueFontWeight
};
},
containerFont: function() {
return {
fontFamily: this.containerFontFamily,
fontSize: this.containerFontSize,
fontWeight: this.containerFontWeight
};
},
external_containerFont: function() {
return {
fontFamily: this.external_containerFontFamily,
fontSize: this.external_containerFontSize,
fontWeight: this.external_containerFontWeight
};
},
container_dbFont: function() {
return {
fontFamily: this.container_dbFontFamily,
fontSize: this.container_dbFontSize,
fontWeight: this.container_dbFontWeight
};
},
external_container_dbFont: function() {
return {
fontFamily: this.external_container_dbFontFamily,
fontSize: this.external_container_dbFontSize,
fontWeight: this.external_container_dbFontWeight
};
},
container_queueFont: function() {
return {
fontFamily: this.container_queueFontFamily,
fontSize: this.container_queueFontSize,
fontWeight: this.container_queueFontWeight
};
},
external_container_queueFont: function() {
return {
fontFamily: this.external_container_queueFontFamily,
fontSize: this.external_container_queueFontSize,
fontWeight: this.external_container_queueFontWeight
};
},
componentFont: function() {
return {
fontFamily: this.componentFontFamily,
fontSize: this.componentFontSize,
fontWeight: this.componentFontWeight
};
},
external_componentFont: function() {
return {
fontFamily: this.external_componentFontFamily,
fontSize: this.external_componentFontSize,
fontWeight: this.external_componentFontWeight
};
},
component_dbFont: function() {
return {
fontFamily: this.component_dbFontFamily,
fontSize: this.component_dbFontSize,
fontWeight: this.component_dbFontWeight
};
},
external_component_dbFont: function() {
return {
fontFamily: this.external_component_dbFontFamily,
fontSize: this.external_component_dbFontSize,
fontWeight: this.external_component_dbFontWeight
};
},
component_queueFont: function() {
return {
fontFamily: this.component_queueFontFamily,
fontSize: this.component_queueFontSize,
fontWeight: this.component_queueFontWeight
};
},
external_component_queueFont: function() {
return {
fontFamily: this.external_component_queueFontFamily,
fontSize: this.external_component_queueFontSize,
fontWeight: this.external_component_queueFontWeight
};
},
boundaryFont: function() {
return {
fontFamily: this.boundaryFontFamily,
fontSize: this.boundaryFontSize,
fontWeight: this.boundaryFontWeight
};
},
messageFont: function() {
return {
fontFamily: this.messageFontFamily,
fontSize: this.messageFontSize,
fontWeight: this.messageFontWeight
};
}
},
pie: {
...defaultConfigJson.pie,
useWidth: 984
},
requirement: {
...defaultConfigJson.requirement,
useWidth: void 0
},
gitGraph: {
...defaultConfigJson.gitGraph,
// TODO: This is a temporary override for `gitGraph`, since every other
// diagram does have `useMaxWidth`, but instead sets it to `true`.
// Should we set this to `true` instead?
useMaxWidth: false
},
sankey: {
...defaultConfigJson.sankey,
// this is false, unlike every other diagram (other than gitGraph)
// TODO: can we make this default to `true` instead?
useMaxWidth: false
}
};
const keyify = (obj, prefix = "") => Object.keys(obj).reduce((res, el) => {
if (Array.isArray(obj[el])) {
return res;
} else if (typeof obj[el] === "object" && obj[el] !== null) {
return [...res, prefix + el, ...keyify(obj[el], "")];
}
return [...res, prefix + el];
}, []);
const configKeys = new Set(keyify(config, ""));
const defaultConfig$1 = config;
const sanitizeDirective = (args) => {
log$1.debug("sanitizeDirective called with", args);
if (typeof args !== "object" || args == null) {
return;
}
if (Array.isArray(args)) {
args.forEach((arg) => sanitizeDirective(arg));
return;
}
for (const key of Object.keys(args)) {
log$1.debug("Checking key", key);
if (key.startsWith("__") || key.includes("proto") || key.includes("constr") || !configKeys.has(key) || args[key] == null) {
log$1.debug("sanitize deleting key: ", key);
delete args[key];
continue;
}
if (typeof args[key] === "object") {
log$1.debug("sanitizing object", key);
sanitizeDirective(args[key]);
continue;
}
const cssMatchers = ["themeCSS", "fontFamily", "altFontFamily"];
for (const cssKey of cssMatchers) {
if (key.includes(cssKey)) {
log$1.debug("sanitizing css option", key);
args[key] = sanitizeCss(args[key]);
}
}
}
if (args.themeVariables) {
for (const k of Object.keys(args.themeVariables)) {
const val = args.themeVariables[k];
if ((val == null ? void 0 : val.match) && !val.match(/^[\d "#%(),.;A-Za-z]+$/)) {
args.themeVariables[k] = "";
}
}
}
log$1.debug("After sanitization", args);
};
const sanitizeCss = (str2) => {
let startCnt = 0;
let endCnt = 0;
for (const element of str2) {
if (startCnt < endCnt) {
return "{ /* ERROR: Unbalanced CSS */ }";
}
if (element === "{") {
startCnt++;
} else if (element === "}") {
endCnt++;
}
}
if (startCnt !== endCnt) {
return "{ /* ERROR: Unbalanced CSS */ }";
}
return str2;
};
const frontMatterRegex = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
const directiveRegex = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
const anyCommentRegex = /\s*%%.*\n/gm;
class UnknownDiagramError extends Error {
constructor(message) {
super(message);
this.name = "UnknownDiagramError";
}
}
const detectors = {};
const detectType = function(text, config2) {
text = text.replace(frontMatterRegex, "").replace(directiveRegex, "").replace(anyCommentRegex, "\n");
for (const [key, { detector: detector2 }] of Object.entries(detectors)) {
const diagram2 = detector2(text, config2);
if (diagram2) {
return key;
}
}
throw new UnknownDiagramError(
`No diagram type detected matching given configuration for text: ${text}`
);
};
const registerLazyLoadedDiagrams = (...diagrams2) => {
for (const { id: id2, detector: detector2, loader: loader2 } of diagrams2) {
addDetector(id2, detector2, loader2);
}
};
const addDetector = (key, detector2, loader2) => {
if (detectors[key]) {
log$1.error(`Detector with key ${key} already exists`);
} else {
detectors[key] = { detector: detector2, loader: loader2 };
}
log$1.debug(`Detector with key ${key} added${loader2 ? " with loader" : ""}`);
};
const getDiagramLoader = (key) => {
return detectors[key].loader;
};
const assignWithDepth = (dst, src, { depth = 2, clobber = false } = {}) => {
const config2 = { depth, clobber };
if (Array.isArray(src) && !Array.isArray(dst)) {
src.forEach((s) => assignWithDepth(dst, s, config2));
return dst;
} else if (Array.isArray(src) && Array.isArray(dst)) {
src.forEach((s) => {
if (!dst.includes(s)) {
dst.push(s);
}
});
return dst;
}
if (dst === void 0 || depth <= 0) {
if (dst !== void 0 && dst !== null && typeof dst === "object" && typeof src === "object") {
return Object.assign(dst, src);
} else {
return src;
}
}
if (src !== void 0 && typeof dst === "object" && typeof src === "object") {
Object.keys(src).forEach((key) => {
if (typeof src[key] === "object" && (dst[key] === void 0 || typeof dst[key] === "object")) {
if (dst[key] === void 0) {
dst[key] = Array.isArray(src[key]) ? [] : {};
}
dst[key] = assignWithDepth(dst[key], src[key], { depth: depth - 1, clobber });
} else if (clobber || typeof dst[key] !== "object" && typeof src[key] !== "object") {
dst[key] = src[key];
}
});
}
return dst;
};
const assignWithDepth$1 = assignWithDepth;
const ZERO_WIDTH_SPACE = "";
const d3CurveTypes = {
curveBasis,
curveBasisClosed,
curveBasisOpen,
curveBumpX,
curveBumpY,
curveBundle,
curveCardinalClosed,
curveCardinalOpen,
curveCardinal,
curveCatmullRomClosed,
curveCatmullRomOpen,
curveCatmullRom,
curveLinear,
curveLinearClosed,
curveMonotoneX,
curveMonotoneY,
curveNatural,
curveStep,
curveStepAfter,
curveStepBefore
};
const directiveWithoutOpen = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
const detectInit = function(text, config2) {
const inits = detectDirective(text, /(?:init\b)|(?:initialize\b)/);
let results = {};
if (Array.isArray(inits)) {
const args = inits.map((init2) => init2.args);
sanitizeDirective(args);
results = assignWithDepth$1(results, [...args]);
} else {
results = inits.args;
}
if (!results) {
return;
}
let type2 = detectType(text, config2);
const prop = "config";
if (results[prop] !== void 0) {
if (type2 === "flowchart-v2") {
type2 = "flowchart";
}
results[type2] = results[prop];
delete results[prop];
}
return results;
};
const detectDirective = function(text, type2 = null) {
try {
const commentWithoutDirectives = new RegExp(
`[%]{2}(?![{]${directiveWithoutOpen.source})(?=[}][%]{2}).*
`,
"ig"
);
text = text.trim().replace(commentWithoutDirectives, "").replace(/'/gm, '"');
log$1.debug(
`Detecting diagram directive${type2 !== null ? " type:" + type2 : ""} based on the text:${text}`
);
let match;
const result = [];
while ((match = directiveRegex.exec(text)) !== null) {
if (match.index === directiveRegex.lastIndex) {
directiveRegex.lastIndex++;
}
if (match && !type2 || type2 && match[1] && match[1].match(type2) || type2 && match[2] && match[2].match(type2)) {
const type22 = match[1] ? match[1] : match[2];
const args = match[3] ? match[3].trim() : match[4] ? JSON.parse(match[4].trim()) : null;
result.push({ type: type22, args });
}
}
if (result.length === 0) {
return { type: text, args: null };
}
return result.length === 1 ? result[0] : result;
} catch (error) {
log$1.error(
`ERROR: ${error.message} - Unable to parse directive type: '${type2}' based on the text: '${text}'`
);
return { type: void 0, args: null };
}
};
const removeDirectives = function(text) {
return text.replace(directiveRegex, "");
};
const isSubstringInArray = function(str2, arr) {
for (const [i, element] of arr.entries()) {
if (element.match(str2)) {
return i;
}
}
return -1;
};
function interpolateToCurve(interpolate, defaultCurve) {
if (!interpolate) {
return defaultCurve;
}
const curveName = `curve${interpolate.charAt(0).toUpperCase() + interpolate.slice(1)}`;
return d3CurveTypes[curveName] ?? defaultCurve;
}
function formatUrl(linkStr, config2) {
const url = linkStr.trim();
if (!url) {
return void 0;
}
if (config2.securityLevel !== "loose") {
return sanitizeUrl(url);
}
return url;
}
const runFunc = (functionName, ...params) => {
const arrPaths = functionName.split(".");
const len = arrPaths.length - 1;
const fnName = arrPaths[len];
let obj = window;
for (let i = 0; i < len; i++) {
obj = obj[arrPaths[i]];
if (!obj) {
log$1.error(`Function name: ${functionName} not found in window`);
return;
}
}
obj[fnName](...params);
};
function distance(p1, p2) {
if (!p1 || !p2) {
return 0;
}
return Math.sqrt(Math.pow(p2.x - p1.x, 2) + Math.pow(p2.y - p1.y, 2));
}
function traverseEdge(points) {
let prevPoint;
let totalDistance = 0;
points.forEach((point) => {
totalDistance += distance(point, prevPoint);
prevPoint = point;
});
const remainingDistance = totalDistance / 2;
return calculatePoint(points, remainingDistance);
}
function calcLabelPosition(points) {
if (points.length === 1) {
return points[0];
}
return traverseEdge(points);
}
const roundNumber = (num, precision = 2) => {
const factor = Math.pow(10, precision);
return Math.round(num * factor) / factor;
};
const calculatePoint = (points, distanceToTraverse) => {
let prevPoint = void 0;
let remainingDistance = distanceToTraverse;
for (const point of points) {
if (prevPoint) {
const vectorDistance = distance(point, prevPoint);
if (vectorDistance < remainingDistance) {
remainingDistance -= vectorDistance;
} else {
const distanceRatio = remainingDistance / vectorDistance;
if (distanceRatio <= 0) {
return prevPoint;
}
if (distanceRatio >= 1) {
return { x: point.x, y: point.y };
}
if (distanceRatio > 0 && distanceRatio < 1) {
return {
x: roundNumber((1 - distanceRatio) * prevPoint.x + distanceRatio * point.x, 5),
y: roundNumber((1 - distanceRatio) * prevPoint.y + distanceRatio * point.y, 5)
};
}
}
}
prevPoint = point;
}
throw new Error("Could not find a suitable point for the given distance");
};
const calcCardinalityPosition = (isRelationTypePresent, points, initialPosition) => {
log$1.info(`our points ${JSON.stringify(points)}`);
if (points[0] !== initialPosition) {
points = points.reverse();
}
const distanceToCardinalityPoint = 25;
const center = calculatePoint(points, distanceToCardinalityPoint);
const d = isRelationTypePresent ? 10 : 5;
const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
const cardinalityPosition = { x: 0, y: 0 };
cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
return cardinalityPosition;
};
function calcTerminalLabelPosition(terminalMarkerSize, position, _points) {
const points = structuredClone(_points);
log$1.info("our points", points);
if (position !== "start_left" && position !== "start_right") {
points.reverse();
}
const distanceToCardinalityPoint = 25 + terminalMarkerSize;
const center = calculatePoint(points, distanceToCardinalityPoint);
const d = 10 + terminalMarkerSize * 0.5;
const angle = Math.atan2(points[0].y - center.y, points[0].x - center.x);
const cardinalityPosition = { x: 0, y: 0 };
if (position === "start_left") {
cardinalityPosition.x = Math.sin(angle + Math.PI) * d + (points[0].x + center.x) / 2;
cardinalityPosition.y = -Math.cos(angle + Math.PI) * d + (points[0].y + center.y) / 2;
} else if (position === "end_right") {
cardinalityPosition.x = Math.sin(angle - Math.PI) * d + (points[0].x + center.x) / 2 - 5;
cardinalityPosition.y = -Math.cos(angle - Math.PI) * d + (points[0].y + center.y) / 2 - 5;
} else if (position === "end_left") {
cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2 - 5;
cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2 - 5;
} else {
cardinalityPosition.x = Math.sin(angle) * d + (points[0].x + center.x) / 2;
cardinalityPosition.y = -Math.cos(angle) * d + (points[0].y + center.y) / 2;
}
return cardinalityPosition;
}
function getStylesFromArray(arr) {
let style = "";
let labelStyle = "";
for (const element of arr) {
if (element !== void 0) {
if (element.startsWith("color:") || element.startsWith("text-align:")) {
labelStyle = labelStyle + element + ";";
} else {
style = style + element + ";";
}
}
}
return { style, labelStyle };
}
let cnt = 0;
const generateId = () => {
cnt++;
return "id-" + Math.random().toString(36).substr(2, 12) + "-" + cnt;
};
function makeRandomHex(length) {
let result = "";
const characters = "0123456789abcdef";
const charactersLength = characters.length;
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
return result;
}
const random = (options) => {
return makeRandomHex(options.length);
};
const getTextObj = function() {
return {
x: 0,
y: 0,
fill: void 0,
anchor: "start",
style: "#666",
width: 100,
height: 100,
textMargin: 0,
rx: 0,
ry: 0,
valign: void 0,
text: ""
};
};
const drawSimpleText = function(elem, textData) {
const nText = textData.text.replace(common$1.lineBreakRegex, " ");
const [, _fontSizePx] = parseFontSize(textData.fontSize);
const textElem = elem.append("text");
textElem.attr("x", textData.x);
textElem.attr("y", textData.y);
textElem.style("text-anchor", textData.anchor);
textElem.style("font-family", textData.fontFamily);
textElem.style("font-size", _fontSizePx);
textElem.style("font-weight", textData.fontWeight);
textElem.attr("fill", textData.fill);
if (textData.class !== void 0) {
textElem.attr("class", textData.class);
}
const span = textElem.append("tspan");
span.attr("x", textData.x + textData.textMargin * 2);
span.attr("fill", textData.fill);
span.text(nText);
return textElem;
};
const wrapLabel = memoize(
(label, maxWidth, config2) => {
if (!label) {
return label;
}
config2 = Object.assign(
{ fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "<br/>" },
config2
);
if (common$1.lineBreakRegex.test(label)) {
return label;
}
const words = label.split(" ");
const completedLines = [];
let nextLine = "";
words.forEach((word, index) => {
const wordLength = calculateTextWidth(`${word} `, config2);
const nextLineLength = calculateTextWidth(nextLine, config2);
if (wordLength > maxWidth) {
const { hyphenatedStrings, remainingWord } = breakString(word, maxWidth, "-", config2);
completedLines.push(nextLine, ...hyphenatedStrings);
nextLine = remainingWord;
} else if (nextLineLength + wordLength >= maxWidth) {
completedLines.push(nextLine);
nextLine = word;
} else {
nextLine = [nextLine, word].filter(Boolean).join(" ");
}
const currentWord = index + 1;
const isLastWord = currentWord === words.length;
if (isLastWord) {
completedLines.push(nextLine);
}
});
return completedLines.filter((line) => line !== "").join(config2.joinWith);
},
(label, maxWidth, config2) => `${label}${maxWidth}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}${config2.joinWith}`
);
const breakString = memoize(
(word, maxWidth, hyphenCharacter = "-", config2) => {
config2 = Object.assign(
{ fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 },
config2
);
const characters = [...word];
const lines = [];
let currentLine = "";
characters.forEach((character, index) => {
const nextLine = `${currentLine}${character}`;
const lineWidth = calculateTextWidth(nextLine, config2);
if (lineWidth >= maxWidth) {
const currentCharacter = index + 1;
const isLastLine = characters.length === currentCharacter;
const hyphenatedNextLine = `${nextLine}${hyphenCharacter}`;
lines.push(isLastLine ? nextLine : hyphenatedNextLine);
currentLine = "";
} else {
currentLine = nextLine;
}
});
return { hyphenatedStrings: lines, remainingWord: currentLine };
},
(word, maxWidth, hyphenCharacter = "-", config2) => `${word}${maxWidth}${hyphenCharacter}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}`
);
function calculateTextHeight(text, config2) {
return calculateTextDimensions(text, config2).height;
}
function calculateTextWidth(text, config2) {
return calculateTextDimensions(text, config2).width;
}
const calculateTextDimensions = memoize(
(text, config2) => {
const { fontSize = 12, fontFamily = "Arial", fontWeight = 400 } = config2;
if (!text) {
return { width: 0, height: 0 };
}
const [, _fontSizePx] = parseFontSize(fontSize);
const fontFamilies = ["sans-serif", fontFamily];
const lines = text.split(common$1.lineBreakRegex);
const dims = [];
const body = select("body");
if (!body.remove) {
return { width: 0, height: 0, lineHeight: 0 };
}
const g = body.append("svg");
for (const fontFamily2 of fontFamilies) {
let cHeight = 0;
const dim = { width: 0, height: 0, lineHeight: 0 };
for (const line of lines) {
const textObj = getTextObj();
textObj.text = line || ZERO_WIDTH_SPACE;
const textElem = drawSimpleText(g, textObj).style("font-size", _fontSizePx).style("font-weight", fontWeight).style("font-family", fontFamily2);
const bBox = (textElem._groups || textElem)[0][0].getBBox();
if (bBox.width === 0 && bBox.height === 0) {
throw new Error("svg element not in render tree");
}
dim.width = Math.round(Math.max(dim.width, bBox.width));
cHeight = Math.round(bBox.height);
dim.height += cHeight;
dim.lineHeight = Math.round(Math.max(dim.lineHeight, cHeight));
}
dims.push(dim);
}
g.remove();
const index = isNaN(dims[1].height) || isNaN(dims[1].width) || isNaN(dims[1].lineHeight) || dims[0].height > dims[1].height && dims[0].width > dims[1].width && dims[0].lineHeight > dims[1].lineHeight ? 0 : 1;
return dims[index];
},
(text, config2) => `${text}${config2.fontSize}${config2.fontWeight}${config2.fontFamily}`
);
class InitIDGenerator {
constructor(deterministic = false, seed) {
this.count = 0;
this.count = seed ? seed.length : 0;
this.next = deterministic ? () => this.count++ : () => Date.now();
}
}
let decoder;
const entityDecode = function(html) {
decoder = decoder || document.createElement("div");
html = escape(html).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";");
decoder.innerHTML = html;
return unescape(decoder.textContent);
};
function isDetailedError(error) {
return "str" in error;
}
const insertTitle = (parent, cssClass, titleTopMargin, title) => {
var _a;
if (!title) {
return;
}
const bounds = (_a = parent.node()) == null ? void 0 : _a.getBBox();
if (!bounds) {
return;
}
parent.append("text").text(title).attr("x", bounds.x + bounds.width / 2).attr("y", -titleTopMargin).attr("class", cssClass);
};
const parseFontSize = (fontSize) => {
if (typeof fontSize === "number") {
return [fontSize, fontSize + "px"];
}
const fontSizeNumber = parseInt(fontSize ?? "", 10);
if (Number.isNaN(fontSizeNumber)) {
return [void 0, void 0];
} else if (fontSize === String(fontSizeNumber)) {
return [fontSizeNumber, fontSize + "px"];
} else {
return [fontSizeNumber, fontSize];
}
};
function cleanAndMerge(defaultData, data) {
return merge$1({}, defaultData, data);
}
const utils = {
assignWithDepth: assignWithDepth$1,
wrapLabel,
calculateTextHeight,
calculateTextWidth,
calculateTextDimensions,
cleanAndMerge,
detectInit,
detectDirective,
isSubstringInArray,
interpolateToCurve,
calcLabelPosition,
calcCardinalityPosition,
calcTerminalLabelPosition,
formatUrl,
getStylesFromArray,
generateId,
random,
runFunc,
entityDecode,
insertTitle,
parseFontSize,
InitIDGenerator
};
const version = "10.5.0";
const defaultConfig = Object.freeze(defaultConfig$1);
let siteConfig = assignWithDepth$1({}, defaultConfig);
let configFromInitialize;
let directives = [];
let currentConfig = assignWithDepth$1({}, defaultConfig);
const updateCurrentConfig = (siteCfg, _directives) => {
let cfg = assignWithDepth$1({}, siteCfg);
let sumOfDirectives = {};
for (const d of _directives) {
sanitize(d);
sumOfDirectives = assignWithDepth$1(sumOfDirectives, d);
}
cfg = assignWithDepth$1(cfg, sumOfDirectives);
if (sumOfDirectives.theme && sumOfDirectives.theme in theme) {
const tmpConfigFromInitialize = assignWithDepth$1({}, configFromInitialize);
const themeVariables = assignWithDepth$1(
tmpConfigFromInitialize.themeVariables || {},
sumOfDirectives.themeVariables
);
if (cfg.theme && cfg.theme in theme) {
cfg.themeVariables = theme[cfg.theme].getThemeVariables(themeVariables);
}
}
currentConfig = cfg;
checkConfig(currentConfig);
return currentConfig;
};
const setSiteConfig = (conf) => {
siteConfig = assignWithDepth$1({}, defaultConfig);
siteConfig = assignWithDepth$1(siteConfig, conf);
if (conf.theme && theme[conf.theme]) {
siteConfig.themeVariables = theme[conf.theme].getThemeVariables(conf.themeVariables);
}
updateCurrentConfig(siteConfig, directives);
return siteConfig;
};
const saveConfigFromInitialize = (conf) => {
configFromInitialize = assignWithDepth$1({}, conf);
};
const updateSiteConfig = (conf) => {
siteConfig = assignWithDepth$1(siteConfig, conf);
updateCurrentConfig(siteConfig, directives);
return siteConfig;
};
const getSiteConfig = () => {
return assignWithDepth$1({}, siteConfig);
};
const setConfig = (conf) => {
checkConfig(conf);
assignWithDepth$1(currentConfig, conf);
return getConfig$1();
};
const getConfig$1 = () => {
return assignWithDepth$1({}, currentConfig);
};
const sanitize = (options) => {
if (!options) {
return;
}
["secure", ...siteConfig.secure ?? []].forEach((key) => {
if (Object.hasOwn(options, key)) {
log$1.debug(`Denied attempt to modify a secure key ${key}`, options[key]);
delete options[key];
}
});
Object.keys(options).forEach((key) => {
if (key.startsWith("__")) {
delete options[key];
}
});
Object.keys(options).forEach((key) => {
if (typeof options[key] === "string" && (options[key].includes("<") || options[key].includes(">") || options[key].includes("url(data:"))) {
delete options[key];
}
if (typeof options[key] === "object") {
sanitize(options[key]);
}
});
};
const addDirective = (directive) => {
sanitizeDirective(directive);
if (directive.fontFamily && (!directive.themeVariables || !directive.themeVariables.fontFamily)) {
directive.themeVariables = { fontFamily: directive.fontFamily };
}
directives.push(directive);
updateCurrentConfig(siteConfig, directives);
};
const reset = (config2 = siteConfig) => {
directives = [];
updateCurrentConfig(config2, directives);
};
const ConfigWarning = {
LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."
};
const issuedWarnings = {};
const issueWarning = (warning) => {
if (issuedWarnings[warning]) {
return;
}
log$1.warn(ConfigWarning[warning]);
issuedWarnings[warning] = true;
};
const checkConfig = (config2) => {
if (!config2) {
return;
}
if (config2.lazyLoadedDiagrams || config2.loadExternalDiagramsAtStartup) {
issueWarning("LAZY_LOAD_DEPRECATED");
}
};
const id$j = "c4";
const detector$j = (txt) => {
return /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(txt);
};
const loader$k = async () => {
const { diagram: diagram2 } = await import("./c4Diagram-7ff6304f.js");
return { id: id$j, diagram: diagram2 };
};
const plugin$h = {
id: id$j,
detector: detector$j,
loader: loader$k
};
const c4 = plugin$h;
const id$i = "flowchart";
const detector$i = (txt, config2) => {
var _a, _b;
if (((_a = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper" || ((_b = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _b.defaultRenderer) === "elk") {
return false;
}
return /^\s*graph/.test(txt);
};
const loader$j = async () => {
const { diagram: diagram2 } = await import("./flowDiagram-f303bdd6.js");
return { id: id$i, diagram: diagram2 };
};
const plugin$g = {
id: id$i,
detector: detector$i,
loader: loader$j
};
const flowchart = plugin$g;
const id$h = "flowchart-v2";
const detector$h = (txt, config2) => {
var _a, _b, _c;
if (((_a = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _a.defaultRenderer) === "dagre-d3" || ((_b = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _b.defaultRenderer) === "elk") {
return false;
}
if (/^\s*graph/.test(txt) && ((_c = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _c.defaultRenderer) === "dagre-wrapper") {
return true;
}
return /^\s*flowchart/.test(txt);
};
const loader$i = async () => {
const { diagram: diagram2 } = await import("./flowDiagram-v2-34644886.js");
return { id: id$h, diagram: diagram2 };
};
const plugin$f = {
id: id$h,
detector: detector$h,
loader: loader$i
};
const flowchartV2 = plugin$f;
const id$g = "er";
const detector$g = (txt) => {
return /^\s*erDiagram/.test(txt);
};
const loader$h = async () => {
const { diagram: diagram2 } = await import("./erDiagram-a995d1fe.js");
return { id: id$g, diagram: diagram2 };
};
const plugin$e = {
id: id$g,
detector: detector$g,
loader: loader$h
};
const er = plugin$e;
const id$f = "gitGraph";
const detector$f = (txt) => {
return /^\s*gitGraph/.test(txt);
};
const loader$g = async () => {
const { diagram: diagram2 } = await import("./gitGraphDiagram-2139c8c6.js");
return { id: id$f, diagram: diagram2 };
};
const plugin$d = {
id: id$f,
detector: detector$f,
loader: loader$g
};
const git = plugin$d;
const id$e = "gantt";
const detector$e = (txt) => {
return /^\s*gantt/.test(txt);
};
const loader$f = async () => {
const { diagram: diagram2 } = await import("./ganttDiagram-6a1a118f.js");
return { id: id$e, diagram: diagram2 };
};
const plugin$c = {
id: id$e,
detector: detector$e,
loader: loader$f
};
const gantt = plugin$c;
const id$d = "info";
const detector$d = (txt) => {
return /^\s*info/.test(txt);
};
const loader$e = async () => {
const { diagram: diagram2 } = await import("./infoDiagram-2064d999.js");
return { id: id$d, diagram: diagram2 };
};
const info = {
id: id$d,
detector: detector$d,
loader: loader$e
};
const id$c = "pie";
const detector$c = (txt) => {
return /^\s*pie/.test(txt);
};
const loader$d = async () => {
const { diagram: diagram2 } = await import("./pieDiagram-ed51bc52.js");
return { id: id$c, diagram: diagram2 };
};
const pie = {
id: id$c,
detector: detector$c,
loader: loader$d
};
const id$b = "quadrantChart";
const detector$b = (txt) => {
return /^\s*quadrantChart/.test(txt);
};
const loader$c = async () => {
const { diagram: diagram2 } = await import("./quadrantDiagram-3a393d1c.js");
return { id: id$b, diagram: diagram2 };
};
const plugin$b = {
id: id$b,
detector: detector$b,
loader: loader$c
};
const quadrantChart = plugin$b;
const id$a = "requirement";
const detector$a = (txt) => {
return /^\s*requirement(Diagram)?/.test(txt);
};
const loader$b = async () => {
const { diagram: diagram2 } = await import("./requirementDiagram-e12f1d97.js");
return { id: id$a, diagram: diagram2 };
};
const plugin$a = {
id: id$a,
detector: detector$a,
loader: loader$b
};
const requirement = plugin$a;
const id$9 = "sequence";
const detector$9 = (txt) => {
return /^\s*sequenceDiagram/.test(txt);
};
const loader$a = async () => {
const { diagram: diagram2 } = await import("./sequenceDiagram-d89d0f25.js");
return { id: id$9, diagram: diagram2 };
};
const plugin$9 = {
id: id$9,
detector: detector$9,
loader: loader$a
};
const sequence = plugin$9;
const id$8 = "class";
const detector$8 = (txt, config2) => {
var _a;
if (((_a = config2 == null ? void 0 : config2.class) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
return false;
}
return /^\s*classDiagram/.test(txt);
};
const loader$9 = async () => {
const { diagram: diagram2 } = await import("./classDiagram-04f04946.js");
return { id: id$8, diagram: diagram2 };
};
const plugin$8 = {
id: id$8,
detector: detector$8,
loader: loader$9
};
const classDiagram = plugin$8;
const id$7 = "classDiagram";
const detector$7 = (txt, config2) => {
var _a;
if (/^\s*classDiagram/.test(txt) && ((_a = config2 == null ? void 0 : config2.class) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
return true;
}
return /^\s*classDiagram-v2/.test(txt);
};
const loader$8 = async () => {
const { diagram: diagram2 } = await import("./classDiagram-v2-d4efdcc3.js");
return { id: id$7, diagram: diagram2 };
};
const plugin$7 = {
id: id$7,
detector: detector$7,
loader: loader$8
};
const classDiagramV2 = plugin$7;
const id$6 = "state";
const detector$6 = (txt, config2) => {
var _a;
if (((_a = config2 == null ? void 0 : config2.state) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
return false;
}
return /^\s*stateDiagram/.test(txt);
};
const loader$7 = async () => {
const { diagram: diagram2 } = await import("./stateDiagram-0d589c85.js");
return { id: id$6, diagram: diagram2 };
};
const plugin$6 = {
id: id$6,
detector: detector$6,
loader: loader$7
};
const state = plugin$6;
const id$5 = "stateDiagram";
const detector$5 = (txt, config2) => {
var _a;
if (/^\s*stateDiagram-v2/.test(txt)) {
return true;
}
if (/^\s*stateDiagram/.test(txt) && ((_a = config2 == null ? void 0 : config2.state) == null ? void 0 : _a.defaultRenderer) === "dagre-wrapper") {
return true;
}
return false;
};
const loader$6 = async () => {
const { diagram: diagram2 } = await import("./stateDiagram-v2-8bb05ecb.js");
return { id: id$5, diagram: diagram2 };
};
const plugin$5 = {
id: id$5,
detector: detector$5,
loader: loader$6
};
const stateV2 = plugin$5;
const id$4 = "journey";
const detector$4 = (txt) => {
return /^\s*journey/.test(txt);
};
const loader$5 = async () => {
const { diagram: diagram2 } = await import("./journeyDiagram-6df70039.js");
return { id: id$4, diagram: diagram2 };
};
const plugin$4 = {
id: id$4,
detector: detector$4,
loader: loader$5
};
const journey = plugin$4;
const selectSvgElement = (id2) => {
var _a;
const { securityLevel } = getConfig$1();
let root = select("body");
if (securityLevel === "sandbox") {
const sandboxElement = select(`#i${id2}`);
const doc = ((_a = sandboxElement.node()) == null ? void 0 : _a.contentDocument) ?? document;
root = select(doc.body);
}
const svg = root.select(`#${id2}`);
return svg;
};
const d3Attrs = function(d3Elem, attrs) {
for (let attr of attrs) {
d3Elem.attr(attr[0], attr[1]);
}
};
const calculateSvgSizeAttrs = function(height, width, useMaxWidth) {
let attrs = /* @__PURE__ */ new Map();
if (useMaxWidth) {
attrs.set("width", "100%");
attrs.set("style", `max-width: ${width}px;`);
} else {
attrs.set("height", height);
attrs.set("width", width);
}
return attrs;
};
const configureSvgSize = function(svgElem, height, width, useMaxWidth) {
const attrs = calculateSvgSizeAttrs(height, width, useMaxWidth);
d3Attrs(svgElem, attrs);
};
const setupGraphViewbox$1 = function(graph, svgElem, padding, useMaxWidth) {
const svgBounds = svgElem.node().getBBox();
const sWidth = svgBounds.width;
const sHeight = svgBounds.height;
log$1.info(`SVG bounds: ${sWidth}x${sHeight}`, svgBounds);
let width = 0;
let height = 0;
log$1.info(`Graph bounds: ${width}x${height}`, graph);
width = sWidth + padding * 2;
height = sHeight + padding * 2;
log$1.info(`Calculated bounds: ${width}x${height}`);
configureSvgSize(svgElem, height, width, useMaxWidth);
const vBox = `${svgBounds.x - padding} ${svgBounds.y - padding} ${svgBounds.width + 2 * padding} ${svgBounds.height + 2 * padding}`;
svgElem.attr("viewBox", vBox);
};
const draw = (_text, id2, version2) => {
log$1.debug("renering svg for syntax error\n");
const svg = selectSvgElement(id2);
svg.attr("viewBox", "0 0 2412 512");
configureSvgSize(svg, 100, 512, true);
const g = svg.append("g");
g.append("path").attr("class", "error-icon").attr(
"d",
"m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"
);
g.append("path").attr("class", "error-icon").attr(
"d",
"m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"
);
g.append("path").attr("class", "error-icon").attr(
"d",
"m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"
);
g.append("path").attr("class", "error-icon").attr(
"d",
"m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"
);
g.append("path").attr("class", "error-icon").attr(
"d",
"m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"
);
g.append("path").attr("class", "error-icon").attr(
"d",
"m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"
);
g.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text");
g.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${version2}`);
};
const renderer = { draw };
const errorRenderer = renderer;
const diagram = {
db: {},
renderer,
parser: {
parser: { yy: {} },
parse: () => {
return;
}
}
};
const errorDiagram = diagram;
const id$3 = "flowchart-elk";
const detector$3 = (txt, config2) => {
var _a;
if (
// If diagram explicitly states flowchart-elk
/^\s*flowchart-elk/.test(txt) || // If a flowchart/graph diagram has their default renderer set to elk
/^\s*flowchart|graph/.test(txt) && ((_a = config2 == null ? void 0 : config2.flowchart) == null ? void 0 : _a.defaultRenderer) === "elk"
) {
return true;
}
return false;
};
const loader$4 = async () => {
const { diagram: diagram2 } = await import("./flowchart-elk-definition-b487ab79.js");
return { id: id$3, diagram: diagram2 };
};
const plugin$3 = {
id: id$3,
detector: detector$3,
loader: loader$4
};
const flowchartElk = plugin$3;
const id$2 = "timeline";
const detector$2 = (txt) => {
return /^\s*timeline/.test(txt);
};
const loader$3 = async () => {
const { diagram: diagram2 } = await import("./timeline-definition-8b56e66a.js");
return { id: id$2, diagram: diagram2 };
};
const plugin$2 = {
id: id$2,
detector: detector$2,
loader: loader$3
};
const timeline = plugin$2;
const id$1 = "mindmap";
const detector$1 = (txt) => {
return /^\s*mindmap/.test(txt);
};
const loader$2 = async () => {
const { diagram: diagram2 } = await import("./mindmap-definition-7f612c4b.js");
return { id: id$1, diagram: diagram2 };
};
const plugin$1 = {
id: id$1,
detector: detector$1,
loader: loader$2
};
const mindmap = plugin$1;
const id = "sankey";
const detector = (txt) => {
return /^\s*sankey-beta/.test(txt);
};
const loader$1 = async () => {
const { diagram: diagram2 } = await import("./sankeyDiagram-6de1f9fe.js");
return { id, diagram: diagram2 };
};
const plugin = {
id,
detector,
loader: loader$1
};
const sankey = plugin;
const themes = {};
const getStyles = (type2, userStyles, options) => {
let diagramStyles = "";
if (type2 in themes && themes[type2]) {
diagramStyles = themes[type2](options);
} else {
log$1.warn(`No theme found for ${type2}`);
}
return ` & {
font-family: ${options.fontFamily};
font-size: ${options.fontSize};
fill: ${options.textColor}
}
/* Classes common for multiple diagrams */
& .error-icon {
fill: ${options.errorBkgColor};
}
& .error-text {
fill: ${options.errorTextColor};
stroke: ${options.errorTextColor};
}
& .edge-thickness-normal {
stroke-width: 2px;
}
& .edge-thickness-thick {
stroke-width: 3.5px
}
& .edge-pattern-solid {
stroke-dasharray: 0;
}
& .edge-pattern-dashed{
stroke-dasharray: 3;
}
.edge-pattern-dotted {
stroke-dasharray: 2;
}
& .marker {
fill: ${options.lineColor};
stroke: ${options.lineColor};
}
& .marker.cross {
stroke: ${options.lineColor};
}
& svg {
font-family: ${options.fontFamily};
font-size: ${options.fontSize};
}
${diagramStyles}
${userStyles}
`;
};
const addStylesForDiagram = (type2, diagramTheme) => {
if (diagramTheme !== void 0) {
themes[type2] = diagramTheme;
}
};
const getStyles$1 = getStyles;
let accTitle = "";
let diagramTitle = "";
let accDescription = "";
const sanitizeText$1 = (txt) => sanitizeText$2(txt, getConfig$1());
const clear = () => {
accTitle = "";
accDescription = "";
diagramTitle = "";
};
const setAccTitle = (txt) => {
accTitle = sanitizeText$1(txt).replace(/^\s+/g, "");
};
const getAccTitle = () => accTitle;
const setAccDescription = (txt) => {
accDescription = sanitizeText$1(txt).replace(/\n\s+/g, "\n");
};
const getAccDescription = () => accDescription;
const setDiagramTitle = (txt) => {
diagramTitle = sanitizeText$1(txt);
};
const getDiagramTitle = () => diagramTitle;
const commonDb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
clear,
getAccDescription,
getAccTitle,
getDiagramTitle,
setAccDescription,
setAccTitle,
setDiagramTitle
}, Symbol.toStringTag, { value: "Module" }));
const log = log$1;
const setLogLevel = setLogLevel$1;
const getConfig = getConfig$1;
const sanitizeText = (text) => sanitizeText$2(text, getConfig());
const setupGraphViewbox = setupGraphViewbox$1;
const getCommonDb = () => {
return commonDb;
};
const diagrams = {};
const registerDiagram = (id2, diagram2, detector2) => {
var _a;
if (diagrams[id2]) {
throw new Error(`Diagram ${id2} already registered.`);
}
diagrams[id2] = diagram2;
if (detector2) {
addDetector(id2, detector2);
}
addStylesForDiagram(id2, diagram2.styles);
(_a = diagram2.injectUtils) == null ? void 0 : _a.call(
diagram2,
log,
setLogLevel,
getConfig,
sanitizeText,
setupGraphViewbox,
getCommonDb(),
() => {
}
);
};
const getDiagram = (name) => {
if (name in diagrams) {
return diagrams[name];
}
throw new DiagramNotFoundError(name);
};
class DiagramNotFoundError extends Error {
constructor(name) {
super(`Diagram ${name} not found.`);
}
}
let hasLoadedDiagrams = false;
const addDiagrams = () => {
if (hasLoadedDiagrams) {
return;
}
hasLoadedDiagrams = true;
registerDiagram("error", errorDiagram, (text) => {
return text.toLowerCase().trim() === "error";
});
registerDiagram(
"---",
// --- diagram type may appear if YAML front-matter is not parsed correctly
{
db: {
clear: () => {
}
},
styles: {},
// should never be used
renderer: {
draw: () => {
}
},
parser: {
parser: { yy: {} },
parse: () => {
throw new Error(
"Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks"
);
}
},
init: () => null
// no op
},
(text) => {
return text.toLowerCase().trimStart().startsWith("---");
}
);
registerLazyLoadedDiagrams(
c4,
classDiagramV2,
classDiagram,
er,
gantt,
info,
pie,
requirement,
sequence,
flowchartElk,
flowchartV2,
flowchart,
mindmap,
timeline,
git,
stateV2,
state,
journey,
quadrantChart,
sankey
);
};
class Diagram {
constructor(text, metadata = {}) {
this.text = text;
this.metadata = metadata;
this.type = "graph";
this.text += "\n";
const cnf = getConfig$1();
try {
this.type = detectType(text, cnf);
} catch (e) {
this.type = "error";
this.detectError = e;
}
const diagram2 = getDiagram(this.type);
log$1.debug("Type " + this.type);
this.db = diagram2.db;
this.renderer = diagram2.renderer;
this.parser = diagram2.parser;
this.parser.parser.yy = this.db;
this.init = diagram2.init;
this.parse();
}
parse() {
var _a, _b, _c, _d, _e;
if (this.detectError) {
throw this.detectError;
}
(_b = (_a = this.db).clear) == null ? void 0 : _b.call(_a);
const config2 = getConfig$1();
(_c = this.init) == null ? void 0 : _c.call(this, config2);
if (this.metadata.title) {
(_e = (_d = this.db).setDiagramTitle) == null ? void 0 : _e.call(_d, this.metadata.title);
}
this.parser.parse(this.text);
}
async render(id2, version2) {
await this.renderer.draw(this.text, id2, version2, this);
}
getParser() {
return this.parser;
}
getType() {
return this.type;
}
}
const getDiagramFromText = async (text, metadata = {}) => {
const type2 = detectType(text, getConfig$1());
try {
getDiagram(type2);
} catch (error) {
const loader2 = getDiagramLoader(type2);
if (!loader2) {
throw new UnknownDiagramError(`Diagram ${type2} not found.`);
}
const { id: id2, diagram: diagram2 } = await loader2();
registerDiagram(id2, diagram2);
}
return new Diagram(text, metadata);
};
let interactionFunctions = [];
const addFunction = (func) => {
interactionFunctions.push(func);
};
const attachFunctions = () => {
interactionFunctions.forEach((f) => {
f();
});
interactionFunctions = [];
};
const SVG_ROLE = "graphics-document document";
function setA11yDiagramInfo(svg, diagramType) {
svg.attr("role", SVG_ROLE);
if (diagramType !== "") {
svg.attr("aria-roledescription", diagramType);
}
}
function addSVGa11yTitleDescription(svg, a11yTitle, a11yDesc, baseId) {
if (svg.insert === void 0) {
return;
}
if (a11yDesc) {
const descId = `chart-desc-${baseId}`;
svg.attr("aria-describedby", descId);
svg.insert("desc", ":first-child").attr("id", descId).text(a11yDesc);
}
if (a11yTitle) {
const titleId = `chart-title-${baseId}`;
svg.attr("aria-labelledby", titleId);
svg.insert("title", ":first-child").attr("id", titleId).text(a11yTitle);
}
}
const cleanupComments = (text) => {
return text.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart();
};
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
function isNothing(subject) {
return typeof subject === "undefined" || subject === null;
}
function isObject(subject) {
return typeof subject === "object" && subject !== null;
}
function toArray(sequence2) {
if (Array.isArray(sequence2))
return sequence2;
else if (isNothing(sequence2))
return [];
return [sequence2];
}
function extend(target, source) {
var index, length, key, sourceKeys;
if (source) {
sourceKeys = Object.keys(source);
for (index = 0, length = sourceKeys.length; index < length; index += 1) {
key = sourceKeys[index];
target[key] = source[key];
}
}
return target;
}
function repeat(string, count) {
var result = "", cycle;
for (cycle = 0; cycle < count; cycle += 1) {
result += string;
}
return result;
}
function isNegativeZero(number) {
return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
}
var isNothing_1 = isNothing;
var isObject_1 = isObject;
var toArray_1 = toArray;
var repeat_1 = repeat;
var isNegativeZero_1 = isNegativeZero;
var extend_1 = extend;
var common = {
isNothing: isNothing_1,
isObject: isObject_1,
toArray: toArray_1,
repeat: repeat_1,
isNegativeZero: isNegativeZero_1,
extend: extend_1
};
function formatError(exception2, compact) {
var where = "", message = exception2.reason || "(unknown reason)";
if (!exception2.mark)
return message;
if (exception2.mark.name) {
where += 'in "' + exception2.mark.name + '" ';
}
where += "(" + (exception2.mark.line + 1) + ":" + (exception2.mark.column + 1) + ")";
if (!compact && exception2.mark.snippet) {
where += "\n\n" + exception2.mark.snippet;
}
return message + " " + where;
}
function YAMLException$1(reason, mark) {
Error.call(this);
this.name = "YAMLException";
this.reason = reason;
this.mark = mark;
this.message = formatError(this, false);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = new Error().stack || "";
}
}
YAMLException$1.prototype = Object.create(Error.prototype);
YAMLException$1.prototype.constructor = YAMLException$1;
YAMLException$1.prototype.toString = function toString(compact) {
return this.name + ": " + formatError(this, compact);
};
var exception = YAMLException$1;
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
var head = "";
var tail = "";
var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
if (position - lineStart > maxHalfLength) {
head = " ... ";
lineStart = position - maxHalfLength + head.length;
}
if (lineEnd - position > maxHalfLength) {
tail = " ...";
lineEnd = position + maxHalfLength - tail.length;
}
return {
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "→") + tail,
pos: position - lineStart + head.length
// relative position
};
}
function padStart(string, max) {
return common.repeat(" ", max - string.length) + string;
}
function makeSnippet(mark, options) {
options = Object.create(options || null);
if (!mark.buffer)
return null;
if (!options.maxLength)
options.maxLength = 79;
if (typeof options.indent !== "number")
options.indent = 1;
if (typeof options.linesBefore !== "number")
options.linesBefore = 3;
if (typeof options.linesAfter !== "number")
options.linesAfter = 2;
var re = /\r?\n|\r|\0/g;
var lineStarts = [0];
var lineEnds = [];
var match;
var foundLineNo = -1;
while (match = re.exec(mark.buffer)) {
lineEnds.push(match.index);
lineStarts.push(match.index + match[0].length);
if (mark.position <= match.index && foundLineNo < 0) {
foundLineNo = lineStarts.length - 2;
}
}
if (foundLineNo < 0)
foundLineNo = lineStarts.length - 1;
var result = "", i, line;
var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
for (i = 1; i <= options.linesBefore; i++) {
if (foundLineNo - i < 0)
break;
line = getLine(
mark.buffer,
lineStarts[foundLineNo - i],
lineEnds[foundLineNo - i],
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
maxLineLength
);
result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
}
line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
for (i = 1; i <= options.linesAfter; i++) {
if (foundLineNo + i >= lineEnds.length)
break;
line = getLine(
mark.buffer,
lineStarts[foundLineNo + i],
lineEnds[foundLineNo + i],
mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
maxLineLength
);
result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
}
return result.replace(/\n$/, "");
}
var snippet = makeSnippet;
var TYPE_CONSTRUCTOR_OPTIONS = [
"kind",
"multi",
"resolve",
"construct",
"instanceOf",
"predicate",
"represent",
"representName",
"defaultStyle",
"styleAliases"
];
var YAML_NODE_KINDS = [
"scalar",
"sequence",
"mapping"
];
function compileStyleAliases(map2) {
var result = {};
if (map2 !== null) {
Object.keys(map2).forEach(function(style) {
map2[style].forEach(function(alias) {
result[String(alias)] = style;
});
});
}
return result;
}
function Type$1(tag, options) {
options = options || {};
Object.keys(options).forEach(function(name) {
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
throw new exception('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
}
});
this.options = options;
this.tag = tag;
this.kind = options["kind"] || null;
this.resolve = options["resolve"] || function() {
return true;
};
this.construct = options["construct"] || function(data) {
return data;
};
this.instanceOf = options["instanceOf"] || null;
this.predicate = options["predicate"] || null;
this.represent = options["represent"] || null;
this.representName = options["representName"] || null;
this.defaultStyle = options["defaultStyle"] || null;
this.multi = options["multi"] || false;
this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
throw new exception('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
}
}
var type = Type$1;
function compileList(schema2, name) {
var result = [];
schema2[name].forEach(function(currentType) {
var newIndex = result.length;
result.forEach(function(previousType, previousIndex) {
if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
newIndex = previousIndex;
}
});
result[newIndex] = currentType;
});
return result;
}
function compileMap() {
var result = {
scalar: {},
sequence: {},
mapping: {},
fallback: {},
multi: {
scalar: [],
sequence: [],
mapping: [],
fallback: []
}
}, index, length;
function collectType(type2) {
if (type2.multi) {
result.multi[type2.kind].push(type2);
result.multi["fallback"].push(type2);
} else {
result[type2.kind][type2.tag] = result["fallback"][type2.tag] = type2;
}
}
for (index = 0, length = arguments.length; index < length; index += 1) {
arguments[index].forEach(collectType);
}
return result;
}
function Schema$1(definition) {
return this.extend(definition);
}
Schema$1.prototype.extend = function extend2(definition) {
var implicit = [];
var explicit = [];
if (definition instanceof type) {
explicit.push(definition);
} else if (Array.isArray(definition)) {
explicit = explicit.concat(definition);
} else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
if (definition.implicit)
implicit = implicit.concat(definition.implicit);
if (definition.explicit)
explicit = explicit.concat(definition.explicit);
} else {
throw new exception("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
}
implicit.forEach(function(type$1) {
if (!(type$1 instanceof type)) {
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
}
if (type$1.loadKind && type$1.loadKind !== "scalar") {
throw new exception("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
}
if (type$1.multi) {
throw new exception("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
}
});
explicit.forEach(function(type$1) {
if (!(type$1 instanceof type)) {
throw new exception("Specified list of YAML types (or a single Type object) contains a non-Type object.");
}
});
var result = Object.create(Schema$1.prototype);
result.implicit = (this.implicit || []).concat(implicit);
result.explicit = (this.explicit || []).concat(explicit);
result.compiledImplicit = compileList(result, "implicit");
result.compiledExplicit = compileList(result, "explicit");
result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
return result;
};
var schema = Schema$1;
var str = new type("tag:yaml.org,2002:str", {
kind: "scalar",
construct: function(data) {
return data !== null ? data : "";
}
});
var seq = new type("tag:yaml.org,2002:seq", {
kind: "sequence",
construct: function(data) {
return data !== null ? data : [];
}
});
var map = new type("tag:yaml.org,2002:map", {
kind: "mapping",
construct: function(data) {
return data !== null ? data : {};
}
});
var failsafe = new schema({
explicit: [
str,
seq,
map
]
});
function resolveYamlNull(data) {
if (data === null)
return true;
var max = data.length;
return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
}
function constructYamlNull() {
return null;
}
function isNull(object) {
return object === null;
}
var _null = new type("tag:yaml.org,2002:null", {
kind: "scalar",
resolve: resolveYamlNull,
construct: constructYamlNull,
predicate: isNull,
represent: {
canonical: function() {
return "~";
},
lowercase: function() {
return "null";
},
uppercase: function() {
return "NULL";
},
camelcase: function() {
return "Null";
},
empty: function() {
return "";
}
},
defaultStyle: "lowercase"
});
function resolveYamlBoolean(data) {
if (data === null)
return false;
var max = data.length;
return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
}
function constructYamlBoolean(data) {
return data === "true" || data === "True" || data === "TRUE";
}
function isBoolean(object) {
return Object.prototype.toString.call(object) === "[object Boolean]";
}
var bool = new type("tag:yaml.org,2002:bool", {
kind: "scalar",
resolve: resolveYamlBoolean,
construct: constructYamlBoolean,
predicate: isBoolean,
represent: {
lowercase: function(object) {
return object ? "true" : "false";
},
uppercase: function(object) {
return object ? "TRUE" : "FALSE";
},
camelcase: function(object) {
return object ? "True" : "False";
}
},
defaultStyle: "lowercase"
});
function isHexCode(c) {
return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
}
function isOctCode(c) {
return 48 <= c && c <= 55;
}
function isDecCode(c) {
return 48 <= c && c <= 57;
}
function resolveYamlInteger(data) {
if (data === null)
return false;
var max = data.length, index = 0, hasDigits = false, ch;
if (!max)
return false;
ch = data[index];
if (ch === "-" || ch === "+") {
ch = data[++index];
}
if (ch === "0") {
if (index + 1 === max)
return true;
ch = data[++index];
if (ch === "b") {
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (ch !== "0" && ch !== "1")
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
if (ch === "x") {
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (!isHexCode(data.charCodeAt(index)))
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
if (ch === "o") {
index++;
for (; index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (!isOctCode(data.charCodeAt(index)))
return false;
hasDigits = true;
}
return hasDigits && ch !== "_";
}
}
if (ch === "_")
return false;
for (; index < max; index++) {
ch = data[index];
if (ch === "_")
continue;
if (!isDecCode(data.charCodeAt(index))) {
return false;
}
hasDigits = true;
}
if (!hasDigits || ch === "_")
return false;
return true;
}
function constructYamlInteger(data) {
var value = data, sign = 1, ch;
if (value.indexOf("_") !== -1) {
value = value.replace(/_/g, "");
}
ch = value[0];
if (ch === "-" || ch === "+") {
if (ch === "-")
sign = -1;
value = value.slice(1);
ch = value[0];
}
if (value === "0")
return 0;
if (ch === "0") {
if (value[1] === "b")
return sign * parseInt(value.slice(2), 2);
if (value[1] === "x")
return sign * parseInt(value.slice(2), 16);
if (value[1] === "o")
return sign * parseInt(value.slice(2), 8);
}
return sign * parseInt(value, 10);
}
function isInteger(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
}
var int = new type("tag:yaml.org,2002:int", {
kind: "scalar",
resolve: resolveYamlInteger,
construct: constructYamlInteger,
predicate: isInteger,
represent: {
binary: function(obj) {
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
},
octal: function(obj) {
return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
},
decimal: function(obj) {
return obj.toString(10);
},
/* eslint-disable max-len */
hexadecimal: function(obj) {
return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
}
},
defaultStyle: "decimal",
styleAliases: {
binary: [2, "bin"],
octal: [8, "oct"],
decimal: [10, "dec"],
hexadecimal: [16, "hex"]
}
});
var YAML_FLOAT_PATTERN = new RegExp(
// 2.5e4, 2.5 and integers
"^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
);
function resolveYamlFloat(data) {
if (data === null)
return false;
if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
// Probably should update regexp & check speed
data[data.length - 1] === "_") {
return false;
}
return true;
}
function constructYamlFloat(data) {
var value, sign;
value = data.replace(/_/g, "").toLowerCase();
sign = value[0] === "-" ? -1 : 1;
if ("+-".indexOf(value[0]) >= 0) {
value = value.slice(1);
}
if (value === ".inf") {
return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
} else if (value === ".nan") {
return NaN;
}
return sign * parseFloat(value, 10);
}
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
function representYamlFloat(object, style) {
var res;
if (isNaN(object)) {
switch (style) {
case "lowercase":
return ".nan";
case "uppercase":
return ".NAN";
case "camelcase":
return ".NaN";
}
} else if (Number.POSITIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return ".inf";
case "uppercase":
return ".INF";
case "camelcase":
return ".Inf";
}
} else if (Number.NEGATIVE_INFINITY === object) {
switch (style) {
case "lowercase":
return "-.inf";
case "uppercase":
return "-.INF";
case "camelcase":
return "-.Inf";
}
} else if (common.isNegativeZero(object)) {
return "-0.0";
}
res = object.toString(10);
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
}
function isFloat(object) {
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
}
var float = new type("tag:yaml.org,2002:float", {
kind: "scalar",
resolve: resolveYamlFloat,
construct: constructYamlFloat,
predicate: isFloat,
represent: representYamlFloat,
defaultStyle: "lowercase"
});
var json = failsafe.extend({
implicit: [
_null,
bool,
int,
float
]
});
var core = json;
var YAML_DATE_REGEXP = new RegExp(
"^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
);
var YAML_TIMESTAMP_REGEXP = new RegExp(
"^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
);
function resolveYamlTimestamp(data) {
if (data === null)
return false;
if (YAML_DATE_REGEXP.exec(data) !== null)
return true;
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null)
return true;
return false;
}
function constructYamlTimestamp(data) {
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
match = YAML_DATE_REGEXP.exec(data);
if (match === null)
match = YAML_TIMESTAMP_REGEXP.exec(data);
if (match === null)
throw new Error("Date resolve error");
year = +match[1];
month = +match[2] - 1;
day = +match[3];
if (!match[4]) {
return new Date(Date.UTC(year, month, day));
}
hour = +match[4];
minute = +match[5];
second = +match[6];
if (match[7]) {
fraction = match[7].slice(0, 3);
while (fraction.length < 3) {
fraction += "0";
}
fraction = +fraction;
}
if (match[9]) {
tz_hour = +match[10];
tz_minute = +(match[11] || 0);
delta = (tz_hour * 60 + tz_minute) * 6e4;
if (match[9] === "-")
delta = -delta;
}
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
if (delta)
date.setTime(date.getTime() - delta);
return date;
}
function representYamlTimestamp(object) {
return object.toISOString();
}
var timestamp = new type("tag:yaml.org,2002:timestamp", {
kind: "scalar",
resolve: resolveYamlTimestamp,
construct: constructYamlTimestamp,
instanceOf: Date,
represent: representYamlTimestamp
});
function resolveYamlMerge(data) {
return data === "<<" || data === null;
}
var merge = new type("tag:yaml.org,2002:merge", {
kind: "scalar",
resolve: resolveYamlMerge
});
var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
function resolveYamlBinary(data) {
if (data === null)
return false;
var code, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
for (idx = 0; idx < max; idx++) {
code = map2.indexOf(data.charAt(idx));
if (code > 64)
continue;
if (code < 0)
return false;
bitlen += 6;
}
return bitlen % 8 === 0;
}
function constructYamlBinary(data) {
var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
for (idx = 0; idx < max; idx++) {
if (idx % 4 === 0 && idx) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
}
bits = bits << 6 | map2.indexOf(input.charAt(idx));
}
tailbits = max % 4 * 6;
if (tailbits === 0) {
result.push(bits >> 16 & 255);
result.push(bits >> 8 & 255);
result.push(bits & 255);
} else if (tailbits === 18) {
result.push(bits >> 10 & 255);
result.push(bits >> 2 & 255);
} else if (tailbits === 12) {
result.push(bits >> 4 & 255);
}
return new Uint8Array(result);
}
function representYamlBinary(object) {
var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
for (idx = 0; idx < max; idx++) {
if (idx % 3 === 0 && idx) {
result += map2[bits >> 18 & 63];
result += map2[bits >> 12 & 63];
result += map2[bits >> 6 & 63];
result += map2[bits & 63];
}
bits = (bits << 8) + object[idx];
}
tail = max % 3;
if (tail === 0) {
result += map2[bits >> 18 & 63];
result += map2[bits >> 12 & 63];
result += map2[bits >> 6 & 63];
result += map2[bits & 63];
} else if (tail === 2) {
result += map2[bits >> 10 & 63];
result += map2[bits >> 4 & 63];
result += map2[bits << 2 & 63];
result += map2[64];
} else if (tail === 1) {
result += map2[bits >> 2 & 63];
result += map2[bits << 4 & 63];
result += map2[64];
result += map2[64];
}
return result;
}
function isBinary(obj) {
return Object.prototype.toString.call(obj) === "[object Uint8Array]";
}
var binary = new type("tag:yaml.org,2002:binary", {
kind: "scalar",
resolve: resolveYamlBinary,
construct: constructYamlBinary,
predicate: isBinary,
represent: representYamlBinary
});
var _hasOwnProperty$3 = Object.prototype.hasOwnProperty;
var _toString$2 = Object.prototype.toString;
function resolveYamlOmap(data) {
if (data === null)
return true;
var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
pairHasKey = false;
if (_toString$2.call(pair) !== "[object Object]")
return false;
for (pairKey in pair) {
if (_hasOwnProperty$3.call(pair, pairKey)) {
if (!pairHasKey)
pairHasKey = true;
else
return false;
}
}
if (!pairHasKey)
return false;
if (objectKeys.indexOf(pairKey) === -1)
objectKeys.push(pairKey);
else
return false;
}
return true;
}
function constructYamlOmap(data) {
return data !== null ? data : [];
}
var omap = new type("tag:yaml.org,2002:omap", {
kind: "sequence",
resolve: resolveYamlOmap,
construct: constructYamlOmap
});
var _toString$1 = Object.prototype.toString;
function resolveYamlPairs(data) {
if (data === null)
return true;
var index, length, pair, keys, result, object = data;
result = new Array(object.length);
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
if (_toString$1.call(pair) !== "[object Object]")
return false;
keys = Object.keys(pair);
if (keys.length !== 1)
return false;
result[index] = [keys[0], pair[keys[0]]];
}
return true;
}
function constructYamlPairs(data) {
if (data === null)
return [];
var index, length, pair, keys, result, object = data;
result = new Array(object.length);
for (index = 0, length = object.length; index < length; index += 1) {
pair = object[index];
keys = Object.keys(pair);
result[index] = [keys[0], pair[keys[0]]];
}
return result;
}
var pairs = new type("tag:yaml.org,2002:pairs", {
kind: "sequence",
resolve: resolveYamlPairs,
construct: constructYamlPairs
});
var _hasOwnProperty$2 = Object.prototype.hasOwnProperty;
function resolveYamlSet(data) {
if (data === null)
return true;
var key, object = data;
for (key in object) {
if (_hasOwnProperty$2.call(object, key)) {
if (object[key] !== null)
return false;
}
}
return true;
}
function constructYamlSet(data) {
return data !== null ? data : {};
}
var set = new type("tag:yaml.org,2002:set", {
kind: "mapping",
resolve: resolveYamlSet,
construct: constructYamlSet
});
var _default = core.extend({
implicit: [
timestamp,
merge
],
explicit: [
binary,
omap,
pairs,
set
]
});
var _hasOwnProperty$1 = Object.prototype.hasOwnProperty;
var CONTEXT_FLOW_IN = 1;
var CONTEXT_FLOW_OUT = 2;
var CONTEXT_BLOCK_IN = 3;
var CONTEXT_BLOCK_OUT = 4;
var CHOMPING_CLIP = 1;
var CHOMPING_STRIP = 2;
var CHOMPING_KEEP = 3;
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function _class(obj) {
return Object.prototype.toString.call(obj);
}
function is_EOL(c) {
return c === 10 || c === 13;
}
function is_WHITE_SPACE(c) {
return c === 9 || c === 32;
}
function is_WS_OR_EOL(c) {
return c === 9 || c === 32 || c === 10 || c === 13;
}
function is_FLOW_INDICATOR(c) {
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
}
function fromHexCode(c) {
var lc;
if (48 <= c && c <= 57) {
return c - 48;
}
lc = c | 32;
if (97 <= lc && lc <= 102) {
return lc - 97 + 10;
}
return -1;
}
function escapedHexLen(c) {
if (c === 120) {
return 2;
}
if (c === 117) {
return 4;
}
if (c === 85) {
return 8;
}
return 0;
}
function fromDecimalCode(c) {
if (48 <= c && c <= 57) {
return c - 48;
}
return -1;
}
function simpleEscapeSequence(c) {
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "…" : c === 95 ? " " : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
}
function charFromCodepoint(c) {
if (c <= 65535) {
return String.fromCharCode(c);
}
return String.fromCharCode(
(c - 65536 >> 10) + 55296,
(c - 65536 & 1023) + 56320
);
}
var simpleEscapeCheck = new Array(256);
var simpleEscapeMap = new Array(256);
for (var i = 0; i < 256; i++) {
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
simpleEscapeMap[i] = simpleEscapeSequence(i);
}
function State$1(input, options) {
this.input = input;
this.filename = options["filename"] || null;
this.schema = options["schema"] || _default;
this.onWarning = options["onWarning"] || null;
this.legacy = options["legacy"] || false;
this.json = options["json"] || false;
this.listener = options["listener"] || null;
this.implicitTypes = this.schema.compiledImplicit;
this.typeMap = this.schema.compiledTypeMap;
this.length = input.length;
this.position = 0;
this.line = 0;
this.lineStart = 0;
this.lineIndent = 0;
this.firstTabInLine = -1;
this.documents = [];
}
function generateError(state2, message) {
var mark = {
name: state2.filename,
buffer: state2.input.slice(0, -1),
// omit trailing \0
position: state2.position,
line: state2.line,
column: state2.position - state2.lineStart
};
mark.snippet = snippet(mark);
return new exception(message, mark);
}
function throwError(state2, message) {
throw generateError(state2, message);
}
function throwWarning(state2, message) {
if (state2.onWarning) {
state2.onWarning.call(null, generateError(state2, message));
}
}
var directiveHandlers = {
YAML: function handleYamlDirective(state2, name, args) {
var match, major, minor;
if (state2.version !== null) {
throwError(state2, "duplication of %YAML directive");
}
if (args.length !== 1) {
throwError(state2, "YAML directive accepts exactly one argument");
}
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
if (match === null) {
throwError(state2, "ill-formed argument of the YAML directive");
}
major = parseInt(match[1], 10);
minor = parseInt(match[2], 10);
if (major !== 1) {
throwError(state2, "unacceptable YAML version of the document");
}
state2.version = args[0];
state2.checkLineBreaks = minor < 2;
if (minor !== 1 && minor !== 2) {
throwWarning(state2, "unsupported YAML version of the document");
}
},
TAG: function handleTagDirective(state2, name, args) {
var handle, prefix;
if (args.length !== 2) {
throwError(state2, "TAG directive accepts exactly two arguments");
}
handle = args[0];
prefix = args[1];
if (!PATTERN_TAG_HANDLE.test(handle)) {
throwError(state2, "ill-formed tag handle (first argument) of the TAG directive");
}
if (_hasOwnProperty$1.call(state2.tagMap, handle)) {
throwError(state2, 'there is a previously declared suffix for "' + handle + '" tag handle');
}
if (!PATTERN_TAG_URI.test(prefix)) {
throwError(state2, "ill-formed tag prefix (second argument) of the TAG directive");
}
try {
prefix = decodeURIComponent(prefix);
} catch (err) {
throwError(state2, "tag prefix is malformed: " + prefix);
}
state2.tagMap[handle] = prefix;
}
};
function captureSegment(state2, start, end, checkJson) {
var _position, _length, _character, _result;
if (start < end) {
_result = state2.input.slice(start, end);
if (checkJson) {
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
_character = _result.charCodeAt(_position);
if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
throwError(state2, "expected valid JSON character");
}
}
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
throwError(state2, "the stream contains non-printable characters");
}
state2.result += _result;
}
}
function mergeMappings(state2, destination, source, overridableKeys) {
var sourceKeys, key, index, quantity;
if (!common.isObject(source)) {
throwError(state2, "cannot merge mappings; the provided source object is unacceptable");
}
sourceKeys = Object.keys(source);
for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
key = sourceKeys[index];
if (!_hasOwnProperty$1.call(destination, key)) {
destination[key] = source[key];
overridableKeys[key] = true;
}
}
}
function storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
var index, quantity;
if (Array.isArray(keyNode)) {
keyNode = Array.prototype.slice.call(keyNode);
for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
if (Array.isArray(keyNode[index])) {
throwError(state2, "nested arrays are not supported inside keys");
}
if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
keyNode[index] = "[object Object]";
}
}
}
if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
keyNode = "[object Object]";
}
keyNode = String(keyNode);
if (_result === null) {
_result = {};
}
if (keyTag === "tag:yaml.org,2002:merge") {
if (Array.isArray(valueNode)) {
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
mergeMappings(state2, _result, valueNode[index], overridableKeys);
}
} else {
mergeMappings(state2, _result, valueNode, overridableKeys);
}
} else {
if (!state2.json && !_hasOwnProperty$1.call(overridableKeys, keyNode) && _hasOwnProperty$1.call(_result, keyNode)) {
state2.line = startLine || state2.line;
state2.lineStart = startLineStart || state2.lineStart;
state2.position = startPos || state2.position;
throwError(state2, "duplicated mapping key");
}
if (keyNode === "__proto__") {
Object.defineProperty(_result, keyNode, {
configurable: true,
enumerable: true,
writable: true,
value: valueNode
});
} else {
_result[keyNode] = valueNode;
}
delete overridableKeys[keyNode];
}
return _result;
}
function readLineBreak(state2) {
var ch;
ch = state2.input.charCodeAt(state2.position);
if (ch === 10) {
state2.position++;
} else if (ch === 13) {
state2.position++;
if (state2.input.charCodeAt(state2.position) === 10) {
state2.position++;
}
} else {
throwError(state2, "a line break is expected");
}
state2.line += 1;
state2.lineStart = state2.position;
state2.firstTabInLine = -1;
}
function skipSeparationSpace(state2, allowComments, checkIndent) {
var lineBreaks = 0, ch = state2.input.charCodeAt(state2.position);
while (ch !== 0) {
while (is_WHITE_SPACE(ch)) {
if (ch === 9 && state2.firstTabInLine === -1) {
state2.firstTabInLine = state2.position;
}
ch = state2.input.charCodeAt(++state2.position);
}
if (allowComments && ch === 35) {
do {
ch = state2.input.charCodeAt(++state2.position);
} while (ch !== 10 && ch !== 13 && ch !== 0);
}
if (is_EOL(ch)) {
readLineBreak(state2);
ch = state2.input.charCodeAt(state2.position);
lineBreaks++;
state2.lineIndent = 0;
while (ch === 32) {
state2.lineIndent++;
ch = state2.input.charCodeAt(++state2.position);
}
} else {
break;
}
}
if (checkIndent !== -1 && lineBreaks !== 0 && state2.lineIndent < checkIndent) {
throwWarning(state2, "deficient indentation");
}
return lineBreaks;
}
function testDocumentSeparator(state2) {
var _position = state2.position, ch;
ch = state2.input.charCodeAt(_position);
if ((ch === 45 || ch === 46) && ch === state2.input.charCodeAt(_position + 1) && ch === state2.input.charCodeAt(_position + 2)) {
_position += 3;
ch = state2.input.charCodeAt(_position);
if (ch === 0 || is_WS_OR_EOL(ch)) {
return true;
}
}
return false;
}
function writeFoldedLines(state2, count) {
if (count === 1) {
state2.result += " ";
} else if (count > 1) {
state2.result += common.repeat("\n", count - 1);
}
}
function readPlainScalar(state2, nodeIndent, withinFlowCollection) {
var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state2.kind, _result = state2.result, ch;
ch = state2.input.charCodeAt(state2.position);
if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
return false;
}
if (ch === 63 || ch === 45) {
following = state2.input.charCodeAt(state2.position + 1);
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
return false;
}
}
state2.kind = "scalar";
state2.result = "";
captureStart = captureEnd = state2.position;
hasPendingContent = false;
while (ch !== 0) {
if (ch === 58) {
following = state2.input.charCodeAt(state2.position + 1);
if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
break;
}
} else if (ch === 35) {
preceding = state2.input.charCodeAt(state2.position - 1);
if (is_WS_OR_EOL(preceding)) {
break;
}
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
break;
} else if (is_EOL(ch)) {
_line = state2.line;
_lineStart = state2.lineStart;
_lineIndent = state2.lineIndent;
skipSeparationSpace(state2, false, -1);
if (state2.lineIndent >= nodeIndent) {
hasPendingContent = true;
ch = state2.input.charCodeAt(state2.position);
continue;
} else {
state2.position = captureEnd;
state2.line = _line;
state2.lineStart = _lineStart;
state2.lineIndent = _lineIndent;
break;
}
}
if (hasPendingContent) {
captureSegment(state2, captureStart, captureEnd, false);
writeFoldedLines(state2, state2.line - _line);
captureStart = captureEnd = state2.position;
hasPendingContent = false;
}
if (!is_WHITE_SPACE(ch)) {
captureEnd = state2.position + 1;
}
ch = state2.input.charCodeAt(++state2.position);
}
captureSegment(state2, captureStart, captureEnd, false);
if (state2.result) {
return true;
}
state2.kind = _kind;
state2.result = _result;
return false;
}
function readSingleQuotedScalar(state2, nodeIndent) {
var ch, captureStart, captureEnd;
ch = state2.input.charCodeAt(state2.position);
if (ch !== 39) {
return false;
}
state2.kind = "scalar";
state2.result = "";
state2.position++;
captureStart = captureEnd = state2.position;
while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
if (ch === 39) {
captureSegment(state2, captureStart, state2.position, true);
ch = state2.input.charCodeAt(++state2.position);
if (ch === 39) {
captureStart = state2.position;
state2.position++;
captureEnd = state2.position;
} else {
return true;
}
} else if (is_EOL(ch)) {
captureSegment(state2, captureStart, captureEnd, true);
writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
captureStart = captureEnd = state2.position;
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
throwError(state2, "unexpected end of the document within a single quoted scalar");
} else {
state2.position++;
captureEnd = state2.position;
}
}
throwError(state2, "unexpected end of the stream within a single quoted scalar");
}
function readDoubleQuotedScalar(state2, nodeIndent) {
var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
ch = state2.input.charCodeAt(state2.position);
if (ch !== 34) {
return false;
}
state2.kind = "scalar";
state2.result = "";
state2.position++;
captureStart = captureEnd = state2.position;
while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
if (ch === 34) {
captureSegment(state2, captureStart, state2.position, true);
state2.position++;
return true;
} else if (ch === 92) {
captureSegment(state2, captureStart, state2.position, true);
ch = state2.input.charCodeAt(++state2.position);
if (is_EOL(ch)) {
skipSeparationSpace(state2, false, nodeIndent);
} else if (ch < 256 && simpleEscapeCheck[ch]) {
state2.result += simpleEscapeMap[ch];
state2.position++;
} else if ((tmp = escapedHexLen(ch)) > 0) {
hexLength = tmp;
hexResult = 0;
for (; hexLength > 0; hexLength--) {
ch = state2.input.charCodeAt(++state2.position);
if ((tmp = fromHexCode(ch)) >= 0) {
hexResult = (hexResult << 4) + tmp;
} else {
throwError(state2, "expected hexadecimal character");
}
}
state2.result += charFromCodepoint(hexResult);
state2.position++;
} else {
throwError(state2, "unknown escape sequence");
}
captureStart = captureEnd = state2.position;
} else if (is_EOL(ch)) {
captureSegment(state2, captureStart, captureEnd, true);
writeFoldedLines(state2, skipSeparationSpace(state2, false, nodeIndent));
captureStart = captureEnd = state2.position;
} else if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
throwError(state2, "unexpected end of the document within a double quoted scalar");
} else {
state2.position++;
captureEnd = state2.position;
}
}
throwError(state2, "unexpected end of the stream within a double quoted scalar");
}
function readFlowCollection(state2, nodeIndent) {
var readNext = true, _line, _lineStart, _pos, _tag = state2.tag, _result, _anchor = state2.anchor, following, terminator, isPair, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
ch = state2.input.charCodeAt(state2.position);
if (ch === 91) {
terminator = 93;
isMapping = false;
_result = [];
} else if (ch === 123) {
terminator = 125;
isMapping = true;
_result = {};
} else {
return false;
}
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = _result;
}
ch = state2.input.charCodeAt(++state2.position);
while (ch !== 0) {
skipSeparationSpace(state2, true, nodeIndent);
ch = state2.input.charCodeAt(state2.position);
if (ch === terminator) {
state2.position++;
state2.tag = _tag;
state2.anchor = _anchor;
state2.kind = isMapping ? "mapping" : "sequence";
state2.result = _result;
return true;
} else if (!readNext) {
throwError(state2, "missed comma between flow collection entries");
} else if (ch === 44) {
throwError(state2, "expected the node content, but found ','");
}
keyTag = keyNode = valueNode = null;
isPair = isExplicitPair = false;
if (ch === 63) {
following = state2.input.charCodeAt(state2.position + 1);
if (is_WS_OR_EOL(following)) {
isPair = isExplicitPair = true;
state2.position++;
skipSeparationSpace(state2, true, nodeIndent);
}
}
_line = state2.line;
_lineStart = state2.lineStart;
_pos = state2.position;
composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
keyTag = state2.tag;
keyNode = state2.result;
skipSeparationSpace(state2, true, nodeIndent);
ch = state2.input.charCodeAt(state2.position);
if ((isExplicitPair || state2.line === _line) && ch === 58) {
isPair = true;
ch = state2.input.charCodeAt(++state2.position);
skipSeparationSpace(state2, true, nodeIndent);
composeNode(state2, nodeIndent, CONTEXT_FLOW_IN, false, true);
valueNode = state2.result;
}
if (isMapping) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
} else if (isPair) {
_result.push(storeMappingPair(state2, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
} else {
_result.push(keyNode);
}
skipSeparationSpace(state2, true, nodeIndent);
ch = state2.input.charCodeAt(state2.position);
if (ch === 44) {
readNext = true;
ch = state2.input.charCodeAt(++state2.position);
} else {
readNext = false;
}
}
throwError(state2, "unexpected end of the stream within a flow collection");
}
function readBlockScalar(state2, nodeIndent) {
var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
ch = state2.input.charCodeAt(state2.position);
if (ch === 124) {
folding = false;
} else if (ch === 62) {
folding = true;
} else {
return false;
}
state2.kind = "scalar";
state2.result = "";
while (ch !== 0) {
ch = state2.input.charCodeAt(++state2.position);
if (ch === 43 || ch === 45) {
if (CHOMPING_CLIP === chomping) {
chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
} else {
throwError(state2, "repeat of a chomping mode identifier");
}
} else if ((tmp = fromDecimalCode(ch)) >= 0) {
if (tmp === 0) {
throwError(state2, "bad explicit indentation width of a block scalar; it cannot be less than one");
} else if (!detectedIndent) {
textIndent = nodeIndent + tmp - 1;
detectedIndent = true;
} else {
throwError(state2, "repeat of an indentation width identifier");
}
} else {
break;
}
}
if (is_WHITE_SPACE(ch)) {
do {
ch = state2.input.charCodeAt(++state2.position);
} while (is_WHITE_SPACE(ch));
if (ch === 35) {
do {
ch = state2.input.charCodeAt(++state2.position);
} while (!is_EOL(ch) && ch !== 0);
}
}
while (ch !== 0) {
readLineBreak(state2);
state2.lineIndent = 0;
ch = state2.input.charCodeAt(state2.position);
while ((!detectedIndent || state2.lineIndent < textIndent) && ch === 32) {
state2.lineIndent++;
ch = state2.input.charCodeAt(++state2.position);
}
if (!detectedIndent && state2.lineIndent > textIndent) {
textIndent = state2.lineIndent;
}
if (is_EOL(ch)) {
emptyLines++;
continue;
}
if (state2.lineIndent < textIndent) {
if (chomping === CHOMPING_KEEP) {
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
} else if (chomping === CHOMPING_CLIP) {
if (didReadContent) {
state2.result += "\n";
}
}
break;
}
if (folding) {
if (is_WHITE_SPACE(ch)) {
atMoreIndented = true;
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
} else if (atMoreIndented) {
atMoreIndented = false;
state2.result += common.repeat("\n", emptyLines + 1);
} else if (emptyLines === 0) {
if (didReadContent) {
state2.result += " ";
}
} else {
state2.result += common.repeat("\n", emptyLines);
}
} else {
state2.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
}
didReadContent = true;
detectedIndent = true;
emptyLines = 0;
captureStart = state2.position;
while (!is_EOL(ch) && ch !== 0) {
ch = state2.input.charCodeAt(++state2.position);
}
captureSegment(state2, captureStart, state2.position, false);
}
return true;
}
function readBlockSequence(state2, nodeIndent) {
var _line, _tag = state2.tag, _anchor = state2.anchor, _result = [], following, detected = false, ch;
if (state2.firstTabInLine !== -1)
return false;
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = _result;
}
ch = state2.input.charCodeAt(state2.position);
while (ch !== 0) {
if (state2.firstTabInLine !== -1) {
state2.position = state2.firstTabInLine;
throwError(state2, "tab characters must not be used in indentation");
}
if (ch !== 45) {
break;
}
following = state2.input.charCodeAt(state2.position + 1);
if (!is_WS_OR_EOL(following)) {
break;
}
detected = true;
state2.position++;
if (skipSeparationSpace(state2, true, -1)) {
if (state2.lineIndent <= nodeIndent) {
_result.push(null);
ch = state2.input.charCodeAt(state2.position);
continue;
}
}
_line = state2.line;
composeNode(state2, nodeIndent, CONTEXT_BLOCK_IN, false, true);
_result.push(state2.result);
skipSeparationSpace(state2, true, -1);
ch = state2.input.charCodeAt(state2.position);
if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
throwError(state2, "bad indentation of a sequence entry");
} else if (state2.lineIndent < nodeIndent) {
break;
}
}
if (detected) {
state2.tag = _tag;
state2.anchor = _anchor;
state2.kind = "sequence";
state2.result = _result;
return true;
}
return false;
}
function readBlockMapping(state2, nodeIndent, flowIndent) {
var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state2.tag, _anchor = state2.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
if (state2.firstTabInLine !== -1)
return false;
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = _result;
}
ch = state2.input.charCodeAt(state2.position);
while (ch !== 0) {
if (!atExplicitKey && state2.firstTabInLine !== -1) {
state2.position = state2.firstTabInLine;
throwError(state2, "tab characters must not be used in indentation");
}
following = state2.input.charCodeAt(state2.position + 1);
_line = state2.line;
if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
if (ch === 63) {
if (atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = true;
allowCompact = true;
} else if (atExplicitKey) {
atExplicitKey = false;
allowCompact = true;
} else {
throwError(state2, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
}
state2.position += 1;
ch = following;
} else {
_keyLine = state2.line;
_keyLineStart = state2.lineStart;
_keyPos = state2.position;
if (!composeNode(state2, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
break;
}
if (state2.line === _line) {
ch = state2.input.charCodeAt(state2.position);
while (is_WHITE_SPACE(ch)) {
ch = state2.input.charCodeAt(++state2.position);
}
if (ch === 58) {
ch = state2.input.charCodeAt(++state2.position);
if (!is_WS_OR_EOL(ch)) {
throwError(state2, "a whitespace character is expected after the key-value separator within a block mapping");
}
if (atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
detected = true;
atExplicitKey = false;
allowCompact = false;
keyTag = state2.tag;
keyNode = state2.result;
} else if (detected) {
throwError(state2, "can not read an implicit mapping pair; a colon is missed");
} else {
state2.tag = _tag;
state2.anchor = _anchor;
return true;
}
} else if (detected) {
throwError(state2, "can not read a block mapping entry; a multiline key may not be an implicit key");
} else {
state2.tag = _tag;
state2.anchor = _anchor;
return true;
}
}
if (state2.line === _line || state2.lineIndent > nodeIndent) {
if (atExplicitKey) {
_keyLine = state2.line;
_keyLineStart = state2.lineStart;
_keyPos = state2.position;
}
if (composeNode(state2, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
if (atExplicitKey) {
keyNode = state2.result;
} else {
valueNode = state2.result;
}
}
if (!atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
keyTag = keyNode = valueNode = null;
}
skipSeparationSpace(state2, true, -1);
ch = state2.input.charCodeAt(state2.position);
}
if ((state2.line === _line || state2.lineIndent > nodeIndent) && ch !== 0) {
throwError(state2, "bad indentation of a mapping entry");
} else if (state2.lineIndent < nodeIndent) {
break;
}
}
if (atExplicitKey) {
storeMappingPair(state2, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
}
if (detected) {
state2.tag = _tag;
state2.anchor = _anchor;
state2.kind = "mapping";
state2.result = _result;
}
return detected;
}
function readTagProperty(state2) {
var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
ch = state2.input.charCodeAt(state2.position);
if (ch !== 33)
return false;
if (state2.tag !== null) {
throwError(state2, "duplication of a tag property");
}
ch = state2.input.charCodeAt(++state2.position);
if (ch === 60) {
isVerbatim = true;
ch = state2.input.charCodeAt(++state2.position);
} else if (ch === 33) {
isNamed = true;
tagHandle = "!!";
ch = state2.input.charCodeAt(++state2.position);
} else {
tagHandle = "!";
}
_position = state2.position;
if (isVerbatim) {
do {
ch = state2.input.charCodeAt(++state2.position);
} while (ch !== 0 && ch !== 62);
if (state2.position < state2.length) {
tagName = state2.input.slice(_position, state2.position);
ch = state2.input.charCodeAt(++state2.position);
} else {
throwError(state2, "unexpected end of the stream within a verbatim tag");
}
} else {
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
if (ch === 33) {
if (!isNamed) {
tagHandle = state2.input.slice(_position - 1, state2.position + 1);
if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
throwError(state2, "named tag handle cannot contain such characters");
}
isNamed = true;
_position = state2.position + 1;
} else {
throwError(state2, "tag suffix cannot contain exclamation marks");
}
}
ch = state2.input.charCodeAt(++state2.position);
}
tagName = state2.input.slice(_position, state2.position);
if (PATTERN_FLOW_INDICATORS.test(tagName)) {
throwError(state2, "tag suffix cannot contain flow indicator characters");
}
}
if (tagName && !PATTERN_TAG_URI.test(tagName)) {
throwError(state2, "tag name cannot contain such characters: " + tagName);
}
try {
tagName = decodeURIComponent(tagName);
} catch (err) {
throwError(state2, "tag name is malformed: " + tagName);
}
if (isVerbatim) {
state2.tag = tagName;
} else if (_hasOwnProperty$1.call(state2.tagMap, tagHandle)) {
state2.tag = state2.tagMap[tagHandle] + tagName;
} else if (tagHandle === "!") {
state2.tag = "!" + tagName;
} else if (tagHandle === "!!") {
state2.tag = "tag:yaml.org,2002:" + tagName;
} else {
throwError(state2, 'undeclared tag handle "' + tagHandle + '"');
}
return true;
}
function readAnchorProperty(state2) {
var _position, ch;
ch = state2.input.charCodeAt(state2.position);
if (ch !== 38)
return false;
if (state2.anchor !== null) {
throwError(state2, "duplication of an anchor property");
}
ch = state2.input.charCodeAt(++state2.position);
_position = state2.position;
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
ch = state2.input.charCodeAt(++state2.position);
}
if (state2.position === _position) {
throwError(state2, "name of an anchor node must contain at least one character");
}
state2.anchor = state2.input.slice(_position, state2.position);
return true;
}
function readAlias(state2) {
var _position, alias, ch;
ch = state2.input.charCodeAt(state2.position);
if (ch !== 42)
return false;
ch = state2.input.charCodeAt(++state2.position);
_position = state2.position;
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
ch = state2.input.charCodeAt(++state2.position);
}
if (state2.position === _position) {
throwError(state2, "name of an alias node must contain at least one character");
}
alias = state2.input.slice(_position, state2.position);
if (!_hasOwnProperty$1.call(state2.anchorMap, alias)) {
throwError(state2, 'unidentified alias "' + alias + '"');
}
state2.result = state2.anchorMap[alias];
skipSeparationSpace(state2, true, -1);
return true;
}
function composeNode(state2, parentIndent, nodeContext, allowToSeek, allowCompact) {
var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type2, flowIndent, blockIndent;
if (state2.listener !== null) {
state2.listener("open", state2);
}
state2.tag = null;
state2.anchor = null;
state2.kind = null;
state2.result = null;
allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
if (allowToSeek) {
if (skipSeparationSpace(state2, true, -1)) {
atNewLine = true;
if (state2.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state2.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state2.lineIndent < parentIndent) {
indentStatus = -1;
}
}
}
if (indentStatus === 1) {
while (readTagProperty(state2) || readAnchorProperty(state2)) {
if (skipSeparationSpace(state2, true, -1)) {
atNewLine = true;
allowBlockCollections = allowBlockStyles;
if (state2.lineIndent > parentIndent) {
indentStatus = 1;
} else if (state2.lineIndent === parentIndent) {
indentStatus = 0;
} else if (state2.lineIndent < parentIndent) {
indentStatus = -1;
}
} else {
allowBlockCollections = false;
}
}
}
if (allowBlockCollections) {
allowBlockCollections = atNewLine || allowCompact;
}
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
flowIndent = parentIndent;
} else {
flowIndent = parentIndent + 1;
}
blockIndent = state2.position - state2.lineStart;
if (indentStatus === 1) {
if (allowBlockCollections && (readBlockSequence(state2, blockIndent) || readBlockMapping(state2, blockIndent, flowIndent)) || readFlowCollection(state2, flowIndent)) {
hasContent = true;
} else {
if (allowBlockScalars && readBlockScalar(state2, flowIndent) || readSingleQuotedScalar(state2, flowIndent) || readDoubleQuotedScalar(state2, flowIndent)) {
hasContent = true;
} else if (readAlias(state2)) {
hasContent = true;
if (state2.tag !== null || state2.anchor !== null) {
throwError(state2, "alias node should not have any properties");
}
} else if (readPlainScalar(state2, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
hasContent = true;
if (state2.tag === null) {
state2.tag = "?";
}
}
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
}
} else if (indentStatus === 0) {
hasContent = allowBlockCollections && readBlockSequence(state2, blockIndent);
}
}
if (state2.tag === null) {
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
} else if (state2.tag === "?") {
if (state2.result !== null && state2.kind !== "scalar") {
throwError(state2, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state2.kind + '"');
}
for (typeIndex = 0, typeQuantity = state2.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
type2 = state2.implicitTypes[typeIndex];
if (type2.resolve(state2.result)) {
state2.result = type2.construct(state2.result);
state2.tag = type2.tag;
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
break;
}
}
} else if (state2.tag !== "!") {
if (_hasOwnProperty$1.call(state2.typeMap[state2.kind || "fallback"], state2.tag)) {
type2 = state2.typeMap[state2.kind || "fallback"][state2.tag];
} else {
type2 = null;
typeList = state2.typeMap.multi[state2.kind || "fallback"];
for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
if (state2.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
type2 = typeList[typeIndex];
break;
}
}
}
if (!type2) {
throwError(state2, "unknown tag !<" + state2.tag + ">");
}
if (state2.result !== null && type2.kind !== state2.kind) {
throwError(state2, "unacceptable node kind for !<" + state2.tag + '> tag; it should be "' + type2.kind + '", not "' + state2.kind + '"');
}
if (!type2.resolve(state2.result, state2.tag)) {
throwError(state2, "cannot resolve a node with !<" + state2.tag + "> explicit tag");
} else {
state2.result = type2.construct(state2.result, state2.tag);
if (state2.anchor !== null) {
state2.anchorMap[state2.anchor] = state2.result;
}
}
}
if (state2.listener !== null) {
state2.listener("close", state2);
}
return state2.tag !== null || state2.anchor !== null || hasContent;
}
function readDocument(state2) {
var documentStart = state2.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
state2.version = null;
state2.checkLineBreaks = state2.legacy;
state2.tagMap = /* @__PURE__ */ Object.create(null);
state2.anchorMap = /* @__PURE__ */ Object.create(null);
while ((ch = state2.input.charCodeAt(state2.position)) !== 0) {
skipSeparationSpace(state2, true, -1);
ch = state2.input.charCodeAt(state2.position);
if (state2.lineIndent > 0 || ch !== 37) {
break;
}
hasDirectives = true;
ch = state2.input.charCodeAt(++state2.position);
_position = state2.position;
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
ch = state2.input.charCodeAt(++state2.position);
}
directiveName = state2.input.slice(_position, state2.position);
directiveArgs = [];
if (directiveName.length < 1) {
throwError(state2, "directive name must not be less than one character in length");
}
while (ch !== 0) {
while (is_WHITE_SPACE(ch)) {
ch = state2.input.charCodeAt(++state2.position);
}
if (ch === 35) {
do {
ch = state2.input.charCodeAt(++state2.position);
} while (ch !== 0 && !is_EOL(ch));
break;
}
if (is_EOL(ch))
break;
_position = state2.position;
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
ch = state2.input.charCodeAt(++state2.position);
}
directiveArgs.push(state2.input.slice(_position, state2.position));
}
if (ch !== 0)
readLineBreak(state2);
if (_hasOwnProperty$1.call(directiveHandlers, directiveName)) {
directiveHandlers[directiveName](state2, directiveName, directiveArgs);
} else {
throwWarning(state2, 'unknown document directive "' + directiveName + '"');
}
}
skipSeparationSpace(state2, true, -1);
if (state2.lineIndent === 0 && state2.input.charCodeAt(state2.position) === 45 && state2.input.charCodeAt(state2.position + 1) === 45 && state2.input.charCodeAt(state2.position + 2) === 45) {
state2.position += 3;
skipSeparationSpace(state2, true, -1);
} else if (hasDirectives) {
throwError(state2, "directives end mark is expected");
}
composeNode(state2, state2.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
skipSeparationSpace(state2, true, -1);
if (state2.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state2.input.slice(documentStart, state2.position))) {
throwWarning(state2, "non-ASCII line breaks are interpreted as content");
}
state2.documents.push(state2.result);
if (state2.position === state2.lineStart && testDocumentSeparator(state2)) {
if (state2.input.charCodeAt(state2.position) === 46) {
state2.position += 3;
skipSeparationSpace(state2, true, -1);
}
return;
}
if (state2.position < state2.length - 1) {
throwError(state2, "end of the stream or a document separator is expected");
} else {
return;
}
}
function loadDocuments(input, options) {
input = String(input);
options = options || {};
if (input.length !== 0) {
if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
input += "\n";
}
if (input.charCodeAt(0) === 65279) {
input = input.slice(1);
}
}
var state2 = new State$1(input, options);
var nullpos = input.indexOf("\0");
if (nullpos !== -1) {
state2.position = nullpos;
throwError(state2, "null byte is not allowed in input");
}
state2.input += "\0";
while (state2.input.charCodeAt(state2.position) === 32) {
state2.lineIndent += 1;
state2.position += 1;
}
while (state2.position < state2.length - 1) {
readDocument(state2);
}
return state2.documents;
}
function loadAll$1(input, iterator, options) {
if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
options = iterator;
iterator = null;
}
var documents = loadDocuments(input, options);
if (typeof iterator !== "function") {
return documents;
}
for (var index = 0, length = documents.length; index < length; index += 1) {
iterator(documents[index]);
}
}
function load$1(input, options) {
var documents = loadDocuments(input, options);
if (documents.length === 0) {
return void 0;
} else if (documents.length === 1) {
return documents[0];
}
throw new exception("expected a single document in the stream, but found more");
}
var loadAll_1 = loadAll$1;
var load_1 = load$1;
var loader = {
loadAll: loadAll_1,
load: load_1
};
var JSON_SCHEMA = json;
var load = loader.load;
function extractFrontMatter(text) {
const matches = text.match(frontMatterRegex);
if (!matches) {
return {
text,
metadata: {}
};
}
let parsed = load(matches[1], {
// To support config, we need JSON schema.
// https://www.yaml.org/spec/1.2/spec.html#id2803231
schema: JSON_SCHEMA
}) ?? {};
parsed = typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
const metadata = {};
if (parsed.displayMode) {
metadata.displayMode = parsed.displayMode.toString();
}
if (parsed.title) {
metadata.title = parsed.title.toString();
}
if (parsed.config) {
metadata.config = parsed.config;
}
return {
text: text.slice(matches[0].length),
metadata
};
}
const cleanupText = (code) => {
return code.replace(/\r\n?/g, "\n").replace(
/<(\w+)([^>]*)>/g,
(match, tag, attributes) => "<" + tag + attributes.replace(/="([^"]*)"/g, "='$1'") + ">"
);
};
const processFrontmatter = (code) => {
const { text, metadata } = extractFrontMatter(code);
const { displayMode, title, config: config2 = {} } = metadata;
if (displayMode) {
if (!config2.gantt) {
config2.gantt = {};
}
config2.gantt.displayMode = displayMode;
}
return { title, config: config2, text };
};
const processDirectives = (code) => {
const initDirective = utils.detectInit(code) ?? {};
const wrapDirectives = utils.detectDirective(code, "wrap");
if (Array.isArray(wrapDirectives)) {
initDirective.wrap = wrapDirectives.some(({ type: type2 }) => {
});
} else if ((wrapDirectives == null ? void 0 : wrapDirectives.type) === "wrap") {
initDirective.wrap = true;
}
return {
text: removeDirectives(code),
directive: initDirective
};
};
function preprocessDiagram(code) {
const cleanedCode = cleanupText(code);
const frontMatterResult = processFrontmatter(cleanedCode);
const directiveResult = processDirectives(frontMatterResult.text);
const config2 = cleanAndMerge(frontMatterResult.config, directiveResult.directive);
code = cleanupComments(directiveResult.text);
return {
code,
title: frontMatterResult.title,
config: config2
};
}
const MAX_TEXTLENGTH = 5e4;
const MAX_TEXTLENGTH_EXCEEDED_MSG = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa";
const SECURITY_LVL_SANDBOX = "sandbox";
const SECURITY_LVL_LOOSE = "loose";
const XMLNS_SVG_STD = "http://www.w3.org/2000/svg";
const XMLNS_XLINK_STD = "http://www.w3.org/1999/xlink";
const XMLNS_XHTML_STD = "http://www.w3.org/1999/xhtml";
const IFRAME_WIDTH = "100%";
const IFRAME_HEIGHT = "100%";
const IFRAME_STYLES = "border:0;margin:0;";
const IFRAME_BODY_STYLE = "margin:0";
const IFRAME_SANDBOX_OPTS = "allow-top-navigation-by-user-activation allow-popups";
const IFRAME_NOT_SUPPORTED_MSG = 'The "iframe" tag is not supported by your browser.';
const DOMPURIFY_TAGS = ["foreignobject"];
const DOMPURIFY_ATTR = ["dominant-baseline"];
function processAndSetConfigs(text) {
const processed = preprocessDiagram(text);
reset();
addDirective(processed.config ?? {});
return processed;
}
async function parse$1(text, parseOptions) {
addDiagrams();
text = processAndSetConfigs(text).code;
try {
await getDiagramFromText(text);
} catch (error) {
if (parseOptions == null ? void 0 : parseOptions.suppressErrors) {
return false;
}
throw error;
}
return true;
}
const encodeEntities = function(text) {
let txt = text;
txt = txt.replace(/style.*:\S*#.*;/g, function(s) {
return s.substring(0, s.length - 1);
});
txt = txt.replace(/classDef.*:\S*#.*;/g, function(s) {
return s.substring(0, s.length - 1);
});
txt = txt.replace(/#\w+;/g, function(s) {
const innerTxt = s.substring(1, s.length - 1);
const isInt = /^\+?\d+$/.test(innerTxt);
if (isInt) {
return "fl°°" + innerTxt + "¶ß";
} else {
return "fl°" + innerTxt + "¶ß";
}
});
return txt;
};
const decodeEntities = function(text) {
return text.replace(/fl°°/g, "&#").replace(/fl°/g, "&").replace(/¶ß/g, ";");
};
const cssImportantStyles = (cssClass, element, cssClasses = []) => {
return `
.${cssClass} ${element} { ${cssClasses.join(" !important; ")} !important; }`;
};
const createCssStyles = (config2, classDefs = {}) => {
var _a;
let cssStyles = "";
if (config2.themeCSS !== void 0) {
cssStyles += `
${config2.themeCSS}`;
}
if (config2.fontFamily !== void 0) {
cssStyles += `
:root { --mermaid-font-family: ${config2.fontFamily}}`;
}
if (config2.altFontFamily !== void 0) {
cssStyles += `
:root { --mermaid-alt-font-family: ${config2.altFontFamily}}`;
}
if (!isEmpty(classDefs)) {
const htmlLabels = config2.htmlLabels || ((_a = config2.flowchart) == null ? void 0 : _a.htmlLabels);
const cssHtmlElements = ["> *", "span"];
const cssShapeElements = ["rect", "polygon", "ellipse", "circle", "path"];
const cssElements = htmlLabels ? cssHtmlElements : cssShapeElements;
for (const classId in classDefs) {
const styleClassDef = classDefs[classId];
if (!isEmpty(styleClassDef.styles)) {
cssElements.forEach((cssElement) => {
cssStyles += cssImportantStyles(styleClassDef.id, cssElement, styleClassDef.styles);
});
}
if (!isEmpty(styleClassDef.textStyles)) {
cssStyles += cssImportantStyles(styleClassDef.id, "tspan", styleClassDef.textStyles);
}
}
}
return cssStyles;
};
const createUserStyles = (config2, graphType, classDefs, svgId) => {
const userCSSstyles = createCssStyles(config2, classDefs);
const allStyles = getStyles$1(graphType, userCSSstyles, config2.themeVariables);
return serialize(compile(`${svgId}{${allStyles}}`), stringify);
};
const cleanUpSvgCode = (svgCode = "", inSandboxMode, useArrowMarkerUrls) => {
let cleanedUpSvg = svgCode;
if (!useArrowMarkerUrls && !inSandboxMode) {
cleanedUpSvg = cleanedUpSvg.replace(
/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,
'marker-end="url(#'
);
}
cleanedUpSvg = decodeEntities(cleanedUpSvg);
cleanedUpSvg = cleanedUpSvg.replace(/<br>/g, "<br/>");
return cleanedUpSvg;
};
const putIntoIFrame = (svgCode = "", svgElement) => {
var _a, _b;
const height = ((_b = (_a = svgElement == null ? void 0 : svgElement.viewBox) == null ? void 0 : _a.baseVal) == null ? void 0 : _b.height) ? svgElement.viewBox.baseVal.height + "px" : IFRAME_HEIGHT;
const base64encodedSrc = btoa('<body style="' + IFRAME_BODY_STYLE + '">' + svgCode + "</body>");
return `<iframe style="width:${IFRAME_WIDTH};height:${height};${IFRAME_STYLES}" src="data:text/html;base64,${base64encodedSrc}" sandbox="${IFRAME_SANDBOX_OPTS}">
${IFRAME_NOT_SUPPORTED_MSG}
</iframe>`;
};
const appendDivSvgG = (parentRoot, id2, enclosingDivId, divStyle, svgXlink) => {
const enclosingDiv = parentRoot.append("div");
enclosingDiv.attr("id", enclosingDivId);
if (divStyle) {
enclosingDiv.attr("style", divStyle);
}
const svgNode = enclosingDiv.append("svg").attr("id", id2).attr("width", "100%").attr("xmlns", XMLNS_SVG_STD);
if (svgXlink) {
svgNode.attr("xmlns:xlink", svgXlink);
}
svgNode.append("g");
return parentRoot;
};
function sandboxedIframe(parentNode, iFrameId) {
return parentNode.append("iframe").attr("id", iFrameId).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
}
const removeExistingElements = (doc, id2, divId, iFrameId) => {
var _a, _b, _c;
(_a = doc.getElementById(id2)) == null ? void 0 : _a.remove();
(_b = doc.getElementById(divId)) == null ? void 0 : _b.remove();
(_c = doc.getElementById(iFrameId)) == null ? void 0 : _c.remove();
};
const render$1 = async function(id2, text, svgContainingElement) {
var _a, _b, _c, _d, _e, _f;
addDiagrams();
const processed = processAndSetConfigs(text);
text = processed.code;
const config2 = getConfig$1();
log$1.debug(config2);
if (text.length > ((config2 == null ? void 0 : config2.maxTextSize) ?? MAX_TEXTLENGTH)) {
text = MAX_TEXTLENGTH_EXCEEDED_MSG;
}
const idSelector = "#" + id2;
const iFrameID = "i" + id2;
const iFrameID_selector = "#" + iFrameID;
const enclosingDivID = "d" + id2;
const enclosingDivID_selector = "#" + enclosingDivID;
let root = select("body");
const isSandboxed = config2.securityLevel === SECURITY_LVL_SANDBOX;
const isLooseSecurityLevel = config2.securityLevel === SECURITY_LVL_LOOSE;
const fontFamily = config2.fontFamily;
if (svgContainingElement !== void 0) {
if (svgContainingElement) {
svgContainingElement.innerHTML = "";
}
if (isSandboxed) {
const iframe = sandboxedIframe(select(svgContainingElement), iFrameID);
root = select(iframe.nodes()[0].contentDocument.body);
root.node().style.margin = 0;
} else {
root = select(svgContainingElement);
}
appendDivSvgG(root, id2, enclosingDivID, `font-family: ${fontFamily}`, XMLNS_XLINK_STD);
} else {
removeExistingElements(document, id2, enclosingDivID, iFrameID);
if (isSandboxed) {
const iframe = sandboxedIframe(select("body"), iFrameID);
root = select(iframe.nodes()[0].contentDocument.body);
root.node().style.margin = 0;
} else {
root = select("body");
}
appendDivSvgG(root, id2, enclosingDivID);
}
text = encodeEntities(text);
let diag;
let parseEncounteredException;
try {
diag = await getDiagramFromText(text, { title: processed.title });
} catch (error) {
diag = new Diagram("error");
parseEncounteredException = error;
}
const element = root.select(enclosingDivID_selector).node();
const diagramType = diag.type;
const svg = element.firstChild;
const firstChild = svg.firstChild;
const diagramClassDefs = (_b = (_a = diag.renderer).getClasses) == null ? void 0 : _b.call(_a, text, diag);
const rules = createUserStyles(config2, diagramType, diagramClassDefs, idSelector);
const style1 = document.createElement("style");
style1.innerHTML = rules;
svg.insertBefore(style1, firstChild);
try {
await diag.renderer.draw(text, id2, version, diag);
} catch (e) {
errorRenderer.draw(text, id2, version);
throw e;
}
const svgNode = root.select(`${enclosingDivID_selector} svg`);
const a11yTitle = (_d = (_c = diag.db).getAccTitle) == null ? void 0 : _d.call(_c);
const a11yDescr = (_f = (_e = diag.db).getAccDescription) == null ? void 0 : _f.call(_e);
addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr);
root.select(`[id="${id2}"]`).selectAll("foreignobject > *").attr("xmlns", XMLNS_XHTML_STD);
let svgCode = root.select(enclosingDivID_selector).node().innerHTML;
log$1.debug("config.arrowMarkerAbsolute", config2.arrowMarkerAbsolute);
svgCode = cleanUpSvgCode(svgCode, isSandboxed, evaluate(config2.arrowMarkerAbsolute));
if (isSandboxed) {
const svgEl = root.select(enclosingDivID_selector + " svg").node();
svgCode = putIntoIFrame(svgCode, svgEl);
} else if (!isLooseSecurityLevel) {
svgCode = DOMPurify.sanitize(svgCode, {
ADD_TAGS: DOMPURIFY_TAGS,
ADD_ATTR: DOMPURIFY_ATTR
});
}
attachFunctions();
if (parseEncounteredException) {
throw parseEncounteredException;
}
const tmpElementSelector = isSandboxed ? iFrameID_selector : enclosingDivID_selector;
const node = select(tmpElementSelector).node();
if (node && "remove" in node) {
node.remove();
}
return {
svg: svgCode,
bindFunctions: diag.db.bindFunctions
};
};
function initialize$1(options = {}) {
var _a;
if ((options == null ? void 0 : options.fontFamily) && !((_a = options.themeVariables) == null ? void 0 : _a.fontFamily)) {
if (!options.themeVariables) {
options.themeVariables = {};
}
options.themeVariables.fontFamily = options.fontFamily;
}
saveConfigFromInitialize(options);
if ((options == null ? void 0 : options.theme) && options.theme in theme) {
options.themeVariables = theme[options.theme].getThemeVariables(
options.themeVariables
);
} else if (options) {
options.themeVariables = theme.default.getThemeVariables(options.themeVariables);
}
const config2 = typeof options === "object" ? setSiteConfig(options) : getSiteConfig();
setLogLevel$1(config2.logLevel);
addDiagrams();
}
function addA11yInfo(diagramType, svgNode, a11yTitle, a11yDescr) {
setA11yDiagramInfo(svgNode, diagramType);
addSVGa11yTitleDescription(svgNode, a11yTitle, a11yDescr, svgNode.attr("id"));
}
const mermaidAPI = Object.freeze({
render: render$1,
parse: parse$1,
getDiagramFromText,
initialize: initialize$1,
getConfig: getConfig$1,
setConfig,
getSiteConfig,
updateSiteConfig,
reset: () => {
reset();
},
globalReset: () => {
reset(defaultConfig);
},
defaultConfig
});
setLogLevel$1(getConfig$1().logLevel);
reset(getConfig$1());
const loadRegisteredDiagrams = async () => {
log$1.debug(`Loading registered diagrams`);
const results = await Promise.allSettled(
Object.entries(detectors).map(async ([key, { detector: detector2, loader: loader2 }]) => {
if (loader2) {
try {
getDiagram(key);
} catch (error) {
try {
const { diagram: diagram2, id: id2 } = await loader2();
registerDiagram(id2, diagram2, detector2);
} catch (err) {
log$1.error(`Failed to load external diagram with key ${key}. Removing from detectors.`);
delete detectors[key];
throw err;
}
}
}
})
);
const failed = results.filter((result) => result.status === "rejected");
if (failed.length > 0) {
log$1.error(`Failed to load ${failed.length} external diagrams`);
for (const res of failed) {
log$1.error(res);
}
throw new Error(`Failed to load ${failed.length} external diagrams`);
}
};
const handleError = (error, errors, parseError) => {
log$1.warn(error);
if (isDetailedError(error)) {
if (parseError) {
parseError(error.str, error.hash);
}
errors.push({ ...error, message: error.str, error });
} else {
if (parseError) {
parseError(error);
}
if (error instanceof Error) {
errors.push({
str: error.message,
message: error.message,
hash: error.name,
error
});
}
}
};
const run = async function(options = {
querySelector: ".mermaid"
}) {
try {
await runThrowsErrors(options);
} catch (e) {
if (isDetailedError(e)) {
log$1.error(e.str);
}
if (mermaid.parseError) {
mermaid.parseError(e);
}
if (!options.suppressErrors) {
log$1.error("Use the suppressErrors option to suppress these errors");
throw e;
}
}
};
const runThrowsErrors = async function({ postRenderCallback, querySelector, nodes } = {
querySelector: ".mermaid"
}) {
const conf = mermaidAPI.getConfig();
log$1.debug(`${!postRenderCallback ? "No " : ""}Callback function found`);
let nodesToProcess;
if (nodes) {
nodesToProcess = nodes;
} else if (querySelector) {
nodesToProcess = document.querySelectorAll(querySelector);
} else {
throw new Error("Nodes and querySelector are both undefined");
}
log$1.debug(`Found ${nodesToProcess.length} diagrams`);
if ((conf == null ? void 0 : conf.startOnLoad) !== void 0) {
log$1.debug("Start On Load: " + (conf == null ? void 0 : conf.startOnLoad));
mermaidAPI.updateSiteConfig({ startOnLoad: conf == null ? void 0 : conf.startOnLoad });
}
const idGenerator = new utils.InitIDGenerator(conf.deterministicIds, conf.deterministicIDSeed);
let txt;
const errors = [];
for (const element of Array.from(nodesToProcess)) {
log$1.info("Rendering diagram: " + element.id);
/*! Check if previously processed */
if (element.getAttribute("data-processed")) {
continue;
}
element.setAttribute("data-processed", "true");
const id2 = `mermaid-${idGenerator.next()}`;
txt = element.innerHTML;
txt = dedent(utils.entityDecode(txt)).trim().replace(/<br\s*\/?>/gi, "<br/>");
const init2 = utils.detectInit(txt);
if (init2) {
log$1.debug("Detected early reinit: ", init2);
}
try {
const { svg, bindFunctions } = await render(id2, txt, element);
element.innerHTML = svg;
if (postRenderCallback) {
await postRenderCallback(id2);
}
if (bindFunctions) {
bindFunctions(element);
}
} catch (error) {
handleError(error, errors, mermaid.parseError);
}
}
if (errors.length > 0) {
throw errors[0];
}
};
const initialize = function(config2) {
mermaidAPI.initialize(config2);
};
const init = async function(config2, nodes, callback) {
log$1.warn("mermaid.init is deprecated. Please use run instead.");
if (config2) {
initialize(config2);
}
const runOptions = { postRenderCallback: callback, querySelector: ".mermaid" };
if (typeof nodes === "string") {
runOptions.querySelector = nodes;
} else if (nodes) {
if (nodes instanceof HTMLElement) {
runOptions.nodes = [nodes];
} else {
runOptions.nodes = nodes;
}
}
await run(runOptions);
};
const registerExternalDiagrams = async (diagrams2, {
lazyLoad = true
} = {}) => {
registerLazyLoadedDiagrams(...diagrams2);
if (lazyLoad === false) {
await loadRegisteredDiagrams();
}
};
const contentLoaded = function() {
if (mermaid.startOnLoad) {
const { startOnLoad } = mermaidAPI.getConfig();
if (startOnLoad) {
mermaid.run().catch((err) => log$1.error("Mermaid failed to initialize", err));
}
}
};
if (typeof document !== "undefined") {
/*!
* Wait for document loaded before starting the execution
*/
window.addEventListener("load", contentLoaded, false);
}
const setParseErrorHandler = function(parseErrorHandler) {
mermaid.parseError = parseErrorHandler;
};
const executionQueue = [];
let executionQueueRunning = false;
const executeQueue = async () => {
if (executionQueueRunning) {
return;
}
executionQueueRunning = true;
while (executionQueue.length > 0) {
const f = executionQueue.shift();
if (f) {
try {
await f();
} catch (e) {
log$1.error("Error executing queue", e);
}
}
}
executionQueueRunning = false;
};
const parse = async (text, parseOptions) => {
return new Promise((resolve, reject) => {
const performCall = () => new Promise((res, rej) => {
mermaidAPI.parse(text, parseOptions).then(
(r) => {
res(r);
resolve(r);
},
(e) => {
var _a;
log$1.error("Error parsing", e);
(_a = mermaid.parseError) == null ? void 0 : _a.call(mermaid, e);
rej(e);
reject(e);
}
);
});
executionQueue.push(performCall);
executeQueue().catch(reject);
});
};
const render = (id2, text, container) => {
return new Promise((resolve, reject) => {
const performCall = () => new Promise((res, rej) => {
mermaidAPI.render(id2, text, container).then(
(r) => {
res(r);
resolve(r);
},
(e) => {
var _a;
log$1.error("Error parsing", e);
(_a = mermaid.parseError) == null ? void 0 : _a.call(mermaid, e);
rej(e);
reject(e);
}
);
});
executionQueue.push(performCall);
executeQueue().catch(reject);
});
};
const mermaid = {
startOnLoad: true,
mermaidAPI,
parse,
render,
init,
run,
registerExternalDiagrams,
initialize,
parseError: void 0,
contentLoaded,
setParseErrorHandler,
detectType
};
export {
selectSvgElement as A,
defaultConfig$1 as B,
cleanAndMerge as C,
parseFontSize as D,
getThemeVariables$2 as E,
addFunction as F,
generateId as G,
lineBreakRegex as H,
defaultConfig as I,
decodeEntities as J,
commonDb as K,
mermaid as L,
ZERO_WIDTH_SPACE as Z,
getAccDescription as a,
setAccDescription as b,
getConfig$1 as c,
sanitizeText$2 as d,
common$1 as e,
assignWithDepth$1 as f,
getAccTitle as g,
calculateTextWidth as h,
configureSvgSize as i,
calculateTextHeight as j,
getStylesFromArray as k,
log$1 as l,
evaluate as m,
interpolateToCurve as n,
setupGraphViewbox$1 as o,
setConfig as p,
setDiagramTitle as q,
getDiagramTitle as r,
setAccTitle as s,
clear as t,
utils as u,
parseGenericTypes as v,
wrapLabel as w,
random as x,
getConfig as y,
setupGraphViewbox as z
};