import { w as e } from "./src-BEYP07TO.js";
import { n as t, r as n, t as r } from "./src-hxErHTV1.js";
import { K as i, Q as a, Z as o, a as s, b as c, et as l, o as u } from "./chunk-7R4GIKGN-DiZ1HYFd.js";
import { t as d } from "./arc-DyfKNDOh.js";
//#region node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-YZTLITO2.mjs
var f = (function() {
	var e = /* @__PURE__ */ t(function(e, t, n, r) {
		for (n ||= {}, r = e.length; r--; n[e[r]] = t);
		return n;
	}, "o"), n = [
		6,
		8,
		10,
		11,
		12,
		14,
		16,
		17,
		20,
		21
	], r = [1, 9], i = [1, 10], a = [1, 11], o = [1, 12], s = [1, 13], c = [1, 16], l = [1, 17], u = {
		trace: /* @__PURE__ */ t(function() {}, "trace"),
		yy: {},
		symbols_: {
			error: 2,
			start: 3,
			timeline: 4,
			document: 5,
			EOF: 6,
			line: 7,
			SPACE: 8,
			statement: 9,
			NEWLINE: 10,
			title: 11,
			acc_title: 12,
			acc_title_value: 13,
			acc_descr: 14,
			acc_descr_value: 15,
			acc_descr_multiline_value: 16,
			section: 17,
			period_statement: 18,
			event_statement: 19,
			period: 20,
			event: 21,
			$accept: 0,
			$end: 1
		},
		terminals_: {
			2: "error",
			4: "timeline",
			6: "EOF",
			8: "SPACE",
			10: "NEWLINE",
			11: "title",
			12: "acc_title",
			13: "acc_title_value",
			14: "acc_descr",
			15: "acc_descr_value",
			16: "acc_descr_multiline_value",
			17: "section",
			20: "period",
			21: "event"
		},
		productions_: [
			0,
			[3, 3],
			[5, 0],
			[5, 2],
			[7, 2],
			[7, 1],
			[7, 1],
			[7, 1],
			[9, 1],
			[9, 2],
			[9, 2],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[18, 1],
			[19, 1]
		],
		performAction: /* @__PURE__ */ t(function(e, t, n, r, i, a, o) {
			var s = a.length - 1;
			switch (i) {
				case 1: return a[s - 1];
				case 2:
					this.$ = [];
					break;
				case 3:
					a[s - 1].push(a[s]), this.$ = a[s - 1];
					break;
				case 4:
				case 5:
					this.$ = a[s];
					break;
				case 6:
				case 7:
					this.$ = [];
					break;
				case 8:
					r.getCommonDb().setDiagramTitle(a[s].substr(6)), this.$ = a[s].substr(6);
					break;
				case 9:
					this.$ = a[s].trim(), r.getCommonDb().setAccTitle(this.$);
					break;
				case 10:
				case 11:
					this.$ = a[s].trim(), r.getCommonDb().setAccDescription(this.$);
					break;
				case 12:
					r.addSection(a[s].substr(8)), this.$ = a[s].substr(8);
					break;
				case 15:
					r.addTask(a[s], 0, ""), this.$ = a[s];
					break;
				case 16:
					r.addEvent(a[s].substr(2)), this.$ = a[s];
					break;
			}
		}, "anonymous"),
		table: [
			{
				3: 1,
				4: [1, 2]
			},
			{ 1: [3] },
			e(n, [2, 2], { 5: 3 }),
			{
				6: [1, 4],
				7: 5,
				8: [1, 6],
				9: 7,
				10: [1, 8],
				11: r,
				12: i,
				14: a,
				16: o,
				17: s,
				18: 14,
				19: 15,
				20: c,
				21: l
			},
			e(n, [2, 7], { 1: [2, 1] }),
			e(n, [2, 3]),
			{
				9: 18,
				11: r,
				12: i,
				14: a,
				16: o,
				17: s,
				18: 14,
				19: 15,
				20: c,
				21: l
			},
			e(n, [2, 5]),
			e(n, [2, 6]),
			e(n, [2, 8]),
			{ 13: [1, 19] },
			{ 15: [1, 20] },
			e(n, [2, 11]),
			e(n, [2, 12]),
			e(n, [2, 13]),
			e(n, [2, 14]),
			e(n, [2, 15]),
			e(n, [2, 16]),
			e(n, [2, 4]),
			e(n, [2, 9]),
			e(n, [2, 10])
		],
		defaultActions: {},
		parseError: /* @__PURE__ */ t(function(e, t) {
			if (t.recoverable) this.trace(e);
			else {
				var n = Error(e);
				throw n.hash = t, n;
			}
		}, "parseError"),
		parse: /* @__PURE__ */ t(function(e) {
			var n = this, r = [0], i = [], a = [null], o = [], s = this.table, c = "", l = 0, u = 0, d = 0, f = 2, p = 1, m = o.slice.call(arguments, 1), h = Object.create(this.lexer), g = { yy: {} };
			for (var _ in this.yy) Object.prototype.hasOwnProperty.call(this.yy, _) && (g.yy[_] = this.yy[_]);
			h.setInput(e, g.yy), g.yy.lexer = h, g.yy.parser = this, h.yylloc === void 0 && (h.yylloc = {});
			var v = h.yylloc;
			o.push(v);
			var y = h.options && h.options.ranges;
			typeof g.yy.parseError == "function" ? this.parseError = g.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
			function b(e) {
				r.length -= 2 * e, a.length -= e, o.length -= e;
			}
			t(b, "popStack");
			function x() {
				var e = i.pop() || h.lex() || p;
				return typeof e != "number" && (e instanceof Array && (i = e, e = i.pop()), e = n.symbols_[e] || e), e;
			}
			t(x, "lex");
			for (var S, C, w, T, E, D = {}, O, k, A, j;;) {
				if (w = r[r.length - 1], this.defaultActions[w] ? T = this.defaultActions[w] : (S ??= x(), T = s[w] && s[w][S]), T === void 0 || !T.length || !T[0]) {
					var M = "";
					for (O in j = [], s[w]) this.terminals_[O] && O > f && j.push("'" + this.terminals_[O] + "'");
					M = h.showPosition ? "Parse error on line " + (l + 1) + ":\n" + h.showPosition() + "\nExpecting " + j.join(", ") + ", got '" + (this.terminals_[S] || S) + "'" : "Parse error on line " + (l + 1) + ": Unexpected " + (S == p ? "end of input" : "'" + (this.terminals_[S] || S) + "'"), this.parseError(M, {
						text: h.match,
						token: this.terminals_[S] || S,
						line: h.yylineno,
						loc: v,
						expected: j
					});
				}
				if (T[0] instanceof Array && T.length > 1) throw Error("Parse Error: multiple actions possible at state: " + w + ", token: " + S);
				switch (T[0]) {
					case 1:
						r.push(S), a.push(h.yytext), o.push(h.yylloc), r.push(T[1]), S = null, C ? (S = C, C = null) : (u = h.yyleng, c = h.yytext, l = h.yylineno, v = h.yylloc, d > 0 && d--);
						break;
					case 2:
						if (k = this.productions_[T[1]][1], D.$ = a[a.length - k], D._$ = {
							first_line: o[o.length - (k || 1)].first_line,
							last_line: o[o.length - 1].last_line,
							first_column: o[o.length - (k || 1)].first_column,
							last_column: o[o.length - 1].last_column
						}, y && (D._$.range = [o[o.length - (k || 1)].range[0], o[o.length - 1].range[1]]), E = this.performAction.apply(D, [
							c,
							u,
							l,
							g.yy,
							T[1],
							a,
							o
						].concat(m)), E !== void 0) return E;
						k && (r = r.slice(0, -1 * k * 2), a = a.slice(0, -1 * k), o = o.slice(0, -1 * k)), r.push(this.productions_[T[1]][0]), a.push(D.$), o.push(D._$), A = s[r[r.length - 2]][r[r.length - 1]], r.push(A);
						break;
					case 3: return !0;
				}
			}
			return !0;
		}, "parse")
	};
	u.lexer = /* @__PURE__ */ (function() {
		return {
			EOF: 1,
			parseError: /* @__PURE__ */ t(function(e, t) {
				if (this.yy.parser) this.yy.parser.parseError(e, t);
				else throw Error(e);
			}, "parseError"),
			setInput: /* @__PURE__ */ t(function(e, t) {
				return this.yy = t || this.yy || {}, this._input = e, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = {
					first_line: 1,
					first_column: 0,
					last_line: 1,
					last_column: 0
				}, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this;
			}, "setInput"),
			input: /* @__PURE__ */ t(function() {
				var e = this._input[0];
				return this.yytext += e, this.yyleng++, this.offset++, this.match += e, this.matched += e, e.match(/(?:\r\n?|\n).*/g) ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), e;
			}, "input"),
			unput: /* @__PURE__ */ t(function(e) {
				var t = e.length, n = e.split(/(?:\r\n?|\n)/g);
				this._input = e + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - t), this.offset -= t;
				var r = this.match.split(/(?:\r\n?|\n)/g);
				this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), n.length - 1 && (this.yylineno -= n.length - 1);
				var i = this.yylloc.range;
				return this.yylloc = {
					first_line: this.yylloc.first_line,
					last_line: this.yylineno + 1,
					first_column: this.yylloc.first_column,
					last_column: n ? (n.length === r.length ? this.yylloc.first_column : 0) + r[r.length - n.length].length - n[0].length : this.yylloc.first_column - t
				}, this.options.ranges && (this.yylloc.range = [i[0], i[0] + this.yyleng - t]), this.yyleng = this.yytext.length, this;
			}, "unput"),
			more: /* @__PURE__ */ t(function() {
				return this._more = !0, this;
			}, "more"),
			reject: /* @__PURE__ */ t(function() {
				if (this.options.backtrack_lexer) this._backtrack = !0;
				else return this.parseError("Lexical error on line " + (this.yylineno + 1) + ". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n" + this.showPosition(), {
					text: "",
					token: null,
					line: this.yylineno
				});
				return this;
			}, "reject"),
			less: /* @__PURE__ */ t(function(e) {
				this.unput(this.match.slice(e));
			}, "less"),
			pastInput: /* @__PURE__ */ t(function() {
				var e = this.matched.substr(0, this.matched.length - this.match.length);
				return (e.length > 20 ? "..." : "") + e.substr(-20).replace(/\n/g, "");
			}, "pastInput"),
			upcomingInput: /* @__PURE__ */ t(function() {
				var e = this.match;
				return e.length < 20 && (e += this._input.substr(0, 20 - e.length)), (e.substr(0, 20) + (e.length > 20 ? "..." : "")).replace(/\n/g, "");
			}, "upcomingInput"),
			showPosition: /* @__PURE__ */ t(function() {
				var e = this.pastInput(), t = Array(e.length + 1).join("-");
				return e + this.upcomingInput() + "\n" + t + "^";
			}, "showPosition"),
			test_match: /* @__PURE__ */ t(function(e, t) {
				var n, r, i;
				if (this.options.backtrack_lexer && (i = {
					yylineno: this.yylineno,
					yylloc: {
						first_line: this.yylloc.first_line,
						last_line: this.last_line,
						first_column: this.yylloc.first_column,
						last_column: this.yylloc.last_column
					},
					yytext: this.yytext,
					match: this.match,
					matches: this.matches,
					matched: this.matched,
					yyleng: this.yyleng,
					offset: this.offset,
					_more: this._more,
					_input: this._input,
					yy: this.yy,
					conditionStack: this.conditionStack.slice(0),
					done: this.done
				}, this.options.ranges && (i.yylloc.range = this.yylloc.range.slice(0))), r = e[0].match(/(?:\r\n?|\n).*/g), r && (this.yylineno += r.length), this.yylloc = {
					first_line: this.yylloc.last_line,
					last_line: this.yylineno + 1,
					first_column: this.yylloc.last_column,
					last_column: r ? r[r.length - 1].length - r[r.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + e[0].length
				}, this.yytext += e[0], this.match += e[0], this.matches = e, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(e[0].length), this.matched += e[0], n = this.performAction.call(this, this.yy, this, t, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), n) return n;
				if (this._backtrack) {
					for (var a in i) this[a] = i[a];
					return !1;
				}
				return !1;
			}, "test_match"),
			next: /* @__PURE__ */ t(function() {
				if (this.done) return this.EOF;
				this._input || (this.done = !0);
				var e, t, n, r;
				this._more || (this.yytext = "", this.match = "");
				for (var i = this._currentRules(), a = 0; a < i.length; a++) if (n = this._input.match(this.rules[i[a]]), n && (!t || n[0].length > t[0].length)) {
					if (t = n, r = a, this.options.backtrack_lexer) {
						if (e = this.test_match(n, i[a]), e !== !1) return e;
						if (this._backtrack) {
							t = !1;
							continue;
						} else return !1;
					} else if (!this.options.flex) break;
				}
				return t ? (e = this.test_match(t, i[r]), e === !1 ? !1 : e) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
					text: "",
					token: null,
					line: this.yylineno
				});
			}, "next"),
			lex: /* @__PURE__ */ t(function() {
				return this.next() || this.lex();
			}, "lex"),
			begin: /* @__PURE__ */ t(function(e) {
				this.conditionStack.push(e);
			}, "begin"),
			popState: /* @__PURE__ */ t(function() {
				return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
			}, "popState"),
			_currentRules: /* @__PURE__ */ t(function() {
				return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
			}, "_currentRules"),
			topState: /* @__PURE__ */ t(function(e) {
				return e = this.conditionStack.length - 1 - Math.abs(e || 0), e >= 0 ? this.conditionStack[e] : "INITIAL";
			}, "topState"),
			pushState: /* @__PURE__ */ t(function(e) {
				this.begin(e);
			}, "pushState"),
			stateStackSize: /* @__PURE__ */ t(function() {
				return this.conditionStack.length;
			}, "stateStackSize"),
			options: { "case-insensitive": !0 },
			performAction: /* @__PURE__ */ t(function(e, t, n, r) {
				switch (n) {
					case 0: break;
					case 1: break;
					case 2: return 10;
					case 3: break;
					case 4: break;
					case 5: return 4;
					case 6: return 11;
					case 7: return this.begin("acc_title"), 12;
					case 8: return this.popState(), "acc_title_value";
					case 9: return this.begin("acc_descr"), 14;
					case 10: return this.popState(), "acc_descr_value";
					case 11:
						this.begin("acc_descr_multiline");
						break;
					case 12:
						this.popState();
						break;
					case 13: return "acc_descr_multiline_value";
					case 14: return 17;
					case 15: return 21;
					case 16: return 20;
					case 17: return 6;
					case 18: return "INVALID";
				}
			}, "anonymous"),
			rules: [
				/^(?:%(?!\{)[^\n]*)/i,
				/^(?:[^\}]%%[^\n]*)/i,
				/^(?:[\n]+)/i,
				/^(?:\s+)/i,
				/^(?:#[^\n]*)/i,
				/^(?:timeline\b)/i,
				/^(?:title\s[^\n]+)/i,
				/^(?:accTitle\s*:\s*)/i,
				/^(?:(?!\n||)*[^\n]*)/i,
				/^(?:accDescr\s*:\s*)/i,
				/^(?:(?!\n||)*[^\n]*)/i,
				/^(?:accDescr\s*\{\s*)/i,
				/^(?:[\}])/i,
				/^(?:[^\}]*)/i,
				/^(?:section\s[^:\n]+)/i,
				/^(?::\s(?:[^:\n]|:(?!\s))+)/i,
				/^(?:[^#:\n]+)/i,
				/^(?:$)/i,
				/^(?:.)/i
			],
			conditions: {
				acc_descr_multiline: {
					rules: [12, 13],
					inclusive: !1
				},
				acc_descr: {
					rules: [10],
					inclusive: !1
				},
				acc_title: {
					rules: [8],
					inclusive: !1
				},
				INITIAL: {
					rules: [
						0,
						1,
						2,
						3,
						4,
						5,
						6,
						7,
						9,
						11,
						14,
						15,
						16,
						17,
						18
					],
					inclusive: !0
				}
			}
		};
	})();
	function d() {
		this.yy = {};
	}
	return t(d, "Parser"), d.prototype = u, u.Parser = d, new d();
})();
f.parser = f;
var p = f, m = {};
r(m, {
	addEvent: () => E,
	addSection: () => S,
	addTask: () => T,
	addTaskOrg: () => D,
	clear: () => x,
	default: () => k,
	getCommonDb: () => b,
	getSections: () => C,
	getTasks: () => w
});
var h = "", g = 0, _ = [], v = [], y = [], b = /* @__PURE__ */ t(() => u, "getCommonDb"), x = /* @__PURE__ */ t(function() {
	_.length = 0, v.length = 0, h = "", y.length = 0, s();
}, "clear"), S = /* @__PURE__ */ t(function(e) {
	h = e, _.push(e);
}, "addSection"), C = /* @__PURE__ */ t(function() {
	return _;
}, "getSections"), w = /* @__PURE__ */ t(function() {
	let e = O(), t = 0;
	for (; !e && t < 100;) e = O(), t++;
	return v.push(...y), v;
}, "getTasks"), T = /* @__PURE__ */ t(function(e, t, n) {
	let r = {
		id: g++,
		section: h,
		type: h,
		task: e,
		score: t || 0,
		events: n ? [n] : []
	};
	y.push(r);
}, "addTask"), E = /* @__PURE__ */ t(function(e) {
	y.find((e) => e.id === g - 1).events.push(e);
}, "addEvent"), D = /* @__PURE__ */ t(function(e) {
	let t = {
		section: h,
		type: h,
		description: e,
		task: e,
		classes: []
	};
	v.push(t);
}, "addTaskOrg"), O = /* @__PURE__ */ t(function() {
	let e = /* @__PURE__ */ t(function(e) {
		return y[e].processed;
	}, "compileTask"), n = !0;
	for (let [t, r] of y.entries()) e(t), n &&= r.processed;
	return n;
}, "compileTasks"), k = {
	clear: x,
	getCommonDb: b,
	addSection: S,
	getSections: C,
	getTasks: w,
	addTask: T,
	addTaskOrg: D,
	addEvent: E
}, A = 12, j = /* @__PURE__ */ t(function(e, t) {
	let n = e.append("rect");
	return n.attr("x", t.x), n.attr("y", t.y), n.attr("fill", t.fill), n.attr("stroke", t.stroke), n.attr("width", t.width), n.attr("height", t.height), n.attr("rx", t.rx), n.attr("ry", t.ry), t.class !== void 0 && n.attr("class", t.class), n;
}, "drawRect"), M = /* @__PURE__ */ t(function(e, n) {
	let r = e.append("circle").attr("cx", n.cx).attr("cy", n.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), i = e.append("g");
	i.append("circle").attr("cx", n.cx - 15 / 3).attr("cy", n.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), i.append("circle").attr("cx", n.cx + 15 / 3).attr("cy", n.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
	function a(e) {
		let t = d().startAngle(Math.PI / 2).endAngle(Math.PI / 2 * 3).innerRadius(15 / 2).outerRadius(15 / 2.2);
		e.append("path").attr("class", "mouth").attr("d", t).attr("transform", "translate(" + n.cx + "," + (n.cy + 2) + ")");
	}
	t(a, "smile");
	function o(e) {
		let t = d().startAngle(3 * Math.PI / 2).endAngle(Math.PI / 2 * 5).innerRadius(15 / 2).outerRadius(15 / 2.2);
		e.append("path").attr("class", "mouth").attr("d", t).attr("transform", "translate(" + n.cx + "," + (n.cy + 7) + ")");
	}
	t(o, "sad");
	function s(e) {
		e.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", n.cx - 5).attr("y1", n.cy + 7).attr("x2", n.cx + 5).attr("y2", n.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
	}
	return t(s, "ambivalent"), n.score > 3 ? a(i) : n.score < 3 ? o(i) : s(i), r;
}, "drawFace"), N = /* @__PURE__ */ t(function(e, t) {
	let n = e.append("circle");
	return n.attr("cx", t.cx), n.attr("cy", t.cy), n.attr("class", "actor-" + t.pos), n.attr("fill", t.fill), n.attr("stroke", t.stroke), n.attr("r", t.r), n.class !== void 0 && n.attr("class", n.class), t.title !== void 0 && n.append("title").text(t.title), n;
}, "drawCircle"), P = /* @__PURE__ */ t(function(e, t) {
	let n = t.text.replace(/<br\s*\/?>/gi, " "), r = e.append("text");
	r.attr("x", t.x), r.attr("y", t.y), r.attr("class", "legend"), r.style("text-anchor", t.anchor), t.class !== void 0 && r.attr("class", t.class);
	let i = r.append("tspan");
	return i.attr("x", t.x + t.textMargin * 2), i.text(n), r;
}, "drawText"), F = /* @__PURE__ */ t(function(e, n) {
	function r(e, t, n, r, i) {
		return e + "," + t + " " + (e + n) + "," + t + " " + (e + n) + "," + (t + r - i) + " " + (e + n - i * 1.2) + "," + (t + r) + " " + e + "," + (t + r);
	}
	t(r, "genPoints");
	let i = e.append("polygon");
	i.attr("points", r(n.x, n.y, 50, 20, 7)), i.attr("class", "labelBox"), n.y += n.labelMargin, n.x += .5 * n.labelMargin, P(e, n);
}, "drawLabel"), I = /* @__PURE__ */ t(function(e, t, n) {
	let r = e.append("g"), i = V();
	i.x = t.x, i.y = t.y, i.fill = t.fill, i.width = n.width, i.height = n.height, i.class = "journey-section section-type-" + t.num, i.rx = 3, i.ry = 3, j(r, i), H(n)(t.text, r, i.x, i.y, i.width, i.height, { class: "journey-section section-type-" + t.num }, n, t.colour);
}, "drawSection"), L = -1, R = /* @__PURE__ */ t(function(e, t, n) {
	let r = t.x + n.width / 2, i = e.append("g");
	L++, i.append("line").attr("id", "task" + L).attr("x1", r).attr("y1", t.y).attr("x2", r).attr("y2", 450).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), M(i, {
		cx: r,
		cy: 300 + (5 - t.score) * 30,
		score: t.score
	});
	let a = V();
	a.x = t.x, a.y = t.y, a.fill = t.fill, a.width = n.width, a.height = n.height, a.class = "task task-type-" + t.num, a.rx = 3, a.ry = 3, j(i, a), H(n)(t.task, i, a.x, a.y, a.width, a.height, { class: "task" }, n, t.colour);
}, "drawTask"), z = /* @__PURE__ */ t(function(e, t) {
	j(e, {
		x: t.startx,
		y: t.starty,
		width: t.stopx - t.startx,
		height: t.stopy - t.starty,
		fill: t.fill,
		class: "rect"
	}).lower();
}, "drawBackgroundRect"), B = /* @__PURE__ */ t(function() {
	return {
		x: 0,
		y: 0,
		fill: void 0,
		"text-anchor": "start",
		width: 100,
		height: 100,
		textMargin: 0,
		rx: 0,
		ry: 0
	};
}, "getTextObj"), V = /* @__PURE__ */ t(function() {
	return {
		x: 0,
		y: 0,
		width: 100,
		anchor: "start",
		height: 100,
		rx: 0,
		ry: 0
	};
}, "getNoteRect"), H = /* @__PURE__ */ (function() {
	function e(e, t, n, r, a, o, s, c) {
		i(t.append("text").attr("x", n + a / 2).attr("y", r + o / 2 + 5).style("font-color", c).style("text-anchor", "middle").text(e), s);
	}
	t(e, "byText");
	function n(e, t, n, r, a, o, s, c, l) {
		let { taskFontSize: u, taskFontFamily: d } = c, f = e.split(/<br\s*\/?>/gi);
		for (let e = 0; e < f.length; e++) {
			let c = e * u - u * (f.length - 1) / 2, p = t.append("text").attr("x", n + a / 2).attr("y", r).attr("fill", l).style("text-anchor", "middle").style("font-size", u).style("font-family", d);
			p.append("tspan").attr("x", n + a / 2).attr("dy", c).text(f[e]), p.attr("y", r + o / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), i(p, s);
		}
	}
	t(n, "byTspan");
	function r(e, t, r, a, o, s, c, l) {
		let u = t.append("switch"), d = u.append("foreignObject").attr("x", r).attr("y", a).attr("width", o).attr("height", s).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
		d.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(e), n(e, u, r, a, o, s, c, l), i(d, c);
	}
	t(r, "byFo");
	function i(e, t) {
		for (let n in t) n in t && e.attr(n, t[n]);
	}
	return t(i, "_setTextAttrs"), function(t) {
		return t.textPlacement === "fo" ? r : t.textPlacement === "old" ? e : n;
	};
})(), U = /* @__PURE__ */ t(function(e) {
	e.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
}, "initGraphics");
function W(t, n) {
	t.each(function() {
		var t = e(this), r = t.text().split(/(\s+|<br>)/).reverse(), i, a = [], o = 1.1, s = t.attr("y"), c = parseFloat(t.attr("dy")), l = t.text(null).append("tspan").attr("x", 0).attr("y", s).attr("dy", c + "em");
		for (let e = 0; e < r.length; e++) i = r[r.length - 1 - e], a.push(i), l.text(a.join(" ").trim()), (l.node().getComputedTextLength() > n || i === "<br>") && (a.pop(), l.text(a.join(" ").trim()), a = i === "<br>" ? [""] : [i], l = t.append("tspan").attr("x", 0).attr("y", s).attr("dy", o + "em").text(i));
	});
}
t(W, "wrap");
var G = /* @__PURE__ */ t(function(e, t, n, r) {
	let i = n % A - 1, a = e.append("g");
	t.section = i, a.attr("class", (t.class ? t.class + " " : "") + "timeline-node " + ("section-" + i));
	let o = a.append("g"), s = a.append("g"), c = s.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(W, t.width).node().getBBox(), l = r.fontSize?.replace ? r.fontSize.replace("px", "") : r.fontSize;
	return t.height = c.height + l * 1.1 * .5 + t.padding, t.height = Math.max(t.height, t.maxHeight), t.width += 2 * t.padding, s.attr("transform", "translate(" + t.width / 2 + ", " + t.padding / 2 + ")"), q(o, t, i, r), t;
}, "drawNode"), K = /* @__PURE__ */ t(function(e, t, n) {
	let r = e.append("g"), i = r.append("text").text(t.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(W, t.width).node().getBBox(), a = n.fontSize?.replace ? n.fontSize.replace("px", "") : n.fontSize;
	return r.remove(), i.height + a * 1.1 * .5 + t.padding;
}, "getVirtualNodeHeight"), q = /* @__PURE__ */ t(function(e, t, n) {
	e.append("path").attr("id", "node-" + t.id).attr("class", "node-bkg node-" + t.type).attr("d", `M0 ${t.height - 5} v${-t.height + 10} q0,-5 5,-5 h${t.width - 10} q5,0 5,5 v${t.height - 5} H0 Z`), e.append("line").attr("class", "node-line-" + n).attr("x1", 0).attr("y1", t.height).attr("x2", t.width).attr("y2", t.height);
}, "defaultBkg"), J = {
	drawRect: j,
	drawCircle: N,
	drawSection: I,
	drawText: P,
	drawLabel: F,
	drawTask: R,
	drawBackgroundRect: z,
	getTextObj: B,
	getNoteRect: V,
	initGraphics: U,
	drawNode: G,
	getVirtualNodeHeight: K
}, Y = /* @__PURE__ */ t(function(t, r, a, o) {
	let s = c(), l = s.timeline?.leftMargin ?? 50;
	n.debug("timeline", o.db);
	let u = s.securityLevel, d;
	u === "sandbox" && (d = e("#i" + r));
	let f = e(u === "sandbox" ? d.nodes()[0].contentDocument.body : "body").select("#" + r);
	f.append("g");
	let p = o.db.getTasks(), m = o.db.getCommonDb().getDiagramTitle();
	n.debug("task", p), J.initGraphics(f);
	let h = o.db.getSections();
	n.debug("sections", h);
	let g = 0, _ = 0, v = 0, y = 0, b = 50 + l, x = 50;
	y = 50;
	let S = 0, C = !0;
	h.forEach(function(e) {
		let t = {
			number: S,
			descr: e,
			section: S,
			width: 150,
			padding: 20,
			maxHeight: g
		}, r = J.getVirtualNodeHeight(f, t, s);
		n.debug("sectionHeight before draw", r), g = Math.max(g, r + 20);
	});
	let w = 0, T = 0;
	n.debug("tasks.length", p.length);
	for (let [e, t] of p.entries()) {
		let r = {
			number: e,
			descr: t,
			section: t.section,
			width: 150,
			padding: 20,
			maxHeight: _
		}, i = J.getVirtualNodeHeight(f, r, s);
		n.debug("taskHeight before draw", i), _ = Math.max(_, i + 20), w = Math.max(w, t.events.length);
		let a = 0;
		for (let e of t.events) {
			let n = {
				descr: e,
				section: t.section,
				number: t.section,
				width: 150,
				padding: 20,
				maxHeight: 50
			};
			a += J.getVirtualNodeHeight(f, n, s);
		}
		t.events.length > 0 && (a += (t.events.length - 1) * 10), T = Math.max(T, a);
	}
	n.debug("maxSectionHeight before draw", g), n.debug("maxTaskHeight before draw", _), h && h.length > 0 ? h.forEach((e) => {
		let t = p.filter((t) => t.section === e), r = {
			number: S,
			descr: e,
			section: S,
			width: 200 * Math.max(t.length, 1) - 50,
			padding: 20,
			maxHeight: g
		};
		n.debug("sectionNode", r);
		let i = f.append("g"), a = J.drawNode(i, r, S, s);
		n.debug("sectionNode output", a), i.attr("transform", `translate(${b}, ${y})`), x += g + 50, t.length > 0 && X(f, t, S, b, x, _, s, w, T, g, !1), b += 200 * Math.max(t.length, 1), x = y, S++;
	}) : (C = !1, X(f, p, S, b, x, _, s, w, T, g, !0));
	let E = f.node().getBBox();
	n.debug("bounds", E), m && f.append("text").text(m).attr("x", E.width / 2 - l).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), v = C ? g + _ + 150 : _ + 100, f.append("g").attr("class", "lineWrapper").append("line").attr("x1", l).attr("y1", v).attr("x2", E.width + 3 * l).attr("y2", v).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"), i(void 0, f, s.timeline?.padding ?? 50, s.timeline?.useMaxWidth ?? !1);
}, "draw"), X = /* @__PURE__ */ t(function(e, t, r, i, a, o, s, c, l, u, d) {
	for (let c of t) {
		let t = {
			descr: c.task,
			section: r,
			number: r,
			width: 150,
			padding: 20,
			maxHeight: o
		};
		n.debug("taskNode", t);
		let u = e.append("g").attr("class", "taskWrapper"), f = J.drawNode(u, t, r, s).height;
		if (n.debug("taskHeight after draw", f), u.attr("transform", `translate(${i}, ${a})`), o = Math.max(o, f), c.events) {
			let t = e.append("g").attr("class", "lineWrapper"), n = o;
			a += 100, n += Z(e, c.events, r, i, a, s), a -= 100, t.append("line").attr("x1", i + 190 / 2).attr("y1", a + o).attr("x2", i + 190 / 2).attr("y2", a + o + 100 + l + 100).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
		}
		i += 200, d && !s.timeline?.disableMulticolor && r++;
	}
	a -= 10;
}, "drawTasks"), Z = /* @__PURE__ */ t(function(e, t, r, i, a, o) {
	let s = 0, c = a;
	a += 100;
	for (let c of t) {
		let t = {
			descr: c,
			section: r,
			number: r,
			width: 150,
			padding: 20,
			maxHeight: 50
		};
		n.debug("eventNode", t);
		let l = e.append("g").attr("class", "eventWrapper"), u = J.drawNode(l, t, r, o).height;
		s += u, l.attr("transform", `translate(${i}, ${a})`), a = a + 10 + u;
	}
	return a = c, s;
}, "drawEvents"), Q = {
	setConf: /* @__PURE__ */ t(() => {}, "setConf"),
	draw: Y
}, $ = /* @__PURE__ */ t((e) => {
	let t = "";
	for (let t = 0; t < e.THEME_COLOR_LIMIT; t++) e["lineColor" + t] = e["lineColor" + t] || e["cScaleInv" + t], l(e["lineColor" + t]) ? e["lineColor" + t] = a(e["lineColor" + t], 20) : e["lineColor" + t] = o(e["lineColor" + t], 20);
	for (let n = 0; n < e.THEME_COLOR_LIMIT; n++) {
		let r = "" + (17 - 3 * n);
		t += `
    .section-${n - 1} rect, .section-${n - 1} path, .section-${n - 1} circle, .section-${n - 1} path  {
      fill: ${e["cScale" + n]};
    }
    .section-${n - 1} text {
     fill: ${e["cScaleLabel" + n]};
    }
    .node-icon-${n - 1} {
      font-size: 40px;
      color: ${e["cScaleLabel" + n]};
    }
    .section-edge-${n - 1}{
      stroke: ${e["cScale" + n]};
    }
    .edge-depth-${n - 1}{
      stroke-width: ${r};
    }
    .section-${n - 1} line {
      stroke: ${e["cScaleInv" + n]} ;
      stroke-width: 3;
    }

    .lineWrapper line{
      stroke: ${e["cScaleLabel" + n]} ;
    }

    .disabled, .disabled circle, .disabled text {
      fill: lightgray;
    }
    .disabled text {
      fill: #efefef;
    }
    `;
	}
	return t;
}, "genSections"), ee = {
	db: m,
	renderer: Q,
	parser: p,
	styles: /* @__PURE__ */ t((e) => `
  .edge {
    stroke-width: 3;
  }
  ${$(e)}
  .section-root rect, .section-root path, .section-root circle  {
    fill: ${e.git0};
  }
  .section-root text {
    fill: ${e.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .eventWrapper  {
   filter: brightness(120%);
  }
`, "getStyles")
};
//#endregion
export { ee as diagram };

//# sourceMappingURL=timeline-definition-YZTLITO2-B0SegHNN.js.map