import { __toESM } from "../../../../../_virtual/rolldown_runtime.js";
import { require_dayjs_min } from "../../../../dayjs/dayjs.min.js";
import { __name, log } from "./chunk-AGHRB4JF.js";
import { clear, common_default, configureSvgSize, getAccDescription, getAccTitle, getConfig2, getDiagramTitle, setAccDescription, setAccTitle, setDiagramTitle } from "./chunk-ABZYJK2D.js";
import max from "../../../../d3-array/src/max.js";
import min from "../../../../d3-array/src/min.js";
import { axisBottom, axisTop } from "../../../../d3-axis/src/axis.js";
import select_default from "../../../../d3-selection/src/select.js";
import hcl_default from "../../../../d3-interpolate/src/hcl.js";
import linear from "../../../../d3-scale/src/linear.js";
import { millisecond } from "../../../../d3-time/src/millisecond.js";
import { second } from "../../../../d3-time/src/second.js";
import { timeMinute } from "../../../../d3-time/src/minute.js";
import { timeHour } from "../../../../d3-time/src/hour.js";
import { timeDay } from "../../../../d3-time/src/day.js";
import { timeFriday, timeMonday, timeSaturday, timeSunday, timeThursday, timeTuesday, timeWednesday } from "../../../../d3-time/src/week.js";
import { timeMonth } from "../../../../d3-time/src/month.js";
import { timeFormat } from "../../../../d3-time-format/src/defaultLocale.js";
import time from "../../../../d3-scale/src/time.js";
import "../../../../d3/src/index.js";
import { require_dist } from "../../../../@braintree/sanitize-url/dist/index.js";
import { utils_default } from "./chunk-S3R3BYOJ.js";
import { require_isoWeek } from "../../../../dayjs/plugin/isoWeek.js";
import { require_customParseFormat } from "../../../../dayjs/plugin/customParseFormat.js";
import { require_advancedFormat } from "../../../../dayjs/plugin/advancedFormat.js";
import { require_duration } from "../../../../dayjs/plugin/duration.js";
var import_dist = require_dist(), import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min(), 1), import_isoWeek = /* @__PURE__ */ __toESM(require_isoWeek(), 1), import_customParseFormat = /* @__PURE__ */ __toESM(require_customParseFormat(), 1), import_advancedFormat = /* @__PURE__ */ __toESM(require_advancedFormat(), 1), import_dayjs_min$1 = /* @__PURE__ */ __toESM(require_dayjs_min(), 1), import_duration = /* @__PURE__ */ __toESM(require_duration(), 1), parser = (function() {
	var e = /* @__PURE__ */ __name(function(e, f, p, m) {
		for (p ||= {}, m = e.length; m--; p[e[m]] = f);
		return p;
	}, "o"), f = [
		6,
		8,
		10,
		12,
		13,
		14,
		15,
		16,
		17,
		18,
		20,
		21,
		22,
		23,
		24,
		25,
		26,
		27,
		28,
		29,
		30,
		31,
		33,
		35,
		36,
		38,
		40
	], m = [1, 26], h = [1, 27], g = [1, 28], _ = [1, 29], v = [1, 30], y = [1, 31], b = [1, 32], x = [1, 33], S = [1, 34], C = [1, 9], T = [1, 10], E = [1, 11], D = [1, 12], O = [1, 13], k = [1, 14], A = [1, 15], j = [1, 16], M = [1, 19], N = [1, 20], P = [1, 21], F = [1, 22], I = [1, 23], L = [1, 25], R = [1, 35], z = {
		trace: /* @__PURE__ */ __name(function() {}, "trace"),
		yy: {},
		symbols_: {
			error: 2,
			start: 3,
			gantt: 4,
			document: 5,
			EOF: 6,
			line: 7,
			SPACE: 8,
			statement: 9,
			NL: 10,
			weekday: 11,
			weekday_monday: 12,
			weekday_tuesday: 13,
			weekday_wednesday: 14,
			weekday_thursday: 15,
			weekday_friday: 16,
			weekday_saturday: 17,
			weekday_sunday: 18,
			weekend: 19,
			weekend_friday: 20,
			weekend_saturday: 21,
			dateFormat: 22,
			inclusiveEndDates: 23,
			topAxis: 24,
			axisFormat: 25,
			tickInterval: 26,
			excludes: 27,
			includes: 28,
			todayMarker: 29,
			title: 30,
			acc_title: 31,
			acc_title_value: 32,
			acc_descr: 33,
			acc_descr_value: 34,
			acc_descr_multiline_value: 35,
			section: 36,
			clickStatement: 37,
			taskTxt: 38,
			taskData: 39,
			click: 40,
			callbackname: 41,
			callbackargs: 42,
			href: 43,
			clickStatementDebug: 44,
			$accept: 0,
			$end: 1
		},
		terminals_: {
			2: "error",
			4: "gantt",
			6: "EOF",
			8: "SPACE",
			10: "NL",
			12: "weekday_monday",
			13: "weekday_tuesday",
			14: "weekday_wednesday",
			15: "weekday_thursday",
			16: "weekday_friday",
			17: "weekday_saturday",
			18: "weekday_sunday",
			20: "weekend_friday",
			21: "weekend_saturday",
			22: "dateFormat",
			23: "inclusiveEndDates",
			24: "topAxis",
			25: "axisFormat",
			26: "tickInterval",
			27: "excludes",
			28: "includes",
			29: "todayMarker",
			30: "title",
			31: "acc_title",
			32: "acc_title_value",
			33: "acc_descr",
			34: "acc_descr_value",
			35: "acc_descr_multiline_value",
			36: "section",
			38: "taskTxt",
			39: "taskData",
			40: "click",
			41: "callbackname",
			42: "callbackargs",
			43: "href"
		},
		productions_: [
			0,
			[3, 3],
			[5, 0],
			[5, 2],
			[7, 2],
			[7, 1],
			[7, 1],
			[7, 1],
			[11, 1],
			[11, 1],
			[11, 1],
			[11, 1],
			[11, 1],
			[11, 1],
			[11, 1],
			[19, 1],
			[19, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 2],
			[9, 2],
			[9, 1],
			[9, 1],
			[9, 1],
			[9, 2],
			[37, 2],
			[37, 3],
			[37, 3],
			[37, 4],
			[37, 3],
			[37, 4],
			[37, 2],
			[44, 2],
			[44, 3],
			[44, 3],
			[44, 4],
			[44, 3],
			[44, 4],
			[44, 2]
		],
		performAction: /* @__PURE__ */ __name(function(e, f, p, m, h, g, _) {
			var v = g.length - 1;
			switch (h) {
				case 1: return g[v - 1];
				case 2:
					this.$ = [];
					break;
				case 3:
					g[v - 1].push(g[v]), this.$ = g[v - 1];
					break;
				case 4:
				case 5:
					this.$ = g[v];
					break;
				case 6:
				case 7:
					this.$ = [];
					break;
				case 8:
					m.setWeekday("monday");
					break;
				case 9:
					m.setWeekday("tuesday");
					break;
				case 10:
					m.setWeekday("wednesday");
					break;
				case 11:
					m.setWeekday("thursday");
					break;
				case 12:
					m.setWeekday("friday");
					break;
				case 13:
					m.setWeekday("saturday");
					break;
				case 14:
					m.setWeekday("sunday");
					break;
				case 15:
					m.setWeekend("friday");
					break;
				case 16:
					m.setWeekend("saturday");
					break;
				case 17:
					m.setDateFormat(g[v].substr(11)), this.$ = g[v].substr(11);
					break;
				case 18:
					m.enableInclusiveEndDates(), this.$ = g[v].substr(18);
					break;
				case 19:
					m.TopAxis(), this.$ = g[v].substr(8);
					break;
				case 20:
					m.setAxisFormat(g[v].substr(11)), this.$ = g[v].substr(11);
					break;
				case 21:
					m.setTickInterval(g[v].substr(13)), this.$ = g[v].substr(13);
					break;
				case 22:
					m.setExcludes(g[v].substr(9)), this.$ = g[v].substr(9);
					break;
				case 23:
					m.setIncludes(g[v].substr(9)), this.$ = g[v].substr(9);
					break;
				case 24:
					m.setTodayMarker(g[v].substr(12)), this.$ = g[v].substr(12);
					break;
				case 27:
					m.setDiagramTitle(g[v].substr(6)), this.$ = g[v].substr(6);
					break;
				case 28:
					this.$ = g[v].trim(), m.setAccTitle(this.$);
					break;
				case 29:
				case 30:
					this.$ = g[v].trim(), m.setAccDescription(this.$);
					break;
				case 31:
					m.addSection(g[v].substr(8)), this.$ = g[v].substr(8);
					break;
				case 33:
					m.addTask(g[v - 1], g[v]), this.$ = "task";
					break;
				case 34:
					this.$ = g[v - 1], m.setClickEvent(g[v - 1], g[v], null);
					break;
				case 35:
					this.$ = g[v - 2], m.setClickEvent(g[v - 2], g[v - 1], g[v]);
					break;
				case 36:
					this.$ = g[v - 2], m.setClickEvent(g[v - 2], g[v - 1], null), m.setLink(g[v - 2], g[v]);
					break;
				case 37:
					this.$ = g[v - 3], m.setClickEvent(g[v - 3], g[v - 2], g[v - 1]), m.setLink(g[v - 3], g[v]);
					break;
				case 38:
					this.$ = g[v - 2], m.setClickEvent(g[v - 2], g[v], null), m.setLink(g[v - 2], g[v - 1]);
					break;
				case 39:
					this.$ = g[v - 3], m.setClickEvent(g[v - 3], g[v - 1], g[v]), m.setLink(g[v - 3], g[v - 2]);
					break;
				case 40:
					this.$ = g[v - 1], m.setLink(g[v - 1], g[v]);
					break;
				case 41:
				case 47:
					this.$ = g[v - 1] + " " + g[v];
					break;
				case 42:
				case 43:
				case 45:
					this.$ = g[v - 2] + " " + g[v - 1] + " " + g[v];
					break;
				case 44:
				case 46:
					this.$ = g[v - 3] + " " + g[v - 2] + " " + g[v - 1] + " " + g[v];
					break;
			}
		}, "anonymous"),
		table: [
			{
				3: 1,
				4: [1, 2]
			},
			{ 1: [3] },
			e(f, [2, 2], { 5: 3 }),
			{
				6: [1, 4],
				7: 5,
				8: [1, 6],
				9: 7,
				10: [1, 8],
				11: 17,
				12: m,
				13: h,
				14: g,
				15: _,
				16: v,
				17: y,
				18: b,
				19: 18,
				20: x,
				21: S,
				22: C,
				23: T,
				24: E,
				25: D,
				26: O,
				27: k,
				28: A,
				29: j,
				30: M,
				31: N,
				33: P,
				35: F,
				36: I,
				37: 24,
				38: L,
				40: R
			},
			e(f, [2, 7], { 1: [2, 1] }),
			e(f, [2, 3]),
			{
				9: 36,
				11: 17,
				12: m,
				13: h,
				14: g,
				15: _,
				16: v,
				17: y,
				18: b,
				19: 18,
				20: x,
				21: S,
				22: C,
				23: T,
				24: E,
				25: D,
				26: O,
				27: k,
				28: A,
				29: j,
				30: M,
				31: N,
				33: P,
				35: F,
				36: I,
				37: 24,
				38: L,
				40: R
			},
			e(f, [2, 5]),
			e(f, [2, 6]),
			e(f, [2, 17]),
			e(f, [2, 18]),
			e(f, [2, 19]),
			e(f, [2, 20]),
			e(f, [2, 21]),
			e(f, [2, 22]),
			e(f, [2, 23]),
			e(f, [2, 24]),
			e(f, [2, 25]),
			e(f, [2, 26]),
			e(f, [2, 27]),
			{ 32: [1, 37] },
			{ 34: [1, 38] },
			e(f, [2, 30]),
			e(f, [2, 31]),
			e(f, [2, 32]),
			{ 39: [1, 39] },
			e(f, [2, 8]),
			e(f, [2, 9]),
			e(f, [2, 10]),
			e(f, [2, 11]),
			e(f, [2, 12]),
			e(f, [2, 13]),
			e(f, [2, 14]),
			e(f, [2, 15]),
			e(f, [2, 16]),
			{
				41: [1, 40],
				43: [1, 41]
			},
			e(f, [2, 4]),
			e(f, [2, 28]),
			e(f, [2, 29]),
			e(f, [2, 33]),
			e(f, [2, 34], {
				42: [1, 42],
				43: [1, 43]
			}),
			e(f, [2, 40], { 41: [1, 44] }),
			e(f, [2, 35], { 43: [1, 45] }),
			e(f, [2, 36]),
			e(f, [2, 38], { 42: [1, 46] }),
			e(f, [2, 37]),
			e(f, [2, 39])
		],
		defaultActions: {},
		parseError: /* @__PURE__ */ __name(function(e, f) {
			if (f.recoverable) this.trace(e);
			else {
				var p = Error(e);
				throw p.hash = f, p;
			}
		}, "parseError"),
		parse: /* @__PURE__ */ __name(function(e) {
			var f = this, m = [0], h = [], g = [null], _ = [], v = this.table, y = "", b = 0, x = 0, S = 0, C = 2, T = 1, E = _.slice.call(arguments, 1), D = Object.create(this.lexer), O = { yy: {} };
			for (var k in this.yy) Object.prototype.hasOwnProperty.call(this.yy, k) && (O.yy[k] = this.yy[k]);
			D.setInput(e, O.yy), O.yy.lexer = D, O.yy.parser = this, D.yylloc === void 0 && (D.yylloc = {});
			var A = D.yylloc;
			_.push(A);
			var j = D.options && D.options.ranges;
			typeof O.yy.parseError == "function" ? this.parseError = O.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
			function M(e) {
				m.length -= 2 * e, g.length -= e, _.length -= e;
			}
			__name(M, "popStack");
			function N() {
				var e = h.pop() || D.lex() || T;
				return typeof e != "number" && (e instanceof Array && (h = e, e = h.pop()), e = f.symbols_[e] || e), e;
			}
			__name(N, "lex");
			for (var P, F, I, L, R, z = {}, B, V, H, U;;) {
				if (I = m[m.length - 1], this.defaultActions[I] ? L = this.defaultActions[I] : (P ??= N(), L = v[I] && v[I][P]), L === void 0 || !L.length || !L[0]) {
					var W = "";
					for (B in U = [], v[I]) this.terminals_[B] && B > C && U.push("'" + this.terminals_[B] + "'");
					W = D.showPosition ? "Parse error on line " + (b + 1) + ":\n" + D.showPosition() + "\nExpecting " + U.join(", ") + ", got '" + (this.terminals_[P] || P) + "'" : "Parse error on line " + (b + 1) + ": Unexpected " + (P == T ? "end of input" : "'" + (this.terminals_[P] || P) + "'"), this.parseError(W, {
						text: D.match,
						token: this.terminals_[P] || P,
						line: D.yylineno,
						loc: A,
						expected: U
					});
				}
				if (L[0] instanceof Array && L.length > 1) throw Error("Parse Error: multiple actions possible at state: " + I + ", token: " + P);
				switch (L[0]) {
					case 1:
						m.push(P), g.push(D.yytext), _.push(D.yylloc), m.push(L[1]), P = null, F ? (P = F, F = null) : (x = D.yyleng, y = D.yytext, b = D.yylineno, A = D.yylloc, S > 0 && S--);
						break;
					case 2:
						if (V = this.productions_[L[1]][1], z.$ = g[g.length - V], z._$ = {
							first_line: _[_.length - (V || 1)].first_line,
							last_line: _[_.length - 1].last_line,
							first_column: _[_.length - (V || 1)].first_column,
							last_column: _[_.length - 1].last_column
						}, j && (z._$.range = [_[_.length - (V || 1)].range[0], _[_.length - 1].range[1]]), R = this.performAction.apply(z, [
							y,
							x,
							b,
							O.yy,
							L[1],
							g,
							_
						].concat(E)), R !== void 0) return R;
						V && (m = m.slice(0, -1 * V * 2), g = g.slice(0, -1 * V), _ = _.slice(0, -1 * V)), m.push(this.productions_[L[1]][0]), g.push(z.$), _.push(z._$), H = v[m[m.length - 2]][m[m.length - 1]], m.push(H);
						break;
					case 3: return !0;
				}
			}
			return !0;
		}, "parse")
	};
	z.lexer = /* @__PURE__ */ (function() {
		return {
			EOF: 1,
			parseError: /* @__PURE__ */ __name(function(e, f) {
				if (this.yy.parser) this.yy.parser.parseError(e, f);
				else throw Error(e);
			}, "parseError"),
			setInput: /* @__PURE__ */ __name(function(e, f) {
				return this.yy = f || 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__ */ __name(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__ */ __name(function(e) {
				var f = e.length, p = e.split(/(?:\r\n?|\n)/g);
				this._input = e + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - f), this.offset -= f;
				var m = 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), p.length - 1 && (this.yylineno -= p.length - 1);
				var h = 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: p ? (p.length === m.length ? this.yylloc.first_column : 0) + m[m.length - p.length].length - p[0].length : this.yylloc.first_column - f
				}, this.options.ranges && (this.yylloc.range = [h[0], h[0] + this.yyleng - f]), this.yyleng = this.yytext.length, this;
			}, "unput"),
			more: /* @__PURE__ */ __name(function() {
				return this._more = !0, this;
			}, "more"),
			reject: /* @__PURE__ */ __name(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__ */ __name(function(e) {
				this.unput(this.match.slice(e));
			}, "less"),
			pastInput: /* @__PURE__ */ __name(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__ */ __name(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__ */ __name(function() {
				var e = this.pastInput(), f = Array(e.length + 1).join("-");
				return e + this.upcomingInput() + "\n" + f + "^";
			}, "showPosition"),
			test_match: /* @__PURE__ */ __name(function(e, f) {
				var p, m, h;
				if (this.options.backtrack_lexer && (h = {
					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 && (h.yylloc.range = this.yylloc.range.slice(0))), m = e[0].match(/(?:\r\n?|\n).*/g), m && (this.yylineno += m.length), this.yylloc = {
					first_line: this.yylloc.last_line,
					last_line: this.yylineno + 1,
					first_column: this.yylloc.last_column,
					last_column: m ? m[m.length - 1].length - m[m.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], p = this.performAction.call(this, this.yy, this, f, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), p) return p;
				if (this._backtrack) {
					for (var g in h) this[g] = h[g];
					return !1;
				}
				return !1;
			}, "test_match"),
			next: /* @__PURE__ */ __name(function() {
				if (this.done) return this.EOF;
				this._input || (this.done = !0);
				var e, f, p, m;
				this._more || (this.yytext = "", this.match = "");
				for (var h = this._currentRules(), g = 0; g < h.length; g++) if (p = this._input.match(this.rules[h[g]]), p && (!f || p[0].length > f[0].length)) {
					if (f = p, m = g, this.options.backtrack_lexer) {
						if (e = this.test_match(p, h[g]), e !== !1) return e;
						if (this._backtrack) {
							f = !1;
							continue;
						} else return !1;
					} else if (!this.options.flex) break;
				}
				return f ? (e = this.test_match(f, h[m]), 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__ */ __name(function() {
				return this.next() || this.lex();
			}, "lex"),
			begin: /* @__PURE__ */ __name(function(e) {
				this.conditionStack.push(e);
			}, "begin"),
			popState: /* @__PURE__ */ __name(function() {
				return this.conditionStack.length - 1 > 0 ? this.conditionStack.pop() : this.conditionStack[0];
			}, "popState"),
			_currentRules: /* @__PURE__ */ __name(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__ */ __name(function(e) {
				return e = this.conditionStack.length - 1 - Math.abs(e || 0), e >= 0 ? this.conditionStack[e] : "INITIAL";
			}, "topState"),
			pushState: /* @__PURE__ */ __name(function(e) {
				this.begin(e);
			}, "pushState"),
			stateStackSize: /* @__PURE__ */ __name(function() {
				return this.conditionStack.length;
			}, "stateStackSize"),
			options: { "case-insensitive": !0 },
			performAction: /* @__PURE__ */ __name(function(e, f, p, m) {
				switch (p) {
					case 0: return this.begin("open_directive"), "open_directive";
					case 1: return this.begin("acc_title"), 31;
					case 2: return this.popState(), "acc_title_value";
					case 3: return this.begin("acc_descr"), 33;
					case 4: return this.popState(), "acc_descr_value";
					case 5:
						this.begin("acc_descr_multiline");
						break;
					case 6:
						this.popState();
						break;
					case 7: return "acc_descr_multiline_value";
					case 8: break;
					case 9: break;
					case 10: break;
					case 11: return 10;
					case 12: break;
					case 13: break;
					case 14:
						this.begin("href");
						break;
					case 15:
						this.popState();
						break;
					case 16: return 43;
					case 17:
						this.begin("callbackname");
						break;
					case 18:
						this.popState();
						break;
					case 19:
						this.popState(), this.begin("callbackargs");
						break;
					case 20: return 41;
					case 21:
						this.popState();
						break;
					case 22: return 42;
					case 23:
						this.begin("click");
						break;
					case 24:
						this.popState();
						break;
					case 25: return 40;
					case 26: return 4;
					case 27: return 22;
					case 28: return 23;
					case 29: return 24;
					case 30: return 25;
					case 31: return 26;
					case 32: return 28;
					case 33: return 27;
					case 34: return 29;
					case 35: return 12;
					case 36: return 13;
					case 37: return 14;
					case 38: return 15;
					case 39: return 16;
					case 40: return 17;
					case 41: return 18;
					case 42: return 20;
					case 43: return 21;
					case 44: return "date";
					case 45: return 30;
					case 46: return "accDescription";
					case 47: return 36;
					case 48: return 38;
					case 49: return 39;
					case 50: return ":";
					case 51: return 6;
					case 52: return "INVALID";
				}
			}, "anonymous"),
			rules: [
				/^(?:%%\{)/i,
				/^(?:accTitle\s*:\s*)/i,
				/^(?:(?!\n||)*[^\n]*)/i,
				/^(?:accDescr\s*:\s*)/i,
				/^(?:(?!\n||)*[^\n]*)/i,
				/^(?:accDescr\s*\{\s*)/i,
				/^(?:[\}])/i,
				/^(?:[^\}]*)/i,
				/^(?:%%(?!\{)*[^\n]*)/i,
				/^(?:[^\}]%%*[^\n]*)/i,
				/^(?:%%*[^\n]*[\n]*)/i,
				/^(?:[\n]+)/i,
				/^(?:\s+)/i,
				/^(?:%[^\n]*)/i,
				/^(?:href[\s]+["])/i,
				/^(?:["])/i,
				/^(?:[^"]*)/i,
				/^(?:call[\s]+)/i,
				/^(?:\([\s]*\))/i,
				/^(?:\()/i,
				/^(?:[^(]*)/i,
				/^(?:\))/i,
				/^(?:[^)]*)/i,
				/^(?:click[\s]+)/i,
				/^(?:[\s\n])/i,
				/^(?:[^\s\n]*)/i,
				/^(?:gantt\b)/i,
				/^(?:dateFormat\s[^#\n;]+)/i,
				/^(?:inclusiveEndDates\b)/i,
				/^(?:topAxis\b)/i,
				/^(?:axisFormat\s[^#\n;]+)/i,
				/^(?:tickInterval\s[^#\n;]+)/i,
				/^(?:includes\s[^#\n;]+)/i,
				/^(?:excludes\s[^#\n;]+)/i,
				/^(?:todayMarker\s[^\n;]+)/i,
				/^(?:weekday\s+monday\b)/i,
				/^(?:weekday\s+tuesday\b)/i,
				/^(?:weekday\s+wednesday\b)/i,
				/^(?:weekday\s+thursday\b)/i,
				/^(?:weekday\s+friday\b)/i,
				/^(?:weekday\s+saturday\b)/i,
				/^(?:weekday\s+sunday\b)/i,
				/^(?:weekend\s+friday\b)/i,
				/^(?:weekend\s+saturday\b)/i,
				/^(?:\d\d\d\d-\d\d-\d\d\b)/i,
				/^(?:title\s[^\n]+)/i,
				/^(?:accDescription\s[^#\n;]+)/i,
				/^(?:section\s[^\n]+)/i,
				/^(?:[^:\n]+)/i,
				/^(?::[^#\n;]+)/i,
				/^(?::)/i,
				/^(?:$)/i,
				/^(?:.)/i
			],
			conditions: {
				acc_descr_multiline: {
					rules: [6, 7],
					inclusive: !1
				},
				acc_descr: {
					rules: [4],
					inclusive: !1
				},
				acc_title: {
					rules: [2],
					inclusive: !1
				},
				callbackargs: {
					rules: [21, 22],
					inclusive: !1
				},
				callbackname: {
					rules: [
						18,
						19,
						20
					],
					inclusive: !1
				},
				href: {
					rules: [15, 16],
					inclusive: !1
				},
				click: {
					rules: [24, 25],
					inclusive: !1
				},
				INITIAL: {
					rules: [
						0,
						1,
						3,
						5,
						8,
						9,
						10,
						11,
						12,
						13,
						14,
						17,
						23,
						26,
						27,
						28,
						29,
						30,
						31,
						32,
						33,
						34,
						35,
						36,
						37,
						38,
						39,
						40,
						41,
						42,
						43,
						44,
						45,
						46,
						47,
						48,
						49,
						50,
						51,
						52
					],
					inclusive: !0
				}
			}
		};
	})();
	function B() {
		this.yy = {};
	}
	return __name(B, "Parser"), B.prototype = z, z.Parser = B, new B();
})();
parser.parser = parser;
var gantt_default = parser;
import_dayjs_min.default.extend(import_isoWeek.default), import_dayjs_min.default.extend(import_customParseFormat.default), import_dayjs_min.default.extend(import_advancedFormat.default);
var WEEKEND_START_DAY = {
	friday: 5,
	saturday: 6
}, dateFormat = "", axisFormat = "", tickInterval = void 0, todayMarker = "", includes = [], excludes = [], links = /* @__PURE__ */ new Map(), sections = [], tasks = [], currentSection = "", displayMode = "", tags = [
	"active",
	"done",
	"crit",
	"milestone",
	"vert"
], funs = [], inclusiveEndDates = !1, topAxis = !1, weekday = "sunday", weekend = "saturday", lastOrder = 0, clear2 = /* @__PURE__ */ __name(function() {
	sections = [], tasks = [], currentSection = "", funs = [], taskCnt = 0, lastTask = void 0, lastTaskID = void 0, rawTasks = [], dateFormat = "", axisFormat = "", displayMode = "", tickInterval = void 0, todayMarker = "", includes = [], excludes = [], inclusiveEndDates = !1, topAxis = !1, lastOrder = 0, links = /* @__PURE__ */ new Map(), clear(), weekday = "sunday", weekend = "saturday";
}, "clear"), setAxisFormat = /* @__PURE__ */ __name(function(e) {
	axisFormat = e;
}, "setAxisFormat"), getAxisFormat = /* @__PURE__ */ __name(function() {
	return axisFormat;
}, "getAxisFormat"), setTickInterval = /* @__PURE__ */ __name(function(e) {
	tickInterval = e;
}, "setTickInterval"), getTickInterval = /* @__PURE__ */ __name(function() {
	return tickInterval;
}, "getTickInterval"), setTodayMarker = /* @__PURE__ */ __name(function(e) {
	todayMarker = e;
}, "setTodayMarker"), getTodayMarker = /* @__PURE__ */ __name(function() {
	return todayMarker;
}, "getTodayMarker"), setDateFormat = /* @__PURE__ */ __name(function(e) {
	dateFormat = e;
}, "setDateFormat"), enableInclusiveEndDates = /* @__PURE__ */ __name(function() {
	inclusiveEndDates = !0;
}, "enableInclusiveEndDates"), endDatesAreInclusive = /* @__PURE__ */ __name(function() {
	return inclusiveEndDates;
}, "endDatesAreInclusive"), enableTopAxis = /* @__PURE__ */ __name(function() {
	topAxis = !0;
}, "enableTopAxis"), topAxisEnabled = /* @__PURE__ */ __name(function() {
	return topAxis;
}, "topAxisEnabled"), setDisplayMode = /* @__PURE__ */ __name(function(e) {
	displayMode = e;
}, "setDisplayMode"), getDisplayMode = /* @__PURE__ */ __name(function() {
	return displayMode;
}, "getDisplayMode"), getDateFormat = /* @__PURE__ */ __name(function() {
	return dateFormat;
}, "getDateFormat"), setIncludes = /* @__PURE__ */ __name(function(e) {
	includes = e.toLowerCase().split(/[\s,]+/);
}, "setIncludes"), getIncludes = /* @__PURE__ */ __name(function() {
	return includes;
}, "getIncludes"), setExcludes = /* @__PURE__ */ __name(function(e) {
	excludes = e.toLowerCase().split(/[\s,]+/);
}, "setExcludes"), getExcludes = /* @__PURE__ */ __name(function() {
	return excludes;
}, "getExcludes"), getLinks = /* @__PURE__ */ __name(function() {
	return links;
}, "getLinks"), addSection = /* @__PURE__ */ __name(function(e) {
	currentSection = e, sections.push(e);
}, "addSection"), getSections = /* @__PURE__ */ __name(function() {
	return sections;
}, "getSections"), getTasks = /* @__PURE__ */ __name(function() {
	let e = compileTasks(), f = 0;
	for (; !e && f < 10;) e = compileTasks(), f++;
	return tasks = rawTasks, tasks;
}, "getTasks"), isInvalidDate = /* @__PURE__ */ __name(function(e, f, p, m) {
	let h = e.format(f.trim()), g = e.format("YYYY-MM-DD");
	return m.includes(h) || m.includes(g) ? !1 : p.includes("weekends") && (e.isoWeekday() === WEEKEND_START_DAY[weekend] || e.isoWeekday() === WEEKEND_START_DAY[weekend] + 1) || p.includes(e.format("dddd").toLowerCase()) ? !0 : p.includes(h) || p.includes(g);
}, "isInvalidDate"), setWeekday = /* @__PURE__ */ __name(function(e) {
	weekday = e;
}, "setWeekday"), getWeekday = /* @__PURE__ */ __name(function() {
	return weekday;
}, "getWeekday"), setWeekend = /* @__PURE__ */ __name(function(e) {
	weekend = e;
}, "setWeekend"), checkTaskDates = /* @__PURE__ */ __name(function(e, f, p, m) {
	if (!p.length || e.manualEndTime) return;
	let h;
	h = e.startTime instanceof Date ? (0, import_dayjs_min.default)(e.startTime) : (0, import_dayjs_min.default)(e.startTime, f, !0), h = h.add(1, "d");
	let g;
	g = e.endTime instanceof Date ? (0, import_dayjs_min.default)(e.endTime) : (0, import_dayjs_min.default)(e.endTime, f, !0);
	let [_, v] = fixTaskDates(h, g, f, p, m);
	e.endTime = _.toDate(), e.renderEndTime = v;
}, "checkTaskDates"), fixTaskDates = /* @__PURE__ */ __name(function(e, f, p, m, h) {
	let g = !1, _ = null;
	for (; e <= f;) g || (_ = f.toDate()), g = isInvalidDate(e, p, m, h), g && (f = f.add(1, "d")), e = e.add(1, "d");
	return [f, _];
}, "fixTaskDates"), getStartDate = /* @__PURE__ */ __name(function(e, f, h) {
	if (h = h.trim(), (/* @__PURE__ */ __name((e) => {
		let f = e.trim();
		return f === "x" || f === "X";
	}, "isTimestampFormat"))(f) && /^\d+$/.test(h)) return new Date(Number(h));
	let g = /^after\s+(?<ids>[\d\w- ]+)/.exec(h);
	if (g !== null) {
		let e = null;
		for (let f of g.groups.ids.split(" ")) {
			let p = findTaskById(f);
			p !== void 0 && (!e || p.endTime > e.endTime) && (e = p);
		}
		if (e) return e.endTime;
		let f = /* @__PURE__ */ new Date();
		return f.setHours(0, 0, 0, 0), f;
	}
	let _ = (0, import_dayjs_min.default)(h, f.trim(), !0);
	if (_.isValid()) return _.toDate();
	{
		log.debug("Invalid date:" + h), log.debug("With date format:" + f.trim());
		let e = new Date(h);
		if (e === void 0 || isNaN(e.getTime()) || e.getFullYear() < -1e4 || e.getFullYear() > 1e4) throw Error("Invalid date:" + h);
		return e;
	}
}, "getStartDate"), parseDuration = /* @__PURE__ */ __name(function(e) {
	let f = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(e.trim());
	return f === null ? [NaN, "ms"] : [Number.parseFloat(f[1]), f[2]];
}, "parseDuration"), getEndDate = /* @__PURE__ */ __name(function(e, f, p, m = !1) {
	p = p.trim();
	let h = /^until\s+(?<ids>[\d\w- ]+)/.exec(p);
	if (h !== null) {
		let e = null;
		for (let f of h.groups.ids.split(" ")) {
			let p = findTaskById(f);
			p !== void 0 && (!e || p.startTime < e.startTime) && (e = p);
		}
		if (e) return e.startTime;
		let f = /* @__PURE__ */ new Date();
		return f.setHours(0, 0, 0, 0), f;
	}
	let g = (0, import_dayjs_min.default)(p, f.trim(), !0);
	if (g.isValid()) return m && (g = g.add(1, "d")), g.toDate();
	let _ = (0, import_dayjs_min.default)(e), [v, y] = parseDuration(p);
	if (!Number.isNaN(v)) {
		let e = _.add(v, y);
		e.isValid() && (_ = e);
	}
	return _.toDate();
}, "getEndDate"), taskCnt = 0, parseId = /* @__PURE__ */ __name(function(e) {
	return e === void 0 ? (taskCnt += 1, "task" + taskCnt) : e;
}, "parseId"), compileData = /* @__PURE__ */ __name(function(e, f) {
	let p;
	p = f.substr(0, 1) === ":" ? f.substr(1, f.length) : f;
	let m = p.split(","), h = {};
	getTaskTags(m, h, tags);
	for (let e = 0; e < m.length; e++) m[e] = m[e].trim();
	let g = "";
	switch (m.length) {
		case 1:
			h.id = parseId(), h.startTime = e.endTime, g = m[0];
			break;
		case 2:
			h.id = parseId(), h.startTime = getStartDate(void 0, dateFormat, m[0]), g = m[1];
			break;
		case 3:
			h.id = parseId(m[0]), h.startTime = getStartDate(void 0, dateFormat, m[1]), g = m[2];
			break;
		default:
	}
	return g && (h.endTime = getEndDate(h.startTime, dateFormat, g, inclusiveEndDates), h.manualEndTime = (0, import_dayjs_min.default)(g, "YYYY-MM-DD", !0).isValid(), checkTaskDates(h, dateFormat, excludes, includes)), h;
}, "compileData"), parseData = /* @__PURE__ */ __name(function(e, f) {
	let p;
	p = f.substr(0, 1) === ":" ? f.substr(1, f.length) : f;
	let m = p.split(","), h = {};
	getTaskTags(m, h, tags);
	for (let e = 0; e < m.length; e++) m[e] = m[e].trim();
	switch (m.length) {
		case 1:
			h.id = parseId(), h.startTime = {
				type: "prevTaskEnd",
				id: e
			}, h.endTime = { data: m[0] };
			break;
		case 2:
			h.id = parseId(), h.startTime = {
				type: "getStartDate",
				startData: m[0]
			}, h.endTime = { data: m[1] };
			break;
		case 3:
			h.id = parseId(m[0]), h.startTime = {
				type: "getStartDate",
				startData: m[1]
			}, h.endTime = { data: m[2] };
			break;
		default:
	}
	return h;
}, "parseData"), lastTask, lastTaskID, rawTasks = [], taskDb = {}, addTask = /* @__PURE__ */ __name(function(e, f) {
	let p = {
		section: currentSection,
		type: currentSection,
		processed: !1,
		manualEndTime: !1,
		renderEndTime: null,
		raw: { data: f },
		task: e,
		classes: []
	}, m = parseData(lastTaskID, f);
	p.raw.startTime = m.startTime, p.raw.endTime = m.endTime, p.id = m.id, p.prevTaskId = lastTaskID, p.active = m.active, p.done = m.done, p.crit = m.crit, p.milestone = m.milestone, p.vert = m.vert, p.order = lastOrder, lastOrder++;
	let h = rawTasks.push(p);
	lastTaskID = p.id, taskDb[p.id] = h - 1;
}, "addTask"), findTaskById = /* @__PURE__ */ __name(function(e) {
	let f = taskDb[e];
	return rawTasks[f];
}, "findTaskById"), addTaskOrg = /* @__PURE__ */ __name(function(e, f) {
	let p = {
		section: currentSection,
		type: currentSection,
		description: e,
		task: e,
		classes: []
	}, m = compileData(lastTask, f);
	p.startTime = m.startTime, p.endTime = m.endTime, p.id = m.id, p.active = m.active, p.done = m.done, p.crit = m.crit, p.milestone = m.milestone, p.vert = m.vert, lastTask = p, tasks.push(p);
}, "addTaskOrg"), compileTasks = /* @__PURE__ */ __name(function() {
	let e = /* @__PURE__ */ __name(function(e) {
		let f = rawTasks[e], p = "";
		switch (rawTasks[e].raw.startTime.type) {
			case "prevTaskEnd":
				f.startTime = findTaskById(f.prevTaskId).endTime;
				break;
			case "getStartDate":
				p = getStartDate(void 0, dateFormat, rawTasks[e].raw.startTime.startData), p && (rawTasks[e].startTime = p);
				break;
		}
		return rawTasks[e].startTime && (rawTasks[e].endTime = getEndDate(rawTasks[e].startTime, dateFormat, rawTasks[e].raw.endTime.data, inclusiveEndDates), rawTasks[e].endTime && (rawTasks[e].processed = !0, rawTasks[e].manualEndTime = (0, import_dayjs_min.default)(rawTasks[e].raw.endTime.data, "YYYY-MM-DD", !0).isValid(), checkTaskDates(rawTasks[e], dateFormat, excludes, includes))), rawTasks[e].processed;
	}, "compileTask"), f = !0;
	for (let [p, m] of rawTasks.entries()) e(p), f &&= m.processed;
	return f;
}, "compileTasks"), setLink = /* @__PURE__ */ __name(function(e, f) {
	let p = f;
	getConfig2().securityLevel !== "loose" && (p = (0, import_dist.sanitizeUrl)(f)), e.split(",").forEach(function(e) {
		findTaskById(e) !== void 0 && (pushFun(e, () => {
			window.open(p, "_self");
		}), links.set(e, p));
	}), setClass(e, "clickable");
}, "setLink"), setClass = /* @__PURE__ */ __name(function(e, f) {
	e.split(",").forEach(function(e) {
		let p = findTaskById(e);
		p !== void 0 && p.classes.push(f);
	});
}, "setClass"), setClickFun = /* @__PURE__ */ __name(function(e, f, p) {
	if (getConfig2().securityLevel !== "loose" || f === void 0) return;
	let m = [];
	if (typeof p == "string") {
		m = p.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
		for (let e = 0; e < m.length; e++) {
			let f = m[e].trim();
			f.startsWith("\"") && f.endsWith("\"") && (f = f.substr(1, f.length - 2)), m[e] = f;
		}
	}
	m.length === 0 && m.push(e), findTaskById(e) !== void 0 && pushFun(e, () => {
		utils_default.runFunc(f, ...m);
	});
}, "setClickFun"), pushFun = /* @__PURE__ */ __name(function(e, f) {
	funs.push(function() {
		let p = document.querySelector(`[id="${e}"]`);
		p !== null && p.addEventListener("click", function() {
			f();
		});
	}, function() {
		let p = document.querySelector(`[id="${e}-text"]`);
		p !== null && p.addEventListener("click", function() {
			f();
		});
	});
}, "pushFun"), ganttDb_default = {
	getConfig: /* @__PURE__ */ __name(() => getConfig2().gantt, "getConfig"),
	clear: clear2,
	setDateFormat,
	getDateFormat,
	enableInclusiveEndDates,
	endDatesAreInclusive,
	enableTopAxis,
	topAxisEnabled,
	setAxisFormat,
	getAxisFormat,
	setTickInterval,
	getTickInterval,
	setTodayMarker,
	getTodayMarker,
	setAccTitle,
	getAccTitle,
	setDiagramTitle,
	getDiagramTitle,
	setDisplayMode,
	getDisplayMode,
	setAccDescription,
	getAccDescription,
	addSection,
	getSections,
	getTasks,
	addTask,
	findTaskById,
	addTaskOrg,
	setIncludes,
	getIncludes,
	setExcludes,
	getExcludes,
	setClickEvent: /* @__PURE__ */ __name(function(e, f, p) {
		e.split(",").forEach(function(e) {
			setClickFun(e, f, p);
		}), setClass(e, "clickable");
	}, "setClickEvent"),
	setLink,
	getLinks,
	bindFunctions: /* @__PURE__ */ __name(function(e) {
		funs.forEach(function(f) {
			f(e);
		});
	}, "bindFunctions"),
	parseDuration,
	isInvalidDate,
	setWeekday,
	getWeekday,
	setWeekend
};
function getTaskTags(e, f, p) {
	let m = !0;
	for (; m;) m = !1, p.forEach(function(p) {
		let h = "^\\s*" + p + "\\s*$", g = new RegExp(h);
		e[0].match(g) && (f[p] = !0, e.shift(1), m = !0);
	});
}
__name(getTaskTags, "getTaskTags"), import_dayjs_min$1.default.extend(import_duration.default);
var setConf = /* @__PURE__ */ __name(function() {
	log.debug("Something is calling, setConf, remove the call");
}, "setConf"), mapWeekdayToTimeFunction = {
	monday: timeMonday,
	tuesday: timeTuesday,
	wednesday: timeWednesday,
	thursday: timeThursday,
	friday: timeFriday,
	saturday: timeSaturday,
	sunday: timeSunday
}, getMaxIntersections = /* @__PURE__ */ __name((e, f) => {
	let p = [...e].map(() => -Infinity), m = [...e].sort((e, f) => e.startTime - f.startTime || e.order - f.order), h = 0;
	for (let e of m) for (let m = 0; m < p.length; m++) if (e.startTime >= p[m]) {
		p[m] = e.endTime, e.order = m + f, m > h && (h = m);
		break;
	}
	return h;
}, "getMaxIntersections"), w, MAX_TICK_COUNT = 1e4, diagram = {
	parser: gantt_default,
	db: ganttDb_default,
	renderer: {
		setConf,
		draw: /* @__PURE__ */ __name(function(e, f, h, v) {
			let y = getConfig2().gantt, x = getConfig2().securityLevel, S;
			x === "sandbox" && (S = select_default("#i" + f));
			let C = select_default(x === "sandbox" ? S.nodes()[0].contentDocument.body : "body"), T = x === "sandbox" ? S.nodes()[0].contentDocument : document, R = T.getElementById(f);
			w = R.parentElement.offsetWidth, w === void 0 && (w = 1200), y.useWidth !== void 0 && (w = y.useWidth);
			let z = v.db.getTasks(), B = [];
			for (let e of z) B.push(e.type);
			B = $(B);
			let V = {}, H = 2 * y.topPadding;
			if (v.db.getDisplayMode() === "compact" || y.displayMode === "compact") {
				let e = {};
				for (let f of z) e[f.section] === void 0 ? e[f.section] = [f] : e[f.section].push(f);
				let f = 0;
				for (let p of Object.keys(e)) {
					let m = getMaxIntersections(e[p], f) + 1;
					f += m, H += m * (y.barHeight + y.barGap), V[p] = m;
				}
			} else {
				H += z.length * (y.barHeight + y.barGap);
				for (let e of B) V[e] = z.filter((f) => f.type === e).length;
			}
			R.setAttribute("viewBox", "0 0 " + w + " " + H);
			let U = C.select(`[id="${f}"]`), W = time().domain([min(z, function(e) {
				return e.startTime;
			}), max(z, function(e) {
				return e.endTime;
			})]).rangeRound([0, w - y.leftPadding - y.rightPadding]);
			function G(e, f) {
				let p = e.startTime, m = f.startTime, h = 0;
				return p > m ? h = 1 : p < m && (h = -1), h;
			}
			__name(G, "taskCompare"), z.sort(G), K(z, w, H), configureSvgSize(U, H, w, y.useMaxWidth), U.append("text").text(v.db.getDiagramTitle()).attr("x", w / 2).attr("y", y.titleTopMargin).attr("class", "titleText");
			function K(e, f, p) {
				let m = y.barHeight, h = m + y.barGap, g = y.topPadding, _ = y.leftPadding, b = linear().domain([0, B.length]).range(["#00B9FA", "#F95002"]).interpolate(hcl_default);
				J(h, g, _, f, p, e, v.db.getExcludes(), v.db.getIncludes()), X(_, g, f, p), q(e, h, g, _, m, b, f, p), Z(h, g, _, m, b), Q(_, g, f, p);
			}
			__name(K, "makeGantt");
			function q(e, p, m, h, g, _, x) {
				e.sort((e, f) => e.vert === f.vert ? 0 : e.vert ? 1 : -1);
				let S = [...new Set(e.map((e) => e.order))].map((f) => e.find((e) => e.order === f));
				U.append("g").selectAll("rect").data(S).enter().append("rect").attr("x", 0).attr("y", function(e, f) {
					return f = e.order, f * p + m - 2;
				}).attr("width", function() {
					return x - y.rightPadding / 2;
				}).attr("height", p).attr("class", function(e) {
					for (let [f, p] of B.entries()) if (e.type === p) return "section section" + f % y.numberSectionStyles;
					return "section section0";
				}).enter();
				let C = U.append("g").selectAll("rect").data(e).enter(), T = v.db.getLinks();
				if (C.append("rect").attr("id", function(e) {
					return e.id;
				}).attr("rx", 3).attr("ry", 3).attr("x", function(e) {
					return e.milestone ? W(e.startTime) + h + .5 * (W(e.endTime) - W(e.startTime)) - .5 * g : W(e.startTime) + h;
				}).attr("y", function(e, f) {
					return f = e.order, e.vert ? y.gridLineStartPadding : f * p + m;
				}).attr("width", function(e) {
					return e.milestone ? g : e.vert ? .08 * g : W(e.renderEndTime || e.endTime) - W(e.startTime);
				}).attr("height", function(e) {
					return e.vert ? z.length * (y.barHeight + y.barGap) + y.barHeight * 2 : g;
				}).attr("transform-origin", function(e, f) {
					return f = e.order, (W(e.startTime) + h + .5 * (W(e.endTime) - W(e.startTime))).toString() + "px " + (f * p + m + .5 * g).toString() + "px";
				}).attr("class", function(e) {
					let f = "";
					e.classes.length > 0 && (f = e.classes.join(" "));
					let p = 0;
					for (let [f, m] of B.entries()) e.type === m && (p = f % y.numberSectionStyles);
					let m = "";
					return e.active ? e.crit ? m += " activeCrit" : m = " active" : e.done ? m = e.crit ? " doneCrit" : " done" : e.crit && (m += " crit"), m.length === 0 && (m = " task"), e.milestone && (m = " milestone " + m), e.vert && (m = " vert " + m), m += p, m += " " + f, "task" + m;
				}), C.append("text").attr("id", function(e) {
					return e.id + "-text";
				}).text(function(e) {
					return e.task;
				}).attr("font-size", y.fontSize).attr("x", function(e) {
					let f = W(e.startTime), p = W(e.renderEndTime || e.endTime);
					if (e.milestone && (f += .5 * (W(e.endTime) - W(e.startTime)) - .5 * g, p = f + g), e.vert) return W(e.startTime) + h;
					let m = this.getBBox().width;
					return m > p - f ? p + m + 1.5 * y.leftPadding > x ? f + h - 5 : p + h + 5 : (p - f) / 2 + f + h;
				}).attr("y", function(e, f) {
					return e.vert ? y.gridLineStartPadding + z.length * (y.barHeight + y.barGap) + 60 : (f = e.order, f * p + y.barHeight / 2 + (y.fontSize / 2 - 2) + m);
				}).attr("text-height", g).attr("class", function(e) {
					let f = W(e.startTime), p = W(e.endTime);
					e.milestone && (p = f + g);
					let m = this.getBBox().width, h = "";
					e.classes.length > 0 && (h = e.classes.join(" "));
					let _ = 0;
					for (let [f, p] of B.entries()) e.type === p && (_ = f % y.numberSectionStyles);
					let v = "";
					return e.active && (v = e.crit ? "activeCritText" + _ : "activeText" + _), e.done ? v = e.crit ? v + " doneCritText" + _ : v + " doneText" + _ : e.crit && (v = v + " critText" + _), e.milestone && (v += " milestoneText"), e.vert && (v += " vertText"), m > p - f ? p + m + 1.5 * y.leftPadding > x ? h + " taskTextOutsideLeft taskTextOutside" + _ + " " + v : h + " taskTextOutsideRight taskTextOutside" + _ + " " + v + " width-" + m : h + " taskText taskText" + _ + " " + v + " width-" + m;
				}), getConfig2().securityLevel === "sandbox") {
					let e;
					e = select_default("#i" + f);
					let p = e.nodes()[0].contentDocument;
					C.filter(function(e) {
						return T.has(e.id);
					}).each(function(e) {
						var f = p.querySelector("#" + e.id), m = p.querySelector("#" + e.id + "-text");
						let h = f.parentNode;
						var g = p.createElement("a");
						g.setAttribute("xlink:href", T.get(e.id)), g.setAttribute("target", "_top"), h.appendChild(g), g.appendChild(f), g.appendChild(m);
					});
				}
			}
			__name(q, "drawRects");
			function J(e, f, p, h, g, _, b, x) {
				if (b.length === 0 && x.length === 0) return;
				let S, C;
				for (let { startTime: e, endTime: f } of _) (S === void 0 || e < S) && (S = e), (C === void 0 || f > C) && (C = f);
				if (!S || !C) return;
				if ((0, import_dayjs_min$1.default)(C).diff((0, import_dayjs_min$1.default)(S), "year") > 5) {
					log.warn("The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days.");
					return;
				}
				let T = v.db.getDateFormat(), E = [], D = null, O = (0, import_dayjs_min$1.default)(S);
				for (; O.valueOf() <= C;) v.db.isInvalidDate(O, T, b, x) ? D ? D.end = O : D = {
					start: O,
					end: O
				} : D &&= (E.push(D), null), O = O.add(1, "d");
				U.append("g").selectAll("rect").data(E).enter().append("rect").attr("id", (e) => "exclude-" + e.start.format("YYYY-MM-DD")).attr("x", (e) => W(e.start.startOf("day")) + p).attr("y", y.gridLineStartPadding).attr("width", (e) => W(e.end.endOf("day")) - W(e.start.startOf("day"))).attr("height", g - f - y.gridLineStartPadding).attr("transform-origin", function(f, m) {
					return (W(f.start) + p + .5 * (W(f.end) - W(f.start))).toString() + "px " + (m * e + .5 * g).toString() + "px";
				}).attr("class", "exclude-range");
			}
			__name(J, "drawExcludeDays");
			function Y(e, f, p, m) {
				if (p <= 0 || e > f) return Infinity;
				let h = f - e, g = import_dayjs_min$1.default.duration({ [m ?? "day"]: p }).asMilliseconds();
				return g <= 0 ? Infinity : Math.ceil(h / g);
			}
			__name(Y, "getEstimatedTickCount");
			function X(e, f, p, h) {
				let g = v.db.getDateFormat(), _ = v.db.getAxisFormat(), b;
				b = _ || (g === "D" ? "%d" : y.axisFormat ?? "%Y-%m-%d");
				let x = axisBottom(W).tickSize(-h + f + y.gridLineStartPadding).tickFormat(timeFormat(b)), S = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(v.db.getTickInterval() || y.tickInterval);
				if (S !== null) {
					let e = parseInt(S[1], 10);
					if (isNaN(e) || e <= 0) log.warn(`Invalid tick interval value: "${S[1]}". Skipping custom tick interval.`);
					else {
						let f = S[2], p = v.db.getWeekday() || y.weekday, h = W.domain(), g = h[0], _ = h[1], b = Y(g, _, e, f);
						if (b > MAX_TICK_COUNT) log.warn(`The tick interval "${e}${f}" would generate ${b} ticks, which exceeds the maximum allowed (${MAX_TICK_COUNT}). This may indicate an invalid date or time range. Skipping custom tick interval.`);
						else switch (f) {
							case "millisecond":
								x.ticks(millisecond.every(e));
								break;
							case "second":
								x.ticks(second.every(e));
								break;
							case "minute":
								x.ticks(timeMinute.every(e));
								break;
							case "hour":
								x.ticks(timeHour.every(e));
								break;
							case "day":
								x.ticks(timeDay.every(e));
								break;
							case "week":
								x.ticks(mapWeekdayToTimeFunction[p].every(e));
								break;
							case "month":
								x.ticks(timeMonth.every(e));
								break;
						}
					}
				}
				if (U.append("g").attr("class", "grid").attr("transform", "translate(" + e + ", " + (h - 50) + ")").call(x).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em"), v.db.topAxisEnabled() || y.topAxis) {
					let p = axisTop(W).tickSize(-h + f + y.gridLineStartPadding).tickFormat(timeFormat(b));
					if (S !== null) {
						let e = parseInt(S[1], 10);
						if (isNaN(e) || e <= 0) log.warn(`Invalid tick interval value: "${S[1]}". Skipping custom tick interval.`);
						else {
							let f = S[2], m = v.db.getWeekday() || y.weekday, h = W.domain(), g = h[0], _ = h[1];
							if (Y(g, _, e, f) <= MAX_TICK_COUNT) switch (f) {
								case "millisecond":
									p.ticks(millisecond.every(e));
									break;
								case "second":
									p.ticks(second.every(e));
									break;
								case "minute":
									p.ticks(timeMinute.every(e));
									break;
								case "hour":
									p.ticks(timeHour.every(e));
									break;
								case "day":
									p.ticks(timeDay.every(e));
									break;
								case "week":
									p.ticks(mapWeekdayToTimeFunction[m].every(e));
									break;
								case "month":
									p.ticks(timeMonth.every(e));
									break;
							}
						}
					}
					U.append("g").attr("class", "grid").attr("transform", "translate(" + e + ", " + f + ")").call(p).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10);
				}
			}
			__name(X, "makeGrid");
			function Z(e, f) {
				let p = 0, m = Object.keys(V).map((e) => [e, V[e]]);
				U.append("g").selectAll("text").data(m).enter().append(function(e) {
					let f = e[0].split(common_default.lineBreakRegex), p = -(f.length - 1) / 2, m = T.createElementNS("http://www.w3.org/2000/svg", "text");
					m.setAttribute("dy", p + "em");
					for (let [e, p] of f.entries()) {
						let f = T.createElementNS("http://www.w3.org/2000/svg", "tspan");
						f.setAttribute("alignment-baseline", "central"), f.setAttribute("x", "10"), e > 0 && f.setAttribute("dy", "1em"), f.textContent = p, m.appendChild(f);
					}
					return m;
				}).attr("x", 10).attr("y", function(h, g) {
					if (g > 0) for (let _ = 0; _ < g; _++) return p += m[g - 1][1], h[1] * e / 2 + p * e + f;
					else return h[1] * e / 2 + f;
				}).attr("font-size", y.sectionFontSize).attr("class", function(e) {
					for (let [f, p] of B.entries()) if (e[0] === p) return "sectionTitle sectionTitle" + f % y.numberSectionStyles;
					return "sectionTitle";
				});
			}
			__name(Z, "vertLabels");
			function Q(e, f, p, m) {
				let h = v.db.getTodayMarker();
				if (h === "off") return;
				let g = U.append("g").attr("class", "today"), _ = /* @__PURE__ */ new Date(), b = g.append("line");
				b.attr("x1", W(_) + e).attr("x2", W(_) + e).attr("y1", y.titleTopMargin).attr("y2", m - y.titleTopMargin).attr("class", "today"), h !== "" && b.attr("style", h.replace(/,/g, ";"));
			}
			__name(Q, "drawToday");
			function $(e) {
				let f = {}, p = [];
				for (let m = 0, h = e.length; m < h; ++m) Object.prototype.hasOwnProperty.call(f, e[m]) || (f[e[m]] = !0, p.push(e[m]));
				return p;
			}
			__name($, "checkUnique");
		}, "draw")
	},
	styles: /* @__PURE__ */ __name((e) => `
  .mermaid-main-font {
        font-family: ${e.fontFamily};
  }

  .exclude-range {
    fill: ${e.excludeBkgColor};
  }

  .section {
    stroke: none;
    opacity: 0.2;
  }

  .section0 {
    fill: ${e.sectionBkgColor};
  }

  .section2 {
    fill: ${e.sectionBkgColor2};
  }

  .section1,
  .section3 {
    fill: ${e.altSectionBkgColor};
    opacity: 0.2;
  }

  .sectionTitle0 {
    fill: ${e.titleColor};
  }

  .sectionTitle1 {
    fill: ${e.titleColor};
  }

  .sectionTitle2 {
    fill: ${e.titleColor};
  }

  .sectionTitle3 {
    fill: ${e.titleColor};
  }

  .sectionTitle {
    text-anchor: start;
    font-family: ${e.fontFamily};
  }


  /* Grid and axis */

  .grid .tick {
    stroke: ${e.gridColor};
    opacity: 0.8;
    shape-rendering: crispEdges;
  }

  .grid .tick text {
    font-family: ${e.fontFamily};
    fill: ${e.textColor};
  }

  .grid path {
    stroke-width: 0;
  }


  /* Today line */

  .today {
    fill: none;
    stroke: ${e.todayLineColor};
    stroke-width: 2px;
  }


  /* Task styling */

  /* Default task */

  .task {
    stroke-width: 2;
  }

  .taskText {
    text-anchor: middle;
    font-family: ${e.fontFamily};
  }

  .taskTextOutsideRight {
    fill: ${e.taskTextDarkColor};
    text-anchor: start;
    font-family: ${e.fontFamily};
  }

  .taskTextOutsideLeft {
    fill: ${e.taskTextDarkColor};
    text-anchor: end;
  }


  /* Special case clickable */

  .task.clickable {
    cursor: pointer;
  }

  .taskText.clickable {
    cursor: pointer;
    fill: ${e.taskTextClickableColor} !important;
    font-weight: bold;
  }

  .taskTextOutsideLeft.clickable {
    cursor: pointer;
    fill: ${e.taskTextClickableColor} !important;
    font-weight: bold;
  }

  .taskTextOutsideRight.clickable {
    cursor: pointer;
    fill: ${e.taskTextClickableColor} !important;
    font-weight: bold;
  }


  /* Specific task settings for the sections*/

  .taskText0,
  .taskText1,
  .taskText2,
  .taskText3 {
    fill: ${e.taskTextColor};
  }

  .task0,
  .task1,
  .task2,
  .task3 {
    fill: ${e.taskBkgColor};
    stroke: ${e.taskBorderColor};
  }

  .taskTextOutside0,
  .taskTextOutside2
  {
    fill: ${e.taskTextOutsideColor};
  }

  .taskTextOutside1,
  .taskTextOutside3 {
    fill: ${e.taskTextOutsideColor};
  }


  /* Active task */

  .active0,
  .active1,
  .active2,
  .active3 {
    fill: ${e.activeTaskBkgColor};
    stroke: ${e.activeTaskBorderColor};
  }

  .activeText0,
  .activeText1,
  .activeText2,
  .activeText3 {
    fill: ${e.taskTextDarkColor} !important;
  }


  /* Completed task */

  .done0,
  .done1,
  .done2,
  .done3 {
    stroke: ${e.doneTaskBorderColor};
    fill: ${e.doneTaskBkgColor};
    stroke-width: 2;
  }

  .doneText0,
  .doneText1,
  .doneText2,
  .doneText3 {
    fill: ${e.taskTextDarkColor} !important;
  }


  /* Tasks on the critical line */

  .crit0,
  .crit1,
  .crit2,
  .crit3 {
    stroke: ${e.critBorderColor};
    fill: ${e.critBkgColor};
    stroke-width: 2;
  }

  .activeCrit0,
  .activeCrit1,
  .activeCrit2,
  .activeCrit3 {
    stroke: ${e.critBorderColor};
    fill: ${e.activeTaskBkgColor};
    stroke-width: 2;
  }

  .doneCrit0,
  .doneCrit1,
  .doneCrit2,
  .doneCrit3 {
    stroke: ${e.critBorderColor};
    fill: ${e.doneTaskBkgColor};
    stroke-width: 2;
    cursor: pointer;
    shape-rendering: crispEdges;
  }

  .milestone {
    transform: rotate(45deg) scale(0.8,0.8);
  }

  .milestoneText {
    font-style: italic;
  }
  .doneCritText0,
  .doneCritText1,
  .doneCritText2,
  .doneCritText3 {
    fill: ${e.taskTextDarkColor} !important;
  }

  .vert {
    stroke: ${e.vertLineColor};
  }

  .vertText {
    font-size: 15px;
    text-anchor: middle;
    fill: ${e.vertLineColor} !important;
  }

  .activeCritText0,
  .activeCritText1,
  .activeCritText2,
  .activeCritText3 {
    fill: ${e.taskTextDarkColor} !important;
  }

  .titleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${e.titleColor || e.textColor};
    font-family: ${e.fontFamily};
  }
`, "getStyles")
};
export { diagram };
