import { utils_default as se } from "./chunk-S3R3BYOJ.js";
import { getAccDescription as ne, setAccDescription as ae, getDiagramTitle as oe, setDiagramTitle as ce, getAccTitle as le, setAccTitle as ue, getConfig2 as J, configureSvgSize as de, common_default as fe, clear as me } from "./chunk-ABZYJK2D.js";
import { __name as o, log as U } from "./chunk-AGHRB4JF.js";
import { d as he } from "../../../../../../../../_virtual/index4.js";
import A from "../../../../../../../../_virtual/dayjs.min.js";
import ke from "../../../../../../../../_virtual/isoWeek.js";
import ye from "../../../../../../../../_virtual/customParseFormat.js";
import ge from "../../../../../../../../_virtual/advancedFormat.js";
import pe from "../../../../../../../../_virtual/duration.js";
import "../../../../../../d3-transition@3.0.1_d3-selection@3.0.0/node_modules/d3-transition/src/selection/index.js";
import "../../../../../../d3-zoom@3.0.0/node_modules/d3-zoom/src/transform.js";
import ve from "../../../../../../d3-scale@4.0.2/node_modules/d3-scale/src/time.js";
import Te from "../../../../../../d3-array@3.2.4/node_modules/d3-array/src/min.js";
import be from "../../../../../../d3-array@3.2.4/node_modules/d3-array/src/max.js";
import xe from "../../../../../../d3-scale@4.0.2/node_modules/d3-scale/src/linear.js";
import we from "../../../../../../d3-interpolate@3.0.1/node_modules/d3-interpolate/src/hcl.js";
import { axisBottom as _e, axisTop as De } from "../../../../../../d3-axis@3.0.0/node_modules/d3-axis/src/axis.js";
import { timeFormat as Nt } from "../../../../../../d3-time-format@4.1.0/node_modules/d3-time-format/src/defaultLocale.js";
import { timeMonth as Rt } from "../../../../../../d3-time@3.1.0/node_modules/d3-time/src/month.js";
import { timeSunday as Ce, timeSaturday as Ee, timeFriday as Se, timeThursday as Ie, timeWednesday as Ae, timeTuesday as Fe, timeMonday as Le } from "../../../../../../d3-time@3.1.0/node_modules/d3-time/src/week.js";
import { timeDay as Yt } from "../../../../../../d3-time@3.1.0/node_modules/d3-time/src/day.js";
import { timeHour as Bt } from "../../../../../../d3-time@3.1.0/node_modules/d3-time/src/hour.js";
import { timeMinute as zt } from "../../../../../../d3-time@3.1.0/node_modules/d3-time/src/minute.js";
import { second as qt } from "../../../../../../d3-time@3.1.0/node_modules/d3-time/src/second.js";
import { millisecond as jt } from "../../../../../../d3-time@3.1.0/node_modules/d3-time/src/millisecond.js";
import mt from "../../../../../../d3-selection@3.0.0/node_modules/d3-selection/src/select.js";
var xt = (function() {
  var t = /* @__PURE__ */ o(function(h, c, l, d) {
    for (l = l || {}, d = h.length; d--; l[h[d]] = c) ;
    return l;
  }, "o"), r = [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], s = [1, 26], a = [1, 27], n = [1, 28], f = [1, 29], g = [1, 30], E = [1, 31], L = [1, 32], Y = [1, 33], C = [1, 34], M = [1, 9], B = [1, 10], O = [1, 11], P = [1, 12], _ = [1, 13], $ = [1, 14], tt = [1, 15], et = [1, 16], it = [1, 19], H = [1, 20], rt = [1, 21], st = [1, 22], nt = [1, 23], at = [1, 25], k = [1, 35], T = {
    trace: /* @__PURE__ */ o(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__ */ o(function(c, l, d, u, y, i, S) {
      var e = i.length - 1;
      switch (y) {
        case 1:
          return i[e - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          i[e - 1].push(i[e]), this.$ = i[e - 1];
          break;
        case 4:
        case 5:
          this.$ = i[e];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          u.setWeekday("monday");
          break;
        case 9:
          u.setWeekday("tuesday");
          break;
        case 10:
          u.setWeekday("wednesday");
          break;
        case 11:
          u.setWeekday("thursday");
          break;
        case 12:
          u.setWeekday("friday");
          break;
        case 13:
          u.setWeekday("saturday");
          break;
        case 14:
          u.setWeekday("sunday");
          break;
        case 15:
          u.setWeekend("friday");
          break;
        case 16:
          u.setWeekend("saturday");
          break;
        case 17:
          u.setDateFormat(i[e].substr(11)), this.$ = i[e].substr(11);
          break;
        case 18:
          u.enableInclusiveEndDates(), this.$ = i[e].substr(18);
          break;
        case 19:
          u.TopAxis(), this.$ = i[e].substr(8);
          break;
        case 20:
          u.setAxisFormat(i[e].substr(11)), this.$ = i[e].substr(11);
          break;
        case 21:
          u.setTickInterval(i[e].substr(13)), this.$ = i[e].substr(13);
          break;
        case 22:
          u.setExcludes(i[e].substr(9)), this.$ = i[e].substr(9);
          break;
        case 23:
          u.setIncludes(i[e].substr(9)), this.$ = i[e].substr(9);
          break;
        case 24:
          u.setTodayMarker(i[e].substr(12)), this.$ = i[e].substr(12);
          break;
        case 27:
          u.setDiagramTitle(i[e].substr(6)), this.$ = i[e].substr(6);
          break;
        case 28:
          this.$ = i[e].trim(), u.setAccTitle(this.$);
          break;
        case 29:
        case 30:
          this.$ = i[e].trim(), u.setAccDescription(this.$);
          break;
        case 31:
          u.addSection(i[e].substr(8)), this.$ = i[e].substr(8);
          break;
        case 33:
          u.addTask(i[e - 1], i[e]), this.$ = "task";
          break;
        case 34:
          this.$ = i[e - 1], u.setClickEvent(i[e - 1], i[e], null);
          break;
        case 35:
          this.$ = i[e - 2], u.setClickEvent(i[e - 2], i[e - 1], i[e]);
          break;
        case 36:
          this.$ = i[e - 2], u.setClickEvent(i[e - 2], i[e - 1], null), u.setLink(i[e - 2], i[e]);
          break;
        case 37:
          this.$ = i[e - 3], u.setClickEvent(i[e - 3], i[e - 2], i[e - 1]), u.setLink(i[e - 3], i[e]);
          break;
        case 38:
          this.$ = i[e - 2], u.setClickEvent(i[e - 2], i[e], null), u.setLink(i[e - 2], i[e - 1]);
          break;
        case 39:
          this.$ = i[e - 3], u.setClickEvent(i[e - 3], i[e - 1], i[e]), u.setLink(i[e - 3], i[e - 2]);
          break;
        case 40:
          this.$ = i[e - 1], u.setLink(i[e - 1], i[e]);
          break;
        case 41:
        case 47:
          this.$ = i[e - 1] + " " + i[e];
          break;
        case 42:
        case 43:
        case 45:
          this.$ = i[e - 2] + " " + i[e - 1] + " " + i[e];
          break;
        case 44:
        case 46:
          this.$ = i[e - 3] + " " + i[e - 2] + " " + i[e - 1] + " " + i[e];
          break;
      }
    }, "anonymous"),
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(r, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 17, 12: s, 13: a, 14: n, 15: f, 16: g, 17: E, 18: L, 19: 18, 20: Y, 21: C, 22: M, 23: B, 24: O, 25: P, 26: _, 27: $, 28: tt, 29: et, 30: it, 31: H, 33: rt, 35: st, 36: nt, 37: 24, 38: at, 40: k }, t(r, [2, 7], { 1: [2, 1] }), t(r, [2, 3]), { 9: 36, 11: 17, 12: s, 13: a, 14: n, 15: f, 16: g, 17: E, 18: L, 19: 18, 20: Y, 21: C, 22: M, 23: B, 24: O, 25: P, 26: _, 27: $, 28: tt, 29: et, 30: it, 31: H, 33: rt, 35: st, 36: nt, 37: 24, 38: at, 40: k }, t(r, [2, 5]), t(r, [2, 6]), t(r, [2, 17]), t(r, [2, 18]), t(r, [2, 19]), t(r, [2, 20]), t(r, [2, 21]), t(r, [2, 22]), t(r, [2, 23]), t(r, [2, 24]), t(r, [2, 25]), t(r, [2, 26]), t(r, [2, 27]), { 32: [1, 37] }, { 34: [1, 38] }, t(r, [2, 30]), t(r, [2, 31]), t(r, [2, 32]), { 39: [1, 39] }, t(r, [2, 8]), t(r, [2, 9]), t(r, [2, 10]), t(r, [2, 11]), t(r, [2, 12]), t(r, [2, 13]), t(r, [2, 14]), t(r, [2, 15]), t(r, [2, 16]), { 41: [1, 40], 43: [1, 41] }, t(r, [2, 4]), t(r, [2, 28]), t(r, [2, 29]), t(r, [2, 33]), t(r, [2, 34], { 42: [1, 42], 43: [1, 43] }), t(r, [2, 40], { 41: [1, 44] }), t(r, [2, 35], { 43: [1, 45] }), t(r, [2, 36]), t(r, [2, 38], { 42: [1, 46] }), t(r, [2, 37]), t(r, [2, 39])],
    defaultActions: {},
    parseError: /* @__PURE__ */ o(function(c, l) {
      if (l.recoverable)
        this.trace(c);
      else {
        var d = new Error(c);
        throw d.hash = l, d;
      }
    }, "parseError"),
    parse: /* @__PURE__ */ o(function(c) {
      var l = this, d = [0], u = [], y = [null], i = [], S = this.table, e = "", m = 0, D = 0, w = 2, x = 1, F = i.slice.call(arguments, 1), v = Object.create(this.lexer), z = { yy: {} };
      for (var ot in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, ot) && (z.yy[ot] = this.yy[ot]);
      v.setInput(c, z.yy), z.yy.lexer = v, z.yy.parser = this, typeof v.yylloc > "u" && (v.yylloc = {});
      var pt = v.yylloc;
      i.push(pt);
      var ie = v.options && v.options.ranges;
      typeof z.yy.parseError == "function" ? this.parseError = z.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function re(W) {
        d.length = d.length - 2 * W, y.length = y.length - W, i.length = i.length - W;
      }
      o(re, "popStack");
      function Ot() {
        var W;
        return W = u.pop() || v.lex() || x, typeof W != "number" && (W instanceof Array && (u = W, W = u.pop()), W = l.symbols_[W] || W), W;
      }
      o(Ot, "lex");
      for (var V, X, N, vt, K = {}, dt, q, Pt, ft; ; ) {
        if (X = d[d.length - 1], this.defaultActions[X] ? N = this.defaultActions[X] : ((V === null || typeof V > "u") && (V = Ot()), N = S[X] && S[X][V]), typeof N > "u" || !N.length || !N[0]) {
          var Tt = "";
          ft = [];
          for (dt in S[X])
            this.terminals_[dt] && dt > w && ft.push("'" + this.terminals_[dt] + "'");
          v.showPosition ? Tt = "Parse error on line " + (m + 1) + `:
` + v.showPosition() + `
Expecting ` + ft.join(", ") + ", got '" + (this.terminals_[V] || V) + "'" : Tt = "Parse error on line " + (m + 1) + ": Unexpected " + (V == x ? "end of input" : "'" + (this.terminals_[V] || V) + "'"), this.parseError(Tt, {
            text: v.match,
            token: this.terminals_[V] || V,
            line: v.yylineno,
            loc: pt,
            expected: ft
          });
        }
        if (N[0] instanceof Array && N.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + X + ", token: " + V);
        switch (N[0]) {
          case 1:
            d.push(V), y.push(v.yytext), i.push(v.yylloc), d.push(N[1]), V = null, D = v.yyleng, e = v.yytext, m = v.yylineno, pt = v.yylloc;
            break;
          case 2:
            if (q = this.productions_[N[1]][1], K.$ = y[y.length - q], K._$ = {
              first_line: i[i.length - (q || 1)].first_line,
              last_line: i[i.length - 1].last_line,
              first_column: i[i.length - (q || 1)].first_column,
              last_column: i[i.length - 1].last_column
            }, ie && (K._$.range = [
              i[i.length - (q || 1)].range[0],
              i[i.length - 1].range[1]
            ]), vt = this.performAction.apply(K, [
              e,
              D,
              m,
              z.yy,
              N[1],
              y,
              i
            ].concat(F)), typeof vt < "u")
              return vt;
            q && (d = d.slice(0, -1 * q * 2), y = y.slice(0, -1 * q), i = i.slice(0, -1 * q)), d.push(this.productions_[N[1]][0]), y.push(K.$), i.push(K._$), Pt = S[d[d.length - 2]][d[d.length - 1]], d.push(Pt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }, "parse")
  }, b = /* @__PURE__ */ (function() {
    var h = {
      EOF: 1,
      parseError: /* @__PURE__ */ o(function(l, d) {
        if (this.yy.parser)
          this.yy.parser.parseError(l, d);
        else
          throw new Error(l);
      }, "parseError"),
      // resets the lexer, sets new input
      setInput: /* @__PURE__ */ o(function(c, l) {
        return this.yy = l || this.yy || {}, this._input = c, 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"),
      // consumes and returns one char from the input
      input: /* @__PURE__ */ o(function() {
        var c = this._input[0];
        this.yytext += c, this.yyleng++, this.offset++, this.match += c, this.matched += c;
        var l = c.match(/(?:\r\n?|\n).*/g);
        return l ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), c;
      }, "input"),
      // unshifts one char (or a string) into the input
      unput: /* @__PURE__ */ o(function(c) {
        var l = c.length, d = c.split(/(?:\r\n?|\n)/g);
        this._input = c + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - l), this.offset -= l;
        var u = 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), d.length - 1 && (this.yylineno -= d.length - 1);
        var y = 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: d ? (d.length === u.length ? this.yylloc.first_column : 0) + u[u.length - d.length].length - d[0].length : this.yylloc.first_column - l
        }, this.options.ranges && (this.yylloc.range = [y[0], y[0] + this.yyleng - l]), this.yyleng = this.yytext.length, this;
      }, "unput"),
      // When called from action, caches matched text and appends it on next action
      more: /* @__PURE__ */ o(function() {
        return this._more = !0, this;
      }, "more"),
      // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
      reject: /* @__PURE__ */ o(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).
` + this.showPosition(), {
            text: "",
            token: null,
            line: this.yylineno
          });
        return this;
      }, "reject"),
      // retain first n characters of the match
      less: /* @__PURE__ */ o(function(c) {
        this.unput(this.match.slice(c));
      }, "less"),
      // displays already matched input, i.e. for error messages
      pastInput: /* @__PURE__ */ o(function() {
        var c = this.matched.substr(0, this.matched.length - this.match.length);
        return (c.length > 20 ? "..." : "") + c.substr(-20).replace(/\n/g, "");
      }, "pastInput"),
      // displays upcoming input, i.e. for error messages
      upcomingInput: /* @__PURE__ */ o(function() {
        var c = this.match;
        return c.length < 20 && (c += this._input.substr(0, 20 - c.length)), (c.substr(0, 20) + (c.length > 20 ? "..." : "")).replace(/\n/g, "");
      }, "upcomingInput"),
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: /* @__PURE__ */ o(function() {
        var c = this.pastInput(), l = new Array(c.length + 1).join("-");
        return c + this.upcomingInput() + `
` + l + "^";
      }, "showPosition"),
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: /* @__PURE__ */ o(function(c, l) {
        var d, u, y;
        if (this.options.backtrack_lexer && (y = {
          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 && (y.yylloc.range = this.yylloc.range.slice(0))), u = c[0].match(/(?:\r\n?|\n).*/g), u && (this.yylineno += u.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: u ? u[u.length - 1].length - u[u.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + c[0].length
        }, this.yytext += c[0], this.match += c[0], this.matches = c, 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(c[0].length), this.matched += c[0], d = this.performAction.call(this, this.yy, this, l, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), d)
          return d;
        if (this._backtrack) {
          for (var i in y)
            this[i] = y[i];
          return !1;
        }
        return !1;
      }, "test_match"),
      // return next match in input
      next: /* @__PURE__ */ o(function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var c, l, d, u;
        this._more || (this.yytext = "", this.match = "");
        for (var y = this._currentRules(), i = 0; i < y.length; i++)
          if (d = this._input.match(this.rules[y[i]]), d && (!l || d[0].length > l[0].length)) {
            if (l = d, u = i, this.options.backtrack_lexer) {
              if (c = this.test_match(d, y[i]), c !== !1)
                return c;
              if (this._backtrack) {
                l = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return l ? (c = this.test_match(l, y[u]), c !== !1 ? c : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      }, "next"),
      // return next match that has a token
      lex: /* @__PURE__ */ o(function() {
        var l = this.next();
        return l || this.lex();
      }, "lex"),
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: /* @__PURE__ */ o(function(l) {
        this.conditionStack.push(l);
      }, "begin"),
      // pop the previously active lexer condition state off the condition stack
      popState: /* @__PURE__ */ o(function() {
        var l = this.conditionStack.length - 1;
        return l > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      }, "popState"),
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: /* @__PURE__ */ o(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"),
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: /* @__PURE__ */ o(function(l) {
        return l = this.conditionStack.length - 1 - Math.abs(l || 0), l >= 0 ? this.conditionStack[l] : "INITIAL";
      }, "topState"),
      // alias for begin(condition)
      pushState: /* @__PURE__ */ o(function(l) {
        this.begin(l);
      }, "pushState"),
      // return the number of states currently on the stack
      stateStackSize: /* @__PURE__ */ o(function() {
        return this.conditionStack.length;
      }, "stateStackSize"),
      options: { "case-insensitive": !0 },
      performAction: /* @__PURE__ */ o(function(l, d, u, y) {
        switch (u) {
          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 } }
    };
    return h;
  })();
  T.lexer = b;
  function p() {
    this.yy = {};
  }
  return o(p, "Parser"), p.prototype = T, T.Parser = p, new p();
})();
xt.parser = xt;
var Me = xt;
A.extend(ke);
A.extend(ye);
A.extend(ge);
var Xt = { friday: 5, saturday: 6 }, R = "", Ct = "", Et = void 0, St = "", ct = [], lt = [], It = /* @__PURE__ */ new Map(), At = [], yt = [], Z = "", Ft = "", Ht = ["active", "done", "crit", "milestone", "vert"], Lt = [], ut = !1, Mt = !1, Vt = "sunday", gt = "saturday", wt = 0, Ve = /* @__PURE__ */ o(function() {
  At = [], yt = [], Z = "", Lt = [], ht = 0, Dt = void 0, kt = void 0, I = [], R = "", Ct = "", Ft = "", Et = void 0, St = "", ct = [], lt = [], ut = !1, Mt = !1, wt = 0, It = /* @__PURE__ */ new Map(), me(), Vt = "sunday", gt = "saturday";
}, "clear"), We = /* @__PURE__ */ o(function(t) {
  Ct = t;
}, "setAxisFormat"), Oe = /* @__PURE__ */ o(function() {
  return Ct;
}, "getAxisFormat"), Pe = /* @__PURE__ */ o(function(t) {
  Et = t;
}, "setTickInterval"), Ne = /* @__PURE__ */ o(function() {
  return Et;
}, "getTickInterval"), Re = /* @__PURE__ */ o(function(t) {
  St = t;
}, "setTodayMarker"), Ye = /* @__PURE__ */ o(function() {
  return St;
}, "getTodayMarker"), Be = /* @__PURE__ */ o(function(t) {
  R = t;
}, "setDateFormat"), ze = /* @__PURE__ */ o(function() {
  ut = !0;
}, "enableInclusiveEndDates"), qe = /* @__PURE__ */ o(function() {
  return ut;
}, "endDatesAreInclusive"), je = /* @__PURE__ */ o(function() {
  Mt = !0;
}, "enableTopAxis"), Xe = /* @__PURE__ */ o(function() {
  return Mt;
}, "topAxisEnabled"), Ue = /* @__PURE__ */ o(function(t) {
  Ft = t;
}, "setDisplayMode"), Ge = /* @__PURE__ */ o(function() {
  return Ft;
}, "getDisplayMode"), He = /* @__PURE__ */ o(function() {
  return R;
}, "getDateFormat"), Ke = /* @__PURE__ */ o(function(t) {
  ct = t.toLowerCase().split(/[\s,]+/);
}, "setIncludes"), Je = /* @__PURE__ */ o(function() {
  return ct;
}, "getIncludes"), Qe = /* @__PURE__ */ o(function(t) {
  lt = t.toLowerCase().split(/[\s,]+/);
}, "setExcludes"), Ze = /* @__PURE__ */ o(function() {
  return lt;
}, "getExcludes"), $e = /* @__PURE__ */ o(function() {
  return It;
}, "getLinks"), ti = /* @__PURE__ */ o(function(t) {
  Z = t, At.push(t);
}, "addSection"), ei = /* @__PURE__ */ o(function() {
  return At;
}, "getSections"), ii = /* @__PURE__ */ o(function() {
  let t = Ut();
  const r = 10;
  let s = 0;
  for (; !t && s < r; )
    t = Ut(), s++;
  return yt = I, yt;
}, "getTasks"), Kt = /* @__PURE__ */ o(function(t, r, s, a) {
  const n = t.format(r.trim()), f = t.format("YYYY-MM-DD");
  return a.includes(n) || a.includes(f) ? !1 : s.includes("weekends") && (t.isoWeekday() === Xt[gt] || t.isoWeekday() === Xt[gt] + 1) || s.includes(t.format("dddd").toLowerCase()) ? !0 : s.includes(n) || s.includes(f);
}, "isInvalidDate"), ri = /* @__PURE__ */ o(function(t) {
  Vt = t;
}, "setWeekday"), si = /* @__PURE__ */ o(function() {
  return Vt;
}, "getWeekday"), ni = /* @__PURE__ */ o(function(t) {
  gt = t;
}, "setWeekend"), Jt = /* @__PURE__ */ o(function(t, r, s, a) {
  if (!s.length || t.manualEndTime)
    return;
  let n;
  t.startTime instanceof Date ? n = A(t.startTime) : n = A(t.startTime, r, !0), n = n.add(1, "d");
  let f;
  t.endTime instanceof Date ? f = A(t.endTime) : f = A(t.endTime, r, !0);
  const [g, E] = ai(
    n,
    f,
    r,
    s,
    a
  );
  t.endTime = g.toDate(), t.renderEndTime = E;
}, "checkTaskDates"), ai = /* @__PURE__ */ o(function(t, r, s, a, n) {
  let f = !1, g = null;
  for (; t <= r; )
    f || (g = r.toDate()), f = Kt(t, s, a, n), f && (r = r.add(1, "d")), t = t.add(1, "d");
  return [r, g];
}, "fixTaskDates"), _t = /* @__PURE__ */ o(function(t, r, s) {
  if (s = s.trim(), (/* @__PURE__ */ o((E) => {
    const L = E.trim();
    return L === "x" || L === "X";
  }, "isTimestampFormat"))(r) && /^\d+$/.test(s))
    return new Date(Number(s));
  const f = /^after\s+(?<ids>[\d\w- ]+)/.exec(s);
  if (f !== null) {
    let E = null;
    for (const Y of f.groups.ids.split(" ")) {
      let C = G(Y);
      C !== void 0 && (!E || C.endTime > E.endTime) && (E = C);
    }
    if (E)
      return E.endTime;
    const L = /* @__PURE__ */ new Date();
    return L.setHours(0, 0, 0, 0), L;
  }
  let g = A(s, r.trim(), !0);
  if (g.isValid())
    return g.toDate();
  {
    U.debug("Invalid date:" + s), U.debug("With date format:" + r.trim());
    const E = new Date(s);
    if (E === void 0 || isNaN(E.getTime()) || // WebKit browsers can mis-parse invalid dates to be ridiculously
    // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304.
    // This can cause virtually infinite loops while rendering, so for the
    // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as
    // invalid.
    E.getFullYear() < -1e4 || E.getFullYear() > 1e4)
      throw new Error("Invalid date:" + s);
    return E;
  }
}, "getStartDate"), Qt = /* @__PURE__ */ o(function(t) {
  const r = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim());
  return r !== null ? [Number.parseFloat(r[1]), r[2]] : [NaN, "ms"];
}, "parseDuration"), Zt = /* @__PURE__ */ o(function(t, r, s, a = !1) {
  s = s.trim();
  const f = /^until\s+(?<ids>[\d\w- ]+)/.exec(s);
  if (f !== null) {
    let C = null;
    for (const B of f.groups.ids.split(" ")) {
      let O = G(B);
      O !== void 0 && (!C || O.startTime < C.startTime) && (C = O);
    }
    if (C)
      return C.startTime;
    const M = /* @__PURE__ */ new Date();
    return M.setHours(0, 0, 0, 0), M;
  }
  let g = A(s, r.trim(), !0);
  if (g.isValid())
    return a && (g = g.add(1, "d")), g.toDate();
  let E = A(t);
  const [L, Y] = Qt(s);
  if (!Number.isNaN(L)) {
    const C = E.add(L, Y);
    C.isValid() && (E = C);
  }
  return E.toDate();
}, "getEndDate"), ht = 0, Q = /* @__PURE__ */ o(function(t) {
  return t === void 0 ? (ht = ht + 1, "task" + ht) : t;
}, "parseId"), oi = /* @__PURE__ */ o(function(t, r) {
  let s;
  r.substr(0, 1) === ":" ? s = r.substr(1, r.length) : s = r;
  const a = s.split(","), n = {};
  Wt(a, n, Ht);
  for (let g = 0; g < a.length; g++)
    a[g] = a[g].trim();
  let f = "";
  switch (a.length) {
    case 1:
      n.id = Q(), n.startTime = t.endTime, f = a[0];
      break;
    case 2:
      n.id = Q(), n.startTime = _t(void 0, R, a[0]), f = a[1];
      break;
    case 3:
      n.id = Q(a[0]), n.startTime = _t(void 0, R, a[1]), f = a[2];
      break;
  }
  return f && (n.endTime = Zt(n.startTime, R, f, ut), n.manualEndTime = A(f, "YYYY-MM-DD", !0).isValid(), Jt(n, R, lt, ct)), n;
}, "compileData"), ci = /* @__PURE__ */ o(function(t, r) {
  let s;
  r.substr(0, 1) === ":" ? s = r.substr(1, r.length) : s = r;
  const a = s.split(","), n = {};
  Wt(a, n, Ht);
  for (let f = 0; f < a.length; f++)
    a[f] = a[f].trim();
  switch (a.length) {
    case 1:
      n.id = Q(), n.startTime = {
        type: "prevTaskEnd",
        id: t
      }, n.endTime = {
        data: a[0]
      };
      break;
    case 2:
      n.id = Q(), n.startTime = {
        type: "getStartDate",
        startData: a[0]
      }, n.endTime = {
        data: a[1]
      };
      break;
    case 3:
      n.id = Q(a[0]), n.startTime = {
        type: "getStartDate",
        startData: a[1]
      }, n.endTime = {
        data: a[2]
      };
      break;
  }
  return n;
}, "parseData"), Dt, kt, I = [], $t = {}, li = /* @__PURE__ */ o(function(t, r) {
  const s = {
    section: Z,
    type: Z,
    processed: !1,
    manualEndTime: !1,
    renderEndTime: null,
    raw: { data: r },
    task: t,
    classes: []
  }, a = ci(kt, r);
  s.raw.startTime = a.startTime, s.raw.endTime = a.endTime, s.id = a.id, s.prevTaskId = kt, s.active = a.active, s.done = a.done, s.crit = a.crit, s.milestone = a.milestone, s.vert = a.vert, s.order = wt, wt++;
  const n = I.push(s);
  kt = s.id, $t[s.id] = n - 1;
}, "addTask"), G = /* @__PURE__ */ o(function(t) {
  const r = $t[t];
  return I[r];
}, "findTaskById"), ui = /* @__PURE__ */ o(function(t, r) {
  const s = {
    section: Z,
    type: Z,
    description: t,
    task: t,
    classes: []
  }, a = oi(Dt, r);
  s.startTime = a.startTime, s.endTime = a.endTime, s.id = a.id, s.active = a.active, s.done = a.done, s.crit = a.crit, s.milestone = a.milestone, s.vert = a.vert, Dt = s, yt.push(s);
}, "addTaskOrg"), Ut = /* @__PURE__ */ o(function() {
  const t = /* @__PURE__ */ o(function(s) {
    const a = I[s];
    let n = "";
    switch (I[s].raw.startTime.type) {
      case "prevTaskEnd": {
        const f = G(a.prevTaskId);
        a.startTime = f.endTime;
        break;
      }
      case "getStartDate":
        n = _t(void 0, R, I[s].raw.startTime.startData), n && (I[s].startTime = n);
        break;
    }
    return I[s].startTime && (I[s].endTime = Zt(
      I[s].startTime,
      R,
      I[s].raw.endTime.data,
      ut
    ), I[s].endTime && (I[s].processed = !0, I[s].manualEndTime = A(
      I[s].raw.endTime.data,
      "YYYY-MM-DD",
      !0
    ).isValid(), Jt(I[s], R, lt, ct))), I[s].processed;
  }, "compileTask");
  let r = !0;
  for (const [s, a] of I.entries())
    t(s), r = r && a.processed;
  return r;
}, "compileTasks"), di = /* @__PURE__ */ o(function(t, r) {
  let s = r;
  J().securityLevel !== "loose" && (s = he.sanitizeUrl(r)), t.split(",").forEach(function(a) {
    G(a) !== void 0 && (ee(a, () => {
      window.open(s, "_self");
    }), It.set(a, s));
  }), te(t, "clickable");
}, "setLink"), te = /* @__PURE__ */ o(function(t, r) {
  t.split(",").forEach(function(s) {
    let a = G(s);
    a !== void 0 && a.classes.push(r);
  });
}, "setClass"), fi = /* @__PURE__ */ o(function(t, r, s) {
  if (J().securityLevel !== "loose" || r === void 0)
    return;
  let a = [];
  if (typeof s == "string") {
    a = s.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
    for (let f = 0; f < a.length; f++) {
      let g = a[f].trim();
      g.startsWith('"') && g.endsWith('"') && (g = g.substr(1, g.length - 2)), a[f] = g;
    }
  }
  a.length === 0 && a.push(t), G(t) !== void 0 && ee(t, () => {
    se.runFunc(r, ...a);
  });
}, "setClickFun"), ee = /* @__PURE__ */ o(function(t, r) {
  Lt.push(
    function() {
      const s = document.querySelector(`[id="${t}"]`);
      s !== null && s.addEventListener("click", function() {
        r();
      });
    },
    function() {
      const s = document.querySelector(`[id="${t}-text"]`);
      s !== null && s.addEventListener("click", function() {
        r();
      });
    }
  );
}, "pushFun"), mi = /* @__PURE__ */ o(function(t, r, s) {
  t.split(",").forEach(function(a) {
    fi(a, r, s);
  }), te(t, "clickable");
}, "setClickEvent"), hi = /* @__PURE__ */ o(function(t) {
  Lt.forEach(function(r) {
    r(t);
  });
}, "bindFunctions"), ki = {
  getConfig: /* @__PURE__ */ o(() => J().gantt, "getConfig"),
  clear: Ve,
  setDateFormat: Be,
  getDateFormat: He,
  enableInclusiveEndDates: ze,
  endDatesAreInclusive: qe,
  enableTopAxis: je,
  topAxisEnabled: Xe,
  setAxisFormat: We,
  getAxisFormat: Oe,
  setTickInterval: Pe,
  getTickInterval: Ne,
  setTodayMarker: Re,
  getTodayMarker: Ye,
  setAccTitle: ue,
  getAccTitle: le,
  setDiagramTitle: ce,
  getDiagramTitle: oe,
  setDisplayMode: Ue,
  getDisplayMode: Ge,
  setAccDescription: ae,
  getAccDescription: ne,
  addSection: ti,
  getSections: ei,
  getTasks: ii,
  addTask: li,
  findTaskById: G,
  addTaskOrg: ui,
  setIncludes: Ke,
  getIncludes: Je,
  setExcludes: Qe,
  getExcludes: Ze,
  setClickEvent: mi,
  setLink: di,
  getLinks: $e,
  bindFunctions: hi,
  parseDuration: Qt,
  isInvalidDate: Kt,
  setWeekday: ri,
  getWeekday: si,
  setWeekend: ni
};
function Wt(t, r, s) {
  let a = !0;
  for (; a; )
    a = !1, s.forEach(function(n) {
      const f = "^\\s*" + n + "\\s*$", g = new RegExp(f);
      t[0].match(g) && (r[n] = !0, t.shift(1), a = !0);
    });
}
o(Wt, "getTaskTags");
A.extend(pe);
var yi = /* @__PURE__ */ o(function() {
  U.debug("Something is calling, setConf, remove the call");
}, "setConf"), Gt = {
  monday: Le,
  tuesday: Fe,
  wednesday: Ae,
  thursday: Ie,
  friday: Se,
  saturday: Ee,
  sunday: Ce
}, gi = /* @__PURE__ */ o((t, r) => {
  let s = [...t].map(() => -1 / 0), a = [...t].sort((f, g) => f.startTime - g.startTime || f.order - g.order), n = 0;
  for (const f of a)
    for (let g = 0; g < s.length; g++)
      if (f.startTime >= s[g]) {
        s[g] = f.endTime, f.order = g + r, g > n && (n = g);
        break;
      }
  return n;
}, "getMaxIntersections"), j, bt = 1e4, pi = /* @__PURE__ */ o(function(t, r, s, a) {
  const n = J().gantt, f = J().securityLevel;
  let g;
  f === "sandbox" && (g = mt("#i" + r));
  const E = f === "sandbox" ? mt(g.nodes()[0].contentDocument.body) : mt("body"), L = f === "sandbox" ? g.nodes()[0].contentDocument : document, Y = L.getElementById(r);
  j = Y.parentElement.offsetWidth, j === void 0 && (j = 1200), n.useWidth !== void 0 && (j = n.useWidth);
  const C = a.db.getTasks();
  let M = [];
  for (const k of C)
    M.push(k.type);
  M = at(M);
  const B = {};
  let O = 2 * n.topPadding;
  if (a.db.getDisplayMode() === "compact" || n.displayMode === "compact") {
    const k = {};
    for (const b of C)
      k[b.section] === void 0 ? k[b.section] = [b] : k[b.section].push(b);
    let T = 0;
    for (const b of Object.keys(k)) {
      const p = gi(k[b], T) + 1;
      T += p, O += p * (n.barHeight + n.barGap), B[b] = p;
    }
  } else {
    O += C.length * (n.barHeight + n.barGap);
    for (const k of M)
      B[k] = C.filter((T) => T.type === k).length;
  }
  Y.setAttribute("viewBox", "0 0 " + j + " " + O);
  const P = E.select(`[id="${r}"]`), _ = ve().domain([
    Te(C, function(k) {
      return k.startTime;
    }),
    be(C, function(k) {
      return k.endTime;
    })
  ]).rangeRound([0, j - n.leftPadding - n.rightPadding]);
  function $(k, T) {
    const b = k.startTime, p = T.startTime;
    let h = 0;
    return b > p ? h = 1 : b < p && (h = -1), h;
  }
  o($, "taskCompare"), C.sort($), tt(C, j, O), de(P, O, j, n.useMaxWidth), P.append("text").text(a.db.getDiagramTitle()).attr("x", j / 2).attr("y", n.titleTopMargin).attr("class", "titleText");
  function tt(k, T, b) {
    const p = n.barHeight, h = p + n.barGap, c = n.topPadding, l = n.leftPadding, d = xe().domain([0, M.length]).range(["#00B9FA", "#F95002"]).interpolate(we);
    it(
      h,
      c,
      l,
      T,
      b,
      k,
      a.db.getExcludes(),
      a.db.getIncludes()
    ), rt(l, c, T, b), et(k, h, c, l, p, d, T), st(h, c), nt(l, c, T, b);
  }
  o(tt, "makeGantt");
  function et(k, T, b, p, h, c, l) {
    k.sort((e, m) => e.vert === m.vert ? 0 : e.vert ? 1 : -1);
    const u = [...new Set(k.map((e) => e.order))].map((e) => k.find((m) => m.order === e));
    P.append("g").selectAll("rect").data(u).enter().append("rect").attr("x", 0).attr("y", function(e, m) {
      return m = e.order, m * T + b - 2;
    }).attr("width", function() {
      return l - n.rightPadding / 2;
    }).attr("height", T).attr("class", function(e) {
      for (const [m, D] of M.entries())
        if (e.type === D)
          return "section section" + m % n.numberSectionStyles;
      return "section section0";
    }).enter();
    const y = P.append("g").selectAll("rect").data(k).enter(), i = a.db.getLinks();
    if (y.append("rect").attr("id", function(e) {
      return e.id;
    }).attr("rx", 3).attr("ry", 3).attr("x", function(e) {
      return e.milestone ? _(e.startTime) + p + 0.5 * (_(e.endTime) - _(e.startTime)) - 0.5 * h : _(e.startTime) + p;
    }).attr("y", function(e, m) {
      return m = e.order, e.vert ? n.gridLineStartPadding : m * T + b;
    }).attr("width", function(e) {
      return e.milestone ? h : e.vert ? 0.08 * h : _(e.renderEndTime || e.endTime) - _(e.startTime);
    }).attr("height", function(e) {
      return e.vert ? C.length * (n.barHeight + n.barGap) + n.barHeight * 2 : h;
    }).attr("transform-origin", function(e, m) {
      return m = e.order, (_(e.startTime) + p + 0.5 * (_(e.endTime) - _(e.startTime))).toString() + "px " + (m * T + b + 0.5 * h).toString() + "px";
    }).attr("class", function(e) {
      const m = "task";
      let D = "";
      e.classes.length > 0 && (D = e.classes.join(" "));
      let w = 0;
      for (const [F, v] of M.entries())
        e.type === v && (w = F % n.numberSectionStyles);
      let x = "";
      return e.active ? e.crit ? x += " activeCrit" : x = " active" : e.done ? e.crit ? x = " doneCrit" : x = " done" : e.crit && (x += " crit"), x.length === 0 && (x = " task"), e.milestone && (x = " milestone " + x), e.vert && (x = " vert " + x), x += w, x += " " + D, m + x;
    }), y.append("text").attr("id", function(e) {
      return e.id + "-text";
    }).text(function(e) {
      return e.task;
    }).attr("font-size", n.fontSize).attr("x", function(e) {
      let m = _(e.startTime), D = _(e.renderEndTime || e.endTime);
      if (e.milestone && (m += 0.5 * (_(e.endTime) - _(e.startTime)) - 0.5 * h, D = m + h), e.vert)
        return _(e.startTime) + p;
      const w = this.getBBox().width;
      return w > D - m ? D + w + 1.5 * n.leftPadding > l ? m + p - 5 : D + p + 5 : (D - m) / 2 + m + p;
    }).attr("y", function(e, m) {
      return e.vert ? n.gridLineStartPadding + C.length * (n.barHeight + n.barGap) + 60 : (m = e.order, m * T + n.barHeight / 2 + (n.fontSize / 2 - 2) + b);
    }).attr("text-height", h).attr("class", function(e) {
      const m = _(e.startTime);
      let D = _(e.endTime);
      e.milestone && (D = m + h);
      const w = this.getBBox().width;
      let x = "";
      e.classes.length > 0 && (x = e.classes.join(" "));
      let F = 0;
      for (const [z, ot] of M.entries())
        e.type === ot && (F = z % n.numberSectionStyles);
      let v = "";
      return e.active && (e.crit ? v = "activeCritText" + F : v = "activeText" + F), e.done ? e.crit ? v = v + " doneCritText" + F : v = v + " doneText" + F : e.crit && (v = v + " critText" + F), e.milestone && (v += " milestoneText"), e.vert && (v += " vertText"), w > D - m ? D + w + 1.5 * n.leftPadding > l ? x + " taskTextOutsideLeft taskTextOutside" + F + " " + v : x + " taskTextOutsideRight taskTextOutside" + F + " " + v + " width-" + w : x + " taskText taskText" + F + " " + v + " width-" + w;
    }), J().securityLevel === "sandbox") {
      let e;
      e = mt("#i" + r);
      const m = e.nodes()[0].contentDocument;
      y.filter(function(D) {
        return i.has(D.id);
      }).each(function(D) {
        var w = m.querySelector("#" + D.id), x = m.querySelector("#" + D.id + "-text");
        const F = w.parentNode;
        var v = m.createElement("a");
        v.setAttribute("xlink:href", i.get(D.id)), v.setAttribute("target", "_top"), F.appendChild(v), v.appendChild(w), v.appendChild(x);
      });
    }
  }
  o(et, "drawRects");
  function it(k, T, b, p, h, c, l, d) {
    if (l.length === 0 && d.length === 0)
      return;
    let u, y;
    for (const { startTime: w, endTime: x } of c)
      (u === void 0 || w < u) && (u = w), (y === void 0 || x > y) && (y = x);
    if (!u || !y)
      return;
    if (A(y).diff(A(u), "year") > 5) {
      U.warn(
        "The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days."
      );
      return;
    }
    const i = a.db.getDateFormat(), S = [];
    let e = null, m = A(u);
    for (; m.valueOf() <= y; )
      a.db.isInvalidDate(m, i, l, d) ? e ? e.end = m : e = {
        start: m,
        end: m
      } : e && (S.push(e), e = null), m = m.add(1, "d");
    P.append("g").selectAll("rect").data(S).enter().append("rect").attr("id", (w) => "exclude-" + w.start.format("YYYY-MM-DD")).attr("x", (w) => _(w.start.startOf("day")) + b).attr("y", n.gridLineStartPadding).attr("width", (w) => _(w.end.endOf("day")) - _(w.start.startOf("day"))).attr("height", h - T - n.gridLineStartPadding).attr("transform-origin", function(w, x) {
      return (_(w.start) + b + 0.5 * (_(w.end) - _(w.start))).toString() + "px " + (x * k + 0.5 * h).toString() + "px";
    }).attr("class", "exclude-range");
  }
  o(it, "drawExcludeDays");
  function H(k, T, b, p) {
    if (b <= 0 || k > T)
      return 1 / 0;
    const h = T - k, c = A.duration({ [p ?? "day"]: b }).asMilliseconds();
    return c <= 0 ? 1 / 0 : Math.ceil(h / c);
  }
  o(H, "getEstimatedTickCount");
  function rt(k, T, b, p) {
    const h = a.db.getDateFormat(), c = a.db.getAxisFormat();
    let l;
    c ? l = c : h === "D" ? l = "%d" : l = n.axisFormat ?? "%Y-%m-%d";
    let d = _e(_).tickSize(-p + T + n.gridLineStartPadding).tickFormat(Nt(l));
    const y = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(
      a.db.getTickInterval() || n.tickInterval
    );
    if (y !== null) {
      const i = parseInt(y[1], 10);
      if (isNaN(i) || i <= 0)
        U.warn(
          `Invalid tick interval value: "${y[1]}". Skipping custom tick interval.`
        );
      else {
        const S = y[2], e = a.db.getWeekday() || n.weekday, m = _.domain(), D = m[0], w = m[1], x = H(D, w, i, S);
        if (x > bt)
          U.warn(
            `The tick interval "${i}${S}" would generate ${x} ticks, which exceeds the maximum allowed (${bt}). This may indicate an invalid date or time range. Skipping custom tick interval.`
          );
        else
          switch (S) {
            case "millisecond":
              d.ticks(jt.every(i));
              break;
            case "second":
              d.ticks(qt.every(i));
              break;
            case "minute":
              d.ticks(zt.every(i));
              break;
            case "hour":
              d.ticks(Bt.every(i));
              break;
            case "day":
              d.ticks(Yt.every(i));
              break;
            case "week":
              d.ticks(Gt[e].every(i));
              break;
            case "month":
              d.ticks(Rt.every(i));
              break;
          }
      }
    }
    if (P.append("g").attr("class", "grid").attr("transform", "translate(" + k + ", " + (p - 50) + ")").call(d).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em"), a.db.topAxisEnabled() || n.topAxis) {
      let i = De(_).tickSize(-p + T + n.gridLineStartPadding).tickFormat(Nt(l));
      if (y !== null) {
        const S = parseInt(y[1], 10);
        if (isNaN(S) || S <= 0)
          U.warn(
            `Invalid tick interval value: "${y[1]}". Skipping custom tick interval.`
          );
        else {
          const e = y[2], m = a.db.getWeekday() || n.weekday, D = _.domain(), w = D[0], x = D[1];
          if (H(w, x, S, e) <= bt)
            switch (e) {
              case "millisecond":
                i.ticks(jt.every(S));
                break;
              case "second":
                i.ticks(qt.every(S));
                break;
              case "minute":
                i.ticks(zt.every(S));
                break;
              case "hour":
                i.ticks(Bt.every(S));
                break;
              case "day":
                i.ticks(Yt.every(S));
                break;
              case "week":
                i.ticks(Gt[m].every(S));
                break;
              case "month":
                i.ticks(Rt.every(S));
                break;
            }
        }
      }
      P.append("g").attr("class", "grid").attr("transform", "translate(" + k + ", " + T + ")").call(i).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10);
    }
  }
  o(rt, "makeGrid");
  function st(k, T) {
    let b = 0;
    const p = Object.keys(B).map((h) => [h, B[h]]);
    P.append("g").selectAll("text").data(p).enter().append(function(h) {
      const c = h[0].split(fe.lineBreakRegex), l = -(c.length - 1) / 2, d = L.createElementNS("http://www.w3.org/2000/svg", "text");
      d.setAttribute("dy", l + "em");
      for (const [u, y] of c.entries()) {
        const i = L.createElementNS("http://www.w3.org/2000/svg", "tspan");
        i.setAttribute("alignment-baseline", "central"), i.setAttribute("x", "10"), u > 0 && i.setAttribute("dy", "1em"), i.textContent = y, d.appendChild(i);
      }
      return d;
    }).attr("x", 10).attr("y", function(h, c) {
      if (c > 0)
        for (let l = 0; l < c; l++)
          return b += p[c - 1][1], h[1] * k / 2 + b * k + T;
      else
        return h[1] * k / 2 + T;
    }).attr("font-size", n.sectionFontSize).attr("class", function(h) {
      for (const [c, l] of M.entries())
        if (h[0] === l)
          return "sectionTitle sectionTitle" + c % n.numberSectionStyles;
      return "sectionTitle";
    });
  }
  o(st, "vertLabels");
  function nt(k, T, b, p) {
    const h = a.db.getTodayMarker();
    if (h === "off")
      return;
    const c = P.append("g").attr("class", "today"), l = /* @__PURE__ */ new Date(), d = c.append("line");
    d.attr("x1", _(l) + k).attr("x2", _(l) + k).attr("y1", n.titleTopMargin).attr("y2", p - n.titleTopMargin).attr("class", "today"), h !== "" && d.attr("style", h.replace(/,/g, ";"));
  }
  o(nt, "drawToday");
  function at(k) {
    const T = {}, b = [];
    for (let p = 0, h = k.length; p < h; ++p)
      Object.prototype.hasOwnProperty.call(T, k[p]) || (T[k[p]] = !0, b.push(k[p]));
    return b;
  }
  o(at, "checkUnique");
}, "draw"), vi = {
  setConf: yi,
  draw: pi
}, Ti = /* @__PURE__ */ o((t) => `
  .mermaid-main-font {
        font-family: ${t.fontFamily};
  }

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

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

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

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

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

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

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

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

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

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


  /* Grid and axis */

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

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

  .grid path {
    stroke-width: 0;
  }


  /* Today line */

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


  /* Task styling */

  /* Default task */

  .task {
    stroke-width: 2;
  }

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

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

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


  /* Special case clickable */

  .task.clickable {
    cursor: pointer;
  }

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

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

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


  /* Specific task settings for the sections*/

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

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

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

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


  /* Active task */

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

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


  /* Completed task */

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

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


  /* Tasks on the critical line */

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

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

  .doneCrit0,
  .doneCrit1,
  .doneCrit2,
  .doneCrit3 {
    stroke: ${t.critBorderColor};
    fill: ${t.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: ${t.taskTextDarkColor} !important;
  }

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

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

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

  .titleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.titleColor || t.textColor};
    font-family: ${t.fontFamily};
  }
`, "getStyles"), bi = Ti, Hi = {
  parser: Me,
  db: ki,
  renderer: vi,
  styles: bi
};
export {
  Hi as diagram
};
