import { d as As } from "./chunk-BKyTJ1V5.js";
import { g as Nu, a as Fy, b as rk } from "./chunk-CGD3Ka0J.js";
import { E as sk } from "./chunk-vVYLWEJE.js";
const Fu = 20, ak = {
  rect: "rectangle",
  circle: "ellipse"
}, J0 = {
  startOnLoad: !1,
  flowchart: { curve: "linear" },
  themeVariables: {
    // Multiplying by 1.25 to increase the font size by 25% and render correctly in Excalidraw
    fontSize: `${Fu * 1.25}px`
  },
  maxEdges: 500,
  maxTextSize: 5e4
};
class Ou {
  constructor({ converter: e }) {
    this.convert = (n, i) => this.converter(n, {
      ...i,
      fontSize: i.fontSize || Fu
    }), this.converter = e;
  }
}
var es;
(function(t) {
  t.ROUND = "round", t.STADIUM = "stadium", t.DOUBLECIRCLE = "doublecircle", t.CIRCLE = "circle", t.DIAMOND = "diamond";
})(es || (es = {}));
var wd;
(function(t) {
  t.COLOR = "color";
})(wd || (wd = {}));
var js;
(function(t) {
  t.FILL = "fill", t.STROKE = "stroke", t.STROKE_WIDTH = "stroke-width", t.STROKE_DASHARRAY = "stroke-dasharray";
})(js || (js = {}));
var Xa = {}, tp;
function ok() {
  if (tp) return Xa;
  tp = 1, Object.defineProperty(Xa, "__esModule", { value: !0 }), Xa.removeMarkdown = void 0;
  var t = function(e, n) {
    n === void 0 && (n = {
      listUnicodeChar: ""
    }), n = n || {}, n.listUnicodeChar = n.hasOwnProperty("listUnicodeChar") ? n.listUnicodeChar : !1, n.stripListLeaders = n.hasOwnProperty("stripListLeaders") ? n.stripListLeaders : !0, n.gfm = n.hasOwnProperty("gfm") ? n.gfm : !0, n.useImgAltText = n.hasOwnProperty("useImgAltText") ? n.useImgAltText : !0, n.preserveLinks = n.hasOwnProperty("preserveLinks") ? n.preserveLinks : !1;
    var i = e || "";
    i = i.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm, "");
    try {
      n.stripListLeaders && (n.listUnicodeChar ? i = i.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, n.listUnicodeChar + " $1") : i = i.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm, "$1")), n.gfm && (i = i.replace(/\n={2,}/g, `
`).replace(/~{3}.*\n/g, "").replace(/~~/g, "").replace(/`{3}.*\n/g, "")), n.preserveLinks && (i = i.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g, "$1 ($2)")), i = i.replace(/<[^>]*>/g, "").replace(/^[=\-]{2,}\s*$/g, "").replace(/\[\^.+?\](\: .*?$)?/g, "").replace(/\s{0,2}\[.*?\]: .*?$/g, "").replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g, n.useImgAltText ? "$1" : "").replace(/\[(.*?)\][\[\(].*?[\]\)]/g, "$1").replace(/^\s{0,3}>\s?/g, "").replace(/(^|\n)\s{0,3}>\s?/g, `

`).replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g, "").replace(/^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} {0,}(\n)?\s{0,}$/gm, "$1$2$3").replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2").replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g, "$2").replace(/(`{3,})(.*?)\1/gm, "$2").replace(/`(.+?)`/g, "$1").replace(/\n{2,}/g, `

`);
    } catch (r) {
      return console.error(r), e;
    }
    return i;
  };
  return Xa.removeMarkdown = t, Xa;
}
var lk = ok();
const ck = {
  arrow_circle: {
    endArrowhead: "dot"
  },
  arrow_cross: {
    endArrowhead: "bar"
  },
  arrow_open: {
    endArrowhead: null,
    startArrowhead: null
  },
  double_arrow_circle: {
    endArrowhead: "dot",
    startArrowhead: "dot"
  },
  double_arrow_cross: {
    endArrowhead: "bar",
    startArrowhead: "bar"
  },
  double_arrow_point: {
    endArrowhead: "arrow",
    startArrowhead: "arrow"
  }
}, uk = (t) => ck[t], zl = (t) => {
  let e = t.text;
  return t.labelType === "markdown" && (e = lk.removeMarkdown(t.text)), hk(e);
}, hk = (t) => {
  const e = /\s?(fa|fab):[a-zA-Z0-9-]+/g;
  return t.replace(e, "");
}, dk = (t) => {
  const e = {};
  return Object.keys(t).forEach((n) => {
    switch (n) {
      case js.FILL: {
        e.backgroundColor = t[n], e.fillStyle = "solid";
        break;
      }
      case js.STROKE: {
        e.strokeColor = t[n];
        break;
      }
      case js.STROKE_WIDTH: {
        e.strokeWidth = Number(t[n]?.split("px")[0]);
        break;
      }
      case js.STROKE_DASHARRAY: {
        e.strokeStyle = "dashed";
        break;
      }
    }
  }), e;
}, fk = (t) => {
  const e = {};
  return Object.keys(t).forEach((n) => {
    switch (n) {
      case wd.COLOR: {
        e.strokeColor = t[n];
        break;
      }
    }
  }), e;
}, pk = (t) => {
  const e = {};
  t.subGraphs.map((i) => {
    i.nodeIds.forEach((r) => {
      e[i.id] = {
        id: i.id,
        parent: null,
        isLeaf: !1
      }, e[r] = {
        id: r,
        parent: i.id,
        isLeaf: t.vertices[r] !== void 0
      };
    });
  });
  const n = {};
  return [...Object.keys(t.vertices), ...t.subGraphs.map((i) => i.id)].forEach((i) => {
    if (!e[i])
      return;
    let r = e[i];
    const s = [];
    for (r.isLeaf || s.push(`subgraph_group_${r.id}`); r.parent; )
      s.push(`subgraph_group_${r.parent}`), r = e[r.parent];
    n[i] = s;
  }), {
    getGroupIds: (i) => n[i] || [],
    getParentId: (i) => e[i] ? e[i].parent : null
  };
}, gk = new Ou({
  converter: (t, e) => {
    const n = [], i = e.fontSize, { getGroupIds: r, getParentId: s } = pk(t);
    return t.subGraphs.reverse().forEach((a) => {
      const o = r(a.id), l = {
        id: a.id,
        type: "rectangle",
        groupIds: o,
        x: a.x,
        y: a.y,
        width: a.width,
        height: a.height,
        label: {
          groupIds: o,
          text: zl(a),
          fontSize: i,
          verticalAlign: "top"
        }
      };
      n.push(l);
    }), Object.values(t.vertices).forEach((a) => {
      if (!a)
        return;
      const o = r(a.id), l = dk(a.containerStyle), u = fk(a.labelStyle);
      let h = {
        id: a.id,
        type: "rectangle",
        groupIds: o,
        x: a.x,
        y: a.y,
        width: a.width,
        height: a.height,
        strokeWidth: 2,
        label: {
          groupIds: o,
          text: zl(a),
          fontSize: i,
          ...u
        },
        link: a.link || null,
        ...l
      };
      switch (a.type) {
        case es.STADIUM: {
          h = { ...h, roundness: { type: 3 } };
          break;
        }
        case es.ROUND: {
          h = { ...h, roundness: { type: 3 } };
          break;
        }
        case es.DOUBLECIRCLE: {
          o.push(`doublecircle_${a.id}}`);
          const d = {
            type: "ellipse",
            groupIds: o,
            x: a.x + 5,
            y: a.y + 5,
            width: a.width - 10,
            height: a.height - 10,
            strokeWidth: 2,
            roundness: { type: 3 },
            label: {
              groupIds: o,
              text: zl(a),
              fontSize: i
            }
          };
          h = { ...h, groupIds: o, type: "ellipse" }, n.push(d);
          break;
        }
        case es.CIRCLE: {
          h.type = "ellipse";
          break;
        }
        case es.DIAMOND: {
          h.type = "diamond";
          break;
        }
      }
      n.push(h);
    }), t.edges.forEach((a) => {
      let o = [];
      const l = s(a.start), u = s(a.end);
      l && l === u && (o = r(l));
      const { startX: h, startY: f, reflectionPoints: d } = a, p = d.map((A) => [
        A.x - d[0].x,
        A.y - d[0].y
      ]), y = uk(a.type), _ = {
        id: `${a.start}_${a.end}`,
        type: "arrow",
        groupIds: o,
        x: h,
        y: f,
        // 4 and 2 are the Excalidraw's stroke width of thick and thin respectively
        // TODO: use constant exported from Excalidraw package
        strokeWidth: a.stroke === "thick" ? 4 : 2,
        strokeStyle: a.stroke === "dotted" ? "dashed" : void 0,
        points: p,
        ...a.text ? { label: { text: zl(a), fontSize: i, groupIds: o } } : {},
        roundness: {
          type: 2
        },
        ...y
      }, T = n.find((A) => A.id === a.start), v = n.find((A) => A.id === a.end);
      !T || !v || (_.start = {
        id: T.id || ""
      }, _.end = {
        id: v.id || ""
      }, n.push(_));
    }), {
      elements: n
    };
  }
});
let gr = (t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce((e, n) => (n &= 63, n < 36 ? e += n.toString(36) : n < 62 ? e += (n - 26).toString(36).toUpperCase() : n > 62 ? e += "-" : e += "_", e), "");
const yk = new Ou({
  converter: (t) => {
    const e = gr(), { width: n, height: i } = t, r = {
      type: "image",
      x: 0,
      y: 0,
      width: n,
      height: i,
      status: "saved",
      fileId: e
    };
    return { files: {
      [e]: {
        id: e,
        mimeType: t.mimeType,
        dataURL: t.dataURL
      }
    }, elements: [r] };
  }
}), nf = (t) => t.replace(/\\n/g, `
`), ko = (t) => {
  const e = {
    type: "line",
    x: t.startX,
    y: t.startY,
    points: [
      [0, 0],
      [t.endX - t.startX, t.endY - t.startY]
    ],
    width: t.endX - t.startX,
    height: t.endY - t.startY,
    strokeStyle: t.strokeStyle || "solid",
    strokeColor: t.strokeColor || "#000",
    strokeWidth: t.strokeWidth || 1
  };
  return t.groupId && Object.assign(e, { groupIds: [t.groupId] }), t.id && Object.assign(e, { id: t.id }), e;
}, Bc = (t) => {
  const e = {
    type: "text",
    x: t.x,
    y: t.y,
    width: t.width,
    height: t.height,
    text: nf(t.text) || "",
    fontSize: t.fontSize,
    verticalAlign: "middle"
  };
  return t.groupId && Object.assign(e, { groupIds: [t.groupId] }), t.id && Object.assign(e, { id: t.id }), e;
}, co = (t) => {
  let e = {};
  t.type === "rectangle" && t.subtype === "activation" && (e = {
    backgroundColor: "#e9ecef",
    fillStyle: "solid"
  });
  const n = {
    id: t.id,
    type: t.type,
    x: t.x,
    y: t.y,
    width: t.width,
    height: t.height,
    label: {
      text: nf(t?.label?.text || ""),
      fontSize: t?.label?.fontSize,
      verticalAlign: t.label?.verticalAlign || "middle",
      strokeColor: t.label?.color || "#000",
      groupIds: t.groupId ? [t.groupId] : []
    },
    strokeStyle: t?.strokeStyle,
    strokeWidth: t?.strokeWidth,
    strokeColor: t?.strokeColor,
    backgroundColor: t?.bgColor,
    fillStyle: "solid",
    ...e
  };
  return t.groupId && Object.assign(n, { groupIds: [t.groupId] }), n;
}, Oy = (t) => {
  const e = {
    type: "arrow",
    x: t.startX,
    y: t.startY,
    points: t.points || [
      [0, 0],
      [t.endX - t.startX, t.endY - t.startY]
    ],
    width: t.endX - t.startX,
    height: t.endY - t.startY,
    strokeStyle: t?.strokeStyle || "solid",
    endArrowhead: t?.endArrowhead || null,
    startArrowhead: t?.startArrowhead || null,
    label: {
      text: nf(t?.label?.text || ""),
      fontSize: 16
    },
    roundness: {
      type: 2
    },
    start: t.start,
    end: t.end
  };
  return t.groupId && Object.assign(e, { groupIds: [t.groupId] }), e;
}, mk = new Ou({
  converter: (t) => {
    const e = [], n = [];
    if (Object.values(t.nodes).forEach((i) => {
      !i || !i.length || i.forEach((r) => {
        let s;
        switch (r.type) {
          case "line":
            s = ko(r);
            break;
          case "rectangle":
          case "ellipse":
            s = co(r);
            break;
          case "text":
            s = Bc(r);
            break;
          default:
            throw `unknown type ${r.type}`;
        }
        r.type === "rectangle" && r?.subtype === "activation" ? n.push(s) : e.push(s);
      });
    }), Object.values(t.lines).forEach((i) => {
      i && e.push(ko(i));
    }), Object.values(t.arrows).forEach((i) => {
      i && (e.push(Oy(i)), i.sequenceNumber && e.push(co(i.sequenceNumber)));
    }), e.push(...n), t.loops) {
      const { lines: i, texts: r, nodes: s } = t.loops;
      i.forEach((a) => {
        e.push(ko(a));
      }), r.forEach((a) => {
        e.push(Bc(a));
      }), s.forEach((a) => {
        e.push(co(a));
      });
    }
    return t.groups && t.groups.forEach((i) => {
      const { actorKeys: r, name: s } = i;
      let a = 1 / 0, o = 1 / 0, l = 0, u = 0;
      if (!r.length)
        return;
      e.filter((w) => {
        if (w.id) {
          const b = w.id.indexOf("-"), F = w.id.substring(0, b);
          return r.includes(F);
        }
      }).forEach((w) => {
        if (w.x === void 0 || w.y === void 0 || w.width === void 0 || w.height === void 0)
          throw new Error(`Actor attributes missing ${w}`);
        a = Math.min(a, w.x), o = Math.min(o, w.y), l = Math.max(l, w.x + w.width), u = Math.max(u, w.y + w.height);
      });
      const f = 10, d = a - f, p = o - f, y = l - a + f * 2, m = u - o + f * 2, _ = gr(), T = co({
        type: "rectangle",
        x: d,
        y: p,
        width: y,
        height: m,
        bgColor: i.fill,
        id: _
      });
      e.unshift(T);
      const v = gr(), A = [_];
      e.forEach((w) => {
        if (w.type !== "frame") {
          if (w.x === void 0 || w.y === void 0 || w.width === void 0 || w.height === void 0)
            throw new Error(`Element attributes missing ${w}`);
          if (w.x >= a && w.x + w.width <= l && w.y >= o && w.y + w.height <= u) {
            const b = w.id || gr();
            w.id || Object.assign(w, { id: b }), A.push(b);
          }
        }
      });
      const L = {
        type: "frame",
        id: v,
        name: s,
        children: A
      };
      e.push(L);
    }), { elements: e };
  }
}), xk = new Ou({
  converter: (t) => {
    const e = [];
    return Object.values(t.nodes).forEach((n) => {
      !n || !n.length || n.forEach((i) => {
        let r;
        switch (i.type) {
          case "line":
            r = ko(i);
            break;
          case "rectangle":
          case "ellipse":
            r = co(i);
            break;
          case "text":
            r = Bc(i);
            break;
          default:
            throw `unknown type ${i.type}`;
        }
        e.push(r);
      });
    }), Object.values(t.lines).forEach((n) => {
      n && e.push(ko(n));
    }), Object.values(t.arrows).forEach((n) => {
      if (!n)
        return;
      const i = Oy(n);
      e.push(i);
    }), Object.values(t.text).forEach((n) => {
      const i = Bc(n);
      e.push(i);
    }), Object.values(t.namespaces).forEach((n) => {
      const i = Object.keys(n.classes), r = [...i], s = [...t.lines, ...t.arrows, ...t.text];
      i.forEach((o) => {
        const l = s.filter((u) => u.metadata && u.metadata.classId === o).map((u) => u.id);
        l.length && r.push(...l);
      });
      const a = {
        type: "frame",
        id: gr(),
        name: n.id,
        children: r
      };
      e.push(a);
    }), { elements: e };
  }
}), bk = (t, e = {}) => {
  switch (t.type) {
    case "graphImage":
      return yk.convert(t, e);
    case "flowchart":
      return gk.convert(t, e);
    case "sequence":
      return mk.convert(t, e);
    case "class":
      return xk.convert(t, e);
    default:
      throw new Error(`graphToExcalidraw: unknown graph type "${t.type}, only flowcharts are supported!"`);
  }
};
function Ry(t) {
  for (var e = [], n = 1; n < arguments.length; n++)
    e[n - 1] = arguments[n];
  var i = Array.from(typeof t == "string" ? [t] : t);
  i[i.length - 1] = i[i.length - 1].replace(/\r?\n([\t ]*)$/, "");
  var r = i.reduce(function(o, l) {
    var u = l.match(/\n([\t ]+|(?!\s).)/g);
    return u ? o.concat(u.map(function(h) {
      var f, d;
      return (d = (f = h.match(/[\t ]/g)) === null || f === void 0 ? void 0 : f.length) !== null && d !== void 0 ? d : 0;
    })) : o;
  }, []);
  if (r.length) {
    var s = new RegExp(`
[	 ]{` + Math.min.apply(Math, r) + "}", "g");
    i = i.map(function(o) {
      return o.replace(s, `
`);
    });
  }
  i[0] = i[0].replace(/^\r?\n/, "");
  var a = i[0];
  return e.forEach(function(o, l) {
    var u = a.match(/(?:^|\n)( *)$/), h = u ? u[1] : "", f = o;
    typeof o == "string" && o.includes(`
`) && (f = String(o).split(`
`).map(function(d, p) {
      return p === 0 ? d : "" + h + d;
    }).join(`
`)), a += f + i[l + 1];
  }), a;
}
var sc = { exports: {} }, _k = sc.exports, ep;
function kk() {
  return ep || (ep = 1, (function(t, e) {
    (function(n, i) {
      t.exports = i();
    })(_k, (function() {
      var n = 1e3, i = 6e4, r = 36e5, s = "millisecond", a = "second", o = "minute", l = "hour", u = "day", h = "week", f = "month", d = "quarter", p = "year", y = "date", m = "Invalid Date", _ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, T = /\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, v = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(P) {
        var R = ["th", "st", "nd", "rd"], M = P % 100;
        return "[" + P + (R[(M - 20) % 10] || R[M] || R[0]) + "]";
      } }, A = function(P, R, M) {
        var B = String(P);
        return !B || B.length >= R ? P : "" + Array(R + 1 - B.length).join(M) + P;
      }, L = { s: A, z: function(P) {
        var R = -P.utcOffset(), M = Math.abs(R), B = Math.floor(M / 60), N = M % 60;
        return (R <= 0 ? "+" : "-") + A(B, 2, "0") + ":" + A(N, 2, "0");
      }, m: function P(R, M) {
        if (R.date() < M.date()) return -P(M, R);
        var B = 12 * (M.year() - R.year()) + (M.month() - R.month()), N = R.clone().add(B, f), D = M - N < 0, E = R.clone().add(B + (D ? -1 : 1), f);
        return +(-(B + (M - N) / (D ? N - E : E - N)) || 0);
      }, a: function(P) {
        return P < 0 ? Math.ceil(P) || 0 : Math.floor(P);
      }, p: function(P) {
        return { M: f, y: p, w: h, d: u, D: y, h: l, m: o, s: a, ms: s, Q: d }[P] || String(P || "").toLowerCase().replace(/s$/, "");
      }, u: function(P) {
        return P === void 0;
      } }, w = "en", b = {};
      b[w] = v;
      var F = "$isDayjsObject", S = function(P) {
        return P instanceof I || !(!P || !P[F]);
      }, x = function P(R, M, B) {
        var N;
        if (!R) return w;
        if (typeof R == "string") {
          var D = R.toLowerCase();
          b[D] && (N = D), M && (b[D] = M, N = D);
          var E = R.split("-");
          if (!N && E.length > 1) return P(E[0]);
        } else {
          var V = R.name;
          b[V] = R, N = V;
        }
        return !B && N && (w = N), N || !B && w;
      }, C = function(P, R) {
        if (S(P)) return P.clone();
        var M = typeof R == "object" ? R : {};
        return M.date = P, M.args = arguments, new I(M);
      }, g = L;
      g.l = x, g.i = S, g.w = function(P, R) {
        return C(P, { locale: R.$L, utc: R.$u, x: R.$x, $offset: R.$offset });
      };
      var I = (function() {
        function P(M) {
          this.$L = x(M.locale, null, !0), this.parse(M), this.$x = this.$x || M.x || {}, this[F] = !0;
        }
        var R = P.prototype;
        return R.parse = function(M) {
          this.$d = (function(B) {
            var N = B.date, D = B.utc;
            if (N === null) return /* @__PURE__ */ new Date(NaN);
            if (g.u(N)) return /* @__PURE__ */ new Date();
            if (N instanceof Date) return new Date(N);
            if (typeof N == "string" && !/Z$/i.test(N)) {
              var E = N.match(_);
              if (E) {
                var V = E[2] - 1 || 0, nt = (E[7] || "0").substring(0, 3);
                return D ? new Date(Date.UTC(E[1], V, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, nt)) : new Date(E[1], V, E[3] || 1, E[4] || 0, E[5] || 0, E[6] || 0, nt);
              }
            }
            return new Date(N);
          })(M), this.init();
        }, R.init = function() {
          var M = this.$d;
          this.$y = M.getFullYear(), this.$M = M.getMonth(), this.$D = M.getDate(), this.$W = M.getDay(), this.$H = M.getHours(), this.$m = M.getMinutes(), this.$s = M.getSeconds(), this.$ms = M.getMilliseconds();
        }, R.$utils = function() {
          return g;
        }, R.isValid = function() {
          return this.$d.toString() !== m;
        }, R.isSame = function(M, B) {
          var N = C(M);
          return this.startOf(B) <= N && N <= this.endOf(B);
        }, R.isAfter = function(M, B) {
          return C(M) < this.startOf(B);
        }, R.isBefore = function(M, B) {
          return this.endOf(B) < C(M);
        }, R.$g = function(M, B, N) {
          return g.u(M) ? this[B] : this.set(N, M);
        }, R.unix = function() {
          return Math.floor(this.valueOf() / 1e3);
        }, R.valueOf = function() {
          return this.$d.getTime();
        }, R.startOf = function(M, B) {
          var N = this, D = !!g.u(B) || B, E = g.p(M), V = function(W, Z) {
            var q = g.w(N.$u ? Date.UTC(N.$y, Z, W) : new Date(N.$y, Z, W), N);
            return D ? q : q.endOf(u);
          }, nt = function(W, Z) {
            return g.w(N.toDate()[W].apply(N.toDate("s"), (D ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(Z)), N);
          }, O = this.$W, ct = this.$M, X = this.$D, H = "set" + (this.$u ? "UTC" : "");
          switch (E) {
            case p:
              return D ? V(1, 0) : V(31, 11);
            case f:
              return D ? V(1, ct) : V(0, ct + 1);
            case h:
              var it = this.$locale().weekStart || 0, ot = (O < it ? O + 7 : O) - it;
              return V(D ? X - ot : X + (6 - ot), ct);
            case u:
            case y:
              return nt(H + "Hours", 0);
            case l:
              return nt(H + "Minutes", 1);
            case o:
              return nt(H + "Seconds", 2);
            case a:
              return nt(H + "Milliseconds", 3);
            default:
              return this.clone();
          }
        }, R.endOf = function(M) {
          return this.startOf(M, !1);
        }, R.$set = function(M, B) {
          var N, D = g.p(M), E = "set" + (this.$u ? "UTC" : ""), V = (N = {}, N[u] = E + "Date", N[y] = E + "Date", N[f] = E + "Month", N[p] = E + "FullYear", N[l] = E + "Hours", N[o] = E + "Minutes", N[a] = E + "Seconds", N[s] = E + "Milliseconds", N)[D], nt = D === u ? this.$D + (B - this.$W) : B;
          if (D === f || D === p) {
            var O = this.clone().set(y, 1);
            O.$d[V](nt), O.init(), this.$d = O.set(y, Math.min(this.$D, O.daysInMonth())).$d;
          } else V && this.$d[V](nt);
          return this.init(), this;
        }, R.set = function(M, B) {
          return this.clone().$set(M, B);
        }, R.get = function(M) {
          return this[g.p(M)]();
        }, R.add = function(M, B) {
          var N, D = this;
          M = Number(M);
          var E = g.p(B), V = function(ct) {
            var X = C(D);
            return g.w(X.date(X.date() + Math.round(ct * M)), D);
          };
          if (E === f) return this.set(f, this.$M + M);
          if (E === p) return this.set(p, this.$y + M);
          if (E === u) return V(1);
          if (E === h) return V(7);
          var nt = (N = {}, N[o] = i, N[l] = r, N[a] = n, N)[E] || 1, O = this.$d.getTime() + M * nt;
          return g.w(O, this);
        }, R.subtract = function(M, B) {
          return this.add(-1 * M, B);
        }, R.format = function(M) {
          var B = this, N = this.$locale();
          if (!this.isValid()) return N.invalidDate || m;
          var D = M || "YYYY-MM-DDTHH:mm:ssZ", E = g.z(this), V = this.$H, nt = this.$m, O = this.$M, ct = N.weekdays, X = N.months, H = N.meridiem, it = function(Z, q, G, U) {
            return Z && (Z[q] || Z(B, D)) || G[q].slice(0, U);
          }, ot = function(Z) {
            return g.s(V % 12 || 12, Z, "0");
          }, W = H || function(Z, q, G) {
            var U = Z < 12 ? "AM" : "PM";
            return G ? U.toLowerCase() : U;
          };
          return D.replace(T, (function(Z, q) {
            return q || (function(G) {
              switch (G) {
                case "YY":
                  return String(B.$y).slice(-2);
                case "YYYY":
                  return g.s(B.$y, 4, "0");
                case "M":
                  return O + 1;
                case "MM":
                  return g.s(O + 1, 2, "0");
                case "MMM":
                  return it(N.monthsShort, O, X, 3);
                case "MMMM":
                  return it(X, O);
                case "D":
                  return B.$D;
                case "DD":
                  return g.s(B.$D, 2, "0");
                case "d":
                  return String(B.$W);
                case "dd":
                  return it(N.weekdaysMin, B.$W, ct, 2);
                case "ddd":
                  return it(N.weekdaysShort, B.$W, ct, 3);
                case "dddd":
                  return ct[B.$W];
                case "H":
                  return String(V);
                case "HH":
                  return g.s(V, 2, "0");
                case "h":
                  return ot(1);
                case "hh":
                  return ot(2);
                case "a":
                  return W(V, nt, !0);
                case "A":
                  return W(V, nt, !1);
                case "m":
                  return String(nt);
                case "mm":
                  return g.s(nt, 2, "0");
                case "s":
                  return String(B.$s);
                case "ss":
                  return g.s(B.$s, 2, "0");
                case "SSS":
                  return g.s(B.$ms, 3, "0");
                case "Z":
                  return E;
              }
              return null;
            })(Z) || E.replace(":", "");
          }));
        }, R.utcOffset = function() {
          return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
        }, R.diff = function(M, B, N) {
          var D, E = this, V = g.p(B), nt = C(M), O = (nt.utcOffset() - this.utcOffset()) * i, ct = this - nt, X = function() {
            return g.m(E, nt);
          };
          switch (V) {
            case p:
              D = X() / 12;
              break;
            case f:
              D = X();
              break;
            case d:
              D = X() / 3;
              break;
            case h:
              D = (ct - O) / 6048e5;
              break;
            case u:
              D = (ct - O) / 864e5;
              break;
            case l:
              D = ct / r;
              break;
            case o:
              D = ct / i;
              break;
            case a:
              D = ct / n;
              break;
            default:
              D = ct;
          }
          return N ? D : g.a(D);
        }, R.daysInMonth = function() {
          return this.endOf(f).$D;
        }, R.$locale = function() {
          return b[this.$L];
        }, R.locale = function(M, B) {
          if (!M) return this.$L;
          var N = this.clone(), D = x(M, B, !0);
          return D && (N.$L = D), N;
        }, R.clone = function() {
          return g.w(this.$d, this);
        }, R.toDate = function() {
          return new Date(this.valueOf());
        }, R.toJSON = function() {
          return this.isValid() ? this.toISOString() : null;
        }, R.toISOString = function() {
          return this.$d.toISOString();
        }, R.toString = function() {
          return this.$d.toUTCString();
        }, P;
      })(), k = I.prototype;
      return C.prototype = k, [["$ms", s], ["$s", a], ["$m", o], ["$H", l], ["$W", u], ["$M", f], ["$y", p], ["$D", y]].forEach((function(P) {
        k[P[1]] = function(R) {
          return this.$g(R, P[0], P[1]);
        };
      })), C.extend = function(P, R) {
        return P.$i || (P(R, I, C), P.$i = !0), C;
      }, C.locale = x, C.isDayjs = S, C.unix = function(P) {
        return C(1e3 * P);
      }, C.en = b[w], C.Ls = b, C.p = {}, C;
    }));
  })(sc)), sc.exports;
}
var Tk = kk();
const ln = /* @__PURE__ */ Nu(Tk);
function ac(t, e) {
  return t == null || e == null ? NaN : t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function wk(t, e) {
  return t == null || e == null ? NaN : e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function rf(t) {
  let e, n, i;
  t.length !== 2 ? (e = ac, n = (o, l) => ac(t(o), l), i = (o, l) => t(o) - l) : (e = t === ac || t === wk ? t : vk, n = t, i = t);
  function r(o, l, u = 0, h = o.length) {
    if (u < h) {
      if (e(l, l) !== 0) return h;
      do {
        const f = u + h >>> 1;
        n(o[f], l) < 0 ? u = f + 1 : h = f;
      } while (u < h);
    }
    return u;
  }
  function s(o, l, u = 0, h = o.length) {
    if (u < h) {
      if (e(l, l) !== 0) return h;
      do {
        const f = u + h >>> 1;
        n(o[f], l) <= 0 ? u = f + 1 : h = f;
      } while (u < h);
    }
    return u;
  }
  function a(o, l, u = 0, h = o.length) {
    const f = r(o, l, u, h - 1);
    return f > u && i(o[f - 1], l) > -i(o[f], l) ? f - 1 : f;
  }
  return { left: r, center: a, right: s };
}
function vk() {
  return 0;
}
function Ek(t) {
  return t === null ? NaN : +t;
}
const Ck = rf(ac), Sk = Ck.right;
rf(Ek).center;
class np extends Map {
  constructor(e, n = Ik) {
    if (super(), Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: n } }), e != null) for (const [i, r] of e) this.set(i, r);
  }
  get(e) {
    return super.get(ip(this, e));
  }
  has(e) {
    return super.has(ip(this, e));
  }
  set(e, n) {
    return super.set(Ak(this, e), n);
  }
  delete(e) {
    return super.delete(Lk(this, e));
  }
}
function ip({ _intern: t, _key: e }, n) {
  const i = e(n);
  return t.has(i) ? t.get(i) : n;
}
function Ak({ _intern: t, _key: e }, n) {
  const i = e(n);
  return t.has(i) ? t.get(i) : (t.set(i, n), n);
}
function Lk({ _intern: t, _key: e }, n) {
  const i = e(n);
  return t.has(i) && (n = t.get(i), t.delete(i)), n;
}
function Ik(t) {
  return t !== null && typeof t == "object" ? t.valueOf() : t;
}
const Bk = Math.sqrt(50), Dk = Math.sqrt(10), Nk = Math.sqrt(2);
function Dc(t, e, n) {
  const i = (e - t) / Math.max(0, n), r = Math.floor(Math.log10(i)), s = i / Math.pow(10, r), a = s >= Bk ? 10 : s >= Dk ? 5 : s >= Nk ? 2 : 1;
  let o, l, u;
  return r < 0 ? (u = Math.pow(10, -r) / a, o = Math.round(t * u), l = Math.round(e * u), o / u < t && ++o, l / u > e && --l, u = -u) : (u = Math.pow(10, r) * a, o = Math.round(t / u), l = Math.round(e / u), o * u < t && ++o, l * u > e && --l), l < o && 0.5 <= n && n < 2 ? Dc(t, e, n * 2) : [o, l, u];
}
function Fk(t, e, n) {
  if (e = +e, t = +t, n = +n, !(n > 0)) return [];
  if (t === e) return [t];
  const i = e < t, [r, s, a] = i ? Dc(e, t, n) : Dc(t, e, n);
  if (!(s >= r)) return [];
  const o = s - r + 1, l = new Array(o);
  if (i)
    if (a < 0) for (let u = 0; u < o; ++u) l[u] = (s - u) / -a;
    else for (let u = 0; u < o; ++u) l[u] = (s - u) * a;
  else if (a < 0) for (let u = 0; u < o; ++u) l[u] = (r + u) / -a;
  else for (let u = 0; u < o; ++u) l[u] = (r + u) * a;
  return l;
}
function vd(t, e, n) {
  return e = +e, t = +t, n = +n, Dc(t, e, n)[2];
}
function Ed(t, e, n) {
  e = +e, t = +t, n = +n;
  const i = e < t, r = i ? vd(e, t, n) : vd(t, e, n);
  return (i ? -1 : 1) * (r < 0 ? 1 / -r : r);
}
function Ok(t, e) {
  let n;
  if (e === void 0)
    for (const i of t)
      i != null && (n < i || n === void 0 && i >= i) && (n = i);
  else {
    let i = -1;
    for (let r of t)
      (r = e(r, ++i, t)) != null && (n < r || n === void 0 && r >= r) && (n = r);
  }
  return n;
}
function Rk(t, e) {
  let n;
  if (e === void 0)
    for (const i of t)
      i != null && (n > i || n === void 0 && i >= i) && (n = i);
  else {
    let i = -1;
    for (let r of t)
      (r = e(r, ++i, t)) != null && (n > r || n === void 0 && r >= r) && (n = r);
  }
  return n;
}
function Mk(t, e, n) {
  t = +t, e = +e, n = (r = arguments.length) < 2 ? (e = t, t = 0, 1) : r < 3 ? 1 : +n;
  for (var i = -1, r = Math.max(0, Math.ceil((e - t) / n)) | 0, s = new Array(r); ++i < r; )
    s[i] = t + i * n;
  return s;
}
function Pk(t) {
  return t;
}
var oc = 1, Nh = 2, Cd = 3, Vl = 4, rp = 1e-6;
function zk(t) {
  return "translate(" + t + ",0)";
}
function Vk(t) {
  return "translate(0," + t + ")";
}
function qk(t) {
  return (e) => +t(e);
}
function $k(t, e) {
  return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (n) => +t(n) + e;
}
function Yk() {
  return !this.__axis;
}
function My(t, e) {
  var n = [], i = null, r = null, s = 6, a = 6, o = 3, l = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, u = t === oc || t === Vl ? -1 : 1, h = t === Vl || t === Nh ? "x" : "y", f = t === oc || t === Cd ? zk : Vk;
  function d(p) {
    var y = i ?? (e.ticks ? e.ticks.apply(e, n) : e.domain()), m = r ?? (e.tickFormat ? e.tickFormat.apply(e, n) : Pk), _ = Math.max(s, 0) + o, T = e.range(), v = +T[0] + l, A = +T[T.length - 1] + l, L = (e.bandwidth ? $k : qk)(e.copy(), l), w = p.selection ? p.selection() : p, b = w.selectAll(".domain").data([null]), F = w.selectAll(".tick").data(y, e).order(), S = F.exit(), x = F.enter().append("g").attr("class", "tick"), C = F.select("line"), g = F.select("text");
    b = b.merge(b.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), F = F.merge(x), C = C.merge(x.append("line").attr("stroke", "currentColor").attr(h + "2", u * s)), g = g.merge(x.append("text").attr("fill", "currentColor").attr(h, u * _).attr("dy", t === oc ? "0em" : t === Cd ? "0.71em" : "0.32em")), p !== w && (b = b.transition(p), F = F.transition(p), C = C.transition(p), g = g.transition(p), S = S.transition(p).attr("opacity", rp).attr("transform", function(I) {
      return isFinite(I = L(I)) ? f(I + l) : this.getAttribute("transform");
    }), x.attr("opacity", rp).attr("transform", function(I) {
      var k = this.parentNode.__axis;
      return f((k && isFinite(k = k(I)) ? k : L(I)) + l);
    })), S.remove(), b.attr("d", t === Vl || t === Nh ? a ? "M" + u * a + "," + v + "H" + l + "V" + A + "H" + u * a : "M" + l + "," + v + "V" + A : a ? "M" + v + "," + u * a + "V" + l + "H" + A + "V" + u * a : "M" + v + "," + l + "H" + A), F.attr("opacity", 1).attr("transform", function(I) {
      return f(L(I) + l);
    }), C.attr(h + "2", u * s), g.attr(h, u * _).text(m), w.filter(Yk).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === Nh ? "start" : t === Vl ? "end" : "middle"), w.each(function() {
      this.__axis = L;
    });
  }
  return d.scale = function(p) {
    return arguments.length ? (e = p, d) : e;
  }, d.ticks = function() {
    return n = Array.from(arguments), d;
  }, d.tickArguments = function(p) {
    return arguments.length ? (n = p == null ? [] : Array.from(p), d) : n.slice();
  }, d.tickValues = function(p) {
    return arguments.length ? (i = p == null ? null : Array.from(p), d) : i && i.slice();
  }, d.tickFormat = function(p) {
    return arguments.length ? (r = p, d) : r;
  }, d.tickSize = function(p) {
    return arguments.length ? (s = a = +p, d) : s;
  }, d.tickSizeInner = function(p) {
    return arguments.length ? (s = +p, d) : s;
  }, d.tickSizeOuter = function(p) {
    return arguments.length ? (a = +p, d) : a;
  }, d.tickPadding = function(p) {
    return arguments.length ? (o = +p, d) : o;
  }, d.offset = function(p) {
    return arguments.length ? (l = +p, d) : l;
  }, d;
}
function Wk(t) {
  return My(oc, t);
}
function Uk(t) {
  return My(Cd, t);
}
var Hk = { value: () => {
} };
function Py() {
  for (var t = 0, e = arguments.length, n = {}, i; t < e; ++t) {
    if (!(i = arguments[t] + "") || i in n || /[\s.]/.test(i)) throw new Error("illegal type: " + i);
    n[i] = [];
  }
  return new lc(n);
}
function lc(t) {
  this._ = t;
}
function Gk(t, e) {
  return t.trim().split(/^|\s+/).map(function(n) {
    var i = "", r = n.indexOf(".");
    if (r >= 0 && (i = n.slice(r + 1), n = n.slice(0, r)), n && !e.hasOwnProperty(n)) throw new Error("unknown type: " + n);
    return { type: n, name: i };
  });
}
lc.prototype = Py.prototype = {
  constructor: lc,
  on: function(t, e) {
    var n = this._, i = Gk(t + "", n), r, s = -1, a = i.length;
    if (arguments.length < 2) {
      for (; ++s < a; ) if ((r = (t = i[s]).type) && (r = jk(n[r], t.name))) return r;
      return;
    }
    if (e != null && typeof e != "function") throw new Error("invalid callback: " + e);
    for (; ++s < a; )
      if (r = (t = i[s]).type) n[r] = sp(n[r], t.name, e);
      else if (e == null) for (r in n) n[r] = sp(n[r], t.name, null);
    return this;
  },
  copy: function() {
    var t = {}, e = this._;
    for (var n in e) t[n] = e[n].slice();
    return new lc(t);
  },
  call: function(t, e) {
    if ((r = arguments.length - 2) > 0) for (var n = new Array(r), i = 0, r, s; i < r; ++i) n[i] = arguments[i + 2];
    if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
    for (s = this._[t], i = 0, r = s.length; i < r; ++i) s[i].value.apply(e, n);
  },
  apply: function(t, e, n) {
    if (!this._.hasOwnProperty(t)) throw new Error("unknown type: " + t);
    for (var i = this._[t], r = 0, s = i.length; r < s; ++r) i[r].value.apply(e, n);
  }
};
function jk(t, e) {
  for (var n = 0, i = t.length, r; n < i; ++n)
    if ((r = t[n]).name === e)
      return r.value;
}
function sp(t, e, n) {
  for (var i = 0, r = t.length; i < r; ++i)
    if (t[i].name === e) {
      t[i] = Hk, t = t.slice(0, i).concat(t.slice(i + 1));
      break;
    }
  return n != null && t.push({ name: e, value: n }), t;
}
var Sd = "http://www.w3.org/1999/xhtml";
const ap = {
  svg: "http://www.w3.org/2000/svg",
  xhtml: Sd,
  xlink: "http://www.w3.org/1999/xlink",
  xml: "http://www.w3.org/XML/1998/namespace",
  xmlns: "http://www.w3.org/2000/xmlns/"
};
function Ru(t) {
  var e = t += "", n = e.indexOf(":");
  return n >= 0 && (e = t.slice(0, n)) !== "xmlns" && (t = t.slice(n + 1)), ap.hasOwnProperty(e) ? { space: ap[e], local: t } : t;
}
function Xk(t) {
  return function() {
    var e = this.ownerDocument, n = this.namespaceURI;
    return n === Sd && e.documentElement.namespaceURI === Sd ? e.createElement(t) : e.createElementNS(n, t);
  };
}
function Kk(t) {
  return function() {
    return this.ownerDocument.createElementNS(t.space, t.local);
  };
}
function zy(t) {
  var e = Ru(t);
  return (e.local ? Kk : Xk)(e);
}
function Qk() {
}
function sf(t) {
  return t == null ? Qk : function() {
    return this.querySelector(t);
  };
}
function Zk(t) {
  typeof t != "function" && (t = sf(t));
  for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
    for (var s = e[r], a = s.length, o = i[r] = new Array(a), l, u, h = 0; h < a; ++h)
      (l = s[h]) && (u = t.call(l, l.__data__, h, s)) && ("__data__" in l && (u.__data__ = l.__data__), o[h] = u);
  return new Tn(i, this._parents);
}
function Vy(t) {
  return t == null ? [] : Array.isArray(t) ? t : Array.from(t);
}
function Jk() {
  return [];
}
function qy(t) {
  return t == null ? Jk : function() {
    return this.querySelectorAll(t);
  };
}
function t6(t) {
  return function() {
    return Vy(t.apply(this, arguments));
  };
}
function e6(t) {
  typeof t == "function" ? t = t6(t) : t = qy(t);
  for (var e = this._groups, n = e.length, i = [], r = [], s = 0; s < n; ++s)
    for (var a = e[s], o = a.length, l, u = 0; u < o; ++u)
      (l = a[u]) && (i.push(t.call(l, l.__data__, u, a)), r.push(l));
  return new Tn(i, r);
}
function $y(t) {
  return function() {
    return this.matches(t);
  };
}
function Yy(t) {
  return function(e) {
    return e.matches(t);
  };
}
var n6 = Array.prototype.find;
function i6(t) {
  return function() {
    return n6.call(this.children, t);
  };
}
function r6() {
  return this.firstElementChild;
}
function s6(t) {
  return this.select(t == null ? r6 : i6(typeof t == "function" ? t : Yy(t)));
}
var a6 = Array.prototype.filter;
function o6() {
  return Array.from(this.children);
}
function l6(t) {
  return function() {
    return a6.call(this.children, t);
  };
}
function c6(t) {
  return this.selectAll(t == null ? o6 : l6(typeof t == "function" ? t : Yy(t)));
}
function u6(t) {
  typeof t != "function" && (t = $y(t));
  for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
    for (var s = e[r], a = s.length, o = i[r] = [], l, u = 0; u < a; ++u)
      (l = s[u]) && t.call(l, l.__data__, u, s) && o.push(l);
  return new Tn(i, this._parents);
}
function Wy(t) {
  return new Array(t.length);
}
function h6() {
  return new Tn(this._enter || this._groups.map(Wy), this._parents);
}
function Nc(t, e) {
  this.ownerDocument = t.ownerDocument, this.namespaceURI = t.namespaceURI, this._next = null, this._parent = t, this.__data__ = e;
}
Nc.prototype = {
  constructor: Nc,
  appendChild: function(t) {
    return this._parent.insertBefore(t, this._next);
  },
  insertBefore: function(t, e) {
    return this._parent.insertBefore(t, e);
  },
  querySelector: function(t) {
    return this._parent.querySelector(t);
  },
  querySelectorAll: function(t) {
    return this._parent.querySelectorAll(t);
  }
};
function d6(t) {
  return function() {
    return t;
  };
}
function f6(t, e, n, i, r, s) {
  for (var a = 0, o, l = e.length, u = s.length; a < u; ++a)
    (o = e[a]) ? (o.__data__ = s[a], i[a] = o) : n[a] = new Nc(t, s[a]);
  for (; a < l; ++a)
    (o = e[a]) && (r[a] = o);
}
function p6(t, e, n, i, r, s, a) {
  var o, l, u = /* @__PURE__ */ new Map(), h = e.length, f = s.length, d = new Array(h), p;
  for (o = 0; o < h; ++o)
    (l = e[o]) && (d[o] = p = a.call(l, l.__data__, o, e) + "", u.has(p) ? r[o] = l : u.set(p, l));
  for (o = 0; o < f; ++o)
    p = a.call(t, s[o], o, s) + "", (l = u.get(p)) ? (i[o] = l, l.__data__ = s[o], u.delete(p)) : n[o] = new Nc(t, s[o]);
  for (o = 0; o < h; ++o)
    (l = e[o]) && u.get(d[o]) === l && (r[o] = l);
}
function g6(t) {
  return t.__data__;
}
function y6(t, e) {
  if (!arguments.length) return Array.from(this, g6);
  var n = e ? p6 : f6, i = this._parents, r = this._groups;
  typeof t != "function" && (t = d6(t));
  for (var s = r.length, a = new Array(s), o = new Array(s), l = new Array(s), u = 0; u < s; ++u) {
    var h = i[u], f = r[u], d = f.length, p = m6(t.call(h, h && h.__data__, u, i)), y = p.length, m = o[u] = new Array(y), _ = a[u] = new Array(y), T = l[u] = new Array(d);
    n(h, f, m, _, T, p, e);
    for (var v = 0, A = 0, L, w; v < y; ++v)
      if (L = m[v]) {
        for (v >= A && (A = v + 1); !(w = _[A]) && ++A < y; ) ;
        L._next = w || null;
      }
  }
  return a = new Tn(a, i), a._enter = o, a._exit = l, a;
}
function m6(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function x6() {
  return new Tn(this._exit || this._groups.map(Wy), this._parents);
}
function b6(t, e, n) {
  var i = this.enter(), r = this, s = this.exit();
  return typeof t == "function" ? (i = t(i), i && (i = i.selection())) : i = i.append(t + ""), e != null && (r = e(r), r && (r = r.selection())), n == null ? s.remove() : n(s), i && r ? i.merge(r).order() : r;
}
function _6(t) {
  for (var e = t.selection ? t.selection() : t, n = this._groups, i = e._groups, r = n.length, s = i.length, a = Math.min(r, s), o = new Array(r), l = 0; l < a; ++l)
    for (var u = n[l], h = i[l], f = u.length, d = o[l] = new Array(f), p, y = 0; y < f; ++y)
      (p = u[y] || h[y]) && (d[y] = p);
  for (; l < r; ++l)
    o[l] = n[l];
  return new Tn(o, this._parents);
}
function k6() {
  for (var t = this._groups, e = -1, n = t.length; ++e < n; )
    for (var i = t[e], r = i.length - 1, s = i[r], a; --r >= 0; )
      (a = i[r]) && (s && a.compareDocumentPosition(s) ^ 4 && s.parentNode.insertBefore(a, s), s = a);
  return this;
}
function T6(t) {
  t || (t = w6);
  function e(f, d) {
    return f && d ? t(f.__data__, d.__data__) : !f - !d;
  }
  for (var n = this._groups, i = n.length, r = new Array(i), s = 0; s < i; ++s) {
    for (var a = n[s], o = a.length, l = r[s] = new Array(o), u, h = 0; h < o; ++h)
      (u = a[h]) && (l[h] = u);
    l.sort(e);
  }
  return new Tn(r, this._parents).order();
}
function w6(t, e) {
  return t < e ? -1 : t > e ? 1 : t >= e ? 0 : NaN;
}
function v6() {
  var t = arguments[0];
  return arguments[0] = this, t.apply(null, arguments), this;
}
function E6() {
  return Array.from(this);
}
function C6() {
  for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
    for (var i = t[e], r = 0, s = i.length; r < s; ++r) {
      var a = i[r];
      if (a) return a;
    }
  return null;
}
function S6() {
  let t = 0;
  for (const e of this) ++t;
  return t;
}
function A6() {
  return !this.node();
}
function L6(t) {
  for (var e = this._groups, n = 0, i = e.length; n < i; ++n)
    for (var r = e[n], s = 0, a = r.length, o; s < a; ++s)
      (o = r[s]) && t.call(o, o.__data__, s, r);
  return this;
}
function I6(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function B6(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function D6(t, e) {
  return function() {
    this.setAttribute(t, e);
  };
}
function N6(t, e) {
  return function() {
    this.setAttributeNS(t.space, t.local, e);
  };
}
function F6(t, e) {
  return function() {
    var n = e.apply(this, arguments);
    n == null ? this.removeAttribute(t) : this.setAttribute(t, n);
  };
}
function O6(t, e) {
  return function() {
    var n = e.apply(this, arguments);
    n == null ? this.removeAttributeNS(t.space, t.local) : this.setAttributeNS(t.space, t.local, n);
  };
}
function R6(t, e) {
  var n = Ru(t);
  if (arguments.length < 2) {
    var i = this.node();
    return n.local ? i.getAttributeNS(n.space, n.local) : i.getAttribute(n);
  }
  return this.each((e == null ? n.local ? B6 : I6 : typeof e == "function" ? n.local ? O6 : F6 : n.local ? N6 : D6)(n, e));
}
function Uy(t) {
  return t.ownerDocument && t.ownerDocument.defaultView || t.document && t || t.defaultView;
}
function M6(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function P6(t, e, n) {
  return function() {
    this.style.setProperty(t, e, n);
  };
}
function z6(t, e, n) {
  return function() {
    var i = e.apply(this, arguments);
    i == null ? this.style.removeProperty(t) : this.style.setProperty(t, i, n);
  };
}
function V6(t, e, n) {
  return arguments.length > 1 ? this.each((e == null ? M6 : typeof e == "function" ? z6 : P6)(t, e, n ?? "")) : fa(this.node(), t);
}
function fa(t, e) {
  return t.style.getPropertyValue(e) || Uy(t).getComputedStyle(t, null).getPropertyValue(e);
}
function q6(t) {
  return function() {
    delete this[t];
  };
}
function $6(t, e) {
  return function() {
    this[t] = e;
  };
}
function Y6(t, e) {
  return function() {
    var n = e.apply(this, arguments);
    n == null ? delete this[t] : this[t] = n;
  };
}
function W6(t, e) {
  return arguments.length > 1 ? this.each((e == null ? q6 : typeof e == "function" ? Y6 : $6)(t, e)) : this.node()[t];
}
function Hy(t) {
  return t.trim().split(/^|\s+/);
}
function af(t) {
  return t.classList || new Gy(t);
}
function Gy(t) {
  this._node = t, this._names = Hy(t.getAttribute("class") || "");
}
Gy.prototype = {
  add: function(t) {
    var e = this._names.indexOf(t);
    e < 0 && (this._names.push(t), this._node.setAttribute("class", this._names.join(" ")));
  },
  remove: function(t) {
    var e = this._names.indexOf(t);
    e >= 0 && (this._names.splice(e, 1), this._node.setAttribute("class", this._names.join(" ")));
  },
  contains: function(t) {
    return this._names.indexOf(t) >= 0;
  }
};
function jy(t, e) {
  for (var n = af(t), i = -1, r = e.length; ++i < r; ) n.add(e[i]);
}
function Xy(t, e) {
  for (var n = af(t), i = -1, r = e.length; ++i < r; ) n.remove(e[i]);
}
function U6(t) {
  return function() {
    jy(this, t);
  };
}
function H6(t) {
  return function() {
    Xy(this, t);
  };
}
function G6(t, e) {
  return function() {
    (e.apply(this, arguments) ? jy : Xy)(this, t);
  };
}
function j6(t, e) {
  var n = Hy(t + "");
  if (arguments.length < 2) {
    for (var i = af(this.node()), r = -1, s = n.length; ++r < s; ) if (!i.contains(n[r])) return !1;
    return !0;
  }
  return this.each((typeof e == "function" ? G6 : e ? U6 : H6)(n, e));
}
function X6() {
  this.textContent = "";
}
function K6(t) {
  return function() {
    this.textContent = t;
  };
}
function Q6(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.textContent = e ?? "";
  };
}
function Z6(t) {
  return arguments.length ? this.each(t == null ? X6 : (typeof t == "function" ? Q6 : K6)(t)) : this.node().textContent;
}
function J6() {
  this.innerHTML = "";
}
function tT(t) {
  return function() {
    this.innerHTML = t;
  };
}
function eT(t) {
  return function() {
    var e = t.apply(this, arguments);
    this.innerHTML = e ?? "";
  };
}
function nT(t) {
  return arguments.length ? this.each(t == null ? J6 : (typeof t == "function" ? eT : tT)(t)) : this.node().innerHTML;
}
function iT() {
  this.nextSibling && this.parentNode.appendChild(this);
}
function rT() {
  return this.each(iT);
}
function sT() {
  this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
}
function aT() {
  return this.each(sT);
}
function oT(t) {
  var e = typeof t == "function" ? t : zy(t);
  return this.select(function() {
    return this.appendChild(e.apply(this, arguments));
  });
}
function lT() {
  return null;
}
function cT(t, e) {
  var n = typeof t == "function" ? t : zy(t), i = e == null ? lT : typeof e == "function" ? e : sf(e);
  return this.select(function() {
    return this.insertBefore(n.apply(this, arguments), i.apply(this, arguments) || null);
  });
}
function uT() {
  var t = this.parentNode;
  t && t.removeChild(this);
}
function hT() {
  return this.each(uT);
}
function dT() {
  var t = this.cloneNode(!1), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function fT() {
  var t = this.cloneNode(!0), e = this.parentNode;
  return e ? e.insertBefore(t, this.nextSibling) : t;
}
function pT(t) {
  return this.select(t ? fT : dT);
}
function gT(t) {
  return arguments.length ? this.property("__data__", t) : this.node().__data__;
}
function yT(t) {
  return function(e) {
    t.call(this, e, this.__data__);
  };
}
function mT(t) {
  return t.trim().split(/^|\s+/).map(function(e) {
    var n = "", i = e.indexOf(".");
    return i >= 0 && (n = e.slice(i + 1), e = e.slice(0, i)), { type: e, name: n };
  });
}
function xT(t) {
  return function() {
    var e = this.__on;
    if (e) {
      for (var n = 0, i = -1, r = e.length, s; n < r; ++n)
        s = e[n], (!t.type || s.type === t.type) && s.name === t.name ? this.removeEventListener(s.type, s.listener, s.options) : e[++i] = s;
      ++i ? e.length = i : delete this.__on;
    }
  };
}
function bT(t, e, n) {
  return function() {
    var i = this.__on, r, s = yT(e);
    if (i) {
      for (var a = 0, o = i.length; a < o; ++a)
        if ((r = i[a]).type === t.type && r.name === t.name) {
          this.removeEventListener(r.type, r.listener, r.options), this.addEventListener(r.type, r.listener = s, r.options = n), r.value = e;
          return;
        }
    }
    this.addEventListener(t.type, s, n), r = { type: t.type, name: t.name, value: e, listener: s, options: n }, i ? i.push(r) : this.__on = [r];
  };
}
function _T(t, e, n) {
  var i = mT(t + ""), r, s = i.length, a;
  if (arguments.length < 2) {
    var o = this.node().__on;
    if (o) {
      for (var l = 0, u = o.length, h; l < u; ++l)
        for (r = 0, h = o[l]; r < s; ++r)
          if ((a = i[r]).type === h.type && a.name === h.name)
            return h.value;
    }
    return;
  }
  for (o = e ? bT : xT, r = 0; r < s; ++r) this.each(o(i[r], e, n));
  return this;
}
function Ky(t, e, n) {
  var i = Uy(t), r = i.CustomEvent;
  typeof r == "function" ? r = new r(e, n) : (r = i.document.createEvent("Event"), n ? (r.initEvent(e, n.bubbles, n.cancelable), r.detail = n.detail) : r.initEvent(e, !1, !1)), t.dispatchEvent(r);
}
function kT(t, e) {
  return function() {
    return Ky(this, t, e);
  };
}
function TT(t, e) {
  return function() {
    return Ky(this, t, e.apply(this, arguments));
  };
}
function wT(t, e) {
  return this.each((typeof e == "function" ? TT : kT)(t, e));
}
function* vT() {
  for (var t = this._groups, e = 0, n = t.length; e < n; ++e)
    for (var i = t[e], r = 0, s = i.length, a; r < s; ++r)
      (a = i[r]) && (yield a);
}
var of = [null];
function Tn(t, e) {
  this._groups = t, this._parents = e;
}
function xl() {
  return new Tn([[document.documentElement]], of);
}
function ET() {
  return this;
}
Tn.prototype = xl.prototype = {
  constructor: Tn,
  select: Zk,
  selectAll: e6,
  selectChild: s6,
  selectChildren: c6,
  filter: u6,
  data: y6,
  enter: h6,
  exit: x6,
  join: b6,
  merge: _6,
  selection: ET,
  order: k6,
  sort: T6,
  call: v6,
  nodes: E6,
  node: C6,
  size: S6,
  empty: A6,
  each: L6,
  attr: R6,
  style: V6,
  property: W6,
  classed: j6,
  text: Z6,
  html: nT,
  raise: rT,
  lower: aT,
  append: oT,
  insert: cT,
  remove: hT,
  clone: pT,
  datum: gT,
  on: _T,
  dispatch: wT,
  [Symbol.iterator]: vT
};
function yt(t) {
  return typeof t == "string" ? new Tn([[document.querySelector(t)]], [document.documentElement]) : new Tn([[t]], of);
}
function Qy(t) {
  return typeof t == "string" ? new Tn([document.querySelectorAll(t)], [document.documentElement]) : new Tn([Vy(t)], of);
}
function bl(t, e, n) {
  t.prototype = e.prototype = n, n.constructor = t;
}
function Mu(t, e) {
  var n = Object.create(t.prototype);
  for (var i in e) n[i] = e[i];
  return n;
}
function Ls() {
}
var Po = 0.7, Fc = 1 / Po, na = "\\s*([+-]?\\d+)\\s*", zo = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", Vi = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", CT = /^#([0-9a-f]{3,8})$/, ST = new RegExp(`^rgb\\(${na},${na},${na}\\)$`), AT = new RegExp(`^rgb\\(${Vi},${Vi},${Vi}\\)$`), LT = new RegExp(`^rgba\\(${na},${na},${na},${zo}\\)$`), IT = new RegExp(`^rgba\\(${Vi},${Vi},${Vi},${zo}\\)$`), BT = new RegExp(`^hsl\\(${zo},${Vi},${Vi}\\)$`), DT = new RegExp(`^hsla\\(${zo},${Vi},${Vi},${zo}\\)$`), op = {
  aliceblue: 15792383,
  antiquewhite: 16444375,
  aqua: 65535,
  aquamarine: 8388564,
  azure: 15794175,
  beige: 16119260,
  bisque: 16770244,
  black: 0,
  blanchedalmond: 16772045,
  blue: 255,
  blueviolet: 9055202,
  brown: 10824234,
  burlywood: 14596231,
  cadetblue: 6266528,
  chartreuse: 8388352,
  chocolate: 13789470,
  coral: 16744272,
  cornflowerblue: 6591981,
  cornsilk: 16775388,
  crimson: 14423100,
  cyan: 65535,
  darkblue: 139,
  darkcyan: 35723,
  darkgoldenrod: 12092939,
  darkgray: 11119017,
  darkgreen: 25600,
  darkgrey: 11119017,
  darkkhaki: 12433259,
  darkmagenta: 9109643,
  darkolivegreen: 5597999,
  darkorange: 16747520,
  darkorchid: 10040012,
  darkred: 9109504,
  darksalmon: 15308410,
  darkseagreen: 9419919,
  darkslateblue: 4734347,
  darkslategray: 3100495,
  darkslategrey: 3100495,
  darkturquoise: 52945,
  darkviolet: 9699539,
  deeppink: 16716947,
  deepskyblue: 49151,
  dimgray: 6908265,
  dimgrey: 6908265,
  dodgerblue: 2003199,
  firebrick: 11674146,
  floralwhite: 16775920,
  forestgreen: 2263842,
  fuchsia: 16711935,
  gainsboro: 14474460,
  ghostwhite: 16316671,
  gold: 16766720,
  goldenrod: 14329120,
  gray: 8421504,
  green: 32768,
  greenyellow: 11403055,
  grey: 8421504,
  honeydew: 15794160,
  hotpink: 16738740,
  indianred: 13458524,
  indigo: 4915330,
  ivory: 16777200,
  khaki: 15787660,
  lavender: 15132410,
  lavenderblush: 16773365,
  lawngreen: 8190976,
  lemonchiffon: 16775885,
  lightblue: 11393254,
  lightcoral: 15761536,
  lightcyan: 14745599,
  lightgoldenrodyellow: 16448210,
  lightgray: 13882323,
  lightgreen: 9498256,
  lightgrey: 13882323,
  lightpink: 16758465,
  lightsalmon: 16752762,
  lightseagreen: 2142890,
  lightskyblue: 8900346,
  lightslategray: 7833753,
  lightslategrey: 7833753,
  lightsteelblue: 11584734,
  lightyellow: 16777184,
  lime: 65280,
  limegreen: 3329330,
  linen: 16445670,
  magenta: 16711935,
  maroon: 8388608,
  mediumaquamarine: 6737322,
  mediumblue: 205,
  mediumorchid: 12211667,
  mediumpurple: 9662683,
  mediumseagreen: 3978097,
  mediumslateblue: 8087790,
  mediumspringgreen: 64154,
  mediumturquoise: 4772300,
  mediumvioletred: 13047173,
  midnightblue: 1644912,
  mintcream: 16121850,
  mistyrose: 16770273,
  moccasin: 16770229,
  navajowhite: 16768685,
  navy: 128,
  oldlace: 16643558,
  olive: 8421376,
  olivedrab: 7048739,
  orange: 16753920,
  orangered: 16729344,
  orchid: 14315734,
  palegoldenrod: 15657130,
  palegreen: 10025880,
  paleturquoise: 11529966,
  palevioletred: 14381203,
  papayawhip: 16773077,
  peachpuff: 16767673,
  peru: 13468991,
  pink: 16761035,
  plum: 14524637,
  powderblue: 11591910,
  purple: 8388736,
  rebeccapurple: 6697881,
  red: 16711680,
  rosybrown: 12357519,
  royalblue: 4286945,
  saddlebrown: 9127187,
  salmon: 16416882,
  sandybrown: 16032864,
  seagreen: 3050327,
  seashell: 16774638,
  sienna: 10506797,
  silver: 12632256,
  skyblue: 8900331,
  slateblue: 6970061,
  slategray: 7372944,
  slategrey: 7372944,
  snow: 16775930,
  springgreen: 65407,
  steelblue: 4620980,
  tan: 13808780,
  teal: 32896,
  thistle: 14204888,
  tomato: 16737095,
  turquoise: 4251856,
  violet: 15631086,
  wheat: 16113331,
  white: 16777215,
  whitesmoke: 16119285,
  yellow: 16776960,
  yellowgreen: 10145074
};
bl(Ls, ds, {
  copy(t) {
    return Object.assign(new this.constructor(), this, t);
  },
  displayable() {
    return this.rgb().displayable();
  },
  hex: lp,
  // Deprecated! Use color.formatHex.
  formatHex: lp,
  formatHex8: NT,
  formatHsl: FT,
  formatRgb: cp,
  toString: cp
});
function lp() {
  return this.rgb().formatHex();
}
function NT() {
  return this.rgb().formatHex8();
}
function FT() {
  return Jy(this).formatHsl();
}
function cp() {
  return this.rgb().formatRgb();
}
function ds(t) {
  var e, n;
  return t = (t + "").trim().toLowerCase(), (e = CT.exec(t)) ? (n = e[1].length, e = parseInt(e[1], 16), n === 6 ? up(e) : n === 3 ? new cn(e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, (e & 15) << 4 | e & 15, 1) : n === 8 ? ql(e >> 24 & 255, e >> 16 & 255, e >> 8 & 255, (e & 255) / 255) : n === 4 ? ql(e >> 12 & 15 | e >> 8 & 240, e >> 8 & 15 | e >> 4 & 240, e >> 4 & 15 | e & 240, ((e & 15) << 4 | e & 15) / 255) : null) : (e = ST.exec(t)) ? new cn(e[1], e[2], e[3], 1) : (e = AT.exec(t)) ? new cn(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, 1) : (e = LT.exec(t)) ? ql(e[1], e[2], e[3], e[4]) : (e = IT.exec(t)) ? ql(e[1] * 255 / 100, e[2] * 255 / 100, e[3] * 255 / 100, e[4]) : (e = BT.exec(t)) ? fp(e[1], e[2] / 100, e[3] / 100, 1) : (e = DT.exec(t)) ? fp(e[1], e[2] / 100, e[3] / 100, e[4]) : op.hasOwnProperty(t) ? up(op[t]) : t === "transparent" ? new cn(NaN, NaN, NaN, 0) : null;
}
function up(t) {
  return new cn(t >> 16 & 255, t >> 8 & 255, t & 255, 1);
}
function ql(t, e, n, i) {
  return i <= 0 && (t = e = n = NaN), new cn(t, e, n, i);
}
function Zy(t) {
  return t instanceof Ls || (t = ds(t)), t ? (t = t.rgb(), new cn(t.r, t.g, t.b, t.opacity)) : new cn();
}
function Ad(t, e, n, i) {
  return arguments.length === 1 ? Zy(t) : new cn(t, e, n, i ?? 1);
}
function cn(t, e, n, i) {
  this.r = +t, this.g = +e, this.b = +n, this.opacity = +i;
}
bl(cn, Ad, Mu(Ls, {
  brighter(t) {
    return t = t == null ? Fc : Math.pow(Fc, t), new cn(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? Po : Math.pow(Po, t), new cn(this.r * t, this.g * t, this.b * t, this.opacity);
  },
  rgb() {
    return this;
  },
  clamp() {
    return new cn(ls(this.r), ls(this.g), ls(this.b), Oc(this.opacity));
  },
  displayable() {
    return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
  },
  hex: hp,
  // Deprecated! Use color.formatHex.
  formatHex: hp,
  formatHex8: OT,
  formatRgb: dp,
  toString: dp
}));
function hp() {
  return `#${ss(this.r)}${ss(this.g)}${ss(this.b)}`;
}
function OT() {
  return `#${ss(this.r)}${ss(this.g)}${ss(this.b)}${ss((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}
function dp() {
  const t = Oc(this.opacity);
  return `${t === 1 ? "rgb(" : "rgba("}${ls(this.r)}, ${ls(this.g)}, ${ls(this.b)}${t === 1 ? ")" : `, ${t})`}`;
}
function Oc(t) {
  return isNaN(t) ? 1 : Math.max(0, Math.min(1, t));
}
function ls(t) {
  return Math.max(0, Math.min(255, Math.round(t) || 0));
}
function ss(t) {
  return t = ls(t), (t < 16 ? "0" : "") + t.toString(16);
}
function fp(t, e, n, i) {
  return i <= 0 ? t = e = n = NaN : n <= 0 || n >= 1 ? t = e = NaN : e <= 0 && (t = NaN), new xi(t, e, n, i);
}
function Jy(t) {
  if (t instanceof xi) return new xi(t.h, t.s, t.l, t.opacity);
  if (t instanceof Ls || (t = ds(t)), !t) return new xi();
  if (t instanceof xi) return t;
  t = t.rgb();
  var e = t.r / 255, n = t.g / 255, i = t.b / 255, r = Math.min(e, n, i), s = Math.max(e, n, i), a = NaN, o = s - r, l = (s + r) / 2;
  return o ? (e === s ? a = (n - i) / o + (n < i) * 6 : n === s ? a = (i - e) / o + 2 : a = (e - n) / o + 4, o /= l < 0.5 ? s + r : 2 - s - r, a *= 60) : o = l > 0 && l < 1 ? 0 : a, new xi(a, o, l, t.opacity);
}
function RT(t, e, n, i) {
  return arguments.length === 1 ? Jy(t) : new xi(t, e, n, i ?? 1);
}
function xi(t, e, n, i) {
  this.h = +t, this.s = +e, this.l = +n, this.opacity = +i;
}
bl(xi, RT, Mu(Ls, {
  brighter(t) {
    return t = t == null ? Fc : Math.pow(Fc, t), new xi(this.h, this.s, this.l * t, this.opacity);
  },
  darker(t) {
    return t = t == null ? Po : Math.pow(Po, t), new xi(this.h, this.s, this.l * t, this.opacity);
  },
  rgb() {
    var t = this.h % 360 + (this.h < 0) * 360, e = isNaN(t) || isNaN(this.s) ? 0 : this.s, n = this.l, i = n + (n < 0.5 ? n : 1 - n) * e, r = 2 * n - i;
    return new cn(
      Fh(t >= 240 ? t - 240 : t + 120, r, i),
      Fh(t, r, i),
      Fh(t < 120 ? t + 240 : t - 120, r, i),
      this.opacity
    );
  },
  clamp() {
    return new xi(pp(this.h), $l(this.s), $l(this.l), Oc(this.opacity));
  },
  displayable() {
    return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
  },
  formatHsl() {
    const t = Oc(this.opacity);
    return `${t === 1 ? "hsl(" : "hsla("}${pp(this.h)}, ${$l(this.s) * 100}%, ${$l(this.l) * 100}%${t === 1 ? ")" : `, ${t})`}`;
  }
}));
function pp(t) {
  return t = (t || 0) % 360, t < 0 ? t + 360 : t;
}
function $l(t) {
  return Math.max(0, Math.min(1, t || 0));
}
function Fh(t, e, n) {
  return (t < 60 ? e + (n - e) * t / 60 : t < 180 ? n : t < 240 ? e + (n - e) * (240 - t) / 60 : e) * 255;
}
const MT = Math.PI / 180, PT = 180 / Math.PI, Rc = 18, tm = 0.96422, em = 1, nm = 0.82521, im = 4 / 29, ia = 6 / 29, rm = 3 * ia * ia, zT = ia * ia * ia;
function sm(t) {
  if (t instanceof qi) return new qi(t.l, t.a, t.b, t.opacity);
  if (t instanceof or) return am(t);
  t instanceof cn || (t = Zy(t));
  var e = Ph(t.r), n = Ph(t.g), i = Ph(t.b), r = Oh((0.2225045 * e + 0.7168786 * n + 0.0606169 * i) / em), s, a;
  return e === n && n === i ? s = a = r : (s = Oh((0.4360747 * e + 0.3850649 * n + 0.1430804 * i) / tm), a = Oh((0.0139322 * e + 0.0971045 * n + 0.7141733 * i) / nm)), new qi(116 * r - 16, 500 * (s - r), 200 * (r - a), t.opacity);
}
function VT(t, e, n, i) {
  return arguments.length === 1 ? sm(t) : new qi(t, e, n, i ?? 1);
}
function qi(t, e, n, i) {
  this.l = +t, this.a = +e, this.b = +n, this.opacity = +i;
}
bl(qi, VT, Mu(Ls, {
  brighter(t) {
    return new qi(this.l + Rc * (t ?? 1), this.a, this.b, this.opacity);
  },
  darker(t) {
    return new qi(this.l - Rc * (t ?? 1), this.a, this.b, this.opacity);
  },
  rgb() {
    var t = (this.l + 16) / 116, e = isNaN(this.a) ? t : t + this.a / 500, n = isNaN(this.b) ? t : t - this.b / 200;
    return e = tm * Rh(e), t = em * Rh(t), n = nm * Rh(n), new cn(
      Mh(3.1338561 * e - 1.6168667 * t - 0.4906146 * n),
      Mh(-0.9787684 * e + 1.9161415 * t + 0.033454 * n),
      Mh(0.0719453 * e - 0.2289914 * t + 1.4052427 * n),
      this.opacity
    );
  }
}));
function Oh(t) {
  return t > zT ? Math.pow(t, 1 / 3) : t / rm + im;
}
function Rh(t) {
  return t > ia ? t * t * t : rm * (t - im);
}
function Mh(t) {
  return 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - 0.055);
}
function Ph(t) {
  return (t /= 255) <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4);
}
function qT(t) {
  if (t instanceof or) return new or(t.h, t.c, t.l, t.opacity);
  if (t instanceof qi || (t = sm(t)), t.a === 0 && t.b === 0) return new or(NaN, 0 < t.l && t.l < 100 ? 0 : NaN, t.l, t.opacity);
  var e = Math.atan2(t.b, t.a) * PT;
  return new or(e < 0 ? e + 360 : e, Math.sqrt(t.a * t.a + t.b * t.b), t.l, t.opacity);
}
function Ld(t, e, n, i) {
  return arguments.length === 1 ? qT(t) : new or(t, e, n, i ?? 1);
}
function or(t, e, n, i) {
  this.h = +t, this.c = +e, this.l = +n, this.opacity = +i;
}
function am(t) {
  if (isNaN(t.h)) return new qi(t.l, 0, 0, t.opacity);
  var e = t.h * MT;
  return new qi(t.l, Math.cos(e) * t.c, Math.sin(e) * t.c, t.opacity);
}
bl(or, Ld, Mu(Ls, {
  brighter(t) {
    return new or(this.h, this.c, this.l + Rc * (t ?? 1), this.opacity);
  },
  darker(t) {
    return new or(this.h, this.c, this.l - Rc * (t ?? 1), this.opacity);
  },
  rgb() {
    return am(this).rgb();
  }
}));
const Pu = (t) => () => t;
function om(t, e) {
  return function(n) {
    return t + n * e;
  };
}
function $T(t, e, n) {
  return t = Math.pow(t, n), e = Math.pow(e, n) - t, n = 1 / n, function(i) {
    return Math.pow(t + i * e, n);
  };
}
function YT(t, e) {
  var n = e - t;
  return n ? om(t, n > 180 || n < -180 ? n - 360 * Math.round(n / 360) : n) : Pu(isNaN(t) ? e : t);
}
function WT(t) {
  return (t = +t) == 1 ? To : function(e, n) {
    return n - e ? $T(e, n, t) : Pu(isNaN(e) ? n : e);
  };
}
function To(t, e) {
  var n = e - t;
  return n ? om(t, n) : Pu(isNaN(t) ? e : t);
}
const Mc = (function t(e) {
  var n = WT(e);
  function i(r, s) {
    var a = n((r = Ad(r)).r, (s = Ad(s)).r), o = n(r.g, s.g), l = n(r.b, s.b), u = To(r.opacity, s.opacity);
    return function(h) {
      return r.r = a(h), r.g = o(h), r.b = l(h), r.opacity = u(h), r + "";
    };
  }
  return i.gamma = t, i;
})(1);
function UT(t, e) {
  e || (e = []);
  var n = t ? Math.min(e.length, t.length) : 0, i = e.slice(), r;
  return function(s) {
    for (r = 0; r < n; ++r) i[r] = t[r] * (1 - s) + e[r] * s;
    return i;
  };
}
function HT(t) {
  return ArrayBuffer.isView(t) && !(t instanceof DataView);
}
function GT(t, e) {
  var n = e ? e.length : 0, i = t ? Math.min(n, t.length) : 0, r = new Array(i), s = new Array(n), a;
  for (a = 0; a < i; ++a) r[a] = lf(t[a], e[a]);
  for (; a < n; ++a) s[a] = e[a];
  return function(o) {
    for (a = 0; a < i; ++a) s[a] = r[a](o);
    return s;
  };
}
function jT(t, e) {
  var n = /* @__PURE__ */ new Date();
  return t = +t, e = +e, function(i) {
    return n.setTime(t * (1 - i) + e * i), n;
  };
}
function mi(t, e) {
  return t = +t, e = +e, function(n) {
    return t * (1 - n) + e * n;
  };
}
function XT(t, e) {
  var n = {}, i = {}, r;
  (t === null || typeof t != "object") && (t = {}), (e === null || typeof e != "object") && (e = {});
  for (r in e)
    r in t ? n[r] = lf(t[r], e[r]) : i[r] = e[r];
  return function(s) {
    for (r in n) i[r] = n[r](s);
    return i;
  };
}
var Id = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, zh = new RegExp(Id.source, "g");
function KT(t) {
  return function() {
    return t;
  };
}
function QT(t) {
  return function(e) {
    return t(e) + "";
  };
}
function lm(t, e) {
  var n = Id.lastIndex = zh.lastIndex = 0, i, r, s, a = -1, o = [], l = [];
  for (t = t + "", e = e + ""; (i = Id.exec(t)) && (r = zh.exec(e)); )
    (s = r.index) > n && (s = e.slice(n, s), o[a] ? o[a] += s : o[++a] = s), (i = i[0]) === (r = r[0]) ? o[a] ? o[a] += r : o[++a] = r : (o[++a] = null, l.push({ i: a, x: mi(i, r) })), n = zh.lastIndex;
  return n < e.length && (s = e.slice(n), o[a] ? o[a] += s : o[++a] = s), o.length < 2 ? l[0] ? QT(l[0].x) : KT(e) : (e = l.length, function(u) {
    for (var h = 0, f; h < e; ++h) o[(f = l[h]).i] = f.x(u);
    return o.join("");
  });
}
function lf(t, e) {
  var n = typeof e, i;
  return e == null || n === "boolean" ? Pu(e) : (n === "number" ? mi : n === "string" ? (i = ds(e)) ? (e = i, Mc) : lm : e instanceof ds ? Mc : e instanceof Date ? jT : HT(e) ? UT : Array.isArray(e) ? GT : typeof e.valueOf != "function" && typeof e.toString != "function" || isNaN(e) ? XT : mi)(t, e);
}
function ZT(t, e) {
  return t = +t, e = +e, function(n) {
    return Math.round(t * (1 - n) + e * n);
  };
}
var gp = 180 / Math.PI, Bd = {
  translateX: 0,
  translateY: 0,
  rotate: 0,
  skewX: 0,
  scaleX: 1,
  scaleY: 1
};
function cm(t, e, n, i, r, s) {
  var a, o, l;
  return (a = Math.sqrt(t * t + e * e)) && (t /= a, e /= a), (l = t * n + e * i) && (n -= t * l, i -= e * l), (o = Math.sqrt(n * n + i * i)) && (n /= o, i /= o, l /= o), t * i < e * n && (t = -t, e = -e, l = -l, a = -a), {
    translateX: r,
    translateY: s,
    rotate: Math.atan2(e, t) * gp,
    skewX: Math.atan(l) * gp,
    scaleX: a,
    scaleY: o
  };
}
var Yl;
function JT(t) {
  const e = new (typeof DOMMatrix == "function" ? DOMMatrix : WebKitCSSMatrix)(t + "");
  return e.isIdentity ? Bd : cm(e.a, e.b, e.c, e.d, e.e, e.f);
}
function tw(t) {
  return t == null || (Yl || (Yl = document.createElementNS("http://www.w3.org/2000/svg", "g")), Yl.setAttribute("transform", t), !(t = Yl.transform.baseVal.consolidate())) ? Bd : (t = t.matrix, cm(t.a, t.b, t.c, t.d, t.e, t.f));
}
function um(t, e, n, i) {
  function r(u) {
    return u.length ? u.pop() + " " : "";
  }
  function s(u, h, f, d, p, y) {
    if (u !== f || h !== d) {
      var m = p.push("translate(", null, e, null, n);
      y.push({ i: m - 4, x: mi(u, f) }, { i: m - 2, x: mi(h, d) });
    } else (f || d) && p.push("translate(" + f + e + d + n);
  }
  function a(u, h, f, d) {
    u !== h ? (u - h > 180 ? h += 360 : h - u > 180 && (u += 360), d.push({ i: f.push(r(f) + "rotate(", null, i) - 2, x: mi(u, h) })) : h && f.push(r(f) + "rotate(" + h + i);
  }
  function o(u, h, f, d) {
    u !== h ? d.push({ i: f.push(r(f) + "skewX(", null, i) - 2, x: mi(u, h) }) : h && f.push(r(f) + "skewX(" + h + i);
  }
  function l(u, h, f, d, p, y) {
    if (u !== f || h !== d) {
      var m = p.push(r(p) + "scale(", null, ",", null, ")");
      y.push({ i: m - 4, x: mi(u, f) }, { i: m - 2, x: mi(h, d) });
    } else (f !== 1 || d !== 1) && p.push(r(p) + "scale(" + f + "," + d + ")");
  }
  return function(u, h) {
    var f = [], d = [];
    return u = t(u), h = t(h), s(u.translateX, u.translateY, h.translateX, h.translateY, f, d), a(u.rotate, h.rotate, f, d), o(u.skewX, h.skewX, f, d), l(u.scaleX, u.scaleY, h.scaleX, h.scaleY, f, d), u = h = null, function(p) {
      for (var y = -1, m = d.length, _; ++y < m; ) f[(_ = d[y]).i] = _.x(p);
      return f.join("");
    };
  };
}
var ew = um(JT, "px, ", "px)", "deg)"), nw = um(tw, ", ", ")", ")");
function iw(t) {
  return function(e, n) {
    var i = t((e = Ld(e)).h, (n = Ld(n)).h), r = To(e.c, n.c), s = To(e.l, n.l), a = To(e.opacity, n.opacity);
    return function(o) {
      return e.h = i(o), e.c = r(o), e.l = s(o), e.opacity = a(o), e + "";
    };
  };
}
const rw = iw(YT);
var pa = 0, uo = 0, Ka = 0, hm = 1e3, Pc, ho, zc = 0, fs = 0, zu = 0, Vo = typeof performance == "object" && performance.now ? performance : Date, dm = typeof window == "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(t) {
  setTimeout(t, 17);
};
function cf() {
  return fs || (dm(sw), fs = Vo.now() + zu);
}
function sw() {
  fs = 0;
}
function Vc() {
  this._call = this._time = this._next = null;
}
Vc.prototype = fm.prototype = {
  constructor: Vc,
  restart: function(t, e, n) {
    if (typeof t != "function") throw new TypeError("callback is not a function");
    n = (n == null ? cf() : +n) + (e == null ? 0 : +e), !this._next && ho !== this && (ho ? ho._next = this : Pc = this, ho = this), this._call = t, this._time = n, Dd();
  },
  stop: function() {
    this._call && (this._call = null, this._time = 1 / 0, Dd());
  }
};
function fm(t, e, n) {
  var i = new Vc();
  return i.restart(t, e, n), i;
}
function aw() {
  cf(), ++pa;
  for (var t = Pc, e; t; )
    (e = fs - t._time) >= 0 && t._call.call(void 0, e), t = t._next;
  --pa;
}
function yp() {
  fs = (zc = Vo.now()) + zu, pa = uo = 0;
  try {
    aw();
  } finally {
    pa = 0, lw(), fs = 0;
  }
}
function ow() {
  var t = Vo.now(), e = t - zc;
  e > hm && (zu -= e, zc = t);
}
function lw() {
  for (var t, e = Pc, n, i = 1 / 0; e; )
    e._call ? (i > e._time && (i = e._time), t = e, e = e._next) : (n = e._next, e._next = null, e = t ? t._next = n : Pc = n);
  ho = t, Dd(i);
}
function Dd(t) {
  if (!pa) {
    uo && (uo = clearTimeout(uo));
    var e = t - fs;
    e > 24 ? (t < 1 / 0 && (uo = setTimeout(yp, t - Vo.now() - zu)), Ka && (Ka = clearInterval(Ka))) : (Ka || (zc = Vo.now(), Ka = setInterval(ow, hm)), pa = 1, dm(yp));
  }
}
function mp(t, e, n) {
  var i = new Vc();
  return e = e == null ? 0 : +e, i.restart((r) => {
    i.stop(), t(r + e);
  }, e, n), i;
}
var cw = Py("start", "end", "cancel", "interrupt"), uw = [], pm = 0, xp = 1, Nd = 2, cc = 3, bp = 4, Fd = 5, uc = 6;
function Vu(t, e, n, i, r, s) {
  var a = t.__transition;
  if (!a) t.__transition = {};
  else if (n in a) return;
  hw(t, n, {
    name: e,
    index: i,
    // For context during callback.
    group: r,
    // For context during callback.
    on: cw,
    tween: uw,
    time: s.time,
    delay: s.delay,
    duration: s.duration,
    ease: s.ease,
    timer: null,
    state: pm
  });
}
function uf(t, e) {
  var n = Ii(t, e);
  if (n.state > pm) throw new Error("too late; already scheduled");
  return n;
}
function ji(t, e) {
  var n = Ii(t, e);
  if (n.state > cc) throw new Error("too late; already running");
  return n;
}
function Ii(t, e) {
  var n = t.__transition;
  if (!n || !(n = n[e])) throw new Error("transition not found");
  return n;
}
function hw(t, e, n) {
  var i = t.__transition, r;
  i[e] = n, n.timer = fm(s, 0, n.time);
  function s(u) {
    n.state = xp, n.timer.restart(a, n.delay, n.time), n.delay <= u && a(u - n.delay);
  }
  function a(u) {
    var h, f, d, p;
    if (n.state !== xp) return l();
    for (h in i)
      if (p = i[h], p.name === n.name) {
        if (p.state === cc) return mp(a);
        p.state === bp ? (p.state = uc, p.timer.stop(), p.on.call("interrupt", t, t.__data__, p.index, p.group), delete i[h]) : +h < e && (p.state = uc, p.timer.stop(), p.on.call("cancel", t, t.__data__, p.index, p.group), delete i[h]);
      }
    if (mp(function() {
      n.state === cc && (n.state = bp, n.timer.restart(o, n.delay, n.time), o(u));
    }), n.state = Nd, n.on.call("start", t, t.__data__, n.index, n.group), n.state === Nd) {
      for (n.state = cc, r = new Array(d = n.tween.length), h = 0, f = -1; h < d; ++h)
        (p = n.tween[h].value.call(t, t.__data__, n.index, n.group)) && (r[++f] = p);
      r.length = f + 1;
    }
  }
  function o(u) {
    for (var h = u < n.duration ? n.ease.call(null, u / n.duration) : (n.timer.restart(l), n.state = Fd, 1), f = -1, d = r.length; ++f < d; )
      r[f].call(t, h);
    n.state === Fd && (n.on.call("end", t, t.__data__, n.index, n.group), l());
  }
  function l() {
    n.state = uc, n.timer.stop(), delete i[e];
    for (var u in i) return;
    delete t.__transition;
  }
}
function dw(t, e) {
  var n = t.__transition, i, r, s = !0, a;
  if (n) {
    e = e == null ? null : e + "";
    for (a in n) {
      if ((i = n[a]).name !== e) {
        s = !1;
        continue;
      }
      r = i.state > Nd && i.state < Fd, i.state = uc, i.timer.stop(), i.on.call(r ? "interrupt" : "cancel", t, t.__data__, i.index, i.group), delete n[a];
    }
    s && delete t.__transition;
  }
}
function fw(t) {
  return this.each(function() {
    dw(this, t);
  });
}
function pw(t, e) {
  var n, i;
  return function() {
    var r = ji(this, t), s = r.tween;
    if (s !== n) {
      i = n = s;
      for (var a = 0, o = i.length; a < o; ++a)
        if (i[a].name === e) {
          i = i.slice(), i.splice(a, 1);
          break;
        }
    }
    r.tween = i;
  };
}
function gw(t, e, n) {
  var i, r;
  if (typeof n != "function") throw new Error();
  return function() {
    var s = ji(this, t), a = s.tween;
    if (a !== i) {
      r = (i = a).slice();
      for (var o = { name: e, value: n }, l = 0, u = r.length; l < u; ++l)
        if (r[l].name === e) {
          r[l] = o;
          break;
        }
      l === u && r.push(o);
    }
    s.tween = r;
  };
}
function yw(t, e) {
  var n = this._id;
  if (t += "", arguments.length < 2) {
    for (var i = Ii(this.node(), n).tween, r = 0, s = i.length, a; r < s; ++r)
      if ((a = i[r]).name === t)
        return a.value;
    return null;
  }
  return this.each((e == null ? pw : gw)(n, t, e));
}
function hf(t, e, n) {
  var i = t._id;
  return t.each(function() {
    var r = ji(this, i);
    (r.value || (r.value = {}))[e] = n.apply(this, arguments);
  }), function(r) {
    return Ii(r, i).value[e];
  };
}
function gm(t, e) {
  var n;
  return (typeof e == "number" ? mi : e instanceof ds ? Mc : (n = ds(e)) ? (e = n, Mc) : lm)(t, e);
}
function mw(t) {
  return function() {
    this.removeAttribute(t);
  };
}
function xw(t) {
  return function() {
    this.removeAttributeNS(t.space, t.local);
  };
}
function bw(t, e, n) {
  var i, r = n + "", s;
  return function() {
    var a = this.getAttribute(t);
    return a === r ? null : a === i ? s : s = e(i = a, n);
  };
}
function _w(t, e, n) {
  var i, r = n + "", s;
  return function() {
    var a = this.getAttributeNS(t.space, t.local);
    return a === r ? null : a === i ? s : s = e(i = a, n);
  };
}
function kw(t, e, n) {
  var i, r, s;
  return function() {
    var a, o = n(this), l;
    return o == null ? void this.removeAttribute(t) : (a = this.getAttribute(t), l = o + "", a === l ? null : a === i && l === r ? s : (r = l, s = e(i = a, o)));
  };
}
function Tw(t, e, n) {
  var i, r, s;
  return function() {
    var a, o = n(this), l;
    return o == null ? void this.removeAttributeNS(t.space, t.local) : (a = this.getAttributeNS(t.space, t.local), l = o + "", a === l ? null : a === i && l === r ? s : (r = l, s = e(i = a, o)));
  };
}
function ww(t, e) {
  var n = Ru(t), i = n === "transform" ? nw : gm;
  return this.attrTween(t, typeof e == "function" ? (n.local ? Tw : kw)(n, i, hf(this, "attr." + t, e)) : e == null ? (n.local ? xw : mw)(n) : (n.local ? _w : bw)(n, i, e));
}
function vw(t, e) {
  return function(n) {
    this.setAttribute(t, e.call(this, n));
  };
}
function Ew(t, e) {
  return function(n) {
    this.setAttributeNS(t.space, t.local, e.call(this, n));
  };
}
function Cw(t, e) {
  var n, i;
  function r() {
    var s = e.apply(this, arguments);
    return s !== i && (n = (i = s) && Ew(t, s)), n;
  }
  return r._value = e, r;
}
function Sw(t, e) {
  var n, i;
  function r() {
    var s = e.apply(this, arguments);
    return s !== i && (n = (i = s) && vw(t, s)), n;
  }
  return r._value = e, r;
}
function Aw(t, e) {
  var n = "attr." + t;
  if (arguments.length < 2) return (n = this.tween(n)) && n._value;
  if (e == null) return this.tween(n, null);
  if (typeof e != "function") throw new Error();
  var i = Ru(t);
  return this.tween(n, (i.local ? Cw : Sw)(i, e));
}
function Lw(t, e) {
  return function() {
    uf(this, t).delay = +e.apply(this, arguments);
  };
}
function Iw(t, e) {
  return e = +e, function() {
    uf(this, t).delay = e;
  };
}
function Bw(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? Lw : Iw)(e, t)) : Ii(this.node(), e).delay;
}
function Dw(t, e) {
  return function() {
    ji(this, t).duration = +e.apply(this, arguments);
  };
}
function Nw(t, e) {
  return e = +e, function() {
    ji(this, t).duration = e;
  };
}
function Fw(t) {
  var e = this._id;
  return arguments.length ? this.each((typeof t == "function" ? Dw : Nw)(e, t)) : Ii(this.node(), e).duration;
}
function Ow(t, e) {
  if (typeof e != "function") throw new Error();
  return function() {
    ji(this, t).ease = e;
  };
}
function Rw(t) {
  var e = this._id;
  return arguments.length ? this.each(Ow(e, t)) : Ii(this.node(), e).ease;
}
function Mw(t, e) {
  return function() {
    var n = e.apply(this, arguments);
    if (typeof n != "function") throw new Error();
    ji(this, t).ease = n;
  };
}
function Pw(t) {
  if (typeof t != "function") throw new Error();
  return this.each(Mw(this._id, t));
}
function zw(t) {
  typeof t != "function" && (t = $y(t));
  for (var e = this._groups, n = e.length, i = new Array(n), r = 0; r < n; ++r)
    for (var s = e[r], a = s.length, o = i[r] = [], l, u = 0; u < a; ++u)
      (l = s[u]) && t.call(l, l.__data__, u, s) && o.push(l);
  return new br(i, this._parents, this._name, this._id);
}
function Vw(t) {
  if (t._id !== this._id) throw new Error();
  for (var e = this._groups, n = t._groups, i = e.length, r = n.length, s = Math.min(i, r), a = new Array(i), o = 0; o < s; ++o)
    for (var l = e[o], u = n[o], h = l.length, f = a[o] = new Array(h), d, p = 0; p < h; ++p)
      (d = l[p] || u[p]) && (f[p] = d);
  for (; o < i; ++o)
    a[o] = e[o];
  return new br(a, this._parents, this._name, this._id);
}
function qw(t) {
  return (t + "").trim().split(/^|\s+/).every(function(e) {
    var n = e.indexOf(".");
    return n >= 0 && (e = e.slice(0, n)), !e || e === "start";
  });
}
function $w(t, e, n) {
  var i, r, s = qw(e) ? uf : ji;
  return function() {
    var a = s(this, t), o = a.on;
    o !== i && (r = (i = o).copy()).on(e, n), a.on = r;
  };
}
function Yw(t, e) {
  var n = this._id;
  return arguments.length < 2 ? Ii(this.node(), n).on.on(t) : this.each($w(n, t, e));
}
function Ww(t) {
  return function() {
    var e = this.parentNode;
    for (var n in this.__transition) if (+n !== t) return;
    e && e.removeChild(this);
  };
}
function Uw() {
  return this.on("end.remove", Ww(this._id));
}
function Hw(t) {
  var e = this._name, n = this._id;
  typeof t != "function" && (t = sf(t));
  for (var i = this._groups, r = i.length, s = new Array(r), a = 0; a < r; ++a)
    for (var o = i[a], l = o.length, u = s[a] = new Array(l), h, f, d = 0; d < l; ++d)
      (h = o[d]) && (f = t.call(h, h.__data__, d, o)) && ("__data__" in h && (f.__data__ = h.__data__), u[d] = f, Vu(u[d], e, n, d, u, Ii(h, n)));
  return new br(s, this._parents, e, n);
}
function Gw(t) {
  var e = this._name, n = this._id;
  typeof t != "function" && (t = qy(t));
  for (var i = this._groups, r = i.length, s = [], a = [], o = 0; o < r; ++o)
    for (var l = i[o], u = l.length, h, f = 0; f < u; ++f)
      if (h = l[f]) {
        for (var d = t.call(h, h.__data__, f, l), p, y = Ii(h, n), m = 0, _ = d.length; m < _; ++m)
          (p = d[m]) && Vu(p, e, n, m, d, y);
        s.push(d), a.push(h);
      }
  return new br(s, a, e, n);
}
var jw = xl.prototype.constructor;
function Xw() {
  return new jw(this._groups, this._parents);
}
function Kw(t, e) {
  var n, i, r;
  return function() {
    var s = fa(this, t), a = (this.style.removeProperty(t), fa(this, t));
    return s === a ? null : s === n && a === i ? r : r = e(n = s, i = a);
  };
}
function ym(t) {
  return function() {
    this.style.removeProperty(t);
  };
}
function Qw(t, e, n) {
  var i, r = n + "", s;
  return function() {
    var a = fa(this, t);
    return a === r ? null : a === i ? s : s = e(i = a, n);
  };
}
function Zw(t, e, n) {
  var i, r, s;
  return function() {
    var a = fa(this, t), o = n(this), l = o + "";
    return o == null && (l = o = (this.style.removeProperty(t), fa(this, t))), a === l ? null : a === i && l === r ? s : (r = l, s = e(i = a, o));
  };
}
function Jw(t, e) {
  var n, i, r, s = "style." + e, a = "end." + s, o;
  return function() {
    var l = ji(this, t), u = l.on, h = l.value[s] == null ? o || (o = ym(e)) : void 0;
    (u !== n || r !== h) && (i = (n = u).copy()).on(a, r = h), l.on = i;
  };
}
function tv(t, e, n) {
  var i = (t += "") == "transform" ? ew : gm;
  return e == null ? this.styleTween(t, Kw(t, i)).on("end.style." + t, ym(t)) : typeof e == "function" ? this.styleTween(t, Zw(t, i, hf(this, "style." + t, e))).each(Jw(this._id, t)) : this.styleTween(t, Qw(t, i, e), n).on("end.style." + t, null);
}
function ev(t, e, n) {
  return function(i) {
    this.style.setProperty(t, e.call(this, i), n);
  };
}
function nv(t, e, n) {
  var i, r;
  function s() {
    var a = e.apply(this, arguments);
    return a !== r && (i = (r = a) && ev(t, a, n)), i;
  }
  return s._value = e, s;
}
function iv(t, e, n) {
  var i = "style." + (t += "");
  if (arguments.length < 2) return (i = this.tween(i)) && i._value;
  if (e == null) return this.tween(i, null);
  if (typeof e != "function") throw new Error();
  return this.tween(i, nv(t, e, n ?? ""));
}
function rv(t) {
  return function() {
    this.textContent = t;
  };
}
function sv(t) {
  return function() {
    var e = t(this);
    this.textContent = e ?? "";
  };
}
function av(t) {
  return this.tween("text", typeof t == "function" ? sv(hf(this, "text", t)) : rv(t == null ? "" : t + ""));
}
function ov(t) {
  return function(e) {
    this.textContent = t.call(this, e);
  };
}
function lv(t) {
  var e, n;
  function i() {
    var r = t.apply(this, arguments);
    return r !== n && (e = (n = r) && ov(r)), e;
  }
  return i._value = t, i;
}
function cv(t) {
  var e = "text";
  if (arguments.length < 1) return (e = this.tween(e)) && e._value;
  if (t == null) return this.tween(e, null);
  if (typeof t != "function") throw new Error();
  return this.tween(e, lv(t));
}
function uv() {
  for (var t = this._name, e = this._id, n = mm(), i = this._groups, r = i.length, s = 0; s < r; ++s)
    for (var a = i[s], o = a.length, l, u = 0; u < o; ++u)
      if (l = a[u]) {
        var h = Ii(l, e);
        Vu(l, t, n, u, a, {
          time: h.time + h.delay + h.duration,
          delay: 0,
          duration: h.duration,
          ease: h.ease
        });
      }
  return new br(i, this._parents, t, n);
}
function hv() {
  var t, e, n = this, i = n._id, r = n.size();
  return new Promise(function(s, a) {
    var o = { value: a }, l = { value: function() {
      --r === 0 && s();
    } };
    n.each(function() {
      var u = ji(this, i), h = u.on;
      h !== t && (e = (t = h).copy(), e._.cancel.push(o), e._.interrupt.push(o), e._.end.push(l)), u.on = e;
    }), r === 0 && s();
  });
}
var dv = 0;
function br(t, e, n, i) {
  this._groups = t, this._parents = e, this._name = n, this._id = i;
}
function mm() {
  return ++dv;
}
var er = xl.prototype;
br.prototype = {
  constructor: br,
  select: Hw,
  selectAll: Gw,
  selectChild: er.selectChild,
  selectChildren: er.selectChildren,
  filter: zw,
  merge: Vw,
  selection: Xw,
  transition: uv,
  call: er.call,
  nodes: er.nodes,
  node: er.node,
  size: er.size,
  empty: er.empty,
  each: er.each,
  on: Yw,
  attr: ww,
  attrTween: Aw,
  style: tv,
  styleTween: iv,
  text: av,
  textTween: cv,
  remove: Uw,
  tween: yw,
  delay: Bw,
  duration: Fw,
  ease: Rw,
  easeVarying: Pw,
  end: hv,
  [Symbol.iterator]: er[Symbol.iterator]
};
function fv(t) {
  return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
}
var pv = {
  time: null,
  // Set on use.
  delay: 0,
  duration: 250,
  ease: fv
};
function gv(t, e) {
  for (var n; !(n = t.__transition) || !(n = n[e]); )
    if (!(t = t.parentNode))
      throw new Error(`transition ${e} not found`);
  return n;
}
function yv(t) {
  var e, n;
  t instanceof br ? (e = t._id, t = t._name) : (e = mm(), (n = pv).time = cf(), t = t == null ? null : t + "");
  for (var i = this._groups, r = i.length, s = 0; s < r; ++s)
    for (var a = i[s], o = a.length, l, u = 0; u < o; ++u)
      (l = a[u]) && Vu(l, t, e, u, a, n || gv(l, e));
  return new br(i, this._parents, t, e);
}
xl.prototype.interrupt = fw;
xl.prototype.transition = yv;
const Od = Math.PI, Rd = 2 * Od, Zr = 1e-6, mv = Rd - Zr;
function xm(t) {
  this._ += t[0];
  for (let e = 1, n = t.length; e < n; ++e)
    this._ += arguments[e] + t[e];
}
function xv(t) {
  let e = Math.floor(t);
  if (!(e >= 0)) throw new Error(`invalid digits: ${t}`);
  if (e > 15) return xm;
  const n = 10 ** e;
  return function(i) {
    this._ += i[0];
    for (let r = 1, s = i.length; r < s; ++r)
      this._ += Math.round(arguments[r] * n) / n + i[r];
  };
}
let bv = class {
  constructor(e) {
    this._x0 = this._y0 = // start of current subpath
    this._x1 = this._y1 = null, this._ = "", this._append = e == null ? xm : xv(e);
  }
  moveTo(e, n) {
    this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +n}`;
  }
  closePath() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
  }
  lineTo(e, n) {
    this._append`L${this._x1 = +e},${this._y1 = +n}`;
  }
  quadraticCurveTo(e, n, i, r) {
    this._append`Q${+e},${+n},${this._x1 = +i},${this._y1 = +r}`;
  }
  bezierCurveTo(e, n, i, r, s, a) {
    this._append`C${+e},${+n},${+i},${+r},${this._x1 = +s},${this._y1 = +a}`;
  }
  arcTo(e, n, i, r, s) {
    if (e = +e, n = +n, i = +i, r = +r, s = +s, s < 0) throw new Error(`negative radius: ${s}`);
    let a = this._x1, o = this._y1, l = i - e, u = r - n, h = a - e, f = o - n, d = h * h + f * f;
    if (this._x1 === null)
      this._append`M${this._x1 = e},${this._y1 = n}`;
    else if (d > Zr) if (!(Math.abs(f * l - u * h) > Zr) || !s)
      this._append`L${this._x1 = e},${this._y1 = n}`;
    else {
      let p = i - a, y = r - o, m = l * l + u * u, _ = p * p + y * y, T = Math.sqrt(m), v = Math.sqrt(d), A = s * Math.tan((Od - Math.acos((m + d - _) / (2 * T * v))) / 2), L = A / v, w = A / T;
      Math.abs(L - 1) > Zr && this._append`L${e + L * h},${n + L * f}`, this._append`A${s},${s},0,0,${+(f * p > h * y)},${this._x1 = e + w * l},${this._y1 = n + w * u}`;
    }
  }
  arc(e, n, i, r, s, a) {
    if (e = +e, n = +n, i = +i, a = !!a, i < 0) throw new Error(`negative radius: ${i}`);
    let o = i * Math.cos(r), l = i * Math.sin(r), u = e + o, h = n + l, f = 1 ^ a, d = a ? r - s : s - r;
    this._x1 === null ? this._append`M${u},${h}` : (Math.abs(this._x1 - u) > Zr || Math.abs(this._y1 - h) > Zr) && this._append`L${u},${h}`, i && (d < 0 && (d = d % Rd + Rd), d > mv ? this._append`A${i},${i},0,1,${f},${e - o},${n - l}A${i},${i},0,1,${f},${this._x1 = u},${this._y1 = h}` : d > Zr && this._append`A${i},${i},0,${+(d >= Od)},${f},${this._x1 = e + i * Math.cos(s)},${this._y1 = n + i * Math.sin(s)}`);
  }
  rect(e, n, i, r) {
    this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +n}h${i = +i}v${+r}h${-i}Z`;
  }
  toString() {
    return this._;
  }
};
function _v(t) {
  if (!t.ok) throw new Error(t.status + " " + t.statusText);
  return t.text();
}
function kv(t, e) {
  return fetch(t, e).then(_v);
}
function Tv(t) {
  return (e, n) => kv(e, n).then((i) => new DOMParser().parseFromString(i, t));
}
var wv = Tv("image/svg+xml");
function vv(t) {
  return Math.abs(t = Math.round(t)) >= 1e21 ? t.toLocaleString("en").replace(/,/g, "") : t.toString(10);
}
function qc(t, e) {
  if (!isFinite(t) || t === 0) return null;
  var n = (t = e ? t.toExponential(e - 1) : t.toExponential()).indexOf("e"), i = t.slice(0, n);
  return [
    i.length > 1 ? i[0] + i.slice(2) : i,
    +t.slice(n + 1)
  ];
}
function ga(t) {
  return t = qc(Math.abs(t)), t ? t[1] : NaN;
}
function Ev(t, e) {
  return function(n, i) {
    for (var r = n.length, s = [], a = 0, o = t[0], l = 0; r > 0 && o > 0 && (l + o + 1 > i && (o = Math.max(1, i - l)), s.push(n.substring(r -= o, r + o)), !((l += o + 1) > i)); )
      o = t[a = (a + 1) % t.length];
    return s.reverse().join(e);
  };
}
function Cv(t) {
  return function(e) {
    return e.replace(/[0-9]/g, function(n) {
      return t[+n];
    });
  };
}
var Sv = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;
function $c(t) {
  if (!(e = Sv.exec(t))) throw new Error("invalid format: " + t);
  var e;
  return new df({
    fill: e[1],
    align: e[2],
    sign: e[3],
    symbol: e[4],
    zero: e[5],
    width: e[6],
    comma: e[7],
    precision: e[8] && e[8].slice(1),
    trim: e[9],
    type: e[10]
  });
}
$c.prototype = df.prototype;
function df(t) {
  this.fill = t.fill === void 0 ? " " : t.fill + "", this.align = t.align === void 0 ? ">" : t.align + "", this.sign = t.sign === void 0 ? "-" : t.sign + "", this.symbol = t.symbol === void 0 ? "" : t.symbol + "", this.zero = !!t.zero, this.width = t.width === void 0 ? void 0 : +t.width, this.comma = !!t.comma, this.precision = t.precision === void 0 ? void 0 : +t.precision, this.trim = !!t.trim, this.type = t.type === void 0 ? "" : t.type + "";
}
df.prototype.toString = function() {
  return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type;
};
function Av(t) {
  t: for (var e = t.length, n = 1, i = -1, r; n < e; ++n)
    switch (t[n]) {
      case ".":
        i = r = n;
        break;
      case "0":
        i === 0 && (i = n), r = n;
        break;
      default:
        if (!+t[n]) break t;
        i > 0 && (i = 0);
        break;
    }
  return i > 0 ? t.slice(0, i) + t.slice(r + 1) : t;
}
var Yc;
function Lv(t, e) {
  var n = qc(t, e);
  if (!n) return Yc = void 0, t.toPrecision(e);
  var i = n[0], r = n[1], s = r - (Yc = Math.max(-8, Math.min(8, Math.floor(r / 3))) * 3) + 1, a = i.length;
  return s === a ? i : s > a ? i + new Array(s - a + 1).join("0") : s > 0 ? i.slice(0, s) + "." + i.slice(s) : "0." + new Array(1 - s).join("0") + qc(t, Math.max(0, e + s - 1))[0];
}
function _p(t, e) {
  var n = qc(t, e);
  if (!n) return t + "";
  var i = n[0], r = n[1];
  return r < 0 ? "0." + new Array(-r).join("0") + i : i.length > r + 1 ? i.slice(0, r + 1) + "." + i.slice(r + 1) : i + new Array(r - i.length + 2).join("0");
}
const kp = {
  "%": (t, e) => (t * 100).toFixed(e),
  b: (t) => Math.round(t).toString(2),
  c: (t) => t + "",
  d: vv,
  e: (t, e) => t.toExponential(e),
  f: (t, e) => t.toFixed(e),
  g: (t, e) => t.toPrecision(e),
  o: (t) => Math.round(t).toString(8),
  p: (t, e) => _p(t * 100, e),
  r: _p,
  s: Lv,
  X: (t) => Math.round(t).toString(16).toUpperCase(),
  x: (t) => Math.round(t).toString(16)
};
function Tp(t) {
  return t;
}
var wp = Array.prototype.map, vp = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
function Iv(t) {
  var e = t.grouping === void 0 || t.thousands === void 0 ? Tp : Ev(wp.call(t.grouping, Number), t.thousands + ""), n = t.currency === void 0 ? "" : t.currency[0] + "", i = t.currency === void 0 ? "" : t.currency[1] + "", r = t.decimal === void 0 ? "." : t.decimal + "", s = t.numerals === void 0 ? Tp : Cv(wp.call(t.numerals, String)), a = t.percent === void 0 ? "%" : t.percent + "", o = t.minus === void 0 ? "−" : t.minus + "", l = t.nan === void 0 ? "NaN" : t.nan + "";
  function u(f, d) {
    f = $c(f);
    var p = f.fill, y = f.align, m = f.sign, _ = f.symbol, T = f.zero, v = f.width, A = f.comma, L = f.precision, w = f.trim, b = f.type;
    b === "n" ? (A = !0, b = "g") : kp[b] || (L === void 0 && (L = 12), w = !0, b = "g"), (T || p === "0" && y === "=") && (T = !0, p = "0", y = "=");
    var F = (d && d.prefix !== void 0 ? d.prefix : "") + (_ === "$" ? n : _ === "#" && /[boxX]/.test(b) ? "0" + b.toLowerCase() : ""), S = (_ === "$" ? i : /[%p]/.test(b) ? a : "") + (d && d.suffix !== void 0 ? d.suffix : ""), x = kp[b], C = /[defgprs%]/.test(b);
    L = L === void 0 ? 6 : /[gprs]/.test(b) ? Math.max(1, Math.min(21, L)) : Math.max(0, Math.min(20, L));
    function g(I) {
      var k = F, P = S, R, M, B;
      if (b === "c")
        P = x(I) + P, I = "";
      else {
        I = +I;
        var N = I < 0 || 1 / I < 0;
        if (I = isNaN(I) ? l : x(Math.abs(I), L), w && (I = Av(I)), N && +I == 0 && m !== "+" && (N = !1), k = (N ? m === "(" ? m : o : m === "-" || m === "(" ? "" : m) + k, P = (b === "s" && !isNaN(I) && Yc !== void 0 ? vp[8 + Yc / 3] : "") + P + (N && m === "(" ? ")" : ""), C) {
          for (R = -1, M = I.length; ++R < M; )
            if (B = I.charCodeAt(R), 48 > B || B > 57) {
              P = (B === 46 ? r + I.slice(R + 1) : I.slice(R)) + P, I = I.slice(0, R);
              break;
            }
        }
      }
      A && !T && (I = e(I, 1 / 0));
      var D = k.length + I.length + P.length, E = D < v ? new Array(v - D + 1).join(p) : "";
      switch (A && T && (I = e(E + I, E.length ? v - P.length : 1 / 0), E = ""), y) {
        case "<":
          I = k + I + P + E;
          break;
        case "=":
          I = k + E + I + P;
          break;
        case "^":
          I = E.slice(0, D = E.length >> 1) + k + I + P + E.slice(D);
          break;
        default:
          I = E + k + I + P;
          break;
      }
      return s(I);
    }
    return g.toString = function() {
      return f + "";
    }, g;
  }
  function h(f, d) {
    var p = Math.max(-8, Math.min(8, Math.floor(ga(d) / 3))) * 3, y = Math.pow(10, -p), m = u((f = $c(f), f.type = "f", f), { suffix: vp[8 + p / 3] });
    return function(_) {
      return m(y * _);
    };
  }
  return {
    format: u,
    formatPrefix: h
  };
}
var Wl, bm, _m;
Bv({
  thousands: ",",
  grouping: [3],
  currency: ["$", ""]
});
function Bv(t) {
  return Wl = Iv(t), bm = Wl.format, _m = Wl.formatPrefix, Wl;
}
function Dv(t) {
  return Math.max(0, -ga(Math.abs(t)));
}
function Nv(t, e) {
  return Math.max(0, Math.max(-8, Math.min(8, Math.floor(ga(e) / 3))) * 3 - ga(Math.abs(t)));
}
function Fv(t, e) {
  return t = Math.abs(t), e = Math.abs(e) - t, Math.max(0, ga(e) - ga(t)) + 1;
}
function qu(t, e) {
  switch (arguments.length) {
    case 0:
      break;
    case 1:
      this.range(t);
      break;
    default:
      this.range(e).domain(t);
      break;
  }
  return this;
}
const Ep = Symbol("implicit");
function _l() {
  var t = new np(), e = [], n = [], i = Ep;
  function r(s) {
    let a = t.get(s);
    if (a === void 0) {
      if (i !== Ep) return i;
      t.set(s, a = e.push(s) - 1);
    }
    return n[a % n.length];
  }
  return r.domain = function(s) {
    if (!arguments.length) return e.slice();
    e = [], t = new np();
    for (const a of s)
      t.has(a) || t.set(a, e.push(a) - 1);
    return r;
  }, r.range = function(s) {
    return arguments.length ? (n = Array.from(s), r) : n.slice();
  }, r.unknown = function(s) {
    return arguments.length ? (i = s, r) : i;
  }, r.copy = function() {
    return _l(e, n).unknown(i);
  }, qu.apply(r, arguments), r;
}
function Md() {
  var t = _l().unknown(void 0), e = t.domain, n = t.range, i = 0, r = 1, s, a, o = !1, l = 0, u = 0, h = 0.5;
  delete t.unknown;
  function f() {
    var d = e().length, p = r < i, y = p ? r : i, m = p ? i : r;
    s = (m - y) / Math.max(1, d - l + u * 2), o && (s = Math.floor(s)), y += (m - y - s * (d - l)) * h, a = s * (1 - l), o && (y = Math.round(y), a = Math.round(a));
    var _ = Mk(d).map(function(T) {
      return y + s * T;
    });
    return n(p ? _.reverse() : _);
  }
  return t.domain = function(d) {
    return arguments.length ? (e(d), f()) : e();
  }, t.range = function(d) {
    return arguments.length ? ([i, r] = d, i = +i, r = +r, f()) : [i, r];
  }, t.rangeRound = function(d) {
    return [i, r] = d, i = +i, r = +r, o = !0, f();
  }, t.bandwidth = function() {
    return a;
  }, t.step = function() {
    return s;
  }, t.round = function(d) {
    return arguments.length ? (o = !!d, f()) : o;
  }, t.padding = function(d) {
    return arguments.length ? (l = Math.min(1, u = +d), f()) : l;
  }, t.paddingInner = function(d) {
    return arguments.length ? (l = Math.min(1, d), f()) : l;
  }, t.paddingOuter = function(d) {
    return arguments.length ? (u = +d, f()) : u;
  }, t.align = function(d) {
    return arguments.length ? (h = Math.max(0, Math.min(1, d)), f()) : h;
  }, t.copy = function() {
    return Md(e(), [i, r]).round(o).paddingInner(l).paddingOuter(u).align(h);
  }, qu.apply(f(), arguments);
}
function Ov(t) {
  return function() {
    return t;
  };
}
function Rv(t) {
  return +t;
}
var Cp = [0, 1];
function Xs(t) {
  return t;
}
function Pd(t, e) {
  return (e -= t = +t) ? function(n) {
    return (n - t) / e;
  } : Ov(isNaN(e) ? NaN : 0.5);
}
function Mv(t, e) {
  var n;
  return t > e && (n = t, t = e, e = n), function(i) {
    return Math.max(t, Math.min(e, i));
  };
}
function Pv(t, e, n) {
  var i = t[0], r = t[1], s = e[0], a = e[1];
  return r < i ? (i = Pd(r, i), s = n(a, s)) : (i = Pd(i, r), s = n(s, a)), function(o) {
    return s(i(o));
  };
}
function zv(t, e, n) {
  var i = Math.min(t.length, e.length) - 1, r = new Array(i), s = new Array(i), a = -1;
  for (t[i] < t[0] && (t = t.slice().reverse(), e = e.slice().reverse()); ++a < i; )
    r[a] = Pd(t[a], t[a + 1]), s[a] = n(e[a], e[a + 1]);
  return function(o) {
    var l = Sk(t, o, 1, i) - 1;
    return s[l](r[l](o));
  };
}
function km(t, e) {
  return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown());
}
function Vv() {
  var t = Cp, e = Cp, n = lf, i, r, s, a = Xs, o, l, u;
  function h() {
    var d = Math.min(t.length, e.length);
    return a !== Xs && (a = Mv(t[0], t[d - 1])), o = d > 2 ? zv : Pv, l = u = null, f;
  }
  function f(d) {
    return d == null || isNaN(d = +d) ? s : (l || (l = o(t.map(i), e, n)))(i(a(d)));
  }
  return f.invert = function(d) {
    return a(r((u || (u = o(e, t.map(i), mi)))(d)));
  }, f.domain = function(d) {
    return arguments.length ? (t = Array.from(d, Rv), h()) : t.slice();
  }, f.range = function(d) {
    return arguments.length ? (e = Array.from(d), h()) : e.slice();
  }, f.rangeRound = function(d) {
    return e = Array.from(d), n = ZT, h();
  }, f.clamp = function(d) {
    return arguments.length ? (a = d ? !0 : Xs, h()) : a !== Xs;
  }, f.interpolate = function(d) {
    return arguments.length ? (n = d, h()) : n;
  }, f.unknown = function(d) {
    return arguments.length ? (s = d, f) : s;
  }, function(d, p) {
    return i = d, r = p, h();
  };
}
function Tm() {
  return Vv()(Xs, Xs);
}
function qv(t, e, n, i) {
  var r = Ed(t, e, n), s;
  switch (i = $c(i ?? ",f"), i.type) {
    case "s": {
      var a = Math.max(Math.abs(t), Math.abs(e));
      return i.precision == null && !isNaN(s = Nv(r, a)) && (i.precision = s), _m(i, a);
    }
    case "":
    case "e":
    case "g":
    case "p":
    case "r": {
      i.precision == null && !isNaN(s = Fv(r, Math.max(Math.abs(t), Math.abs(e)))) && (i.precision = s - (i.type === "e"));
      break;
    }
    case "f":
    case "%": {
      i.precision == null && !isNaN(s = Dv(r)) && (i.precision = s - (i.type === "%") * 2);
      break;
    }
  }
  return bm(i);
}
function $v(t) {
  var e = t.domain;
  return t.ticks = function(n) {
    var i = e();
    return Fk(i[0], i[i.length - 1], n ?? 10);
  }, t.tickFormat = function(n, i) {
    var r = e();
    return qv(r[0], r[r.length - 1], n ?? 10, i);
  }, t.nice = function(n) {
    n == null && (n = 10);
    var i = e(), r = 0, s = i.length - 1, a = i[r], o = i[s], l, u, h = 10;
    for (o < a && (u = a, a = o, o = u, u = r, r = s, s = u); h-- > 0; ) {
      if (u = vd(a, o, n), u === l)
        return i[r] = a, i[s] = o, e(i);
      if (u > 0)
        a = Math.floor(a / u) * u, o = Math.ceil(o / u) * u;
      else if (u < 0)
        a = Math.ceil(a * u) / u, o = Math.floor(o * u) / u;
      else
        break;
      l = u;
    }
    return t;
  }, t;
}
function ya() {
  var t = Tm();
  return t.copy = function() {
    return km(t, ya());
  }, qu.apply(t, arguments), $v(t);
}
function Yv(t, e) {
  t = t.slice();
  var n = 0, i = t.length - 1, r = t[n], s = t[i], a;
  return s < r && (a = n, n = i, i = a, a = r, r = s, s = a), t[n] = e.floor(r), t[i] = e.ceil(s), t;
}
const Vh = /* @__PURE__ */ new Date(), qh = /* @__PURE__ */ new Date();
function je(t, e, n, i) {
  function r(s) {
    return t(s = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+s)), s;
  }
  return r.floor = (s) => (t(s = /* @__PURE__ */ new Date(+s)), s), r.ceil = (s) => (t(s = new Date(s - 1)), e(s, 1), t(s), s), r.round = (s) => {
    const a = r(s), o = r.ceil(s);
    return s - a < o - s ? a : o;
  }, r.offset = (s, a) => (e(s = /* @__PURE__ */ new Date(+s), a == null ? 1 : Math.floor(a)), s), r.range = (s, a, o) => {
    const l = [];
    if (s = r.ceil(s), o = o == null ? 1 : Math.floor(o), !(s < a) || !(o > 0)) return l;
    let u;
    do
      l.push(u = /* @__PURE__ */ new Date(+s)), e(s, o), t(s);
    while (u < s && s < a);
    return l;
  }, r.filter = (s) => je((a) => {
    if (a >= a) for (; t(a), !s(a); ) a.setTime(a - 1);
  }, (a, o) => {
    if (a >= a)
      if (o < 0) for (; ++o <= 0; )
        for (; e(a, -1), !s(a); )
          ;
      else for (; --o >= 0; )
        for (; e(a, 1), !s(a); )
          ;
  }), n && (r.count = (s, a) => (Vh.setTime(+s), qh.setTime(+a), t(Vh), t(qh), Math.floor(n(Vh, qh))), r.every = (s) => (s = Math.floor(s), !isFinite(s) || !(s > 0) ? null : s > 1 ? r.filter(i ? (a) => i(a) % s === 0 : (a) => r.count(0, a) % s === 0) : r)), r;
}
const ma = je(() => {
}, (t, e) => {
  t.setTime(+t + e);
}, (t, e) => e - t);
ma.every = (t) => (t = Math.floor(t), !isFinite(t) || !(t > 0) ? null : t > 1 ? je((e) => {
  e.setTime(Math.floor(e / t) * t);
}, (e, n) => {
  e.setTime(+e + n * t);
}, (e, n) => (n - e) / t) : ma);
ma.range;
const lr = 1e3, ai = lr * 60, cr = ai * 60, _r = cr * 24, ff = _r * 7, Sp = _r * 30, $h = _r * 365, Or = je((t) => {
  t.setTime(t - t.getMilliseconds());
}, (t, e) => {
  t.setTime(+t + e * lr);
}, (t, e) => (e - t) / lr, (t) => t.getUTCSeconds());
Or.range;
const qo = je((t) => {
  t.setTime(t - t.getMilliseconds() - t.getSeconds() * lr);
}, (t, e) => {
  t.setTime(+t + e * ai);
}, (t, e) => (e - t) / ai, (t) => t.getMinutes());
qo.range;
const Wv = je((t) => {
  t.setUTCSeconds(0, 0);
}, (t, e) => {
  t.setTime(+t + e * ai);
}, (t, e) => (e - t) / ai, (t) => t.getUTCMinutes());
Wv.range;
const $o = je((t) => {
  t.setTime(t - t.getMilliseconds() - t.getSeconds() * lr - t.getMinutes() * ai);
}, (t, e) => {
  t.setTime(+t + e * cr);
}, (t, e) => (e - t) / cr, (t) => t.getHours());
$o.range;
const Uv = je((t) => {
  t.setUTCMinutes(0, 0, 0);
}, (t, e) => {
  t.setTime(+t + e * cr);
}, (t, e) => (e - t) / cr, (t) => t.getUTCHours());
Uv.range;
const ps = je(
  (t) => t.setHours(0, 0, 0, 0),
  (t, e) => t.setDate(t.getDate() + e),
  (t, e) => (e - t - (e.getTimezoneOffset() - t.getTimezoneOffset()) * ai) / _r,
  (t) => t.getDate() - 1
);
ps.range;
const pf = je((t) => {
  t.setUTCHours(0, 0, 0, 0);
}, (t, e) => {
  t.setUTCDate(t.getUTCDate() + e);
}, (t, e) => (e - t) / _r, (t) => t.getUTCDate() - 1);
pf.range;
const Hv = je((t) => {
  t.setUTCHours(0, 0, 0, 0);
}, (t, e) => {
  t.setUTCDate(t.getUTCDate() + e);
}, (t, e) => (e - t) / _r, (t) => Math.floor(t / _r));
Hv.range;
function Is(t) {
  return je((e) => {
    e.setDate(e.getDate() - (e.getDay() + 7 - t) % 7), e.setHours(0, 0, 0, 0);
  }, (e, n) => {
    e.setDate(e.getDate() + n * 7);
  }, (e, n) => (n - e - (n.getTimezoneOffset() - e.getTimezoneOffset()) * ai) / ff);
}
const kl = Is(0), Yo = Is(1), wm = Is(2), vm = Is(3), gs = Is(4), Em = Is(5), Cm = Is(6);
kl.range;
Yo.range;
wm.range;
vm.range;
gs.range;
Em.range;
Cm.range;
function Bs(t) {
  return je((e) => {
    e.setUTCDate(e.getUTCDate() - (e.getUTCDay() + 7 - t) % 7), e.setUTCHours(0, 0, 0, 0);
  }, (e, n) => {
    e.setUTCDate(e.getUTCDate() + n * 7);
  }, (e, n) => (n - e) / ff);
}
const Sm = Bs(0), Wc = Bs(1), Gv = Bs(2), jv = Bs(3), xa = Bs(4), Xv = Bs(5), Kv = Bs(6);
Sm.range;
Wc.range;
Gv.range;
jv.range;
xa.range;
Xv.range;
Kv.range;
const Wo = je((t) => {
  t.setDate(1), t.setHours(0, 0, 0, 0);
}, (t, e) => {
  t.setMonth(t.getMonth() + e);
}, (t, e) => e.getMonth() - t.getMonth() + (e.getFullYear() - t.getFullYear()) * 12, (t) => t.getMonth());
Wo.range;
const Qv = je((t) => {
  t.setUTCDate(1), t.setUTCHours(0, 0, 0, 0);
}, (t, e) => {
  t.setUTCMonth(t.getUTCMonth() + e);
}, (t, e) => e.getUTCMonth() - t.getUTCMonth() + (e.getUTCFullYear() - t.getUTCFullYear()) * 12, (t) => t.getUTCMonth());
Qv.range;
const kr = je((t) => {
  t.setMonth(0, 1), t.setHours(0, 0, 0, 0);
}, (t, e) => {
  t.setFullYear(t.getFullYear() + e);
}, (t, e) => e.getFullYear() - t.getFullYear(), (t) => t.getFullYear());
kr.every = (t) => !isFinite(t = Math.floor(t)) || !(t > 0) ? null : je((e) => {
  e.setFullYear(Math.floor(e.getFullYear() / t) * t), e.setMonth(0, 1), e.setHours(0, 0, 0, 0);
}, (e, n) => {
  e.setFullYear(e.getFullYear() + n * t);
});
kr.range;
const ys = je((t) => {
  t.setUTCMonth(0, 1), t.setUTCHours(0, 0, 0, 0);
}, (t, e) => {
  t.setUTCFullYear(t.getUTCFullYear() + e);
}, (t, e) => e.getUTCFullYear() - t.getUTCFullYear(), (t) => t.getUTCFullYear());
ys.every = (t) => !isFinite(t = Math.floor(t)) || !(t > 0) ? null : je((e) => {
  e.setUTCFullYear(Math.floor(e.getUTCFullYear() / t) * t), e.setUTCMonth(0, 1), e.setUTCHours(0, 0, 0, 0);
}, (e, n) => {
  e.setUTCFullYear(e.getUTCFullYear() + n * t);
});
ys.range;
function Zv(t, e, n, i, r, s) {
  const a = [
    [Or, 1, lr],
    [Or, 5, 5 * lr],
    [Or, 15, 15 * lr],
    [Or, 30, 30 * lr],
    [s, 1, ai],
    [s, 5, 5 * ai],
    [s, 15, 15 * ai],
    [s, 30, 30 * ai],
    [r, 1, cr],
    [r, 3, 3 * cr],
    [r, 6, 6 * cr],
    [r, 12, 12 * cr],
    [i, 1, _r],
    [i, 2, 2 * _r],
    [n, 1, ff],
    [e, 1, Sp],
    [e, 3, 3 * Sp],
    [t, 1, $h]
  ];
  function o(u, h, f) {
    const d = h < u;
    d && ([u, h] = [h, u]);
    const p = f && typeof f.range == "function" ? f : l(u, h, f), y = p ? p.range(u, +h + 1) : [];
    return d ? y.reverse() : y;
  }
  function l(u, h, f) {
    const d = Math.abs(h - u) / f, p = rf(([, , _]) => _).right(a, d);
    if (p === a.length) return t.every(Ed(u / $h, h / $h, f));
    if (p === 0) return ma.every(Math.max(Ed(u, h, f), 1));
    const [y, m] = a[d / a[p - 1][2] < a[p][2] / d ? p - 1 : p];
    return y.every(m);
  }
  return [o, l];
}
const [Jv, tE] = Zv(kr, Wo, kl, ps, $o, qo);
function Yh(t) {
  if (0 <= t.y && t.y < 100) {
    var e = new Date(-1, t.m, t.d, t.H, t.M, t.S, t.L);
    return e.setFullYear(t.y), e;
  }
  return new Date(t.y, t.m, t.d, t.H, t.M, t.S, t.L);
}
function Wh(t) {
  if (0 <= t.y && t.y < 100) {
    var e = new Date(Date.UTC(-1, t.m, t.d, t.H, t.M, t.S, t.L));
    return e.setUTCFullYear(t.y), e;
  }
  return new Date(Date.UTC(t.y, t.m, t.d, t.H, t.M, t.S, t.L));
}
function Qa(t, e, n) {
  return { y: t, m: e, d: n, H: 0, M: 0, S: 0, L: 0 };
}
function eE(t) {
  var e = t.dateTime, n = t.date, i = t.time, r = t.periods, s = t.days, a = t.shortDays, o = t.months, l = t.shortMonths, u = Za(r), h = Ja(r), f = Za(s), d = Ja(s), p = Za(a), y = Ja(a), m = Za(o), _ = Ja(o), T = Za(l), v = Ja(l), A = {
    a: B,
    A: N,
    b: D,
    B: E,
    c: null,
    d: Np,
    e: Np,
    f: vE,
    g: FE,
    G: RE,
    H: kE,
    I: TE,
    j: wE,
    L: Am,
    m: EE,
    M: CE,
    p: V,
    q: nt,
    Q: Rp,
    s: Mp,
    S: SE,
    u: AE,
    U: LE,
    V: IE,
    w: BE,
    W: DE,
    x: null,
    X: null,
    y: NE,
    Y: OE,
    Z: ME,
    "%": Op
  }, L = {
    a: O,
    A: ct,
    b: X,
    B: H,
    c: null,
    d: Fp,
    e: Fp,
    f: qE,
    g: QE,
    G: JE,
    H: PE,
    I: zE,
    j: VE,
    L: Im,
    m: $E,
    M: YE,
    p: it,
    q: ot,
    Q: Rp,
    s: Mp,
    S: WE,
    u: UE,
    U: HE,
    V: GE,
    w: jE,
    W: XE,
    x: null,
    X: null,
    y: KE,
    Y: ZE,
    Z: tC,
    "%": Op
  }, w = {
    a: C,
    A: g,
    b: I,
    B: k,
    c: P,
    d: Bp,
    e: Bp,
    f: mE,
    g: Ip,
    G: Lp,
    H: Dp,
    I: Dp,
    j: fE,
    L: yE,
    m: dE,
    M: pE,
    p: x,
    q: hE,
    Q: bE,
    s: _E,
    S: gE,
    u: aE,
    U: oE,
    V: lE,
    w: sE,
    W: cE,
    x: R,
    X: M,
    y: Ip,
    Y: Lp,
    Z: uE,
    "%": xE
  };
  A.x = b(n, A), A.X = b(i, A), A.c = b(e, A), L.x = b(n, L), L.X = b(i, L), L.c = b(e, L);
  function b(W, Z) {
    return function(q) {
      var G = [], U = -1, ht = 0, Y = W.length, wt, J, Ct;
      for (q instanceof Date || (q = /* @__PURE__ */ new Date(+q)); ++U < Y; )
        W.charCodeAt(U) === 37 && (G.push(W.slice(ht, U)), (J = Ap[wt = W.charAt(++U)]) != null ? wt = W.charAt(++U) : J = wt === "e" ? " " : "0", (Ct = Z[wt]) && (wt = Ct(q, J)), G.push(wt), ht = U + 1);
      return G.push(W.slice(ht, U)), G.join("");
    };
  }
  function F(W, Z) {
    return function(q) {
      var G = Qa(1900, void 0, 1), U = S(G, W, q += "", 0), ht, Y;
      if (U != q.length) return null;
      if ("Q" in G) return new Date(G.Q);
      if ("s" in G) return new Date(G.s * 1e3 + ("L" in G ? G.L : 0));
      if (Z && !("Z" in G) && (G.Z = 0), "p" in G && (G.H = G.H % 12 + G.p * 12), G.m === void 0 && (G.m = "q" in G ? G.q : 0), "V" in G) {
        if (G.V < 1 || G.V > 53) return null;
        "w" in G || (G.w = 1), "Z" in G ? (ht = Wh(Qa(G.y, 0, 1)), Y = ht.getUTCDay(), ht = Y > 4 || Y === 0 ? Wc.ceil(ht) : Wc(ht), ht = pf.offset(ht, (G.V - 1) * 7), G.y = ht.getUTCFullYear(), G.m = ht.getUTCMonth(), G.d = ht.getUTCDate() + (G.w + 6) % 7) : (ht = Yh(Qa(G.y, 0, 1)), Y = ht.getDay(), ht = Y > 4 || Y === 0 ? Yo.ceil(ht) : Yo(ht), ht = ps.offset(ht, (G.V - 1) * 7), G.y = ht.getFullYear(), G.m = ht.getMonth(), G.d = ht.getDate() + (G.w + 6) % 7);
      } else ("W" in G || "U" in G) && ("w" in G || (G.w = "u" in G ? G.u % 7 : "W" in G ? 1 : 0), Y = "Z" in G ? Wh(Qa(G.y, 0, 1)).getUTCDay() : Yh(Qa(G.y, 0, 1)).getDay(), G.m = 0, G.d = "W" in G ? (G.w + 6) % 7 + G.W * 7 - (Y + 5) % 7 : G.w + G.U * 7 - (Y + 6) % 7);
      return "Z" in G ? (G.H += G.Z / 100 | 0, G.M += G.Z % 100, Wh(G)) : Yh(G);
    };
  }
  function S(W, Z, q, G) {
    for (var U = 0, ht = Z.length, Y = q.length, wt, J; U < ht; ) {
      if (G >= Y) return -1;
      if (wt = Z.charCodeAt(U++), wt === 37) {
        if (wt = Z.charAt(U++), J = w[wt in Ap ? Z.charAt(U++) : wt], !J || (G = J(W, q, G)) < 0) return -1;
      } else if (wt != q.charCodeAt(G++))
        return -1;
    }
    return G;
  }
  function x(W, Z, q) {
    var G = u.exec(Z.slice(q));
    return G ? (W.p = h.get(G[0].toLowerCase()), q + G[0].length) : -1;
  }
  function C(W, Z, q) {
    var G = p.exec(Z.slice(q));
    return G ? (W.w = y.get(G[0].toLowerCase()), q + G[0].length) : -1;
  }
  function g(W, Z, q) {
    var G = f.exec(Z.slice(q));
    return G ? (W.w = d.get(G[0].toLowerCase()), q + G[0].length) : -1;
  }
  function I(W, Z, q) {
    var G = T.exec(Z.slice(q));
    return G ? (W.m = v.get(G[0].toLowerCase()), q + G[0].length) : -1;
  }
  function k(W, Z, q) {
    var G = m.exec(Z.slice(q));
    return G ? (W.m = _.get(G[0].toLowerCase()), q + G[0].length) : -1;
  }
  function P(W, Z, q) {
    return S(W, e, Z, q);
  }
  function R(W, Z, q) {
    return S(W, n, Z, q);
  }
  function M(W, Z, q) {
    return S(W, i, Z, q);
  }
  function B(W) {
    return a[W.getDay()];
  }
  function N(W) {
    return s[W.getDay()];
  }
  function D(W) {
    return l[W.getMonth()];
  }
  function E(W) {
    return o[W.getMonth()];
  }
  function V(W) {
    return r[+(W.getHours() >= 12)];
  }
  function nt(W) {
    return 1 + ~~(W.getMonth() / 3);
  }
  function O(W) {
    return a[W.getUTCDay()];
  }
  function ct(W) {
    return s[W.getUTCDay()];
  }
  function X(W) {
    return l[W.getUTCMonth()];
  }
  function H(W) {
    return o[W.getUTCMonth()];
  }
  function it(W) {
    return r[+(W.getUTCHours() >= 12)];
  }
  function ot(W) {
    return 1 + ~~(W.getUTCMonth() / 3);
  }
  return {
    format: function(W) {
      var Z = b(W += "", A);
      return Z.toString = function() {
        return W;
      }, Z;
    },
    parse: function(W) {
      var Z = F(W += "", !1);
      return Z.toString = function() {
        return W;
      }, Z;
    },
    utcFormat: function(W) {
      var Z = b(W += "", L);
      return Z.toString = function() {
        return W;
      }, Z;
    },
    utcParse: function(W) {
      var Z = F(W += "", !0);
      return Z.toString = function() {
        return W;
      }, Z;
    }
  };
}
var Ap = { "-": "", _: " ", 0: "0" }, tn = /^\s*\d+/, nE = /^%/, iE = /[\\^$*+?|[\]().{}]/g;
function ae(t, e, n) {
  var i = t < 0 ? "-" : "", r = (i ? -t : t) + "", s = r.length;
  return i + (s < n ? new Array(n - s + 1).join(e) + r : r);
}
function rE(t) {
  return t.replace(iE, "\\$&");
}
function Za(t) {
  return new RegExp("^(?:" + t.map(rE).join("|") + ")", "i");
}
function Ja(t) {
  return new Map(t.map((e, n) => [e.toLowerCase(), n]));
}
function sE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 1));
  return i ? (t.w = +i[0], n + i[0].length) : -1;
}
function aE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 1));
  return i ? (t.u = +i[0], n + i[0].length) : -1;
}
function oE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.U = +i[0], n + i[0].length) : -1;
}
function lE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.V = +i[0], n + i[0].length) : -1;
}
function cE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.W = +i[0], n + i[0].length) : -1;
}
function Lp(t, e, n) {
  var i = tn.exec(e.slice(n, n + 4));
  return i ? (t.y = +i[0], n + i[0].length) : -1;
}
function Ip(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.y = +i[0] + (+i[0] > 68 ? 1900 : 2e3), n + i[0].length) : -1;
}
function uE(t, e, n) {
  var i = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n, n + 6));
  return i ? (t.Z = i[1] ? 0 : -(i[2] + (i[3] || "00")), n + i[0].length) : -1;
}
function hE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 1));
  return i ? (t.q = i[0] * 3 - 3, n + i[0].length) : -1;
}
function dE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.m = i[0] - 1, n + i[0].length) : -1;
}
function Bp(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.d = +i[0], n + i[0].length) : -1;
}
function fE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 3));
  return i ? (t.m = 0, t.d = +i[0], n + i[0].length) : -1;
}
function Dp(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.H = +i[0], n + i[0].length) : -1;
}
function pE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.M = +i[0], n + i[0].length) : -1;
}
function gE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 2));
  return i ? (t.S = +i[0], n + i[0].length) : -1;
}
function yE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 3));
  return i ? (t.L = +i[0], n + i[0].length) : -1;
}
function mE(t, e, n) {
  var i = tn.exec(e.slice(n, n + 6));
  return i ? (t.L = Math.floor(i[0] / 1e3), n + i[0].length) : -1;
}
function xE(t, e, n) {
  var i = nE.exec(e.slice(n, n + 1));
  return i ? n + i[0].length : -1;
}
function bE(t, e, n) {
  var i = tn.exec(e.slice(n));
  return i ? (t.Q = +i[0], n + i[0].length) : -1;
}
function _E(t, e, n) {
  var i = tn.exec(e.slice(n));
  return i ? (t.s = +i[0], n + i[0].length) : -1;
}
function Np(t, e) {
  return ae(t.getDate(), e, 2);
}
function kE(t, e) {
  return ae(t.getHours(), e, 2);
}
function TE(t, e) {
  return ae(t.getHours() % 12 || 12, e, 2);
}
function wE(t, e) {
  return ae(1 + ps.count(kr(t), t), e, 3);
}
function Am(t, e) {
  return ae(t.getMilliseconds(), e, 3);
}
function vE(t, e) {
  return Am(t, e) + "000";
}
function EE(t, e) {
  return ae(t.getMonth() + 1, e, 2);
}
function CE(t, e) {
  return ae(t.getMinutes(), e, 2);
}
function SE(t, e) {
  return ae(t.getSeconds(), e, 2);
}
function AE(t) {
  var e = t.getDay();
  return e === 0 ? 7 : e;
}
function LE(t, e) {
  return ae(kl.count(kr(t) - 1, t), e, 2);
}
function Lm(t) {
  var e = t.getDay();
  return e >= 4 || e === 0 ? gs(t) : gs.ceil(t);
}
function IE(t, e) {
  return t = Lm(t), ae(gs.count(kr(t), t) + (kr(t).getDay() === 4), e, 2);
}
function BE(t) {
  return t.getDay();
}
function DE(t, e) {
  return ae(Yo.count(kr(t) - 1, t), e, 2);
}
function NE(t, e) {
  return ae(t.getFullYear() % 100, e, 2);
}
function FE(t, e) {
  return t = Lm(t), ae(t.getFullYear() % 100, e, 2);
}
function OE(t, e) {
  return ae(t.getFullYear() % 1e4, e, 4);
}
function RE(t, e) {
  var n = t.getDay();
  return t = n >= 4 || n === 0 ? gs(t) : gs.ceil(t), ae(t.getFullYear() % 1e4, e, 4);
}
function ME(t) {
  var e = t.getTimezoneOffset();
  return (e > 0 ? "-" : (e *= -1, "+")) + ae(e / 60 | 0, "0", 2) + ae(e % 60, "0", 2);
}
function Fp(t, e) {
  return ae(t.getUTCDate(), e, 2);
}
function PE(t, e) {
  return ae(t.getUTCHours(), e, 2);
}
function zE(t, e) {
  return ae(t.getUTCHours() % 12 || 12, e, 2);
}
function VE(t, e) {
  return ae(1 + pf.count(ys(t), t), e, 3);
}
function Im(t, e) {
  return ae(t.getUTCMilliseconds(), e, 3);
}
function qE(t, e) {
  return Im(t, e) + "000";
}
function $E(t, e) {
  return ae(t.getUTCMonth() + 1, e, 2);
}
function YE(t, e) {
  return ae(t.getUTCMinutes(), e, 2);
}
function WE(t, e) {
  return ae(t.getUTCSeconds(), e, 2);
}
function UE(t) {
  var e = t.getUTCDay();
  return e === 0 ? 7 : e;
}
function HE(t, e) {
  return ae(Sm.count(ys(t) - 1, t), e, 2);
}
function Bm(t) {
  var e = t.getUTCDay();
  return e >= 4 || e === 0 ? xa(t) : xa.ceil(t);
}
function GE(t, e) {
  return t = Bm(t), ae(xa.count(ys(t), t) + (ys(t).getUTCDay() === 4), e, 2);
}
function jE(t) {
  return t.getUTCDay();
}
function XE(t, e) {
  return ae(Wc.count(ys(t) - 1, t), e, 2);
}
function KE(t, e) {
  return ae(t.getUTCFullYear() % 100, e, 2);
}
function QE(t, e) {
  return t = Bm(t), ae(t.getUTCFullYear() % 100, e, 2);
}
function ZE(t, e) {
  return ae(t.getUTCFullYear() % 1e4, e, 4);
}
function JE(t, e) {
  var n = t.getUTCDay();
  return t = n >= 4 || n === 0 ? xa(t) : xa.ceil(t), ae(t.getUTCFullYear() % 1e4, e, 4);
}
function tC() {
  return "+0000";
}
function Op() {
  return "%";
}
function Rp(t) {
  return +t;
}
function Mp(t) {
  return Math.floor(+t / 1e3);
}
var Ws, Uc;
eC({
  dateTime: "%x, %X",
  date: "%-m/%-d/%Y",
  time: "%-I:%M:%S %p",
  periods: ["AM", "PM"],
  days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
  shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
  shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
});
function eC(t) {
  return Ws = eE(t), Uc = Ws.format, Ws.parse, Ws.utcFormat, Ws.utcParse, Ws;
}
function nC(t) {
  return new Date(t);
}
function iC(t) {
  return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t);
}
function Dm(t, e, n, i, r, s, a, o, l, u) {
  var h = Tm(), f = h.invert, d = h.domain, p = u(".%L"), y = u(":%S"), m = u("%I:%M"), _ = u("%I %p"), T = u("%a %d"), v = u("%b %d"), A = u("%B"), L = u("%Y");
  function w(b) {
    return (l(b) < b ? p : o(b) < b ? y : a(b) < b ? m : s(b) < b ? _ : i(b) < b ? r(b) < b ? T : v : n(b) < b ? A : L)(b);
  }
  return h.invert = function(b) {
    return new Date(f(b));
  }, h.domain = function(b) {
    return arguments.length ? d(Array.from(b, iC)) : d().map(nC);
  }, h.ticks = function(b) {
    var F = d();
    return t(F[0], F[F.length - 1], b ?? 10);
  }, h.tickFormat = function(b, F) {
    return F == null ? w : u(F);
  }, h.nice = function(b) {
    var F = d();
    return (!b || typeof b.range != "function") && (b = e(F[0], F[F.length - 1], b ?? 10)), b ? d(Yv(F, b)) : h;
  }, h.copy = function() {
    return km(h, Dm(t, e, n, i, r, s, a, o, l, u));
  }, h;
}
function rC() {
  return qu.apply(Dm(Jv, tE, kr, Wo, kl, ps, $o, qo, Or, Uc).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments);
}
function sC(t) {
  for (var e = t.length / 6 | 0, n = new Array(e), i = 0; i < e; ) n[i] = "#" + t.slice(i * 6, ++i * 6);
  return n;
}
const Nm = sC("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");
function Be(t) {
  return function() {
    return t;
  };
}
const Pp = Math.abs, rn = Math.atan2, Kr = Math.cos, aC = Math.max, Uh = Math.min, Di = Math.sin, Ks = Math.sqrt, sn = 1e-12, Uo = Math.PI, Hc = Uo / 2, hc = 2 * Uo;
function oC(t) {
  return t > 1 ? 0 : t < -1 ? Uo : Math.acos(t);
}
function zp(t) {
  return t >= 1 ? Hc : t <= -1 ? -Hc : Math.asin(t);
}
function Fm(t) {
  let e = 3;
  return t.digits = function(n) {
    if (!arguments.length) return e;
    if (n == null)
      e = null;
    else {
      const i = Math.floor(n);
      if (!(i >= 0)) throw new RangeError(`invalid digits: ${n}`);
      e = i;
    }
    return t;
  }, () => new bv(e);
}
function lC(t) {
  return t.innerRadius;
}
function cC(t) {
  return t.outerRadius;
}
function uC(t) {
  return t.startAngle;
}
function hC(t) {
  return t.endAngle;
}
function dC(t) {
  return t && t.padAngle;
}
function fC(t, e, n, i, r, s, a, o) {
  var l = n - t, u = i - e, h = a - r, f = o - s, d = f * l - h * u;
  if (!(d * d < sn))
    return d = (h * (e - s) - f * (t - r)) / d, [t + d * l, e + d * u];
}
function Ul(t, e, n, i, r, s, a) {
  var o = t - n, l = e - i, u = (a ? s : -s) / Ks(o * o + l * l), h = u * l, f = -u * o, d = t + h, p = e + f, y = n + h, m = i + f, _ = (d + y) / 2, T = (p + m) / 2, v = y - d, A = m - p, L = v * v + A * A, w = r - s, b = d * m - y * p, F = (A < 0 ? -1 : 1) * Ks(aC(0, w * w * L - b * b)), S = (b * A - v * F) / L, x = (-b * v - A * F) / L, C = (b * A + v * F) / L, g = (-b * v + A * F) / L, I = S - _, k = x - T, P = C - _, R = g - T;
  return I * I + k * k > P * P + R * R && (S = C, x = g), {
    cx: S,
    cy: x,
    x01: -h,
    y01: -f,
    x11: S * (r / w - 1),
    y11: x * (r / w - 1)
  };
}
function ba() {
  var t = lC, e = cC, n = Be(0), i = null, r = uC, s = hC, a = dC, o = null, l = Fm(u);
  function u() {
    var h, f, d = +t.apply(this, arguments), p = +e.apply(this, arguments), y = r.apply(this, arguments) - Hc, m = s.apply(this, arguments) - Hc, _ = Pp(m - y), T = m > y;
    if (o || (o = h = l()), p < d && (f = p, p = d, d = f), !(p > sn)) o.moveTo(0, 0);
    else if (_ > hc - sn)
      o.moveTo(p * Kr(y), p * Di(y)), o.arc(0, 0, p, y, m, !T), d > sn && (o.moveTo(d * Kr(m), d * Di(m)), o.arc(0, 0, d, m, y, T));
    else {
      var v = y, A = m, L = y, w = m, b = _, F = _, S = a.apply(this, arguments) / 2, x = S > sn && (i ? +i.apply(this, arguments) : Ks(d * d + p * p)), C = Uh(Pp(p - d) / 2, +n.apply(this, arguments)), g = C, I = C, k, P;
      if (x > sn) {
        var R = zp(x / d * Di(S)), M = zp(x / p * Di(S));
        (b -= R * 2) > sn ? (R *= T ? 1 : -1, L += R, w -= R) : (b = 0, L = w = (y + m) / 2), (F -= M * 2) > sn ? (M *= T ? 1 : -1, v += M, A -= M) : (F = 0, v = A = (y + m) / 2);
      }
      var B = p * Kr(v), N = p * Di(v), D = d * Kr(w), E = d * Di(w);
      if (C > sn) {
        var V = p * Kr(A), nt = p * Di(A), O = d * Kr(L), ct = d * Di(L), X;
        if (_ < Uo)
          if (X = fC(B, N, O, ct, V, nt, D, E)) {
            var H = B - X[0], it = N - X[1], ot = V - X[0], W = nt - X[1], Z = 1 / Di(oC((H * ot + it * W) / (Ks(H * H + it * it) * Ks(ot * ot + W * W))) / 2), q = Ks(X[0] * X[0] + X[1] * X[1]);
            g = Uh(C, (d - q) / (Z - 1)), I = Uh(C, (p - q) / (Z + 1));
          } else
            g = I = 0;
      }
      F > sn ? I > sn ? (k = Ul(O, ct, B, N, p, I, T), P = Ul(V, nt, D, E, p, I, T), o.moveTo(k.cx + k.x01, k.cy + k.y01), I < C ? o.arc(k.cx, k.cy, I, rn(k.y01, k.x01), rn(P.y01, P.x01), !T) : (o.arc(k.cx, k.cy, I, rn(k.y01, k.x01), rn(k.y11, k.x11), !T), o.arc(0, 0, p, rn(k.cy + k.y11, k.cx + k.x11), rn(P.cy + P.y11, P.cx + P.x11), !T), o.arc(P.cx, P.cy, I, rn(P.y11, P.x11), rn(P.y01, P.x01), !T))) : (o.moveTo(B, N), o.arc(0, 0, p, v, A, !T)) : o.moveTo(B, N), !(d > sn) || !(b > sn) ? o.lineTo(D, E) : g > sn ? (k = Ul(D, E, V, nt, d, -g, T), P = Ul(B, N, O, ct, d, -g, T), o.lineTo(k.cx + k.x01, k.cy + k.y01), g < C ? o.arc(k.cx, k.cy, g, rn(k.y01, k.x01), rn(P.y01, P.x01), !T) : (o.arc(k.cx, k.cy, g, rn(k.y01, k.x01), rn(k.y11, k.x11), !T), o.arc(0, 0, d, rn(k.cy + k.y11, k.cx + k.x11), rn(P.cy + P.y11, P.cx + P.x11), T), o.arc(P.cx, P.cy, g, rn(P.y11, P.x11), rn(P.y01, P.x01), !T))) : o.arc(0, 0, d, w, L, T);
    }
    if (o.closePath(), h) return o = null, h + "" || null;
  }
  return u.centroid = function() {
    var h = (+t.apply(this, arguments) + +e.apply(this, arguments)) / 2, f = (+r.apply(this, arguments) + +s.apply(this, arguments)) / 2 - Uo / 2;
    return [Kr(f) * h, Di(f) * h];
  }, u.innerRadius = function(h) {
    return arguments.length ? (t = typeof h == "function" ? h : Be(+h), u) : t;
  }, u.outerRadius = function(h) {
    return arguments.length ? (e = typeof h == "function" ? h : Be(+h), u) : e;
  }, u.cornerRadius = function(h) {
    return arguments.length ? (n = typeof h == "function" ? h : Be(+h), u) : n;
  }, u.padRadius = function(h) {
    return arguments.length ? (i = h == null ? null : typeof h == "function" ? h : Be(+h), u) : i;
  }, u.startAngle = function(h) {
    return arguments.length ? (r = typeof h == "function" ? h : Be(+h), u) : r;
  }, u.endAngle = function(h) {
    return arguments.length ? (s = typeof h == "function" ? h : Be(+h), u) : s;
  }, u.padAngle = function(h) {
    return arguments.length ? (a = typeof h == "function" ? h : Be(+h), u) : a;
  }, u.context = function(h) {
    return arguments.length ? (o = h ?? null, u) : o;
  }, u;
}
function Om(t) {
  return typeof t == "object" && "length" in t ? t : Array.from(t);
}
function Rm(t) {
  this._context = t;
}
Rm.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(t, e) : this._context.moveTo(t, e);
        break;
      case 1:
        this._point = 2;
      // falls through
      default:
        this._context.lineTo(t, e);
        break;
    }
  }
};
function bn(t) {
  return new Rm(t);
}
function pC(t) {
  return t[0];
}
function gC(t) {
  return t[1];
}
function Tr(t, e) {
  var n = Be(!0), i = null, r = bn, s = null, a = Fm(o);
  t = typeof t == "function" ? t : t === void 0 ? pC : Be(t), e = typeof e == "function" ? e : e === void 0 ? gC : Be(e);
  function o(l) {
    var u, h = (l = Om(l)).length, f, d = !1, p;
    for (i == null && (s = r(p = a())), u = 0; u <= h; ++u)
      !(u < h && n(f = l[u], u, l)) === d && ((d = !d) ? s.lineStart() : s.lineEnd()), d && s.point(+t(f, u, l), +e(f, u, l));
    if (p) return s = null, p + "" || null;
  }
  return o.x = function(l) {
    return arguments.length ? (t = typeof l == "function" ? l : Be(+l), o) : t;
  }, o.y = function(l) {
    return arguments.length ? (e = typeof l == "function" ? l : Be(+l), o) : e;
  }, o.defined = function(l) {
    return arguments.length ? (n = typeof l == "function" ? l : Be(!!l), o) : n;
  }, o.curve = function(l) {
    return arguments.length ? (r = l, i != null && (s = r(i)), o) : r;
  }, o.context = function(l) {
    return arguments.length ? (l == null ? i = s = null : s = r(i = l), o) : i;
  }, o;
}
function yC(t, e) {
  return e < t ? -1 : e > t ? 1 : e >= t ? 0 : NaN;
}
function mC(t) {
  return t;
}
function xC() {
  var t = mC, e = yC, n = null, i = Be(0), r = Be(hc), s = Be(0);
  function a(o) {
    var l, u = (o = Om(o)).length, h, f, d = 0, p = new Array(u), y = new Array(u), m = +i.apply(this, arguments), _ = Math.min(hc, Math.max(-hc, r.apply(this, arguments) - m)), T, v = Math.min(Math.abs(_) / u, s.apply(this, arguments)), A = v * (_ < 0 ? -1 : 1), L;
    for (l = 0; l < u; ++l)
      (L = y[p[l] = l] = +t(o[l], l, o)) > 0 && (d += L);
    for (e != null ? p.sort(function(w, b) {
      return e(y[w], y[b]);
    }) : n != null && p.sort(function(w, b) {
      return n(o[w], o[b]);
    }), l = 0, f = d ? (_ - u * A) / d : 0; l < u; ++l, m = T)
      h = p[l], L = y[h], T = m + (L > 0 ? L * f : 0) + A, y[h] = {
        data: o[h],
        index: l,
        value: L,
        startAngle: m,
        endAngle: T,
        padAngle: v
      };
    return y;
  }
  return a.value = function(o) {
    return arguments.length ? (t = typeof o == "function" ? o : Be(+o), a) : t;
  }, a.sortValues = function(o) {
    return arguments.length ? (e = o, n = null, a) : e;
  }, a.sort = function(o) {
    return arguments.length ? (n = o, e = null, a) : n;
  }, a.startAngle = function(o) {
    return arguments.length ? (i = typeof o == "function" ? o : Be(+o), a) : i;
  }, a.endAngle = function(o) {
    return arguments.length ? (r = typeof o == "function" ? o : Be(+o), a) : r;
  }, a.padAngle = function(o) {
    return arguments.length ? (s = typeof o == "function" ? o : Be(+o), a) : s;
  }, a;
}
class Mm {
  constructor(e, n) {
    this._context = e, this._x = n;
  }
  areaStart() {
    this._line = 0;
  }
  areaEnd() {
    this._line = NaN;
  }
  lineStart() {
    this._point = 0;
  }
  lineEnd() {
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  }
  point(e, n) {
    switch (e = +e, n = +n, this._point) {
      case 0: {
        this._point = 1, this._line ? this._context.lineTo(e, n) : this._context.moveTo(e, n);
        break;
      }
      case 1:
        this._point = 2;
      // falls through
      default: {
        this._x ? this._context.bezierCurveTo(this._x0 = (this._x0 + e) / 2, this._y0, this._x0, n, e, n) : this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + n) / 2, e, this._y0, e, n);
        break;
      }
    }
    this._x0 = e, this._y0 = n;
  }
}
function bC(t) {
  return new Mm(t, !0);
}
function _C(t) {
  return new Mm(t, !1);
}
function Vr() {
}
function Gc(t, e, n) {
  t._context.bezierCurveTo(
    (2 * t._x0 + t._x1) / 3,
    (2 * t._y0 + t._y1) / 3,
    (t._x0 + 2 * t._x1) / 3,
    (t._y0 + 2 * t._y1) / 3,
    (t._x0 + 4 * t._x1 + e) / 6,
    (t._y0 + 4 * t._y1 + n) / 6
  );
}
function $u(t) {
  this._context = t;
}
$u.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 3:
        Gc(this, this._x1, this._y1);
      // falls through
      case 2:
        this._context.lineTo(this._x1, this._y1);
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(t, e) : this._context.moveTo(t, e);
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);
      // falls through
      default:
        Gc(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e;
  }
};
function Tl(t) {
  return new $u(t);
}
function Pm(t) {
  this._context = t;
}
Pm.prototype = {
  areaStart: Vr,
  areaEnd: Vr,
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 1: {
        this._context.moveTo(this._x2, this._y2), this._context.closePath();
        break;
      }
      case 2: {
        this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3), this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3), this._context.closePath();
        break;
      }
      case 3: {
        this.point(this._x2, this._y2), this.point(this._x3, this._y3), this.point(this._x4, this._y4);
        break;
      }
    }
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1, this._x2 = t, this._y2 = e;
        break;
      case 1:
        this._point = 2, this._x3 = t, this._y3 = e;
        break;
      case 2:
        this._point = 3, this._x4 = t, this._y4 = e, this._context.moveTo((this._x0 + 4 * this._x1 + t) / 6, (this._y0 + 4 * this._y1 + e) / 6);
        break;
      default:
        Gc(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e;
  }
};
function kC(t) {
  return new Pm(t);
}
function zm(t) {
  this._context = t;
}
zm.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1;
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3;
        var n = (this._x0 + 4 * this._x1 + t) / 6, i = (this._y0 + 4 * this._y1 + e) / 6;
        this._line ? this._context.lineTo(n, i) : this._context.moveTo(n, i);
        break;
      case 3:
        this._point = 4;
      // falls through
      default:
        Gc(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e;
  }
};
function TC(t) {
  return new zm(t);
}
function Vm(t, e) {
  this._basis = new $u(t), this._beta = e;
}
Vm.prototype = {
  lineStart: function() {
    this._x = [], this._y = [], this._basis.lineStart();
  },
  lineEnd: function() {
    var t = this._x, e = this._y, n = t.length - 1;
    if (n > 0)
      for (var i = t[0], r = e[0], s = t[n] - i, a = e[n] - r, o = -1, l; ++o <= n; )
        l = o / n, this._basis.point(
          this._beta * t[o] + (1 - this._beta) * (i + l * s),
          this._beta * e[o] + (1 - this._beta) * (r + l * a)
        );
    this._x = this._y = null, this._basis.lineEnd();
  },
  point: function(t, e) {
    this._x.push(+t), this._y.push(+e);
  }
};
const wC = (function t(e) {
  function n(i) {
    return e === 1 ? new $u(i) : new Vm(i, e);
  }
  return n.beta = function(i) {
    return t(+i);
  }, n;
})(0.85);
function jc(t, e, n) {
  t._context.bezierCurveTo(
    t._x1 + t._k * (t._x2 - t._x0),
    t._y1 + t._k * (t._y2 - t._y0),
    t._x2 + t._k * (t._x1 - e),
    t._y2 + t._k * (t._y1 - n),
    t._x2,
    t._y2
  );
}
function gf(t, e) {
  this._context = t, this._k = (1 - e) / 6;
}
gf.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2:
        this._context.lineTo(this._x2, this._y2);
        break;
      case 3:
        jc(this, this._x1, this._y1);
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(t, e) : this._context.moveTo(t, e);
        break;
      case 1:
        this._point = 2, this._x1 = t, this._y1 = e;
        break;
      case 2:
        this._point = 3;
      // falls through
      default:
        jc(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = e;
  }
};
const vC = (function t(e) {
  function n(i) {
    return new gf(i, e);
  }
  return n.tension = function(i) {
    return t(+i);
  }, n;
})(0);
function yf(t, e) {
  this._context = t, this._k = (1 - e) / 6;
}
yf.prototype = {
  areaStart: Vr,
  areaEnd: Vr,
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 1: {
        this._context.moveTo(this._x3, this._y3), this._context.closePath();
        break;
      }
      case 2: {
        this._context.lineTo(this._x3, this._y3), this._context.closePath();
        break;
      }
      case 3: {
        this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
        break;
      }
    }
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1, this._x3 = t, this._y3 = e;
        break;
      case 1:
        this._point = 2, this._context.moveTo(this._x4 = t, this._y4 = e);
        break;
      case 2:
        this._point = 3, this._x5 = t, this._y5 = e;
        break;
      default:
        jc(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = e;
  }
};
const EC = (function t(e) {
  function n(i) {
    return new yf(i, e);
  }
  return n.tension = function(i) {
    return t(+i);
  }, n;
})(0);
function mf(t, e) {
  this._context = t, this._k = (1 - e) / 6;
}
mf.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1;
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
        break;
      case 3:
        this._point = 4;
      // falls through
      default:
        jc(this, t, e);
        break;
    }
    this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = e;
  }
};
const CC = (function t(e) {
  function n(i) {
    return new mf(i, e);
  }
  return n.tension = function(i) {
    return t(+i);
  }, n;
})(0);
function xf(t, e, n) {
  var i = t._x1, r = t._y1, s = t._x2, a = t._y2;
  if (t._l01_a > sn) {
    var o = 2 * t._l01_2a + 3 * t._l01_a * t._l12_a + t._l12_2a, l = 3 * t._l01_a * (t._l01_a + t._l12_a);
    i = (i * o - t._x0 * t._l12_2a + t._x2 * t._l01_2a) / l, r = (r * o - t._y0 * t._l12_2a + t._y2 * t._l01_2a) / l;
  }
  if (t._l23_a > sn) {
    var u = 2 * t._l23_2a + 3 * t._l23_a * t._l12_a + t._l12_2a, h = 3 * t._l23_a * (t._l23_a + t._l12_a);
    s = (s * u + t._x1 * t._l23_2a - e * t._l12_2a) / h, a = (a * u + t._y1 * t._l23_2a - n * t._l12_2a) / h;
  }
  t._context.bezierCurveTo(i, r, s, a, t._x2, t._y2);
}
function qm(t, e) {
  this._context = t, this._alpha = e;
}
qm.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2:
        this._context.lineTo(this._x2, this._y2);
        break;
      case 3:
        this.point(this._x2, this._y2);
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    if (t = +t, e = +e, this._point) {
      var n = this._x2 - t, i = this._y2 - e;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + i * i, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(t, e) : this._context.moveTo(t, e);
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3;
      // falls through
      default:
        xf(this, t, e);
        break;
    }
    this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = e;
  }
};
const SC = (function t(e) {
  function n(i) {
    return e ? new qm(i, e) : new gf(i, 0);
  }
  return n.alpha = function(i) {
    return t(+i);
  }, n;
})(0.5);
function $m(t, e) {
  this._context = t, this._alpha = e;
}
$m.prototype = {
  areaStart: Vr,
  areaEnd: Vr,
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 1: {
        this._context.moveTo(this._x3, this._y3), this._context.closePath();
        break;
      }
      case 2: {
        this._context.lineTo(this._x3, this._y3), this._context.closePath();
        break;
      }
      case 3: {
        this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
        break;
      }
    }
  },
  point: function(t, e) {
    if (t = +t, e = +e, this._point) {
      var n = this._x2 - t, i = this._y2 - e;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + i * i, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1, this._x3 = t, this._y3 = e;
        break;
      case 1:
        this._point = 2, this._context.moveTo(this._x4 = t, this._y4 = e);
        break;
      case 2:
        this._point = 3, this._x5 = t, this._y5 = e;
        break;
      default:
        xf(this, t, e);
        break;
    }
    this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = e;
  }
};
const AC = (function t(e) {
  function n(i) {
    return e ? new $m(i, e) : new yf(i, 0);
  }
  return n.alpha = function(i) {
    return t(+i);
  }, n;
})(0.5);
function Ym(t, e) {
  this._context = t, this._alpha = e;
}
Ym.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
  },
  lineEnd: function() {
    (this._line || this._line !== 0 && this._point === 3) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    if (t = +t, e = +e, this._point) {
      var n = this._x2 - t, i = this._y2 - e;
      this._l23_a = Math.sqrt(this._l23_2a = Math.pow(n * n + i * i, this._alpha));
    }
    switch (this._point) {
      case 0:
        this._point = 1;
        break;
      case 1:
        this._point = 2;
        break;
      case 2:
        this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
        break;
      case 3:
        this._point = 4;
      // falls through
      default:
        xf(this, t, e);
        break;
    }
    this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = t, this._y0 = this._y1, this._y1 = this._y2, this._y2 = e;
  }
};
const LC = (function t(e) {
  function n(i) {
    return e ? new Ym(i, e) : new mf(i, 0);
  }
  return n.alpha = function(i) {
    return t(+i);
  }, n;
})(0.5);
function Wm(t) {
  this._context = t;
}
Wm.prototype = {
  areaStart: Vr,
  areaEnd: Vr,
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    this._point && this._context.closePath();
  },
  point: function(t, e) {
    t = +t, e = +e, this._point ? this._context.lineTo(t, e) : (this._point = 1, this._context.moveTo(t, e));
  }
};
function IC(t) {
  return new Wm(t);
}
function Vp(t) {
  return t < 0 ? -1 : 1;
}
function qp(t, e, n) {
  var i = t._x1 - t._x0, r = e - t._x1, s = (t._y1 - t._y0) / (i || r < 0 && -0), a = (n - t._y1) / (r || i < 0 && -0), o = (s * r + a * i) / (i + r);
  return (Vp(s) + Vp(a)) * Math.min(Math.abs(s), Math.abs(a), 0.5 * Math.abs(o)) || 0;
}
function $p(t, e) {
  var n = t._x1 - t._x0;
  return n ? (3 * (t._y1 - t._y0) / n - e) / 2 : e;
}
function Hh(t, e, n) {
  var i = t._x0, r = t._y0, s = t._x1, a = t._y1, o = (s - i) / 3;
  t._context.bezierCurveTo(i + o, r + o * e, s - o, a - o * n, s, a);
}
function Xc(t) {
  this._context = t;
}
Xc.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
  },
  lineEnd: function() {
    switch (this._point) {
      case 2:
        this._context.lineTo(this._x1, this._y1);
        break;
      case 3:
        Hh(this, this._t0, $p(this, this._t0));
        break;
    }
    (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
  },
  point: function(t, e) {
    var n = NaN;
    if (t = +t, e = +e, !(t === this._x1 && e === this._y1)) {
      switch (this._point) {
        case 0:
          this._point = 1, this._line ? this._context.lineTo(t, e) : this._context.moveTo(t, e);
          break;
        case 1:
          this._point = 2;
          break;
        case 2:
          this._point = 3, Hh(this, $p(this, n = qp(this, t, e)), n);
          break;
        default:
          Hh(this, this._t0, n = qp(this, t, e));
          break;
      }
      this._x0 = this._x1, this._x1 = t, this._y0 = this._y1, this._y1 = e, this._t0 = n;
    }
  }
};
function Um(t) {
  this._context = new Hm(t);
}
(Um.prototype = Object.create(Xc.prototype)).point = function(t, e) {
  Xc.prototype.point.call(this, e, t);
};
function Hm(t) {
  this._context = t;
}
Hm.prototype = {
  moveTo: function(t, e) {
    this._context.moveTo(e, t);
  },
  closePath: function() {
    this._context.closePath();
  },
  lineTo: function(t, e) {
    this._context.lineTo(e, t);
  },
  bezierCurveTo: function(t, e, n, i, r, s) {
    this._context.bezierCurveTo(e, t, i, n, s, r);
  }
};
function BC(t) {
  return new Xc(t);
}
function DC(t) {
  return new Um(t);
}
function Gm(t) {
  this._context = t;
}
Gm.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = [], this._y = [];
  },
  lineEnd: function() {
    var t = this._x, e = this._y, n = t.length;
    if (n)
      if (this._line ? this._context.lineTo(t[0], e[0]) : this._context.moveTo(t[0], e[0]), n === 2)
        this._context.lineTo(t[1], e[1]);
      else
        for (var i = Yp(t), r = Yp(e), s = 0, a = 1; a < n; ++s, ++a)
          this._context.bezierCurveTo(i[0][s], r[0][s], i[1][s], r[1][s], t[a], e[a]);
    (this._line || this._line !== 0 && n === 1) && this._context.closePath(), this._line = 1 - this._line, this._x = this._y = null;
  },
  point: function(t, e) {
    this._x.push(+t), this._y.push(+e);
  }
};
function Yp(t) {
  var e, n = t.length - 1, i, r = new Array(n), s = new Array(n), a = new Array(n);
  for (r[0] = 0, s[0] = 2, a[0] = t[0] + 2 * t[1], e = 1; e < n - 1; ++e) r[e] = 1, s[e] = 4, a[e] = 4 * t[e] + 2 * t[e + 1];
  for (r[n - 1] = 2, s[n - 1] = 7, a[n - 1] = 8 * t[n - 1] + t[n], e = 1; e < n; ++e) i = r[e] / s[e - 1], s[e] -= i, a[e] -= i * a[e - 1];
  for (r[n - 1] = a[n - 1] / s[n - 1], e = n - 2; e >= 0; --e) r[e] = (a[e] - r[e + 1]) / s[e];
  for (s[n - 1] = (t[n] + r[n - 1]) / 2, e = 0; e < n - 1; ++e) s[e] = 2 * t[e + 1] - r[e + 1];
  return [r, s];
}
function NC(t) {
  return new Gm(t);
}
function Yu(t, e) {
  this._context = t, this._t = e;
}
Yu.prototype = {
  areaStart: function() {
    this._line = 0;
  },
  areaEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._x = this._y = NaN, this._point = 0;
  },
  lineEnd: function() {
    0 < this._t && this._t < 1 && this._point === 2 && this._context.lineTo(this._x, this._y), (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line >= 0 && (this._t = 1 - this._t, this._line = 1 - this._line);
  },
  point: function(t, e) {
    switch (t = +t, e = +e, this._point) {
      case 0:
        this._point = 1, this._line ? this._context.lineTo(t, e) : this._context.moveTo(t, e);
        break;
      case 1:
        this._point = 2;
      // falls through
      default: {
        if (this._t <= 0)
          this._context.lineTo(this._x, e), this._context.lineTo(t, e);
        else {
          var n = this._x * (1 - this._t) + t * this._t;
          this._context.lineTo(n, this._y), this._context.lineTo(n, e);
        }
        break;
      }
    }
    this._x = t, this._y = e;
  }
};
function FC(t) {
  return new Yu(t, 0.5);
}
function OC(t) {
  return new Yu(t, 0);
}
function RC(t) {
  return new Yu(t, 1);
}
function fo(t, e, n) {
  this.k = t, this.x = e, this.y = n;
}
fo.prototype = {
  constructor: fo,
  scale: function(t) {
    return t === 1 ? this : new fo(this.k * t, this.x, this.y);
  },
  translate: function(t, e) {
    return t === 0 & e === 0 ? this : new fo(this.k, this.x + this.k * t, this.y + this.k * e);
  },
  apply: function(t) {
    return [t[0] * this.k + this.x, t[1] * this.k + this.y];
  },
  applyX: function(t) {
    return t * this.k + this.x;
  },
  applyY: function(t) {
    return t * this.k + this.y;
  },
  invert: function(t) {
    return [(t[0] - this.x) / this.k, (t[1] - this.y) / this.k];
  },
  invertX: function(t) {
    return (t - this.x) / this.k;
  },
  invertY: function(t) {
    return (t - this.y) / this.k;
  },
  rescaleX: function(t) {
    return t.copy().domain(t.range().map(this.invertX, this).map(t.invert, t));
  },
  rescaleY: function(t) {
    return t.copy().domain(t.range().map(this.invertY, this).map(t.invert, t));
  },
  toString: function() {
    return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
  }
};
fo.prototype;
/*! @license DOMPurify 3.1.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.6/LICENSE */
const {
  entries: jm,
  setPrototypeOf: Wp,
  isFrozen: MC,
  getPrototypeOf: PC,
  getOwnPropertyDescriptor: zC
} = Object;
let {
  freeze: wn,
  seal: li,
  create: Xm
} = Object, {
  apply: zd,
  construct: Vd
} = typeof Reflect < "u" && Reflect;
wn || (wn = function(e) {
  return e;
});
li || (li = function(e) {
  return e;
});
zd || (zd = function(e, n, i) {
  return e.apply(n, i);
});
Vd || (Vd = function(e, n) {
  return new e(...n);
});
const Hl = Vn(Array.prototype.forEach), Up = Vn(Array.prototype.pop), to = Vn(Array.prototype.push), dc = Vn(String.prototype.toLowerCase), Gh = Vn(String.prototype.toString), Hp = Vn(String.prototype.match), eo = Vn(String.prototype.replace), VC = Vn(String.prototype.indexOf), qC = Vn(String.prototype.trim), yi = Vn(Object.prototype.hasOwnProperty), gn = Vn(RegExp.prototype.test), no = $C(TypeError);
function Vn(t) {
  return function(e) {
    for (var n = arguments.length, i = new Array(n > 1 ? n - 1 : 0), r = 1; r < n; r++)
      i[r - 1] = arguments[r];
    return zd(t, e, i);
  };
}
function $C(t) {
  return function() {
    for (var e = arguments.length, n = new Array(e), i = 0; i < e; i++)
      n[i] = arguments[i];
    return Vd(t, n);
  };
}
function ee(t, e) {
  let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : dc;
  Wp && Wp(t, null);
  let i = e.length;
  for (; i--; ) {
    let r = e[i];
    if (typeof r == "string") {
      const s = n(r);
      s !== r && (MC(e) || (e[i] = s), r = s);
    }
    t[r] = !0;
  }
  return t;
}
function YC(t) {
  for (let e = 0; e < t.length; e++)
    yi(t, e) || (t[e] = null);
  return t;
}
function Jr(t) {
  const e = Xm(null);
  for (const [n, i] of jm(t))
    yi(t, n) && (Array.isArray(i) ? e[n] = YC(i) : i && typeof i == "object" && i.constructor === Object ? e[n] = Jr(i) : e[n] = i);
  return e;
}
function io(t, e) {
  for (; t !== null; ) {
    const i = zC(t, e);
    if (i) {
      if (i.get)
        return Vn(i.get);
      if (typeof i.value == "function")
        return Vn(i.value);
    }
    t = PC(t);
  }
  function n() {
    return null;
  }
  return n;
}
const Gp = wn(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]), jh = wn(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]), Xh = wn(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]), WC = wn(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]), Kh = wn(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]), UC = wn(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]), jp = wn(["#text"]), Xp = wn(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]), Qh = wn(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]), Kp = wn(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]), Gl = wn(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]), HC = li(/\{\{[\w\W]*|[\w\W]*\}\}/gm), GC = li(/<%[\w\W]*|[\w\W]*%>/gm), jC = li(/\${[\w\W]*}/gm), XC = li(/^data-[\-\w.\u00B7-\uFFFF]/), KC = li(/^aria-[\-\w]+$/), Km = li(
  /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
  // eslint-disable-line no-useless-escape
), QC = li(/^(?:\w+script|data):/i), ZC = li(
  /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
  // eslint-disable-line no-control-regex
), Qm = li(/^html$/i), JC = li(/^[a-z][.\w]*(-[.\w]+)+$/i);
var Qp = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  MUSTACHE_EXPR: HC,
  ERB_EXPR: GC,
  TMPLIT_EXPR: jC,
  DATA_ATTR: XC,
  ARIA_ATTR: KC,
  IS_ALLOWED_URI: Km,
  IS_SCRIPT_OR_DATA: QC,
  ATTR_WHITESPACE: ZC,
  DOCTYPE_NAME: Qm,
  CUSTOM_ELEMENT: JC
});
const ro = {
  element: 1,
  text: 3,
  // Deprecated
  progressingInstruction: 7,
  comment: 8,
  document: 9
}, tS = function() {
  return typeof window > "u" ? null : window;
}, eS = function(e, n) {
  if (typeof e != "object" || typeof e.createPolicy != "function")
    return null;
  let i = null;
  const r = "data-tt-policy-suffix";
  n && n.hasAttribute(r) && (i = n.getAttribute(r));
  const s = "dompurify" + (i ? "#" + i : "");
  try {
    return e.createPolicy(s, {
      createHTML(a) {
        return a;
      },
      createScriptURL(a) {
        return a;
      }
    });
  } catch {
    return console.warn("TrustedTypes policy " + s + " could not be created."), null;
  }
};
function Zm() {
  let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : tS();
  const e = (At) => Zm(At);
  if (e.version = "3.1.6", e.removed = [], !t || !t.document || t.document.nodeType !== ro.document)
    return e.isSupported = !1, e;
  let {
    document: n
  } = t;
  const i = n, r = i.currentScript, {
    DocumentFragment: s,
    HTMLTemplateElement: a,
    Node: o,
    Element: l,
    NodeFilter: u,
    NamedNodeMap: h = t.NamedNodeMap || t.MozNamedAttrMap,
    HTMLFormElement: f,
    DOMParser: d,
    trustedTypes: p
  } = t, y = l.prototype, m = io(y, "cloneNode"), _ = io(y, "remove"), T = io(y, "nextSibling"), v = io(y, "childNodes"), A = io(y, "parentNode");
  if (typeof a == "function") {
    const At = n.createElement("template");
    At.content && At.content.ownerDocument && (n = At.content.ownerDocument);
  }
  let L, w = "";
  const {
    implementation: b,
    createNodeIterator: F,
    createDocumentFragment: S,
    getElementsByTagName: x
  } = n, {
    importNode: C
  } = i;
  let g = {};
  e.isSupported = typeof jm == "function" && typeof A == "function" && b && b.createHTMLDocument !== void 0;
  const {
    MUSTACHE_EXPR: I,
    ERB_EXPR: k,
    TMPLIT_EXPR: P,
    DATA_ATTR: R,
    ARIA_ATTR: M,
    IS_SCRIPT_OR_DATA: B,
    ATTR_WHITESPACE: N,
    CUSTOM_ELEMENT: D
  } = Qp;
  let {
    IS_ALLOWED_URI: E
  } = Qp, V = null;
  const nt = ee({}, [...Gp, ...jh, ...Xh, ...Kh, ...jp]);
  let O = null;
  const ct = ee({}, [...Xp, ...Qh, ...Kp, ...Gl]);
  let X = Object.seal(Xm(null, {
    tagNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    attributeNameCheck: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: null
    },
    allowCustomizedBuiltInElements: {
      writable: !0,
      configurable: !1,
      enumerable: !0,
      value: !1
    }
  })), H = null, it = null, ot = !0, W = !0, Z = !1, q = !0, G = !1, U = !0, ht = !1, Y = !1, wt = !1, J = !1, Ct = !1, Tt = !1, $t = !0, Rt = !1;
  const te = "user-content-";
  let mt = !0, pt = !1, dt = {}, ft = null;
  const j = ee({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
  let $ = null;
  const et = ee({}, ["audio", "video", "img", "source", "image", "track"]);
  let rt = null;
  const ut = ee({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]), Kt = "http://www.w3.org/1998/Math/MathML", Zt = "http://www.w3.org/2000/svg", Qt = "http://www.w3.org/1999/xhtml";
  let Mt = Qt, ne = !1, Bt = null;
  const Te = ee({}, [Kt, Zt, Qt], Gh);
  let ie = null;
  const Bi = ["application/xhtml+xml", "text/html"], Ar = "text/html";
  let Jt = null, se = null;
  const xe = n.createElement("form"), jt = function(st) {
    return st instanceof RegExp || st instanceof Function;
  }, he = function() {
    let st = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    if (!(se && se === st)) {
      if ((!st || typeof st != "object") && (st = {}), st = Jr(st), ie = // eslint-disable-next-line unicorn/prefer-includes
      Bi.indexOf(st.PARSER_MEDIA_TYPE) === -1 ? Ar : st.PARSER_MEDIA_TYPE, Jt = ie === "application/xhtml+xml" ? Gh : dc, V = yi(st, "ALLOWED_TAGS") ? ee({}, st.ALLOWED_TAGS, Jt) : nt, O = yi(st, "ALLOWED_ATTR") ? ee({}, st.ALLOWED_ATTR, Jt) : ct, Bt = yi(st, "ALLOWED_NAMESPACES") ? ee({}, st.ALLOWED_NAMESPACES, Gh) : Te, rt = yi(st, "ADD_URI_SAFE_ATTR") ? ee(
        Jr(ut),
        // eslint-disable-line indent
        st.ADD_URI_SAFE_ATTR,
        // eslint-disable-line indent
        Jt
        // eslint-disable-line indent
      ) : ut, $ = yi(st, "ADD_DATA_URI_TAGS") ? ee(
        Jr(et),
        // eslint-disable-line indent
        st.ADD_DATA_URI_TAGS,
        // eslint-disable-line indent
        Jt
        // eslint-disable-line indent
      ) : et, ft = yi(st, "FORBID_CONTENTS") ? ee({}, st.FORBID_CONTENTS, Jt) : j, H = yi(st, "FORBID_TAGS") ? ee({}, st.FORBID_TAGS, Jt) : {}, it = yi(st, "FORBID_ATTR") ? ee({}, st.FORBID_ATTR, Jt) : {}, dt = yi(st, "USE_PROFILES") ? st.USE_PROFILES : !1, ot = st.ALLOW_ARIA_ATTR !== !1, W = st.ALLOW_DATA_ATTR !== !1, Z = st.ALLOW_UNKNOWN_PROTOCOLS || !1, q = st.ALLOW_SELF_CLOSE_IN_ATTR !== !1, G = st.SAFE_FOR_TEMPLATES || !1, U = st.SAFE_FOR_XML !== !1, ht = st.WHOLE_DOCUMENT || !1, J = st.RETURN_DOM || !1, Ct = st.RETURN_DOM_FRAGMENT || !1, Tt = st.RETURN_TRUSTED_TYPE || !1, wt = st.FORCE_BODY || !1, $t = st.SANITIZE_DOM !== !1, Rt = st.SANITIZE_NAMED_PROPS || !1, mt = st.KEEP_CONTENT !== !1, pt = st.IN_PLACE || !1, E = st.ALLOWED_URI_REGEXP || Km, Mt = st.NAMESPACE || Qt, X = st.CUSTOM_ELEMENT_HANDLING || {}, st.CUSTOM_ELEMENT_HANDLING && jt(st.CUSTOM_ELEMENT_HANDLING.tagNameCheck) && (X.tagNameCheck = st.CUSTOM_ELEMENT_HANDLING.tagNameCheck), st.CUSTOM_ELEMENT_HANDLING && jt(st.CUSTOM_ELEMENT_HANDLING.attributeNameCheck) && (X.attributeNameCheck = st.CUSTOM_ELEMENT_HANDLING.attributeNameCheck), st.CUSTOM_ELEMENT_HANDLING && typeof st.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements == "boolean" && (X.allowCustomizedBuiltInElements = st.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements), G && (W = !1), Ct && (J = !0), dt && (V = ee({}, jp), O = [], dt.html === !0 && (ee(V, Gp), ee(O, Xp)), dt.svg === !0 && (ee(V, jh), ee(O, Qh), ee(O, Gl)), dt.svgFilters === !0 && (ee(V, Xh), ee(O, Qh), ee(O, Gl)), dt.mathMl === !0 && (ee(V, Kh), ee(O, Kp), ee(O, Gl))), st.ADD_TAGS && (V === nt && (V = Jr(V)), ee(V, st.ADD_TAGS, Jt)), st.ADD_ATTR && (O === ct && (O = Jr(O)), ee(O, st.ADD_ATTR, Jt)), st.ADD_URI_SAFE_ATTR && ee(rt, st.ADD_URI_SAFE_ATTR, Jt), st.FORBID_CONTENTS && (ft === j && (ft = Jr(ft)), ee(ft, st.FORBID_CONTENTS, Jt)), mt && (V["#text"] = !0), ht && ee(V, ["html", "head", "body"]), V.table && (ee(V, ["tbody"]), delete H.tbody), st.TRUSTED_TYPES_POLICY) {
        if (typeof st.TRUSTED_TYPES_POLICY.createHTML != "function")
          throw no('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
        if (typeof st.TRUSTED_TYPES_POLICY.createScriptURL != "function")
          throw no('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
        L = st.TRUSTED_TYPES_POLICY, w = L.createHTML("");
      } else
        L === void 0 && (L = eS(p, r)), L !== null && typeof w == "string" && (w = L.createHTML(""));
      wn && wn(st), se = st;
    }
  }, Vt = ee({}, ["mi", "mo", "mn", "ms", "mtext"]), re = ee({}, ["foreignobject", "annotation-xml"]), oe = ee({}, ["title", "style", "font", "a", "script"]), Xt = ee({}, [...jh, ...Xh, ...WC]), Wt = ee({}, [...Kh, ...UC]), Pt = function(st) {
    let _t = A(st);
    (!_t || !_t.tagName) && (_t = {
      namespaceURI: Mt,
      tagName: "template"
    });
    const St = dc(st.tagName), de = dc(_t.tagName);
    return Bt[st.namespaceURI] ? st.namespaceURI === Zt ? _t.namespaceURI === Qt ? St === "svg" : _t.namespaceURI === Kt ? St === "svg" && (de === "annotation-xml" || Vt[de]) : !!Xt[St] : st.namespaceURI === Kt ? _t.namespaceURI === Qt ? St === "math" : _t.namespaceURI === Zt ? St === "math" && re[de] : !!Wt[St] : st.namespaceURI === Qt ? _t.namespaceURI === Zt && !re[de] || _t.namespaceURI === Kt && !Vt[de] ? !1 : !Wt[St] && (oe[St] || !Xt[St]) : !!(ie === "application/xhtml+xml" && Bt[st.namespaceURI]) : !1;
  }, fe = function(st) {
    to(e.removed, {
      element: st
    });
    try {
      A(st).removeChild(st);
    } catch {
      _(st);
    }
  }, le = function(st, _t) {
    try {
      to(e.removed, {
        attribute: _t.getAttributeNode(st),
        from: _t
      });
    } catch {
      to(e.removed, {
        attribute: null,
        from: _t
      });
    }
    if (_t.removeAttribute(st), st === "is" && !O[st])
      if (J || Ct)
        try {
          fe(_t);
        } catch {
        }
      else
        try {
          _t.setAttribute(st, "");
        } catch {
        }
  }, Ga = function(st) {
    let _t = null, St = null;
    if (wt)
      st = "<remove></remove>" + st;
    else {
      const pe = Hp(st, /^[\r\n\t ]+/);
      St = pe && pe[0];
    }
    ie === "application/xhtml+xml" && Mt === Qt && (st = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + st + "</body></html>");
    const de = L ? L.createHTML(st) : st;
    if (Mt === Qt)
      try {
        _t = new d().parseFromString(de, ie);
      } catch {
      }
    if (!_t || !_t.documentElement) {
      _t = b.createDocument(Mt, "template", null);
      try {
        _t.documentElement.innerHTML = ne ? w : de;
      } catch {
      }
    }
    const Fe = _t.body || _t.documentElement;
    return st && St && Fe.insertBefore(n.createTextNode(St), Fe.childNodes[0] || null), Mt === Qt ? x.call(_t, ht ? "html" : "body")[0] : ht ? _t.documentElement : Fe;
  }, di = function(st) {
    return F.call(
      st.ownerDocument || st,
      st,
      // eslint-disable-next-line no-bitwise
      u.SHOW_ELEMENT | u.SHOW_COMMENT | u.SHOW_TEXT | u.SHOW_PROCESSING_INSTRUCTION | u.SHOW_CDATA_SECTION,
      null
    );
  }, Un = function(st) {
    return st instanceof f && (typeof st.nodeName != "string" || typeof st.textContent != "string" || typeof st.removeChild != "function" || !(st.attributes instanceof h) || typeof st.removeAttribute != "function" || typeof st.setAttribute != "function" || typeof st.namespaceURI != "string" || typeof st.insertBefore != "function" || typeof st.hasChildNodes != "function");
  }, Hn = function(st) {
    return typeof o == "function" && st instanceof o;
  }, $e = function(st, _t, St) {
    g[st] && Hl(g[st], (de) => {
      de.call(e, _t, St, se);
    });
  }, Gn = function(st) {
    let _t = null;
    if ($e("beforeSanitizeElements", st, null), Un(st))
      return fe(st), !0;
    const St = Jt(st.nodeName);
    if ($e("uponSanitizeElement", st, {
      tagName: St,
      allowedTags: V
    }), st.hasChildNodes() && !Hn(st.firstElementChild) && gn(/<[/\w]/g, st.innerHTML) && gn(/<[/\w]/g, st.textContent) || st.nodeType === ro.progressingInstruction || U && st.nodeType === ro.comment && gn(/<[/\w]/g, st.data))
      return fe(st), !0;
    if (!V[St] || H[St]) {
      if (!H[St] && Xn(St) && (X.tagNameCheck instanceof RegExp && gn(X.tagNameCheck, St) || X.tagNameCheck instanceof Function && X.tagNameCheck(St)))
        return !1;
      if (mt && !ft[St]) {
        const de = A(st) || st.parentNode, Fe = v(st) || st.childNodes;
        if (Fe && de) {
          const pe = Fe.length;
          for (let Et = pe - 1; Et >= 0; --Et) {
            const Lt = m(Fe[Et], !0);
            Lt.__removalCount = (st.__removalCount || 0) + 1, de.insertBefore(Lt, T(st));
          }
        }
      }
      return fe(st), !0;
    }
    return st instanceof l && !Pt(st) || (St === "noscript" || St === "noembed" || St === "noframes") && gn(/<\/no(script|embed|frames)/i, st.innerHTML) ? (fe(st), !0) : (G && st.nodeType === ro.text && (_t = st.textContent, Hl([I, k, P], (de) => {
      _t = eo(_t, de, " ");
    }), st.textContent !== _t && (to(e.removed, {
      element: st.cloneNode()
    }), st.textContent = _t)), $e("afterSanitizeElements", st, null), !1);
  }, jn = function(st, _t, St) {
    if ($t && (_t === "id" || _t === "name") && (St in n || St in xe))
      return !1;
    if (!(W && !it[_t] && gn(R, _t))) {
      if (!(ot && gn(M, _t))) {
        if (!O[_t] || it[_t]) {
          if (
            // First condition does a very basic check if a) it's basically a valid custom element tagname AND
            // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
            !(Xn(st) && (X.tagNameCheck instanceof RegExp && gn(X.tagNameCheck, st) || X.tagNameCheck instanceof Function && X.tagNameCheck(st)) && (X.attributeNameCheck instanceof RegExp && gn(X.attributeNameCheck, _t) || X.attributeNameCheck instanceof Function && X.attributeNameCheck(_t)) || // Alternative, second condition checks if it's an `is`-attribute, AND
            // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
            _t === "is" && X.allowCustomizedBuiltInElements && (X.tagNameCheck instanceof RegExp && gn(X.tagNameCheck, St) || X.tagNameCheck instanceof Function && X.tagNameCheck(St)))
          ) return !1;
        } else if (!rt[_t]) {
          if (!gn(E, eo(St, N, ""))) {
            if (!((_t === "src" || _t === "xlink:href" || _t === "href") && st !== "script" && VC(St, "data:") === 0 && $[st])) {
              if (!(Z && !gn(B, eo(St, N, "")))) {
                if (St)
                  return !1;
              }
            }
          }
        }
      }
    }
    return !0;
  }, Xn = function(st) {
    return st !== "annotation-xml" && Hp(st, D);
  }, Kn = function(st) {
    $e("beforeSanitizeAttributes", st, null);
    const {
      attributes: _t
    } = st;
    if (!_t)
      return;
    const St = {
      attrName: "",
      attrValue: "",
      keepAttr: !0,
      allowedAttributes: O
    };
    let de = _t.length;
    for (; de--; ) {
      const Fe = _t[de], {
        name: pe,
        namespaceURI: Et,
        value: Lt
      } = Fe, Yt = Jt(pe);
      let kt = pe === "value" ? Lt : qC(Lt);
      if (St.attrName = Yt, St.attrValue = kt, St.keepAttr = !0, St.forceKeepAttr = void 0, $e("uponSanitizeAttribute", st, St), kt = St.attrValue, U && gn(/((--!?|])>)|<\/(style|title)/i, kt)) {
        le(pe, st);
        continue;
      }
      if (St.forceKeepAttr || (le(pe, st), !St.keepAttr))
        continue;
      if (!q && gn(/\/>/i, kt)) {
        le(pe, st);
        continue;
      }
      G && Hl([I, k, P], (K) => {
        kt = eo(kt, K, " ");
      });
      const ge = Jt(st.nodeName);
      if (jn(ge, Yt, kt)) {
        if (Rt && (Yt === "id" || Yt === "name") && (le(pe, st), kt = te + kt), L && typeof p == "object" && typeof p.getAttributeType == "function" && !Et)
          switch (p.getAttributeType(ge, Yt)) {
            case "TrustedHTML": {
              kt = L.createHTML(kt);
              break;
            }
            case "TrustedScriptURL": {
              kt = L.createScriptURL(kt);
              break;
            }
          }
        try {
          Et ? st.setAttributeNS(Et, pe, kt) : st.setAttribute(pe, kt), Un(st) ? fe(st) : Up(e.removed);
        } catch {
        }
      }
    }
    $e("afterSanitizeAttributes", st, null);
  }, fi = function At(st) {
    let _t = null;
    const St = di(st);
    for ($e("beforeSanitizeShadowDOM", st, null); _t = St.nextNode(); )
      $e("uponSanitizeShadowNode", _t, null), !Gn(_t) && (_t.content instanceof s && At(_t.content), Kn(_t));
    $e("afterSanitizeShadowDOM", st, null);
  };
  return e.sanitize = function(At) {
    let st = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _t = null, St = null, de = null, Fe = null;
    if (ne = !At, ne && (At = "<!-->"), typeof At != "string" && !Hn(At))
      if (typeof At.toString == "function") {
        if (At = At.toString(), typeof At != "string")
          throw no("dirty is not a string, aborting");
      } else
        throw no("toString is not a function");
    if (!e.isSupported)
      return At;
    if (Y || he(st), e.removed = [], typeof At == "string" && (pt = !1), pt) {
      if (At.nodeName) {
        const Lt = Jt(At.nodeName);
        if (!V[Lt] || H[Lt])
          throw no("root node is forbidden and cannot be sanitized in-place");
      }
    } else if (At instanceof o)
      _t = Ga("<!---->"), St = _t.ownerDocument.importNode(At, !0), St.nodeType === ro.element && St.nodeName === "BODY" || St.nodeName === "HTML" ? _t = St : _t.appendChild(St);
    else {
      if (!J && !G && !ht && // eslint-disable-next-line unicorn/prefer-includes
      At.indexOf("<") === -1)
        return L && Tt ? L.createHTML(At) : At;
      if (_t = Ga(At), !_t)
        return J ? null : Tt ? w : "";
    }
    _t && wt && fe(_t.firstChild);
    const pe = di(pt ? At : _t);
    for (; de = pe.nextNode(); )
      Gn(de) || (de.content instanceof s && fi(de.content), Kn(de));
    if (pt)
      return At;
    if (J) {
      if (Ct)
        for (Fe = S.call(_t.ownerDocument); _t.firstChild; )
          Fe.appendChild(_t.firstChild);
      else
        Fe = _t;
      return (O.shadowroot || O.shadowrootmode) && (Fe = C.call(i, Fe, !0)), Fe;
    }
    let Et = ht ? _t.outerHTML : _t.innerHTML;
    return ht && V["!doctype"] && _t.ownerDocument && _t.ownerDocument.doctype && _t.ownerDocument.doctype.name && gn(Qm, _t.ownerDocument.doctype.name) && (Et = "<!DOCTYPE " + _t.ownerDocument.doctype.name + `>
` + Et), G && Hl([I, k, P], (Lt) => {
      Et = eo(Et, Lt, " ");
    }), L && Tt ? L.createHTML(Et) : Et;
  }, e.setConfig = function() {
    let At = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
    he(At), Y = !0;
  }, e.clearConfig = function() {
    se = null, Y = !1;
  }, e.isValidAttribute = function(At, st, _t) {
    se || he({});
    const St = Jt(At), de = Jt(st);
    return jn(St, de, _t);
  }, e.addHook = function(At, st) {
    typeof st == "function" && (g[At] = g[At] || [], to(g[At], st));
  }, e.removeHook = function(At) {
    if (g[At])
      return Up(g[At]);
  }, e.removeHooks = function(At) {
    g[At] && (g[At] = []);
  }, e.removeAllHooks = function() {
    g = {};
  }, e;
}
var _a = Zm();
const fc = {
  /* CLAMP */
  min: {
    r: 0,
    g: 0,
    b: 0,
    s: 0,
    l: 0,
    a: 0
  },
  max: {
    r: 255,
    g: 255,
    b: 255,
    h: 360,
    s: 100,
    l: 100,
    a: 1
  },
  clamp: {
    r: (t) => t >= 255 ? 255 : t < 0 ? 0 : t,
    g: (t) => t >= 255 ? 255 : t < 0 ? 0 : t,
    b: (t) => t >= 255 ? 255 : t < 0 ? 0 : t,
    h: (t) => t % 360,
    s: (t) => t >= 100 ? 100 : t < 0 ? 0 : t,
    l: (t) => t >= 100 ? 100 : t < 0 ? 0 : t,
    a: (t) => t >= 1 ? 1 : t < 0 ? 0 : t
  },
  /* CONVERSION */
  //SOURCE: https://planetcalc.com/7779
  toLinear: (t) => {
    const e = t / 255;
    return t > 0.03928 ? Math.pow((e + 0.055) / 1.055, 2.4) : e / 12.92;
  },
  //SOURCE: https://gist.github.com/mjackson/5311256
  hue2rgb: (t, e, n) => (n < 0 && (n += 1), n > 1 && (n -= 1), n < 1 / 6 ? t + (e - t) * 6 * n : n < 1 / 2 ? e : n < 2 / 3 ? t + (e - t) * (2 / 3 - n) * 6 : t),
  hsl2rgb: ({ h: t, s: e, l: n }, i) => {
    if (!e)
      return n * 2.55;
    t /= 360, e /= 100, n /= 100;
    const r = n < 0.5 ? n * (1 + e) : n + e - n * e, s = 2 * n - r;
    switch (i) {
      case "r":
        return fc.hue2rgb(s, r, t + 1 / 3) * 255;
      case "g":
        return fc.hue2rgb(s, r, t) * 255;
      case "b":
        return fc.hue2rgb(s, r, t - 1 / 3) * 255;
    }
  },
  rgb2hsl: ({ r: t, g: e, b: n }, i) => {
    t /= 255, e /= 255, n /= 255;
    const r = Math.max(t, e, n), s = Math.min(t, e, n), a = (r + s) / 2;
    if (i === "l")
      return a * 100;
    if (r === s)
      return 0;
    const o = r - s, l = a > 0.5 ? o / (2 - r - s) : o / (r + s);
    if (i === "s")
      return l * 100;
    switch (r) {
      case t:
        return ((e - n) / o + (e < n ? 6 : 0)) * 60;
      case e:
        return ((n - t) / o + 2) * 60;
      case n:
        return ((t - e) / o + 4) * 60;
      default:
        return -1;
    }
  }
}, nS = {
  /* API */
  clamp: (t, e, n) => e > n ? Math.min(e, Math.max(n, t)) : Math.min(n, Math.max(e, t)),
  round: (t) => Math.round(t * 1e10) / 1e10
}, iS = {
  /* API */
  dec2hex: (t) => {
    const e = Math.round(t).toString(16);
    return e.length > 1 ? e : `0${e}`;
  }
}, zt = {
  channel: fc,
  lang: nS,
  unit: iS
}, Dr = {};
for (let t = 0; t <= 255; t++)
  Dr[t] = zt.unit.dec2hex(t);
const an = {
  ALL: 0,
  RGB: 1,
  HSL: 2
};
class rS {
  constructor() {
    this.type = an.ALL;
  }
  /* API */
  get() {
    return this.type;
  }
  set(e) {
    if (this.type && this.type !== e)
      throw new Error("Cannot change both RGB and HSL channels at the same time");
    this.type = e;
  }
  reset() {
    this.type = an.ALL;
  }
  is(e) {
    return this.type === e;
  }
}
class sS {
  /* CONSTRUCTOR */
  constructor(e, n) {
    this.color = n, this.changed = !1, this.data = e, this.type = new rS();
  }
  /* API */
  set(e, n) {
    return this.color = n, this.changed = !1, this.data = e, this.type.type = an.ALL, this;
  }
  /* HELPERS */
  _ensureHSL() {
    const e = this.data, { h: n, s: i, l: r } = e;
    n === void 0 && (e.h = zt.channel.rgb2hsl(e, "h")), i === void 0 && (e.s = zt.channel.rgb2hsl(e, "s")), r === void 0 && (e.l = zt.channel.rgb2hsl(e, "l"));
  }
  _ensureRGB() {
    const e = this.data, { r: n, g: i, b: r } = e;
    n === void 0 && (e.r = zt.channel.hsl2rgb(e, "r")), i === void 0 && (e.g = zt.channel.hsl2rgb(e, "g")), r === void 0 && (e.b = zt.channel.hsl2rgb(e, "b"));
  }
  /* GETTERS */
  get r() {
    const e = this.data, n = e.r;
    return !this.type.is(an.HSL) && n !== void 0 ? n : (this._ensureHSL(), zt.channel.hsl2rgb(e, "r"));
  }
  get g() {
    const e = this.data, n = e.g;
    return !this.type.is(an.HSL) && n !== void 0 ? n : (this._ensureHSL(), zt.channel.hsl2rgb(e, "g"));
  }
  get b() {
    const e = this.data, n = e.b;
    return !this.type.is(an.HSL) && n !== void 0 ? n : (this._ensureHSL(), zt.channel.hsl2rgb(e, "b"));
  }
  get h() {
    const e = this.data, n = e.h;
    return !this.type.is(an.RGB) && n !== void 0 ? n : (this._ensureRGB(), zt.channel.rgb2hsl(e, "h"));
  }
  get s() {
    const e = this.data, n = e.s;
    return !this.type.is(an.RGB) && n !== void 0 ? n : (this._ensureRGB(), zt.channel.rgb2hsl(e, "s"));
  }
  get l() {
    const e = this.data, n = e.l;
    return !this.type.is(an.RGB) && n !== void 0 ? n : (this._ensureRGB(), zt.channel.rgb2hsl(e, "l"));
  }
  get a() {
    return this.data.a;
  }
  /* SETTERS */
  set r(e) {
    this.type.set(an.RGB), this.changed = !0, this.data.r = e;
  }
  set g(e) {
    this.type.set(an.RGB), this.changed = !0, this.data.g = e;
  }
  set b(e) {
    this.type.set(an.RGB), this.changed = !0, this.data.b = e;
  }
  set h(e) {
    this.type.set(an.HSL), this.changed = !0, this.data.h = e;
  }
  set s(e) {
    this.type.set(an.HSL), this.changed = !0, this.data.s = e;
  }
  set l(e) {
    this.type.set(an.HSL), this.changed = !0, this.data.l = e;
  }
  set a(e) {
    this.changed = !0, this.data.a = e;
  }
}
const Wu = new sS({ r: 0, g: 0, b: 0, a: 0 }, "transparent"), ra = {
  /* VARIABLES */
  re: /^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,
  /* API */
  parse: (t) => {
    if (t.charCodeAt(0) !== 35)
      return;
    const e = t.match(ra.re);
    if (!e)
      return;
    const n = e[1], i = parseInt(n, 16), r = n.length, s = r % 4 === 0, a = r > 4, o = a ? 1 : 17, l = a ? 8 : 4, u = s ? 0 : -1, h = a ? 255 : 15;
    return Wu.set({
      r: (i >> l * (u + 3) & h) * o,
      g: (i >> l * (u + 2) & h) * o,
      b: (i >> l * (u + 1) & h) * o,
      a: s ? (i & h) * o / 255 : 1
    }, t);
  },
  stringify: (t) => {
    const { r: e, g: n, b: i, a: r } = t;
    return r < 1 ? `#${Dr[Math.round(e)]}${Dr[Math.round(n)]}${Dr[Math.round(i)]}${Dr[Math.round(r * 255)]}` : `#${Dr[Math.round(e)]}${Dr[Math.round(n)]}${Dr[Math.round(i)]}`;
  }
}, as = {
  /* VARIABLES */
  re: /^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,
  hueRe: /^(.+?)(deg|grad|rad|turn)$/i,
  /* HELPERS */
  _hue2deg: (t) => {
    const e = t.match(as.hueRe);
    if (e) {
      const [, n, i] = e;
      switch (i) {
        case "grad":
          return zt.channel.clamp.h(parseFloat(n) * 0.9);
        case "rad":
          return zt.channel.clamp.h(parseFloat(n) * 180 / Math.PI);
        case "turn":
          return zt.channel.clamp.h(parseFloat(n) * 360);
      }
    }
    return zt.channel.clamp.h(parseFloat(t));
  },
  /* API */
  parse: (t) => {
    const e = t.charCodeAt(0);
    if (e !== 104 && e !== 72)
      return;
    const n = t.match(as.re);
    if (!n)
      return;
    const [, i, r, s, a, o] = n;
    return Wu.set({
      h: as._hue2deg(i),
      s: zt.channel.clamp.s(parseFloat(r)),
      l: zt.channel.clamp.l(parseFloat(s)),
      a: a ? zt.channel.clamp.a(o ? parseFloat(a) / 100 : parseFloat(a)) : 1
    }, t);
  },
  stringify: (t) => {
    const { h: e, s: n, l: i, a: r } = t;
    return r < 1 ? `hsla(${zt.lang.round(e)}, ${zt.lang.round(n)}%, ${zt.lang.round(i)}%, ${r})` : `hsl(${zt.lang.round(e)}, ${zt.lang.round(n)}%, ${zt.lang.round(i)}%)`;
  }
}, wo = {
  /* VARIABLES */
  colors: {
    aliceblue: "#f0f8ff",
    antiquewhite: "#faebd7",
    aqua: "#00ffff",
    aquamarine: "#7fffd4",
    azure: "#f0ffff",
    beige: "#f5f5dc",
    bisque: "#ffe4c4",
    black: "#000000",
    blanchedalmond: "#ffebcd",
    blue: "#0000ff",
    blueviolet: "#8a2be2",
    brown: "#a52a2a",
    burlywood: "#deb887",
    cadetblue: "#5f9ea0",
    chartreuse: "#7fff00",
    chocolate: "#d2691e",
    coral: "#ff7f50",
    cornflowerblue: "#6495ed",
    cornsilk: "#fff8dc",
    crimson: "#dc143c",
    cyanaqua: "#00ffff",
    darkblue: "#00008b",
    darkcyan: "#008b8b",
    darkgoldenrod: "#b8860b",
    darkgray: "#a9a9a9",
    darkgreen: "#006400",
    darkgrey: "#a9a9a9",
    darkkhaki: "#bdb76b",
    darkmagenta: "#8b008b",
    darkolivegreen: "#556b2f",
    darkorange: "#ff8c00",
    darkorchid: "#9932cc",
    darkred: "#8b0000",
    darksalmon: "#e9967a",
    darkseagreen: "#8fbc8f",
    darkslateblue: "#483d8b",
    darkslategray: "#2f4f4f",
    darkslategrey: "#2f4f4f",
    darkturquoise: "#00ced1",
    darkviolet: "#9400d3",
    deeppink: "#ff1493",
    deepskyblue: "#00bfff",
    dimgray: "#696969",
    dimgrey: "#696969",
    dodgerblue: "#1e90ff",
    firebrick: "#b22222",
    floralwhite: "#fffaf0",
    forestgreen: "#228b22",
    fuchsia: "#ff00ff",
    gainsboro: "#dcdcdc",
    ghostwhite: "#f8f8ff",
    gold: "#ffd700",
    goldenrod: "#daa520",
    gray: "#808080",
    green: "#008000",
    greenyellow: "#adff2f",
    grey: "#808080",
    honeydew: "#f0fff0",
    hotpink: "#ff69b4",
    indianred: "#cd5c5c",
    indigo: "#4b0082",
    ivory: "#fffff0",
    khaki: "#f0e68c",
    lavender: "#e6e6fa",
    lavenderblush: "#fff0f5",
    lawngreen: "#7cfc00",
    lemonchiffon: "#fffacd",
    lightblue: "#add8e6",
    lightcoral: "#f08080",
    lightcyan: "#e0ffff",
    lightgoldenrodyellow: "#fafad2",
    lightgray: "#d3d3d3",
    lightgreen: "#90ee90",
    lightgrey: "#d3d3d3",
    lightpink: "#ffb6c1",
    lightsalmon: "#ffa07a",
    lightseagreen: "#20b2aa",
    lightskyblue: "#87cefa",
    lightslategray: "#778899",
    lightslategrey: "#778899",
    lightsteelblue: "#b0c4de",
    lightyellow: "#ffffe0",
    lime: "#00ff00",
    limegreen: "#32cd32",
    linen: "#faf0e6",
    magenta: "#ff00ff",
    maroon: "#800000",
    mediumaquamarine: "#66cdaa",
    mediumblue: "#0000cd",
    mediumorchid: "#ba55d3",
    mediumpurple: "#9370db",
    mediumseagreen: "#3cb371",
    mediumslateblue: "#7b68ee",
    mediumspringgreen: "#00fa9a",
    mediumturquoise: "#48d1cc",
    mediumvioletred: "#c71585",
    midnightblue: "#191970",
    mintcream: "#f5fffa",
    mistyrose: "#ffe4e1",
    moccasin: "#ffe4b5",
    navajowhite: "#ffdead",
    navy: "#000080",
    oldlace: "#fdf5e6",
    olive: "#808000",
    olivedrab: "#6b8e23",
    orange: "#ffa500",
    orangered: "#ff4500",
    orchid: "#da70d6",
    palegoldenrod: "#eee8aa",
    palegreen: "#98fb98",
    paleturquoise: "#afeeee",
    palevioletred: "#db7093",
    papayawhip: "#ffefd5",
    peachpuff: "#ffdab9",
    peru: "#cd853f",
    pink: "#ffc0cb",
    plum: "#dda0dd",
    powderblue: "#b0e0e6",
    purple: "#800080",
    rebeccapurple: "#663399",
    red: "#ff0000",
    rosybrown: "#bc8f8f",
    royalblue: "#4169e1",
    saddlebrown: "#8b4513",
    salmon: "#fa8072",
    sandybrown: "#f4a460",
    seagreen: "#2e8b57",
    seashell: "#fff5ee",
    sienna: "#a0522d",
    silver: "#c0c0c0",
    skyblue: "#87ceeb",
    slateblue: "#6a5acd",
    slategray: "#708090",
    slategrey: "#708090",
    snow: "#fffafa",
    springgreen: "#00ff7f",
    tan: "#d2b48c",
    teal: "#008080",
    thistle: "#d8bfd8",
    transparent: "#00000000",
    turquoise: "#40e0d0",
    violet: "#ee82ee",
    wheat: "#f5deb3",
    white: "#ffffff",
    whitesmoke: "#f5f5f5",
    yellow: "#ffff00",
    yellowgreen: "#9acd32"
  },
  /* API */
  parse: (t) => {
    t = t.toLowerCase();
    const e = wo.colors[t];
    if (e)
      return ra.parse(e);
  },
  stringify: (t) => {
    const e = ra.stringify(t);
    for (const n in wo.colors)
      if (wo.colors[n] === e)
        return n;
  }
}, po = {
  /* VARIABLES */
  re: /^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,
  /* API */
  parse: (t) => {
    const e = t.charCodeAt(0);
    if (e !== 114 && e !== 82)
      return;
    const n = t.match(po.re);
    if (!n)
      return;
    const [, i, r, s, a, o, l, u, h] = n;
    return Wu.set({
      r: zt.channel.clamp.r(r ? parseFloat(i) * 2.55 : parseFloat(i)),
      g: zt.channel.clamp.g(a ? parseFloat(s) * 2.55 : parseFloat(s)),
      b: zt.channel.clamp.b(l ? parseFloat(o) * 2.55 : parseFloat(o)),
      a: u ? zt.channel.clamp.a(h ? parseFloat(u) / 100 : parseFloat(u)) : 1
    }, t);
  },
  stringify: (t) => {
    const { r: e, g: n, b: i, a: r } = t;
    return r < 1 ? `rgba(${zt.lang.round(e)}, ${zt.lang.round(n)}, ${zt.lang.round(i)}, ${zt.lang.round(r)})` : `rgb(${zt.lang.round(e)}, ${zt.lang.round(n)}, ${zt.lang.round(i)})`;
  }
}, Si = {
  /* VARIABLES */
  format: {
    keyword: wo,
    hex: ra,
    rgb: po,
    rgba: po,
    hsl: as,
    hsla: as
  },
  /* API */
  parse: (t) => {
    if (typeof t != "string")
      return t;
    const e = ra.parse(t) || po.parse(t) || as.parse(t) || wo.parse(t);
    if (e)
      return e;
    throw new Error(`Unsupported color format: "${t}"`);
  },
  stringify: (t) => !t.changed && t.color ? t.color : t.type.is(an.HSL) || t.data.r === void 0 ? as.stringify(t) : t.a < 1 || !Number.isInteger(t.r) || !Number.isInteger(t.g) || !Number.isInteger(t.b) ? po.stringify(t) : ra.stringify(t)
}, Jm = (t, e) => {
  const n = Si.parse(t);
  for (const i in e)
    n[i] = zt.channel.clamp[i](e[i]);
  return Si.stringify(n);
}, cs = (t, e, n = 0, i = 1) => {
  if (typeof t != "number")
    return Jm(t, { a: e });
  const r = Wu.set({
    r: zt.channel.clamp.r(t),
    g: zt.channel.clamp.g(e),
    b: zt.channel.clamp.b(n),
    a: zt.channel.clamp.a(i)
  });
  return Si.stringify(r);
}, tx = (t, e) => zt.lang.round(Si.parse(t)[e]), aS = (t) => {
  const { r: e, g: n, b: i } = Si.parse(t), r = 0.2126 * zt.channel.toLinear(e) + 0.7152 * zt.channel.toLinear(n) + 0.0722 * zt.channel.toLinear(i);
  return zt.lang.round(r);
}, oS = (t) => aS(t) >= 0.5, Ds = (t) => !oS(t), ex = (t, e, n) => {
  const i = Si.parse(t), r = i[e], s = zt.channel.clamp[e](r + n);
  return r !== s && (i[e] = s), Si.stringify(i);
}, Nt = (t, e) => ex(t, "l", e), Ot = (t, e) => ex(t, "l", -e), lt = (t, e) => {
  const n = Si.parse(t), i = {};
  for (const r in e)
    e[r] && (i[r] = n[r] + e[r]);
  return Jm(t, i);
}, lS = (t, e, n = 50) => {
  const { r: i, g: r, b: s, a } = Si.parse(t), { r: o, g: l, b: u, a: h } = Si.parse(e), f = n / 100, d = f * 2 - 1, p = a - h, m = ((d * p === -1 ? d : (d + p) / (1 + d * p)) + 1) / 2, _ = 1 - m, T = i * m + o * _, v = r * m + l * _, A = s * m + u * _, L = a * f + h * (1 - f);
  return cs(T, v, A, L);
}, vt = (t, e = 100) => {
  const n = Si.parse(t);
  return n.r = 255 - n.r, n.g = 255 - n.g, n.b = 255 - n.b, lS(n, t, e);
};
var nx = typeof global == "object" && global && global.Object === Object && global, cS = typeof self == "object" && self && self.Object === Object && self, Xi = nx || cS || Function("return this")(), ci = Xi.Symbol, ix = Object.prototype, uS = ix.hasOwnProperty, hS = ix.toString, so = ci ? ci.toStringTag : void 0;
function dS(t) {
  var e = uS.call(t, so), n = t[so];
  try {
    t[so] = void 0;
    var i = !0;
  } catch {
  }
  var r = hS.call(t);
  return i && (e ? t[so] = n : delete t[so]), r;
}
var fS = Object.prototype, pS = fS.toString;
function gS(t) {
  return pS.call(t);
}
var yS = "[object Null]", mS = "[object Undefined]", Zp = ci ? ci.toStringTag : void 0;
function Ns(t) {
  return t == null ? t === void 0 ? mS : yS : Zp && Zp in Object(t) ? dS(t) : gS(t);
}
function qn(t) {
  var e = typeof t;
  return t != null && (e == "object" || e == "function");
}
var xS = "[object AsyncFunction]", bS = "[object Function]", _S = "[object GeneratorFunction]", kS = "[object Proxy]";
function ka(t) {
  if (!qn(t))
    return !1;
  var e = Ns(t);
  return e == bS || e == _S || e == xS || e == kS;
}
var Zh = Xi["__core-js_shared__"], Jp = (function() {
  var t = /[^.]+$/.exec(Zh && Zh.keys && Zh.keys.IE_PROTO || "");
  return t ? "Symbol(src)_1." + t : "";
})();
function TS(t) {
  return !!Jp && Jp in t;
}
var wS = Function.prototype, vS = wS.toString;
function Fs(t) {
  if (t != null) {
    try {
      return vS.call(t);
    } catch {
    }
    try {
      return t + "";
    } catch {
    }
  }
  return "";
}
var ES = /[\\^$.*+?()[\]{}|]/g, CS = /^\[object .+?Constructor\]$/, SS = Function.prototype, AS = Object.prototype, LS = SS.toString, IS = AS.hasOwnProperty, BS = RegExp(
  "^" + LS.call(IS).replace(ES, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
);
function DS(t) {
  if (!qn(t) || TS(t))
    return !1;
  var e = ka(t) ? BS : CS;
  return e.test(Fs(t));
}
function NS(t, e) {
  return t?.[e];
}
function Os(t, e) {
  var n = NS(t, e);
  return DS(n) ? n : void 0;
}
var Ho = Os(Object, "create");
function FS() {
  this.__data__ = Ho ? Ho(null) : {}, this.size = 0;
}
function OS(t) {
  var e = this.has(t) && delete this.__data__[t];
  return this.size -= e ? 1 : 0, e;
}
var RS = "__lodash_hash_undefined__", MS = Object.prototype, PS = MS.hasOwnProperty;
function zS(t) {
  var e = this.__data__;
  if (Ho) {
    var n = e[t];
    return n === RS ? void 0 : n;
  }
  return PS.call(e, t) ? e[t] : void 0;
}
var VS = Object.prototype, qS = VS.hasOwnProperty;
function $S(t) {
  var e = this.__data__;
  return Ho ? e[t] !== void 0 : qS.call(e, t);
}
var YS = "__lodash_hash_undefined__";
function WS(t, e) {
  var n = this.__data__;
  return this.size += this.has(t) ? 0 : 1, n[t] = Ho && e === void 0 ? YS : e, this;
}
function ms(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.clear(); ++e < n; ) {
    var i = t[e];
    this.set(i[0], i[1]);
  }
}
ms.prototype.clear = FS;
ms.prototype.delete = OS;
ms.prototype.get = zS;
ms.prototype.has = $S;
ms.prototype.set = WS;
function US() {
  this.__data__ = [], this.size = 0;
}
function za(t, e) {
  return t === e || t !== t && e !== e;
}
function Uu(t, e) {
  for (var n = t.length; n--; )
    if (za(t[n][0], e))
      return n;
  return -1;
}
var HS = Array.prototype, GS = HS.splice;
function jS(t) {
  var e = this.__data__, n = Uu(e, t);
  if (n < 0)
    return !1;
  var i = e.length - 1;
  return n == i ? e.pop() : GS.call(e, n, 1), --this.size, !0;
}
function XS(t) {
  var e = this.__data__, n = Uu(e, t);
  return n < 0 ? void 0 : e[n][1];
}
function KS(t) {
  return Uu(this.__data__, t) > -1;
}
function QS(t, e) {
  var n = this.__data__, i = Uu(n, t);
  return i < 0 ? (++this.size, n.push([t, e])) : n[i][1] = e, this;
}
function vr(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.clear(); ++e < n; ) {
    var i = t[e];
    this.set(i[0], i[1]);
  }
}
vr.prototype.clear = US;
vr.prototype.delete = jS;
vr.prototype.get = XS;
vr.prototype.has = KS;
vr.prototype.set = QS;
var Go = Os(Xi, "Map");
function ZS() {
  this.size = 0, this.__data__ = {
    hash: new ms(),
    map: new (Go || vr)(),
    string: new ms()
  };
}
function JS(t) {
  var e = typeof t;
  return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
}
function Hu(t, e) {
  var n = t.__data__;
  return JS(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
}
function t7(t) {
  var e = Hu(this, t).delete(t);
  return this.size -= e ? 1 : 0, e;
}
function e7(t) {
  return Hu(this, t).get(t);
}
function n7(t) {
  return Hu(this, t).has(t);
}
function i7(t, e) {
  var n = Hu(this, t), i = n.size;
  return n.set(t, e), this.size += n.size == i ? 0 : 1, this;
}
function Er(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.clear(); ++e < n; ) {
    var i = t[e];
    this.set(i[0], i[1]);
  }
}
Er.prototype.clear = ZS;
Er.prototype.delete = t7;
Er.prototype.get = e7;
Er.prototype.has = n7;
Er.prototype.set = i7;
var r7 = "Expected a function";
function Va(t, e) {
  if (typeof t != "function" || e != null && typeof e != "function")
    throw new TypeError(r7);
  var n = function() {
    var i = arguments, r = e ? e.apply(this, i) : i[0], s = n.cache;
    if (s.has(r))
      return s.get(r);
    var a = t.apply(this, i);
    return n.cache = s.set(r, a) || s, a;
  };
  return n.cache = new (Va.Cache || Er)(), n;
}
Va.Cache = Er;
function s7() {
  this.__data__ = new vr(), this.size = 0;
}
function a7(t) {
  var e = this.__data__, n = e.delete(t);
  return this.size = e.size, n;
}
function o7(t) {
  return this.__data__.get(t);
}
function l7(t) {
  return this.__data__.has(t);
}
var c7 = 200;
function u7(t, e) {
  var n = this.__data__;
  if (n instanceof vr) {
    var i = n.__data__;
    if (!Go || i.length < c7 - 1)
      return i.push([t, e]), this.size = ++n.size, this;
    n = this.__data__ = new Er(i);
  }
  return n.set(t, e), this.size = n.size, this;
}
function wi(t) {
  var e = this.__data__ = new vr(t);
  this.size = e.size;
}
wi.prototype.clear = s7;
wi.prototype.delete = a7;
wi.prototype.get = o7;
wi.prototype.has = l7;
wi.prototype.set = u7;
var Kc = (function() {
  try {
    var t = Os(Object, "defineProperty");
    return t({}, "", {}), t;
  } catch {
  }
})();
function Gu(t, e, n) {
  e == "__proto__" && Kc ? Kc(t, e, {
    configurable: !0,
    enumerable: !0,
    value: n,
    writable: !0
  }) : t[e] = n;
}
function qd(t, e, n) {
  (n !== void 0 && !za(t[e], n) || n === void 0 && !(e in t)) && Gu(t, e, n);
}
function h7(t) {
  return function(e, n, i) {
    for (var r = -1, s = Object(e), a = i(e), o = a.length; o--; ) {
      var l = a[++r];
      if (n(s[l], l, s) === !1)
        break;
    }
    return e;
  };
}
var bf = h7(), rx = typeof exports == "object" && exports && !exports.nodeType && exports, tg = rx && typeof module == "object" && module && !module.nodeType && module, d7 = tg && tg.exports === rx, eg = d7 ? Xi.Buffer : void 0, ng = eg ? eg.allocUnsafe : void 0;
function sx(t, e) {
  if (e)
    return t.slice();
  var n = t.length, i = ng ? ng(n) : new t.constructor(n);
  return t.copy(i), i;
}
var Qc = Xi.Uint8Array;
function _f(t) {
  var e = new t.constructor(t.byteLength);
  return new Qc(e).set(new Qc(t)), e;
}
function ax(t, e) {
  var n = e ? _f(t.buffer) : t.buffer;
  return new t.constructor(n, t.byteOffset, t.length);
}
function ox(t, e) {
  var n = -1, i = t.length;
  for (e || (e = Array(i)); ++n < i; )
    e[n] = t[n];
  return e;
}
var ig = Object.create, f7 = /* @__PURE__ */ (function() {
  function t() {
  }
  return function(e) {
    if (!qn(e))
      return {};
    if (ig)
      return ig(e);
    t.prototype = e;
    var n = new t();
    return t.prototype = void 0, n;
  };
})();
function lx(t, e) {
  return function(n) {
    return t(e(n));
  };
}
var kf = lx(Object.getPrototypeOf, Object), p7 = Object.prototype;
function ju(t) {
  var e = t && t.constructor, n = typeof e == "function" && e.prototype || p7;
  return t === n;
}
function cx(t) {
  return typeof t.constructor == "function" && !ju(t) ? f7(kf(t)) : {};
}
function Wi(t) {
  return t != null && typeof t == "object";
}
var g7 = "[object Arguments]";
function rg(t) {
  return Wi(t) && Ns(t) == g7;
}
var ux = Object.prototype, y7 = ux.hasOwnProperty, m7 = ux.propertyIsEnumerable, Ta = rg(/* @__PURE__ */ (function() {
  return arguments;
})()) ? rg : function(t) {
  return Wi(t) && y7.call(t, "callee") && !m7.call(t, "callee");
}, Ve = Array.isArray, x7 = 9007199254740991;
function Tf(t) {
  return typeof t == "number" && t > -1 && t % 1 == 0 && t <= x7;
}
function Yr(t) {
  return t != null && Tf(t.length) && !ka(t);
}
function hx(t) {
  return Wi(t) && Yr(t);
}
function b7() {
  return !1;
}
var dx = typeof exports == "object" && exports && !exports.nodeType && exports, sg = dx && typeof module == "object" && module && !module.nodeType && module, _7 = sg && sg.exports === dx, ag = _7 ? Xi.Buffer : void 0, k7 = ag ? ag.isBuffer : void 0, wa = k7 || b7, T7 = "[object Object]", w7 = Function.prototype, v7 = Object.prototype, fx = w7.toString, E7 = v7.hasOwnProperty, C7 = fx.call(Object);
function px(t) {
  if (!Wi(t) || Ns(t) != T7)
    return !1;
  var e = kf(t);
  if (e === null)
    return !0;
  var n = E7.call(e, "constructor") && e.constructor;
  return typeof n == "function" && n instanceof n && fx.call(n) == C7;
}
var S7 = "[object Arguments]", A7 = "[object Array]", L7 = "[object Boolean]", I7 = "[object Date]", B7 = "[object Error]", D7 = "[object Function]", N7 = "[object Map]", F7 = "[object Number]", O7 = "[object Object]", R7 = "[object RegExp]", M7 = "[object Set]", P7 = "[object String]", z7 = "[object WeakMap]", V7 = "[object ArrayBuffer]", q7 = "[object DataView]", $7 = "[object Float32Array]", Y7 = "[object Float64Array]", W7 = "[object Int8Array]", U7 = "[object Int16Array]", H7 = "[object Int32Array]", G7 = "[object Uint8Array]", j7 = "[object Uint8ClampedArray]", X7 = "[object Uint16Array]", K7 = "[object Uint32Array]", _e = {};
_e[$7] = _e[Y7] = _e[W7] = _e[U7] = _e[H7] = _e[G7] = _e[j7] = _e[X7] = _e[K7] = !0;
_e[S7] = _e[A7] = _e[V7] = _e[L7] = _e[q7] = _e[I7] = _e[B7] = _e[D7] = _e[N7] = _e[F7] = _e[O7] = _e[R7] = _e[M7] = _e[P7] = _e[z7] = !1;
function Q7(t) {
  return Wi(t) && Tf(t.length) && !!_e[Ns(t)];
}
function Xu(t) {
  return function(e) {
    return t(e);
  };
}
var gx = typeof exports == "object" && exports && !exports.nodeType && exports, vo = gx && typeof module == "object" && module && !module.nodeType && module, Z7 = vo && vo.exports === gx, Jh = Z7 && nx.process, va = (function() {
  try {
    var t = vo && vo.require && vo.require("util").types;
    return t || Jh && Jh.binding && Jh.binding("util");
  } catch {
  }
})(), og = va && va.isTypedArray, Ku = og ? Xu(og) : Q7;
function $d(t, e) {
  if (!(e === "constructor" && typeof t[e] == "function") && e != "__proto__")
    return t[e];
}
var J7 = Object.prototype, t8 = J7.hasOwnProperty;
function Qu(t, e, n) {
  var i = t[e];
  (!(t8.call(t, e) && za(i, n)) || n === void 0 && !(e in t)) && Gu(t, e, n);
}
function wl(t, e, n, i) {
  var r = !n;
  n || (n = {});
  for (var s = -1, a = e.length; ++s < a; ) {
    var o = e[s], l = void 0;
    l === void 0 && (l = t[o]), r ? Gu(n, o, l) : Qu(n, o, l);
  }
  return n;
}
function e8(t, e) {
  for (var n = -1, i = Array(t); ++n < t; )
    i[n] = e(n);
  return i;
}
var n8 = 9007199254740991, i8 = /^(?:0|[1-9]\d*)$/;
function Zu(t, e) {
  var n = typeof t;
  return e = e ?? n8, !!e && (n == "number" || n != "symbol" && i8.test(t)) && t > -1 && t % 1 == 0 && t < e;
}
var r8 = Object.prototype, s8 = r8.hasOwnProperty;
function yx(t, e) {
  var n = Ve(t), i = !n && Ta(t), r = !n && !i && wa(t), s = !n && !i && !r && Ku(t), a = n || i || r || s, o = a ? e8(t.length, String) : [], l = o.length;
  for (var u in t)
    (e || s8.call(t, u)) && !(a && // Safari 9 has enumerable `arguments.length` in strict mode.
    (u == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
    r && (u == "offset" || u == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
    s && (u == "buffer" || u == "byteLength" || u == "byteOffset") || // Skip index properties.
    Zu(u, l))) && o.push(u);
  return o;
}
function a8(t) {
  var e = [];
  if (t != null)
    for (var n in Object(t))
      e.push(n);
  return e;
}
var o8 = Object.prototype, l8 = o8.hasOwnProperty;
function c8(t) {
  if (!qn(t))
    return a8(t);
  var e = ju(t), n = [];
  for (var i in t)
    i == "constructor" && (e || !l8.call(t, i)) || n.push(i);
  return n;
}
function Rs(t) {
  return Yr(t) ? yx(t, !0) : c8(t);
}
function u8(t) {
  return wl(t, Rs(t));
}
function h8(t, e, n, i, r, s, a) {
  var o = $d(t, n), l = $d(e, n), u = a.get(l);
  if (u) {
    qd(t, n, u);
    return;
  }
  var h = s ? s(o, l, n + "", t, e, a) : void 0, f = h === void 0;
  if (f) {
    var d = Ve(l), p = !d && wa(l), y = !d && !p && Ku(l);
    h = l, d || p || y ? Ve(o) ? h = o : hx(o) ? h = ox(o) : p ? (f = !1, h = sx(l, !0)) : y ? (f = !1, h = ax(l, !0)) : h = [] : px(l) || Ta(l) ? (h = o, Ta(o) ? h = u8(o) : (!qn(o) || ka(o)) && (h = cx(l))) : f = !1;
  }
  f && (a.set(l, h), r(h, l, i, s, a), a.delete(l)), qd(t, n, h);
}
function mx(t, e, n, i, r) {
  t !== e && bf(e, function(s, a) {
    if (r || (r = new wi()), qn(s))
      h8(t, e, a, n, mx, i, r);
    else {
      var o = i ? i($d(t, a), s, a + "", t, e, r) : void 0;
      o === void 0 && (o = s), qd(t, a, o);
    }
  }, Rs);
}
function Ms(t) {
  return t;
}
function d8(t, e, n) {
  switch (n.length) {
    case 0:
      return t.call(e);
    case 1:
      return t.call(e, n[0]);
    case 2:
      return t.call(e, n[0], n[1]);
    case 3:
      return t.call(e, n[0], n[1], n[2]);
  }
  return t.apply(e, n);
}
var lg = Math.max;
function xx(t, e, n) {
  return e = lg(e === void 0 ? t.length - 1 : e, 0), function() {
    for (var i = arguments, r = -1, s = lg(i.length - e, 0), a = Array(s); ++r < s; )
      a[r] = i[e + r];
    r = -1;
    for (var o = Array(e + 1); ++r < e; )
      o[r] = i[r];
    return o[e] = n(a), d8(t, this, o);
  };
}
function Qs(t) {
  return function() {
    return t;
  };
}
var f8 = Kc ? function(t, e) {
  return Kc(t, "toString", {
    configurable: !0,
    enumerable: !1,
    value: Qs(e),
    writable: !0
  });
} : Ms, p8 = 800, g8 = 16, y8 = Date.now;
function m8(t) {
  var e = 0, n = 0;
  return function() {
    var i = y8(), r = g8 - (i - n);
    if (n = i, r > 0) {
      if (++e >= p8)
        return arguments[0];
    } else
      e = 0;
    return t.apply(void 0, arguments);
  };
}
var bx = m8(f8);
function Ju(t, e) {
  return bx(xx(t, e, Ms), t + "");
}
function jo(t, e, n) {
  if (!qn(n))
    return !1;
  var i = typeof e;
  return (i == "number" ? Yr(n) && Zu(e, n.length) : i == "string" && e in n) ? za(n[e], t) : !1;
}
function x8(t) {
  return Ju(function(e, n) {
    var i = -1, r = n.length, s = r > 1 ? n[r - 1] : void 0, a = r > 2 ? n[2] : void 0;
    for (s = t.length > 3 && typeof s == "function" ? (r--, s) : void 0, a && jo(n[0], n[1], a) && (s = r < 3 ? void 0 : s, r = 1), e = Object(e); ++i < r; ) {
      var o = n[i];
      o && t(e, o, i, s);
    }
    return e;
  });
}
var Zc = x8(function(t, e, n) {
  mx(t, e, n);
}), _x = "comm", kx = "rule", Tx = "decl", b8 = "@import", _8 = "@namespace", k8 = "@keyframes", T8 = "@layer", w8 = Math.abs, Eo = String.fromCharCode;
function wx(t) {
  return t.trim();
}
function Yd(t, e, n) {
  return t.replace(e, n);
}
function sa(t, e) {
  return t.charCodeAt(e) | 0;
}
function Ea(t, e, n) {
  return t.slice(e, n);
}
function Oi(t) {
  return t.length;
}
function v8(t) {
  return t.length;
}
function jl(t, e) {
  return e.push(t), t;
}
var th = 1, Ca = 1, vx = 0, ui = 0, Re = 0, qa = "";
function wf(t, e, n, i, r, s, a, o) {
  return { value: t, root: e, parent: n, type: i, props: r, children: s, line: th, column: Ca, length: a, return: "", siblings: o };
}
function E8() {
  return Re;
}
function C8() {
  return Re = ui > 0 ? sa(qa, --ui) : 0, Ca--, Re === 10 && (Ca = 1, th--), Re;
}
function vi() {
  return Re = ui < vx ? sa(qa, ui++) : 0, Ca++, Re === 10 && (Ca = 1, th++), Re;
}
function Rr() {
  return sa(qa, ui);
}
function pc() {
  return ui;
}
function eh(t, e) {
  return Ea(qa, t, e);
}
function Xo(t) {
  switch (t) {
    // \0 \t \n \r \s whitespace token
    case 0:
    case 9:
    case 10:
    case 13:
    case 32:
      return 5;
    // ! + , / > @ ~ isolate token
    case 33:
    case 43:
    case 44:
    case 47:
    case 62:
    case 64:
    case 126:
    // ; { } breakpoint token
    case 59:
    case 123:
    case 125:
      return 4;
    // : accompanied token
    case 58:
      return 3;
    // " ' ( [ opening delimit token
    case 34:
    case 39:
    case 40:
    case 91:
      return 2;
    // ) ] closing delimit token
    case 41:
    case 93:
      return 1;
  }
  return 0;
}
function S8(t) {
  return th = Ca = 1, vx = Oi(qa = t), ui = 0, [];
}
function A8(t) {
  return qa = "", t;
}
function td(t) {
  return wx(eh(ui - 1, Wd(t === 91 ? t + 2 : t === 40 ? t + 1 : t)));
}
function L8(t) {
  for (; (Re = Rr()) && Re < 33; )
    vi();
  return Xo(t) > 2 || Xo(Re) > 3 ? "" : " ";
}
function I8(t, e) {
  for (; --e && vi() && !(Re < 48 || Re > 102 || Re > 57 && Re < 65 || Re > 70 && Re < 97); )
    ;
  return eh(t, pc() + (e < 6 && Rr() == 32 && vi() == 32));
}
function Wd(t) {
  for (; vi(); )
    switch (Re) {
      // ] ) " '
      case t:
        return ui;
      // " '
      case 34:
      case 39:
        t !== 34 && t !== 39 && Wd(Re);
        break;
      // (
      case 40:
        t === 41 && Wd(t);
        break;
      // \
      case 92:
        vi();
        break;
    }
  return ui;
}
function B8(t, e) {
  for (; vi() && t + Re !== 57; )
    if (t + Re === 84 && Rr() === 47)
      break;
  return "/*" + eh(e, ui - 1) + "*" + Eo(t === 47 ? t : vi());
}
function D8(t) {
  for (; !Xo(Rr()); )
    vi();
  return eh(t, ui);
}
function N8(t) {
  return A8(gc("", null, null, null, [""], t = S8(t), 0, [0], t));
}
function gc(t, e, n, i, r, s, a, o, l) {
  for (var u = 0, h = 0, f = a, d = 0, p = 0, y = 0, m = 1, _ = 1, T = 1, v = 0, A = 0, L = "", w = r, b = s, F = i, S = L; _; )
    switch (y = A, A = vi()) {
      // (
      case 40:
        y != 108 && sa(S, f - 1) == 58 ? (v++, S += "(") : S += td(A);
        break;
      // )
      case 41:
        v--, S += ")";
        break;
      // " ' [
      case 34:
      case 39:
      case 91:
        S += td(A);
        break;
      // \t \n \r \s
      case 9:
      case 10:
      case 13:
      case 32:
        if (v > 0) {
          S += Eo(A);
          break;
        }
        S += L8(y);
        break;
      // \
      case 92:
        S += I8(pc() - 1, 7);
        continue;
      // /
      case 47:
        switch (Rr()) {
          case 42:
          case 47:
            jl(F8(B8(vi(), pc()), e, n, l), l), (Xo(y || 1) == 5 || Xo(Rr() || 1) == 5) && Oi(S) && Ea(S, -1, void 0) !== " " && (S += " ");
            break;
          default:
            S += "/";
        }
        break;
      // {
      case 123 * m:
        o[u++] = Oi(S) * T;
      // } ; \0
      case 125 * m:
      case 59:
      case 0:
        if (v > 0 && A) {
          S += Eo(A);
          break;
        }
        switch (A) {
          // \0 }
          case 0:
          case 125:
            _ = 0;
          // ;
          case 59 + h:
            T == -1 && (S = Yd(S, /\f/g, "")), p > 0 && (Oi(S) - f || m === 0) && jl(p > 32 ? ug(S + ";", i, n, f - 1, l) : ug(Yd(S, " ", "") + ";", i, n, f - 2, l), l);
            break;
          // @ ;
          case 59:
            S += ";";
          // { rule/at-rule
          default:
            if (jl(F = cg(S, e, n, u, h, r, o, L, w = [], b = [], f, s), s), A === 123)
              if (h === 0)
                gc(S, e, F, F, w, s, f, o, b);
              else {
                switch (d) {
                  // c(ontainer)
                  case 99:
                    if (sa(S, 3) === 110) break;
                  // l(ayer)
                  case 108:
                    if (sa(S, 2) === 97) break;
                  default:
                    h = 0;
                  // d(ocument) m(edia) s(upports)
                  case 100:
                  case 109:
                  case 115:
                }
                h ? gc(t, F, F, i && jl(cg(t, F, F, 0, 0, r, o, L, r, w = [], f, b), b), r, b, f, o, i ? w : b) : gc(S, F, F, F, [""], b, 0, o, b);
              }
        }
        u = h = p = 0, m = T = 1, L = S = "", f = a;
        break;
      // :
      case 58:
        f = 1 + Oi(S), p = y;
      default:
        if (m < 1) {
          if (A == 123)
            --m;
          else if (A == 125 && m++ == 0 && C8() == 125)
            continue;
        }
        switch (S += Eo(A), A * m) {
          // &
          case 38:
            T = h > 0 ? 1 : (S += "\f", -1);
            break;
          // ,
          case 44:
            if (v > 0) break;
            o[u++] = (Oi(S) - 1) * T, T = 1;
            break;
          // @
          case 64:
            Rr() === 45 && (S += td(vi())), d = Rr(), h = f = Oi(L = S += D8(pc())), A++;
            break;
          // -
          case 45:
            y === 45 && Oi(S) == 2 && (m = 0);
        }
    }
  return s;
}
function cg(t, e, n, i, r, s, a, o, l, u, h, f) {
  for (var d = r - 1, p = r === 0 ? s : [""], y = v8(p), m = 0, _ = 0, T = 0; m < i; ++m)
    for (var v = 0, A = Ea(t, d + 1, d = w8(_ = a[m])), L = t; v < y; ++v)
      (L = wx(_ > 0 ? p[v] + " " + A : Yd(A, /&\f/g, p[v]))) && (l[T++] = L);
  return wf(t, e, n, r === 0 ? kx : o, l, u, h, f);
}
function F8(t, e, n, i) {
  return wf(t, e, n, _x, Eo(E8()), Ea(t, 2, -2), 0, i);
}
function ug(t, e, n, i, r) {
  return wf(t, e, n, Tx, Ea(t, 0, i), Ea(t, i + 1, -1), i, r);
}
function Ud(t, e) {
  for (var n = "", i = 0; i < t.length; i++)
    n += e(t[i], i, t, e) || "";
  return n;
}
function O8(t, e, n, i) {
  switch (t.type) {
    case T8:
      if (t.children.length) break;
    case b8:
    case _8:
    case Tx:
      return t.return = t.return || t.value;
    case _x:
      return "";
    case k8:
      return t.return = t.value + "{" + Ud(t.children, i) + "}";
    case kx:
      if (!Oi(t.value = t.props.join(","))) return "";
  }
  return Oi(n = Ud(t.children, i)) ? t.return = t.value + "{" + n + "}" : "";
}
var R8 = lx(Object.keys, Object), M8 = Object.prototype, P8 = M8.hasOwnProperty;
function Ex(t) {
  if (!ju(t))
    return R8(t);
  var e = [];
  for (var n in Object(t))
    P8.call(t, n) && n != "constructor" && e.push(n);
  return e;
}
var Hd = Os(Xi, "DataView"), Gd = Os(Xi, "Promise"), aa = Os(Xi, "Set"), jd = Os(Xi, "WeakMap"), hg = "[object Map]", z8 = "[object Object]", dg = "[object Promise]", fg = "[object Set]", pg = "[object WeakMap]", gg = "[object DataView]", V8 = Fs(Hd), q8 = Fs(Go), $8 = Fs(Gd), Y8 = Fs(aa), W8 = Fs(jd), ri = Ns;
(Hd && ri(new Hd(new ArrayBuffer(1))) != gg || Go && ri(new Go()) != hg || Gd && ri(Gd.resolve()) != dg || aa && ri(new aa()) != fg || jd && ri(new jd()) != pg) && (ri = function(t) {
  var e = Ns(t), n = e == z8 ? t.constructor : void 0, i = n ? Fs(n) : "";
  if (i)
    switch (i) {
      case V8:
        return gg;
      case q8:
        return hg;
      case $8:
        return dg;
      case Y8:
        return fg;
      case W8:
        return pg;
    }
  return e;
});
var U8 = "[object Map]", H8 = "[object Set]", G8 = Object.prototype, j8 = G8.hasOwnProperty;
function Co(t) {
  if (t == null)
    return !0;
  if (Yr(t) && (Ve(t) || typeof t == "string" || typeof t.splice == "function" || wa(t) || Ku(t) || Ta(t)))
    return !t.length;
  var e = ri(t);
  if (e == U8 || e == H8)
    return !t.size;
  if (ju(t))
    return !Ex(t).length;
  for (var n in t)
    if (j8.call(t, n))
      return !1;
  return !0;
}
const nr = {
  trace: 0,
  debug: 1,
  info: 2,
  warn: 3,
  error: 4,
  fatal: 5
}, z = {
  trace: (...t) => {
  },
  debug: (...t) => {
  },
  info: (...t) => {
  },
  warn: (...t) => {
  },
  error: (...t) => {
  },
  fatal: (...t) => {
  }
}, vf = function(t = "fatal") {
  let e = nr.fatal;
  typeof t == "string" ? (t = t.toLowerCase(), t in nr && (e = nr[t])) : typeof t == "number" && (e = t), z.trace = () => {
  }, z.debug = () => {
  }, z.info = () => {
  }, z.warn = () => {
  }, z.error = () => {
  }, z.fatal = () => {
  }, e <= nr.fatal && (z.fatal = console.error ? console.error.bind(console, Jn("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", Jn("FATAL"))), e <= nr.error && (z.error = console.error ? console.error.bind(console, Jn("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", Jn("ERROR"))), e <= nr.warn && (z.warn = console.warn ? console.warn.bind(console, Jn("WARN"), "color: orange") : console.log.bind(console, "\x1B[33m", Jn("WARN"))), e <= nr.info && (z.info = console.info ? console.info.bind(console, Jn("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", Jn("INFO"))), e <= nr.debug && (z.debug = console.debug ? console.debug.bind(console, Jn("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", Jn("DEBUG"))), e <= nr.trace && (z.trace = console.debug ? console.debug.bind(console, Jn("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", Jn("TRACE")));
}, Jn = (t) => `%c${ln().format("ss.SSS")} : ${t} : `, $a = /<br\s*\/?>/gi, X8 = (t) => t ? Sx(t).replace(/\\n/g, "#br#").split("#br#") : [""], K8 = /* @__PURE__ */ (() => {
  let t = !1;
  return () => {
    t || (Q8(), t = !0);
  };
})();
function Q8() {
  const t = "data-temp-href-target";
  _a.addHook("beforeSanitizeAttributes", (e) => {
    e.tagName === "A" && e.hasAttribute("target") && e.setAttribute(t, e.getAttribute("target") || "");
  }), _a.addHook("afterSanitizeAttributes", (e) => {
    e.tagName === "A" && e.hasAttribute(t) && (e.setAttribute("target", e.getAttribute(t) || ""), e.removeAttribute(t), e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener"));
  });
}
const Cx = (t) => (K8(), _a.sanitize(t)), yg = (t, e) => {
  var n;
  if (((n = e.flowchart) == null ? void 0 : n.htmlLabels) !== !1) {
    const i = e.securityLevel;
    i === "antiscript" || i === "strict" ? t = Cx(t) : i !== "loose" && (t = Sx(t), t = t.replace(/</g, "&lt;").replace(/>/g, "&gt;"), t = t.replace(/=/g, "&equals;"), t = eA(t));
  }
  return t;
}, Ne = (t, e) => t && (e.dompurifyConfig ? t = _a.sanitize(yg(t, e), e.dompurifyConfig).toString() : t = _a.sanitize(yg(t, e), {
  FORBID_TAGS: ["style"]
}).toString(), t), Z8 = (t, e) => typeof t == "string" ? Ne(t, e) : t.flat().map((n) => Ne(n, e)), J8 = (t) => $a.test(t), tA = (t) => t.split($a), eA = (t) => t.replace(/#br#/g, "<br/>"), Sx = (t) => t.replace($a, "#br#"), nA = (t) => {
  let e = "";
  return t && (e = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, e = e.replaceAll(/\(/g, "\\("), e = e.replaceAll(/\)/g, "\\)")), e;
}, Ge = (t) => !(t === !1 || ["false", "null", "0"].includes(String(t).trim().toLowerCase())), iA = function(...t) {
  const e = t.filter((n) => !isNaN(n));
  return Math.max(...e);
}, rA = function(...t) {
  const e = t.filter((n) => !isNaN(n));
  return Math.min(...e);
}, So = function(t) {
  const e = t.split(/(,)/), n = [];
  for (let i = 0; i < e.length; i++) {
    let r = e[i];
    if (r === "," && i > 0 && i + 1 < e.length) {
      const s = e[i - 1], a = e[i + 1];
      sA(s, a) && (r = s + "," + a, i++, n.pop());
    }
    n.push(aA(r));
  }
  return n.join("");
}, Xd = (t, e) => Math.max(0, t.split(e).length - 1), sA = (t, e) => {
  const n = Xd(t, "~"), i = Xd(e, "~");
  return n === 1 && i === 1;
}, aA = (t) => {
  const e = Xd(t, "~");
  let n = !1;
  if (e <= 1)
    return t;
  e % 2 !== 0 && t.startsWith("~") && (t = t.substring(1), n = !0);
  const i = [...t];
  let r = i.indexOf("~"), s = i.lastIndexOf("~");
  for (; r !== -1 && s !== -1 && r !== s; )
    i[r] = "<", i[s] = ">", r = i.indexOf("~"), s = i.lastIndexOf("~");
  return n && i.unshift("~"), i.join("");
}, mg = () => window.MathMLElement !== void 0, Kd = /\$\$(.*)\$\$/g, hi = (t) => {
  var e;
  return (((e = t.match(Kd)) == null ? void 0 : e.length) ?? 0) > 0;
}, vl = async (t, e) => {
  t = await Ps(t, e);
  const n = document.createElement("div");
  n.innerHTML = t, n.id = "katex-temp", n.style.visibility = "hidden", n.style.position = "absolute", n.style.top = "0";
  const i = document.querySelector("body");
  i?.insertAdjacentElement("beforeend", n);
  const r = { width: n.clientWidth, height: n.clientHeight };
  return n.remove(), r;
}, Ps = async (t, e) => {
  if (!hi(t))
    return t;
  if (!mg() && !e.legacyMathML)
    return t.replace(Kd, "MathML is unsupported in this environment.");
  const { default: n } = await import("./chunk-BlwB2yOK.js").then((i) => i.k);
  return t.split($a).map(
    (i) => hi(i) ? `
            <div style="display: flex; align-items: center; justify-content: center; white-space: nowrap;">
              ${i}
            </div>
          ` : `<div>${i}</div>`
  ).join("").replace(
    Kd,
    (i, r) => n.renderToString(r, {
      throwOnError: !0,
      displayMode: !0,
      output: mg() ? "mathml" : "htmlAndMathml"
    }).replace(/\n/g, " ").replace(/<annotation.*<\/annotation>/g, "")
  );
}, bt = {
  getRows: X8,
  sanitizeText: Ne,
  sanitizeTextOrArray: Z8,
  hasBreaks: J8,
  splitBreaks: tA,
  lineBreakRegex: $a,
  removeScript: Cx,
  getUrl: nA,
  evaluate: Ge,
  getMax: iA,
  getMin: rA
}, xn = (t, e) => e ? lt(t, { s: -40, l: 10 }) : lt(t, { s: -40, l: -10 }), nh = "#ffffff", ih = "#f2f2f2";
let oA = class {
  constructor() {
    this.background = "#f4f4f4", this.primaryColor = "#fff4dd", this.noteBkgColor = "#fff5ad", this.noteTextColor = "#333", this.THEME_COLOR_LIMIT = 12, this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif', this.fontSize = "16px";
  }
  updateColors() {
    var e, n, i, r, s, a, o, l, u, h, f;
    if (this.primaryTextColor = this.primaryTextColor || (this.darkMode ? "#eee" : "#333"), this.secondaryColor = this.secondaryColor || lt(this.primaryColor, { h: -120 }), this.tertiaryColor = this.tertiaryColor || lt(this.primaryColor, { h: 180, l: 5 }), this.primaryBorderColor = this.primaryBorderColor || xn(this.primaryColor, this.darkMode), this.secondaryBorderColor = this.secondaryBorderColor || xn(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = this.tertiaryBorderColor || xn(this.tertiaryColor, this.darkMode), this.noteBorderColor = this.noteBorderColor || xn(this.noteBkgColor, this.darkMode), this.noteBkgColor = this.noteBkgColor || "#fff5ad", this.noteTextColor = this.noteTextColor || "#333", this.secondaryTextColor = this.secondaryTextColor || vt(this.secondaryColor), this.tertiaryTextColor = this.tertiaryTextColor || vt(this.tertiaryColor), this.lineColor = this.lineColor || vt(this.background), this.arrowheadColor = this.arrowheadColor || vt(this.background), this.textColor = this.textColor || this.primaryTextColor, this.border2 = this.border2 || this.tertiaryBorderColor, this.nodeBkg = this.nodeBkg || this.primaryColor, this.mainBkg = this.mainBkg || this.primaryColor, this.nodeBorder = this.nodeBorder || this.primaryBorderColor, this.clusterBkg = this.clusterBkg || this.tertiaryColor, this.clusterBorder = this.clusterBorder || this.tertiaryBorderColor, this.defaultLinkColor = this.defaultLinkColor || this.lineColor, this.titleColor = this.titleColor || this.tertiaryTextColor, this.edgeLabelBackground = this.edgeLabelBackground || (this.darkMode ? Ot(this.secondaryColor, 30) : this.secondaryColor), this.nodeTextColor = this.nodeTextColor || this.primaryTextColor, this.actorBorder = this.actorBorder || this.primaryBorderColor, this.actorBkg = this.actorBkg || this.mainBkg, this.actorTextColor = this.actorTextColor || this.primaryTextColor, this.actorLineColor = this.actorLineColor || "grey", this.labelBoxBkgColor = this.labelBoxBkgColor || this.actorBkg, this.signalColor = this.signalColor || this.textColor, this.signalTextColor = this.signalTextColor || this.textColor, this.labelBoxBorderColor = this.labelBoxBorderColor || this.actorBorder, this.labelTextColor = this.labelTextColor || this.actorTextColor, this.loopTextColor = this.loopTextColor || this.actorTextColor, this.activationBorderColor = this.activationBorderColor || Ot(this.secondaryColor, 10), this.activationBkgColor = this.activationBkgColor || this.secondaryColor, this.sequenceNumberColor = this.sequenceNumberColor || vt(this.lineColor), this.sectionBkgColor = this.sectionBkgColor || this.tertiaryColor, this.altSectionBkgColor = this.altSectionBkgColor || "white", this.sectionBkgColor = this.sectionBkgColor || this.secondaryColor, this.sectionBkgColor2 = this.sectionBkgColor2 || this.primaryColor, this.excludeBkgColor = this.excludeBkgColor || "#eeeeee", this.taskBorderColor = this.taskBorderColor || this.primaryBorderColor, this.taskBkgColor = this.taskBkgColor || this.primaryColor, this.activeTaskBorderColor = this.activeTaskBorderColor || this.primaryColor, this.activeTaskBkgColor = this.activeTaskBkgColor || Nt(this.primaryColor, 23), this.gridColor = this.gridColor || "lightgrey", this.doneTaskBkgColor = this.doneTaskBkgColor || "lightgrey", this.doneTaskBorderColor = this.doneTaskBorderColor || "grey", this.critBorderColor = this.critBorderColor || "#ff8888", this.critBkgColor = this.critBkgColor || "red", this.todayLineColor = this.todayLineColor || "red", this.taskTextColor = this.taskTextColor || this.textColor, this.taskTextOutsideColor = this.taskTextOutsideColor || this.textColor, this.taskTextLightColor = this.taskTextLightColor || this.textColor, this.taskTextColor = this.taskTextColor || this.primaryTextColor, this.taskTextDarkColor = this.taskTextDarkColor || this.textColor, this.taskTextClickableColor = this.taskTextClickableColor || "#003163", this.personBorder = this.personBorder || this.primaryBorderColor, this.personBkg = this.personBkg || this.mainBkg, this.transitionColor = this.transitionColor || this.lineColor, this.transitionLabelColor = this.transitionLabelColor || this.textColor, this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor, this.stateBkg = this.stateBkg || this.mainBkg, this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg, this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor, this.altBackground = this.altBackground || this.tertiaryColor, this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg, this.compositeBorder = this.compositeBorder || this.nodeBorder, this.innerEndBackground = this.nodeBorder, this.errorBkgColor = this.errorBkgColor || this.tertiaryColor, this.errorTextColor = this.errorTextColor || this.tertiaryTextColor, this.transitionColor = this.transitionColor || this.lineColor, this.specialStateColor = this.lineColor, this.cScale0 = this.cScale0 || this.primaryColor, this.cScale1 = this.cScale1 || this.secondaryColor, this.cScale2 = this.cScale2 || this.tertiaryColor, this.cScale3 = this.cScale3 || lt(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || lt(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || lt(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || lt(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || lt(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || lt(this.primaryColor, { h: 210, l: 150 }), this.cScale9 = this.cScale9 || lt(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || lt(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || lt(this.primaryColor, { h: 330 }), this.darkMode)
      for (let p = 0; p < this.THEME_COLOR_LIMIT; p++)
        this["cScale" + p] = Ot(this["cScale" + p], 75);
    else
      for (let p = 0; p < this.THEME_COLOR_LIMIT; p++)
        this["cScale" + p] = Ot(this["cScale" + p], 25);
    for (let p = 0; p < this.THEME_COLOR_LIMIT; p++)
      this["cScaleInv" + p] = this["cScaleInv" + p] || vt(this["cScale" + p]);
    for (let p = 0; p < this.THEME_COLOR_LIMIT; p++)
      this.darkMode ? this["cScalePeer" + p] = this["cScalePeer" + p] || Nt(this["cScale" + p], 10) : this["cScalePeer" + p] = this["cScalePeer" + p] || Ot(this["cScale" + p], 10);
    this.scaleLabelColor = this.scaleLabelColor || this.labelTextColor;
    for (let p = 0; p < this.THEME_COLOR_LIMIT; p++)
      this["cScaleLabel" + p] = this["cScaleLabel" + p] || this.scaleLabelColor;
    const d = this.darkMode ? -4 : -1;
    for (let p = 0; p < 5; p++)
      this["surface" + p] = this["surface" + p] || lt(this.mainBkg, { h: 180, s: -15, l: d * (5 + p * 3) }), this["surfacePeer" + p] = this["surfacePeer" + p] || lt(this.mainBkg, { h: 180, s: -15, l: d * (8 + p * 3) });
    this.classText = this.classText || this.textColor, this.fillType0 = this.fillType0 || this.primaryColor, this.fillType1 = this.fillType1 || this.secondaryColor, this.fillType2 = this.fillType2 || lt(this.primaryColor, { h: 64 }), this.fillType3 = this.fillType3 || lt(this.secondaryColor, { h: 64 }), this.fillType4 = this.fillType4 || lt(this.primaryColor, { h: -64 }), this.fillType5 = this.fillType5 || lt(this.secondaryColor, { h: -64 }), this.fillType6 = this.fillType6 || lt(this.primaryColor, { h: 128 }), this.fillType7 = this.fillType7 || lt(this.secondaryColor, { h: 128 }), this.pie1 = this.pie1 || this.primaryColor, this.pie2 = this.pie2 || this.secondaryColor, this.pie3 = this.pie3 || this.tertiaryColor, this.pie4 = this.pie4 || lt(this.primaryColor, { l: -10 }), this.pie5 = this.pie5 || lt(this.secondaryColor, { l: -10 }), this.pie6 = this.pie6 || lt(this.tertiaryColor, { l: -10 }), this.pie7 = this.pie7 || lt(this.primaryColor, { h: 60, l: -10 }), this.pie8 = this.pie8 || lt(this.primaryColor, { h: -60, l: -10 }), this.pie9 = this.pie9 || lt(this.primaryColor, { h: 120, l: 0 }), this.pie10 = this.pie10 || lt(this.primaryColor, { h: 60, l: -20 }), this.pie11 = this.pie11 || lt(this.primaryColor, { h: -60, l: -20 }), this.pie12 = this.pie12 || lt(this.primaryColor, { h: 120, l: -10 }), this.pieTitleTextSize = this.pieTitleTextSize || "25px", this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor, this.pieSectionTextSize = this.pieSectionTextSize || "17px", this.pieSectionTextColor = this.pieSectionTextColor || this.textColor, this.pieLegendTextSize = this.pieLegendTextSize || "17px", this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor, this.pieStrokeColor = this.pieStrokeColor || "black", this.pieStrokeWidth = this.pieStrokeWidth || "2px", this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px", this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black", this.pieOpacity = this.pieOpacity || "0.7", this.quadrant1Fill = this.quadrant1Fill || this.primaryColor, this.quadrant2Fill = this.quadrant2Fill || lt(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || lt(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || lt(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || lt(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || lt(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || lt(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || Ds(this.quadrant1Fill) ? Nt(this.quadrant1Fill) : Ot(this.quadrant1Fill), this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor, this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor, this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor, this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor, this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor, this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor, this.xyChart = {
      backgroundColor: ((e = this.xyChart) == null ? void 0 : e.backgroundColor) || this.background,
      titleColor: ((n = this.xyChart) == null ? void 0 : n.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((i = this.xyChart) == null ? void 0 : i.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((r = this.xyChart) == null ? void 0 : r.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((s = this.xyChart) == null ? void 0 : s.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((a = this.xyChart) == null ? void 0 : a.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((o = this.xyChart) == null ? void 0 : o.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((l = this.xyChart) == null ? void 0 : l.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((u = this.xyChart) == null ? void 0 : u.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((h = this.xyChart) == null ? void 0 : h.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((f = this.xyChart) == null ? void 0 : f.plotColorPalette) || "#FFF4DD,#FFD8B1,#FFA07A,#ECEFF1,#D6DBDF,#C3E0A8,#FFB6A4,#FFD74D,#738FA7,#FFFFF0"
    }, this.requirementBackground = this.requirementBackground || this.primaryColor, this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor, this.requirementBorderSize = this.requirementBorderSize || "1", this.requirementTextColor = this.requirementTextColor || this.primaryTextColor, this.relationColor = this.relationColor || this.lineColor, this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? Ot(this.secondaryColor, 30) : this.secondaryColor), this.relationLabelColor = this.relationLabelColor || this.actorTextColor, this.git0 = this.git0 || this.primaryColor, this.git1 = this.git1 || this.secondaryColor, this.git2 = this.git2 || this.tertiaryColor, this.git3 = this.git3 || lt(this.primaryColor, { h: -30 }), this.git4 = this.git4 || lt(this.primaryColor, { h: -60 }), this.git5 = this.git5 || lt(this.primaryColor, { h: -90 }), this.git6 = this.git6 || lt(this.primaryColor, { h: 60 }), this.git7 = this.git7 || lt(this.primaryColor, { h: 120 }), this.darkMode ? (this.git0 = Nt(this.git0, 25), this.git1 = Nt(this.git1, 25), this.git2 = Nt(this.git2, 25), this.git3 = Nt(this.git3, 25), this.git4 = Nt(this.git4, 25), this.git5 = Nt(this.git5, 25), this.git6 = Nt(this.git6, 25), this.git7 = Nt(this.git7, 25)) : (this.git0 = Ot(this.git0, 25), this.git1 = Ot(this.git1, 25), this.git2 = Ot(this.git2, 25), this.git3 = Ot(this.git3, 25), this.git4 = Ot(this.git4, 25), this.git5 = Ot(this.git5, 25), this.git6 = Ot(this.git6, 25), this.git7 = Ot(this.git7, 25)), this.gitInv0 = this.gitInv0 || vt(this.git0), this.gitInv1 = this.gitInv1 || vt(this.git1), this.gitInv2 = this.gitInv2 || vt(this.git2), this.gitInv3 = this.gitInv3 || vt(this.git3), this.gitInv4 = this.gitInv4 || vt(this.git4), this.gitInv5 = this.gitInv5 || vt(this.git5), this.gitInv6 = this.gitInv6 || vt(this.git6), this.gitInv7 = this.gitInv7 || vt(this.git7), this.branchLabelColor = this.branchLabelColor || (this.darkMode ? "black" : this.labelTextColor), this.gitBranchLabel0 = this.gitBranchLabel0 || this.branchLabelColor, this.gitBranchLabel1 = this.gitBranchLabel1 || this.branchLabelColor, this.gitBranchLabel2 = this.gitBranchLabel2 || this.branchLabelColor, this.gitBranchLabel3 = this.gitBranchLabel3 || this.branchLabelColor, this.gitBranchLabel4 = this.gitBranchLabel4 || this.branchLabelColor, this.gitBranchLabel5 = this.gitBranchLabel5 || this.branchLabelColor, this.gitBranchLabel6 = this.gitBranchLabel6 || this.branchLabelColor, this.gitBranchLabel7 = this.gitBranchLabel7 || this.branchLabelColor, this.tagLabelColor = this.tagLabelColor || this.primaryTextColor, this.tagLabelBackground = this.tagLabelBackground || this.primaryColor, this.tagLabelBorder = this.tagBorder || this.primaryBorderColor, this.tagLabelFontSize = this.tagLabelFontSize || "10px", this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor, this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor, this.commitLabelFontSize = this.commitLabelFontSize || "10px", this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || nh, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || ih;
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const n = Object.keys(e);
    n.forEach((i) => {
      this[i] = e[i];
    }), this.updateColors(), n.forEach((i) => {
      this[i] = e[i];
    });
  }
};
const lA = (t) => {
  const e = new oA();
  return e.calculate(t), e;
};
let cA = class {
  constructor() {
    this.background = "#333", this.primaryColor = "#1f2020", this.secondaryColor = Nt(this.primaryColor, 16), this.tertiaryColor = lt(this.primaryColor, { h: -160 }), this.primaryBorderColor = vt(this.background), this.secondaryBorderColor = xn(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = xn(this.tertiaryColor, this.darkMode), this.primaryTextColor = vt(this.primaryColor), this.secondaryTextColor = vt(this.secondaryColor), this.tertiaryTextColor = vt(this.tertiaryColor), this.lineColor = vt(this.background), this.textColor = vt(this.background), this.mainBkg = "#1f2020", this.secondBkg = "calculated", this.mainContrastColor = "lightgrey", this.darkTextColor = Nt(vt("#323D47"), 10), this.lineColor = "calculated", this.border1 = "#81B1DB", this.border2 = cs(255, 255, 255, 0.25), this.arrowheadColor = "calculated", this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif', this.fontSize = "16px", this.labelBackground = "#181818", this.textColor = "#ccc", this.THEME_COLOR_LIMIT = 12, this.nodeBkg = "calculated", this.nodeBorder = "calculated", this.clusterBkg = "calculated", this.clusterBorder = "calculated", this.defaultLinkColor = "calculated", this.titleColor = "#F9FFFE", this.edgeLabelBackground = "calculated", this.actorBorder = "calculated", this.actorBkg = "calculated", this.actorTextColor = "calculated", this.actorLineColor = "calculated", this.signalColor = "calculated", this.signalTextColor = "calculated", this.labelBoxBkgColor = "calculated", this.labelBoxBorderColor = "calculated", this.labelTextColor = "calculated", this.loopTextColor = "calculated", this.noteBorderColor = "calculated", this.noteBkgColor = "#fff5ad", this.noteTextColor = "calculated", this.activationBorderColor = "calculated", this.activationBkgColor = "calculated", this.sequenceNumberColor = "black", this.sectionBkgColor = Ot("#EAE8D9", 30), this.altSectionBkgColor = "calculated", this.sectionBkgColor2 = "#EAE8D9", this.excludeBkgColor = Ot(this.sectionBkgColor, 10), this.taskBorderColor = cs(255, 255, 255, 70), this.taskBkgColor = "calculated", this.taskTextColor = "calculated", this.taskTextLightColor = "calculated", this.taskTextOutsideColor = "calculated", this.taskTextClickableColor = "#003163", this.activeTaskBorderColor = cs(255, 255, 255, 50), this.activeTaskBkgColor = "#81B1DB", this.gridColor = "calculated", this.doneTaskBkgColor = "calculated", this.doneTaskBorderColor = "grey", this.critBorderColor = "#E83737", this.critBkgColor = "#E83737", this.taskTextDarkColor = "calculated", this.todayLineColor = "#DB5757", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.labelColor = "calculated", this.errorBkgColor = "#a44141", this.errorTextColor = "#ddd";
  }
  updateColors() {
    var e, n, i, r, s, a, o, l, u, h, f;
    this.secondBkg = Nt(this.mainBkg, 16), this.lineColor = this.mainContrastColor, this.arrowheadColor = this.mainContrastColor, this.nodeBkg = this.mainBkg, this.nodeBorder = this.border1, this.clusterBkg = this.secondBkg, this.clusterBorder = this.border2, this.defaultLinkColor = this.lineColor, this.edgeLabelBackground = Nt(this.labelBackground, 25), this.actorBorder = this.border1, this.actorBkg = this.mainBkg, this.actorTextColor = this.mainContrastColor, this.actorLineColor = this.mainContrastColor, this.signalColor = this.mainContrastColor, this.signalTextColor = this.mainContrastColor, this.labelBoxBkgColor = this.actorBkg, this.labelBoxBorderColor = this.actorBorder, this.labelTextColor = this.mainContrastColor, this.loopTextColor = this.mainContrastColor, this.noteBorderColor = this.secondaryBorderColor, this.noteBkgColor = this.secondBkg, this.noteTextColor = this.secondaryTextColor, this.activationBorderColor = this.border1, this.activationBkgColor = this.secondBkg, this.altSectionBkgColor = this.background, this.taskBkgColor = Nt(this.mainBkg, 23), this.taskTextColor = this.darkTextColor, this.taskTextLightColor = this.mainContrastColor, this.taskTextOutsideColor = this.taskTextLightColor, this.gridColor = this.mainContrastColor, this.doneTaskBkgColor = this.mainContrastColor, this.taskTextDarkColor = this.darkTextColor, this.transitionColor = this.transitionColor || this.lineColor, this.transitionLabelColor = this.transitionLabelColor || this.textColor, this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor, this.stateBkg = this.stateBkg || this.mainBkg, this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg, this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor, this.altBackground = this.altBackground || "#555", this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg, this.compositeBorder = this.compositeBorder || this.nodeBorder, this.innerEndBackground = this.primaryBorderColor, this.specialStateColor = "#f4f4f4", this.errorBkgColor = this.errorBkgColor || this.tertiaryColor, this.errorTextColor = this.errorTextColor || this.tertiaryTextColor, this.fillType0 = this.primaryColor, this.fillType1 = this.secondaryColor, this.fillType2 = lt(this.primaryColor, { h: 64 }), this.fillType3 = lt(this.secondaryColor, { h: 64 }), this.fillType4 = lt(this.primaryColor, { h: -64 }), this.fillType5 = lt(this.secondaryColor, { h: -64 }), this.fillType6 = lt(this.primaryColor, { h: 128 }), this.fillType7 = lt(this.secondaryColor, { h: 128 }), this.cScale1 = this.cScale1 || "#0b0000", this.cScale2 = this.cScale2 || "#4d1037", this.cScale3 = this.cScale3 || "#3f5258", this.cScale4 = this.cScale4 || "#4f2f1b", this.cScale5 = this.cScale5 || "#6e0a0a", this.cScale6 = this.cScale6 || "#3b0048", this.cScale7 = this.cScale7 || "#995a01", this.cScale8 = this.cScale8 || "#154706", this.cScale9 = this.cScale9 || "#161722", this.cScale10 = this.cScale10 || "#00296f", this.cScale11 = this.cScale11 || "#01629c", this.cScale12 = this.cScale12 || "#010029", this.cScale0 = this.cScale0 || this.primaryColor, this.cScale1 = this.cScale1 || this.secondaryColor, this.cScale2 = this.cScale2 || this.tertiaryColor, this.cScale3 = this.cScale3 || lt(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || lt(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || lt(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || lt(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || lt(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || lt(this.primaryColor, { h: 210 }), this.cScale9 = this.cScale9 || lt(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || lt(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || lt(this.primaryColor, { h: 330 });
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScaleInv" + d] = this["cScaleInv" + d] || vt(this["cScale" + d]);
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScalePeer" + d] = this["cScalePeer" + d] || Nt(this["cScale" + d], 10);
    for (let d = 0; d < 5; d++)
      this["surface" + d] = this["surface" + d] || lt(this.mainBkg, { h: 30, s: -30, l: -(-10 + d * 4) }), this["surfacePeer" + d] = this["surfacePeer" + d] || lt(this.mainBkg, { h: 30, s: -30, l: -(-7 + d * 4) });
    this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor);
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScaleLabel" + d] = this["cScaleLabel" + d] || this.scaleLabelColor;
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["pie" + d] = this["cScale" + d];
    this.pieTitleTextSize = this.pieTitleTextSize || "25px", this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor, this.pieSectionTextSize = this.pieSectionTextSize || "17px", this.pieSectionTextColor = this.pieSectionTextColor || this.textColor, this.pieLegendTextSize = this.pieLegendTextSize || "17px", this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor, this.pieStrokeColor = this.pieStrokeColor || "black", this.pieStrokeWidth = this.pieStrokeWidth || "2px", this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px", this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black", this.pieOpacity = this.pieOpacity || "0.7", this.quadrant1Fill = this.quadrant1Fill || this.primaryColor, this.quadrant2Fill = this.quadrant2Fill || lt(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || lt(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || lt(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || lt(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || lt(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || lt(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || Ds(this.quadrant1Fill) ? Nt(this.quadrant1Fill) : Ot(this.quadrant1Fill), this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor, this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor, this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor, this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor, this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor, this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor, this.xyChart = {
      backgroundColor: ((e = this.xyChart) == null ? void 0 : e.backgroundColor) || this.background,
      titleColor: ((n = this.xyChart) == null ? void 0 : n.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((i = this.xyChart) == null ? void 0 : i.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((r = this.xyChart) == null ? void 0 : r.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((s = this.xyChart) == null ? void 0 : s.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((a = this.xyChart) == null ? void 0 : a.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((o = this.xyChart) == null ? void 0 : o.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((l = this.xyChart) == null ? void 0 : l.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((u = this.xyChart) == null ? void 0 : u.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((h = this.xyChart) == null ? void 0 : h.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((f = this.xyChart) == null ? void 0 : f.plotColorPalette) || "#3498db,#2ecc71,#e74c3c,#f1c40f,#bdc3c7,#ffffff,#34495e,#9b59b6,#1abc9c,#e67e22"
    }, this.classText = this.primaryTextColor, this.requirementBackground = this.requirementBackground || this.primaryColor, this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor, this.requirementBorderSize = this.requirementBorderSize || "1", this.requirementTextColor = this.requirementTextColor || this.primaryTextColor, this.relationColor = this.relationColor || this.lineColor, this.relationLabelBackground = this.relationLabelBackground || (this.darkMode ? Ot(this.secondaryColor, 30) : this.secondaryColor), this.relationLabelColor = this.relationLabelColor || this.actorTextColor, this.git0 = Nt(this.secondaryColor, 20), this.git1 = Nt(this.pie2 || this.secondaryColor, 20), this.git2 = Nt(this.pie3 || this.tertiaryColor, 20), this.git3 = Nt(this.pie4 || lt(this.primaryColor, { h: -30 }), 20), this.git4 = Nt(this.pie5 || lt(this.primaryColor, { h: -60 }), 20), this.git5 = Nt(this.pie6 || lt(this.primaryColor, { h: -90 }), 10), this.git6 = Nt(this.pie7 || lt(this.primaryColor, { h: 60 }), 10), this.git7 = Nt(this.pie8 || lt(this.primaryColor, { h: 120 }), 20), this.gitInv0 = this.gitInv0 || vt(this.git0), this.gitInv1 = this.gitInv1 || vt(this.git1), this.gitInv2 = this.gitInv2 || vt(this.git2), this.gitInv3 = this.gitInv3 || vt(this.git3), this.gitInv4 = this.gitInv4 || vt(this.git4), this.gitInv5 = this.gitInv5 || vt(this.git5), this.gitInv6 = this.gitInv6 || vt(this.git6), this.gitInv7 = this.gitInv7 || vt(this.git7), this.gitBranchLabel0 = this.gitBranchLabel0 || vt(this.labelTextColor), this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor, this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor, this.gitBranchLabel3 = this.gitBranchLabel3 || vt(this.labelTextColor), this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor, this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor, this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor, this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor, this.tagLabelColor = this.tagLabelColor || this.primaryTextColor, this.tagLabelBackground = this.tagLabelBackground || this.primaryColor, this.tagLabelBorder = this.tagBorder || this.primaryBorderColor, this.tagLabelFontSize = this.tagLabelFontSize || "10px", this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor, this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor, this.commitLabelFontSize = this.commitLabelFontSize || "10px", this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || Nt(this.background, 12), this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || Nt(this.background, 2);
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const n = Object.keys(e);
    n.forEach((i) => {
      this[i] = e[i];
    }), this.updateColors(), n.forEach((i) => {
      this[i] = e[i];
    });
  }
};
const uA = (t) => {
  const e = new cA();
  return e.calculate(t), e;
};
let hA = class {
  constructor() {
    this.background = "#f4f4f4", this.primaryColor = "#ECECFF", this.secondaryColor = lt(this.primaryColor, { h: 120 }), this.secondaryColor = "#ffffde", this.tertiaryColor = lt(this.primaryColor, { h: -160 }), this.primaryBorderColor = xn(this.primaryColor, this.darkMode), this.secondaryBorderColor = xn(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = xn(this.tertiaryColor, this.darkMode), this.primaryTextColor = vt(this.primaryColor), this.secondaryTextColor = vt(this.secondaryColor), this.tertiaryTextColor = vt(this.tertiaryColor), this.lineColor = vt(this.background), this.textColor = vt(this.background), this.background = "white", this.mainBkg = "#ECECFF", this.secondBkg = "#ffffde", this.lineColor = "#333333", this.border1 = "#9370DB", this.border2 = "#aaaa33", this.arrowheadColor = "#333333", this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif', this.fontSize = "16px", this.labelBackground = "#e8e8e8", this.textColor = "#333", this.THEME_COLOR_LIMIT = 12, this.nodeBkg = "calculated", this.nodeBorder = "calculated", this.clusterBkg = "calculated", this.clusterBorder = "calculated", this.defaultLinkColor = "calculated", this.titleColor = "calculated", this.edgeLabelBackground = "calculated", this.actorBorder = "calculated", this.actorBkg = "calculated", this.actorTextColor = "black", this.actorLineColor = "grey", this.signalColor = "calculated", this.signalTextColor = "calculated", this.labelBoxBkgColor = "calculated", this.labelBoxBorderColor = "calculated", this.labelTextColor = "calculated", this.loopTextColor = "calculated", this.noteBorderColor = "calculated", this.noteBkgColor = "#fff5ad", this.noteTextColor = "calculated", this.activationBorderColor = "#666", this.activationBkgColor = "#f4f4f4", this.sequenceNumberColor = "white", this.sectionBkgColor = "calculated", this.altSectionBkgColor = "calculated", this.sectionBkgColor2 = "calculated", this.excludeBkgColor = "#eeeeee", this.taskBorderColor = "calculated", this.taskBkgColor = "calculated", this.taskTextLightColor = "calculated", this.taskTextColor = this.taskTextLightColor, this.taskTextDarkColor = "calculated", this.taskTextOutsideColor = this.taskTextDarkColor, this.taskTextClickableColor = "calculated", this.activeTaskBorderColor = "calculated", this.activeTaskBkgColor = "calculated", this.gridColor = "calculated", this.doneTaskBkgColor = "calculated", this.doneTaskBorderColor = "calculated", this.critBorderColor = "calculated", this.critBkgColor = "calculated", this.todayLineColor = "calculated", this.sectionBkgColor = cs(102, 102, 255, 0.49), this.altSectionBkgColor = "white", this.sectionBkgColor2 = "#fff400", this.taskBorderColor = "#534fbc", this.taskBkgColor = "#8a90dd", this.taskTextLightColor = "white", this.taskTextColor = "calculated", this.taskTextDarkColor = "black", this.taskTextOutsideColor = "calculated", this.taskTextClickableColor = "#003163", this.activeTaskBorderColor = "#534fbc", this.activeTaskBkgColor = "#bfc7ff", this.gridColor = "lightgrey", this.doneTaskBkgColor = "lightgrey", this.doneTaskBorderColor = "grey", this.critBorderColor = "#ff8888", this.critBkgColor = "red", this.todayLineColor = "red", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.labelColor = "black", this.errorBkgColor = "#552222", this.errorTextColor = "#552222", this.updateColors();
  }
  updateColors() {
    var e, n, i, r, s, a, o, l, u, h, f;
    this.cScale0 = this.cScale0 || this.primaryColor, this.cScale1 = this.cScale1 || this.secondaryColor, this.cScale2 = this.cScale2 || this.tertiaryColor, this.cScale3 = this.cScale3 || lt(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || lt(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || lt(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || lt(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || lt(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || lt(this.primaryColor, { h: 210 }), this.cScale9 = this.cScale9 || lt(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || lt(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || lt(this.primaryColor, { h: 330 }), this.cScalePeer1 = this.cScalePeer1 || Ot(this.secondaryColor, 45), this.cScalePeer2 = this.cScalePeer2 || Ot(this.tertiaryColor, 40);
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScale" + d] = Ot(this["cScale" + d], 10), this["cScalePeer" + d] = this["cScalePeer" + d] || Ot(this["cScale" + d], 25);
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScaleInv" + d] = this["cScaleInv" + d] || lt(this["cScale" + d], { h: 180 });
    for (let d = 0; d < 5; d++)
      this["surface" + d] = this["surface" + d] || lt(this.mainBkg, { h: 30, l: -(5 + d * 5) }), this["surfacePeer" + d] = this["surfacePeer" + d] || lt(this.mainBkg, { h: 30, l: -(7 + d * 5) });
    if (this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor, this.labelTextColor !== "calculated") {
      this.cScaleLabel0 = this.cScaleLabel0 || vt(this.labelTextColor), this.cScaleLabel3 = this.cScaleLabel3 || vt(this.labelTextColor);
      for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
        this["cScaleLabel" + d] = this["cScaleLabel" + d] || this.labelTextColor;
    }
    this.nodeBkg = this.mainBkg, this.nodeBorder = this.border1, this.clusterBkg = this.secondBkg, this.clusterBorder = this.border2, this.defaultLinkColor = this.lineColor, this.titleColor = this.textColor, this.edgeLabelBackground = this.labelBackground, this.actorBorder = Nt(this.border1, 23), this.actorBkg = this.mainBkg, this.labelBoxBkgColor = this.actorBkg, this.signalColor = this.textColor, this.signalTextColor = this.textColor, this.labelBoxBorderColor = this.actorBorder, this.labelTextColor = this.actorTextColor, this.loopTextColor = this.actorTextColor, this.noteBorderColor = this.border2, this.noteTextColor = this.actorTextColor, this.taskTextColor = this.taskTextLightColor, this.taskTextOutsideColor = this.taskTextDarkColor, this.transitionColor = this.transitionColor || this.lineColor, this.transitionLabelColor = this.transitionLabelColor || this.textColor, this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor, this.stateBkg = this.stateBkg || this.mainBkg, this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg, this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor, this.altBackground = this.altBackground || "#f0f0f0", this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg, this.compositeBorder = this.compositeBorder || this.nodeBorder, this.innerEndBackground = this.nodeBorder, this.specialStateColor = this.lineColor, this.errorBkgColor = this.errorBkgColor || this.tertiaryColor, this.errorTextColor = this.errorTextColor || this.tertiaryTextColor, this.transitionColor = this.transitionColor || this.lineColor, this.classText = this.primaryTextColor, this.fillType0 = this.primaryColor, this.fillType1 = this.secondaryColor, this.fillType2 = lt(this.primaryColor, { h: 64 }), this.fillType3 = lt(this.secondaryColor, { h: 64 }), this.fillType4 = lt(this.primaryColor, { h: -64 }), this.fillType5 = lt(this.secondaryColor, { h: -64 }), this.fillType6 = lt(this.primaryColor, { h: 128 }), this.fillType7 = lt(this.secondaryColor, { h: 128 }), this.pie1 = this.pie1 || this.primaryColor, this.pie2 = this.pie2 || this.secondaryColor, this.pie3 = this.pie3 || lt(this.tertiaryColor, { l: -40 }), this.pie4 = this.pie4 || lt(this.primaryColor, { l: -10 }), this.pie5 = this.pie5 || lt(this.secondaryColor, { l: -30 }), this.pie6 = this.pie6 || lt(this.tertiaryColor, { l: -20 }), this.pie7 = this.pie7 || lt(this.primaryColor, { h: 60, l: -20 }), this.pie8 = this.pie8 || lt(this.primaryColor, { h: -60, l: -40 }), this.pie9 = this.pie9 || lt(this.primaryColor, { h: 120, l: -40 }), this.pie10 = this.pie10 || lt(this.primaryColor, { h: 60, l: -40 }), this.pie11 = this.pie11 || lt(this.primaryColor, { h: -90, l: -40 }), this.pie12 = this.pie12 || lt(this.primaryColor, { h: 120, l: -30 }), this.pieTitleTextSize = this.pieTitleTextSize || "25px", this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor, this.pieSectionTextSize = this.pieSectionTextSize || "17px", this.pieSectionTextColor = this.pieSectionTextColor || this.textColor, this.pieLegendTextSize = this.pieLegendTextSize || "17px", this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor, this.pieStrokeColor = this.pieStrokeColor || "black", this.pieStrokeWidth = this.pieStrokeWidth || "2px", this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px", this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black", this.pieOpacity = this.pieOpacity || "0.7", this.quadrant1Fill = this.quadrant1Fill || this.primaryColor, this.quadrant2Fill = this.quadrant2Fill || lt(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || lt(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || lt(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || lt(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || lt(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || lt(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || Ds(this.quadrant1Fill) ? Nt(this.quadrant1Fill) : Ot(this.quadrant1Fill), this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor, this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor, this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor, this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor, this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor, this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor, this.xyChart = {
      backgroundColor: ((e = this.xyChart) == null ? void 0 : e.backgroundColor) || this.background,
      titleColor: ((n = this.xyChart) == null ? void 0 : n.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((i = this.xyChart) == null ? void 0 : i.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((r = this.xyChart) == null ? void 0 : r.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((s = this.xyChart) == null ? void 0 : s.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((a = this.xyChart) == null ? void 0 : a.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((o = this.xyChart) == null ? void 0 : o.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((l = this.xyChart) == null ? void 0 : l.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((u = this.xyChart) == null ? void 0 : u.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((h = this.xyChart) == null ? void 0 : h.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((f = this.xyChart) == null ? void 0 : f.plotColorPalette) || "#ECECFF,#8493A6,#FFC3A0,#DCDDE1,#B8E994,#D1A36F,#C3CDE6,#FFB6C1,#496078,#F8F3E3"
    }, this.requirementBackground = this.requirementBackground || this.primaryColor, this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor, this.requirementBorderSize = this.requirementBorderSize || "1", this.requirementTextColor = this.requirementTextColor || this.primaryTextColor, this.relationColor = this.relationColor || this.lineColor, this.relationLabelBackground = this.relationLabelBackground || this.labelBackground, this.relationLabelColor = this.relationLabelColor || this.actorTextColor, this.git0 = this.git0 || this.primaryColor, this.git1 = this.git1 || this.secondaryColor, this.git2 = this.git2 || this.tertiaryColor, this.git3 = this.git3 || lt(this.primaryColor, { h: -30 }), this.git4 = this.git4 || lt(this.primaryColor, { h: -60 }), this.git5 = this.git5 || lt(this.primaryColor, { h: -90 }), this.git6 = this.git6 || lt(this.primaryColor, { h: 60 }), this.git7 = this.git7 || lt(this.primaryColor, { h: 120 }), this.darkMode ? (this.git0 = Nt(this.git0, 25), this.git1 = Nt(this.git1, 25), this.git2 = Nt(this.git2, 25), this.git3 = Nt(this.git3, 25), this.git4 = Nt(this.git4, 25), this.git5 = Nt(this.git5, 25), this.git6 = Nt(this.git6, 25), this.git7 = Nt(this.git7, 25)) : (this.git0 = Ot(this.git0, 25), this.git1 = Ot(this.git1, 25), this.git2 = Ot(this.git2, 25), this.git3 = Ot(this.git3, 25), this.git4 = Ot(this.git4, 25), this.git5 = Ot(this.git5, 25), this.git6 = Ot(this.git6, 25), this.git7 = Ot(this.git7, 25)), this.gitInv0 = this.gitInv0 || Ot(vt(this.git0), 25), this.gitInv1 = this.gitInv1 || vt(this.git1), this.gitInv2 = this.gitInv2 || vt(this.git2), this.gitInv3 = this.gitInv3 || vt(this.git3), this.gitInv4 = this.gitInv4 || vt(this.git4), this.gitInv5 = this.gitInv5 || vt(this.git5), this.gitInv6 = this.gitInv6 || vt(this.git6), this.gitInv7 = this.gitInv7 || vt(this.git7), this.gitBranchLabel0 = this.gitBranchLabel0 || vt(this.labelTextColor), this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor, this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor, this.gitBranchLabel3 = this.gitBranchLabel3 || vt(this.labelTextColor), this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor, this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor, this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor, this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor, this.tagLabelColor = this.tagLabelColor || this.primaryTextColor, this.tagLabelBackground = this.tagLabelBackground || this.primaryColor, this.tagLabelBorder = this.tagBorder || this.primaryBorderColor, this.tagLabelFontSize = this.tagLabelFontSize || "10px", this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor, this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor, this.commitLabelFontSize = this.commitLabelFontSize || "10px", this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || nh, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || ih;
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const n = Object.keys(e);
    n.forEach((i) => {
      this[i] = e[i];
    }), this.updateColors(), n.forEach((i) => {
      this[i] = e[i];
    });
  }
};
const Ef = (t) => {
  const e = new hA();
  return e.calculate(t), e;
};
let dA = class {
  constructor() {
    this.background = "#f4f4f4", this.primaryColor = "#cde498", this.secondaryColor = "#cdffb2", this.background = "white", this.mainBkg = "#cde498", this.secondBkg = "#cdffb2", this.lineColor = "green", this.border1 = "#13540c", this.border2 = "#6eaa49", this.arrowheadColor = "green", this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif', this.fontSize = "16px", this.tertiaryColor = Nt("#cde498", 10), this.primaryBorderColor = xn(this.primaryColor, this.darkMode), this.secondaryBorderColor = xn(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = xn(this.tertiaryColor, this.darkMode), this.primaryTextColor = vt(this.primaryColor), this.secondaryTextColor = vt(this.secondaryColor), this.tertiaryTextColor = vt(this.primaryColor), this.lineColor = vt(this.background), this.textColor = vt(this.background), this.THEME_COLOR_LIMIT = 12, this.nodeBkg = "calculated", this.nodeBorder = "calculated", this.clusterBkg = "calculated", this.clusterBorder = "calculated", this.defaultLinkColor = "calculated", this.titleColor = "#333", this.edgeLabelBackground = "#e8e8e8", this.actorBorder = "calculated", this.actorBkg = "calculated", this.actorTextColor = "black", this.actorLineColor = "grey", this.signalColor = "#333", this.signalTextColor = "#333", this.labelBoxBkgColor = "calculated", this.labelBoxBorderColor = "#326932", this.labelTextColor = "calculated", this.loopTextColor = "calculated", this.noteBorderColor = "calculated", this.noteBkgColor = "#fff5ad", this.noteTextColor = "calculated", this.activationBorderColor = "#666", this.activationBkgColor = "#f4f4f4", this.sequenceNumberColor = "white", this.sectionBkgColor = "#6eaa49", this.altSectionBkgColor = "white", this.sectionBkgColor2 = "#6eaa49", this.excludeBkgColor = "#eeeeee", this.taskBorderColor = "calculated", this.taskBkgColor = "#487e3a", this.taskTextLightColor = "white", this.taskTextColor = "calculated", this.taskTextDarkColor = "black", this.taskTextOutsideColor = "calculated", this.taskTextClickableColor = "#003163", this.activeTaskBorderColor = "calculated", this.activeTaskBkgColor = "calculated", this.gridColor = "lightgrey", this.doneTaskBkgColor = "lightgrey", this.doneTaskBorderColor = "grey", this.critBorderColor = "#ff8888", this.critBkgColor = "red", this.todayLineColor = "red", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.labelColor = "black", this.errorBkgColor = "#552222", this.errorTextColor = "#552222";
  }
  updateColors() {
    var e, n, i, r, s, a, o, l, u, h, f;
    this.actorBorder = Ot(this.mainBkg, 20), this.actorBkg = this.mainBkg, this.labelBoxBkgColor = this.actorBkg, this.labelTextColor = this.actorTextColor, this.loopTextColor = this.actorTextColor, this.noteBorderColor = this.border2, this.noteTextColor = this.actorTextColor, this.cScale0 = this.cScale0 || this.primaryColor, this.cScale1 = this.cScale1 || this.secondaryColor, this.cScale2 = this.cScale2 || this.tertiaryColor, this.cScale3 = this.cScale3 || lt(this.primaryColor, { h: 30 }), this.cScale4 = this.cScale4 || lt(this.primaryColor, { h: 60 }), this.cScale5 = this.cScale5 || lt(this.primaryColor, { h: 90 }), this.cScale6 = this.cScale6 || lt(this.primaryColor, { h: 120 }), this.cScale7 = this.cScale7 || lt(this.primaryColor, { h: 150 }), this.cScale8 = this.cScale8 || lt(this.primaryColor, { h: 210 }), this.cScale9 = this.cScale9 || lt(this.primaryColor, { h: 270 }), this.cScale10 = this.cScale10 || lt(this.primaryColor, { h: 300 }), this.cScale11 = this.cScale11 || lt(this.primaryColor, { h: 330 }), this.cScalePeer1 = this.cScalePeer1 || Ot(this.secondaryColor, 45), this.cScalePeer2 = this.cScalePeer2 || Ot(this.tertiaryColor, 40);
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScale" + d] = Ot(this["cScale" + d], 10), this["cScalePeer" + d] = this["cScalePeer" + d] || Ot(this["cScale" + d], 25);
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScaleInv" + d] = this["cScaleInv" + d] || lt(this["cScale" + d], { h: 180 });
    this.scaleLabelColor = this.scaleLabelColor !== "calculated" && this.scaleLabelColor ? this.scaleLabelColor : this.labelTextColor;
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScaleLabel" + d] = this["cScaleLabel" + d] || this.scaleLabelColor;
    for (let d = 0; d < 5; d++)
      this["surface" + d] = this["surface" + d] || lt(this.mainBkg, { h: 30, s: -30, l: -(5 + d * 5) }), this["surfacePeer" + d] = this["surfacePeer" + d] || lt(this.mainBkg, { h: 30, s: -30, l: -(8 + d * 5) });
    this.nodeBkg = this.mainBkg, this.nodeBorder = this.border1, this.clusterBkg = this.secondBkg, this.clusterBorder = this.border2, this.defaultLinkColor = this.lineColor, this.taskBorderColor = this.border1, this.taskTextColor = this.taskTextLightColor, this.taskTextOutsideColor = this.taskTextDarkColor, this.activeTaskBorderColor = this.taskBorderColor, this.activeTaskBkgColor = this.mainBkg, this.transitionColor = this.transitionColor || this.lineColor, this.transitionLabelColor = this.transitionLabelColor || this.textColor, this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor, this.stateBkg = this.stateBkg || this.mainBkg, this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg, this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor, this.altBackground = this.altBackground || "#f0f0f0", this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg, this.compositeBorder = this.compositeBorder || this.nodeBorder, this.innerEndBackground = this.primaryBorderColor, this.specialStateColor = this.lineColor, this.errorBkgColor = this.errorBkgColor || this.tertiaryColor, this.errorTextColor = this.errorTextColor || this.tertiaryTextColor, this.transitionColor = this.transitionColor || this.lineColor, this.classText = this.primaryTextColor, this.fillType0 = this.primaryColor, this.fillType1 = this.secondaryColor, this.fillType2 = lt(this.primaryColor, { h: 64 }), this.fillType3 = lt(this.secondaryColor, { h: 64 }), this.fillType4 = lt(this.primaryColor, { h: -64 }), this.fillType5 = lt(this.secondaryColor, { h: -64 }), this.fillType6 = lt(this.primaryColor, { h: 128 }), this.fillType7 = lt(this.secondaryColor, { h: 128 }), this.pie1 = this.pie1 || this.primaryColor, this.pie2 = this.pie2 || this.secondaryColor, this.pie3 = this.pie3 || this.tertiaryColor, this.pie4 = this.pie4 || lt(this.primaryColor, { l: -30 }), this.pie5 = this.pie5 || lt(this.secondaryColor, { l: -30 }), this.pie6 = this.pie6 || lt(this.tertiaryColor, { h: 40, l: -40 }), this.pie7 = this.pie7 || lt(this.primaryColor, { h: 60, l: -10 }), this.pie8 = this.pie8 || lt(this.primaryColor, { h: -60, l: -10 }), this.pie9 = this.pie9 || lt(this.primaryColor, { h: 120, l: 0 }), this.pie10 = this.pie10 || lt(this.primaryColor, { h: 60, l: -50 }), this.pie11 = this.pie11 || lt(this.primaryColor, { h: -60, l: -50 }), this.pie12 = this.pie12 || lt(this.primaryColor, { h: 120, l: -50 }), this.pieTitleTextSize = this.pieTitleTextSize || "25px", this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor, this.pieSectionTextSize = this.pieSectionTextSize || "17px", this.pieSectionTextColor = this.pieSectionTextColor || this.textColor, this.pieLegendTextSize = this.pieLegendTextSize || "17px", this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor, this.pieStrokeColor = this.pieStrokeColor || "black", this.pieStrokeWidth = this.pieStrokeWidth || "2px", this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px", this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black", this.pieOpacity = this.pieOpacity || "0.7", this.quadrant1Fill = this.quadrant1Fill || this.primaryColor, this.quadrant2Fill = this.quadrant2Fill || lt(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || lt(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || lt(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || lt(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || lt(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || lt(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || Ds(this.quadrant1Fill) ? Nt(this.quadrant1Fill) : Ot(this.quadrant1Fill), this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor, this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor, this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor, this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor, this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor, this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor, this.xyChart = {
      backgroundColor: ((e = this.xyChart) == null ? void 0 : e.backgroundColor) || this.background,
      titleColor: ((n = this.xyChart) == null ? void 0 : n.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((i = this.xyChart) == null ? void 0 : i.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((r = this.xyChart) == null ? void 0 : r.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((s = this.xyChart) == null ? void 0 : s.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((a = this.xyChart) == null ? void 0 : a.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((o = this.xyChart) == null ? void 0 : o.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((l = this.xyChart) == null ? void 0 : l.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((u = this.xyChart) == null ? void 0 : u.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((h = this.xyChart) == null ? void 0 : h.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((f = this.xyChart) == null ? void 0 : f.plotColorPalette) || "#CDE498,#FF6B6B,#A0D2DB,#D7BDE2,#F0F0F0,#FFC3A0,#7FD8BE,#FF9A8B,#FAF3E0,#FFF176"
    }, this.requirementBackground = this.requirementBackground || this.primaryColor, this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor, this.requirementBorderSize = this.requirementBorderSize || "1", this.requirementTextColor = this.requirementTextColor || this.primaryTextColor, this.relationColor = this.relationColor || this.lineColor, this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground, this.relationLabelColor = this.relationLabelColor || this.actorTextColor, this.git0 = this.git0 || this.primaryColor, this.git1 = this.git1 || this.secondaryColor, this.git2 = this.git2 || this.tertiaryColor, this.git3 = this.git3 || lt(this.primaryColor, { h: -30 }), this.git4 = this.git4 || lt(this.primaryColor, { h: -60 }), this.git5 = this.git5 || lt(this.primaryColor, { h: -90 }), this.git6 = this.git6 || lt(this.primaryColor, { h: 60 }), this.git7 = this.git7 || lt(this.primaryColor, { h: 120 }), this.darkMode ? (this.git0 = Nt(this.git0, 25), this.git1 = Nt(this.git1, 25), this.git2 = Nt(this.git2, 25), this.git3 = Nt(this.git3, 25), this.git4 = Nt(this.git4, 25), this.git5 = Nt(this.git5, 25), this.git6 = Nt(this.git6, 25), this.git7 = Nt(this.git7, 25)) : (this.git0 = Ot(this.git0, 25), this.git1 = Ot(this.git1, 25), this.git2 = Ot(this.git2, 25), this.git3 = Ot(this.git3, 25), this.git4 = Ot(this.git4, 25), this.git5 = Ot(this.git5, 25), this.git6 = Ot(this.git6, 25), this.git7 = Ot(this.git7, 25)), this.gitInv0 = this.gitInv0 || vt(this.git0), this.gitInv1 = this.gitInv1 || vt(this.git1), this.gitInv2 = this.gitInv2 || vt(this.git2), this.gitInv3 = this.gitInv3 || vt(this.git3), this.gitInv4 = this.gitInv4 || vt(this.git4), this.gitInv5 = this.gitInv5 || vt(this.git5), this.gitInv6 = this.gitInv6 || vt(this.git6), this.gitInv7 = this.gitInv7 || vt(this.git7), this.gitBranchLabel0 = this.gitBranchLabel0 || vt(this.labelTextColor), this.gitBranchLabel1 = this.gitBranchLabel1 || this.labelTextColor, this.gitBranchLabel2 = this.gitBranchLabel2 || this.labelTextColor, this.gitBranchLabel3 = this.gitBranchLabel3 || vt(this.labelTextColor), this.gitBranchLabel4 = this.gitBranchLabel4 || this.labelTextColor, this.gitBranchLabel5 = this.gitBranchLabel5 || this.labelTextColor, this.gitBranchLabel6 = this.gitBranchLabel6 || this.labelTextColor, this.gitBranchLabel7 = this.gitBranchLabel7 || this.labelTextColor, this.tagLabelColor = this.tagLabelColor || this.primaryTextColor, this.tagLabelBackground = this.tagLabelBackground || this.primaryColor, this.tagLabelBorder = this.tagBorder || this.primaryBorderColor, this.tagLabelFontSize = this.tagLabelFontSize || "10px", this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor, this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor, this.commitLabelFontSize = this.commitLabelFontSize || "10px", this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || nh, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || ih;
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const n = Object.keys(e);
    n.forEach((i) => {
      this[i] = e[i];
    }), this.updateColors(), n.forEach((i) => {
      this[i] = e[i];
    });
  }
};
const fA = (t) => {
  const e = new dA();
  return e.calculate(t), e;
};
class pA {
  constructor() {
    this.primaryColor = "#eee", this.contrast = "#707070", this.secondaryColor = Nt(this.contrast, 55), this.background = "#ffffff", this.tertiaryColor = lt(this.primaryColor, { h: -160 }), this.primaryBorderColor = xn(this.primaryColor, this.darkMode), this.secondaryBorderColor = xn(this.secondaryColor, this.darkMode), this.tertiaryBorderColor = xn(this.tertiaryColor, this.darkMode), this.primaryTextColor = vt(this.primaryColor), this.secondaryTextColor = vt(this.secondaryColor), this.tertiaryTextColor = vt(this.tertiaryColor), this.lineColor = vt(this.background), this.textColor = vt(this.background), this.mainBkg = "#eee", this.secondBkg = "calculated", this.lineColor = "#666", this.border1 = "#999", this.border2 = "calculated", this.note = "#ffa", this.text = "#333", this.critical = "#d42", this.done = "#bbb", this.arrowheadColor = "#333333", this.fontFamily = '"trebuchet ms", verdana, arial, sans-serif', this.fontSize = "16px", this.THEME_COLOR_LIMIT = 12, this.nodeBkg = "calculated", this.nodeBorder = "calculated", this.clusterBkg = "calculated", this.clusterBorder = "calculated", this.defaultLinkColor = "calculated", this.titleColor = "calculated", this.edgeLabelBackground = "white", this.actorBorder = "calculated", this.actorBkg = "calculated", this.actorTextColor = "calculated", this.actorLineColor = "calculated", this.signalColor = "calculated", this.signalTextColor = "calculated", this.labelBoxBkgColor = "calculated", this.labelBoxBorderColor = "calculated", this.labelTextColor = "calculated", this.loopTextColor = "calculated", this.noteBorderColor = "calculated", this.noteBkgColor = "calculated", this.noteTextColor = "calculated", this.activationBorderColor = "#666", this.activationBkgColor = "#f4f4f4", this.sequenceNumberColor = "white", this.sectionBkgColor = "calculated", this.altSectionBkgColor = "white", this.sectionBkgColor2 = "calculated", this.excludeBkgColor = "#eeeeee", this.taskBorderColor = "calculated", this.taskBkgColor = "calculated", this.taskTextLightColor = "white", this.taskTextColor = "calculated", this.taskTextDarkColor = "calculated", this.taskTextOutsideColor = "calculated", this.taskTextClickableColor = "#003163", this.activeTaskBorderColor = "calculated", this.activeTaskBkgColor = "calculated", this.gridColor = "calculated", this.doneTaskBkgColor = "calculated", this.doneTaskBorderColor = "calculated", this.critBkgColor = "calculated", this.critBorderColor = "calculated", this.todayLineColor = "calculated", this.personBorder = this.primaryBorderColor, this.personBkg = this.mainBkg, this.labelColor = "black", this.errorBkgColor = "#552222", this.errorTextColor = "#552222";
  }
  updateColors() {
    var e, n, i, r, s, a, o, l, u, h, f;
    this.secondBkg = Nt(this.contrast, 55), this.border2 = this.contrast, this.actorBorder = Nt(this.border1, 23), this.actorBkg = this.mainBkg, this.actorTextColor = this.text, this.actorLineColor = this.lineColor, this.signalColor = this.text, this.signalTextColor = this.text, this.labelBoxBkgColor = this.actorBkg, this.labelBoxBorderColor = this.actorBorder, this.labelTextColor = this.text, this.loopTextColor = this.text, this.noteBorderColor = "#999", this.noteBkgColor = "#666", this.noteTextColor = "#fff", this.cScale0 = this.cScale0 || "#555", this.cScale1 = this.cScale1 || "#F4F4F4", this.cScale2 = this.cScale2 || "#555", this.cScale3 = this.cScale3 || "#BBB", this.cScale4 = this.cScale4 || "#777", this.cScale5 = this.cScale5 || "#999", this.cScale6 = this.cScale6 || "#DDD", this.cScale7 = this.cScale7 || "#FFF", this.cScale8 = this.cScale8 || "#DDD", this.cScale9 = this.cScale9 || "#BBB", this.cScale10 = this.cScale10 || "#999", this.cScale11 = this.cScale11 || "#777";
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScaleInv" + d] = this["cScaleInv" + d] || vt(this["cScale" + d]);
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this.darkMode ? this["cScalePeer" + d] = this["cScalePeer" + d] || Nt(this["cScale" + d], 10) : this["cScalePeer" + d] = this["cScalePeer" + d] || Ot(this["cScale" + d], 10);
    this.scaleLabelColor = this.scaleLabelColor || (this.darkMode ? "black" : this.labelTextColor), this.cScaleLabel0 = this.cScaleLabel0 || this.cScale1, this.cScaleLabel2 = this.cScaleLabel2 || this.cScale1;
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["cScaleLabel" + d] = this["cScaleLabel" + d] || this.scaleLabelColor;
    for (let d = 0; d < 5; d++)
      this["surface" + d] = this["surface" + d] || lt(this.mainBkg, { l: -(5 + d * 5) }), this["surfacePeer" + d] = this["surfacePeer" + d] || lt(this.mainBkg, { l: -(8 + d * 5) });
    this.nodeBkg = this.mainBkg, this.nodeBorder = this.border1, this.clusterBkg = this.secondBkg, this.clusterBorder = this.border2, this.defaultLinkColor = this.lineColor, this.titleColor = this.text, this.sectionBkgColor = Nt(this.contrast, 30), this.sectionBkgColor2 = Nt(this.contrast, 30), this.taskBorderColor = Ot(this.contrast, 10), this.taskBkgColor = this.contrast, this.taskTextColor = this.taskTextLightColor, this.taskTextDarkColor = this.text, this.taskTextOutsideColor = this.taskTextDarkColor, this.activeTaskBorderColor = this.taskBorderColor, this.activeTaskBkgColor = this.mainBkg, this.gridColor = Nt(this.border1, 30), this.doneTaskBkgColor = this.done, this.doneTaskBorderColor = this.lineColor, this.critBkgColor = this.critical, this.critBorderColor = Ot(this.critBkgColor, 10), this.todayLineColor = this.critBkgColor, this.transitionColor = this.transitionColor || "#000", this.transitionLabelColor = this.transitionLabelColor || this.textColor, this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor, this.stateBkg = this.stateBkg || this.mainBkg, this.labelBackgroundColor = this.labelBackgroundColor || this.stateBkg, this.compositeBackground = this.compositeBackground || this.background || this.tertiaryColor, this.altBackground = this.altBackground || "#f4f4f4", this.compositeTitleBackground = this.compositeTitleBackground || this.mainBkg, this.stateBorder = this.stateBorder || "#000", this.innerEndBackground = this.primaryBorderColor, this.specialStateColor = "#222", this.errorBkgColor = this.errorBkgColor || this.tertiaryColor, this.errorTextColor = this.errorTextColor || this.tertiaryTextColor, this.classText = this.primaryTextColor, this.fillType0 = this.primaryColor, this.fillType1 = this.secondaryColor, this.fillType2 = lt(this.primaryColor, { h: 64 }), this.fillType3 = lt(this.secondaryColor, { h: 64 }), this.fillType4 = lt(this.primaryColor, { h: -64 }), this.fillType5 = lt(this.secondaryColor, { h: -64 }), this.fillType6 = lt(this.primaryColor, { h: 128 }), this.fillType7 = lt(this.secondaryColor, { h: 128 });
    for (let d = 0; d < this.THEME_COLOR_LIMIT; d++)
      this["pie" + d] = this["cScale" + d];
    this.pie12 = this.pie0, this.pieTitleTextSize = this.pieTitleTextSize || "25px", this.pieTitleTextColor = this.pieTitleTextColor || this.taskTextDarkColor, this.pieSectionTextSize = this.pieSectionTextSize || "17px", this.pieSectionTextColor = this.pieSectionTextColor || this.textColor, this.pieLegendTextSize = this.pieLegendTextSize || "17px", this.pieLegendTextColor = this.pieLegendTextColor || this.taskTextDarkColor, this.pieStrokeColor = this.pieStrokeColor || "black", this.pieStrokeWidth = this.pieStrokeWidth || "2px", this.pieOuterStrokeWidth = this.pieOuterStrokeWidth || "2px", this.pieOuterStrokeColor = this.pieOuterStrokeColor || "black", this.pieOpacity = this.pieOpacity || "0.7", this.quadrant1Fill = this.quadrant1Fill || this.primaryColor, this.quadrant2Fill = this.quadrant2Fill || lt(this.primaryColor, { r: 5, g: 5, b: 5 }), this.quadrant3Fill = this.quadrant3Fill || lt(this.primaryColor, { r: 10, g: 10, b: 10 }), this.quadrant4Fill = this.quadrant4Fill || lt(this.primaryColor, { r: 15, g: 15, b: 15 }), this.quadrant1TextFill = this.quadrant1TextFill || this.primaryTextColor, this.quadrant2TextFill = this.quadrant2TextFill || lt(this.primaryTextColor, { r: -5, g: -5, b: -5 }), this.quadrant3TextFill = this.quadrant3TextFill || lt(this.primaryTextColor, { r: -10, g: -10, b: -10 }), this.quadrant4TextFill = this.quadrant4TextFill || lt(this.primaryTextColor, { r: -15, g: -15, b: -15 }), this.quadrantPointFill = this.quadrantPointFill || Ds(this.quadrant1Fill) ? Nt(this.quadrant1Fill) : Ot(this.quadrant1Fill), this.quadrantPointTextFill = this.quadrantPointTextFill || this.primaryTextColor, this.quadrantXAxisTextFill = this.quadrantXAxisTextFill || this.primaryTextColor, this.quadrantYAxisTextFill = this.quadrantYAxisTextFill || this.primaryTextColor, this.quadrantInternalBorderStrokeFill = this.quadrantInternalBorderStrokeFill || this.primaryBorderColor, this.quadrantExternalBorderStrokeFill = this.quadrantExternalBorderStrokeFill || this.primaryBorderColor, this.quadrantTitleFill = this.quadrantTitleFill || this.primaryTextColor, this.xyChart = {
      backgroundColor: ((e = this.xyChart) == null ? void 0 : e.backgroundColor) || this.background,
      titleColor: ((n = this.xyChart) == null ? void 0 : n.titleColor) || this.primaryTextColor,
      xAxisTitleColor: ((i = this.xyChart) == null ? void 0 : i.xAxisTitleColor) || this.primaryTextColor,
      xAxisLabelColor: ((r = this.xyChart) == null ? void 0 : r.xAxisLabelColor) || this.primaryTextColor,
      xAxisTickColor: ((s = this.xyChart) == null ? void 0 : s.xAxisTickColor) || this.primaryTextColor,
      xAxisLineColor: ((a = this.xyChart) == null ? void 0 : a.xAxisLineColor) || this.primaryTextColor,
      yAxisTitleColor: ((o = this.xyChart) == null ? void 0 : o.yAxisTitleColor) || this.primaryTextColor,
      yAxisLabelColor: ((l = this.xyChart) == null ? void 0 : l.yAxisLabelColor) || this.primaryTextColor,
      yAxisTickColor: ((u = this.xyChart) == null ? void 0 : u.yAxisTickColor) || this.primaryTextColor,
      yAxisLineColor: ((h = this.xyChart) == null ? void 0 : h.yAxisLineColor) || this.primaryTextColor,
      plotColorPalette: ((f = this.xyChart) == null ? void 0 : f.plotColorPalette) || "#EEE,#6BB8E4,#8ACB88,#C7ACD6,#E8DCC2,#FFB2A8,#FFF380,#7E8D91,#FFD8B1,#FAF3E0"
    }, this.requirementBackground = this.requirementBackground || this.primaryColor, this.requirementBorderColor = this.requirementBorderColor || this.primaryBorderColor, this.requirementBorderSize = this.requirementBorderSize || "1", this.requirementTextColor = this.requirementTextColor || this.primaryTextColor, this.relationColor = this.relationColor || this.lineColor, this.relationLabelBackground = this.relationLabelBackground || this.edgeLabelBackground, this.relationLabelColor = this.relationLabelColor || this.actorTextColor, this.git0 = Ot(this.pie1, 25) || this.primaryColor, this.git1 = this.pie2 || this.secondaryColor, this.git2 = this.pie3 || this.tertiaryColor, this.git3 = this.pie4 || lt(this.primaryColor, { h: -30 }), this.git4 = this.pie5 || lt(this.primaryColor, { h: -60 }), this.git5 = this.pie6 || lt(this.primaryColor, { h: -90 }), this.git6 = this.pie7 || lt(this.primaryColor, { h: 60 }), this.git7 = this.pie8 || lt(this.primaryColor, { h: 120 }), this.gitInv0 = this.gitInv0 || vt(this.git0), this.gitInv1 = this.gitInv1 || vt(this.git1), this.gitInv2 = this.gitInv2 || vt(this.git2), this.gitInv3 = this.gitInv3 || vt(this.git3), this.gitInv4 = this.gitInv4 || vt(this.git4), this.gitInv5 = this.gitInv5 || vt(this.git5), this.gitInv6 = this.gitInv6 || vt(this.git6), this.gitInv7 = this.gitInv7 || vt(this.git7), this.branchLabelColor = this.branchLabelColor || this.labelTextColor, this.gitBranchLabel0 = this.branchLabelColor, this.gitBranchLabel1 = "white", this.gitBranchLabel2 = this.branchLabelColor, this.gitBranchLabel3 = "white", this.gitBranchLabel4 = this.branchLabelColor, this.gitBranchLabel5 = this.branchLabelColor, this.gitBranchLabel6 = this.branchLabelColor, this.gitBranchLabel7 = this.branchLabelColor, this.tagLabelColor = this.tagLabelColor || this.primaryTextColor, this.tagLabelBackground = this.tagLabelBackground || this.primaryColor, this.tagLabelBorder = this.tagBorder || this.primaryBorderColor, this.tagLabelFontSize = this.tagLabelFontSize || "10px", this.commitLabelColor = this.commitLabelColor || this.secondaryTextColor, this.commitLabelBackground = this.commitLabelBackground || this.secondaryColor, this.commitLabelFontSize = this.commitLabelFontSize || "10px", this.attributeBackgroundColorOdd = this.attributeBackgroundColorOdd || nh, this.attributeBackgroundColorEven = this.attributeBackgroundColorEven || ih;
  }
  calculate(e) {
    if (typeof e != "object") {
      this.updateColors();
      return;
    }
    const n = Object.keys(e);
    n.forEach((i) => {
      this[i] = e[i];
    }), this.updateColors(), n.forEach((i) => {
      this[i] = e[i];
    });
  }
}
const gA = (t) => {
  const e = new pA();
  return e.calculate(t), e;
}, yr = {
  base: {
    getThemeVariables: lA
  },
  dark: {
    getThemeVariables: uA
  },
  default: {
    getThemeVariables: Ef
  },
  forest: {
    getThemeVariables: fA
  },
  neutral: {
    getThemeVariables: gA
  }
}, ir = {
  flowchart: {
    useMaxWidth: !0,
    titleTopMargin: 25,
    subGraphTitleMargin: {
      top: 0,
      bottom: 0
    },
    diagramPadding: 8,
    htmlLabels: !0,
    nodeSpacing: 50,
    rankSpacing: 50,
    curve: "basis",
    padding: 15,
    defaultRenderer: "dagre-wrapper",
    wrappingWidth: 200
  },
  sequence: {
    useMaxWidth: !0,
    hideUnusedParticipants: !1,
    activationWidth: 10,
    diagramMarginX: 50,
    diagramMarginY: 10,
    actorMargin: 50,
    width: 150,
    height: 65,
    boxMargin: 10,
    boxTextMargin: 5,
    noteMargin: 10,
    messageMargin: 35,
    messageAlign: "center",
    mirrorActors: !0,
    forceMenus: !1,
    bottomMarginAdj: 1,
    rightAngles: !1,
    showSequenceNumbers: !1,
    actorFontSize: 14,
    actorFontFamily: '"Open Sans", sans-serif',
    actorFontWeight: 400,
    noteFontSize: 14,
    noteFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
    noteFontWeight: 400,
    noteAlign: "center",
    messageFontSize: 16,
    messageFontFamily: '"trebuchet ms", verdana, arial, sans-serif',
    messageFontWeight: 400,
    wrap: !1,
    wrapPadding: 10,
    labelBoxWidth: 50,
    labelBoxHeight: 20
  },
  gantt: {
    useMaxWidth: !0,
    titleTopMargin: 25,
    barHeight: 20,
    barGap: 4,
    topPadding: 50,
    rightPadding: 75,
    leftPadding: 75,
    gridLineStartPadding: 35,
    fontSize: 11,
    sectionFontSize: 11,
    numberSectionStyles: 4,
    axisFormat: "%Y-%m-%d",
    topAxis: !1,
    displayMode: "",
    weekday: "sunday"
  },
  journey: {
    useMaxWidth: !0,
    diagramMarginX: 50,
    diagramMarginY: 10,
    leftMargin: 150,
    width: 150,
    height: 50,
    boxMargin: 10,
    boxTextMargin: 5,
    noteMargin: 10,
    messageMargin: 35,
    messageAlign: "center",
    bottomMarginAdj: 1,
    rightAngles: !1,
    taskFontSize: 14,
    taskFontFamily: '"Open Sans", sans-serif',
    taskMargin: 50,
    activationWidth: 10,
    textPlacement: "fo",
    actorColours: [
      "#8FBC8F",
      "#7CFC00",
      "#00FFFF",
      "#20B2AA",
      "#B0E0E6",
      "#FFFFE0"
    ],
    sectionFills: [
      "#191970",
      "#8B008B",
      "#4B0082",
      "#2F4F4F",
      "#800000",
      "#8B4513",
      "#00008B"
    ],
    sectionColours: [
      "#fff"
    ]
  },
  class: {
    useMaxWidth: !0,
    titleTopMargin: 25,
    arrowMarkerAbsolute: !1,
    dividerMargin: 10,
    padding: 5,
    textHeight: 10,
    defaultRenderer: "dagre-wrapper",
    htmlLabels: !1
  },
  state: {
    useMaxWidth: !0,
    titleTopMargin: 25,
    dividerMargin: 10,
    sizeUnit: 5,
    padding: 8,
    textHeight: 10,
    titleShift: -15,
    noteMargin: 10,
    forkWidth: 70,
    forkHeight: 7,
    miniPadding: 2,
    fontSizeFactor: 5.02,
    fontSize: 24,
    labelHeight: 16,
    edgeLengthFactor: "20",
    compositTitleSize: 35,
    radius: 5,
    defaultRenderer: "dagre-wrapper"
  },
  er: {
    useMaxWidth: !0,
    titleTopMargin: 25,
    diagramPadding: 20,
    layoutDirection: "TB",
    minEntityWidth: 100,
    minEntityHeight: 75,
    entityPadding: 15,
    stroke: "gray",
    fill: "honeydew",
    fontSize: 12
  },
  pie: {
    useMaxWidth: !0,
    textPosition: 0.75
  },
  quadrantChart: {
    useMaxWidth: !0,
    chartWidth: 500,
    chartHeight: 500,
    titleFontSize: 20,
    titlePadding: 10,
    quadrantPadding: 5,
    xAxisLabelPadding: 5,
    yAxisLabelPadding: 5,
    xAxisLabelFontSize: 16,
    yAxisLabelFontSize: 16,
    quadrantLabelFontSize: 16,
    quadrantTextTopPadding: 5,
    pointTextPadding: 5,
    pointLabelFontSize: 12,
    pointRadius: 5,
    xAxisPosition: "top",
    yAxisPosition: "left",
    quadrantInternalBorderStrokeWidth: 1,
    quadrantExternalBorderStrokeWidth: 2
  },
  xyChart: {
    useMaxWidth: !0,
    width: 700,
    height: 500,
    titleFontSize: 20,
    titlePadding: 10,
    showTitle: !0,
    xAxis: {
      $ref: "#/$defs/XYChartAxisConfig",
      showLabel: !0,
      labelFontSize: 14,
      labelPadding: 5,
      showTitle: !0,
      titleFontSize: 16,
      titlePadding: 5,
      showTick: !0,
      tickLength: 5,
      tickWidth: 2,
      showAxisLine: !0,
      axisLineWidth: 2
    },
    yAxis: {
      $ref: "#/$defs/XYChartAxisConfig",
      showLabel: !0,
      labelFontSize: 14,
      labelPadding: 5,
      showTitle: !0,
      titleFontSize: 16,
      titlePadding: 5,
      showTick: !0,
      tickLength: 5,
      tickWidth: 2,
      showAxisLine: !0,
      axisLineWidth: 2
    },
    chartOrientation: "vertical",
    plotReservedSpacePercent: 50
  },
  requirement: {
    useMaxWidth: !0,
    rect_fill: "#f9f9f9",
    text_color: "#333",
    rect_border_size: "0.5px",
    rect_border_color: "#bbb",
    rect_min_width: 200,
    rect_min_height: 200,
    fontSize: 14,
    rect_padding: 10,
    line_height: 20
  },
  mindmap: {
    useMaxWidth: !0,
    padding: 10,
    maxNodeWidth: 200
  },
  timeline: {
    useMaxWidth: !0,
    diagramMarginX: 50,
    diagramMarginY: 10,
    leftMargin: 150,
    width: 150,
    height: 50,
    boxMargin: 10,
    boxTextMargin: 5,
    noteMargin: 10,
    messageMargin: 35,
    messageAlign: "center",
    bottomMarginAdj: 1,
    rightAngles: !1,
    taskFontSize: 14,
    taskFontFamily: '"Open Sans", sans-serif',
    taskMargin: 50,
    activationWidth: 10,
    textPlacement: "fo",
    actorColours: [
      "#8FBC8F",
      "#7CFC00",
      "#00FFFF",
      "#20B2AA",
      "#B0E0E6",
      "#FFFFE0"
    ],
    sectionFills: [
      "#191970",
      "#8B008B",
      "#4B0082",
      "#2F4F4F",
      "#800000",
      "#8B4513",
      "#00008B"
    ],
    sectionColours: [
      "#fff"
    ],
    disableMulticolor: !1
  },
  gitGraph: {
    useMaxWidth: !0,
    titleTopMargin: 25,
    diagramPadding: 8,
    nodeLabel: {
      width: 75,
      height: 100,
      x: -25,
      y: 0
    },
    mainBranchName: "main",
    mainBranchOrder: 0,
    showCommitLabel: !0,
    showBranches: !0,
    rotateCommitLabel: !0,
    parallelCommits: !1,
    arrowMarkerAbsolute: !1
  },
  c4: {
    useMaxWidth: !0,
    diagramMarginX: 50,
    diagramMarginY: 10,
    c4ShapeMargin: 50,
    c4ShapePadding: 20,
    width: 216,
    height: 60,
    boxMargin: 10,
    c4ShapeInRow: 4,
    nextLinePaddingX: 0,
    c4BoundaryInRow: 2,
    personFontSize: 14,
    personFontFamily: '"Open Sans", sans-serif',
    personFontWeight: "normal",
    external_personFontSize: 14,
    external_personFontFamily: '"Open Sans", sans-serif',
    external_personFontWeight: "normal",
    systemFontSize: 14,
    systemFontFamily: '"Open Sans", sans-serif',
    systemFontWeight: "normal",
    external_systemFontSize: 14,
    external_systemFontFamily: '"Open Sans", sans-serif',
    external_systemFontWeight: "normal",
    system_dbFontSize: 14,
    system_dbFontFamily: '"Open Sans", sans-serif',
    system_dbFontWeight: "normal",
    external_system_dbFontSize: 14,
    external_system_dbFontFamily: '"Open Sans", sans-serif',
    external_system_dbFontWeight: "normal",
    system_queueFontSize: 14,
    system_queueFontFamily: '"Open Sans", sans-serif',
    system_queueFontWeight: "normal",
    external_system_queueFontSize: 14,
    external_system_queueFontFamily: '"Open Sans", sans-serif',
    external_system_queueFontWeight: "normal",
    boundaryFontSize: 14,
    boundaryFontFamily: '"Open Sans", sans-serif',
    boundaryFontWeight: "normal",
    messageFontSize: 12,
    messageFontFamily: '"Open Sans", sans-serif',
    messageFontWeight: "normal",
    containerFontSize: 14,
    containerFontFamily: '"Open Sans", sans-serif',
    containerFontWeight: "normal",
    external_containerFontSize: 14,
    external_containerFontFamily: '"Open Sans", sans-serif',
    external_containerFontWeight: "normal",
    container_dbFontSize: 14,
    container_dbFontFamily: '"Open Sans", sans-serif',
    container_dbFontWeight: "normal",
    external_container_dbFontSize: 14,
    external_container_dbFontFamily: '"Open Sans", sans-serif',
    external_container_dbFontWeight: "normal",
    container_queueFontSize: 14,
    container_queueFontFamily: '"Open Sans", sans-serif',
    container_queueFontWeight: "normal",
    external_container_queueFontSize: 14,
    external_container_queueFontFamily: '"Open Sans", sans-serif',
    external_container_queueFontWeight: "normal",
    componentFontSize: 14,
    componentFontFamily: '"Open Sans", sans-serif',
    componentFontWeight: "normal",
    external_componentFontSize: 14,
    external_componentFontFamily: '"Open Sans", sans-serif',
    external_componentFontWeight: "normal",
    component_dbFontSize: 14,
    component_dbFontFamily: '"Open Sans", sans-serif',
    component_dbFontWeight: "normal",
    external_component_dbFontSize: 14,
    external_component_dbFontFamily: '"Open Sans", sans-serif',
    external_component_dbFontWeight: "normal",
    component_queueFontSize: 14,
    component_queueFontFamily: '"Open Sans", sans-serif',
    component_queueFontWeight: "normal",
    external_component_queueFontSize: 14,
    external_component_queueFontFamily: '"Open Sans", sans-serif',
    external_component_queueFontWeight: "normal",
    wrap: !0,
    wrapPadding: 10,
    person_bg_color: "#08427B",
    person_border_color: "#073B6F",
    external_person_bg_color: "#686868",
    external_person_border_color: "#8A8A8A",
    system_bg_color: "#1168BD",
    system_border_color: "#3C7FC0",
    system_db_bg_color: "#1168BD",
    system_db_border_color: "#3C7FC0",
    system_queue_bg_color: "#1168BD",
    system_queue_border_color: "#3C7FC0",
    external_system_bg_color: "#999999",
    external_system_border_color: "#8A8A8A",
    external_system_db_bg_color: "#999999",
    external_system_db_border_color: "#8A8A8A",
    external_system_queue_bg_color: "#999999",
    external_system_queue_border_color: "#8A8A8A",
    container_bg_color: "#438DD5",
    container_border_color: "#3C7FC0",
    container_db_bg_color: "#438DD5",
    container_db_border_color: "#3C7FC0",
    container_queue_bg_color: "#438DD5",
    container_queue_border_color: "#3C7FC0",
    external_container_bg_color: "#B3B3B3",
    external_container_border_color: "#A6A6A6",
    external_container_db_bg_color: "#B3B3B3",
    external_container_db_border_color: "#A6A6A6",
    external_container_queue_bg_color: "#B3B3B3",
    external_container_queue_border_color: "#A6A6A6",
    component_bg_color: "#85BBF0",
    component_border_color: "#78A8D8",
    component_db_bg_color: "#85BBF0",
    component_db_border_color: "#78A8D8",
    component_queue_bg_color: "#85BBF0",
    component_queue_border_color: "#78A8D8",
    external_component_bg_color: "#CCCCCC",
    external_component_border_color: "#BFBFBF",
    external_component_db_bg_color: "#CCCCCC",
    external_component_db_border_color: "#BFBFBF",
    external_component_queue_bg_color: "#CCCCCC",
    external_component_queue_border_color: "#BFBFBF"
  },
  sankey: {
    useMaxWidth: !0,
    width: 600,
    height: 400,
    linkColor: "gradient",
    nodeAlignment: "justify",
    showValues: !0,
    prefix: "",
    suffix: ""
  },
  block: {
    useMaxWidth: !0,
    padding: 8
  },
  theme: "default",
  maxTextSize: 5e4,
  maxEdges: 500,
  darkMode: !1,
  fontFamily: '"trebuchet ms", verdana, arial, sans-serif;',
  logLevel: 5,
  securityLevel: "strict",
  startOnLoad: !0,
  arrowMarkerAbsolute: !1,
  secure: [
    "secure",
    "securityLevel",
    "startOnLoad",
    "maxTextSize",
    "maxEdges"
  ],
  legacyMathML: !1,
  deterministicIds: !1,
  fontSize: 16
}, Ax = {
  ...ir,
  // Set, even though they're `undefined` so that `configKeys` finds these keys
  // TODO: Should we replace these with `null` so that they can go in the JSON Schema?
  deterministicIDSeed: void 0,
  themeCSS: void 0,
  // add non-JSON default config values
  themeVariables: yr.default.getThemeVariables(),
  sequence: {
    ...ir.sequence,
    messageFont: function() {
      return {
        fontFamily: this.messageFontFamily,
        fontSize: this.messageFontSize,
        fontWeight: this.messageFontWeight
      };
    },
    noteFont: function() {
      return {
        fontFamily: this.noteFontFamily,
        fontSize: this.noteFontSize,
        fontWeight: this.noteFontWeight
      };
    },
    actorFont: function() {
      return {
        fontFamily: this.actorFontFamily,
        fontSize: this.actorFontSize,
        fontWeight: this.actorFontWeight
      };
    }
  },
  gantt: {
    ...ir.gantt,
    tickInterval: void 0,
    useWidth: void 0
    // can probably be removed since `configKeys` already includes this
  },
  c4: {
    ...ir.c4,
    useWidth: void 0,
    personFont: function() {
      return {
        fontFamily: this.personFontFamily,
        fontSize: this.personFontSize,
        fontWeight: this.personFontWeight
      };
    },
    external_personFont: function() {
      return {
        fontFamily: this.external_personFontFamily,
        fontSize: this.external_personFontSize,
        fontWeight: this.external_personFontWeight
      };
    },
    systemFont: function() {
      return {
        fontFamily: this.systemFontFamily,
        fontSize: this.systemFontSize,
        fontWeight: this.systemFontWeight
      };
    },
    external_systemFont: function() {
      return {
        fontFamily: this.external_systemFontFamily,
        fontSize: this.external_systemFontSize,
        fontWeight: this.external_systemFontWeight
      };
    },
    system_dbFont: function() {
      return {
        fontFamily: this.system_dbFontFamily,
        fontSize: this.system_dbFontSize,
        fontWeight: this.system_dbFontWeight
      };
    },
    external_system_dbFont: function() {
      return {
        fontFamily: this.external_system_dbFontFamily,
        fontSize: this.external_system_dbFontSize,
        fontWeight: this.external_system_dbFontWeight
      };
    },
    system_queueFont: function() {
      return {
        fontFamily: this.system_queueFontFamily,
        fontSize: this.system_queueFontSize,
        fontWeight: this.system_queueFontWeight
      };
    },
    external_system_queueFont: function() {
      return {
        fontFamily: this.external_system_queueFontFamily,
        fontSize: this.external_system_queueFontSize,
        fontWeight: this.external_system_queueFontWeight
      };
    },
    containerFont: function() {
      return {
        fontFamily: this.containerFontFamily,
        fontSize: this.containerFontSize,
        fontWeight: this.containerFontWeight
      };
    },
    external_containerFont: function() {
      return {
        fontFamily: this.external_containerFontFamily,
        fontSize: this.external_containerFontSize,
        fontWeight: this.external_containerFontWeight
      };
    },
    container_dbFont: function() {
      return {
        fontFamily: this.container_dbFontFamily,
        fontSize: this.container_dbFontSize,
        fontWeight: this.container_dbFontWeight
      };
    },
    external_container_dbFont: function() {
      return {
        fontFamily: this.external_container_dbFontFamily,
        fontSize: this.external_container_dbFontSize,
        fontWeight: this.external_container_dbFontWeight
      };
    },
    container_queueFont: function() {
      return {
        fontFamily: this.container_queueFontFamily,
        fontSize: this.container_queueFontSize,
        fontWeight: this.container_queueFontWeight
      };
    },
    external_container_queueFont: function() {
      return {
        fontFamily: this.external_container_queueFontFamily,
        fontSize: this.external_container_queueFontSize,
        fontWeight: this.external_container_queueFontWeight
      };
    },
    componentFont: function() {
      return {
        fontFamily: this.componentFontFamily,
        fontSize: this.componentFontSize,
        fontWeight: this.componentFontWeight
      };
    },
    external_componentFont: function() {
      return {
        fontFamily: this.external_componentFontFamily,
        fontSize: this.external_componentFontSize,
        fontWeight: this.external_componentFontWeight
      };
    },
    component_dbFont: function() {
      return {
        fontFamily: this.component_dbFontFamily,
        fontSize: this.component_dbFontSize,
        fontWeight: this.component_dbFontWeight
      };
    },
    external_component_dbFont: function() {
      return {
        fontFamily: this.external_component_dbFontFamily,
        fontSize: this.external_component_dbFontSize,
        fontWeight: this.external_component_dbFontWeight
      };
    },
    component_queueFont: function() {
      return {
        fontFamily: this.component_queueFontFamily,
        fontSize: this.component_queueFontSize,
        fontWeight: this.component_queueFontWeight
      };
    },
    external_component_queueFont: function() {
      return {
        fontFamily: this.external_component_queueFontFamily,
        fontSize: this.external_component_queueFontSize,
        fontWeight: this.external_component_queueFontWeight
      };
    },
    boundaryFont: function() {
      return {
        fontFamily: this.boundaryFontFamily,
        fontSize: this.boundaryFontSize,
        fontWeight: this.boundaryFontWeight
      };
    },
    messageFont: function() {
      return {
        fontFamily: this.messageFontFamily,
        fontSize: this.messageFontSize,
        fontWeight: this.messageFontWeight
      };
    }
  },
  pie: {
    ...ir.pie,
    useWidth: 984
  },
  xyChart: {
    ...ir.xyChart,
    useWidth: void 0
  },
  requirement: {
    ...ir.requirement,
    useWidth: void 0
  },
  gitGraph: {
    ...ir.gitGraph,
    // TODO: This is a temporary override for `gitGraph`, since every other
    //       diagram does have `useMaxWidth`, but instead sets it to `true`.
    //       Should we set this to `true` instead?
    useMaxWidth: !1
  },
  sankey: {
    ...ir.sankey,
    // this is false, unlike every other diagram (other than gitGraph)
    // TODO: can we make this default to `true` instead?
    useMaxWidth: !1
  }
}, Lx = (t, e = "") => Object.keys(t).reduce((n, i) => Array.isArray(t[i]) ? n : typeof t[i] == "object" && t[i] !== null ? [...n, e + i, ...Lx(t[i], "")] : [...n, e + i], []), yA = new Set(Lx(Ax, "")), be = Ax, Jc = (t) => {
  if (z.debug("sanitizeDirective called with", t), !(typeof t != "object" || t == null)) {
    if (Array.isArray(t)) {
      t.forEach((e) => Jc(e));
      return;
    }
    for (const e of Object.keys(t)) {
      if (z.debug("Checking key", e), e.startsWith("__") || e.includes("proto") || e.includes("constr") || !yA.has(e) || t[e] == null) {
        z.debug("sanitize deleting key: ", e), delete t[e];
        continue;
      }
      if (typeof t[e] == "object") {
        z.debug("sanitizing object", e), Jc(t[e]);
        continue;
      }
      const n = ["themeCSS", "fontFamily", "altFontFamily"];
      for (const i of n)
        e.includes(i) && (z.debug("sanitizing css option", e), t[e] = mA(t[e]));
    }
    if (t.themeVariables)
      for (const e of Object.keys(t.themeVariables)) {
        const n = t.themeVariables[e];
        n?.match && !n.match(/^[\d "#%(),.;A-Za-z]+$/) && (t.themeVariables[e] = "");
      }
    z.debug("After sanitization", t);
  }
}, mA = (t) => {
  let e = 0, n = 0;
  for (const i of t) {
    if (e < n)
      return "{ /* ERROR: Unbalanced CSS */ }";
    i === "{" ? e++ : i === "}" && n++;
  }
  return e !== n ? "{ /* ERROR: Unbalanced CSS */ }" : t;
}, Ix = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s, Ao = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi, xA = /\s*%%.*\n/gm;
class Bx extends Error {
  constructor(e) {
    super(e), this.name = "UnknownDiagramError";
  }
}
const Sa = {}, rh = function(t, e) {
  t = t.replace(Ix, "").replace(Ao, "").replace(xA, `
`);
  for (const [n, { detector: i }] of Object.entries(Sa))
    if (i(t, e))
      return n;
  throw new Bx(
    `No diagram type detected matching given configuration for text: ${t}`
  );
}, Dx = (...t) => {
  for (const { id: e, detector: n, loader: i } of t)
    Nx(e, n, i);
}, Nx = (t, e, n) => {
  Sa[t] ? z.error(`Detector with key ${t} already exists`) : Sa[t] = { detector: e, loader: n }, z.debug(`Detector with key ${t} added${n ? " with loader" : ""}`);
}, bA = (t) => Sa[t].loader, Qd = (t, e, { depth: n = 2, clobber: i = !1 } = {}) => {
  const r = { depth: n, clobber: i };
  return Array.isArray(e) && !Array.isArray(t) ? (e.forEach((s) => Qd(t, s, r)), t) : Array.isArray(e) && Array.isArray(t) ? (e.forEach((s) => {
    t.includes(s) || t.push(s);
  }), t) : t === void 0 || n <= 0 ? t != null && typeof t == "object" && typeof e == "object" ? Object.assign(t, e) : e : (e !== void 0 && typeof t == "object" && typeof e == "object" && Object.keys(e).forEach((s) => {
    typeof e[s] == "object" && (t[s] === void 0 || typeof t[s] == "object") ? (t[s] === void 0 && (t[s] = Array.isArray(e[s]) ? [] : {}), t[s] = Qd(t[s], e[s], { depth: n - 1, clobber: i })) : (i || typeof t[s] != "object" && typeof e[s] != "object") && (t[s] = e[s]);
  }), t);
}, Je = Qd, Fx = "​", _A = {
  curveBasis: Tl,
  curveBasisClosed: kC,
  curveBasisOpen: TC,
  curveBumpX: bC,
  curveBumpY: _C,
  curveBundle: wC,
  curveCardinalClosed: EC,
  curveCardinalOpen: CC,
  curveCardinal: vC,
  curveCatmullRomClosed: AC,
  curveCatmullRomOpen: LC,
  curveCatmullRom: SC,
  curveLinear: bn,
  curveLinearClosed: IC,
  curveMonotoneX: BC,
  curveMonotoneY: DC,
  curveNatural: NC,
  curveStep: FC,
  curveStepAfter: RC,
  curveStepBefore: OC
}, kA = /\s*(?:(\w+)(?=:):|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi, TA = function(t, e) {
  const n = Ox(t, /(?:init\b)|(?:initialize\b)/);
  let i = {};
  if (Array.isArray(n)) {
    const a = n.map((o) => o.args);
    Jc(a), i = Je(i, [...a]);
  } else
    i = n.args;
  if (!i)
    return;
  let r = rh(t, e);
  const s = "config";
  return i[s] !== void 0 && (r === "flowchart-v2" && (r = "flowchart"), i[r] = i[s], delete i[s]), i;
}, Ox = function(t, e = null) {
  try {
    const n = new RegExp(
      `[%]{2}(?![{]${kA.source})(?=[}][%]{2}).*
`,
      "ig"
    );
    t = t.trim().replace(n, "").replace(/'/gm, '"'), z.debug(
      `Detecting diagram directive${e !== null ? " type:" + e : ""} based on the text:${t}`
    );
    let i;
    const r = [];
    for (; (i = Ao.exec(t)) !== null; )
      if (i.index === Ao.lastIndex && Ao.lastIndex++, i && !e || e && i[1] && i[1].match(e) || e && i[2] && i[2].match(e)) {
        const s = i[1] ? i[1] : i[2], a = i[3] ? i[3].trim() : i[4] ? JSON.parse(i[4].trim()) : null;
        r.push({ type: s, args: a });
      }
    return r.length === 0 ? { type: t, args: null } : r.length === 1 ? r[0] : r;
  } catch (n) {
    return z.error(
      `ERROR: ${n.message} - Unable to parse directive type: '${e}' based on the text: '${t}'`
    ), { type: void 0, args: null };
  }
}, wA = function(t) {
  return t.replace(Ao, "");
}, vA = function(t, e) {
  for (const [n, i] of e.entries())
    if (i.match(t))
      return n;
  return -1;
};
function oi(t, e) {
  if (!t)
    return e;
  const n = `curve${t.charAt(0).toUpperCase() + t.slice(1)}`;
  return _A[n] ?? e;
}
function EA(t, e) {
  const n = t.trim();
  if (n)
    return e.securityLevel !== "loose" ? As.sanitizeUrl(n) : n;
}
const CA = (t, ...e) => {
  const n = t.split("."), i = n.length - 1, r = n[i];
  let s = window;
  for (let a = 0; a < i; a++)
    if (s = s[n[a]], !s) {
      z.error(`Function name: ${t} not found in window`);
      return;
    }
  s[r](...e);
};
function Rx(t, e) {
  return !t || !e ? 0 : Math.sqrt(Math.pow(e.x - t.x, 2) + Math.pow(e.y - t.y, 2));
}
function SA(t) {
  let e, n = 0;
  t.forEach((r) => {
    n += Rx(r, e), e = r;
  });
  const i = n / 2;
  return Cf(t, i);
}
function AA(t) {
  return t.length === 1 ? t[0] : SA(t);
}
const xg = (t, e = 2) => {
  const n = Math.pow(10, e);
  return Math.round(t * n) / n;
}, Cf = (t, e) => {
  let n, i = e;
  for (const r of t) {
    if (n) {
      const s = Rx(r, n);
      if (s < i)
        i -= s;
      else {
        const a = i / s;
        if (a <= 0)
          return n;
        if (a >= 1)
          return { x: r.x, y: r.y };
        if (a > 0 && a < 1)
          return {
            x: xg((1 - a) * n.x + a * r.x, 5),
            y: xg((1 - a) * n.y + a * r.y, 5)
          };
      }
    }
    n = r;
  }
  throw new Error("Could not find a suitable point for the given distance");
}, LA = (t, e, n) => {
  z.info(`our points ${JSON.stringify(e)}`), e[0] !== n && (e = e.reverse());
  const r = Cf(e, 25), s = t ? 10 : 5, a = Math.atan2(e[0].y - r.y, e[0].x - r.x), o = { x: 0, y: 0 };
  return o.x = Math.sin(a) * s + (e[0].x + r.x) / 2, o.y = -Math.cos(a) * s + (e[0].y + r.y) / 2, o;
};
function IA(t, e, n) {
  const i = structuredClone(n);
  z.info("our points", i), e !== "start_left" && e !== "start_right" && i.reverse();
  const r = 25 + t, s = Cf(i, r), a = 10 + t * 0.5, o = Math.atan2(i[0].y - s.y, i[0].x - s.x), l = { x: 0, y: 0 };
  return e === "start_left" ? (l.x = Math.sin(o + Math.PI) * a + (i[0].x + s.x) / 2, l.y = -Math.cos(o + Math.PI) * a + (i[0].y + s.y) / 2) : e === "end_right" ? (l.x = Math.sin(o - Math.PI) * a + (i[0].x + s.x) / 2 - 5, l.y = -Math.cos(o - Math.PI) * a + (i[0].y + s.y) / 2 - 5) : e === "end_left" ? (l.x = Math.sin(o) * a + (i[0].x + s.x) / 2 - 5, l.y = -Math.cos(o) * a + (i[0].y + s.y) / 2 - 5) : (l.x = Math.sin(o) * a + (i[0].x + s.x) / 2, l.y = -Math.cos(o) * a + (i[0].y + s.y) / 2), l;
}
function $n(t) {
  let e = "", n = "";
  for (const i of t)
    i !== void 0 && (i.startsWith("color:") || i.startsWith("text-align:") ? n = n + i + ";" : e = e + i + ";");
  return { style: e, labelStyle: n };
}
let bg = 0;
const Mx = () => (bg++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + bg);
function BA(t) {
  let e = "";
  const n = "0123456789abcdef", i = n.length;
  for (let r = 0; r < t; r++)
    e += n.charAt(Math.floor(Math.random() * i));
  return e;
}
const Px = (t) => BA(t.length), DA = function() {
  return {
    x: 0,
    y: 0,
    fill: void 0,
    anchor: "start",
    style: "#666",
    width: 100,
    height: 100,
    textMargin: 0,
    rx: 0,
    ry: 0,
    valign: void 0,
    text: ""
  };
}, NA = function(t, e) {
  const n = e.text.replace(bt.lineBreakRegex, " "), [, i] = zs(e.fontSize), r = t.append("text");
  r.attr("x", e.x), r.attr("y", e.y), r.style("text-anchor", e.anchor), r.style("font-family", e.fontFamily), r.style("font-size", i), r.style("font-weight", e.fontWeight), r.attr("fill", e.fill), e.class !== void 0 && r.attr("class", e.class);
  const s = r.append("tspan");
  return s.attr("x", e.x + e.textMargin * 2), s.attr("fill", e.fill), s.text(n), r;
}, zx = Va(
  (t, e, n) => {
    if (!t || (n = Object.assign(
      { fontSize: 12, fontWeight: 400, fontFamily: "Arial", joinWith: "<br/>" },
      n
    ), bt.lineBreakRegex.test(t)))
      return t;
    const i = t.split(" "), r = [];
    let s = "";
    return i.forEach((a, o) => {
      const l = $i(`${a} `, n), u = $i(s, n);
      if (l > e) {
        const { hyphenatedStrings: d, remainingWord: p } = FA(a, e, "-", n);
        r.push(s, ...d), s = p;
      } else u + l >= e ? (r.push(s), s = a) : s = [s, a].filter(Boolean).join(" ");
      o + 1 === i.length && r.push(s);
    }), r.filter((a) => a !== "").join(n.joinWith);
  },
  (t, e, n) => `${t}${e}${n.fontSize}${n.fontWeight}${n.fontFamily}${n.joinWith}`
), FA = Va(
  (t, e, n = "-", i) => {
    i = Object.assign(
      { fontSize: 12, fontWeight: 400, fontFamily: "Arial", margin: 0 },
      i
    );
    const r = [...t], s = [];
    let a = "";
    return r.forEach((o, l) => {
      const u = `${a}${o}`;
      if ($i(u, i) >= e) {
        const f = l + 1, d = r.length === f, p = `${u}${n}`;
        s.push(d ? u : p), a = "";
      } else
        a = u;
    }), { hyphenatedStrings: s, remainingWord: a };
  },
  (t, e, n = "-", i) => `${t}${e}${n}${i.fontSize}${i.fontWeight}${i.fontFamily}`
);
function Zd(t, e) {
  return Sf(t, e).height;
}
function $i(t, e) {
  return Sf(t, e).width;
}
const Sf = Va(
  (t, e) => {
    const { fontSize: n = 12, fontFamily: i = "Arial", fontWeight: r = 400 } = e;
    if (!t)
      return { width: 0, height: 0 };
    const [, s] = zs(n), a = ["sans-serif", i], o = t.split(bt.lineBreakRegex), l = [], u = yt("body");
    if (!u.remove)
      return { width: 0, height: 0, lineHeight: 0 };
    const h = u.append("svg");
    for (const d of a) {
      let p = 0;
      const y = { width: 0, height: 0, lineHeight: 0 };
      for (const m of o) {
        const _ = DA();
        _.text = m || Fx;
        const T = NA(h, _).style("font-size", s).style("font-weight", r).style("font-family", d), v = (T._groups || T)[0][0].getBBox();
        if (v.width === 0 && v.height === 0)
          throw new Error("svg element not in render tree");
        y.width = Math.round(Math.max(y.width, v.width)), p = Math.round(v.height), y.height += p, y.lineHeight = Math.round(Math.max(y.lineHeight, p));
      }
      l.push(y);
    }
    h.remove();
    const f = isNaN(l[1].height) || isNaN(l[1].width) || isNaN(l[1].lineHeight) || l[0].height > l[1].height && l[0].width > l[1].width && l[0].lineHeight > l[1].lineHeight ? 0 : 1;
    return l[f];
  },
  (t, e) => `${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`
);
class OA {
  constructor(e = !1, n) {
    this.count = 0, this.count = n ? n.length : 0, this.next = e ? () => this.count++ : () => Date.now();
  }
}
let Xl;
const RA = function(t) {
  return Xl = Xl || document.createElement("div"), t = escape(t).replace(/%26/g, "&").replace(/%23/g, "#").replace(/%3B/g, ";"), Xl.innerHTML = t, unescape(Xl.textContent);
};
function Vx(t) {
  return "str" in t;
}
const MA = (t, e, n, i) => {
  var r;
  if (!i)
    return;
  const s = (r = t.node()) == null ? void 0 : r.getBBox();
  s && t.append("text").text(i).attr("x", s.x + s.width / 2).attr("y", -n).attr("class", e);
}, zs = (t) => {
  if (typeof t == "number")
    return [t, t + "px"];
  const e = parseInt(t ?? "", 10);
  return Number.isNaN(e) ? [void 0, void 0] : t === String(e) ? [e, t + "px"] : [e, t];
};
function El(t, e) {
  return Zc({}, t, e);
}
const Gt = {
  assignWithDepth: Je,
  wrapLabel: zx,
  calculateTextHeight: Zd,
  calculateTextWidth: $i,
  calculateTextDimensions: Sf,
  cleanAndMerge: El,
  detectInit: TA,
  detectDirective: Ox,
  isSubstringInArray: vA,
  interpolateToCurve: oi,
  calcLabelPosition: AA,
  calcCardinalityPosition: LA,
  calcTerminalLabelPosition: IA,
  formatUrl: EA,
  getStylesFromArray: $n,
  generateId: Mx,
  random: Px,
  runFunc: CA,
  entityDecode: RA,
  insertTitle: MA,
  parseFontSize: zs,
  InitIDGenerator: OA
}, PA = function(t) {
  let e = t;
  return e = e.replace(/style.*:\S*#.*;/g, function(n) {
    return n.substring(0, n.length - 1);
  }), e = e.replace(/classDef.*:\S*#.*;/g, function(n) {
    return n.substring(0, n.length - 1);
  }), e = e.replace(/#\w+;/g, function(n) {
    const i = n.substring(1, n.length - 1);
    return /^\+?\d+$/.test(i) ? "ﬂ°°" + i + "¶ß" : "ﬂ°" + i + "¶ß";
  }), e;
}, Ko = function(t) {
  return t.replace(/ﬂ°°/g, "&#").replace(/ﬂ°/g, "&").replace(/¶ß/g, ";");
}, _g = "10.9.3", Aa = Object.freeze(be);
let Bn = Je({}, Aa), qx, La = [], Lo = Je({}, Aa);
const sh = (t, e) => {
  let n = Je({}, t), i = {};
  for (const r of e)
    Wx(r), i = Je(i, r);
  if (n = Je(n, i), i.theme && i.theme in yr) {
    const r = Je({}, qx), s = Je(
      r.themeVariables || {},
      i.themeVariables
    );
    n.theme && n.theme in yr && (n.themeVariables = yr[n.theme].getThemeVariables(s));
  }
  return Lo = n, Ux(Lo), Lo;
}, zA = (t) => (Bn = Je({}, Aa), Bn = Je(Bn, t), t.theme && yr[t.theme] && (Bn.themeVariables = yr[t.theme].getThemeVariables(t.themeVariables)), sh(Bn, La), Bn), VA = (t) => {
  qx = Je({}, t);
}, qA = (t) => (Bn = Je(Bn, t), sh(Bn, La), Bn), $x = () => Je({}, Bn), Yx = (t) => (Ux(t), Je(Lo, t), Ee()), Ee = () => Je({}, Lo), Wx = (t) => {
  t && (["secure", ...Bn.secure ?? []].forEach((e) => {
    Object.hasOwn(t, e) && (z.debug(`Denied attempt to modify a secure key ${e}`, t[e]), delete t[e]);
  }), Object.keys(t).forEach((e) => {
    e.startsWith("__") && delete t[e];
  }), Object.keys(t).forEach((e) => {
    typeof t[e] == "string" && (t[e].includes("<") || t[e].includes(">") || t[e].includes("url(data:")) && delete t[e], typeof t[e] == "object" && Wx(t[e]);
  }));
}, $A = (t) => {
  Jc(t), t.fontFamily && (!t.themeVariables || !t.themeVariables.fontFamily) && (t.themeVariables = { fontFamily: t.fontFamily }), La.push(t), sh(Bn, La);
}, tu = (t = Bn) => {
  La = [], sh(t, La);
}, YA = {
  LAZY_LOAD_DEPRECATED: "The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead."
}, kg = {}, WA = (t) => {
  kg[t] || (z.warn(YA[t]), kg[t] = !0);
}, Ux = (t) => {
  t && (t.lazyLoadedDiagrams || t.loadExternalDiagramsAtStartup) && WA("LAZY_LOAD_DEPRECATED");
}, Hx = "c4", UA = (t) => /^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(t), HA = async () => {
  const { diagram: t } = await Promise.resolve().then(() => FN);
  return { id: Hx, diagram: t };
}, GA = {
  id: Hx,
  detector: UA,
  loader: HA
}, jA = GA, Gx = "flowchart", XA = (t, e) => {
  var n, i;
  return ((n = e?.flowchart) == null ? void 0 : n.defaultRenderer) === "dagre-wrapper" || ((i = e?.flowchart) == null ? void 0 : i.defaultRenderer) === "elk" ? !1 : /^\s*graph/.test(t);
}, KA = async () => {
  const { diagram: t } = await Promise.resolve().then(() => iY);
  return { id: Gx, diagram: t };
}, QA = {
  id: Gx,
  detector: XA,
  loader: KA
}, ZA = QA, jx = "flowchart-v2", JA = (t, e) => {
  var n, i, r;
  return ((n = e?.flowchart) == null ? void 0 : n.defaultRenderer) === "dagre-d3" || ((i = e?.flowchart) == null ? void 0 : i.defaultRenderer) === "elk" ? !1 : /^\s*graph/.test(t) && ((r = e?.flowchart) == null ? void 0 : r.defaultRenderer) === "dagre-wrapper" ? !0 : /^\s*flowchart/.test(t);
}, t9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => sY);
  return { id: jx, diagram: t };
}, e9 = {
  id: jx,
  detector: JA,
  loader: t9
}, n9 = e9, Xx = "er", i9 = (t) => /^\s*erDiagram/.test(t), r9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => qY);
  return { id: Xx, diagram: t };
}, s9 = {
  id: Xx,
  detector: i9,
  loader: r9
}, a9 = s9, Kx = "gitGraph", o9 = (t) => /^\s*gitGraph/.test(t), l9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => xW);
  return { id: Kx, diagram: t };
}, c9 = {
  id: Kx,
  detector: o9,
  loader: l9
}, u9 = c9, Qx = "gantt", h9 = (t) => /^\s*gantt/.test(t), d9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => _U);
  return { id: Qx, diagram: t };
}, f9 = {
  id: Qx,
  detector: h9,
  loader: d9
}, p9 = f9, Zx = "info", g9 = (t) => /^\s*info/.test(t), y9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => LU);
  return { id: Zx, diagram: t };
}, m9 = {
  id: Zx,
  detector: g9,
  loader: y9
}, Jx = "pie", x9 = (t) => /^\s*pie/.test(t), b9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => GU);
  return { id: Jx, diagram: t };
}, _9 = {
  id: Jx,
  detector: x9,
  loader: b9
}, tb = "quadrantChart", k9 = (t) => /^\s*quadrantChart/.test(t), T9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => pH);
  return { id: tb, diagram: t };
}, w9 = {
  id: tb,
  detector: k9,
  loader: T9
}, v9 = w9, eb = "xychart", E9 = (t) => /^\s*xychart-beta/.test(t), C9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => YH);
  return { id: eb, diagram: t };
}, S9 = {
  id: eb,
  detector: E9,
  loader: C9
}, A9 = S9, nb = "requirement", L9 = (t) => /^\s*requirement(Diagram)?/.test(t), I9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => kG);
  return { id: nb, diagram: t };
}, B9 = {
  id: nb,
  detector: L9,
  loader: I9
}, D9 = B9, ib = "sequence", N9 = (t) => /^\s*sequenceDiagram/.test(t), F9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => Sj);
  return { id: ib, diagram: t };
}, O9 = {
  id: ib,
  detector: N9,
  loader: F9
}, R9 = O9, rb = "class", M9 = (t, e) => {
  var n;
  return ((n = e?.class) == null ? void 0 : n.defaultRenderer) === "dagre-wrapper" ? !1 : /^\s*classDiagram/.test(t);
}, P9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => lX);
  return { id: rb, diagram: t };
}, z9 = {
  id: rb,
  detector: M9,
  loader: P9
}, V9 = z9, sb = "classDiagram", q9 = (t, e) => {
  var n;
  return /^\s*classDiagram/.test(t) && ((n = e?.class) == null ? void 0 : n.defaultRenderer) === "dagre-wrapper" ? !0 : /^\s*classDiagram-v2/.test(t);
}, $9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => yX);
  return { id: sb, diagram: t };
}, Y9 = {
  id: sb,
  detector: q9,
  loader: $9
}, W9 = Y9, ab = "state", U9 = (t, e) => {
  var n;
  return ((n = e?.state) == null ? void 0 : n.defaultRenderer) === "dagre-wrapper" ? !1 : /^\s*stateDiagram/.test(t);
}, H9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => aK);
  return { id: ab, diagram: t };
}, G9 = {
  id: ab,
  detector: U9,
  loader: H9
}, j9 = G9, ob = "stateDiagram", X9 = (t, e) => {
  var n;
  return !!(/^\s*stateDiagram-v2/.test(t) || /^\s*stateDiagram/.test(t) && ((n = e?.state) == null ? void 0 : n.defaultRenderer) === "dagre-wrapper");
}, K9 = async () => {
  const { diagram: t } = await Promise.resolve().then(() => DK);
  return { id: ob, diagram: t };
}, Q9 = {
  id: ob,
  detector: X9,
  loader: K9
}, Z9 = Q9, lb = "journey", J9 = (t) => /^\s*journey/.test(t), tL = async () => {
  const { diagram: t } = await Promise.resolve().then(() => eQ);
  return { id: lb, diagram: t };
}, eL = {
  id: lb,
  detector: J9,
  loader: tL
}, nL = eL, iL = function(t, e) {
  for (let n of e)
    t.attr(n[0], n[1]);
}, rL = function(t, e, n) {
  let i = /* @__PURE__ */ new Map();
  return n ? (i.set("width", "100%"), i.set("style", `max-width: ${e}px;`)) : (i.set("height", t), i.set("width", e)), i;
}, dn = function(t, e, n, i) {
  const r = rL(e, n, i);
  iL(t, r);
}, Wr = function(t, e, n, i) {
  const r = e.node().getBBox(), s = r.width, a = r.height;
  z.info(`SVG bounds: ${s}x${a}`, r);
  let o = 0, l = 0;
  z.info(`Graph bounds: ${o}x${l}`, t), o = s + n * 2, l = a + n * 2, z.info(`Calculated bounds: ${o}x${l}`), dn(e, l, o, i);
  const u = `${r.x - n} ${r.y - n} ${r.width + 2 * n} ${r.height + 2 * n}`;
  e.attr("viewBox", u);
}, yc = {}, sL = (t, e, n) => {
  let i = "";
  return t in yc && yc[t] ? i = yc[t](n) : z.warn(`No theme found for ${t}`), ` & {
    font-family: ${n.fontFamily};
    font-size: ${n.fontSize};
    fill: ${n.textColor}
  }

  /* Classes common for multiple diagrams */

  & .error-icon {
    fill: ${n.errorBkgColor};
  }
  & .error-text {
    fill: ${n.errorTextColor};
    stroke: ${n.errorTextColor};
  }

  & .edge-thickness-normal {
    stroke-width: 2px;
  }
  & .edge-thickness-thick {
    stroke-width: 3.5px
  }
  & .edge-pattern-solid {
    stroke-dasharray: 0;
  }

  & .edge-pattern-dashed{
    stroke-dasharray: 3;
  }
  .edge-pattern-dotted {
    stroke-dasharray: 2;
  }

  & .marker {
    fill: ${n.lineColor};
    stroke: ${n.lineColor};
  }
  & .marker.cross {
    stroke: ${n.lineColor};
  }

  & svg {
    font-family: ${n.fontFamily};
    font-size: ${n.fontSize};
  }

  ${i}

  ${e}
`;
}, aL = (t, e) => {
  e !== void 0 && (yc[t] = e);
}, oL = sL;
let Af = "", Lf = "", If = "";
const Bf = (t) => Ne(t, Ee()), fn = () => {
  Af = "", If = "", Lf = "";
}, pn = (t) => {
  Af = Bf(t).replace(/^\s+/g, "");
}, vn = () => Af, En = (t) => {
  If = Bf(t).replace(/\n\s+/g, `
`);
}, Cn = () => If, Yn = (t) => {
  Lf = Bf(t);
}, Sn = () => Lf, cb = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  clear: fn,
  getAccDescription: Cn,
  getAccTitle: vn,
  getDiagramTitle: Sn,
  setAccDescription: En,
  setAccTitle: pn,
  setDiagramTitle: Yn
}, Symbol.toStringTag, { value: "Module" })), lL = z, cL = vf, Q = Ee, uL = Yx, ub = Aa, hL = (t) => Ne(t, Q()), hb = Wr, dL = () => cb, eu = {}, nu = (t, e, n) => {
  var i;
  if (eu[t])
    throw new Error(`Diagram ${t} already registered.`);
  eu[t] = e, n && Nx(t, n), aL(t, e.styles), (i = e.injectUtils) == null || i.call(
    e,
    lL,
    cL,
    Q,
    hL,
    hb,
    dL(),
    () => {
    }
  );
}, Df = (t) => {
  if (t in eu)
    return eu[t];
  throw new fL(t);
};
class fL extends Error {
  constructor(e) {
    super(`Diagram ${e} not found.`);
  }
}
const Cl = (t) => {
  var e;
  const { securityLevel: n } = Q();
  let i = yt("body");
  if (n === "sandbox") {
    const a = ((e = yt(`#i${t}`).node()) == null ? void 0 : e.contentDocument) ?? document;
    i = yt(a.body);
  }
  return i.select(`#${t}`);
}, pL = (t, e, n) => {
  z.debug(`rendering svg for syntax error
`);
  const i = Cl(e), r = i.append("g");
  i.attr("viewBox", "0 0 2412 512"), dn(i, 100, 512, !0), r.append("path").attr("class", "error-icon").attr(
    "d",
    "m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"
  ), r.append("path").attr("class", "error-icon").attr(
    "d",
    "m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"
  ), r.append("path").attr("class", "error-icon").attr(
    "d",
    "m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"
  ), r.append("path").attr("class", "error-icon").attr(
    "d",
    "m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"
  ), r.append("path").attr("class", "error-icon").attr(
    "d",
    "m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"
  ), r.append("path").attr("class", "error-icon").attr(
    "d",
    "m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"
  ), r.append("text").attr("class", "error-text").attr("x", 1440).attr("y", 250).attr("font-size", "150px").style("text-anchor", "middle").text("Syntax error in text"), r.append("text").attr("class", "error-text").attr("x", 1250).attr("y", 400).attr("font-size", "100px").style("text-anchor", "middle").text(`mermaid version ${n}`);
}, db = { draw: pL }, gL = db, yL = {
  db: {},
  renderer: db,
  parser: {
    parser: { yy: {} },
    parse: () => {
    }
  }
}, mL = yL, fb = "flowchart-elk", xL = (t, e) => {
  var n;
  return (
    // If diagram explicitly states flowchart-elk
    !!(/^\s*flowchart-elk/.test(t) || // If a flowchart/graph diagram has their default renderer set to elk
    /^\s*flowchart|graph/.test(t) && ((n = e?.flowchart) == null ? void 0 : n.defaultRenderer) === "elk")
  );
}, bL = async () => {
  const { diagram: t } = await Promise.resolve().then(() => xQ);
  return { id: fb, diagram: t };
}, _L = {
  id: fb,
  detector: xL,
  loader: bL
}, kL = _L, pb = "timeline", TL = (t) => /^\s*timeline/.test(t), wL = async () => {
  const { diagram: t } = await Promise.resolve().then(() => qQ);
  return { id: pb, diagram: t };
}, vL = {
  id: pb,
  detector: TL,
  loader: wL
}, EL = vL, gb = "mindmap", CL = (t) => /^\s*mindmap/.test(t), SL = async () => {
  const { diagram: t } = await Promise.resolve().then(() => kZ);
  return { id: gb, diagram: t };
}, AL = {
  id: gb,
  detector: CL,
  loader: SL
}, LL = AL, yb = "sankey", IL = (t) => /^\s*sankey-beta/.test(t), BL = async () => {
  const { diagram: t } = await Promise.resolve().then(() => iJ);
  return { id: yb, diagram: t };
}, DL = {
  id: yb,
  detector: IL,
  loader: BL
}, NL = DL, mb = "block", FL = (t) => /^\s*block-beta/.test(t), OL = async () => {
  const { diagram: t } = await Promise.resolve().then(() => qJ);
  return { id: mb, diagram: t };
}, RL = {
  id: mb,
  detector: FL,
  loader: OL
}, ML = RL;
let Tg = !1;
const Nf = () => {
  Tg || (Tg = !0, nu("error", mL, (t) => t.toLowerCase().trim() === "error"), nu(
    "---",
    // --- diagram type may appear if YAML front-matter is not parsed correctly
    {
      db: {
        clear: () => {
        }
      },
      styles: {},
      // should never be used
      renderer: {
        draw: () => {
        }
      },
      parser: {
        parser: { yy: {} },
        parse: () => {
          throw new Error(
            "Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks"
          );
        }
      },
      init: () => null
      // no op
    },
    (t) => t.toLowerCase().trimStart().startsWith("---")
  ), Dx(
    jA,
    W9,
    V9,
    a9,
    p9,
    m9,
    _9,
    D9,
    R9,
    kL,
    n9,
    ZA,
    LL,
    EL,
    u9,
    Z9,
    j9,
    nL,
    v9,
    NL,
    A9,
    ML
  ));
};
class xb {
  constructor(e, n = {}) {
    this.text = e, this.metadata = n, this.type = "graph", this.text = PA(e), this.text += `
`;
    const i = Ee();
    try {
      this.type = rh(e, i);
    } catch (s) {
      this.type = "error", this.detectError = s;
    }
    const r = Df(this.type);
    z.debug("Type " + this.type), this.db = r.db, this.renderer = r.renderer, this.parser = r.parser, this.parser.parser.yy = this.db, this.init = r.init, this.parse();
  }
  parse() {
    var e, n, i, r, s;
    if (this.detectError)
      throw this.detectError;
    (n = (e = this.db).clear) == null || n.call(e);
    const a = Ee();
    (i = this.init) == null || i.call(this, a), this.metadata.title && ((s = (r = this.db).setDiagramTitle) == null || s.call(r, this.metadata.title)), this.parser.parse(this.text);
  }
  async render(e, n) {
    await this.renderer.draw(this.text, e, n, this);
  }
  getParser() {
    return this.parser;
  }
  getType() {
    return this.type;
  }
}
const PL = async (t, e = {}) => {
  const n = rh(t, Ee());
  try {
    Df(n);
  } catch {
    const r = bA(n);
    if (!r)
      throw new Bx(`Diagram ${n} not found.`);
    const { id: s, diagram: a } = await r();
    nu(s, a);
  }
  return new xb(t, e);
};
let wg = [];
const zL = () => {
  wg.forEach((t) => {
    t();
  }), wg = [];
}, VL = "graphics-document document";
function qL(t, e) {
  t.attr("role", VL), e !== "" && t.attr("aria-roledescription", e);
}
function $L(t, e, n, i) {
  if (t.insert !== void 0) {
    if (n) {
      const r = `chart-desc-${i}`;
      t.attr("aria-describedby", r), t.insert("desc", ":first-child").attr("id", r).text(n);
    }
    if (e) {
      const r = `chart-title-${i}`;
      t.attr("aria-labelledby", r), t.insert("title", ":first-child").attr("id", r).text(e);
    }
  }
}
const YL = (t) => t.replace(/^\s*%%(?!{)[^\n]+\n?/gm, "").trimStart();
/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */
function bb(t) {
  return typeof t > "u" || t === null;
}
function WL(t) {
  return typeof t == "object" && t !== null;
}
function UL(t) {
  return Array.isArray(t) ? t : bb(t) ? [] : [t];
}
function HL(t, e) {
  var n, i, r, s;
  if (e)
    for (s = Object.keys(e), n = 0, i = s.length; n < i; n += 1)
      r = s[n], t[r] = e[r];
  return t;
}
function GL(t, e) {
  var n = "", i;
  for (i = 0; i < e; i += 1)
    n += t;
  return n;
}
function jL(t) {
  return t === 0 && Number.NEGATIVE_INFINITY === 1 / t;
}
var XL = bb, KL = WL, QL = UL, ZL = GL, JL = jL, tI = HL, mn = {
  isNothing: XL,
  isObject: KL,
  toArray: QL,
  repeat: ZL,
  isNegativeZero: JL,
  extend: tI
};
function _b(t, e) {
  var n = "", i = t.reason || "(unknown reason)";
  return t.mark ? (t.mark.name && (n += 'in "' + t.mark.name + '" '), n += "(" + (t.mark.line + 1) + ":" + (t.mark.column + 1) + ")", !e && t.mark.snippet && (n += `

` + t.mark.snippet), i + " " + n) : i;
}
function Qo(t, e) {
  Error.call(this), this.name = "YAMLException", this.reason = t, this.mark = e, this.message = _b(this, !1), Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : this.stack = new Error().stack || "";
}
Qo.prototype = Object.create(Error.prototype);
Qo.prototype.constructor = Qo;
Qo.prototype.toString = function(e) {
  return this.name + ": " + _b(this, e);
};
var sr = Qo;
function ed(t, e, n, i, r) {
  var s = "", a = "", o = Math.floor(r / 2) - 1;
  return i - e > o && (s = " ... ", e = i - o + s.length), n - i > o && (a = " ...", n = i + o - a.length), {
    str: s + t.slice(e, n).replace(/\t/g, "→") + a,
    pos: i - e + s.length
    // relative position
  };
}
function nd(t, e) {
  return mn.repeat(" ", e - t.length) + t;
}
function eI(t, e) {
  if (e = Object.create(e || null), !t.buffer)
    return null;
  e.maxLength || (e.maxLength = 79), typeof e.indent != "number" && (e.indent = 1), typeof e.linesBefore != "number" && (e.linesBefore = 3), typeof e.linesAfter != "number" && (e.linesAfter = 2);
  for (var n = /\r?\n|\r|\0/g, i = [0], r = [], s, a = -1; s = n.exec(t.buffer); )
    r.push(s.index), i.push(s.index + s[0].length), t.position <= s.index && a < 0 && (a = i.length - 2);
  a < 0 && (a = i.length - 1);
  var o = "", l, u, h = Math.min(t.line + e.linesAfter, r.length).toString().length, f = e.maxLength - (e.indent + h + 3);
  for (l = 1; l <= e.linesBefore && !(a - l < 0); l++)
    u = ed(
      t.buffer,
      i[a - l],
      r[a - l],
      t.position - (i[a] - i[a - l]),
      f
    ), o = mn.repeat(" ", e.indent) + nd((t.line - l + 1).toString(), h) + " | " + u.str + `
` + o;
  for (u = ed(t.buffer, i[a], r[a], t.position, f), o += mn.repeat(" ", e.indent) + nd((t.line + 1).toString(), h) + " | " + u.str + `
`, o += mn.repeat("-", e.indent + h + 3 + u.pos) + `^
`, l = 1; l <= e.linesAfter && !(a + l >= r.length); l++)
    u = ed(
      t.buffer,
      i[a + l],
      r[a + l],
      t.position - (i[a] - i[a + l]),
      f
    ), o += mn.repeat(" ", e.indent) + nd((t.line + l + 1).toString(), h) + " | " + u.str + `
`;
  return o.replace(/\n$/, "");
}
var nI = eI, iI = [
  "kind",
  "multi",
  "resolve",
  "construct",
  "instanceOf",
  "predicate",
  "represent",
  "representName",
  "defaultStyle",
  "styleAliases"
], rI = [
  "scalar",
  "sequence",
  "mapping"
];
function sI(t) {
  var e = {};
  return t !== null && Object.keys(t).forEach(function(n) {
    t[n].forEach(function(i) {
      e[String(i)] = n;
    });
  }), e;
}
function aI(t, e) {
  if (e = e || {}, Object.keys(e).forEach(function(n) {
    if (iI.indexOf(n) === -1)
      throw new sr('Unknown option "' + n + '" is met in definition of "' + t + '" YAML type.');
  }), this.options = e, this.tag = t, this.kind = e.kind || null, this.resolve = e.resolve || function() {
    return !0;
  }, this.construct = e.construct || function(n) {
    return n;
  }, this.instanceOf = e.instanceOf || null, this.predicate = e.predicate || null, this.represent = e.represent || null, this.representName = e.representName || null, this.defaultStyle = e.defaultStyle || null, this.multi = e.multi || !1, this.styleAliases = sI(e.styleAliases || null), rI.indexOf(this.kind) === -1)
    throw new sr('Unknown kind "' + this.kind + '" is specified for "' + t + '" YAML type.');
}
var hn = aI;
function vg(t, e) {
  var n = [];
  return t[e].forEach(function(i) {
    var r = n.length;
    n.forEach(function(s, a) {
      s.tag === i.tag && s.kind === i.kind && s.multi === i.multi && (r = a);
    }), n[r] = i;
  }), n;
}
function oI() {
  var t = {
    scalar: {},
    sequence: {},
    mapping: {},
    fallback: {},
    multi: {
      scalar: [],
      sequence: [],
      mapping: [],
      fallback: []
    }
  }, e, n;
  function i(r) {
    r.multi ? (t.multi[r.kind].push(r), t.multi.fallback.push(r)) : t[r.kind][r.tag] = t.fallback[r.tag] = r;
  }
  for (e = 0, n = arguments.length; e < n; e += 1)
    arguments[e].forEach(i);
  return t;
}
function Jd(t) {
  return this.extend(t);
}
Jd.prototype.extend = function(e) {
  var n = [], i = [];
  if (e instanceof hn)
    i.push(e);
  else if (Array.isArray(e))
    i = i.concat(e);
  else if (e && (Array.isArray(e.implicit) || Array.isArray(e.explicit)))
    e.implicit && (n = n.concat(e.implicit)), e.explicit && (i = i.concat(e.explicit));
  else
    throw new sr("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
  n.forEach(function(s) {
    if (!(s instanceof hn))
      throw new sr("Specified list of YAML types (or a single Type object) contains a non-Type object.");
    if (s.loadKind && s.loadKind !== "scalar")
      throw new sr("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
    if (s.multi)
      throw new sr("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
  }), i.forEach(function(s) {
    if (!(s instanceof hn))
      throw new sr("Specified list of YAML types (or a single Type object) contains a non-Type object.");
  });
  var r = Object.create(Jd.prototype);
  return r.implicit = (this.implicit || []).concat(n), r.explicit = (this.explicit || []).concat(i), r.compiledImplicit = vg(r, "implicit"), r.compiledExplicit = vg(r, "explicit"), r.compiledTypeMap = oI(r.compiledImplicit, r.compiledExplicit), r;
};
var lI = Jd, cI = new hn("tag:yaml.org,2002:str", {
  kind: "scalar",
  construct: function(t) {
    return t !== null ? t : "";
  }
}), uI = new hn("tag:yaml.org,2002:seq", {
  kind: "sequence",
  construct: function(t) {
    return t !== null ? t : [];
  }
}), hI = new hn("tag:yaml.org,2002:map", {
  kind: "mapping",
  construct: function(t) {
    return t !== null ? t : {};
  }
}), dI = new lI({
  explicit: [
    cI,
    uI,
    hI
  ]
});
function fI(t) {
  if (t === null)
    return !0;
  var e = t.length;
  return e === 1 && t === "~" || e === 4 && (t === "null" || t === "Null" || t === "NULL");
}
function pI() {
  return null;
}
function gI(t) {
  return t === null;
}
var yI = new hn("tag:yaml.org,2002:null", {
  kind: "scalar",
  resolve: fI,
  construct: pI,
  predicate: gI,
  represent: {
    canonical: function() {
      return "~";
    },
    lowercase: function() {
      return "null";
    },
    uppercase: function() {
      return "NULL";
    },
    camelcase: function() {
      return "Null";
    },
    empty: function() {
      return "";
    }
  },
  defaultStyle: "lowercase"
});
function mI(t) {
  if (t === null)
    return !1;
  var e = t.length;
  return e === 4 && (t === "true" || t === "True" || t === "TRUE") || e === 5 && (t === "false" || t === "False" || t === "FALSE");
}
function xI(t) {
  return t === "true" || t === "True" || t === "TRUE";
}
function bI(t) {
  return Object.prototype.toString.call(t) === "[object Boolean]";
}
var _I = new hn("tag:yaml.org,2002:bool", {
  kind: "scalar",
  resolve: mI,
  construct: xI,
  predicate: bI,
  represent: {
    lowercase: function(t) {
      return t ? "true" : "false";
    },
    uppercase: function(t) {
      return t ? "TRUE" : "FALSE";
    },
    camelcase: function(t) {
      return t ? "True" : "False";
    }
  },
  defaultStyle: "lowercase"
});
function kI(t) {
  return 48 <= t && t <= 57 || 65 <= t && t <= 70 || 97 <= t && t <= 102;
}
function TI(t) {
  return 48 <= t && t <= 55;
}
function wI(t) {
  return 48 <= t && t <= 57;
}
function vI(t) {
  if (t === null)
    return !1;
  var e = t.length, n = 0, i = !1, r;
  if (!e)
    return !1;
  if (r = t[n], (r === "-" || r === "+") && (r = t[++n]), r === "0") {
    if (n + 1 === e)
      return !0;
    if (r = t[++n], r === "b") {
      for (n++; n < e; n++)
        if (r = t[n], r !== "_") {
          if (r !== "0" && r !== "1")
            return !1;
          i = !0;
        }
      return i && r !== "_";
    }
    if (r === "x") {
      for (n++; n < e; n++)
        if (r = t[n], r !== "_") {
          if (!kI(t.charCodeAt(n)))
            return !1;
          i = !0;
        }
      return i && r !== "_";
    }
    if (r === "o") {
      for (n++; n < e; n++)
        if (r = t[n], r !== "_") {
          if (!TI(t.charCodeAt(n)))
            return !1;
          i = !0;
        }
      return i && r !== "_";
    }
  }
  if (r === "_")
    return !1;
  for (; n < e; n++)
    if (r = t[n], r !== "_") {
      if (!wI(t.charCodeAt(n)))
        return !1;
      i = !0;
    }
  return !(!i || r === "_");
}
function EI(t) {
  var e = t, n = 1, i;
  if (e.indexOf("_") !== -1 && (e = e.replace(/_/g, "")), i = e[0], (i === "-" || i === "+") && (i === "-" && (n = -1), e = e.slice(1), i = e[0]), e === "0")
    return 0;
  if (i === "0") {
    if (e[1] === "b")
      return n * parseInt(e.slice(2), 2);
    if (e[1] === "x")
      return n * parseInt(e.slice(2), 16);
    if (e[1] === "o")
      return n * parseInt(e.slice(2), 8);
  }
  return n * parseInt(e, 10);
}
function CI(t) {
  return Object.prototype.toString.call(t) === "[object Number]" && t % 1 === 0 && !mn.isNegativeZero(t);
}
var SI = new hn("tag:yaml.org,2002:int", {
  kind: "scalar",
  resolve: vI,
  construct: EI,
  predicate: CI,
  represent: {
    binary: function(t) {
      return t >= 0 ? "0b" + t.toString(2) : "-0b" + t.toString(2).slice(1);
    },
    octal: function(t) {
      return t >= 0 ? "0o" + t.toString(8) : "-0o" + t.toString(8).slice(1);
    },
    decimal: function(t) {
      return t.toString(10);
    },
    /* eslint-disable max-len */
    hexadecimal: function(t) {
      return t >= 0 ? "0x" + t.toString(16).toUpperCase() : "-0x" + t.toString(16).toUpperCase().slice(1);
    }
  },
  defaultStyle: "decimal",
  styleAliases: {
    binary: [2, "bin"],
    octal: [8, "oct"],
    decimal: [10, "dec"],
    hexadecimal: [16, "hex"]
  }
}), AI = new RegExp(
  // 2.5e4, 2.5 and integers
  "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
);
function LI(t) {
  return !(t === null || !AI.test(t) || // Quick hack to not allow integers end with `_`
  // Probably should update regexp & check speed
  t[t.length - 1] === "_");
}
function II(t) {
  var e, n;
  return e = t.replace(/_/g, "").toLowerCase(), n = e[0] === "-" ? -1 : 1, "+-".indexOf(e[0]) >= 0 && (e = e.slice(1)), e === ".inf" ? n === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY : e === ".nan" ? NaN : n * parseFloat(e, 10);
}
var BI = /^[-+]?[0-9]+e/;
function DI(t, e) {
  var n;
  if (isNaN(t))
    switch (e) {
      case "lowercase":
        return ".nan";
      case "uppercase":
        return ".NAN";
      case "camelcase":
        return ".NaN";
    }
  else if (Number.POSITIVE_INFINITY === t)
    switch (e) {
      case "lowercase":
        return ".inf";
      case "uppercase":
        return ".INF";
      case "camelcase":
        return ".Inf";
    }
  else if (Number.NEGATIVE_INFINITY === t)
    switch (e) {
      case "lowercase":
        return "-.inf";
      case "uppercase":
        return "-.INF";
      case "camelcase":
        return "-.Inf";
    }
  else if (mn.isNegativeZero(t))
    return "-0.0";
  return n = t.toString(10), BI.test(n) ? n.replace("e", ".e") : n;
}
function NI(t) {
  return Object.prototype.toString.call(t) === "[object Number]" && (t % 1 !== 0 || mn.isNegativeZero(t));
}
var FI = new hn("tag:yaml.org,2002:float", {
  kind: "scalar",
  resolve: LI,
  construct: II,
  predicate: NI,
  represent: DI,
  defaultStyle: "lowercase"
}), kb = dI.extend({
  implicit: [
    yI,
    _I,
    SI,
    FI
  ]
}), OI = kb, Tb = new RegExp(
  "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
), wb = new RegExp(
  "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
);
function RI(t) {
  return t === null ? !1 : Tb.exec(t) !== null || wb.exec(t) !== null;
}
function MI(t) {
  var e, n, i, r, s, a, o, l = 0, u = null, h, f, d;
  if (e = Tb.exec(t), e === null && (e = wb.exec(t)), e === null)
    throw new Error("Date resolve error");
  if (n = +e[1], i = +e[2] - 1, r = +e[3], !e[4])
    return new Date(Date.UTC(n, i, r));
  if (s = +e[4], a = +e[5], o = +e[6], e[7]) {
    for (l = e[7].slice(0, 3); l.length < 3; )
      l += "0";
    l = +l;
  }
  return e[9] && (h = +e[10], f = +(e[11] || 0), u = (h * 60 + f) * 6e4, e[9] === "-" && (u = -u)), d = new Date(Date.UTC(n, i, r, s, a, o, l)), u && d.setTime(d.getTime() - u), d;
}
function PI(t) {
  return t.toISOString();
}
var zI = new hn("tag:yaml.org,2002:timestamp", {
  kind: "scalar",
  resolve: RI,
  construct: MI,
  instanceOf: Date,
  represent: PI
});
function VI(t) {
  return t === "<<" || t === null;
}
var qI = new hn("tag:yaml.org,2002:merge", {
  kind: "scalar",
  resolve: VI
}), Ff = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
\r`;
function $I(t) {
  if (t === null)
    return !1;
  var e, n, i = 0, r = t.length, s = Ff;
  for (n = 0; n < r; n++)
    if (e = s.indexOf(t.charAt(n)), !(e > 64)) {
      if (e < 0)
        return !1;
      i += 6;
    }
  return i % 8 === 0;
}
function YI(t) {
  var e, n, i = t.replace(/[\r\n=]/g, ""), r = i.length, s = Ff, a = 0, o = [];
  for (e = 0; e < r; e++)
    e % 4 === 0 && e && (o.push(a >> 16 & 255), o.push(a >> 8 & 255), o.push(a & 255)), a = a << 6 | s.indexOf(i.charAt(e));
  return n = r % 4 * 6, n === 0 ? (o.push(a >> 16 & 255), o.push(a >> 8 & 255), o.push(a & 255)) : n === 18 ? (o.push(a >> 10 & 255), o.push(a >> 2 & 255)) : n === 12 && o.push(a >> 4 & 255), new Uint8Array(o);
}
function WI(t) {
  var e = "", n = 0, i, r, s = t.length, a = Ff;
  for (i = 0; i < s; i++)
    i % 3 === 0 && i && (e += a[n >> 18 & 63], e += a[n >> 12 & 63], e += a[n >> 6 & 63], e += a[n & 63]), n = (n << 8) + t[i];
  return r = s % 3, r === 0 ? (e += a[n >> 18 & 63], e += a[n >> 12 & 63], e += a[n >> 6 & 63], e += a[n & 63]) : r === 2 ? (e += a[n >> 10 & 63], e += a[n >> 4 & 63], e += a[n << 2 & 63], e += a[64]) : r === 1 && (e += a[n >> 2 & 63], e += a[n << 4 & 63], e += a[64], e += a[64]), e;
}
function UI(t) {
  return Object.prototype.toString.call(t) === "[object Uint8Array]";
}
var HI = new hn("tag:yaml.org,2002:binary", {
  kind: "scalar",
  resolve: $I,
  construct: YI,
  predicate: UI,
  represent: WI
}), GI = Object.prototype.hasOwnProperty, jI = Object.prototype.toString;
function XI(t) {
  if (t === null)
    return !0;
  var e = [], n, i, r, s, a, o = t;
  for (n = 0, i = o.length; n < i; n += 1) {
    if (r = o[n], a = !1, jI.call(r) !== "[object Object]")
      return !1;
    for (s in r)
      if (GI.call(r, s))
        if (!a)
          a = !0;
        else
          return !1;
    if (!a)
      return !1;
    if (e.indexOf(s) === -1)
      e.push(s);
    else
      return !1;
  }
  return !0;
}
function KI(t) {
  return t !== null ? t : [];
}
var QI = new hn("tag:yaml.org,2002:omap", {
  kind: "sequence",
  resolve: XI,
  construct: KI
}), ZI = Object.prototype.toString;
function JI(t) {
  if (t === null)
    return !0;
  var e, n, i, r, s, a = t;
  for (s = new Array(a.length), e = 0, n = a.length; e < n; e += 1) {
    if (i = a[e], ZI.call(i) !== "[object Object]" || (r = Object.keys(i), r.length !== 1))
      return !1;
    s[e] = [r[0], i[r[0]]];
  }
  return !0;
}
function tB(t) {
  if (t === null)
    return [];
  var e, n, i, r, s, a = t;
  for (s = new Array(a.length), e = 0, n = a.length; e < n; e += 1)
    i = a[e], r = Object.keys(i), s[e] = [r[0], i[r[0]]];
  return s;
}
var eB = new hn("tag:yaml.org,2002:pairs", {
  kind: "sequence",
  resolve: JI,
  construct: tB
}), nB = Object.prototype.hasOwnProperty;
function iB(t) {
  if (t === null)
    return !0;
  var e, n = t;
  for (e in n)
    if (nB.call(n, e) && n[e] !== null)
      return !1;
  return !0;
}
function rB(t) {
  return t !== null ? t : {};
}
var sB = new hn("tag:yaml.org,2002:set", {
  kind: "mapping",
  resolve: iB,
  construct: rB
}), aB = OI.extend({
  implicit: [
    zI,
    qI
  ],
  explicit: [
    HI,
    QI,
    eB,
    sB
  ]
}), qr = Object.prototype.hasOwnProperty, iu = 1, vb = 2, Eb = 3, ru = 4, id = 1, oB = 2, Eg = 3, lB = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/, cB = /[\x85\u2028\u2029]/, uB = /[,\[\]\{\}]/, Cb = /^(?:!|!!|![a-z\-]+!)$/i, Sb = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
function Cg(t) {
  return Object.prototype.toString.call(t);
}
function Yi(t) {
  return t === 10 || t === 13;
}
function us(t) {
  return t === 9 || t === 32;
}
function On(t) {
  return t === 9 || t === 32 || t === 10 || t === 13;
}
function Zs(t) {
  return t === 44 || t === 91 || t === 93 || t === 123 || t === 125;
}
function hB(t) {
  var e;
  return 48 <= t && t <= 57 ? t - 48 : (e = t | 32, 97 <= e && e <= 102 ? e - 97 + 10 : -1);
}
function dB(t) {
  return t === 120 ? 2 : t === 117 ? 4 : t === 85 ? 8 : 0;
}
function fB(t) {
  return 48 <= t && t <= 57 ? t - 48 : -1;
}
function Sg(t) {
  return t === 48 ? "\0" : t === 97 ? "\x07" : t === 98 ? "\b" : t === 116 || t === 9 ? "	" : t === 110 ? `
` : t === 118 ? "\v" : t === 102 ? "\f" : t === 114 ? "\r" : t === 101 ? "\x1B" : t === 32 ? " " : t === 34 ? '"' : t === 47 ? "/" : t === 92 ? "\\" : t === 78 ? "" : t === 95 ? " " : t === 76 ? "\u2028" : t === 80 ? "\u2029" : "";
}
function pB(t) {
  return t <= 65535 ? String.fromCharCode(t) : String.fromCharCode(
    (t - 65536 >> 10) + 55296,
    (t - 65536 & 1023) + 56320
  );
}
var Ab = new Array(256), Lb = new Array(256);
for (var Us = 0; Us < 256; Us++)
  Ab[Us] = Sg(Us) ? 1 : 0, Lb[Us] = Sg(Us);
function gB(t, e) {
  this.input = t, this.filename = e.filename || null, this.schema = e.schema || aB, this.onWarning = e.onWarning || null, this.legacy = e.legacy || !1, this.json = e.json || !1, this.listener = e.listener || null, this.implicitTypes = this.schema.compiledImplicit, this.typeMap = this.schema.compiledTypeMap, this.length = t.length, this.position = 0, this.line = 0, this.lineStart = 0, this.lineIndent = 0, this.firstTabInLine = -1, this.documents = [];
}
function Ib(t, e) {
  var n = {
    name: t.filename,
    buffer: t.input.slice(0, -1),
    // omit trailing \0
    position: t.position,
    line: t.line,
    column: t.position - t.lineStart
  };
  return n.snippet = nI(n), new sr(e, n);
}
function Ft(t, e) {
  throw Ib(t, e);
}
function su(t, e) {
  t.onWarning && t.onWarning.call(null, Ib(t, e));
}
var Ag = {
  YAML: function(e, n, i) {
    var r, s, a;
    e.version !== null && Ft(e, "duplication of %YAML directive"), i.length !== 1 && Ft(e, "YAML directive accepts exactly one argument"), r = /^([0-9]+)\.([0-9]+)$/.exec(i[0]), r === null && Ft(e, "ill-formed argument of the YAML directive"), s = parseInt(r[1], 10), a = parseInt(r[2], 10), s !== 1 && Ft(e, "unacceptable YAML version of the document"), e.version = i[0], e.checkLineBreaks = a < 2, a !== 1 && a !== 2 && su(e, "unsupported YAML version of the document");
  },
  TAG: function(e, n, i) {
    var r, s;
    i.length !== 2 && Ft(e, "TAG directive accepts exactly two arguments"), r = i[0], s = i[1], Cb.test(r) || Ft(e, "ill-formed tag handle (first argument) of the TAG directive"), qr.call(e.tagMap, r) && Ft(e, 'there is a previously declared suffix for "' + r + '" tag handle'), Sb.test(s) || Ft(e, "ill-formed tag prefix (second argument) of the TAG directive");
    try {
      s = decodeURIComponent(s);
    } catch {
      Ft(e, "tag prefix is malformed: " + s);
    }
    e.tagMap[r] = s;
  }
};
function Mr(t, e, n, i) {
  var r, s, a, o;
  if (e < n) {
    if (o = t.input.slice(e, n), i)
      for (r = 0, s = o.length; r < s; r += 1)
        a = o.charCodeAt(r), a === 9 || 32 <= a && a <= 1114111 || Ft(t, "expected valid JSON character");
    else lB.test(o) && Ft(t, "the stream contains non-printable characters");
    t.result += o;
  }
}
function Lg(t, e, n, i) {
  var r, s, a, o;
  for (mn.isObject(n) || Ft(t, "cannot merge mappings; the provided source object is unacceptable"), r = Object.keys(n), a = 0, o = r.length; a < o; a += 1)
    s = r[a], qr.call(e, s) || (e[s] = n[s], i[s] = !0);
}
function Js(t, e, n, i, r, s, a, o, l) {
  var u, h;
  if (Array.isArray(r))
    for (r = Array.prototype.slice.call(r), u = 0, h = r.length; u < h; u += 1)
      Array.isArray(r[u]) && Ft(t, "nested arrays are not supported inside keys"), typeof r == "object" && Cg(r[u]) === "[object Object]" && (r[u] = "[object Object]");
  if (typeof r == "object" && Cg(r) === "[object Object]" && (r = "[object Object]"), r = String(r), e === null && (e = {}), i === "tag:yaml.org,2002:merge")
    if (Array.isArray(s))
      for (u = 0, h = s.length; u < h; u += 1)
        Lg(t, e, s[u], n);
    else
      Lg(t, e, s, n);
  else
    !t.json && !qr.call(n, r) && qr.call(e, r) && (t.line = a || t.line, t.lineStart = o || t.lineStart, t.position = l || t.position, Ft(t, "duplicated mapping key")), r === "__proto__" ? Object.defineProperty(e, r, {
      configurable: !0,
      enumerable: !0,
      writable: !0,
      value: s
    }) : e[r] = s, delete n[r];
  return e;
}
function Of(t) {
  var e;
  e = t.input.charCodeAt(t.position), e === 10 ? t.position++ : e === 13 ? (t.position++, t.input.charCodeAt(t.position) === 10 && t.position++) : Ft(t, "a line break is expected"), t.line += 1, t.lineStart = t.position, t.firstTabInLine = -1;
}
function Pe(t, e, n) {
  for (var i = 0, r = t.input.charCodeAt(t.position); r !== 0; ) {
    for (; us(r); )
      r === 9 && t.firstTabInLine === -1 && (t.firstTabInLine = t.position), r = t.input.charCodeAt(++t.position);
    if (e && r === 35)
      do
        r = t.input.charCodeAt(++t.position);
      while (r !== 10 && r !== 13 && r !== 0);
    if (Yi(r))
      for (Of(t), r = t.input.charCodeAt(t.position), i++, t.lineIndent = 0; r === 32; )
        t.lineIndent++, r = t.input.charCodeAt(++t.position);
    else
      break;
  }
  return n !== -1 && i !== 0 && t.lineIndent < n && su(t, "deficient indentation"), i;
}
function ah(t) {
  var e = t.position, n;
  return n = t.input.charCodeAt(e), !!((n === 45 || n === 46) && n === t.input.charCodeAt(e + 1) && n === t.input.charCodeAt(e + 2) && (e += 3, n = t.input.charCodeAt(e), n === 0 || On(n)));
}
function Rf(t, e) {
  e === 1 ? t.result += " " : e > 1 && (t.result += mn.repeat(`
`, e - 1));
}
function yB(t, e, n) {
  var i, r, s, a, o, l, u, h, f = t.kind, d = t.result, p;
  if (p = t.input.charCodeAt(t.position), On(p) || Zs(p) || p === 35 || p === 38 || p === 42 || p === 33 || p === 124 || p === 62 || p === 39 || p === 34 || p === 37 || p === 64 || p === 96 || (p === 63 || p === 45) && (r = t.input.charCodeAt(t.position + 1), On(r) || n && Zs(r)))
    return !1;
  for (t.kind = "scalar", t.result = "", s = a = t.position, o = !1; p !== 0; ) {
    if (p === 58) {
      if (r = t.input.charCodeAt(t.position + 1), On(r) || n && Zs(r))
        break;
    } else if (p === 35) {
      if (i = t.input.charCodeAt(t.position - 1), On(i))
        break;
    } else {
      if (t.position === t.lineStart && ah(t) || n && Zs(p))
        break;
      if (Yi(p))
        if (l = t.line, u = t.lineStart, h = t.lineIndent, Pe(t, !1, -1), t.lineIndent >= e) {
          o = !0, p = t.input.charCodeAt(t.position);
          continue;
        } else {
          t.position = a, t.line = l, t.lineStart = u, t.lineIndent = h;
          break;
        }
    }
    o && (Mr(t, s, a, !1), Rf(t, t.line - l), s = a = t.position, o = !1), us(p) || (a = t.position + 1), p = t.input.charCodeAt(++t.position);
  }
  return Mr(t, s, a, !1), t.result ? !0 : (t.kind = f, t.result = d, !1);
}
function mB(t, e) {
  var n, i, r;
  if (n = t.input.charCodeAt(t.position), n !== 39)
    return !1;
  for (t.kind = "scalar", t.result = "", t.position++, i = r = t.position; (n = t.input.charCodeAt(t.position)) !== 0; )
    if (n === 39)
      if (Mr(t, i, t.position, !0), n = t.input.charCodeAt(++t.position), n === 39)
        i = t.position, t.position++, r = t.position;
      else
        return !0;
    else Yi(n) ? (Mr(t, i, r, !0), Rf(t, Pe(t, !1, e)), i = r = t.position) : t.position === t.lineStart && ah(t) ? Ft(t, "unexpected end of the document within a single quoted scalar") : (t.position++, r = t.position);
  Ft(t, "unexpected end of the stream within a single quoted scalar");
}
function xB(t, e) {
  var n, i, r, s, a, o;
  if (o = t.input.charCodeAt(t.position), o !== 34)
    return !1;
  for (t.kind = "scalar", t.result = "", t.position++, n = i = t.position; (o = t.input.charCodeAt(t.position)) !== 0; ) {
    if (o === 34)
      return Mr(t, n, t.position, !0), t.position++, !0;
    if (o === 92) {
      if (Mr(t, n, t.position, !0), o = t.input.charCodeAt(++t.position), Yi(o))
        Pe(t, !1, e);
      else if (o < 256 && Ab[o])
        t.result += Lb[o], t.position++;
      else if ((a = dB(o)) > 0) {
        for (r = a, s = 0; r > 0; r--)
          o = t.input.charCodeAt(++t.position), (a = hB(o)) >= 0 ? s = (s << 4) + a : Ft(t, "expected hexadecimal character");
        t.result += pB(s), t.position++;
      } else
        Ft(t, "unknown escape sequence");
      n = i = t.position;
    } else Yi(o) ? (Mr(t, n, i, !0), Rf(t, Pe(t, !1, e)), n = i = t.position) : t.position === t.lineStart && ah(t) ? Ft(t, "unexpected end of the document within a double quoted scalar") : (t.position++, i = t.position);
  }
  Ft(t, "unexpected end of the stream within a double quoted scalar");
}
function bB(t, e) {
  var n = !0, i, r, s, a = t.tag, o, l = t.anchor, u, h, f, d, p, y = /* @__PURE__ */ Object.create(null), m, _, T, v;
  if (v = t.input.charCodeAt(t.position), v === 91)
    h = 93, p = !1, o = [];
  else if (v === 123)
    h = 125, p = !0, o = {};
  else
    return !1;
  for (t.anchor !== null && (t.anchorMap[t.anchor] = o), v = t.input.charCodeAt(++t.position); v !== 0; ) {
    if (Pe(t, !0, e), v = t.input.charCodeAt(t.position), v === h)
      return t.position++, t.tag = a, t.anchor = l, t.kind = p ? "mapping" : "sequence", t.result = o, !0;
    n ? v === 44 && Ft(t, "expected the node content, but found ','") : Ft(t, "missed comma between flow collection entries"), _ = m = T = null, f = d = !1, v === 63 && (u = t.input.charCodeAt(t.position + 1), On(u) && (f = d = !0, t.position++, Pe(t, !0, e))), i = t.line, r = t.lineStart, s = t.position, Ia(t, e, iu, !1, !0), _ = t.tag, m = t.result, Pe(t, !0, e), v = t.input.charCodeAt(t.position), (d || t.line === i) && v === 58 && (f = !0, v = t.input.charCodeAt(++t.position), Pe(t, !0, e), Ia(t, e, iu, !1, !0), T = t.result), p ? Js(t, o, y, _, m, T, i, r, s) : f ? o.push(Js(t, null, y, _, m, T, i, r, s)) : o.push(m), Pe(t, !0, e), v = t.input.charCodeAt(t.position), v === 44 ? (n = !0, v = t.input.charCodeAt(++t.position)) : n = !1;
  }
  Ft(t, "unexpected end of the stream within a flow collection");
}
function _B(t, e) {
  var n, i, r = id, s = !1, a = !1, o = e, l = 0, u = !1, h, f;
  if (f = t.input.charCodeAt(t.position), f === 124)
    i = !1;
  else if (f === 62)
    i = !0;
  else
    return !1;
  for (t.kind = "scalar", t.result = ""; f !== 0; )
    if (f = t.input.charCodeAt(++t.position), f === 43 || f === 45)
      id === r ? r = f === 43 ? Eg : oB : Ft(t, "repeat of a chomping mode identifier");
    else if ((h = fB(f)) >= 0)
      h === 0 ? Ft(t, "bad explicit indentation width of a block scalar; it cannot be less than one") : a ? Ft(t, "repeat of an indentation width identifier") : (o = e + h - 1, a = !0);
    else
      break;
  if (us(f)) {
    do
      f = t.input.charCodeAt(++t.position);
    while (us(f));
    if (f === 35)
      do
        f = t.input.charCodeAt(++t.position);
      while (!Yi(f) && f !== 0);
  }
  for (; f !== 0; ) {
    for (Of(t), t.lineIndent = 0, f = t.input.charCodeAt(t.position); (!a || t.lineIndent < o) && f === 32; )
      t.lineIndent++, f = t.input.charCodeAt(++t.position);
    if (!a && t.lineIndent > o && (o = t.lineIndent), Yi(f)) {
      l++;
      continue;
    }
    if (t.lineIndent < o) {
      r === Eg ? t.result += mn.repeat(`
`, s ? 1 + l : l) : r === id && s && (t.result += `
`);
      break;
    }
    for (i ? us(f) ? (u = !0, t.result += mn.repeat(`
`, s ? 1 + l : l)) : u ? (u = !1, t.result += mn.repeat(`
`, l + 1)) : l === 0 ? s && (t.result += " ") : t.result += mn.repeat(`
`, l) : t.result += mn.repeat(`
`, s ? 1 + l : l), s = !0, a = !0, l = 0, n = t.position; !Yi(f) && f !== 0; )
      f = t.input.charCodeAt(++t.position);
    Mr(t, n, t.position, !1);
  }
  return !0;
}
function Ig(t, e) {
  var n, i = t.tag, r = t.anchor, s = [], a, o = !1, l;
  if (t.firstTabInLine !== -1)
    return !1;
  for (t.anchor !== null && (t.anchorMap[t.anchor] = s), l = t.input.charCodeAt(t.position); l !== 0 && (t.firstTabInLine !== -1 && (t.position = t.firstTabInLine, Ft(t, "tab characters must not be used in indentation")), !(l !== 45 || (a = t.input.charCodeAt(t.position + 1), !On(a)))); ) {
    if (o = !0, t.position++, Pe(t, !0, -1) && t.lineIndent <= e) {
      s.push(null), l = t.input.charCodeAt(t.position);
      continue;
    }
    if (n = t.line, Ia(t, e, Eb, !1, !0), s.push(t.result), Pe(t, !0, -1), l = t.input.charCodeAt(t.position), (t.line === n || t.lineIndent > e) && l !== 0)
      Ft(t, "bad indentation of a sequence entry");
    else if (t.lineIndent < e)
      break;
  }
  return o ? (t.tag = i, t.anchor = r, t.kind = "sequence", t.result = s, !0) : !1;
}
function kB(t, e, n) {
  var i, r, s, a, o, l, u = t.tag, h = t.anchor, f = {}, d = /* @__PURE__ */ Object.create(null), p = null, y = null, m = null, _ = !1, T = !1, v;
  if (t.firstTabInLine !== -1)
    return !1;
  for (t.anchor !== null && (t.anchorMap[t.anchor] = f), v = t.input.charCodeAt(t.position); v !== 0; ) {
    if (!_ && t.firstTabInLine !== -1 && (t.position = t.firstTabInLine, Ft(t, "tab characters must not be used in indentation")), i = t.input.charCodeAt(t.position + 1), s = t.line, (v === 63 || v === 58) && On(i))
      v === 63 ? (_ && (Js(t, f, d, p, y, null, a, o, l), p = y = m = null), T = !0, _ = !0, r = !0) : _ ? (_ = !1, r = !0) : Ft(t, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"), t.position += 1, v = i;
    else {
      if (a = t.line, o = t.lineStart, l = t.position, !Ia(t, n, vb, !1, !0))
        break;
      if (t.line === s) {
        for (v = t.input.charCodeAt(t.position); us(v); )
          v = t.input.charCodeAt(++t.position);
        if (v === 58)
          v = t.input.charCodeAt(++t.position), On(v) || Ft(t, "a whitespace character is expected after the key-value separator within a block mapping"), _ && (Js(t, f, d, p, y, null, a, o, l), p = y = m = null), T = !0, _ = !1, r = !1, p = t.tag, y = t.result;
        else if (T)
          Ft(t, "can not read an implicit mapping pair; a colon is missed");
        else
          return t.tag = u, t.anchor = h, !0;
      } else if (T)
        Ft(t, "can not read a block mapping entry; a multiline key may not be an implicit key");
      else
        return t.tag = u, t.anchor = h, !0;
    }
    if ((t.line === s || t.lineIndent > e) && (_ && (a = t.line, o = t.lineStart, l = t.position), Ia(t, e, ru, !0, r) && (_ ? y = t.result : m = t.result), _ || (Js(t, f, d, p, y, m, a, o, l), p = y = m = null), Pe(t, !0, -1), v = t.input.charCodeAt(t.position)), (t.line === s || t.lineIndent > e) && v !== 0)
      Ft(t, "bad indentation of a mapping entry");
    else if (t.lineIndent < e)
      break;
  }
  return _ && Js(t, f, d, p, y, null, a, o, l), T && (t.tag = u, t.anchor = h, t.kind = "mapping", t.result = f), T;
}
function TB(t) {
  var e, n = !1, i = !1, r, s, a;
  if (a = t.input.charCodeAt(t.position), a !== 33)
    return !1;
  if (t.tag !== null && Ft(t, "duplication of a tag property"), a = t.input.charCodeAt(++t.position), a === 60 ? (n = !0, a = t.input.charCodeAt(++t.position)) : a === 33 ? (i = !0, r = "!!", a = t.input.charCodeAt(++t.position)) : r = "!", e = t.position, n) {
    do
      a = t.input.charCodeAt(++t.position);
    while (a !== 0 && a !== 62);
    t.position < t.length ? (s = t.input.slice(e, t.position), a = t.input.charCodeAt(++t.position)) : Ft(t, "unexpected end of the stream within a verbatim tag");
  } else {
    for (; a !== 0 && !On(a); )
      a === 33 && (i ? Ft(t, "tag suffix cannot contain exclamation marks") : (r = t.input.slice(e - 1, t.position + 1), Cb.test(r) || Ft(t, "named tag handle cannot contain such characters"), i = !0, e = t.position + 1)), a = t.input.charCodeAt(++t.position);
    s = t.input.slice(e, t.position), uB.test(s) && Ft(t, "tag suffix cannot contain flow indicator characters");
  }
  s && !Sb.test(s) && Ft(t, "tag name cannot contain such characters: " + s);
  try {
    s = decodeURIComponent(s);
  } catch {
    Ft(t, "tag name is malformed: " + s);
  }
  return n ? t.tag = s : qr.call(t.tagMap, r) ? t.tag = t.tagMap[r] + s : r === "!" ? t.tag = "!" + s : r === "!!" ? t.tag = "tag:yaml.org,2002:" + s : Ft(t, 'undeclared tag handle "' + r + '"'), !0;
}
function wB(t) {
  var e, n;
  if (n = t.input.charCodeAt(t.position), n !== 38)
    return !1;
  for (t.anchor !== null && Ft(t, "duplication of an anchor property"), n = t.input.charCodeAt(++t.position), e = t.position; n !== 0 && !On(n) && !Zs(n); )
    n = t.input.charCodeAt(++t.position);
  return t.position === e && Ft(t, "name of an anchor node must contain at least one character"), t.anchor = t.input.slice(e, t.position), !0;
}
function vB(t) {
  var e, n, i;
  if (i = t.input.charCodeAt(t.position), i !== 42)
    return !1;
  for (i = t.input.charCodeAt(++t.position), e = t.position; i !== 0 && !On(i) && !Zs(i); )
    i = t.input.charCodeAt(++t.position);
  return t.position === e && Ft(t, "name of an alias node must contain at least one character"), n = t.input.slice(e, t.position), qr.call(t.anchorMap, n) || Ft(t, 'unidentified alias "' + n + '"'), t.result = t.anchorMap[n], Pe(t, !0, -1), !0;
}
function Ia(t, e, n, i, r) {
  var s, a, o, l = 1, u = !1, h = !1, f, d, p, y, m, _;
  if (t.listener !== null && t.listener("open", t), t.tag = null, t.anchor = null, t.kind = null, t.result = null, s = a = o = ru === n || Eb === n, i && Pe(t, !0, -1) && (u = !0, t.lineIndent > e ? l = 1 : t.lineIndent === e ? l = 0 : t.lineIndent < e && (l = -1)), l === 1)
    for (; TB(t) || wB(t); )
      Pe(t, !0, -1) ? (u = !0, o = s, t.lineIndent > e ? l = 1 : t.lineIndent === e ? l = 0 : t.lineIndent < e && (l = -1)) : o = !1;
  if (o && (o = u || r), (l === 1 || ru === n) && (iu === n || vb === n ? m = e : m = e + 1, _ = t.position - t.lineStart, l === 1 ? o && (Ig(t, _) || kB(t, _, m)) || bB(t, m) ? h = !0 : (a && _B(t, m) || mB(t, m) || xB(t, m) ? h = !0 : vB(t) ? (h = !0, (t.tag !== null || t.anchor !== null) && Ft(t, "alias node should not have any properties")) : yB(t, m, iu === n) && (h = !0, t.tag === null && (t.tag = "?")), t.anchor !== null && (t.anchorMap[t.anchor] = t.result)) : l === 0 && (h = o && Ig(t, _))), t.tag === null)
    t.anchor !== null && (t.anchorMap[t.anchor] = t.result);
  else if (t.tag === "?") {
    for (t.result !== null && t.kind !== "scalar" && Ft(t, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + t.kind + '"'), f = 0, d = t.implicitTypes.length; f < d; f += 1)
      if (y = t.implicitTypes[f], y.resolve(t.result)) {
        t.result = y.construct(t.result), t.tag = y.tag, t.anchor !== null && (t.anchorMap[t.anchor] = t.result);
        break;
      }
  } else if (t.tag !== "!") {
    if (qr.call(t.typeMap[t.kind || "fallback"], t.tag))
      y = t.typeMap[t.kind || "fallback"][t.tag];
    else
      for (y = null, p = t.typeMap.multi[t.kind || "fallback"], f = 0, d = p.length; f < d; f += 1)
        if (t.tag.slice(0, p[f].tag.length) === p[f].tag) {
          y = p[f];
          break;
        }
    y || Ft(t, "unknown tag !<" + t.tag + ">"), t.result !== null && y.kind !== t.kind && Ft(t, "unacceptable node kind for !<" + t.tag + '> tag; it should be "' + y.kind + '", not "' + t.kind + '"'), y.resolve(t.result, t.tag) ? (t.result = y.construct(t.result, t.tag), t.anchor !== null && (t.anchorMap[t.anchor] = t.result)) : Ft(t, "cannot resolve a node with !<" + t.tag + "> explicit tag");
  }
  return t.listener !== null && t.listener("close", t), t.tag !== null || t.anchor !== null || h;
}
function EB(t) {
  var e = t.position, n, i, r, s = !1, a;
  for (t.version = null, t.checkLineBreaks = t.legacy, t.tagMap = /* @__PURE__ */ Object.create(null), t.anchorMap = /* @__PURE__ */ Object.create(null); (a = t.input.charCodeAt(t.position)) !== 0 && (Pe(t, !0, -1), a = t.input.charCodeAt(t.position), !(t.lineIndent > 0 || a !== 37)); ) {
    for (s = !0, a = t.input.charCodeAt(++t.position), n = t.position; a !== 0 && !On(a); )
      a = t.input.charCodeAt(++t.position);
    for (i = t.input.slice(n, t.position), r = [], i.length < 1 && Ft(t, "directive name must not be less than one character in length"); a !== 0; ) {
      for (; us(a); )
        a = t.input.charCodeAt(++t.position);
      if (a === 35) {
        do
          a = t.input.charCodeAt(++t.position);
        while (a !== 0 && !Yi(a));
        break;
      }
      if (Yi(a))
        break;
      for (n = t.position; a !== 0 && !On(a); )
        a = t.input.charCodeAt(++t.position);
      r.push(t.input.slice(n, t.position));
    }
    a !== 0 && Of(t), qr.call(Ag, i) ? Ag[i](t, i, r) : su(t, 'unknown document directive "' + i + '"');
  }
  if (Pe(t, !0, -1), t.lineIndent === 0 && t.input.charCodeAt(t.position) === 45 && t.input.charCodeAt(t.position + 1) === 45 && t.input.charCodeAt(t.position + 2) === 45 ? (t.position += 3, Pe(t, !0, -1)) : s && Ft(t, "directives end mark is expected"), Ia(t, t.lineIndent - 1, ru, !1, !0), Pe(t, !0, -1), t.checkLineBreaks && cB.test(t.input.slice(e, t.position)) && su(t, "non-ASCII line breaks are interpreted as content"), t.documents.push(t.result), t.position === t.lineStart && ah(t)) {
    t.input.charCodeAt(t.position) === 46 && (t.position += 3, Pe(t, !0, -1));
    return;
  }
  if (t.position < t.length - 1)
    Ft(t, "end of the stream or a document separator is expected");
  else
    return;
}
function CB(t, e) {
  t = String(t), e = e || {}, t.length !== 0 && (t.charCodeAt(t.length - 1) !== 10 && t.charCodeAt(t.length - 1) !== 13 && (t += `
`), t.charCodeAt(0) === 65279 && (t = t.slice(1)));
  var n = new gB(t, e), i = t.indexOf("\0");
  for (i !== -1 && (n.position = i, Ft(n, "null byte is not allowed in input")), n.input += "\0"; n.input.charCodeAt(n.position) === 32; )
    n.lineIndent += 1, n.position += 1;
  for (; n.position < n.length - 1; )
    EB(n);
  return n.documents;
}
function SB(t, e) {
  var n = CB(t, e);
  if (n.length !== 0) {
    if (n.length === 1)
      return n[0];
    throw new sr("expected a single document in the stream, but found more");
  }
}
var AB = SB, LB = {
  load: AB
}, IB = kb, BB = LB.load;
function DB(t) {
  const e = t.match(Ix);
  if (!e)
    return {
      text: t,
      metadata: {}
    };
  let n = BB(e[1], {
    // To support config, we need JSON schema.
    // https://www.yaml.org/spec/1.2/spec.html#id2803231
    schema: IB
  }) ?? {};
  n = typeof n == "object" && !Array.isArray(n) ? n : {};
  const i = {};
  return n.displayMode && (i.displayMode = n.displayMode.toString()), n.title && (i.title = n.title.toString()), n.config && (i.config = n.config), {
    text: t.slice(e[0].length),
    metadata: i
  };
}
const NB = (t) => t.replace(/\r\n?/g, `
`).replace(
  /<(\w+)([^>]*)>/g,
  (e, n, i) => "<" + n + i.replace(/="([^"]*)"/g, "='$1'") + ">"
), FB = (t) => {
  const { text: e, metadata: n } = DB(t), { displayMode: i, title: r, config: s = {} } = n;
  return i && (s.gantt || (s.gantt = {}), s.gantt.displayMode = i), { title: r, config: s, text: e };
}, OB = (t) => {
  const e = Gt.detectInit(t) ?? {}, n = Gt.detectDirective(t, "wrap");
  return Array.isArray(n) ? e.wrap = n.some(({ type: i }) => {
  }) : n?.type === "wrap" && (e.wrap = !0), {
    text: wA(t),
    directive: e
  };
};
function Bb(t) {
  const e = NB(t), n = FB(e), i = OB(n.text), r = El(n.config, i.directive);
  return t = YL(i.text), {
    code: t,
    title: n.title,
    config: r
  };
}
const RB = 5e4, MB = "graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa", PB = "sandbox", zB = "loose", VB = "http://www.w3.org/2000/svg", qB = "http://www.w3.org/1999/xlink", $B = "http://www.w3.org/1999/xhtml", YB = "100%", WB = "100%", UB = "border:0;margin:0;", HB = "margin:0", GB = "allow-top-navigation-by-user-activation allow-popups", jB = 'The "iframe" tag is not supported by your browser.', XB = ["foreignobject"], KB = ["dominant-baseline"];
function Db(t) {
  const e = Bb(t);
  return tu(), $A(e.config ?? {}), e;
}
async function QB(t, e) {
  Nf(), t = Db(t).code;
  try {
    await Mf(t);
  } catch (n) {
    if (e?.suppressErrors)
      return !1;
    throw n;
  }
  return !0;
}
const Bg = (t, e, n = []) => `
.${t} ${e} { ${n.join(" !important; ")} !important; }`, ZB = (t, e = {}) => {
  var n;
  let i = "";
  if (t.themeCSS !== void 0 && (i += `
${t.themeCSS}`), t.fontFamily !== void 0 && (i += `
:root { --mermaid-font-family: ${t.fontFamily}}`), t.altFontFamily !== void 0 && (i += `
:root { --mermaid-alt-font-family: ${t.altFontFamily}}`), !Co(e)) {
    const o = t.htmlLabels || ((n = t.flowchart) == null ? void 0 : n.htmlLabels) ? ["> *", "span"] : ["rect", "polygon", "ellipse", "circle", "path"];
    for (const l in e) {
      const u = e[l];
      Co(u.styles) || o.forEach((h) => {
        i += Bg(u.id, h, u.styles);
      }), Co(u.textStyles) || (i += Bg(u.id, "tspan", u.textStyles));
    }
  }
  return i;
}, JB = (t, e, n, i) => {
  const r = ZB(t, n), s = oL(e, r, t.themeVariables);
  return Ud(N8(`${i}{${s}}`), O8);
}, tD = (t = "", e, n) => {
  let i = t;
  return !n && !e && (i = i.replace(
    /marker-end="url\([\d+./:=?A-Za-z-]*?#/g,
    'marker-end="url(#'
  )), i = Ko(i), i = i.replace(/<br>/g, "<br/>"), i;
}, eD = (t = "", e) => {
  var n, i;
  const r = (i = (n = e?.viewBox) == null ? void 0 : n.baseVal) != null && i.height ? e.viewBox.baseVal.height + "px" : WB, s = btoa('<body style="' + HB + '">' + t + "</body>");
  return `<iframe style="width:${YB};height:${r};${UB}" src="data:text/html;base64,${s}" sandbox="${GB}">
  ${jB}
</iframe>`;
}, Dg = (t, e, n, i, r) => {
  const s = t.append("div");
  s.attr("id", n), i && s.attr("style", i);
  const a = s.append("svg").attr("id", e).attr("width", "100%").attr("xmlns", VB);
  return r && a.attr("xmlns:xlink", r), a.append("g"), t;
};
function Ng(t, e) {
  return t.append("iframe").attr("id", e).attr("style", "width: 100%; height: 100%;").attr("sandbox", "");
}
const nD = (t, e, n, i) => {
  var r, s, a;
  (r = t.getElementById(e)) == null || r.remove(), (s = t.getElementById(n)) == null || s.remove(), (a = t.getElementById(i)) == null || a.remove();
}, iD = async function(t, e, n) {
  var i, r, s, a, o, l;
  Nf();
  const u = Db(e);
  e = u.code;
  const h = Ee();
  z.debug(h), e.length > (h?.maxTextSize ?? RB) && (e = MB);
  const f = "#" + t, d = "i" + t, p = "#" + d, y = "d" + t, m = "#" + y;
  let _ = yt("body");
  const T = h.securityLevel === PB, v = h.securityLevel === zB, A = h.fontFamily;
  if (n !== void 0) {
    if (n && (n.innerHTML = ""), T) {
      const D = Ng(yt(n), d);
      _ = yt(D.nodes()[0].contentDocument.body), _.node().style.margin = 0;
    } else
      _ = yt(n);
    Dg(_, t, y, `font-family: ${A}`, qB);
  } else {
    if (nD(document, t, y, d), T) {
      const D = Ng(yt("body"), d);
      _ = yt(D.nodes()[0].contentDocument.body), _.node().style.margin = 0;
    } else
      _ = yt("body");
    Dg(_, t, y);
  }
  let L, w;
  try {
    L = await Mf(e, { title: u.title });
  } catch (D) {
    L = new xb("error"), w = D;
  }
  const b = _.select(m).node(), F = L.type, S = b.firstChild, x = S.firstChild, C = (r = (i = L.renderer).getClasses) == null ? void 0 : r.call(i, e, L), g = JB(h, F, C, f), I = document.createElement("style");
  I.innerHTML = g, S.insertBefore(I, x);
  try {
    await L.renderer.draw(e, t, _g, L);
  } catch (D) {
    throw gL.draw(e, t, _g), D;
  }
  const k = _.select(`${m} svg`), P = (a = (s = L.db).getAccTitle) == null ? void 0 : a.call(s), R = (l = (o = L.db).getAccDescription) == null ? void 0 : l.call(o);
  sD(F, k, P, R), _.select(`[id="${t}"]`).selectAll("foreignobject > *").attr("xmlns", $B);
  let M = _.select(m).node().innerHTML;
  if (z.debug("config.arrowMarkerAbsolute", h.arrowMarkerAbsolute), M = tD(M, T, Ge(h.arrowMarkerAbsolute)), T) {
    const D = _.select(m + " svg").node();
    M = eD(M, D);
  } else v || (M = _a.sanitize(M, {
    ADD_TAGS: XB,
    ADD_ATTR: KB
  }));
  if (zL(), w)
    throw w;
  const N = yt(T ? p : m).node();
  return N && "remove" in N && N.remove(), {
    svg: M,
    bindFunctions: L.db.bindFunctions
  };
};
function rD(t = {}) {
  var e;
  t?.fontFamily && !((e = t.themeVariables) != null && e.fontFamily) && (t.themeVariables || (t.themeVariables = {}), t.themeVariables.fontFamily = t.fontFamily), VA(t), t?.theme && t.theme in yr ? t.themeVariables = yr[t.theme].getThemeVariables(
    t.themeVariables
  ) : t && (t.themeVariables = yr.default.getThemeVariables(t.themeVariables));
  const n = typeof t == "object" ? zA(t) : $x();
  vf(n.logLevel), Nf();
}
const Mf = (t, e = {}) => {
  const { code: n } = Bb(t);
  return PL(n, e);
};
function sD(t, e, n, i) {
  qL(e, t), $L(e, n, i, e.attr("id"));
}
const xs = Object.freeze({
  render: iD,
  parse: QB,
  getDiagramFromText: Mf,
  initialize: rD,
  getConfig: Ee,
  setConfig: Yx,
  getSiteConfig: $x,
  updateSiteConfig: qA,
  reset: () => {
    tu();
  },
  globalReset: () => {
    tu(Aa);
  },
  defaultConfig: Aa
});
vf(Ee().logLevel);
tu(Ee());
const aD = async () => {
  z.debug("Loading registered diagrams");
  const e = (await Promise.allSettled(
    Object.entries(Sa).map(async ([n, { detector: i, loader: r }]) => {
      if (r)
        try {
          Df(n);
        } catch {
          try {
            const { diagram: a, id: o } = await r();
            nu(o, a, i);
          } catch (a) {
            throw z.error(`Failed to load external diagram with key ${n}. Removing from detectors.`), delete Sa[n], a;
          }
        }
    })
  )).filter((n) => n.status === "rejected");
  if (e.length > 0) {
    z.error(`Failed to load ${e.length} external diagrams`);
    for (const n of e)
      z.error(n);
    throw new Error(`Failed to load ${e.length} external diagrams`);
  }
}, oD = (t, e, n) => {
  z.warn(t), Vx(t) ? (n && n(t.str, t.hash), e.push({ ...t, message: t.str, error: t })) : (n && n(t), t instanceof Error && e.push({
    str: t.message,
    message: t.message,
    hash: t.name,
    error: t
  }));
}, Nb = async function(t = {
  querySelector: ".mermaid"
}) {
  try {
    await lD(t);
  } catch (e) {
    if (Vx(e) && z.error(e.str), zn.parseError && zn.parseError(e), !t.suppressErrors)
      throw z.error("Use the suppressErrors option to suppress these errors"), e;
  }
}, lD = async function({ postRenderCallback: t, querySelector: e, nodes: n } = {
  querySelector: ".mermaid"
}) {
  const i = xs.getConfig();
  z.debug(`${t ? "" : "No "}Callback function found`);
  let r;
  if (n)
    r = n;
  else if (e)
    r = document.querySelectorAll(e);
  else
    throw new Error("Nodes and querySelector are both undefined");
  z.debug(`Found ${r.length} diagrams`), i?.startOnLoad !== void 0 && (z.debug("Start On Load: " + i?.startOnLoad), xs.updateSiteConfig({ startOnLoad: i?.startOnLoad }));
  const s = new Gt.InitIDGenerator(i.deterministicIds, i.deterministicIDSeed);
  let a;
  const o = [];
  for (const l of Array.from(r)) {
    z.info("Rendering diagram: " + l.id);
    /*! Check if previously processed */
    if (l.getAttribute("data-processed"))
      continue;
    l.setAttribute("data-processed", "true");
    const u = `mermaid-${s.next()}`;
    a = l.innerHTML, a = Ry(Gt.entityDecode(a)).trim().replace(/<br\s*\/?>/gi, "<br/>");
    const h = Gt.detectInit(a);
    h && z.debug("Detected early reinit: ", h);
    try {
      const { svg: f, bindFunctions: d } = await Mb(u, a, l);
      l.innerHTML = f, t && await t(u), d && d(l);
    } catch (f) {
      oD(f, o, zn.parseError);
    }
  }
  if (o.length > 0)
    throw o[0];
}, Fb = function(t) {
  xs.initialize(t);
}, cD = async function(t, e, n) {
  z.warn("mermaid.init is deprecated. Please use run instead."), t && Fb(t);
  const i = { postRenderCallback: n, querySelector: ".mermaid" };
  typeof e == "string" ? i.querySelector = e : e && (e instanceof HTMLElement ? i.nodes = [e] : i.nodes = e), await Nb(i);
}, uD = async (t, {
  lazyLoad: e = !0
} = {}) => {
  Dx(...t), e === !1 && await aD();
}, Ob = function() {
  if (zn.startOnLoad) {
    const { startOnLoad: t } = xs.getConfig();
    t && zn.run().catch((e) => z.error("Mermaid failed to initialize", e));
  }
};
if (typeof document < "u") {
  /*!
   * Wait for document loaded before starting the execution
   */
  window.addEventListener("load", Ob, !1);
}
const hD = function(t) {
  zn.parseError = t;
}, au = [];
let rd = !1;
const Rb = async () => {
  if (!rd) {
    for (rd = !0; au.length > 0; ) {
      const t = au.shift();
      if (t)
        try {
          await t();
        } catch (e) {
          z.error("Error executing queue", e);
        }
    }
    rd = !1;
  }
}, dD = async (t, e) => new Promise((n, i) => {
  const r = () => new Promise((s, a) => {
    xs.parse(t, e).then(
      (o) => {
        s(o), n(o);
      },
      (o) => {
        var l;
        z.error("Error parsing", o), (l = zn.parseError) == null || l.call(zn, o), a(o), i(o);
      }
    );
  });
  au.push(r), Rb().catch(i);
}), Mb = (t, e, n) => new Promise((i, r) => {
  const s = () => new Promise((a, o) => {
    xs.render(t, e, n).then(
      (l) => {
        a(l), i(l);
      },
      (l) => {
        var u;
        z.error("Error parsing", l), (u = zn.parseError) == null || u.call(zn, l), o(l), r(l);
      }
    );
  });
  au.push(s), Rb().catch(r);
}), zn = {
  startOnLoad: !0,
  mermaidAPI: xs,
  parse: dD,
  render: Mb,
  init: cD,
  run: Nb,
  registerExternalDiagrams: uD,
  initialize: Fb,
  parseError: void 0,
  contentLoaded: Ob,
  setParseErrorHandler: hD,
  detectType: rh
}, Ya = (t) => {
  t = pD(t);
  const e = t.replace(/#(\d+);/g, "&#$1;").replace(/#([a-z]+);/g, "&$1;"), n = document.createElement("textarea");
  return n.innerHTML = e, n.value;
}, oa = (t) => {
  const n = t.getAttribute("transform")?.match(/translate\(([ \d.-]+),\s*([\d.-]+)\)/);
  let i = 0, r = 0;
  return n && (i = Number(n[1]), r = Number(n[2])), { transformX: i, transformY: r };
}, fD = (t) => {
  let e = t;
  return e = e.replace(/style.*:\S*#.*;/g, (n) => n.substring(0, n.length - 1)), e = e.replace(/classDef.*:\S*#.*;/g, (n) => n.substring(0, n.length - 1)), e = e.replace(/#\w+;/g, (n) => {
    const i = n.substring(1, n.length - 1);
    return /^\+?\d+$/.test(i) ? `ﬂ°°${i}¶ß` : `ﬂ°${i}¶ß`;
  }), e;
}, pD = function(t) {
  return t.replace(/ﬂ°°/g, "#").replace(/ﬂ°/g, "&").replace(/¶ß/g, ";");
}, Pb = (t, e = { x: 0, y: 0 }) => {
  if (t.tagName.toLowerCase() !== "path")
    throw new Error(`Invalid input: Expected an HTMLElement of tag "path", got ${t.tagName}`);
  const n = t.getAttribute("d");
  if (!n)
    throw new Error('Path element does not contain a "d" attribute');
  const i = n.split(/(?=[LM])/), r = i[0].substring(1).split(",").map((o) => parseFloat(o)), s = i[i.length - 1].substring(1).split(",").map((o) => parseFloat(o)), a = i.map((o) => {
    const l = o.substring(1).split(",").map((u) => parseFloat(u));
    return { x: l[0], y: l[1] };
  }).filter((o, l, u) => {
    if (l === 0 || l === u.length - 1)
      return !0;
    if (o.x === u[l - 1].x && o.y === u[l - 1].y)
      return !1;
    if (l === u.length - 2 && (u[l - 1].x === o.x || u[l - 1].y === o.y)) {
      const h = u[u.length - 1];
      return Math.hypot(h.x - o.x, h.y - o.y) > 20;
    }
    return o.x !== u[l - 1].x || o.y !== u[l - 1].y;
  }).map((o) => ({
    x: o.x + e.x,
    y: o.y + e.y
  }));
  return {
    startX: r[0] + e.x,
    startY: r[1] + e.y,
    endX: s[0] + e.x,
    endY: s[1] + e.y,
    reflectionPoints: a
  };
}, gD = (t, e) => {
  const n = t.nodes.map((o) => o.startsWith("flowchart-") ? o.split("-")[1] : o), i = e.querySelector(`[id='${t.id}']`);
  if (!i)
    throw new Error("SubGraph element not found");
  const r = Pf(i, e), s = i.getBBox(), a = {
    width: s.width,
    height: s.height
  };
  return t.classes = void 0, t.dir = void 0, {
    ...t,
    nodeIds: n,
    ...r,
    ...a,
    text: Ya(t.title)
  };
}, yD = (t, e) => {
  const n = e.querySelector(`[id*="flowchart-${t.id}-"]`);
  if (!n)
    return;
  let i;
  n.parentElement?.tagName.toLowerCase() === "a" && (i = n.parentElement.getAttribute("xlink:href"));
  const r = Pf(i ? n.parentElement : n, e), s = n.getBBox(), a = {
    width: s.width,
    height: s.height
  }, o = n.querySelector(".label-container")?.getAttribute("style"), l = n.querySelector(".label")?.getAttribute("style"), u = {};
  o?.split(";").forEach((f) => {
    if (!f)
      return;
    const d = f.split(":")[0].trim(), p = f.split(":")[1].trim();
    u[d] = p;
  });
  const h = {};
  return l?.split(";").forEach((f) => {
    if (!f)
      return;
    const d = f.split(":")[0].trim(), p = f.split(":")[1].trim();
    h[d] = p;
  }), {
    id: t.id,
    labelType: t.labelType,
    text: Ya(t.text),
    type: t.type,
    link: i || void 0,
    ...r,
    ...a,
    containerStyle: u,
    labelStyle: h
  };
}, mD = (t, e, n) => {
  const i = n.querySelector(`[id*="L-${t.start}-${t.end}-${e}"]`);
  if (!i)
    throw new Error("Edge element not found");
  const r = Pf(i, n), s = Pb(i, r);
  return t.length = void 0, {
    ...t,
    ...s,
    text: Ya(t.text)
  };
}, Pf = (t, e) => {
  if (!t)
    throw new Error("Element not found");
  let n = t.parentElement?.parentElement;
  const i = t.childNodes[0];
  let r = { x: 0, y: 0 };
  if (i) {
    const { transformX: l, transformY: u } = oa(i), h = i.getBBox();
    r = {
      x: Number(i.getAttribute("x")) || l + h.x || 0,
      y: Number(i.getAttribute("y")) || u + h.y || 0
    };
  }
  const { transformX: s, transformY: a } = oa(t), o = {
    x: s + r.x,
    y: a + r.y
  };
  for (; n && n.id !== e.id; ) {
    if (n.classList.value === "root" && n.hasAttribute("transform")) {
      const { transformX: l, transformY: u } = oa(n);
      o.x += l, o.y += u;
    }
    n = n.parentElement;
  }
  return o;
}, xD = (t, e) => {
  t.parse();
  const n = t.parser.yy, i = n.getVertices();
  Object.keys(i).forEach((o) => {
    i[o] = yD(i[o], e);
  });
  const r = /* @__PURE__ */ new Map(), s = n.getEdges().filter((o) => e.querySelector(`[id*="L-${o.start}-${o.end}"]`)).map((o) => {
    const l = `${o.start}-${o.end}`, u = r.get(l) || 0;
    return r.set(l, u + 1), mD(o, u, e);
  });
  return {
    type: "flowchart",
    subGraphs: n.getSubGraphs().map((o) => gD(o, e)),
    vertices: i,
    edges: s
  };
}, bD = (t, e) => {
  const n = {};
  e?.label && (n.label = { text: Ya(e.label), fontSize: 16 });
  const i = t.tagName;
  if (i === "line")
    n.startX = Number(t.getAttribute("x1")), n.startY = Number(t.getAttribute("y1")), n.endX = Number(t.getAttribute("x2")), n.endY = Number(t.getAttribute("y2"));
  else if (i === "path") {
    const r = t.getAttribute("d");
    if (!r)
      throw new Error('Path element does not contain a "d" attribute');
    const s = r.split(/(?=[LC])/), a = s[0].substring(1).split(",").map((u) => parseFloat(u)), o = [];
    s.forEach((u) => {
      const h = u.substring(1).trim().split(" ").map((f) => {
        const [d, p] = f.split(",");
        return [
          parseFloat(d) - a[0],
          parseFloat(p) - a[1]
        ];
      });
      o.push(...h);
    });
    const l = o[o.length - 1];
    n.startX = a[0], n.startY = a[1], n.endX = l[0], n.endY = l[1], n.points = o;
  }
  return e?.label && (n.startY = n.startY - 10, n.endY = n.endY - 10), n.strokeColor = t.getAttribute("stroke"), n.strokeWidth = Number(t.getAttribute("stroke-width")), n.type = "arrow", n.strokeStyle = e?.strokeStyle || "solid", n.startArrowhead = e?.startArrowhead || null, n.endArrowhead = e?.endArrowhead || null, n;
}, zb = (t, e, n, i, r) => {
  const s = {};
  return s.type = "arrow", s.startX = t, s.startY = e, s.endX = n, s.endY = i, Object.assign(s, { ...r }), s;
}, t1 = (t, e, n, i) => ({
  type: "text",
  x: t,
  y: e,
  text: n,
  width: i?.width || 20,
  height: i?.height || 20,
  fontSize: i?.fontSize || Fu,
  id: i?.id,
  groupId: i?.groupId,
  metadata: i?.metadata
}), Vb = (t, e, n) => {
  const i = {}, r = Number(t.getAttribute("x")), s = Number(t.getAttribute("y"));
  i.type = "text", i.text = Ya(e), n?.id && (i.id = n.id), n?.groupId && (i.groupId = n.groupId);
  const a = t.getBBox();
  i.width = a.width, i.height = a.height, i.x = r - a.width / 2, i.y = s;
  const o = parseInt(getComputedStyle(t).fontSize);
  return i.fontSize = o, i;
}, Ui = (t, e, n = {}) => {
  const i = {};
  i.type = e;
  const { label: r, subtype: s, id: a, groupId: o } = n;
  i.id = a, o && (i.groupId = o), r && (i.label = {
    text: Ya(r.text),
    fontSize: 16,
    verticalAlign: r?.verticalAlign
  });
  const l = t.getBBox();
  switch (i.x = l.x, i.y = l.y, i.width = l.width, i.height = l.height, i.subtype = s, s) {
    case "highlight":
      const u = t.getAttribute("fill");
      u && (i.bgColor = u);
      break;
    case "note":
      i.strokeStyle = "dashed";
      break;
  }
  return i;
}, Zo = (t, e, n, i, r, s) => {
  const a = {};
  return a.startX = e, a.startY = n, a.endX = i, s?.groupId && (a.groupId = s.groupId), s?.id && (a.id = s.id), a.endY = r, a.strokeColor = t.getAttribute("stroke"), a.strokeWidth = Number(t.getAttribute("stroke-width")), a.type = "line", a;
}, Fg = {
  0: "SOLID",
  1: "DOTTED",
  3: "SOLID_CROSS",
  4: "DOTTED_CROSS",
  5: "SOLID_OPEN",
  6: "DOTTED_OPEN",
  24: "SOLID_POINT",
  25: "DOTTED_POINT"
}, Fi = {
  SOLID: 0,
  DOTTED: 1,
  NOTE: 2,
  SOLID_CROSS: 3,
  DOTTED_CROSS: 4,
  SOLID_OPEN: 5,
  DOTTED_OPEN: 6,
  SOLID_POINT: 24,
  DOTTED_POINT: 25,
  CRITICAL_START: 27
}, _D = (t) => {
  let e;
  switch (t) {
    case Fi.SOLID:
    case Fi.SOLID_CROSS:
    case Fi.SOLID_OPEN:
    case Fi.SOLID_POINT:
      e = "solid";
      break;
    case Fi.DOTTED:
    case Fi.DOTTED_CROSS:
    case Fi.DOTTED_OPEN:
    case Fi.DOTTED_POINT:
      e = "dotted";
      break;
    default:
      e = "solid";
      break;
  }
  return e;
}, kD = (t, e) => {
  if (!!t.nextElementSibling?.classList.contains("sequenceNumber")) {
    const i = t.nextElementSibling?.textContent;
    if (!i)
      throw new Error("sequence number not present");
    const r = 30, s = r / 2, o = {
      type: "rectangle",
      x: e.startX - 10,
      y: e.startY - s,
      label: { text: i, fontSize: 14 },
      bgColor: "#e9ecef",
      height: r,
      subtype: "sequence"
    };
    Object.assign(e, { sequenceNumber: o });
  }
}, Og = (t, e, n) => {
  if (!t)
    throw "root node not found";
  const i = gr(), r = Array.from(t.children), s = [];
  return r.forEach((a, o) => {
    const l = `${n?.id}-${o}`;
    let u;
    switch (a.tagName) {
      case "line":
        const h = Number(a.getAttribute("x1")), f = Number(a.getAttribute("y1")), d = Number(a.getAttribute("x2")), p = Number(a.getAttribute("y2"));
        u = Zo(a, h, f, d, p, { groupId: i, id: l });
        break;
      case "text":
        u = Vb(a, e, {
          groupId: i,
          id: l
        });
        break;
      case "circle":
        u = Ui(a, "ellipse", {
          label: a.textContent ? { text: a.textContent } : void 0,
          groupId: i,
          id: l
        });
      default:
        u = Ui(a, ak[a.tagName], {
          label: a.textContent ? { text: a.textContent } : void 0,
          groupId: i,
          id: l
        });
    }
    s.push(u);
  }), s;
}, TD = (t, e) => {
  const n = Array.from(e.querySelectorAll(".actor-top")), i = Array.from(e.querySelectorAll(".actor-bottom")), r = [], s = [];
  return Object.values(t).forEach((a, o) => {
    const l = n.find((f) => f.getAttribute("name") === a.name), u = i.find((f) => f.getAttribute("name") === a.name);
    if (!l || !u)
      throw "root not found";
    const h = a.description;
    if (a.type === "participant") {
      const f = Ui(l, "rectangle", { id: `${a.name}-top`, label: { text: h }, subtype: "actor" });
      if (!f)
        throw "Top Node element not found!";
      r.push([f]);
      const d = Ui(u, "rectangle", { id: `${a.name}-bottom`, label: { text: h }, subtype: "actor" });
      r.push([d]);
      const p = l?.parentElement?.previousElementSibling;
      if (p?.tagName !== "line")
        throw "Line not found";
      const y = Number(p.getAttribute("x1"));
      if (!f.height)
        throw "Top node element height is null";
      const m = f.y + f.height, _ = d.y, T = Number(p.getAttribute("x2")), v = Zo(p, y, m, T, _);
      s.push(v);
    } else if (a.type === "actor") {
      const f = Og(l, h, {
        id: `${a.name}-top`
      });
      r.push(f);
      const d = Og(u, h, {
        id: `${a.name}-bottom`
      });
      r.push(d);
      const p = l.previousElementSibling;
      if (p?.tagName !== "line")
        throw "Line not found";
      const y = Number(p.getAttribute("x1")), m = Number(p.getAttribute("y1")), _ = Number(p.getAttribute("x2")), T = d.find((v) => v.type === "ellipse");
      if (T) {
        const v = T.y, A = Zo(p, y, m, _, v);
        s.push(A);
      }
    }
  }), { nodes: r, lines: s };
}, wD = (t, e) => {
  const n = [], i = Array.from(e.querySelectorAll('[class*="messageLine"]')), r = Object.keys(Fg), s = t.filter((a) => r.includes(a.type.toString()));
  return i.forEach((a, o) => {
    const l = s[o], u = Fg[l.type], h = bD(a, {
      label: l?.message,
      strokeStyle: _D(l.type),
      endArrowhead: u === "SOLID_OPEN" || u === "DOTTED_OPEN" ? null : "arrow"
    });
    kD(a, h), n.push(h);
  }), n;
}, vD = (t, e) => {
  const n = Array.from(e.querySelectorAll(".note")).map((s) => s.parentElement), i = t.filter((s) => s.type === Fi.NOTE), r = [];
  return n.forEach((s, a) => {
    if (!s)
      return;
    const o = s.firstChild, l = i[a].message, u = Ui(o, "rectangle", {
      label: { text: l },
      subtype: "note"
    });
    r.push(u);
  }), r;
}, ED = (t) => {
  const e = Array.from(t.querySelectorAll("[class*=activation]")), n = [];
  return e.forEach((i) => {
    const r = Ui(i, "rectangle", {
      label: { text: "" },
      subtype: "activation"
    });
    n.push(r);
  }), n;
}, CD = (t, e) => {
  const n = Array.from(e.querySelectorAll(".loopLine")), i = [], r = [], s = [];
  n.forEach((h) => {
    const f = Number(h.getAttribute("x1")), d = Number(h.getAttribute("y1")), p = Number(h.getAttribute("x2")), y = Number(h.getAttribute("y2")), m = Zo(h, f, d, p, y);
    m.strokeStyle = "dotted", m.strokeColor = "#adb5bd", m.strokeWidth = 2, i.push(m);
  });
  const a = Array.from(e.querySelectorAll(".loopText")), o = t.filter((h) => h.type === Fi.CRITICAL_START).map((h) => h.message);
  a.forEach((h) => {
    const f = h.textContent || "", d = Vb(h, f), p = f.match(/\[(.*?)\]/)?.[1] || "";
    o.includes(p) && (d.x += 16), r.push(d);
  });
  const l = Array.from(e?.querySelectorAll(".labelBox")), u = Array.from(e?.querySelectorAll(".labelText"));
  return l.forEach((h, f) => {
    const d = u[f]?.textContent || "", p = Ui(h, "rectangle", {
      label: { text: d }
    });
    p.strokeColor = "#adb5bd", p.bgColor = "#e9ecef", p.width = void 0, s.push(p);
  }), { lines: i, texts: r, nodes: s };
}, SD = (t) => {
  const e = Array.from(t.querySelectorAll(".rect")).filter((i) => i.parentElement?.tagName !== "g"), n = [];
  return e.forEach((i) => {
    const r = Ui(i, "rectangle", {
      label: { text: "" },
      subtype: "highlight"
    });
    n.push(r);
  }), n;
}, AD = (t, e) => {
  t.parse();
  const n = t.parser.yy, i = [], r = n.getBoxes(), s = SD(e), a = n.getActors(), { nodes: o, lines: l } = TD(a, e), u = n.getMessages(), h = wD(u, e), f = vD(u, e), d = ED(e), p = CD(u, e);
  return i.push(s), i.push(...o), i.push(f), i.push(d), { type: "sequence", lines: l, arrows: h, nodes: i, loops: p, groups: r };
}, Kl = {
  AGGREGATION: 0,
  EXTENSION: 1,
  COMPOSITION: 2,
  DEPENDENCY: 3
}, Rg = {
  LINE: 0,
  DOTTED_LINE: 1
}, Lr = 16, LD = (t) => {
  let e;
  switch (t) {
    case Rg.LINE:
      e = "solid";
      break;
    case Rg.DOTTED_LINE:
      e = "dotted";
      break;
    default:
      e = "solid";
  }
  return e;
}, Mg = (t) => {
  let e;
  switch (t) {
    case Kl.AGGREGATION:
      e = "diamond_outline";
      break;
    case Kl.COMPOSITION:
      e = "diamond";
      break;
    case Kl.EXTENSION:
      e = "triangle_outline";
      break;
    case "none":
      e = null;
      break;
    case Kl.DEPENDENCY:
    default:
      e = "arrow";
      break;
  }
  return e;
}, ID = (t, e) => {
  const n = [], i = [], r = [];
  return Object.values(t).forEach((s) => {
    const { domId: a, id: o } = s, l = gr(), u = e.querySelector(`[data-id=${o}]`);
    if (!u)
      throw Error(`DOM Node with id ${a} not found`);
    const { transformX: h, transformY: f } = oa(u), d = Ui(u.firstChild, "rectangle", { id: o, groupId: l });
    d.x += h, d.y += f, d.metadata = { classId: o }, n.push(d), Array.from(u.querySelectorAll(".divider")).forEach((m) => {
      const _ = Number(m.getAttribute("x1")), T = Number(m.getAttribute("y1")), v = Number(m.getAttribute("x2")), A = Number(m.getAttribute("y2")), L = Zo(m, _, T, v, A, {
        groupId: l,
        id: gr()
      });
      L.startX += h, L.startY += f, L.endX += h, L.endY += f, L.metadata = { classId: o }, i.push(L);
    });
    const y = u.querySelector(".label")?.children;
    if (!y)
      throw "label nodes not found";
    Array.from(y).forEach((m) => {
      const _ = m.textContent;
      if (!_)
        return;
      const T = gr(), { transformX: v, transformY: A } = oa(m), L = m.getBBox(), b = t1(h + v, f + A + 10, _, {
        width: L.width,
        height: L.height,
        id: T,
        groupId: l,
        metadata: { classId: o }
      });
      r.push(b);
    });
  }), { nodes: n, lines: i, text: r };
}, BD = (t, e) => {
  const n = ["triangle_outline", "diamond", "diamond_outline"], i = e.startArrowhead && n.includes(e.startArrowhead), r = e.endArrowhead && n.includes(e.endArrowhead);
  return !r && !i || (i && (t === "LR" ? e.startX -= Lr : t === "RL" ? e.startX += Lr : t === "TB" ? e.startY -= Lr : t === "BT" && (e.startY += Lr)), r && (t === "LR" ? e.endX += Lr : t === "RL" ? e.endX -= Lr : t === "TB" ? e.endY += Lr : t === "BT" && (e.endY -= Lr))), e;
}, DD = (t, e, n, i) => {
  const r = n.querySelector(".edgePaths")?.children;
  if (!r)
    throw new Error("No Edges found!");
  const s = [], a = [];
  return t.forEach((o, l) => {
    const { id1: u, id2: h, relation: f } = o, d = e.find((g) => g.id === u), p = e.find((g) => g.id === h), y = LD(f.lineType), m = Mg(f.type1), _ = Mg(f.type2), T = Pb(r[l]), v = zb(T.startX, T.startY, T.endX, T.endY, {
      strokeStyle: y,
      startArrowhead: m,
      endArrowhead: _,
      label: o.title ? { text: o.title } : void 0,
      start: { type: "rectangle", id: d.id },
      end: { type: "rectangle", id: p.id }
    }), A = BD(i, v);
    s.push(A);
    const { relationTitle1: L, relationTitle2: w } = o, b = 20, F = 15, S = 15;
    let x, C;
    if (L && L !== "none") {
      switch (i) {
        case "TB":
          x = A.startX - b, A.endX < A.startX && (x -= S), C = A.startY + F;
          break;
        case "BT":
          x = A.startX + b, A.endX > A.startX && (x += S), C = A.startY - F;
          break;
        case "LR":
          x = A.startX + b, C = A.startY + F, A.endY > A.startY && (C += S);
          break;
        case "RL":
          x = A.startX - b, C = A.startY - F, A.startY > A.endY && (C -= S);
          break;
        default:
          x = A.startX - b, C = A.startY + F;
      }
      const g = t1(x, C, L, {
        fontSize: 16
      });
      a.push(g);
    }
    if (w && w !== "none") {
      switch (i) {
        case "TB":
          x = A.endX + b, A.endX < A.startX && (x += S), C = A.endY - F;
          break;
        case "BT":
          x = A.endX - b, A.endX > A.startX && (x -= S), C = A.endY + F;
          break;
        case "LR":
          x = A.endX - b, C = A.endY - F, A.endY > A.startY && (C -= S);
          break;
        case "RL":
          x = A.endX + b, C = A.endY + F, A.startY > A.endY && (C += S);
          break;
        default:
          x = A.endX + b, C = A.endY - F;
      }
      const g = t1(x, C, w, {
        fontSize: 16
      });
      a.push(g);
    }
  }), { arrows: s, text: a };
}, ND = (t, e, n) => {
  const i = [], r = [];
  return t.forEach((s) => {
    const { id: a, text: o, class: l } = s, u = e.querySelector(`#${a}`);
    if (!u)
      throw new Error(`Node with id ${a} not found!`);
    const { transformX: h, transformY: f } = oa(u), d = u.firstChild, p = Ui(d, "rectangle", {
      id: a,
      subtype: "note",
      label: { text: o }
    });
    if (Object.assign(p, {
      x: p.x + h,
      y: p.y + f
    }), i.push(p), l) {
      const y = n.find((L) => L.id === l);
      if (!y)
        throw new Error(`class node with id ${l} not found!`);
      const m = p.x + (p.width || 0) / 2, _ = p.y + (p.height || 0), T = m, v = y.y, A = zb(m, _, T, v, {
        strokeStyle: "dotted",
        startArrowhead: null,
        endArrowhead: null,
        start: { id: p.id, type: "rectangle" },
        end: { id: y.id, type: "rectangle" }
      });
      r.push(A);
    }
  }), { notes: i, connectors: r };
}, FD = (t, e) => {
  t.parse();
  const n = t.parser.yy, i = n.getDirection(), r = [], s = [], a = [], o = [], l = n.getNamespaces(), u = n.getClasses();
  if (Object.keys(u).length) {
    const m = ID(u, e);
    r.push(m.nodes), s.push(...m.lines), a.push(...m.text), o.push(...m.nodes);
  }
  const h = n.getRelations(), { arrows: f, text: d } = DD(h, o, e, i), { notes: p, connectors: y } = ND(n.getNotes(), e, o);
  return r.push(p), f.push(...y), a.push(...d), { type: "class", nodes: r, lines: s, arrows: f, text: a, namespaces: l };
}, OD = (t) => {
  const e = t.querySelector("svg");
  if (!e)
    throw new Error("SVG element not found");
  const n = e.getBoundingClientRect(), i = n.width, r = n.height;
  e.setAttribute("width", `${i}`), e.setAttribute("height", `${r}`);
  const s = "image/svg+xml", a = unescape(encodeURIComponent(e.outerHTML)), l = `data:image/svg+xml;base64,${btoa(a)}`;
  return {
    type: "graphImage",
    mimeType: s,
    dataURL: l,
    width: i,
    height: r
  };
}, RD = async (t, e = J0) => {
  zn.initialize({ ...J0, ...e });
  const n = await zn.mermaidAPI.getDiagramFromText(fD(t)), { svg: i } = await zn.render("mermaid-to-excalidraw", t), r = document.createElement("div");
  r.setAttribute("style", "opacity: 0; position: relative; z-index: -1;"), r.innerHTML = i, r.id = "mermaid-diagram", document.body.appendChild(r);
  let s;
  switch (n.type) {
    case "flowchart-v2": {
      s = xD(n, r);
      break;
    }
    case "sequence": {
      s = AD(n, r);
      break;
    }
    case "classDiagram": {
      s = FD(n, r);
      break;
    }
    // fallback to image if diagram type not-supported
    default:
      s = OD(r);
  }
  return r.remove(), s;
}, KJ = async (t, e) => {
  const n = e || {}, i = parseInt(n.themeVariables?.fontSize ?? "") || Fu, r = await RD(t, {
    ...n,
    themeVariables: {
      ...n.themeVariables,
      // Multiplying by 1.25 to increase the font size by 25% and render correctly in Excalidraw
      fontSize: `${i * 1.25}px`
    }
  });
  return bk(r, {
    fontSize: i
  });
}, oh = (t, e) => {
  const n = t.append("rect");
  if (n.attr("x", e.x), n.attr("y", e.y), n.attr("fill", e.fill), n.attr("stroke", e.stroke), n.attr("width", e.width), n.attr("height", e.height), e.name && n.attr("name", e.name), e.rx !== void 0 && n.attr("rx", e.rx), e.ry !== void 0 && n.attr("ry", e.ry), e.attrs !== void 0)
    for (const i in e.attrs)
      n.attr(i, e.attrs[i]);
  return e.class !== void 0 && n.attr("class", e.class), n;
}, qb = (t, e) => {
  const n = {
    x: e.startx,
    y: e.starty,
    width: e.stopx - e.startx,
    height: e.stopy - e.starty,
    fill: e.fill,
    stroke: e.stroke,
    class: "rect"
  };
  oh(t, n).lower();
}, MD = (t, e) => {
  const n = e.text.replace($a, " "), i = t.append("text");
  i.attr("x", e.x), i.attr("y", e.y), i.attr("class", "legend"), i.style("text-anchor", e.anchor), e.class !== void 0 && i.attr("class", e.class);
  const r = i.append("tspan");
  return r.attr("x", e.x + e.textMargin * 2), r.text(n), i;
}, PD = (t, e, n, i) => {
  const r = t.append("image");
  r.attr("x", e), r.attr("y", n);
  const s = As.sanitizeUrl(i);
  r.attr("xlink:href", s);
}, zD = (t, e, n, i) => {
  const r = t.append("use");
  r.attr("x", e), r.attr("y", n);
  const s = As.sanitizeUrl(i);
  r.attr("xlink:href", `#${s}`);
}, Vs = () => ({
  x: 0,
  y: 0,
  width: 100,
  height: 100,
  fill: "#EDF2AE",
  stroke: "#666",
  anchor: "start",
  rx: 0,
  ry: 0
}), zf = () => ({
  x: 0,
  y: 0,
  width: 100,
  height: 100,
  "text-anchor": "start",
  style: "#666",
  textMargin: 0,
  rx: 0,
  ry: 0,
  tspan: !0
});
var ou = (function() {
  var t = function(mt, pt, dt, ft) {
    for (dt = dt || {}, ft = mt.length; ft--; dt[mt[ft]] = pt)
      ;
    return dt;
  }, e = [1, 24], n = [1, 25], i = [1, 26], r = [1, 27], s = [1, 28], a = [1, 63], o = [1, 64], l = [1, 65], u = [1, 66], h = [1, 67], f = [1, 68], d = [1, 69], p = [1, 29], y = [1, 30], m = [1, 31], _ = [1, 32], T = [1, 33], v = [1, 34], A = [1, 35], L = [1, 36], w = [1, 37], b = [1, 38], F = [1, 39], S = [1, 40], x = [1, 41], C = [1, 42], g = [1, 43], I = [1, 44], k = [1, 45], P = [1, 46], R = [1, 47], M = [1, 48], B = [1, 50], N = [1, 51], D = [1, 52], E = [1, 53], V = [1, 54], nt = [1, 55], O = [1, 56], ct = [1, 57], X = [1, 58], H = [1, 59], it = [1, 60], ot = [14, 42], W = [14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], Z = [12, 14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], q = [1, 82], G = [1, 83], U = [1, 84], ht = [1, 85], Y = [12, 14, 42], wt = [12, 14, 33, 42], J = [12, 14, 33, 42, 76, 77, 79, 80], Ct = [12, 33], Tt = [34, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], $t = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, mermaidDoc: 4, direction: 5, direction_tb: 6, direction_bt: 7, direction_rl: 8, direction_lr: 9, graphConfig: 10, C4_CONTEXT: 11, NEWLINE: 12, statements: 13, EOF: 14, C4_CONTAINER: 15, C4_COMPONENT: 16, C4_DYNAMIC: 17, C4_DEPLOYMENT: 18, otherStatements: 19, diagramStatements: 20, otherStatement: 21, title: 22, accDescription: 23, acc_title: 24, acc_title_value: 25, acc_descr: 26, acc_descr_value: 27, acc_descr_multiline_value: 28, boundaryStatement: 29, boundaryStartStatement: 30, boundaryStopStatement: 31, boundaryStart: 32, LBRACE: 33, ENTERPRISE_BOUNDARY: 34, attributes: 35, SYSTEM_BOUNDARY: 36, BOUNDARY: 37, CONTAINER_BOUNDARY: 38, NODE: 39, NODE_L: 40, NODE_R: 41, RBRACE: 42, diagramStatement: 43, PERSON: 44, PERSON_EXT: 45, SYSTEM: 46, SYSTEM_DB: 47, SYSTEM_QUEUE: 48, SYSTEM_EXT: 49, SYSTEM_EXT_DB: 50, SYSTEM_EXT_QUEUE: 51, CONTAINER: 52, CONTAINER_DB: 53, CONTAINER_QUEUE: 54, CONTAINER_EXT: 55, CONTAINER_EXT_DB: 56, CONTAINER_EXT_QUEUE: 57, COMPONENT: 58, COMPONENT_DB: 59, COMPONENT_QUEUE: 60, COMPONENT_EXT: 61, COMPONENT_EXT_DB: 62, COMPONENT_EXT_QUEUE: 63, REL: 64, BIREL: 65, REL_U: 66, REL_D: 67, REL_L: 68, REL_R: 69, REL_B: 70, REL_INDEX: 71, UPDATE_EL_STYLE: 72, UPDATE_REL_STYLE: 73, UPDATE_LAYOUT_CONFIG: 74, attribute: 75, STR: 76, STR_KEY: 77, STR_VALUE: 78, ATTRIBUTE: 79, ATTRIBUTE_EMPTY: 80, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 6: "direction_tb", 7: "direction_bt", 8: "direction_rl", 9: "direction_lr", 11: "C4_CONTEXT", 12: "NEWLINE", 14: "EOF", 15: "C4_CONTAINER", 16: "C4_COMPONENT", 17: "C4_DYNAMIC", 18: "C4_DEPLOYMENT", 22: "title", 23: "accDescription", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "LBRACE", 34: "ENTERPRISE_BOUNDARY", 36: "SYSTEM_BOUNDARY", 37: "BOUNDARY", 38: "CONTAINER_BOUNDARY", 39: "NODE", 40: "NODE_L", 41: "NODE_R", 42: "RBRACE", 44: "PERSON", 45: "PERSON_EXT", 46: "SYSTEM", 47: "SYSTEM_DB", 48: "SYSTEM_QUEUE", 49: "SYSTEM_EXT", 50: "SYSTEM_EXT_DB", 51: "SYSTEM_EXT_QUEUE", 52: "CONTAINER", 53: "CONTAINER_DB", 54: "CONTAINER_QUEUE", 55: "CONTAINER_EXT", 56: "CONTAINER_EXT_DB", 57: "CONTAINER_EXT_QUEUE", 58: "COMPONENT", 59: "COMPONENT_DB", 60: "COMPONENT_QUEUE", 61: "COMPONENT_EXT", 62: "COMPONENT_EXT_DB", 63: "COMPONENT_EXT_QUEUE", 64: "REL", 65: "BIREL", 66: "REL_U", 67: "REL_D", 68: "REL_L", 69: "REL_R", 70: "REL_B", 71: "REL_INDEX", 72: "UPDATE_EL_STYLE", 73: "UPDATE_REL_STYLE", 74: "UPDATE_LAYOUT_CONFIG", 76: "STR", 77: "STR_KEY", 78: "STR_VALUE", 79: "ATTRIBUTE", 80: "ATTRIBUTE_EMPTY" },
    productions_: [0, [3, 1], [3, 1], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [13, 1], [13, 1], [13, 2], [19, 1], [19, 2], [19, 3], [21, 1], [21, 1], [21, 2], [21, 2], [21, 1], [29, 3], [30, 3], [30, 3], [30, 4], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [31, 1], [20, 1], [20, 2], [20, 3], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 1], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [35, 1], [35, 2], [75, 1], [75, 2], [75, 1], [75, 1]],
    performAction: function(pt, dt, ft, j, $, et, rt) {
      var ut = et.length - 1;
      switch ($) {
        case 3:
          j.setDirection("TB");
          break;
        case 4:
          j.setDirection("BT");
          break;
        case 5:
          j.setDirection("RL");
          break;
        case 6:
          j.setDirection("LR");
          break;
        case 8:
        case 9:
        case 10:
        case 11:
        case 12:
          j.setC4Type(et[ut - 3]);
          break;
        case 19:
          j.setTitle(et[ut].substring(6)), this.$ = et[ut].substring(6);
          break;
        case 20:
          j.setAccDescription(et[ut].substring(15)), this.$ = et[ut].substring(15);
          break;
        case 21:
          this.$ = et[ut].trim(), j.setTitle(this.$);
          break;
        case 22:
        case 23:
          this.$ = et[ut].trim(), j.setAccDescription(this.$);
          break;
        case 28:
        case 29:
          et[ut].splice(2, 0, "ENTERPRISE"), j.addPersonOrSystemBoundary(...et[ut]), this.$ = et[ut];
          break;
        case 30:
          j.addPersonOrSystemBoundary(...et[ut]), this.$ = et[ut];
          break;
        case 31:
          et[ut].splice(2, 0, "CONTAINER"), j.addContainerBoundary(...et[ut]), this.$ = et[ut];
          break;
        case 32:
          j.addDeploymentNode("node", ...et[ut]), this.$ = et[ut];
          break;
        case 33:
          j.addDeploymentNode("nodeL", ...et[ut]), this.$ = et[ut];
          break;
        case 34:
          j.addDeploymentNode("nodeR", ...et[ut]), this.$ = et[ut];
          break;
        case 35:
          j.popBoundaryParseStack();
          break;
        case 39:
          j.addPersonOrSystem("person", ...et[ut]), this.$ = et[ut];
          break;
        case 40:
          j.addPersonOrSystem("external_person", ...et[ut]), this.$ = et[ut];
          break;
        case 41:
          j.addPersonOrSystem("system", ...et[ut]), this.$ = et[ut];
          break;
        case 42:
          j.addPersonOrSystem("system_db", ...et[ut]), this.$ = et[ut];
          break;
        case 43:
          j.addPersonOrSystem("system_queue", ...et[ut]), this.$ = et[ut];
          break;
        case 44:
          j.addPersonOrSystem("external_system", ...et[ut]), this.$ = et[ut];
          break;
        case 45:
          j.addPersonOrSystem("external_system_db", ...et[ut]), this.$ = et[ut];
          break;
        case 46:
          j.addPersonOrSystem("external_system_queue", ...et[ut]), this.$ = et[ut];
          break;
        case 47:
          j.addContainer("container", ...et[ut]), this.$ = et[ut];
          break;
        case 48:
          j.addContainer("container_db", ...et[ut]), this.$ = et[ut];
          break;
        case 49:
          j.addContainer("container_queue", ...et[ut]), this.$ = et[ut];
          break;
        case 50:
          j.addContainer("external_container", ...et[ut]), this.$ = et[ut];
          break;
        case 51:
          j.addContainer("external_container_db", ...et[ut]), this.$ = et[ut];
          break;
        case 52:
          j.addContainer("external_container_queue", ...et[ut]), this.$ = et[ut];
          break;
        case 53:
          j.addComponent("component", ...et[ut]), this.$ = et[ut];
          break;
        case 54:
          j.addComponent("component_db", ...et[ut]), this.$ = et[ut];
          break;
        case 55:
          j.addComponent("component_queue", ...et[ut]), this.$ = et[ut];
          break;
        case 56:
          j.addComponent("external_component", ...et[ut]), this.$ = et[ut];
          break;
        case 57:
          j.addComponent("external_component_db", ...et[ut]), this.$ = et[ut];
          break;
        case 58:
          j.addComponent("external_component_queue", ...et[ut]), this.$ = et[ut];
          break;
        case 60:
          j.addRel("rel", ...et[ut]), this.$ = et[ut];
          break;
        case 61:
          j.addRel("birel", ...et[ut]), this.$ = et[ut];
          break;
        case 62:
          j.addRel("rel_u", ...et[ut]), this.$ = et[ut];
          break;
        case 63:
          j.addRel("rel_d", ...et[ut]), this.$ = et[ut];
          break;
        case 64:
          j.addRel("rel_l", ...et[ut]), this.$ = et[ut];
          break;
        case 65:
          j.addRel("rel_r", ...et[ut]), this.$ = et[ut];
          break;
        case 66:
          j.addRel("rel_b", ...et[ut]), this.$ = et[ut];
          break;
        case 67:
          et[ut].splice(0, 1), j.addRel("rel", ...et[ut]), this.$ = et[ut];
          break;
        case 68:
          j.updateElStyle("update_el_style", ...et[ut]), this.$ = et[ut];
          break;
        case 69:
          j.updateRelStyle("update_rel_style", ...et[ut]), this.$ = et[ut];
          break;
        case 70:
          j.updateLayoutConfig("update_layout_config", ...et[ut]), this.$ = et[ut];
          break;
        case 71:
          this.$ = [et[ut]];
          break;
        case 72:
          et[ut].unshift(et[ut - 1]), this.$ = et[ut];
          break;
        case 73:
        case 75:
          this.$ = et[ut].trim();
          break;
        case 74:
          let Kt = {};
          Kt[et[ut - 1].trim()] = et[ut].trim(), this.$ = Kt;
          break;
        case 76:
          this.$ = "";
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 7: [1, 6], 8: [1, 7], 9: [1, 8], 10: 4, 11: [1, 9], 15: [1, 10], 16: [1, 11], 17: [1, 12], 18: [1, 13] }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 7] }, { 1: [2, 3] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 12: [1, 14] }, { 12: [1, 15] }, { 12: [1, 16] }, { 12: [1, 17] }, { 12: [1, 18] }, { 13: 19, 19: 20, 20: 21, 21: 22, 22: e, 23: n, 24: i, 26: r, 28: s, 29: 49, 30: 61, 32: 62, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 43: 23, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }, { 13: 70, 19: 20, 20: 21, 21: 22, 22: e, 23: n, 24: i, 26: r, 28: s, 29: 49, 30: 61, 32: 62, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 43: 23, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }, { 13: 71, 19: 20, 20: 21, 21: 22, 22: e, 23: n, 24: i, 26: r, 28: s, 29: 49, 30: 61, 32: 62, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 43: 23, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }, { 13: 72, 19: 20, 20: 21, 21: 22, 22: e, 23: n, 24: i, 26: r, 28: s, 29: 49, 30: 61, 32: 62, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 43: 23, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }, { 13: 73, 19: 20, 20: 21, 21: 22, 22: e, 23: n, 24: i, 26: r, 28: s, 29: 49, 30: 61, 32: 62, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 43: 23, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }, { 14: [1, 74] }, t(ot, [2, 13], { 43: 23, 29: 49, 30: 61, 32: 62, 20: 75, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }), t(ot, [2, 14]), t(W, [2, 16], { 12: [1, 76] }), t(ot, [2, 36], { 12: [1, 77] }), t(Z, [2, 19]), t(Z, [2, 20]), { 25: [1, 78] }, { 27: [1, 79] }, t(Z, [2, 23]), { 35: 80, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 86, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 87, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 88, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 89, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 90, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 91, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 92, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 93, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 94, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 95, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 96, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 97, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 98, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 99, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 100, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 101, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 102, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 103, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 104, 75: 81, 76: q, 77: G, 79: U, 80: ht }, t(Y, [2, 59]), { 35: 105, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 106, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 107, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 108, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 109, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 110, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 111, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 112, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 113, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 114, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 115, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 20: 116, 29: 49, 30: 61, 32: 62, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 43: 23, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }, { 12: [1, 118], 33: [1, 117] }, { 35: 119, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 120, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 121, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 122, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 123, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 124, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 35: 125, 75: 81, 76: q, 77: G, 79: U, 80: ht }, { 14: [1, 126] }, { 14: [1, 127] }, { 14: [1, 128] }, { 14: [1, 129] }, { 1: [2, 8] }, t(ot, [2, 15]), t(W, [2, 17], { 21: 22, 19: 130, 22: e, 23: n, 24: i, 26: r, 28: s }), t(ot, [2, 37], { 19: 20, 20: 21, 21: 22, 43: 23, 29: 49, 30: 61, 32: 62, 13: 131, 22: e, 23: n, 24: i, 26: r, 28: s, 34: a, 36: o, 37: l, 38: u, 39: h, 40: f, 41: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A, 51: L, 52: w, 53: b, 54: F, 55: S, 56: x, 57: C, 58: g, 59: I, 60: k, 61: P, 62: R, 63: M, 64: B, 65: N, 66: D, 67: E, 68: V, 69: nt, 70: O, 71: ct, 72: X, 73: H, 74: it }), t(Z, [2, 21]), t(Z, [2, 22]), t(Y, [2, 39]), t(wt, [2, 71], { 75: 81, 35: 132, 76: q, 77: G, 79: U, 80: ht }), t(J, [2, 73]), { 78: [1, 133] }, t(J, [2, 75]), t(J, [2, 76]), t(Y, [2, 40]), t(Y, [2, 41]), t(Y, [2, 42]), t(Y, [2, 43]), t(Y, [2, 44]), t(Y, [2, 45]), t(Y, [2, 46]), t(Y, [2, 47]), t(Y, [2, 48]), t(Y, [2, 49]), t(Y, [2, 50]), t(Y, [2, 51]), t(Y, [2, 52]), t(Y, [2, 53]), t(Y, [2, 54]), t(Y, [2, 55]), t(Y, [2, 56]), t(Y, [2, 57]), t(Y, [2, 58]), t(Y, [2, 60]), t(Y, [2, 61]), t(Y, [2, 62]), t(Y, [2, 63]), t(Y, [2, 64]), t(Y, [2, 65]), t(Y, [2, 66]), t(Y, [2, 67]), t(Y, [2, 68]), t(Y, [2, 69]), t(Y, [2, 70]), { 31: 134, 42: [1, 135] }, { 12: [1, 136] }, { 33: [1, 137] }, t(Ct, [2, 28]), t(Ct, [2, 29]), t(Ct, [2, 30]), t(Ct, [2, 31]), t(Ct, [2, 32]), t(Ct, [2, 33]), t(Ct, [2, 34]), { 1: [2, 9] }, { 1: [2, 10] }, { 1: [2, 11] }, { 1: [2, 12] }, t(W, [2, 18]), t(ot, [2, 38]), t(wt, [2, 72]), t(J, [2, 74]), t(Y, [2, 24]), t(Y, [2, 35]), t(Tt, [2, 25]), t(Tt, [2, 26], { 12: [1, 138] }), t(Tt, [2, 27])],
    defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 7], 5: [2, 3], 6: [2, 4], 7: [2, 5], 8: [2, 6], 74: [2, 8], 126: [2, 9], 127: [2, 10], 128: [2, 11], 129: [2, 12] },
    parseError: function(pt, dt) {
      if (dt.recoverable)
        this.trace(pt);
      else {
        var ft = new Error(pt);
        throw ft.hash = dt, ft;
      }
    },
    parse: function(pt) {
      var dt = this, ft = [0], j = [], $ = [null], et = [], rt = this.table, ut = "", Kt = 0, Zt = 0, Qt = 2, Mt = 1, ne = et.slice.call(arguments, 1), Bt = Object.create(this.lexer), Te = { yy: {} };
      for (var ie in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, ie) && (Te.yy[ie] = this.yy[ie]);
      Bt.setInput(pt, Te.yy), Te.yy.lexer = Bt, Te.yy.parser = this, typeof Bt.yylloc > "u" && (Bt.yylloc = {});
      var Bi = Bt.yylloc;
      et.push(Bi);
      var Ar = Bt.options && Bt.options.ranges;
      typeof Te.yy.parseError == "function" ? this.parseError = Te.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function Jt() {
        var fe;
        return fe = j.pop() || Bt.lex() || Mt, typeof fe != "number" && (fe instanceof Array && (j = fe, fe = j.pop()), fe = dt.symbols_[fe] || fe), fe;
      }
      for (var se, xe, jt, he, Vt = {}, re, oe, Xt, Wt; ; ) {
        if (xe = ft[ft.length - 1], this.defaultActions[xe] ? jt = this.defaultActions[xe] : ((se === null || typeof se > "u") && (se = Jt()), jt = rt[xe] && rt[xe][se]), typeof jt > "u" || !jt.length || !jt[0]) {
          var Pt = "";
          Wt = [];
          for (re in rt[xe])
            this.terminals_[re] && re > Qt && Wt.push("'" + this.terminals_[re] + "'");
          Bt.showPosition ? Pt = "Parse error on line " + (Kt + 1) + `:
` + Bt.showPosition() + `
Expecting ` + Wt.join(", ") + ", got '" + (this.terminals_[se] || se) + "'" : Pt = "Parse error on line " + (Kt + 1) + ": Unexpected " + (se == Mt ? "end of input" : "'" + (this.terminals_[se] || se) + "'"), this.parseError(Pt, {
            text: Bt.match,
            token: this.terminals_[se] || se,
            line: Bt.yylineno,
            loc: Bi,
            expected: Wt
          });
        }
        if (jt[0] instanceof Array && jt.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + xe + ", token: " + se);
        switch (jt[0]) {
          case 1:
            ft.push(se), $.push(Bt.yytext), et.push(Bt.yylloc), ft.push(jt[1]), se = null, Zt = Bt.yyleng, ut = Bt.yytext, Kt = Bt.yylineno, Bi = Bt.yylloc;
            break;
          case 2:
            if (oe = this.productions_[jt[1]][1], Vt.$ = $[$.length - oe], Vt._$ = {
              first_line: et[et.length - (oe || 1)].first_line,
              last_line: et[et.length - 1].last_line,
              first_column: et[et.length - (oe || 1)].first_column,
              last_column: et[et.length - 1].last_column
            }, Ar && (Vt._$.range = [
              et[et.length - (oe || 1)].range[0],
              et[et.length - 1].range[1]
            ]), he = this.performAction.apply(Vt, [
              ut,
              Zt,
              Kt,
              Te.yy,
              jt[1],
              $,
              et
            ].concat(ne)), typeof he < "u")
              return he;
            oe && (ft = ft.slice(0, -1 * oe * 2), $ = $.slice(0, -1 * oe), et = et.slice(0, -1 * oe)), ft.push(this.productions_[jt[1]][0]), $.push(Vt.$), et.push(Vt._$), Xt = rt[ft[ft.length - 2]][ft[ft.length - 1]], ft.push(Xt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, Rt = /* @__PURE__ */ (function() {
    var mt = {
      EOF: 1,
      parseError: function(dt, ft) {
        if (this.yy.parser)
          this.yy.parser.parseError(dt, ft);
        else
          throw new Error(dt);
      },
      // resets the lexer, sets new input
      setInput: function(pt, dt) {
        return this.yy = dt || this.yy || {}, this._input = pt, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var pt = this._input[0];
        this.yytext += pt, this.yyleng++, this.offset++, this.match += pt, this.matched += pt;
        var dt = pt.match(/(?:\r\n?|\n).*/g);
        return dt ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), pt;
      },
      // unshifts one char (or a string) into the input
      unput: function(pt) {
        var dt = pt.length, ft = pt.split(/(?:\r\n?|\n)/g);
        this._input = pt + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - dt), this.offset -= dt;
        var j = 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), ft.length - 1 && (this.yylineno -= ft.length - 1);
        var $ = 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: ft ? (ft.length === j.length ? this.yylloc.first_column : 0) + j[j.length - ft.length].length - ft[0].length : this.yylloc.first_column - dt
        }, this.options.ranges && (this.yylloc.range = [$[0], $[0] + this.yyleng - dt]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(pt) {
        this.unput(this.match.slice(pt));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var pt = this.matched.substr(0, this.matched.length - this.match.length);
        return (pt.length > 20 ? "..." : "") + pt.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var pt = this.match;
        return pt.length < 20 && (pt += this._input.substr(0, 20 - pt.length)), (pt.substr(0, 20) + (pt.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var pt = this.pastInput(), dt = new Array(pt.length + 1).join("-");
        return pt + this.upcomingInput() + `
` + dt + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(pt, dt) {
        var ft, j, $;
        if (this.options.backtrack_lexer && ($ = {
          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 && ($.yylloc.range = this.yylloc.range.slice(0))), j = pt[0].match(/(?:\r\n?|\n).*/g), j && (this.yylineno += j.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: j ? j[j.length - 1].length - j[j.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + pt[0].length
        }, this.yytext += pt[0], this.match += pt[0], this.matches = pt, 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(pt[0].length), this.matched += pt[0], ft = this.performAction.call(this, this.yy, this, dt, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), ft)
          return ft;
        if (this._backtrack) {
          for (var et in $)
            this[et] = $[et];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var pt, dt, ft, j;
        this._more || (this.yytext = "", this.match = "");
        for (var $ = this._currentRules(), et = 0; et < $.length; et++)
          if (ft = this._input.match(this.rules[$[et]]), ft && (!dt || ft[0].length > dt[0].length)) {
            if (dt = ft, j = et, this.options.backtrack_lexer) {
              if (pt = this.test_match(ft, $[et]), pt !== !1)
                return pt;
              if (this._backtrack) {
                dt = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return dt ? (pt = this.test_match(dt, $[j]), pt !== !1 ? pt : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var dt = this.next();
        return dt || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(dt) {
        this.conditionStack.push(dt);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var dt = this.conditionStack.length - 1;
        return dt > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(dt) {
        return dt = this.conditionStack.length - 1 - Math.abs(dt || 0), dt >= 0 ? this.conditionStack[dt] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(dt) {
        this.begin(dt);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: {},
      performAction: function(dt, ft, j, $) {
        switch (j) {
          case 0:
            return 6;
          case 1:
            return 7;
          case 2:
            return 8;
          case 3:
            return 9;
          case 4:
            return 22;
          case 5:
            return 23;
          case 6:
            return this.begin("acc_title"), 24;
          case 7:
            return this.popState(), "acc_title_value";
          case 8:
            return this.begin("acc_descr"), 26;
          case 9:
            return this.popState(), "acc_descr_value";
          case 10:
            this.begin("acc_descr_multiline");
            break;
          case 11:
            this.popState();
            break;
          case 12:
            return "acc_descr_multiline_value";
          case 13:
            break;
          case 14:
            c;
            break;
          case 15:
            return 12;
          case 16:
            break;
          case 17:
            return 11;
          case 18:
            return 15;
          case 19:
            return 16;
          case 20:
            return 17;
          case 21:
            return 18;
          case 22:
            return this.begin("person_ext"), 45;
          case 23:
            return this.begin("person"), 44;
          case 24:
            return this.begin("system_ext_queue"), 51;
          case 25:
            return this.begin("system_ext_db"), 50;
          case 26:
            return this.begin("system_ext"), 49;
          case 27:
            return this.begin("system_queue"), 48;
          case 28:
            return this.begin("system_db"), 47;
          case 29:
            return this.begin("system"), 46;
          case 30:
            return this.begin("boundary"), 37;
          case 31:
            return this.begin("enterprise_boundary"), 34;
          case 32:
            return this.begin("system_boundary"), 36;
          case 33:
            return this.begin("container_ext_queue"), 57;
          case 34:
            return this.begin("container_ext_db"), 56;
          case 35:
            return this.begin("container_ext"), 55;
          case 36:
            return this.begin("container_queue"), 54;
          case 37:
            return this.begin("container_db"), 53;
          case 38:
            return this.begin("container"), 52;
          case 39:
            return this.begin("container_boundary"), 38;
          case 40:
            return this.begin("component_ext_queue"), 63;
          case 41:
            return this.begin("component_ext_db"), 62;
          case 42:
            return this.begin("component_ext"), 61;
          case 43:
            return this.begin("component_queue"), 60;
          case 44:
            return this.begin("component_db"), 59;
          case 45:
            return this.begin("component"), 58;
          case 46:
            return this.begin("node"), 39;
          case 47:
            return this.begin("node"), 39;
          case 48:
            return this.begin("node_l"), 40;
          case 49:
            return this.begin("node_r"), 41;
          case 50:
            return this.begin("rel"), 64;
          case 51:
            return this.begin("birel"), 65;
          case 52:
            return this.begin("rel_u"), 66;
          case 53:
            return this.begin("rel_u"), 66;
          case 54:
            return this.begin("rel_d"), 67;
          case 55:
            return this.begin("rel_d"), 67;
          case 56:
            return this.begin("rel_l"), 68;
          case 57:
            return this.begin("rel_l"), 68;
          case 58:
            return this.begin("rel_r"), 69;
          case 59:
            return this.begin("rel_r"), 69;
          case 60:
            return this.begin("rel_b"), 70;
          case 61:
            return this.begin("rel_index"), 71;
          case 62:
            return this.begin("update_el_style"), 72;
          case 63:
            return this.begin("update_rel_style"), 73;
          case 64:
            return this.begin("update_layout_config"), 74;
          case 65:
            return "EOF_IN_STRUCT";
          case 66:
            return this.begin("attribute"), "ATTRIBUTE_EMPTY";
          case 67:
            this.begin("attribute");
            break;
          case 68:
            this.popState(), this.popState();
            break;
          case 69:
            return 80;
          case 70:
            break;
          case 71:
            return 80;
          case 72:
            this.begin("string");
            break;
          case 73:
            this.popState();
            break;
          case 74:
            return "STR";
          case 75:
            this.begin("string_kv");
            break;
          case 76:
            return this.begin("string_kv_key"), "STR_KEY";
          case 77:
            this.popState(), this.begin("string_kv_value");
            break;
          case 78:
            return "STR_VALUE";
          case 79:
            this.popState(), this.popState();
            break;
          case 80:
            return "STR";
          case 81:
            return "LBRACE";
          case 82:
            return "RBRACE";
          case 83:
            return "SPACE";
          case 84:
            return "EOL";
          case 85:
            return 14;
        }
      },
      rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:title\s[^#\n;]+)/, /^(?:accDescription\s[^#\n;]+)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:C4Context\b)/, /^(?:C4Container\b)/, /^(?:C4Component\b)/, /^(?:C4Dynamic\b)/, /^(?:C4Deployment\b)/, /^(?:Person_Ext\b)/, /^(?:Person\b)/, /^(?:SystemQueue_Ext\b)/, /^(?:SystemDb_Ext\b)/, /^(?:System_Ext\b)/, /^(?:SystemQueue\b)/, /^(?:SystemDb\b)/, /^(?:System\b)/, /^(?:Boundary\b)/, /^(?:Enterprise_Boundary\b)/, /^(?:System_Boundary\b)/, /^(?:ContainerQueue_Ext\b)/, /^(?:ContainerDb_Ext\b)/, /^(?:Container_Ext\b)/, /^(?:ContainerQueue\b)/, /^(?:ContainerDb\b)/, /^(?:Container\b)/, /^(?:Container_Boundary\b)/, /^(?:ComponentQueue_Ext\b)/, /^(?:ComponentDb_Ext\b)/, /^(?:Component_Ext\b)/, /^(?:ComponentQueue\b)/, /^(?:ComponentDb\b)/, /^(?:Component\b)/, /^(?:Deployment_Node\b)/, /^(?:Node\b)/, /^(?:Node_L\b)/, /^(?:Node_R\b)/, /^(?:Rel\b)/, /^(?:BiRel\b)/, /^(?:Rel_Up\b)/, /^(?:Rel_U\b)/, /^(?:Rel_Down\b)/, /^(?:Rel_D\b)/, /^(?:Rel_Left\b)/, /^(?:Rel_L\b)/, /^(?:Rel_Right\b)/, /^(?:Rel_R\b)/, /^(?:Rel_Back\b)/, /^(?:RelIndex\b)/, /^(?:UpdateElementStyle\b)/, /^(?:UpdateRelStyle\b)/, /^(?:UpdateLayoutConfig\b)/, /^(?:$)/, /^(?:[(][ ]*[,])/, /^(?:[(])/, /^(?:[)])/, /^(?:,,)/, /^(?:,)/, /^(?:[ ]*["]["])/, /^(?:[ ]*["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:[ ]*[\$])/, /^(?:[^=]*)/, /^(?:[=][ ]*["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:[^,]+)/, /^(?:\{)/, /^(?:\})/, /^(?:[\s]+)/, /^(?:[\n\r]+)/, /^(?:$)/],
      conditions: { acc_descr_multiline: { rules: [11, 12], inclusive: !1 }, acc_descr: { rules: [9], inclusive: !1 }, acc_title: { rules: [7], inclusive: !1 }, string_kv_value: { rules: [78, 79], inclusive: !1 }, string_kv_key: { rules: [77], inclusive: !1 }, string_kv: { rules: [76], inclusive: !1 }, string: { rules: [73, 74], inclusive: !1 }, attribute: { rules: [68, 69, 70, 71, 72, 75, 80], inclusive: !1 }, update_layout_config: { rules: [65, 66, 67, 68], inclusive: !1 }, update_rel_style: { rules: [65, 66, 67, 68], inclusive: !1 }, update_el_style: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_b: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_r: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_l: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_d: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_u: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_bi: { rules: [], inclusive: !1 }, rel: { rules: [65, 66, 67, 68], inclusive: !1 }, node_r: { rules: [65, 66, 67, 68], inclusive: !1 }, node_l: { rules: [65, 66, 67, 68], inclusive: !1 }, node: { rules: [65, 66, 67, 68], inclusive: !1 }, index: { rules: [], inclusive: !1 }, rel_index: { rules: [65, 66, 67, 68], inclusive: !1 }, component_ext_queue: { rules: [], inclusive: !1 }, component_ext_db: { rules: [65, 66, 67, 68], inclusive: !1 }, component_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, component_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, component_db: { rules: [65, 66, 67, 68], inclusive: !1 }, component: { rules: [65, 66, 67, 68], inclusive: !1 }, container_boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, container_ext_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, container_ext_db: { rules: [65, 66, 67, 68], inclusive: !1 }, container_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, container_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, container_db: { rules: [65, 66, 67, 68], inclusive: !1 }, container: { rules: [65, 66, 67, 68], inclusive: !1 }, birel: { rules: [65, 66, 67, 68], inclusive: !1 }, system_boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, enterprise_boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, system_ext_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, system_ext_db: { rules: [65, 66, 67, 68], inclusive: !1 }, system_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, system_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, system_db: { rules: [65, 66, 67, 68], inclusive: !1 }, system: { rules: [65, 66, 67, 68], inclusive: !1 }, person_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, person: { rules: [65, 66, 67, 68], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 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, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 81, 82, 83, 84, 85], inclusive: !0 } }
    };
    return mt;
  })();
  $t.lexer = Rt;
  function te() {
    this.yy = {};
  }
  return te.prototype = $t, $t.Parser = te, new te();
})();
ou.parser = ou;
const VD = ou;
let Ai = [], Pr = [""], _n = "global", Ei = "", Hi = [
  {
    alias: "global",
    label: { text: "global" },
    type: { text: "global" },
    tags: null,
    link: null,
    parentBoundary: ""
  }
], Jo = [], Vf = "", qf = !1, lu = 4, cu = 2;
var $b;
const qD = function() {
  return $b;
}, $D = function(t) {
  $b = Ne(t, Q());
}, YD = function(t, e, n, i, r, s, a, o, l) {
  if (t == null || e === void 0 || e === null || n === void 0 || n === null || i === void 0 || i === null)
    return;
  let u = {};
  const h = Jo.find((f) => f.from === e && f.to === n);
  if (h ? u = h : Jo.push(u), u.type = t, u.from = e, u.to = n, u.label = { text: i }, r == null)
    u.techn = { text: "" };
  else if (typeof r == "object") {
    let [f, d] = Object.entries(r)[0];
    u[f] = { text: d };
  } else
    u.techn = { text: r };
  if (s == null)
    u.descr = { text: "" };
  else if (typeof s == "object") {
    let [f, d] = Object.entries(s)[0];
    u[f] = { text: d };
  } else
    u.descr = { text: s };
  if (typeof a == "object") {
    let [f, d] = Object.entries(a)[0];
    u[f] = d;
  } else
    u.sprite = a;
  if (typeof o == "object") {
    let [f, d] = Object.entries(o)[0];
    u[f] = d;
  } else
    u.tags = o;
  if (typeof l == "object") {
    let [f, d] = Object.entries(l)[0];
    u[f] = d;
  } else
    u.link = l;
  u.wrap = Ur();
}, WD = function(t, e, n, i, r, s, a) {
  if (e === null || n === null)
    return;
  let o = {};
  const l = Ai.find((u) => u.alias === e);
  if (l && e === l.alias ? o = l : (o.alias = e, Ai.push(o)), n == null ? o.label = { text: "" } : o.label = { text: n }, i == null)
    o.descr = { text: "" };
  else if (typeof i == "object") {
    let [u, h] = Object.entries(i)[0];
    o[u] = { text: h };
  } else
    o.descr = { text: i };
  if (typeof r == "object") {
    let [u, h] = Object.entries(r)[0];
    o[u] = h;
  } else
    o.sprite = r;
  if (typeof s == "object") {
    let [u, h] = Object.entries(s)[0];
    o[u] = h;
  } else
    o.tags = s;
  if (typeof a == "object") {
    let [u, h] = Object.entries(a)[0];
    o[u] = h;
  } else
    o.link = a;
  o.typeC4Shape = { text: t }, o.parentBoundary = _n, o.wrap = Ur();
}, UD = function(t, e, n, i, r, s, a, o) {
  if (e === null || n === null)
    return;
  let l = {};
  const u = Ai.find((h) => h.alias === e);
  if (u && e === u.alias ? l = u : (l.alias = e, Ai.push(l)), n == null ? l.label = { text: "" } : l.label = { text: n }, i == null)
    l.techn = { text: "" };
  else if (typeof i == "object") {
    let [h, f] = Object.entries(i)[0];
    l[h] = { text: f };
  } else
    l.techn = { text: i };
  if (r == null)
    l.descr = { text: "" };
  else if (typeof r == "object") {
    let [h, f] = Object.entries(r)[0];
    l[h] = { text: f };
  } else
    l.descr = { text: r };
  if (typeof s == "object") {
    let [h, f] = Object.entries(s)[0];
    l[h] = f;
  } else
    l.sprite = s;
  if (typeof a == "object") {
    let [h, f] = Object.entries(a)[0];
    l[h] = f;
  } else
    l.tags = a;
  if (typeof o == "object") {
    let [h, f] = Object.entries(o)[0];
    l[h] = f;
  } else
    l.link = o;
  l.wrap = Ur(), l.typeC4Shape = { text: t }, l.parentBoundary = _n;
}, HD = function(t, e, n, i, r, s, a, o) {
  if (e === null || n === null)
    return;
  let l = {};
  const u = Ai.find((h) => h.alias === e);
  if (u && e === u.alias ? l = u : (l.alias = e, Ai.push(l)), n == null ? l.label = { text: "" } : l.label = { text: n }, i == null)
    l.techn = { text: "" };
  else if (typeof i == "object") {
    let [h, f] = Object.entries(i)[0];
    l[h] = { text: f };
  } else
    l.techn = { text: i };
  if (r == null)
    l.descr = { text: "" };
  else if (typeof r == "object") {
    let [h, f] = Object.entries(r)[0];
    l[h] = { text: f };
  } else
    l.descr = { text: r };
  if (typeof s == "object") {
    let [h, f] = Object.entries(s)[0];
    l[h] = f;
  } else
    l.sprite = s;
  if (typeof a == "object") {
    let [h, f] = Object.entries(a)[0];
    l[h] = f;
  } else
    l.tags = a;
  if (typeof o == "object") {
    let [h, f] = Object.entries(o)[0];
    l[h] = f;
  } else
    l.link = o;
  l.wrap = Ur(), l.typeC4Shape = { text: t }, l.parentBoundary = _n;
}, GD = function(t, e, n, i, r) {
  if (t === null || e === null)
    return;
  let s = {};
  const a = Hi.find((o) => o.alias === t);
  if (a && t === a.alias ? s = a : (s.alias = t, Hi.push(s)), e == null ? s.label = { text: "" } : s.label = { text: e }, n == null)
    s.type = { text: "system" };
  else if (typeof n == "object") {
    let [o, l] = Object.entries(n)[0];
    s[o] = { text: l };
  } else
    s.type = { text: n };
  if (typeof i == "object") {
    let [o, l] = Object.entries(i)[0];
    s[o] = l;
  } else
    s.tags = i;
  if (typeof r == "object") {
    let [o, l] = Object.entries(r)[0];
    s[o] = l;
  } else
    s.link = r;
  s.parentBoundary = _n, s.wrap = Ur(), Ei = _n, _n = t, Pr.push(Ei);
}, jD = function(t, e, n, i, r) {
  if (t === null || e === null)
    return;
  let s = {};
  const a = Hi.find((o) => o.alias === t);
  if (a && t === a.alias ? s = a : (s.alias = t, Hi.push(s)), e == null ? s.label = { text: "" } : s.label = { text: e }, n == null)
    s.type = { text: "container" };
  else if (typeof n == "object") {
    let [o, l] = Object.entries(n)[0];
    s[o] = { text: l };
  } else
    s.type = { text: n };
  if (typeof i == "object") {
    let [o, l] = Object.entries(i)[0];
    s[o] = l;
  } else
    s.tags = i;
  if (typeof r == "object") {
    let [o, l] = Object.entries(r)[0];
    s[o] = l;
  } else
    s.link = r;
  s.parentBoundary = _n, s.wrap = Ur(), Ei = _n, _n = t, Pr.push(Ei);
}, XD = function(t, e, n, i, r, s, a, o) {
  if (e === null || n === null)
    return;
  let l = {};
  const u = Hi.find((h) => h.alias === e);
  if (u && e === u.alias ? l = u : (l.alias = e, Hi.push(l)), n == null ? l.label = { text: "" } : l.label = { text: n }, i == null)
    l.type = { text: "node" };
  else if (typeof i == "object") {
    let [h, f] = Object.entries(i)[0];
    l[h] = { text: f };
  } else
    l.type = { text: i };
  if (r == null)
    l.descr = { text: "" };
  else if (typeof r == "object") {
    let [h, f] = Object.entries(r)[0];
    l[h] = { text: f };
  } else
    l.descr = { text: r };
  if (typeof a == "object") {
    let [h, f] = Object.entries(a)[0];
    l[h] = f;
  } else
    l.tags = a;
  if (typeof o == "object") {
    let [h, f] = Object.entries(o)[0];
    l[h] = f;
  } else
    l.link = o;
  l.nodeType = t, l.parentBoundary = _n, l.wrap = Ur(), Ei = _n, _n = e, Pr.push(Ei);
}, KD = function() {
  _n = Ei, Pr.pop(), Ei = Pr.pop(), Pr.push(Ei);
}, QD = function(t, e, n, i, r, s, a, o, l, u, h) {
  let f = Ai.find((d) => d.alias === e);
  if (!(f === void 0 && (f = Hi.find((d) => d.alias === e), f === void 0))) {
    if (n != null)
      if (typeof n == "object") {
        let [d, p] = Object.entries(n)[0];
        f[d] = p;
      } else
        f.bgColor = n;
    if (i != null)
      if (typeof i == "object") {
        let [d, p] = Object.entries(i)[0];
        f[d] = p;
      } else
        f.fontColor = i;
    if (r != null)
      if (typeof r == "object") {
        let [d, p] = Object.entries(r)[0];
        f[d] = p;
      } else
        f.borderColor = r;
    if (s != null)
      if (typeof s == "object") {
        let [d, p] = Object.entries(s)[0];
        f[d] = p;
      } else
        f.shadowing = s;
    if (a != null)
      if (typeof a == "object") {
        let [d, p] = Object.entries(a)[0];
        f[d] = p;
      } else
        f.shape = a;
    if (o != null)
      if (typeof o == "object") {
        let [d, p] = Object.entries(o)[0];
        f[d] = p;
      } else
        f.sprite = o;
    if (l != null)
      if (typeof l == "object") {
        let [d, p] = Object.entries(l)[0];
        f[d] = p;
      } else
        f.techn = l;
    if (u != null)
      if (typeof u == "object") {
        let [d, p] = Object.entries(u)[0];
        f[d] = p;
      } else
        f.legendText = u;
    if (h != null)
      if (typeof h == "object") {
        let [d, p] = Object.entries(h)[0];
        f[d] = p;
      } else
        f.legendSprite = h;
  }
}, ZD = function(t, e, n, i, r, s, a) {
  const o = Jo.find((l) => l.from === e && l.to === n);
  if (o !== void 0) {
    if (i != null)
      if (typeof i == "object") {
        let [l, u] = Object.entries(i)[0];
        o[l] = u;
      } else
        o.textColor = i;
    if (r != null)
      if (typeof r == "object") {
        let [l, u] = Object.entries(r)[0];
        o[l] = u;
      } else
        o.lineColor = r;
    if (s != null)
      if (typeof s == "object") {
        let [l, u] = Object.entries(s)[0];
        o[l] = parseInt(u);
      } else
        o.offsetX = parseInt(s);
    if (a != null)
      if (typeof a == "object") {
        let [l, u] = Object.entries(a)[0];
        o[l] = parseInt(u);
      } else
        o.offsetY = parseInt(a);
  }
}, JD = function(t, e, n) {
  let i = lu, r = cu;
  if (typeof e == "object") {
    const s = Object.values(e)[0];
    i = parseInt(s);
  } else
    i = parseInt(e);
  if (typeof n == "object") {
    const s = Object.values(n)[0];
    r = parseInt(s);
  } else
    r = parseInt(n);
  i >= 1 && (lu = i), r >= 1 && (cu = r);
}, tN = function() {
  return lu;
}, eN = function() {
  return cu;
}, nN = function() {
  return _n;
}, iN = function() {
  return Ei;
}, Yb = function(t) {
  return t == null ? Ai : Ai.filter((e) => e.parentBoundary === t);
}, rN = function(t) {
  return Ai.find((e) => e.alias === t);
}, sN = function(t) {
  return Object.keys(Yb(t));
}, Wb = function(t) {
  return t == null ? Hi : Hi.filter((e) => e.parentBoundary === t);
}, aN = Wb, oN = function() {
  return Jo;
}, lN = function() {
  return Vf;
}, cN = function(t) {
  qf = t;
}, Ur = function() {
  return qf;
}, uN = function() {
  Ai = [], Hi = [
    {
      alias: "global",
      label: { text: "global" },
      type: { text: "global" },
      tags: null,
      link: null,
      parentBoundary: ""
    }
  ], Ei = "", _n = "global", Pr = [""], Jo = [], Pr = [""], Vf = "", qf = !1, lu = 4, cu = 2;
}, hN = {
  SOLID: 0,
  DOTTED: 1,
  NOTE: 2,
  SOLID_CROSS: 3,
  DOTTED_CROSS: 4,
  SOLID_OPEN: 5,
  DOTTED_OPEN: 6,
  LOOP_START: 10,
  LOOP_END: 11,
  ALT_START: 12,
  ALT_ELSE: 13,
  ALT_END: 14,
  OPT_START: 15,
  OPT_END: 16,
  ACTIVE_START: 17,
  ACTIVE_END: 18,
  PAR_START: 19,
  PAR_AND: 20,
  PAR_END: 21,
  RECT_START: 22,
  RECT_END: 23,
  SOLID_POINT: 24,
  DOTTED_POINT: 25
}, dN = {
  FILLED: 0,
  OPEN: 1
}, fN = {
  LEFTOF: 0,
  RIGHTOF: 1,
  OVER: 2
}, pN = function(t) {
  Vf = Ne(t, Q());
}, e1 = {
  addPersonOrSystem: WD,
  addPersonOrSystemBoundary: GD,
  addContainer: UD,
  addContainerBoundary: jD,
  addComponent: HD,
  addDeploymentNode: XD,
  popBoundaryParseStack: KD,
  addRel: YD,
  updateElStyle: QD,
  updateRelStyle: ZD,
  updateLayoutConfig: JD,
  autoWrap: Ur,
  setWrap: cN,
  getC4ShapeArray: Yb,
  getC4Shape: rN,
  getC4ShapeKeys: sN,
  getBoundaries: Wb,
  getBoundarys: aN,
  getCurrentBoundaryParse: nN,
  getParentBoundaryParse: iN,
  getRels: oN,
  getTitle: lN,
  getC4Type: qD,
  getC4ShapeInRow: tN,
  getC4BoundaryInRow: eN,
  setAccTitle: pn,
  getAccTitle: vn,
  getAccDescription: Cn,
  setAccDescription: En,
  getConfig: () => Q().c4,
  clear: uN,
  LINETYPE: hN,
  ARROWTYPE: dN,
  PLACEMENT: fN,
  setTitle: pN,
  setC4Type: $D
  // apply,
}, $f = function(t, e) {
  return oh(t, e);
}, Ub = function(t, e, n, i, r, s) {
  const a = t.append("image");
  a.attr("width", e), a.attr("height", n), a.attr("x", i), a.attr("y", r);
  let o = s.startsWith("data:image/png;base64") ? s : As.sanitizeUrl(s);
  a.attr("xlink:href", o);
}, gN = (t, e, n) => {
  const i = t.append("g");
  let r = 0;
  for (let s of e) {
    let a = s.textColor ? s.textColor : "#444444", o = s.lineColor ? s.lineColor : "#444444", l = s.offsetX ? parseInt(s.offsetX) : 0, u = s.offsetY ? parseInt(s.offsetY) : 0, h = "";
    if (r === 0) {
      let d = i.append("line");
      d.attr("x1", s.startPoint.x), d.attr("y1", s.startPoint.y), d.attr("x2", s.endPoint.x), d.attr("y2", s.endPoint.y), d.attr("stroke-width", "1"), d.attr("stroke", o), d.style("fill", "none"), s.type !== "rel_b" && d.attr("marker-end", "url(" + h + "#arrowhead)"), (s.type === "birel" || s.type === "rel_b") && d.attr("marker-start", "url(" + h + "#arrowend)"), r = -1;
    } else {
      let d = i.append("path");
      d.attr("fill", "none").attr("stroke-width", "1").attr("stroke", o).attr(
        "d",
        "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", s.startPoint.x).replaceAll("starty", s.startPoint.y).replaceAll(
          "controlx",
          s.startPoint.x + (s.endPoint.x - s.startPoint.x) / 2 - (s.endPoint.x - s.startPoint.x) / 4
        ).replaceAll("controly", s.startPoint.y + (s.endPoint.y - s.startPoint.y) / 2).replaceAll("stopx", s.endPoint.x).replaceAll("stopy", s.endPoint.y)
      ), s.type !== "rel_b" && d.attr("marker-end", "url(" + h + "#arrowhead)"), (s.type === "birel" || s.type === "rel_b") && d.attr("marker-start", "url(" + h + "#arrowend)");
    }
    let f = n.messageFont();
    ur(n)(
      s.label.text,
      i,
      Math.min(s.startPoint.x, s.endPoint.x) + Math.abs(s.endPoint.x - s.startPoint.x) / 2 + l,
      Math.min(s.startPoint.y, s.endPoint.y) + Math.abs(s.endPoint.y - s.startPoint.y) / 2 + u,
      s.label.width,
      s.label.height,
      { fill: a },
      f
    ), s.techn && s.techn.text !== "" && (f = n.messageFont(), ur(n)(
      "[" + s.techn.text + "]",
      i,
      Math.min(s.startPoint.x, s.endPoint.x) + Math.abs(s.endPoint.x - s.startPoint.x) / 2 + l,
      Math.min(s.startPoint.y, s.endPoint.y) + Math.abs(s.endPoint.y - s.startPoint.y) / 2 + n.messageFontSize + 5 + u,
      Math.max(s.label.width, s.techn.width),
      s.techn.height,
      { fill: a, "font-style": "italic" },
      f
    ));
  }
}, yN = function(t, e, n) {
  const i = t.append("g");
  let r = e.bgColor ? e.bgColor : "none", s = e.borderColor ? e.borderColor : "#444444", a = e.fontColor ? e.fontColor : "black", o = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" };
  e.nodeType && (o = { "stroke-width": 1 });
  let l = {
    x: e.x,
    y: e.y,
    fill: r,
    stroke: s,
    width: e.width,
    height: e.height,
    rx: 2.5,
    ry: 2.5,
    attrs: o
  };
  $f(i, l);
  let u = n.boundaryFont();
  u.fontWeight = "bold", u.fontSize = u.fontSize + 2, u.fontColor = a, ur(n)(
    e.label.text,
    i,
    e.x,
    e.y + e.label.Y,
    e.width,
    e.height,
    { fill: "#444444" },
    u
  ), e.type && e.type.text !== "" && (u = n.boundaryFont(), u.fontColor = a, ur(n)(
    e.type.text,
    i,
    e.x,
    e.y + e.type.Y,
    e.width,
    e.height,
    { fill: "#444444" },
    u
  )), e.descr && e.descr.text !== "" && (u = n.boundaryFont(), u.fontSize = u.fontSize - 2, u.fontColor = a, ur(n)(
    e.descr.text,
    i,
    e.x,
    e.y + e.descr.Y,
    e.width,
    e.height,
    { fill: "#444444" },
    u
  ));
}, mN = function(t, e, n) {
  var i;
  let r = e.bgColor ? e.bgColor : n[e.typeC4Shape.text + "_bg_color"], s = e.borderColor ? e.borderColor : n[e.typeC4Shape.text + "_border_color"], a = e.fontColor ? e.fontColor : "#FFFFFF", o = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
  switch (e.typeC4Shape.text) {
    case "person":
      o = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII=";
      break;
    case "external_person":
      o = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII=";
      break;
  }
  const l = t.append("g");
  l.attr("class", "person-man");
  const u = Vs();
  switch (e.typeC4Shape.text) {
    case "person":
    case "external_person":
    case "system":
    case "external_system":
    case "container":
    case "external_container":
    case "component":
    case "external_component":
      u.x = e.x, u.y = e.y, u.fill = r, u.width = e.width, u.height = e.height, u.stroke = s, u.rx = 2.5, u.ry = 2.5, u.attrs = { "stroke-width": 0.5 }, $f(l, u);
      break;
    case "system_db":
    case "external_system_db":
    case "container_db":
    case "external_container_db":
    case "component_db":
    case "external_component_db":
      l.append("path").attr("fill", r).attr("stroke-width", "0.5").attr("stroke", s).attr(
        "d",
        "Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx", e.x).replaceAll("starty", e.y).replaceAll("half", e.width / 2).replaceAll("height", e.height)
      ), l.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", s).attr(
        "d",
        "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", e.x).replaceAll("starty", e.y).replaceAll("half", e.width / 2)
      );
      break;
    case "system_queue":
    case "external_system_queue":
    case "container_queue":
    case "external_container_queue":
    case "component_queue":
    case "external_component_queue":
      l.append("path").attr("fill", r).attr("stroke-width", "0.5").attr("stroke", s).attr(
        "d",
        "Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx", e.x).replaceAll("starty", e.y).replaceAll("width", e.width).replaceAll("half", e.height / 2)
      ), l.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", s).attr(
        "d",
        "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", e.x + e.width).replaceAll("starty", e.y).replaceAll("half", e.height / 2)
      );
      break;
  }
  let h = CN(n, e.typeC4Shape.text);
  switch (l.append("text").attr("fill", a).attr("font-family", h.fontFamily).attr("font-size", h.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", e.typeC4Shape.width).attr("x", e.x + e.width / 2 - e.typeC4Shape.width / 2).attr("y", e.y + e.typeC4Shape.Y).text("<<" + e.typeC4Shape.text + ">>"), e.typeC4Shape.text) {
    case "person":
    case "external_person":
      Ub(
        l,
        48,
        48,
        e.x + e.width / 2 - 24,
        e.y + e.image.Y,
        o
      );
      break;
  }
  let f = n[e.typeC4Shape.text + "Font"]();
  return f.fontWeight = "bold", f.fontSize = f.fontSize + 2, f.fontColor = a, ur(n)(
    e.label.text,
    l,
    e.x,
    e.y + e.label.Y,
    e.width,
    e.height,
    { fill: a },
    f
  ), f = n[e.typeC4Shape.text + "Font"](), f.fontColor = a, e.techn && ((i = e.techn) == null ? void 0 : i.text) !== "" ? ur(n)(
    e.techn.text,
    l,
    e.x,
    e.y + e.techn.Y,
    e.width,
    e.height,
    { fill: a, "font-style": "italic" },
    f
  ) : e.type && e.type.text !== "" && ur(n)(
    e.type.text,
    l,
    e.x,
    e.y + e.type.Y,
    e.width,
    e.height,
    { fill: a, "font-style": "italic" },
    f
  ), e.descr && e.descr.text !== "" && (f = n.personFont(), f.fontColor = a, ur(n)(
    e.descr.text,
    l,
    e.x,
    e.y + e.descr.Y,
    e.width,
    e.height,
    { fill: a },
    f
  )), e.height;
}, xN = function(t) {
  t.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
    "d",
    "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
  );
}, bN = function(t) {
  t.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
    "d",
    "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
  );
}, _N = function(t) {
  t.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
    "d",
    "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
  );
}, kN = function(t) {
  t.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
}, TN = function(t) {
  t.append("defs").append("marker").attr("id", "arrowend").attr("refX", 1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z");
}, wN = function(t) {
  t.append("defs").append("marker").attr("id", "filled-head").attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
}, vN = function(t) {
  t.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
}, EN = function(t) {
  const n = t.append("defs").append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4);
  n.append("path").attr("fill", "black").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 9,2 V 6 L16,4 Z"), n.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 0,1 L 6,7 M 6,1 L 0,7");
}, CN = (t, e) => ({
  fontFamily: t[e + "FontFamily"],
  fontSize: t[e + "FontSize"],
  fontWeight: t[e + "FontWeight"]
}), ur = /* @__PURE__ */ (function() {
  function t(r, s, a, o, l, u, h) {
    const f = s.append("text").attr("x", a + l / 2).attr("y", o + u / 2 + 5).style("text-anchor", "middle").text(r);
    i(f, h);
  }
  function e(r, s, a, o, l, u, h, f) {
    const { fontSize: d, fontFamily: p, fontWeight: y } = f, m = r.split(bt.lineBreakRegex);
    for (let _ = 0; _ < m.length; _++) {
      const T = _ * d - d * (m.length - 1) / 2, v = s.append("text").attr("x", a + l / 2).attr("y", o).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", d).style("font-weight", y).style("font-family", p);
      v.append("tspan").attr("dy", T).text(m[_]).attr("alignment-baseline", "mathematical"), i(v, h);
    }
  }
  function n(r, s, a, o, l, u, h, f) {
    const d = s.append("switch"), y = d.append("foreignObject").attr("x", a).attr("y", o).attr("width", l).attr("height", u).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    y.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(r), e(r, d, a, o, l, u, h, f), i(y, h);
  }
  function i(r, s) {
    for (const a in s)
      s.hasOwnProperty(a) && r.attr(a, s[a]);
  }
  return function(r) {
    return r.textPlacement === "fo" ? n : r.textPlacement === "old" ? t : e;
  };
})(), Ri = {
  drawRect: $f,
  drawBoundary: yN,
  drawC4Shape: mN,
  drawRels: gN,
  drawImage: Ub,
  insertArrowHead: kN,
  insertArrowEnd: TN,
  insertArrowFilledHead: wN,
  insertDynamicNumber: vN,
  insertArrowCrossHead: EN,
  insertDatabaseIcon: xN,
  insertComputerIcon: bN,
  insertClockIcon: _N
};
let uu = 0, hu = 0, Hb = 4, n1 = 2;
ou.yy = e1;
let Dt = {};
class Gb {
  constructor(e) {
    this.name = "", this.data = {}, this.data.startx = void 0, this.data.stopx = void 0, this.data.starty = void 0, this.data.stopy = void 0, this.data.widthLimit = void 0, this.nextData = {}, this.nextData.startx = void 0, this.nextData.stopx = void 0, this.nextData.starty = void 0, this.nextData.stopy = void 0, this.nextData.cnt = 0, i1(e.db.getConfig());
  }
  setData(e, n, i, r) {
    this.nextData.startx = this.data.startx = e, this.nextData.stopx = this.data.stopx = n, this.nextData.starty = this.data.starty = i, this.nextData.stopy = this.data.stopy = r;
  }
  updateVal(e, n, i, r) {
    e[n] === void 0 ? e[n] = i : e[n] = r(i, e[n]);
  }
  insert(e) {
    this.nextData.cnt = this.nextData.cnt + 1;
    let n = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + e.margin : this.nextData.stopx + e.margin * 2, i = n + e.width, r = this.nextData.starty + e.margin * 2, s = r + e.height;
    (n >= this.data.widthLimit || i >= this.data.widthLimit || this.nextData.cnt > Hb) && (n = this.nextData.startx + e.margin + Dt.nextLinePaddingX, r = this.nextData.stopy + e.margin * 2, this.nextData.stopx = i = n + e.width, this.nextData.starty = this.nextData.stopy, this.nextData.stopy = s = r + e.height, this.nextData.cnt = 1), e.x = n, e.y = r, this.updateVal(this.data, "startx", n, Math.min), this.updateVal(this.data, "starty", r, Math.min), this.updateVal(this.data, "stopx", i, Math.max), this.updateVal(this.data, "stopy", s, Math.max), this.updateVal(this.nextData, "startx", n, Math.min), this.updateVal(this.nextData, "starty", r, Math.min), this.updateVal(this.nextData, "stopx", i, Math.max), this.updateVal(this.nextData, "stopy", s, Math.max);
  }
  init(e) {
    this.name = "", this.data = {
      startx: void 0,
      stopx: void 0,
      starty: void 0,
      stopy: void 0,
      widthLimit: void 0
    }, this.nextData = {
      startx: void 0,
      stopx: void 0,
      starty: void 0,
      stopy: void 0,
      cnt: 0
    }, i1(e.db.getConfig());
  }
  bumpLastMargin(e) {
    this.data.stopx += e, this.data.stopy += e;
  }
}
const i1 = function(t) {
  Je(Dt, t), t.fontFamily && (Dt.personFontFamily = Dt.systemFontFamily = Dt.messageFontFamily = t.fontFamily), t.fontSize && (Dt.personFontSize = Dt.systemFontSize = Dt.messageFontSize = t.fontSize), t.fontWeight && (Dt.personFontWeight = Dt.systemFontWeight = Dt.messageFontWeight = t.fontWeight);
}, ao = (t, e) => ({
  fontFamily: t[e + "FontFamily"],
  fontSize: t[e + "FontSize"],
  fontWeight: t[e + "FontWeight"]
}), mc = (t) => ({
  fontFamily: t.boundaryFontFamily,
  fontSize: t.boundaryFontSize,
  fontWeight: t.boundaryFontWeight
}), SN = (t) => ({
  fontFamily: t.messageFontFamily,
  fontSize: t.messageFontSize,
  fontWeight: t.messageFontWeight
});
function bi(t, e, n, i, r) {
  if (!e[t].width)
    if (n)
      e[t].text = zx(e[t].text, r, i), e[t].textLines = e[t].text.split(bt.lineBreakRegex).length, e[t].width = r, e[t].height = Zd(e[t].text, i);
    else {
      let s = e[t].text.split(bt.lineBreakRegex);
      e[t].textLines = s.length;
      let a = 0;
      e[t].height = 0, e[t].width = 0;
      for (const o of s)
        e[t].width = Math.max(
          $i(o, i),
          e[t].width
        ), a = Zd(o, i), e[t].height = e[t].height + a;
    }
}
const jb = function(t, e, n) {
  e.x = n.data.startx, e.y = n.data.starty, e.width = n.data.stopx - n.data.startx, e.height = n.data.stopy - n.data.starty, e.label.y = Dt.c4ShapeMargin - 35;
  let i = e.wrap && Dt.wrap, r = mc(Dt);
  r.fontSize = r.fontSize + 2, r.fontWeight = "bold";
  let s = $i(e.label.text, r);
  bi("label", e, i, r, s), Ri.drawBoundary(t, e, Dt);
}, Xb = function(t, e, n, i) {
  let r = 0;
  for (const s of i) {
    r = 0;
    const a = n[s];
    let o = ao(Dt, a.typeC4Shape.text);
    switch (o.fontSize = o.fontSize - 2, a.typeC4Shape.width = $i(
      "«" + a.typeC4Shape.text + "»",
      o
    ), a.typeC4Shape.height = o.fontSize + 2, a.typeC4Shape.Y = Dt.c4ShapePadding, r = a.typeC4Shape.Y + a.typeC4Shape.height - 4, a.image = { width: 0, height: 0, Y: 0 }, a.typeC4Shape.text) {
      case "person":
      case "external_person":
        a.image.width = 48, a.image.height = 48, a.image.Y = r, r = a.image.Y + a.image.height;
        break;
    }
    a.sprite && (a.image.width = 48, a.image.height = 48, a.image.Y = r, r = a.image.Y + a.image.height);
    let l = a.wrap && Dt.wrap, u = Dt.width - Dt.c4ShapePadding * 2, h = ao(Dt, a.typeC4Shape.text);
    if (h.fontSize = h.fontSize + 2, h.fontWeight = "bold", bi("label", a, l, h, u), a.label.Y = r + 8, r = a.label.Y + a.label.height, a.type && a.type.text !== "") {
      a.type.text = "[" + a.type.text + "]";
      let p = ao(Dt, a.typeC4Shape.text);
      bi("type", a, l, p, u), a.type.Y = r + 5, r = a.type.Y + a.type.height;
    } else if (a.techn && a.techn.text !== "") {
      a.techn.text = "[" + a.techn.text + "]";
      let p = ao(Dt, a.techn.text);
      bi("techn", a, l, p, u), a.techn.Y = r + 5, r = a.techn.Y + a.techn.height;
    }
    let f = r, d = a.label.width;
    if (a.descr && a.descr.text !== "") {
      let p = ao(Dt, a.typeC4Shape.text);
      bi("descr", a, l, p, u), a.descr.Y = r + 20, r = a.descr.Y + a.descr.height, d = Math.max(a.label.width, a.descr.width), f = r - a.descr.textLines * 5;
    }
    d = d + Dt.c4ShapePadding, a.width = Math.max(a.width || Dt.width, d, Dt.width), a.height = Math.max(a.height || Dt.height, f, Dt.height), a.margin = a.margin || Dt.c4ShapeMargin, t.insert(a), Ri.drawC4Shape(e, a, Dt);
  }
  t.bumpLastMargin(Dt.c4ShapeMargin);
};
class ti {
  constructor(e, n) {
    this.x = e, this.y = n;
  }
}
let Pg = function(t, e) {
  let n = t.x, i = t.y, r = e.x, s = e.y, a = n + t.width / 2, o = i + t.height / 2, l = Math.abs(n - r), u = Math.abs(i - s), h = u / l, f = t.height / t.width, d = null;
  return i == s && n < r ? d = new ti(n + t.width, o) : i == s && n > r ? d = new ti(n, o) : n == r && i < s ? d = new ti(a, i + t.height) : n == r && i > s && (d = new ti(a, i)), n > r && i < s ? f >= h ? d = new ti(n, o + h * t.width / 2) : d = new ti(
    a - l / u * t.height / 2,
    i + t.height
  ) : n < r && i < s ? f >= h ? d = new ti(n + t.width, o + h * t.width / 2) : d = new ti(
    a + l / u * t.height / 2,
    i + t.height
  ) : n < r && i > s ? f >= h ? d = new ti(n + t.width, o - h * t.width / 2) : d = new ti(a + t.height / 2 * l / u, i) : n > r && i > s && (f >= h ? d = new ti(n, o - t.width / 2 * h) : d = new ti(a - t.height / 2 * l / u, i)), d;
}, AN = function(t, e) {
  let n = { x: 0, y: 0 };
  n.x = e.x + e.width / 2, n.y = e.y + e.height / 2;
  let i = Pg(t, n);
  n.x = t.x + t.width / 2, n.y = t.y + t.height / 2;
  let r = Pg(e, n);
  return { startPoint: i, endPoint: r };
};
const LN = function(t, e, n, i) {
  let r = 0;
  for (let s of e) {
    r = r + 1;
    let a = s.wrap && Dt.wrap, o = SN(Dt);
    i.db.getC4Type() === "C4Dynamic" && (s.label.text = r + ": " + s.label.text);
    let u = $i(s.label.text, o);
    bi("label", s, a, o, u), s.techn && s.techn.text !== "" && (u = $i(s.techn.text, o), bi("techn", s, a, o, u)), s.descr && s.descr.text !== "" && (u = $i(s.descr.text, o), bi("descr", s, a, o, u));
    let h = n(s.from), f = n(s.to), d = AN(h, f);
    s.startPoint = d.startPoint, s.endPoint = d.endPoint;
  }
  Ri.drawRels(t, e, Dt);
};
function Kb(t, e, n, i, r) {
  let s = new Gb(r);
  s.data.widthLimit = n.data.widthLimit / Math.min(n1, i.length);
  for (let [a, o] of i.entries()) {
    let l = 0;
    o.image = { width: 0, height: 0, Y: 0 }, o.sprite && (o.image.width = 48, o.image.height = 48, o.image.Y = l, l = o.image.Y + o.image.height);
    let u = o.wrap && Dt.wrap, h = mc(Dt);
    if (h.fontSize = h.fontSize + 2, h.fontWeight = "bold", bi(
      "label",
      o,
      u,
      h,
      s.data.widthLimit
    ), o.label.Y = l + 8, l = o.label.Y + o.label.height, o.type && o.type.text !== "") {
      o.type.text = "[" + o.type.text + "]";
      let y = mc(Dt);
      bi(
        "type",
        o,
        u,
        y,
        s.data.widthLimit
      ), o.type.Y = l + 5, l = o.type.Y + o.type.height;
    }
    if (o.descr && o.descr.text !== "") {
      let y = mc(Dt);
      y.fontSize = y.fontSize - 2, bi(
        "descr",
        o,
        u,
        y,
        s.data.widthLimit
      ), o.descr.Y = l + 20, l = o.descr.Y + o.descr.height;
    }
    if (a == 0 || a % n1 === 0) {
      let y = n.data.startx + Dt.diagramMarginX, m = n.data.stopy + Dt.diagramMarginY + l;
      s.setData(y, y, m, m);
    } else {
      let y = s.data.stopx !== s.data.startx ? s.data.stopx + Dt.diagramMarginX : s.data.startx, m = s.data.starty;
      s.setData(y, y, m, m);
    }
    s.name = o.alias;
    let f = r.db.getC4ShapeArray(o.alias), d = r.db.getC4ShapeKeys(o.alias);
    d.length > 0 && Xb(
      s,
      t,
      f,
      d
    ), e = o.alias;
    let p = r.db.getBoundarys(e);
    p.length > 0 && Kb(
      t,
      e,
      s,
      p,
      r
    ), o.alias !== "global" && jb(t, o, s), n.data.stopy = Math.max(
      s.data.stopy + Dt.c4ShapeMargin,
      n.data.stopy
    ), n.data.stopx = Math.max(
      s.data.stopx + Dt.c4ShapeMargin,
      n.data.stopx
    ), uu = Math.max(uu, n.data.stopx), hu = Math.max(hu, n.data.stopy);
  }
}
const IN = function(t, e, n, i) {
  Dt = Q().c4;
  const r = Q().securityLevel;
  let s;
  r === "sandbox" && (s = yt("#i" + e));
  const a = yt(r === "sandbox" ? s.nodes()[0].contentDocument.body : "body");
  let o = i.db;
  i.db.setWrap(Dt.wrap), Hb = o.getC4ShapeInRow(), n1 = o.getC4BoundaryInRow(), z.debug(`C:${JSON.stringify(Dt, null, 2)}`);
  const l = r === "sandbox" ? a.select(`[id="${e}"]`) : yt(`[id="${e}"]`);
  Ri.insertComputerIcon(l), Ri.insertDatabaseIcon(l), Ri.insertClockIcon(l);
  let u = new Gb(i);
  u.setData(
    Dt.diagramMarginX,
    Dt.diagramMarginX,
    Dt.diagramMarginY,
    Dt.diagramMarginY
  ), u.data.widthLimit = screen.availWidth, uu = Dt.diagramMarginX, hu = Dt.diagramMarginY;
  const h = i.db.getTitle();
  let f = i.db.getBoundarys("");
  Kb(l, "", u, f, i), Ri.insertArrowHead(l), Ri.insertArrowEnd(l), Ri.insertArrowCrossHead(l), Ri.insertArrowFilledHead(l), LN(l, i.db.getRels(), i.db.getC4Shape, i), u.data.stopx = uu, u.data.stopy = hu;
  const d = u.data;
  let y = d.stopy - d.starty + 2 * Dt.diagramMarginY;
  const _ = d.stopx - d.startx + 2 * Dt.diagramMarginX;
  h && l.append("text").text(h).attr("x", (d.stopx - d.startx) / 2 - 4 * Dt.diagramMarginX).attr("y", d.starty + Dt.diagramMarginY), dn(l, y, _, Dt.useMaxWidth);
  const T = h ? 60 : 0;
  l.attr(
    "viewBox",
    d.startx - Dt.diagramMarginX + " -" + (Dt.diagramMarginY + T) + " " + _ + " " + (y + T)
  ), z.debug("models:", d);
}, zg = {
  drawPersonOrSystemArray: Xb,
  drawBoundary: jb,
  setConf: i1,
  draw: IN
}, BN = (t) => `.person {
    stroke: ${t.personBorder};
    fill: ${t.personBkg};
  }
`, DN = BN, NN = {
  parser: VD,
  db: e1,
  renderer: zg,
  styles: DN,
  init: ({ c4: t, wrap: e }) => {
    zg.setConf(t), e1.setWrap(e);
  }
}, FN = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: NN
}, Symbol.toStringTag, { value: "Module" }));
var r1 = (function() {
  var t = function(pe, Et, Lt, Yt) {
    for (Lt = Lt || {}, Yt = pe.length; Yt--; Lt[pe[Yt]] = Et)
      ;
    return Lt;
  }, e = [1, 4], n = [1, 3], i = [1, 5], r = [1, 8, 9, 10, 11, 27, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], s = [2, 2], a = [1, 13], o = [1, 14], l = [1, 15], u = [1, 16], h = [1, 23], f = [1, 25], d = [1, 26], p = [1, 27], y = [1, 49], m = [1, 48], _ = [1, 29], T = [1, 30], v = [1, 31], A = [1, 32], L = [1, 33], w = [1, 44], b = [1, 46], F = [1, 42], S = [1, 47], x = [1, 43], C = [1, 50], g = [1, 45], I = [1, 51], k = [1, 52], P = [1, 34], R = [1, 35], M = [1, 36], B = [1, 37], N = [1, 57], D = [1, 8, 9, 10, 11, 27, 32, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], E = [1, 61], V = [1, 60], nt = [1, 62], O = [8, 9, 11, 73, 75], ct = [1, 88], X = [1, 93], H = [1, 92], it = [1, 89], ot = [1, 85], W = [1, 91], Z = [1, 87], q = [1, 94], G = [1, 90], U = [1, 95], ht = [1, 86], Y = [8, 9, 10, 11, 73, 75], wt = [8, 9, 10, 11, 44, 73, 75], J = [8, 9, 10, 11, 29, 42, 44, 46, 48, 50, 52, 54, 56, 58, 61, 63, 65, 66, 68, 73, 75, 86, 99, 102, 103, 106, 108, 111, 112, 113], Ct = [8, 9, 11, 42, 58, 73, 75, 86, 99, 102, 103, 106, 108, 111, 112, 113], Tt = [42, 58, 86, 99, 102, 103, 106, 108, 111, 112, 113], $t = [1, 121], Rt = [1, 120], te = [1, 128], mt = [1, 142], pt = [1, 143], dt = [1, 144], ft = [1, 145], j = [1, 130], $ = [1, 132], et = [1, 136], rt = [1, 137], ut = [1, 138], Kt = [1, 139], Zt = [1, 140], Qt = [1, 141], Mt = [1, 146], ne = [1, 147], Bt = [1, 126], Te = [1, 127], ie = [1, 134], Bi = [1, 129], Ar = [1, 133], Jt = [1, 131], se = [8, 9, 10, 11, 27, 32, 34, 36, 38, 42, 58, 81, 82, 83, 84, 85, 86, 99, 102, 103, 106, 108, 111, 112, 113, 118, 119, 120, 121], xe = [1, 149], jt = [8, 9, 11], he = [8, 9, 10, 11, 14, 42, 58, 86, 102, 103, 106, 108, 111, 112, 113], Vt = [1, 169], re = [1, 165], oe = [1, 166], Xt = [1, 170], Wt = [1, 167], Pt = [1, 168], fe = [75, 113, 116], le = [8, 9, 10, 11, 12, 14, 27, 29, 32, 42, 58, 73, 81, 82, 83, 84, 85, 86, 87, 102, 106, 108, 111, 112, 113], Ga = [10, 103], di = [31, 47, 49, 51, 53, 55, 60, 62, 64, 65, 67, 69, 113, 114, 115], Un = [1, 235], Hn = [1, 233], $e = [1, 237], Gn = [1, 231], jn = [1, 232], Xn = [1, 234], Kn = [1, 236], fi = [1, 238], At = [1, 255], st = [8, 9, 11, 103], _t = [8, 9, 10, 11, 58, 81, 102, 103, 106, 107, 108, 109], St = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, graphConfig: 4, document: 5, line: 6, statement: 7, SEMI: 8, NEWLINE: 9, SPACE: 10, EOF: 11, GRAPH: 12, NODIR: 13, DIR: 14, FirstStmtSeparator: 15, ending: 16, endToken: 17, spaceList: 18, spaceListNewline: 19, vertexStatement: 20, separator: 21, styleStatement: 22, linkStyleStatement: 23, classDefStatement: 24, classStatement: 25, clickStatement: 26, subgraph: 27, textNoTags: 28, SQS: 29, text: 30, SQE: 31, end: 32, direction: 33, acc_title: 34, acc_title_value: 35, acc_descr: 36, acc_descr_value: 37, acc_descr_multiline_value: 38, link: 39, node: 40, styledVertex: 41, AMP: 42, vertex: 43, STYLE_SEPARATOR: 44, idString: 45, DOUBLECIRCLESTART: 46, DOUBLECIRCLEEND: 47, PS: 48, PE: 49, "(-": 50, "-)": 51, STADIUMSTART: 52, STADIUMEND: 53, SUBROUTINESTART: 54, SUBROUTINEEND: 55, VERTEX_WITH_PROPS_START: 56, "NODE_STRING[field]": 57, COLON: 58, "NODE_STRING[value]": 59, PIPE: 60, CYLINDERSTART: 61, CYLINDEREND: 62, DIAMOND_START: 63, DIAMOND_STOP: 64, TAGEND: 65, TRAPSTART: 66, TRAPEND: 67, INVTRAPSTART: 68, INVTRAPEND: 69, linkStatement: 70, arrowText: 71, TESTSTR: 72, START_LINK: 73, edgeText: 74, LINK: 75, edgeTextToken: 76, STR: 77, MD_STR: 78, textToken: 79, keywords: 80, STYLE: 81, LINKSTYLE: 82, CLASSDEF: 83, CLASS: 84, CLICK: 85, DOWN: 86, UP: 87, textNoTagsToken: 88, stylesOpt: 89, "idString[vertex]": 90, "idString[class]": 91, CALLBACKNAME: 92, CALLBACKARGS: 93, HREF: 94, LINK_TARGET: 95, "STR[link]": 96, "STR[tooltip]": 97, alphaNum: 98, DEFAULT: 99, numList: 100, INTERPOLATE: 101, NUM: 102, COMMA: 103, style: 104, styleComponent: 105, NODE_STRING: 106, UNIT: 107, BRKT: 108, PCT: 109, idStringToken: 110, MINUS: 111, MULT: 112, UNICODE_TEXT: 113, TEXT: 114, TAGSTART: 115, EDGE_TEXT: 116, alphaNumToken: 117, direction_tb: 118, direction_bt: 119, direction_rl: 120, direction_lr: 121, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 8: "SEMI", 9: "NEWLINE", 10: "SPACE", 11: "EOF", 12: "GRAPH", 13: "NODIR", 14: "DIR", 27: "subgraph", 29: "SQS", 31: "SQE", 32: "end", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 42: "AMP", 44: "STYLE_SEPARATOR", 46: "DOUBLECIRCLESTART", 47: "DOUBLECIRCLEEND", 48: "PS", 49: "PE", 50: "(-", 51: "-)", 52: "STADIUMSTART", 53: "STADIUMEND", 54: "SUBROUTINESTART", 55: "SUBROUTINEEND", 56: "VERTEX_WITH_PROPS_START", 57: "NODE_STRING[field]", 58: "COLON", 59: "NODE_STRING[value]", 60: "PIPE", 61: "CYLINDERSTART", 62: "CYLINDEREND", 63: "DIAMOND_START", 64: "DIAMOND_STOP", 65: "TAGEND", 66: "TRAPSTART", 67: "TRAPEND", 68: "INVTRAPSTART", 69: "INVTRAPEND", 72: "TESTSTR", 73: "START_LINK", 75: "LINK", 77: "STR", 78: "MD_STR", 81: "STYLE", 82: "LINKSTYLE", 83: "CLASSDEF", 84: "CLASS", 85: "CLICK", 86: "DOWN", 87: "UP", 90: "idString[vertex]", 91: "idString[class]", 92: "CALLBACKNAME", 93: "CALLBACKARGS", 94: "HREF", 95: "LINK_TARGET", 96: "STR[link]", 97: "STR[tooltip]", 99: "DEFAULT", 101: "INTERPOLATE", 102: "NUM", 103: "COMMA", 106: "NODE_STRING", 107: "UNIT", 108: "BRKT", 109: "PCT", 111: "MINUS", 112: "MULT", 113: "UNICODE_TEXT", 114: "TEXT", 115: "TAGSTART", 116: "EDGE_TEXT", 118: "direction_tb", 119: "direction_bt", 120: "direction_rl", 121: "direction_lr" },
    productions_: [0, [3, 2], [5, 0], [5, 2], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [4, 2], [4, 2], [4, 2], [4, 3], [16, 2], [16, 1], [17, 1], [17, 1], [17, 1], [15, 1], [15, 1], [15, 2], [19, 2], [19, 2], [19, 1], [19, 1], [18, 2], [18, 1], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 9], [7, 6], [7, 4], [7, 1], [7, 2], [7, 2], [7, 1], [21, 1], [21, 1], [21, 1], [20, 3], [20, 4], [20, 2], [20, 1], [40, 1], [40, 5], [41, 1], [41, 3], [43, 4], [43, 4], [43, 6], [43, 4], [43, 4], [43, 4], [43, 8], [43, 4], [43, 4], [43, 4], [43, 6], [43, 4], [43, 4], [43, 4], [43, 4], [43, 4], [43, 1], [39, 2], [39, 3], [39, 3], [39, 1], [39, 3], [74, 1], [74, 2], [74, 1], [74, 1], [70, 1], [71, 3], [30, 1], [30, 2], [30, 1], [30, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [80, 1], [28, 1], [28, 2], [28, 1], [28, 1], [24, 5], [25, 5], [26, 2], [26, 4], [26, 3], [26, 5], [26, 3], [26, 5], [26, 5], [26, 7], [26, 2], [26, 4], [26, 2], [26, 4], [26, 4], [26, 6], [22, 5], [23, 5], [23, 5], [23, 9], [23, 9], [23, 7], [23, 7], [100, 1], [100, 3], [89, 1], [89, 3], [104, 1], [104, 2], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [105, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [110, 1], [79, 1], [79, 1], [79, 1], [79, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [88, 1], [76, 1], [76, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [117, 1], [45, 1], [45, 2], [98, 1], [98, 2], [33, 1], [33, 1], [33, 1], [33, 1]],
    performAction: function(Et, Lt, Yt, kt, ge, K, ja) {
      var tt = K.length - 1;
      switch (ge) {
        case 2:
          this.$ = [];
          break;
        case 3:
          (!Array.isArray(K[tt]) || K[tt].length > 0) && K[tt - 1].push(K[tt]), this.$ = K[tt - 1];
          break;
        case 4:
        case 176:
          this.$ = K[tt];
          break;
        case 11:
          kt.setDirection("TB"), this.$ = "TB";
          break;
        case 12:
          kt.setDirection(K[tt - 1]), this.$ = K[tt - 1];
          break;
        case 27:
          this.$ = K[tt - 1].nodes;
          break;
        case 28:
        case 29:
        case 30:
        case 31:
        case 32:
          this.$ = [];
          break;
        case 33:
          this.$ = kt.addSubGraph(K[tt - 6], K[tt - 1], K[tt - 4]);
          break;
        case 34:
          this.$ = kt.addSubGraph(K[tt - 3], K[tt - 1], K[tt - 3]);
          break;
        case 35:
          this.$ = kt.addSubGraph(void 0, K[tt - 1], void 0);
          break;
        case 37:
          this.$ = K[tt].trim(), kt.setAccTitle(this.$);
          break;
        case 38:
        case 39:
          this.$ = K[tt].trim(), kt.setAccDescription(this.$);
          break;
        case 43:
          kt.addLink(K[tt - 2].stmt, K[tt], K[tt - 1]), this.$ = { stmt: K[tt], nodes: K[tt].concat(K[tt - 2].nodes) };
          break;
        case 44:
          kt.addLink(K[tt - 3].stmt, K[tt - 1], K[tt - 2]), this.$ = { stmt: K[tt - 1], nodes: K[tt - 1].concat(K[tt - 3].nodes) };
          break;
        case 45:
          this.$ = { stmt: K[tt - 1], nodes: K[tt - 1] };
          break;
        case 46:
          this.$ = { stmt: K[tt], nodes: K[tt] };
          break;
        case 47:
          this.$ = [K[tt]];
          break;
        case 48:
          this.$ = K[tt - 4].concat(K[tt]);
          break;
        case 49:
          this.$ = K[tt];
          break;
        case 50:
          this.$ = K[tt - 2], kt.setClass(K[tt - 2], K[tt]);
          break;
        case 51:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "square");
          break;
        case 52:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "doublecircle");
          break;
        case 53:
          this.$ = K[tt - 5], kt.addVertex(K[tt - 5], K[tt - 2], "circle");
          break;
        case 54:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "ellipse");
          break;
        case 55:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "stadium");
          break;
        case 56:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "subroutine");
          break;
        case 57:
          this.$ = K[tt - 7], kt.addVertex(K[tt - 7], K[tt - 1], "rect", void 0, void 0, void 0, Object.fromEntries([[K[tt - 5], K[tt - 3]]]));
          break;
        case 58:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "cylinder");
          break;
        case 59:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "round");
          break;
        case 60:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "diamond");
          break;
        case 61:
          this.$ = K[tt - 5], kt.addVertex(K[tt - 5], K[tt - 2], "hexagon");
          break;
        case 62:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "odd");
          break;
        case 63:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "trapezoid");
          break;
        case 64:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "inv_trapezoid");
          break;
        case 65:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "lean_right");
          break;
        case 66:
          this.$ = K[tt - 3], kt.addVertex(K[tt - 3], K[tt - 1], "lean_left");
          break;
        case 67:
          this.$ = K[tt], kt.addVertex(K[tt]);
          break;
        case 68:
          K[tt - 1].text = K[tt], this.$ = K[tt - 1];
          break;
        case 69:
        case 70:
          K[tt - 2].text = K[tt - 1], this.$ = K[tt - 2];
          break;
        case 71:
          this.$ = K[tt];
          break;
        case 72:
          var Qn = kt.destructLink(K[tt], K[tt - 2]);
          this.$ = { type: Qn.type, stroke: Qn.stroke, length: Qn.length, text: K[tt - 1] };
          break;
        case 73:
          this.$ = { text: K[tt], type: "text" };
          break;
        case 74:
          this.$ = { text: K[tt - 1].text + "" + K[tt], type: K[tt - 1].type };
          break;
        case 75:
          this.$ = { text: K[tt], type: "string" };
          break;
        case 76:
          this.$ = { text: K[tt], type: "markdown" };
          break;
        case 77:
          var Qn = kt.destructLink(K[tt]);
          this.$ = { type: Qn.type, stroke: Qn.stroke, length: Qn.length };
          break;
        case 78:
          this.$ = K[tt - 1];
          break;
        case 79:
          this.$ = { text: K[tt], type: "text" };
          break;
        case 80:
          this.$ = { text: K[tt - 1].text + "" + K[tt], type: K[tt - 1].type };
          break;
        case 81:
          this.$ = { text: K[tt], type: "string" };
          break;
        case 82:
        case 97:
          this.$ = { text: K[tt], type: "markdown" };
          break;
        case 94:
          this.$ = { text: K[tt], type: "text" };
          break;
        case 95:
          this.$ = { text: K[tt - 1].text + "" + K[tt], type: K[tt - 1].type };
          break;
        case 96:
          this.$ = { text: K[tt], type: "text" };
          break;
        case 98:
          this.$ = K[tt - 4], kt.addClass(K[tt - 2], K[tt]);
          break;
        case 99:
          this.$ = K[tt - 4], kt.setClass(K[tt - 2], K[tt]);
          break;
        case 100:
        case 108:
          this.$ = K[tt - 1], kt.setClickEvent(K[tt - 1], K[tt]);
          break;
        case 101:
        case 109:
          this.$ = K[tt - 3], kt.setClickEvent(K[tt - 3], K[tt - 2]), kt.setTooltip(K[tt - 3], K[tt]);
          break;
        case 102:
          this.$ = K[tt - 2], kt.setClickEvent(K[tt - 2], K[tt - 1], K[tt]);
          break;
        case 103:
          this.$ = K[tt - 4], kt.setClickEvent(K[tt - 4], K[tt - 3], K[tt - 2]), kt.setTooltip(K[tt - 4], K[tt]);
          break;
        case 104:
          this.$ = K[tt - 2], kt.setLink(K[tt - 2], K[tt]);
          break;
        case 105:
          this.$ = K[tt - 4], kt.setLink(K[tt - 4], K[tt - 2]), kt.setTooltip(K[tt - 4], K[tt]);
          break;
        case 106:
          this.$ = K[tt - 4], kt.setLink(K[tt - 4], K[tt - 2], K[tt]);
          break;
        case 107:
          this.$ = K[tt - 6], kt.setLink(K[tt - 6], K[tt - 4], K[tt]), kt.setTooltip(K[tt - 6], K[tt - 2]);
          break;
        case 110:
          this.$ = K[tt - 1], kt.setLink(K[tt - 1], K[tt]);
          break;
        case 111:
          this.$ = K[tt - 3], kt.setLink(K[tt - 3], K[tt - 2]), kt.setTooltip(K[tt - 3], K[tt]);
          break;
        case 112:
          this.$ = K[tt - 3], kt.setLink(K[tt - 3], K[tt - 2], K[tt]);
          break;
        case 113:
          this.$ = K[tt - 5], kt.setLink(K[tt - 5], K[tt - 4], K[tt]), kt.setTooltip(K[tt - 5], K[tt - 2]);
          break;
        case 114:
          this.$ = K[tt - 4], kt.addVertex(K[tt - 2], void 0, void 0, K[tt]);
          break;
        case 115:
          this.$ = K[tt - 4], kt.updateLink([K[tt - 2]], K[tt]);
          break;
        case 116:
          this.$ = K[tt - 4], kt.updateLink(K[tt - 2], K[tt]);
          break;
        case 117:
          this.$ = K[tt - 8], kt.updateLinkInterpolate([K[tt - 6]], K[tt - 2]), kt.updateLink([K[tt - 6]], K[tt]);
          break;
        case 118:
          this.$ = K[tt - 8], kt.updateLinkInterpolate(K[tt - 6], K[tt - 2]), kt.updateLink(K[tt - 6], K[tt]);
          break;
        case 119:
          this.$ = K[tt - 6], kt.updateLinkInterpolate([K[tt - 4]], K[tt]);
          break;
        case 120:
          this.$ = K[tt - 6], kt.updateLinkInterpolate(K[tt - 4], K[tt]);
          break;
        case 121:
        case 123:
          this.$ = [K[tt]];
          break;
        case 122:
        case 124:
          K[tt - 2].push(K[tt]), this.$ = K[tt - 2];
          break;
        case 126:
          this.$ = K[tt - 1] + K[tt];
          break;
        case 174:
          this.$ = K[tt];
          break;
        case 175:
          this.$ = K[tt - 1] + "" + K[tt];
          break;
        case 177:
          this.$ = K[tt - 1] + "" + K[tt];
          break;
        case 178:
          this.$ = { stmt: "dir", value: "TB" };
          break;
        case 179:
          this.$ = { stmt: "dir", value: "BT" };
          break;
        case 180:
          this.$ = { stmt: "dir", value: "RL" };
          break;
        case 181:
          this.$ = { stmt: "dir", value: "LR" };
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 9: e, 10: n, 12: i }, { 1: [3] }, t(r, s, { 5: 6 }), { 4: 7, 9: e, 10: n, 12: i }, { 4: 8, 9: e, 10: n, 12: i }, { 13: [1, 9], 14: [1, 10] }, { 1: [2, 1], 6: 11, 7: 12, 8: a, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 33: 24, 34: f, 36: d, 38: p, 40: 28, 41: 38, 42: y, 43: 39, 45: 40, 58: m, 81: _, 82: T, 83: v, 84: A, 85: L, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k, 118: P, 119: R, 120: M, 121: B }, t(r, [2, 9]), t(r, [2, 10]), t(r, [2, 11]), { 8: [1, 54], 9: [1, 55], 10: N, 15: 53, 18: 56 }, t(D, [2, 3]), t(D, [2, 4]), t(D, [2, 5]), t(D, [2, 6]), t(D, [2, 7]), t(D, [2, 8]), { 8: E, 9: V, 11: nt, 21: 58, 39: 59, 70: 63, 73: [1, 64], 75: [1, 65] }, { 8: E, 9: V, 11: nt, 21: 66 }, { 8: E, 9: V, 11: nt, 21: 67 }, { 8: E, 9: V, 11: nt, 21: 68 }, { 8: E, 9: V, 11: nt, 21: 69 }, { 8: E, 9: V, 11: nt, 21: 70 }, { 8: E, 9: V, 10: [1, 71], 11: nt, 21: 72 }, t(D, [2, 36]), { 35: [1, 73] }, { 37: [1, 74] }, t(D, [2, 39]), t(O, [2, 46], { 18: 75, 10: N }), { 10: [1, 76] }, { 10: [1, 77] }, { 10: [1, 78] }, { 10: [1, 79] }, { 14: ct, 42: X, 58: H, 77: [1, 83], 86: it, 92: [1, 80], 94: [1, 81], 98: 82, 102: ot, 103: W, 106: Z, 108: q, 111: G, 112: U, 113: ht, 117: 84 }, t(D, [2, 178]), t(D, [2, 179]), t(D, [2, 180]), t(D, [2, 181]), t(Y, [2, 47]), t(Y, [2, 49], { 44: [1, 96] }), t(wt, [2, 67], { 110: 109, 29: [1, 97], 42: y, 46: [1, 98], 48: [1, 99], 50: [1, 100], 52: [1, 101], 54: [1, 102], 56: [1, 103], 58: m, 61: [1, 104], 63: [1, 105], 65: [1, 106], 66: [1, 107], 68: [1, 108], 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 111: g, 112: I, 113: k }), t(J, [2, 174]), t(J, [2, 135]), t(J, [2, 136]), t(J, [2, 137]), t(J, [2, 138]), t(J, [2, 139]), t(J, [2, 140]), t(J, [2, 141]), t(J, [2, 142]), t(J, [2, 143]), t(J, [2, 144]), t(J, [2, 145]), t(r, [2, 12]), t(r, [2, 18]), t(r, [2, 19]), { 9: [1, 110] }, t(Ct, [2, 26], { 18: 111, 10: N }), t(D, [2, 27]), { 40: 112, 41: 38, 42: y, 43: 39, 45: 40, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k }, t(D, [2, 40]), t(D, [2, 41]), t(D, [2, 42]), t(Tt, [2, 71], { 71: 113, 60: [1, 115], 72: [1, 114] }), { 74: 116, 76: 117, 77: [1, 118], 78: [1, 119], 113: $t, 116: Rt }, t([42, 58, 60, 72, 86, 99, 102, 103, 106, 108, 111, 112, 113], [2, 77]), t(D, [2, 28]), t(D, [2, 29]), t(D, [2, 30]), t(D, [2, 31]), t(D, [2, 32]), { 10: te, 12: mt, 14: pt, 27: dt, 28: 122, 32: ft, 42: j, 58: $, 73: et, 77: [1, 124], 78: [1, 125], 80: 135, 81: rt, 82: ut, 83: Kt, 84: Zt, 85: Qt, 86: Mt, 87: ne, 88: 123, 102: Bt, 106: Te, 108: ie, 111: Bi, 112: Ar, 113: Jt }, t(se, s, { 5: 148 }), t(D, [2, 37]), t(D, [2, 38]), t(O, [2, 45], { 42: xe }), { 42: y, 45: 150, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k }, { 99: [1, 151], 100: 152, 102: [1, 153] }, { 42: y, 45: 154, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k }, { 42: y, 45: 155, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k }, t(jt, [2, 100], { 10: [1, 156], 93: [1, 157] }), { 77: [1, 158] }, t(jt, [2, 108], { 117: 160, 10: [1, 159], 14: ct, 42: X, 58: H, 86: it, 102: ot, 103: W, 106: Z, 108: q, 111: G, 112: U, 113: ht }), t(jt, [2, 110], { 10: [1, 161] }), t(he, [2, 176]), t(he, [2, 163]), t(he, [2, 164]), t(he, [2, 165]), t(he, [2, 166]), t(he, [2, 167]), t(he, [2, 168]), t(he, [2, 169]), t(he, [2, 170]), t(he, [2, 171]), t(he, [2, 172]), t(he, [2, 173]), { 42: y, 45: 162, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k }, { 30: 163, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 171, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 173, 48: [1, 172], 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 174, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 175, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 176, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 106: [1, 177] }, { 30: 178, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 179, 63: [1, 180], 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 181, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 182, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 30: 183, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, t(J, [2, 175]), t(r, [2, 20]), t(Ct, [2, 25]), t(O, [2, 43], { 18: 184, 10: N }), t(Tt, [2, 68], { 10: [1, 185] }), { 10: [1, 186] }, { 30: 187, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 75: [1, 188], 76: 189, 113: $t, 116: Rt }, t(fe, [2, 73]), t(fe, [2, 75]), t(fe, [2, 76]), t(fe, [2, 161]), t(fe, [2, 162]), { 8: E, 9: V, 10: te, 11: nt, 12: mt, 14: pt, 21: 191, 27: dt, 29: [1, 190], 32: ft, 42: j, 58: $, 73: et, 80: 135, 81: rt, 82: ut, 83: Kt, 84: Zt, 85: Qt, 86: Mt, 87: ne, 88: 192, 102: Bt, 106: Te, 108: ie, 111: Bi, 112: Ar, 113: Jt }, t(le, [2, 94]), t(le, [2, 96]), t(le, [2, 97]), t(le, [2, 150]), t(le, [2, 151]), t(le, [2, 152]), t(le, [2, 153]), t(le, [2, 154]), t(le, [2, 155]), t(le, [2, 156]), t(le, [2, 157]), t(le, [2, 158]), t(le, [2, 159]), t(le, [2, 160]), t(le, [2, 83]), t(le, [2, 84]), t(le, [2, 85]), t(le, [2, 86]), t(le, [2, 87]), t(le, [2, 88]), t(le, [2, 89]), t(le, [2, 90]), t(le, [2, 91]), t(le, [2, 92]), t(le, [2, 93]), { 6: 11, 7: 12, 8: a, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 32: [1, 193], 33: 24, 34: f, 36: d, 38: p, 40: 28, 41: 38, 42: y, 43: 39, 45: 40, 58: m, 81: _, 82: T, 83: v, 84: A, 85: L, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k, 118: P, 119: R, 120: M, 121: B }, { 10: N, 18: 194 }, { 10: [1, 195], 42: y, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 109, 111: g, 112: I, 113: k }, { 10: [1, 196] }, { 10: [1, 197], 103: [1, 198] }, t(Ga, [2, 121]), { 10: [1, 199], 42: y, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 109, 111: g, 112: I, 113: k }, { 10: [1, 200], 42: y, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 109, 111: g, 112: I, 113: k }, { 77: [1, 201] }, t(jt, [2, 102], { 10: [1, 202] }), t(jt, [2, 104], { 10: [1, 203] }), { 77: [1, 204] }, t(he, [2, 177]), { 77: [1, 205], 95: [1, 206] }, t(Y, [2, 50], { 110: 109, 42: y, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 111: g, 112: I, 113: k }), { 31: [1, 207], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, t(di, [2, 79]), t(di, [2, 81]), t(di, [2, 82]), t(di, [2, 146]), t(di, [2, 147]), t(di, [2, 148]), t(di, [2, 149]), { 47: [1, 209], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 30: 210, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 49: [1, 211], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 51: [1, 212], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 53: [1, 213], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 55: [1, 214], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 58: [1, 215] }, { 62: [1, 216], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 64: [1, 217], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 30: 218, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, { 31: [1, 219], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 65: Vt, 67: [1, 220], 69: [1, 221], 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 65: Vt, 67: [1, 223], 69: [1, 222], 79: 208, 113: Xt, 114: Wt, 115: Pt }, t(O, [2, 44], { 42: xe }), t(Tt, [2, 70]), t(Tt, [2, 69]), { 60: [1, 224], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, t(Tt, [2, 72]), t(fe, [2, 74]), { 30: 225, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, t(se, s, { 5: 226 }), t(le, [2, 95]), t(D, [2, 35]), { 41: 227, 42: y, 43: 39, 45: 40, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k }, { 10: Un, 58: Hn, 81: $e, 89: 228, 102: Gn, 104: 229, 105: 230, 106: jn, 107: Xn, 108: Kn, 109: fi }, { 10: Un, 58: Hn, 81: $e, 89: 239, 101: [1, 240], 102: Gn, 104: 229, 105: 230, 106: jn, 107: Xn, 108: Kn, 109: fi }, { 10: Un, 58: Hn, 81: $e, 89: 241, 101: [1, 242], 102: Gn, 104: 229, 105: 230, 106: jn, 107: Xn, 108: Kn, 109: fi }, { 102: [1, 243] }, { 10: Un, 58: Hn, 81: $e, 89: 244, 102: Gn, 104: 229, 105: 230, 106: jn, 107: Xn, 108: Kn, 109: fi }, { 42: y, 45: 245, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k }, t(jt, [2, 101]), { 77: [1, 246] }, { 77: [1, 247], 95: [1, 248] }, t(jt, [2, 109]), t(jt, [2, 111], { 10: [1, 249] }), t(jt, [2, 112]), t(wt, [2, 51]), t(di, [2, 80]), t(wt, [2, 52]), { 49: [1, 250], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, t(wt, [2, 59]), t(wt, [2, 54]), t(wt, [2, 55]), t(wt, [2, 56]), { 106: [1, 251] }, t(wt, [2, 58]), t(wt, [2, 60]), { 64: [1, 252], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, t(wt, [2, 62]), t(wt, [2, 63]), t(wt, [2, 65]), t(wt, [2, 64]), t(wt, [2, 66]), t([10, 42, 58, 86, 99, 102, 103, 106, 108, 111, 112, 113], [2, 78]), { 31: [1, 253], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 6: 11, 7: 12, 8: a, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 32: [1, 254], 33: 24, 34: f, 36: d, 38: p, 40: 28, 41: 38, 42: y, 43: 39, 45: 40, 58: m, 81: _, 82: T, 83: v, 84: A, 85: L, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k, 118: P, 119: R, 120: M, 121: B }, t(Y, [2, 48]), t(jt, [2, 114], { 103: At }), t(st, [2, 123], { 105: 256, 10: Un, 58: Hn, 81: $e, 102: Gn, 106: jn, 107: Xn, 108: Kn, 109: fi }), t(_t, [2, 125]), t(_t, [2, 127]), t(_t, [2, 128]), t(_t, [2, 129]), t(_t, [2, 130]), t(_t, [2, 131]), t(_t, [2, 132]), t(_t, [2, 133]), t(_t, [2, 134]), t(jt, [2, 115], { 103: At }), { 10: [1, 257] }, t(jt, [2, 116], { 103: At }), { 10: [1, 258] }, t(Ga, [2, 122]), t(jt, [2, 98], { 103: At }), t(jt, [2, 99], { 110: 109, 42: y, 58: m, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 111: g, 112: I, 113: k }), t(jt, [2, 103]), t(jt, [2, 105], { 10: [1, 259] }), t(jt, [2, 106]), { 95: [1, 260] }, { 49: [1, 261] }, { 60: [1, 262] }, { 64: [1, 263] }, { 8: E, 9: V, 11: nt, 21: 264 }, t(D, [2, 34]), { 10: Un, 58: Hn, 81: $e, 102: Gn, 104: 265, 105: 230, 106: jn, 107: Xn, 108: Kn, 109: fi }, t(_t, [2, 126]), { 14: ct, 42: X, 58: H, 86: it, 98: 266, 102: ot, 103: W, 106: Z, 108: q, 111: G, 112: U, 113: ht, 117: 84 }, { 14: ct, 42: X, 58: H, 86: it, 98: 267, 102: ot, 103: W, 106: Z, 108: q, 111: G, 112: U, 113: ht, 117: 84 }, { 95: [1, 268] }, t(jt, [2, 113]), t(wt, [2, 53]), { 30: 269, 65: Vt, 77: re, 78: oe, 79: 164, 113: Xt, 114: Wt, 115: Pt }, t(wt, [2, 61]), t(se, s, { 5: 270 }), t(st, [2, 124], { 105: 256, 10: Un, 58: Hn, 81: $e, 102: Gn, 106: jn, 107: Xn, 108: Kn, 109: fi }), t(jt, [2, 119], { 117: 160, 10: [1, 271], 14: ct, 42: X, 58: H, 86: it, 102: ot, 103: W, 106: Z, 108: q, 111: G, 112: U, 113: ht }), t(jt, [2, 120], { 117: 160, 10: [1, 272], 14: ct, 42: X, 58: H, 86: it, 102: ot, 103: W, 106: Z, 108: q, 111: G, 112: U, 113: ht }), t(jt, [2, 107]), { 31: [1, 273], 65: Vt, 79: 208, 113: Xt, 114: Wt, 115: Pt }, { 6: 11, 7: 12, 8: a, 9: o, 10: l, 11: u, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: h, 32: [1, 274], 33: 24, 34: f, 36: d, 38: p, 40: 28, 41: 38, 42: y, 43: 39, 45: 40, 58: m, 81: _, 82: T, 83: v, 84: A, 85: L, 86: w, 99: b, 102: F, 103: S, 106: x, 108: C, 110: 41, 111: g, 112: I, 113: k, 118: P, 119: R, 120: M, 121: B }, { 10: Un, 58: Hn, 81: $e, 89: 275, 102: Gn, 104: 229, 105: 230, 106: jn, 107: Xn, 108: Kn, 109: fi }, { 10: Un, 58: Hn, 81: $e, 89: 276, 102: Gn, 104: 229, 105: 230, 106: jn, 107: Xn, 108: Kn, 109: fi }, t(wt, [2, 57]), t(D, [2, 33]), t(jt, [2, 117], { 103: At }), t(jt, [2, 118], { 103: At })],
    defaultActions: {},
    parseError: function(Et, Lt) {
      if (Lt.recoverable)
        this.trace(Et);
      else {
        var Yt = new Error(Et);
        throw Yt.hash = Lt, Yt;
      }
    },
    parse: function(Et) {
      var Lt = this, Yt = [0], kt = [], ge = [null], K = [], ja = this.table, tt = "", Qn = 0, K0 = 0, tk = 2, Q0 = 1, ek = K.slice.call(arguments, 1), Ke = Object.create(this.lexer), jr = { yy: {} };
      for (var Lh in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Lh) && (jr.yy[Lh] = this.yy[Lh]);
      Ke.setInput(Et, jr.yy), jr.yy.lexer = Ke, jr.yy.parser = this, typeof Ke.yylloc > "u" && (Ke.yylloc = {});
      var Ih = Ke.yylloc;
      K.push(Ih);
      var nk = Ke.options && Ke.options.ranges;
      typeof jr.yy.parseError == "function" ? this.parseError = jr.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function ik() {
        var tr;
        return tr = kt.pop() || Ke.lex() || Q0, typeof tr != "number" && (tr instanceof Array && (kt = tr, tr = kt.pop()), tr = Lt.symbols_[tr] || tr), tr;
      }
      for (var An, Xr, Zn, Bh, Ys = {}, Ml, Ji, Z0, Pl; ; ) {
        if (Xr = Yt[Yt.length - 1], this.defaultActions[Xr] ? Zn = this.defaultActions[Xr] : ((An === null || typeof An > "u") && (An = ik()), Zn = ja[Xr] && ja[Xr][An]), typeof Zn > "u" || !Zn.length || !Zn[0]) {
          var Dh = "";
          Pl = [];
          for (Ml in ja[Xr])
            this.terminals_[Ml] && Ml > tk && Pl.push("'" + this.terminals_[Ml] + "'");
          Ke.showPosition ? Dh = "Parse error on line " + (Qn + 1) + `:
` + Ke.showPosition() + `
Expecting ` + Pl.join(", ") + ", got '" + (this.terminals_[An] || An) + "'" : Dh = "Parse error on line " + (Qn + 1) + ": Unexpected " + (An == Q0 ? "end of input" : "'" + (this.terminals_[An] || An) + "'"), this.parseError(Dh, {
            text: Ke.match,
            token: this.terminals_[An] || An,
            line: Ke.yylineno,
            loc: Ih,
            expected: Pl
          });
        }
        if (Zn[0] instanceof Array && Zn.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + Xr + ", token: " + An);
        switch (Zn[0]) {
          case 1:
            Yt.push(An), ge.push(Ke.yytext), K.push(Ke.yylloc), Yt.push(Zn[1]), An = null, K0 = Ke.yyleng, tt = Ke.yytext, Qn = Ke.yylineno, Ih = Ke.yylloc;
            break;
          case 2:
            if (Ji = this.productions_[Zn[1]][1], Ys.$ = ge[ge.length - Ji], Ys._$ = {
              first_line: K[K.length - (Ji || 1)].first_line,
              last_line: K[K.length - 1].last_line,
              first_column: K[K.length - (Ji || 1)].first_column,
              last_column: K[K.length - 1].last_column
            }, nk && (Ys._$.range = [
              K[K.length - (Ji || 1)].range[0],
              K[K.length - 1].range[1]
            ]), Bh = this.performAction.apply(Ys, [
              tt,
              K0,
              Qn,
              jr.yy,
              Zn[1],
              ge,
              K
            ].concat(ek)), typeof Bh < "u")
              return Bh;
            Ji && (Yt = Yt.slice(0, -1 * Ji * 2), ge = ge.slice(0, -1 * Ji), K = K.slice(0, -1 * Ji)), Yt.push(this.productions_[Zn[1]][0]), ge.push(Ys.$), K.push(Ys._$), Z0 = ja[Yt[Yt.length - 2]][Yt[Yt.length - 1]], Yt.push(Z0);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, de = /* @__PURE__ */ (function() {
    var pe = {
      EOF: 1,
      parseError: function(Lt, Yt) {
        if (this.yy.parser)
          this.yy.parser.parseError(Lt, Yt);
        else
          throw new Error(Lt);
      },
      // resets the lexer, sets new input
      setInput: function(Et, Lt) {
        return this.yy = Lt || this.yy || {}, this._input = Et, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var Et = this._input[0];
        this.yytext += Et, this.yyleng++, this.offset++, this.match += Et, this.matched += Et;
        var Lt = Et.match(/(?:\r\n?|\n).*/g);
        return Lt ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), Et;
      },
      // unshifts one char (or a string) into the input
      unput: function(Et) {
        var Lt = Et.length, Yt = Et.split(/(?:\r\n?|\n)/g);
        this._input = Et + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - Lt), this.offset -= Lt;
        var kt = 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), Yt.length - 1 && (this.yylineno -= Yt.length - 1);
        var ge = 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: Yt ? (Yt.length === kt.length ? this.yylloc.first_column : 0) + kt[kt.length - Yt.length].length - Yt[0].length : this.yylloc.first_column - Lt
        }, this.options.ranges && (this.yylloc.range = [ge[0], ge[0] + this.yyleng - Lt]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(Et) {
        this.unput(this.match.slice(Et));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var Et = this.matched.substr(0, this.matched.length - this.match.length);
        return (Et.length > 20 ? "..." : "") + Et.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var Et = this.match;
        return Et.length < 20 && (Et += this._input.substr(0, 20 - Et.length)), (Et.substr(0, 20) + (Et.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var Et = this.pastInput(), Lt = new Array(Et.length + 1).join("-");
        return Et + this.upcomingInput() + `
` + Lt + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(Et, Lt) {
        var Yt, kt, ge;
        if (this.options.backtrack_lexer && (ge = {
          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 && (ge.yylloc.range = this.yylloc.range.slice(0))), kt = Et[0].match(/(?:\r\n?|\n).*/g), kt && (this.yylineno += kt.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: kt ? kt[kt.length - 1].length - kt[kt.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + Et[0].length
        }, this.yytext += Et[0], this.match += Et[0], this.matches = Et, 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(Et[0].length), this.matched += Et[0], Yt = this.performAction.call(this, this.yy, this, Lt, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), Yt)
          return Yt;
        if (this._backtrack) {
          for (var K in ge)
            this[K] = ge[K];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var Et, Lt, Yt, kt;
        this._more || (this.yytext = "", this.match = "");
        for (var ge = this._currentRules(), K = 0; K < ge.length; K++)
          if (Yt = this._input.match(this.rules[ge[K]]), Yt && (!Lt || Yt[0].length > Lt[0].length)) {
            if (Lt = Yt, kt = K, this.options.backtrack_lexer) {
              if (Et = this.test_match(Yt, ge[K]), Et !== !1)
                return Et;
              if (this._backtrack) {
                Lt = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return Lt ? (Et = this.test_match(Lt, ge[kt]), Et !== !1 ? Et : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var Lt = this.next();
        return Lt || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(Lt) {
        this.conditionStack.push(Lt);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var Lt = this.conditionStack.length - 1;
        return Lt > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(Lt) {
        return Lt = this.conditionStack.length - 1 - Math.abs(Lt || 0), Lt >= 0 ? this.conditionStack[Lt] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(Lt) {
        this.begin(Lt);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: {},
      performAction: function(Lt, Yt, kt, ge) {
        switch (kt) {
          case 0:
            return this.begin("acc_title"), 34;
          case 1:
            return this.popState(), "acc_title_value";
          case 2:
            return this.begin("acc_descr"), 36;
          case 3:
            return this.popState(), "acc_descr_value";
          case 4:
            this.begin("acc_descr_multiline");
            break;
          case 5:
            this.popState();
            break;
          case 6:
            return "acc_descr_multiline_value";
          case 7:
            this.begin("callbackname");
            break;
          case 8:
            this.popState();
            break;
          case 9:
            this.popState(), this.begin("callbackargs");
            break;
          case 10:
            return 92;
          case 11:
            this.popState();
            break;
          case 12:
            return 93;
          case 13:
            return "MD_STR";
          case 14:
            this.popState();
            break;
          case 15:
            this.begin("md_string");
            break;
          case 16:
            return "STR";
          case 17:
            this.popState();
            break;
          case 18:
            this.pushState("string");
            break;
          case 19:
            return 81;
          case 20:
            return 99;
          case 21:
            return 82;
          case 22:
            return 101;
          case 23:
            return 83;
          case 24:
            return 84;
          case 25:
            return 94;
          case 26:
            this.begin("click");
            break;
          case 27:
            this.popState();
            break;
          case 28:
            return 85;
          case 29:
            return Lt.lex.firstGraph() && this.begin("dir"), 12;
          case 30:
            return Lt.lex.firstGraph() && this.begin("dir"), 12;
          case 31:
            return Lt.lex.firstGraph() && this.begin("dir"), 12;
          case 32:
            return 27;
          case 33:
            return 32;
          case 34:
            return 95;
          case 35:
            return 95;
          case 36:
            return 95;
          case 37:
            return 95;
          case 38:
            return this.popState(), 13;
          case 39:
            return this.popState(), 14;
          case 40:
            return this.popState(), 14;
          case 41:
            return this.popState(), 14;
          case 42:
            return this.popState(), 14;
          case 43:
            return this.popState(), 14;
          case 44:
            return this.popState(), 14;
          case 45:
            return this.popState(), 14;
          case 46:
            return this.popState(), 14;
          case 47:
            return this.popState(), 14;
          case 48:
            return this.popState(), 14;
          case 49:
            return 118;
          case 50:
            return 119;
          case 51:
            return 120;
          case 52:
            return 121;
          case 53:
            return 102;
          case 54:
            return 108;
          case 55:
            return 44;
          case 56:
            return 58;
          case 57:
            return 42;
          case 58:
            return 8;
          case 59:
            return 103;
          case 60:
            return 112;
          case 61:
            return this.popState(), 75;
          case 62:
            return this.pushState("edgeText"), 73;
          case 63:
            return 116;
          case 64:
            return this.popState(), 75;
          case 65:
            return this.pushState("thickEdgeText"), 73;
          case 66:
            return 116;
          case 67:
            return this.popState(), 75;
          case 68:
            return this.pushState("dottedEdgeText"), 73;
          case 69:
            return 116;
          case 70:
            return 75;
          case 71:
            return this.popState(), 51;
          case 72:
            return "TEXT";
          case 73:
            return this.pushState("ellipseText"), 50;
          case 74:
            return this.popState(), 53;
          case 75:
            return this.pushState("text"), 52;
          case 76:
            return this.popState(), 55;
          case 77:
            return this.pushState("text"), 54;
          case 78:
            return 56;
          case 79:
            return this.pushState("text"), 65;
          case 80:
            return this.popState(), 62;
          case 81:
            return this.pushState("text"), 61;
          case 82:
            return this.popState(), 47;
          case 83:
            return this.pushState("text"), 46;
          case 84:
            return this.popState(), 67;
          case 85:
            return this.popState(), 69;
          case 86:
            return 114;
          case 87:
            return this.pushState("trapText"), 66;
          case 88:
            return this.pushState("trapText"), 68;
          case 89:
            return 115;
          case 90:
            return 65;
          case 91:
            return 87;
          case 92:
            return "SEP";
          case 93:
            return 86;
          case 94:
            return 112;
          case 95:
            return 108;
          case 96:
            return 42;
          case 97:
            return 106;
          case 98:
            return 111;
          case 99:
            return 113;
          case 100:
            return this.popState(), 60;
          case 101:
            return this.pushState("text"), 60;
          case 102:
            return this.popState(), 49;
          case 103:
            return this.pushState("text"), 48;
          case 104:
            return this.popState(), 31;
          case 105:
            return this.pushState("text"), 29;
          case 106:
            return this.popState(), 64;
          case 107:
            return this.pushState("text"), 63;
          case 108:
            return "TEXT";
          case 109:
            return "QUOTE";
          case 110:
            return 9;
          case 111:
            return 10;
          case 112:
            return 11;
        }
      },
      rules: [/^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["][`])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:["])/, /^(?:style\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\b)/, /^(?:class\b)/, /^(?:href[\s])/, /^(?:click[\s]+)/, /^(?:[\s\n])/, /^(?:[^\s\n]*)/, /^(?:flowchart-elk\b)/, /^(?:graph\b)/, /^(?:flowchart\b)/, /^(?:subgraph\b)/, /^(?:end\b\s*)/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:(\r?\n)*\s*\n)/, /^(?:\s*LR\b)/, /^(?:\s*RL\b)/, /^(?:\s*TB\b)/, /^(?:\s*BT\b)/, /^(?:\s*TD\b)/, /^(?:\s*BR\b)/, /^(?:\s*<)/, /^(?:\s*>)/, /^(?:\s*\^)/, /^(?:\s*v\b)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:[0-9]+)/, /^(?:#)/, /^(?::::)/, /^(?::)/, /^(?:&)/, /^(?:;)/, /^(?:,)/, /^(?:\*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:[^-]|-(?!-)+)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:[^=]|=(?!))/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:[^\.]|\.(?!))/, /^(?:\s*~~[\~]+\s*)/, /^(?:[-/\)][\)])/, /^(?:[^\(\)\[\]\{\}]|!\)+)/, /^(?:\(-)/, /^(?:\]\))/, /^(?:\(\[)/, /^(?:\]\])/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:>)/, /^(?:\)\])/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\(\(\()/, /^(?:[\\(?=\])][\]])/, /^(?:\/(?=\])\])/, /^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:<)/, /^(?:>)/, /^(?:\^)/, /^(?:\\\|)/, /^(?:v\b)/, /^(?:\*)/, /^(?:#)/, /^(?:&)/, /^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/, /^(?:-)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\|)/, /^(?:\|)/, /^(?:\))/, /^(?:\()/, /^(?:\])/, /^(?:\[)/, /^(?:(\}))/, /^(?:\{)/, /^(?:[^\[\]\(\)\{\}\|\"]+)/, /^(?:")/, /^(?:(\r?\n)+)/, /^(?:\s)/, /^(?:$)/],
      conditions: { callbackargs: { rules: [11, 12, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, callbackname: { rules: [8, 9, 10, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, href: { rules: [15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, click: { rules: [15, 18, 27, 28, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, dottedEdgeText: { rules: [15, 18, 67, 69, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, thickEdgeText: { rules: [15, 18, 64, 66, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, edgeText: { rules: [15, 18, 61, 63, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, trapText: { rules: [15, 18, 70, 73, 75, 77, 81, 83, 84, 85, 86, 87, 88, 101, 103, 105, 107], inclusive: !1 }, ellipseText: { rules: [15, 18, 70, 71, 72, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, text: { rules: [15, 18, 70, 73, 74, 75, 76, 77, 80, 81, 82, 83, 87, 88, 100, 101, 102, 103, 104, 105, 106, 107, 108], inclusive: !1 }, vertex: { rules: [15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, dir: { rules: [15, 18, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, acc_descr_multiline: { rules: [5, 6, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, acc_descr: { rules: [3, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, acc_title: { rules: [1, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, md_string: { rules: [13, 14, 15, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, string: { rules: [15, 16, 17, 18, 70, 73, 75, 77, 81, 83, 87, 88, 101, 103, 105, 107], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 64, 65, 67, 68, 70, 73, 75, 77, 78, 79, 81, 83, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 101, 103, 105, 107, 109, 110, 111, 112], inclusive: !0 } }
    };
    return pe;
  })();
  St.lexer = de;
  function Fe() {
    this.yy = {};
  }
  return Fe.prototype = St, St.Parser = Fe, new Fe();
})();
r1.parser = r1;
const Yf = r1, ON = "flowchart-";
let Vg = 0, Ba = Q(), ke = {}, _i = [], ta = {}, wr = [], du = {}, fu = {}, xc = 0, s1 = !0, ei, lh, ch = [];
const uh = (t) => bt.sanitizeText(t, Ba), Sl = function(t) {
  const e = Object.keys(ke);
  for (const n of e)
    if (ke[n].id === t)
      return ke[n].domId;
  return t;
}, Qb = function(t, e, n, i, r, s, a = {}) {
  let o, l = t;
  l !== void 0 && l.trim().length !== 0 && (ke[l] === void 0 && (ke[l] = {
    id: l,
    labelType: "text",
    domId: ON + l + "-" + Vg,
    styles: [],
    classes: []
  }), Vg++, e !== void 0 ? (Ba = Q(), o = uh(e.text.trim()), ke[l].labelType = e.type, o[0] === '"' && o[o.length - 1] === '"' && (o = o.substring(1, o.length - 1)), ke[l].text = o) : ke[l].text === void 0 && (ke[l].text = t), n !== void 0 && (ke[l].type = n), i?.forEach(function(u) {
    ke[l].styles.push(u);
  }), r?.forEach(function(u) {
    ke[l].classes.push(u);
  }), s !== void 0 && (ke[l].dir = s), ke[l].props === void 0 ? ke[l].props = a : a !== void 0 && Object.assign(ke[l].props, a));
}, Zb = function(t, e, n) {
  const s = { start: t, end: e, type: void 0, text: "", labelType: "text" };
  z.info("abc78 Got edge...", s);
  const a = n.text;
  if (a !== void 0 && (s.text = uh(a.text.trim()), s.text[0] === '"' && s.text[s.text.length - 1] === '"' && (s.text = s.text.substring(1, s.text.length - 1)), s.labelType = a.type), n !== void 0 && (s.type = n.type, s.stroke = n.stroke, s.length = n.length), s?.length > 10 && (s.length = 10), _i.length < (Ba.maxEdges ?? 500))
    z.info("abc78 pushing edge..."), _i.push(s);
  else
    throw new Error(
      `Edge limit exceeded. ${_i.length} edges found, but the limit is ${Ba.maxEdges}.

Initialize mermaid with maxEdges set to a higher number to allow more edges.
You cannot set this config via configuration inside the diagram as it is a secure config.
You have to call mermaid.initialize.`
    );
}, Jb = function(t, e, n) {
  z.info("addLink (abc78)", t, e, n);
  let i, r;
  for (i = 0; i < t.length; i++)
    for (r = 0; r < e.length; r++)
      Zb(t[i], e[r], n);
}, t3 = function(t, e) {
  t.forEach(function(n) {
    n === "default" ? _i.defaultInterpolate = e : _i[n].interpolate = e;
  });
}, e3 = function(t, e) {
  t.forEach(function(n) {
    if (n >= _i.length)
      throw new Error(
        `The index ${n} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${_i.length - 1}. (Help: Ensure that the index is within the range of existing edges.)`
      );
    n === "default" ? _i.defaultStyle = e : (Gt.isSubstringInArray("fill", e) === -1 && e.push("fill:none"), _i[n].style = e);
  });
}, n3 = function(t, e) {
  t.split(",").forEach(function(n) {
    ta[n] === void 0 && (ta[n] = { id: n, styles: [], textStyles: [] }), e?.forEach(function(i) {
      if (i.match("color")) {
        const r = i.replace("fill", "bgFill").replace("color", "fill");
        ta[n].textStyles.push(r);
      }
      ta[n].styles.push(i);
    });
  });
}, i3 = function(t) {
  ei = t, ei.match(/.*</) && (ei = "RL"), ei.match(/.*\^/) && (ei = "BT"), ei.match(/.*>/) && (ei = "LR"), ei.match(/.*v/) && (ei = "TB"), ei === "TD" && (ei = "TB");
}, hh = function(t, e) {
  t.split(",").forEach(function(n) {
    let i = n;
    ke[i] !== void 0 && ke[i].classes.push(e), du[i] !== void 0 && du[i].classes.push(e);
  });
}, RN = function(t, e) {
  t.split(",").forEach(function(n) {
    e !== void 0 && (fu[lh === "gen-1" ? Sl(n) : n] = uh(e));
  });
}, MN = function(t, e, n) {
  let i = Sl(t);
  if (Q().securityLevel !== "loose" || e === void 0)
    return;
  let r = [];
  if (typeof n == "string") {
    r = n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
    for (let s = 0; s < r.length; s++) {
      let a = r[s].trim();
      a.charAt(0) === '"' && a.charAt(a.length - 1) === '"' && (a = a.substr(1, a.length - 2)), r[s] = a;
    }
  }
  r.length === 0 && r.push(t), ke[t] !== void 0 && (ke[t].haveCallback = !0, ch.push(function() {
    const s = document.querySelector(`[id="${i}"]`);
    s !== null && s.addEventListener(
      "click",
      function() {
        Gt.runFunc(e, ...r);
      },
      !1
    );
  }));
}, r3 = function(t, e, n) {
  t.split(",").forEach(function(i) {
    ke[i] !== void 0 && (ke[i].link = Gt.formatUrl(e, Ba), ke[i].linkTarget = n);
  }), hh(t, "clickable");
}, s3 = function(t) {
  if (fu.hasOwnProperty(t))
    return fu[t];
}, a3 = function(t, e, n) {
  t.split(",").forEach(function(i) {
    MN(i, e, n);
  }), hh(t, "clickable");
}, o3 = function(t) {
  ch.forEach(function(e) {
    e(t);
  });
}, l3 = function() {
  return ei.trim();
}, c3 = function() {
  return ke;
}, u3 = function() {
  return _i;
}, h3 = function() {
  return ta;
}, d3 = function(t) {
  let e = yt(".mermaidTooltip");
  (e._groups || e)[0][0] === null && (e = yt("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0)), yt(t).select("svg").selectAll("g.node").on("mouseover", function() {
    const r = yt(this);
    if (r.attr("title") === null)
      return;
    const a = this.getBoundingClientRect();
    e.transition().duration(200).style("opacity", ".9"), e.text(r.attr("title")).style("left", window.scrollX + a.left + (a.right - a.left) / 2 + "px").style("top", window.scrollY + a.bottom + "px"), e.html(e.html().replace(/&lt;br\/&gt;/g, "<br/>")), r.classed("hover", !0);
  }).on("mouseout", function() {
    e.transition().duration(500).style("opacity", 0), yt(this).classed("hover", !1);
  });
};
ch.push(d3);
const f3 = function(t = "gen-1") {
  ke = {}, ta = {}, _i = [], ch = [d3], wr = [], du = {}, xc = 0, fu = {}, s1 = !0, lh = t, Ba = Q(), fn();
}, p3 = (t) => {
  lh = t || "gen-2";
}, g3 = function() {
  return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;";
}, y3 = function(t, e, n) {
  let i = t.text.trim(), r = n.text;
  t === n && n.text.match(/\s/) && (i = void 0);
  function s(h) {
    const f = { boolean: {}, number: {}, string: {} }, d = [];
    let p;
    return { nodeList: h.filter(function(m) {
      const _ = typeof m;
      return m.stmt && m.stmt === "dir" ? (p = m.value, !1) : m.trim() === "" ? !1 : _ in f ? f[_].hasOwnProperty(m) ? !1 : f[_][m] = !0 : d.includes(m) ? !1 : d.push(m);
    }), dir: p };
  }
  let a = [];
  const { nodeList: o, dir: l } = s(a.concat.apply(a, e));
  if (a = o, lh === "gen-1")
    for (let h = 0; h < a.length; h++)
      a[h] = Sl(a[h]);
  i = i || "subGraph" + xc, r = r || "", r = uh(r), xc = xc + 1;
  const u = {
    id: i,
    nodes: a,
    title: r.trim(),
    classes: [],
    dir: l,
    labelType: n.type
  };
  return z.info("Adding", u.id, u.nodes, u.dir), u.nodes = E3(u, wr).nodes, wr.push(u), du[i] = u, i;
}, PN = function(t) {
  for (const [e, n] of wr.entries())
    if (n.id === t)
      return e;
  return -1;
};
let go = -1;
const m3 = [], x3 = function(t, e) {
  const n = wr[e].nodes;
  if (go = go + 1, go > 2e3)
    return;
  if (m3[go] = e, wr[e].id === t)
    return {
      result: !0,
      count: 0
    };
  let i = 0, r = 1;
  for (; i < n.length; ) {
    const s = PN(n[i]);
    if (s >= 0) {
      const a = x3(t, s);
      if (a.result)
        return {
          result: !0,
          count: r + a.count
        };
      r = r + a.count;
    }
    i = i + 1;
  }
  return {
    result: !1,
    count: r
  };
}, b3 = function(t) {
  return m3[t];
}, _3 = function() {
  go = -1, wr.length > 0 && x3("none", wr.length - 1);
}, k3 = function() {
  return wr;
}, T3 = () => s1 ? (s1 = !1, !0) : !1, zN = (t) => {
  let e = t.trim(), n = "arrow_open";
  switch (e[0]) {
    case "<":
      n = "arrow_point", e = e.slice(1);
      break;
    case "x":
      n = "arrow_cross", e = e.slice(1);
      break;
    case "o":
      n = "arrow_circle", e = e.slice(1);
      break;
  }
  let i = "normal";
  return e.includes("=") && (i = "thick"), e.includes(".") && (i = "dotted"), { type: n, stroke: i };
}, VN = (t, e) => {
  const n = e.length;
  let i = 0;
  for (let r = 0; r < n; ++r)
    e[r] === t && ++i;
  return i;
}, qN = (t) => {
  const e = t.trim();
  let n = e.slice(0, -1), i = "arrow_open";
  switch (e.slice(-1)) {
    case "x":
      i = "arrow_cross", e[0] === "x" && (i = "double_" + i, n = n.slice(1));
      break;
    case ">":
      i = "arrow_point", e[0] === "<" && (i = "double_" + i, n = n.slice(1));
      break;
    case "o":
      i = "arrow_circle", e[0] === "o" && (i = "double_" + i, n = n.slice(1));
      break;
  }
  let r = "normal", s = n.length - 1;
  n[0] === "=" && (r = "thick"), n[0] === "~" && (r = "invisible");
  let a = VN(".", n);
  return a && (r = "dotted", s = a), { type: i, stroke: r, length: s };
}, w3 = (t, e) => {
  const n = qN(t);
  let i;
  if (e) {
    if (i = zN(e), i.stroke !== n.stroke)
      return { type: "INVALID", stroke: "INVALID" };
    if (i.type === "arrow_open")
      i.type = n.type;
    else {
      if (i.type !== n.type)
        return { type: "INVALID", stroke: "INVALID" };
      i.type = "double_" + i.type;
    }
    return i.type === "double_arrow" && (i.type = "double_arrow_point"), i.length = n.length, i;
  }
  return n;
}, v3 = (t, e) => {
  let n = !1;
  return t.forEach((i) => {
    i.nodes.indexOf(e) >= 0 && (n = !0);
  }), n;
}, E3 = (t, e) => {
  const n = [];
  return t.nodes.forEach((i, r) => {
    v3(e, i) || n.push(t.nodes[r]);
  }), { nodes: n };
}, C3 = {
  firstGraph: T3
}, hs = {
  defaultConfig: () => ub.flowchart,
  setAccTitle: pn,
  getAccTitle: vn,
  getAccDescription: Cn,
  setAccDescription: En,
  addVertex: Qb,
  lookUpDomId: Sl,
  addLink: Jb,
  updateLinkInterpolate: t3,
  updateLink: e3,
  addClass: n3,
  setDirection: i3,
  setClass: hh,
  setTooltip: RN,
  getTooltip: s3,
  setClickEvent: a3,
  setLink: r3,
  bindFunctions: o3,
  getDirection: l3,
  getVertices: c3,
  getEdges: u3,
  getClasses: h3,
  clear: f3,
  setGen: p3,
  defaultStyle: g3,
  addSubGraph: y3,
  getDepthFirstPos: b3,
  indexNodes: _3,
  getSubGraphs: k3,
  destructLink: w3,
  lex: C3,
  exists: v3,
  makeUniq: E3,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn
}, $N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  addClass: n3,
  addLink: Jb,
  addSingleLink: Zb,
  addSubGraph: y3,
  addVertex: Qb,
  bindFunctions: o3,
  clear: f3,
  default: hs,
  defaultStyle: g3,
  destructLink: w3,
  firstGraph: T3,
  getClasses: h3,
  getDepthFirstPos: b3,
  getDirection: l3,
  getEdges: u3,
  getSubGraphs: k3,
  getTooltip: s3,
  getVertices: c3,
  indexNodes: _3,
  lex: C3,
  lookUpDomId: Sl,
  setClass: hh,
  setClickEvent: a3,
  setDirection: i3,
  setGen: p3,
  setLink: r3,
  updateLink: e3,
  updateLinkInterpolate: t3
}, Symbol.toStringTag, { value: "Module" }));
var YN = "[object Symbol]";
function bs(t) {
  return typeof t == "symbol" || Wi(t) && Ns(t) == YN;
}
function la(t, e) {
  for (var n = -1, i = t == null ? 0 : t.length, r = Array(i); ++n < i; )
    r[n] = e(t[n], n, t);
  return r;
}
var qg = ci ? ci.prototype : void 0, $g = qg ? qg.toString : void 0;
function S3(t) {
  if (typeof t == "string")
    return t;
  if (Ve(t))
    return la(t, S3) + "";
  if (bs(t))
    return $g ? $g.call(t) : "";
  var e = t + "";
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
}
var WN = /\s/;
function UN(t) {
  for (var e = t.length; e-- && WN.test(t.charAt(e)); )
    ;
  return e;
}
var HN = /^\s+/;
function GN(t) {
  return t && t.slice(0, UN(t) + 1).replace(HN, "");
}
var Yg = NaN, jN = /^[-+]0x[0-9a-f]+$/i, XN = /^0b[01]+$/i, KN = /^0o[0-7]+$/i, QN = parseInt;
function ZN(t) {
  if (typeof t == "number")
    return t;
  if (bs(t))
    return Yg;
  if (qn(t)) {
    var e = typeof t.valueOf == "function" ? t.valueOf() : t;
    t = qn(e) ? e + "" : e;
  }
  if (typeof t != "string")
    return t === 0 ? t : +t;
  t = GN(t);
  var n = XN.test(t);
  return n || KN.test(t) ? QN(t.slice(2), n ? 2 : 8) : jN.test(t) ? Yg : +t;
}
var Wg = 1 / 0, JN = 17976931348623157e292;
function bc(t) {
  if (!t)
    return t === 0 ? t : 0;
  if (t = ZN(t), t === Wg || t === -Wg) {
    var e = t < 0 ? -1 : 1;
    return e * JN;
  }
  return t === t ? t : 0;
}
function tF(t) {
  var e = bc(t), n = e % 1;
  return e === e ? n ? e - n : e : 0;
}
function eF() {
}
function A3(t, e) {
  for (var n = -1, i = t == null ? 0 : t.length; ++n < i && e(t[n], n, t) !== !1; )
    ;
  return t;
}
function L3(t, e, n, i) {
  for (var r = t.length, s = n + -1; ++s < r; )
    if (e(t[s], s, t))
      return s;
  return -1;
}
function nF(t) {
  return t !== t;
}
function iF(t, e, n) {
  for (var i = n - 1, r = t.length; ++i < r; )
    if (t[i] === e)
      return i;
  return -1;
}
function rF(t, e, n) {
  return e === e ? iF(t, e, n) : L3(t, nF, n);
}
function sF(t, e) {
  var n = t == null ? 0 : t.length;
  return !!n && rF(t, e, 0) > -1;
}
function Pn(t) {
  return Yr(t) ? yx(t) : Ex(t);
}
var aF = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, oF = /^\w*$/;
function Wf(t, e) {
  if (Ve(t))
    return !1;
  var n = typeof t;
  return n == "number" || n == "symbol" || n == "boolean" || t == null || bs(t) ? !0 : oF.test(t) || !aF.test(t) || e != null && t in Object(e);
}
var lF = 500;
function cF(t) {
  var e = Va(t, function(i) {
    return n.size === lF && n.clear(), i;
  }), n = e.cache;
  return e;
}
var uF = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, hF = /\\(\\)?/g, dF = cF(function(t) {
  var e = [];
  return t.charCodeAt(0) === 46 && e.push(""), t.replace(uF, function(n, i, r, s) {
    e.push(r ? s.replace(hF, "$1") : i || n);
  }), e;
});
function I3(t) {
  return t == null ? "" : S3(t);
}
function dh(t, e) {
  return Ve(t) ? t : Wf(t, e) ? [t] : dF(I3(t));
}
function Al(t) {
  if (typeof t == "string" || bs(t))
    return t;
  var e = t + "";
  return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
}
function fh(t, e) {
  e = dh(e, t);
  for (var n = 0, i = e.length; t != null && n < i; )
    t = t[Al(e[n++])];
  return n && n == i ? t : void 0;
}
function fF(t, e, n) {
  var i = t == null ? void 0 : fh(t, e);
  return i === void 0 ? n : i;
}
function Uf(t, e) {
  for (var n = -1, i = e.length, r = t.length; ++n < i; )
    t[r + n] = e[n];
  return t;
}
var Ug = ci ? ci.isConcatSpreadable : void 0;
function pF(t) {
  return Ve(t) || Ta(t) || !!(Ug && t && t[Ug]);
}
function Hf(t, e, n, i, r) {
  var s = -1, a = t.length;
  for (n || (n = pF), r || (r = []); ++s < a; ) {
    var o = t[s];
    n(o) ? Uf(r, o) : i || (r[r.length] = o);
  }
  return r;
}
function Wa(t) {
  var e = t == null ? 0 : t.length;
  return e ? Hf(t) : [];
}
function gF(t) {
  return bx(xx(t, void 0, Wa), t + "");
}
function yF(t, e, n, i) {
  var r = -1, s = t == null ? 0 : t.length;
  for (i && s && (n = t[++r]); ++r < s; )
    n = e(n, t[r], r, t);
  return n;
}
function mF(t, e) {
  return t && wl(e, Pn(e), t);
}
function xF(t, e) {
  return t && wl(e, Rs(e), t);
}
function B3(t, e) {
  for (var n = -1, i = t == null ? 0 : t.length, r = 0, s = []; ++n < i; ) {
    var a = t[n];
    e(a, n, t) && (s[r++] = a);
  }
  return s;
}
function D3() {
  return [];
}
var bF = Object.prototype, _F = bF.propertyIsEnumerable, Hg = Object.getOwnPropertySymbols, Gf = Hg ? function(t) {
  return t == null ? [] : (t = Object(t), B3(Hg(t), function(e) {
    return _F.call(t, e);
  }));
} : D3;
function kF(t, e) {
  return wl(t, Gf(t), e);
}
var TF = Object.getOwnPropertySymbols, N3 = TF ? function(t) {
  for (var e = []; t; )
    Uf(e, Gf(t)), t = kf(t);
  return e;
} : D3;
function wF(t, e) {
  return wl(t, N3(t), e);
}
function F3(t, e, n) {
  var i = e(t);
  return Ve(t) ? i : Uf(i, n(t));
}
function a1(t) {
  return F3(t, Pn, Gf);
}
function vF(t) {
  return F3(t, Rs, N3);
}
var EF = Object.prototype, CF = EF.hasOwnProperty;
function SF(t) {
  var e = t.length, n = new t.constructor(e);
  return e && typeof t[0] == "string" && CF.call(t, "index") && (n.index = t.index, n.input = t.input), n;
}
function AF(t, e) {
  var n = e ? _f(t.buffer) : t.buffer;
  return new t.constructor(n, t.byteOffset, t.byteLength);
}
var LF = /\w*$/;
function IF(t) {
  var e = new t.constructor(t.source, LF.exec(t));
  return e.lastIndex = t.lastIndex, e;
}
var Gg = ci ? ci.prototype : void 0, jg = Gg ? Gg.valueOf : void 0;
function BF(t) {
  return jg ? Object(jg.call(t)) : {};
}
var DF = "[object Boolean]", NF = "[object Date]", FF = "[object Map]", OF = "[object Number]", RF = "[object RegExp]", MF = "[object Set]", PF = "[object String]", zF = "[object Symbol]", VF = "[object ArrayBuffer]", qF = "[object DataView]", $F = "[object Float32Array]", YF = "[object Float64Array]", WF = "[object Int8Array]", UF = "[object Int16Array]", HF = "[object Int32Array]", GF = "[object Uint8Array]", jF = "[object Uint8ClampedArray]", XF = "[object Uint16Array]", KF = "[object Uint32Array]";
function QF(t, e, n) {
  var i = t.constructor;
  switch (e) {
    case VF:
      return _f(t);
    case DF:
    case NF:
      return new i(+t);
    case qF:
      return AF(t, n);
    case $F:
    case YF:
    case WF:
    case UF:
    case HF:
    case GF:
    case jF:
    case XF:
    case KF:
      return ax(t, n);
    case FF:
      return new i();
    case OF:
    case PF:
      return new i(t);
    case RF:
      return IF(t);
    case MF:
      return new i();
    case zF:
      return BF(t);
  }
}
var ZF = "[object Map]";
function JF(t) {
  return Wi(t) && ri(t) == ZF;
}
var Xg = va && va.isMap, tO = Xg ? Xu(Xg) : JF, eO = "[object Set]";
function nO(t) {
  return Wi(t) && ri(t) == eO;
}
var Kg = va && va.isSet, iO = Kg ? Xu(Kg) : nO, rO = 1, sO = 2, aO = 4, O3 = "[object Arguments]", oO = "[object Array]", lO = "[object Boolean]", cO = "[object Date]", uO = "[object Error]", R3 = "[object Function]", hO = "[object GeneratorFunction]", dO = "[object Map]", fO = "[object Number]", M3 = "[object Object]", pO = "[object RegExp]", gO = "[object Set]", yO = "[object String]", mO = "[object Symbol]", xO = "[object WeakMap]", bO = "[object ArrayBuffer]", _O = "[object DataView]", kO = "[object Float32Array]", TO = "[object Float64Array]", wO = "[object Int8Array]", vO = "[object Int16Array]", EO = "[object Int32Array]", CO = "[object Uint8Array]", SO = "[object Uint8ClampedArray]", AO = "[object Uint16Array]", LO = "[object Uint32Array]", ye = {};
ye[O3] = ye[oO] = ye[bO] = ye[_O] = ye[lO] = ye[cO] = ye[kO] = ye[TO] = ye[wO] = ye[vO] = ye[EO] = ye[dO] = ye[fO] = ye[M3] = ye[pO] = ye[gO] = ye[yO] = ye[mO] = ye[CO] = ye[SO] = ye[AO] = ye[LO] = !0;
ye[uO] = ye[R3] = ye[xO] = !1;
function Io(t, e, n, i, r, s) {
  var a, o = e & rO, l = e & sO, u = e & aO;
  if (a !== void 0)
    return a;
  if (!qn(t))
    return t;
  var h = Ve(t);
  if (h) {
    if (a = SF(t), !o)
      return ox(t, a);
  } else {
    var f = ri(t), d = f == R3 || f == hO;
    if (wa(t))
      return sx(t, o);
    if (f == M3 || f == O3 || d && !r) {
      if (a = l || d ? {} : cx(t), !o)
        return l ? wF(t, xF(a, t)) : kF(t, mF(a, t));
    } else {
      if (!ye[f])
        return r ? t : {};
      a = QF(t, f, o);
    }
  }
  s || (s = new wi());
  var p = s.get(t);
  if (p)
    return p;
  s.set(t, a), iO(t) ? t.forEach(function(_) {
    a.add(Io(_, e, n, _, t, s));
  }) : tO(t) && t.forEach(function(_, T) {
    a.set(T, Io(_, e, n, T, t, s));
  });
  var y = u ? l ? vF : a1 : l ? Rs : Pn, m = h ? void 0 : y(t);
  return A3(m || t, function(_, T) {
    m && (T = _, _ = t[T]), Qu(a, T, Io(_, e, n, T, t, s));
  }), a;
}
var IO = 4;
function P3(t) {
  return Io(t, IO);
}
var BO = 1, DO = 4;
function NO(t) {
  return Io(t, BO | DO);
}
var FO = "__lodash_hash_undefined__";
function OO(t) {
  return this.__data__.set(t, FO), this;
}
function RO(t) {
  return this.__data__.has(t);
}
function tl(t) {
  var e = -1, n = t == null ? 0 : t.length;
  for (this.__data__ = new Er(); ++e < n; )
    this.add(t[e]);
}
tl.prototype.add = tl.prototype.push = OO;
tl.prototype.has = RO;
function MO(t, e) {
  for (var n = -1, i = t == null ? 0 : t.length; ++n < i; )
    if (e(t[n], n, t))
      return !0;
  return !1;
}
function z3(t, e) {
  return t.has(e);
}
var PO = 1, zO = 2;
function V3(t, e, n, i, r, s) {
  var a = n & PO, o = t.length, l = e.length;
  if (o != l && !(a && l > o))
    return !1;
  var u = s.get(t), h = s.get(e);
  if (u && h)
    return u == e && h == t;
  var f = -1, d = !0, p = n & zO ? new tl() : void 0;
  for (s.set(t, e), s.set(e, t); ++f < o; ) {
    var y = t[f], m = e[f];
    if (i)
      var _ = a ? i(m, y, f, e, t, s) : i(y, m, f, t, e, s);
    if (_ !== void 0) {
      if (_)
        continue;
      d = !1;
      break;
    }
    if (p) {
      if (!MO(e, function(T, v) {
        if (!z3(p, v) && (y === T || r(y, T, n, i, s)))
          return p.push(v);
      })) {
        d = !1;
        break;
      }
    } else if (!(y === m || r(y, m, n, i, s))) {
      d = !1;
      break;
    }
  }
  return s.delete(t), s.delete(e), d;
}
function VO(t) {
  var e = -1, n = Array(t.size);
  return t.forEach(function(i, r) {
    n[++e] = [r, i];
  }), n;
}
function jf(t) {
  var e = -1, n = Array(t.size);
  return t.forEach(function(i) {
    n[++e] = i;
  }), n;
}
var qO = 1, $O = 2, YO = "[object Boolean]", WO = "[object Date]", UO = "[object Error]", HO = "[object Map]", GO = "[object Number]", jO = "[object RegExp]", XO = "[object Set]", KO = "[object String]", QO = "[object Symbol]", ZO = "[object ArrayBuffer]", JO = "[object DataView]", Qg = ci ? ci.prototype : void 0, sd = Qg ? Qg.valueOf : void 0;
function tR(t, e, n, i, r, s, a) {
  switch (n) {
    case JO:
      if (t.byteLength != e.byteLength || t.byteOffset != e.byteOffset)
        return !1;
      t = t.buffer, e = e.buffer;
    case ZO:
      return !(t.byteLength != e.byteLength || !s(new Qc(t), new Qc(e)));
    case YO:
    case WO:
    case GO:
      return za(+t, +e);
    case UO:
      return t.name == e.name && t.message == e.message;
    case jO:
    case KO:
      return t == e + "";
    case HO:
      var o = VO;
    case XO:
      var l = i & qO;
      if (o || (o = jf), t.size != e.size && !l)
        return !1;
      var u = a.get(t);
      if (u)
        return u == e;
      i |= $O, a.set(t, e);
      var h = V3(o(t), o(e), i, r, s, a);
      return a.delete(t), h;
    case QO:
      if (sd)
        return sd.call(t) == sd.call(e);
  }
  return !1;
}
var eR = 1, nR = Object.prototype, iR = nR.hasOwnProperty;
function rR(t, e, n, i, r, s) {
  var a = n & eR, o = a1(t), l = o.length, u = a1(e), h = u.length;
  if (l != h && !a)
    return !1;
  for (var f = l; f--; ) {
    var d = o[f];
    if (!(a ? d in e : iR.call(e, d)))
      return !1;
  }
  var p = s.get(t), y = s.get(e);
  if (p && y)
    return p == e && y == t;
  var m = !0;
  s.set(t, e), s.set(e, t);
  for (var _ = a; ++f < l; ) {
    d = o[f];
    var T = t[d], v = e[d];
    if (i)
      var A = a ? i(v, T, d, e, t, s) : i(T, v, d, t, e, s);
    if (!(A === void 0 ? T === v || r(T, v, n, i, s) : A)) {
      m = !1;
      break;
    }
    _ || (_ = d == "constructor");
  }
  if (m && !_) {
    var L = t.constructor, w = e.constructor;
    L != w && "constructor" in t && "constructor" in e && !(typeof L == "function" && L instanceof L && typeof w == "function" && w instanceof w) && (m = !1);
  }
  return s.delete(t), s.delete(e), m;
}
var sR = 1, Zg = "[object Arguments]", Jg = "[object Array]", Ql = "[object Object]", aR = Object.prototype, t2 = aR.hasOwnProperty;
function oR(t, e, n, i, r, s) {
  var a = Ve(t), o = Ve(e), l = a ? Jg : ri(t), u = o ? Jg : ri(e);
  l = l == Zg ? Ql : l, u = u == Zg ? Ql : u;
  var h = l == Ql, f = u == Ql, d = l == u;
  if (d && wa(t)) {
    if (!wa(e))
      return !1;
    a = !0, h = !1;
  }
  if (d && !h)
    return s || (s = new wi()), a || Ku(t) ? V3(t, e, n, i, r, s) : tR(t, e, l, n, i, r, s);
  if (!(n & sR)) {
    var p = h && t2.call(t, "__wrapped__"), y = f && t2.call(e, "__wrapped__");
    if (p || y) {
      var m = p ? t.value() : t, _ = y ? e.value() : e;
      return s || (s = new wi()), r(m, _, n, i, s);
    }
  }
  return d ? (s || (s = new wi()), rR(t, e, n, i, r, s)) : !1;
}
function Xf(t, e, n, i, r) {
  return t === e ? !0 : t == null || e == null || !Wi(t) && !Wi(e) ? t !== t && e !== e : oR(t, e, n, i, Xf, r);
}
var lR = 1, cR = 2;
function uR(t, e, n, i) {
  var r = n.length, s = r;
  if (t == null)
    return !s;
  for (t = Object(t); r--; ) {
    var a = n[r];
    if (a[2] ? a[1] !== t[a[0]] : !(a[0] in t))
      return !1;
  }
  for (; ++r < s; ) {
    a = n[r];
    var o = a[0], l = t[o], u = a[1];
    if (a[2]) {
      if (l === void 0 && !(o in t))
        return !1;
    } else {
      var h = new wi(), f;
      if (!(f === void 0 ? Xf(u, l, lR | cR, i, h) : f))
        return !1;
    }
  }
  return !0;
}
function q3(t) {
  return t === t && !qn(t);
}
function hR(t) {
  for (var e = Pn(t), n = e.length; n--; ) {
    var i = e[n], r = t[i];
    e[n] = [i, r, q3(r)];
  }
  return e;
}
function $3(t, e) {
  return function(n) {
    return n == null ? !1 : n[t] === e && (e !== void 0 || t in Object(n));
  };
}
function dR(t) {
  var e = hR(t);
  return e.length == 1 && e[0][2] ? $3(e[0][0], e[0][1]) : function(n) {
    return n === t || uR(n, t, e);
  };
}
function fR(t, e) {
  return t != null && e in Object(t);
}
function Y3(t, e, n) {
  e = dh(e, t);
  for (var i = -1, r = e.length, s = !1; ++i < r; ) {
    var a = Al(e[i]);
    if (!(s = t != null && n(t, a)))
      break;
    t = t[a];
  }
  return s || ++i != r ? s : (r = t == null ? 0 : t.length, !!r && Tf(r) && Zu(a, r) && (Ve(t) || Ta(t)));
}
function W3(t, e) {
  return t != null && Y3(t, e, fR);
}
var pR = 1, gR = 2;
function yR(t, e) {
  return Wf(t) && q3(e) ? $3(Al(t), e) : function(n) {
    var i = fF(n, t);
    return i === void 0 && i === e ? W3(n, t) : Xf(e, i, pR | gR);
  };
}
function mR(t) {
  return function(e) {
    return e?.[t];
  };
}
function xR(t) {
  return function(e) {
    return fh(e, t);
  };
}
function bR(t) {
  return Wf(t) ? mR(Al(t)) : xR(t);
}
function Hr(t) {
  return typeof t == "function" ? t : t == null ? Ms : typeof t == "object" ? Ve(t) ? yR(t[0], t[1]) : dR(t) : bR(t);
}
function Kf(t, e) {
  return t && bf(t, e, Pn);
}
function _R(t, e) {
  return function(n, i) {
    if (n == null)
      return n;
    if (!Yr(n))
      return t(n, i);
    for (var r = n.length, s = -1, a = Object(n); ++s < r && i(a[s], s, a) !== !1; )
      ;
    return n;
  };
}
var ph = _R(Kf), U3 = Object.prototype, kR = U3.hasOwnProperty, Hs = Ju(function(t, e) {
  t = Object(t);
  var n = -1, i = e.length, r = i > 2 ? e[2] : void 0;
  for (r && jo(e[0], e[1], r) && (i = 1); ++n < i; )
    for (var s = e[n], a = Rs(s), o = -1, l = a.length; ++o < l; ) {
      var u = a[o], h = t[u];
      (h === void 0 || za(h, U3[u]) && !kR.call(t, u)) && (t[u] = s[u]);
    }
  return t;
});
function pu(t) {
  var e = t == null ? 0 : t.length;
  return e ? t[e - 1] : void 0;
}
function Qf(t) {
  return typeof t == "function" ? t : Ms;
}
function gt(t, e) {
  var n = Ve(t) ? A3 : ph;
  return n(t, Qf(e));
}
function TR(t, e) {
  var n = [];
  return ph(t, function(i, r, s) {
    e(i, r, s) && n.push(i);
  }), n;
}
function hr(t, e) {
  var n = Ve(t) ? B3 : TR;
  return n(t, Hr(e));
}
function wR(t) {
  return function(e, n, i) {
    var r = Object(e);
    if (!Yr(e)) {
      var s = Hr(n);
      e = Pn(e), n = function(o) {
        return s(r[o], o, r);
      };
    }
    var a = t(e, n, i);
    return a > -1 ? r[s ? e[a] : a] : void 0;
  };
}
var vR = Math.max;
function ER(t, e, n) {
  var i = t == null ? 0 : t.length;
  if (!i)
    return -1;
  var r = n == null ? 0 : tF(n);
  return r < 0 && (r = vR(i + r, 0)), L3(t, Hr(e), r);
}
var Zf = wR(ER);
function H3(t, e) {
  var n = -1, i = Yr(t) ? Array(t.length) : [];
  return ph(t, function(r, s, a) {
    i[++n] = e(r, s, a);
  }), i;
}
function ze(t, e) {
  var n = Ve(t) ? la : H3;
  return n(t, Hr(e));
}
function CR(t, e) {
  return t == null ? t : bf(t, Qf(e), Rs);
}
function SR(t, e) {
  return t && Kf(t, Qf(e));
}
function AR(t, e) {
  return t > e;
}
var LR = Object.prototype, IR = LR.hasOwnProperty;
function BR(t, e) {
  return t != null && IR.call(t, e);
}
function Ht(t, e) {
  return t != null && Y3(t, e, BR);
}
function DR(t, e) {
  return la(e, function(n) {
    return t[n];
  });
}
function mr(t) {
  return t == null ? [] : DR(t, Pn(t));
}
function De(t) {
  return t === void 0;
}
function G3(t, e) {
  return t < e;
}
function gh(t, e) {
  var n = {};
  return e = Hr(e), Kf(t, function(i, r, s) {
    Gu(n, r, e(i, r, s));
  }), n;
}
function Jf(t, e, n) {
  for (var i = -1, r = t.length; ++i < r; ) {
    var s = t[i], a = e(s);
    if (a != null && (o === void 0 ? a === a && !bs(a) : n(a, o)))
      var o = a, l = s;
  }
  return l;
}
function _s(t) {
  return t && t.length ? Jf(t, Ms, AR) : void 0;
}
function el(t) {
  return t && t.length ? Jf(t, Ms, G3) : void 0;
}
function t0(t, e) {
  return t && t.length ? Jf(t, Hr(e), G3) : void 0;
}
function NR(t, e, n, i) {
  if (!qn(t))
    return t;
  e = dh(e, t);
  for (var r = -1, s = e.length, a = s - 1, o = t; o != null && ++r < s; ) {
    var l = Al(e[r]), u = n;
    if (l === "__proto__" || l === "constructor" || l === "prototype")
      return t;
    if (r != a) {
      var h = o[l];
      u = void 0, u === void 0 && (u = qn(h) ? h : Zu(e[r + 1]) ? [] : {});
    }
    Qu(o, l, u), o = o[l];
  }
  return t;
}
function FR(t, e, n) {
  for (var i = -1, r = e.length, s = {}; ++i < r; ) {
    var a = e[i], o = fh(t, a);
    n(o, a) && NR(s, dh(a, t), o);
  }
  return s;
}
function OR(t, e) {
  var n = t.length;
  for (t.sort(e); n--; )
    t[n] = t[n].value;
  return t;
}
function RR(t, e) {
  if (t !== e) {
    var n = t !== void 0, i = t === null, r = t === t, s = bs(t), a = e !== void 0, o = e === null, l = e === e, u = bs(e);
    if (!o && !u && !s && t > e || s && a && l && !o && !u || i && a && l || !n && l || !r)
      return 1;
    if (!i && !s && !u && t < e || u && n && r && !i && !s || o && n && r || !a && r || !l)
      return -1;
  }
  return 0;
}
function MR(t, e, n) {
  for (var i = -1, r = t.criteria, s = e.criteria, a = r.length, o = n.length; ++i < a; ) {
    var l = RR(r[i], s[i]);
    if (l) {
      if (i >= o)
        return l;
      var u = n[i];
      return l * (u == "desc" ? -1 : 1);
    }
  }
  return t.index - e.index;
}
function PR(t, e, n) {
  e.length ? e = la(e, function(s) {
    return Ve(s) ? function(a) {
      return fh(a, s.length === 1 ? s[0] : s);
    } : s;
  }) : e = [Ms];
  var i = -1;
  e = la(e, Xu(Hr));
  var r = H3(t, function(s, a, o) {
    var l = la(e, function(u) {
      return u(s);
    });
    return { criteria: l, index: ++i, value: s };
  });
  return OR(r, function(s, a) {
    return MR(s, a, n);
  });
}
function zR(t, e) {
  return FR(t, e, function(n, i) {
    return W3(t, i);
  });
}
var nl = gF(function(t, e) {
  return t == null ? {} : zR(t, e);
}), VR = Math.ceil, qR = Math.max;
function $R(t, e, n, i) {
  for (var r = -1, s = qR(VR((e - t) / (n || 1)), 0), a = Array(s); s--; )
    a[++r] = t, t += n;
  return a;
}
function YR(t) {
  return function(e, n, i) {
    return i && typeof i != "number" && jo(e, n, i) && (n = i = void 0), e = bc(e), n === void 0 ? (n = e, e = 0) : n = bc(n), i = i === void 0 ? e < n ? 1 : -1 : bc(i), $R(e, n, i);
  };
}
var ks = YR();
function WR(t, e, n, i, r) {
  return r(t, function(s, a, o) {
    n = i ? (i = !1, s) : e(n, s, a, o);
  }), n;
}
function Ll(t, e, n) {
  var i = Ve(t) ? yF : WR, r = arguments.length < 3;
  return i(t, Hr(e), n, r, ph);
}
var Il = Ju(function(t, e) {
  if (t == null)
    return [];
  var n = e.length;
  return n > 1 && jo(t, e[0], e[1]) ? e = [] : n > 2 && jo(e[0], e[1], e[2]) && (e = [e[0]]), PR(t, Hf(e), []);
}), UR = 1 / 0, HR = aa && 1 / jf(new aa([, -0]))[1] == UR ? function(t) {
  return new aa(t);
} : eF, GR = 200;
function jR(t, e, n) {
  var i = -1, r = sF, s = t.length, a = !0, o = [], l = o;
  if (s >= GR) {
    var u = HR(t);
    if (u)
      return jf(u);
    a = !1, r = z3, l = new tl();
  } else
    l = o;
  t:
    for (; ++i < s; ) {
      var h = t[i], f = h;
      if (h = h !== 0 ? h : 0, a && f === f) {
        for (var d = l.length; d--; )
          if (l[d] === f)
            continue t;
        o.push(h);
      } else r(l, f, n) || (l !== o && l.push(f), o.push(h));
    }
  return o;
}
var XR = Ju(function(t) {
  return jR(Hf(t, 1, hx, !0));
}), KR = 0;
function yh(t) {
  var e = ++KR;
  return I3(t) + e;
}
function QR(t, e, n) {
  for (var i = -1, r = t.length, s = e.length, a = {}; ++i < r; ) {
    var o = i < s ? e[i] : void 0;
    n(a, t[i], o);
  }
  return a;
}
function ZR(t, e) {
  return QR(t || [], e || [], Qu);
}
var JR = "\0", Qr = "\0", e2 = "";
class qe {
  constructor(e = {}) {
    this._isDirected = Ht(e, "directed") ? e.directed : !0, this._isMultigraph = Ht(e, "multigraph") ? e.multigraph : !1, this._isCompound = Ht(e, "compound") ? e.compound : !1, this._label = void 0, this._defaultNodeLabelFn = Qs(void 0), this._defaultEdgeLabelFn = Qs(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[Qr] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {};
  }
  /* === Graph functions ========= */
  isDirected() {
    return this._isDirected;
  }
  isMultigraph() {
    return this._isMultigraph;
  }
  isCompound() {
    return this._isCompound;
  }
  setGraph(e) {
    return this._label = e, this;
  }
  graph() {
    return this._label;
  }
  /* === Node functions ========== */
  setDefaultNodeLabel(e) {
    return ka(e) || (e = Qs(e)), this._defaultNodeLabelFn = e, this;
  }
  nodeCount() {
    return this._nodeCount;
  }
  nodes() {
    return Pn(this._nodes);
  }
  sources() {
    var e = this;
    return hr(this.nodes(), function(n) {
      return Co(e._in[n]);
    });
  }
  sinks() {
    var e = this;
    return hr(this.nodes(), function(n) {
      return Co(e._out[n]);
    });
  }
  setNodes(e, n) {
    var i = arguments, r = this;
    return gt(e, function(s) {
      i.length > 1 ? r.setNode(s, n) : r.setNode(s);
    }), this;
  }
  setNode(e, n) {
    return Ht(this._nodes, e) ? (arguments.length > 1 && (this._nodes[e] = n), this) : (this._nodes[e] = arguments.length > 1 ? n : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = Qr, this._children[e] = {}, this._children[Qr][e] = !0), this._in[e] = {}, this._preds[e] = {}, this._out[e] = {}, this._sucs[e] = {}, ++this._nodeCount, this);
  }
  node(e) {
    return this._nodes[e];
  }
  hasNode(e) {
    return Ht(this._nodes, e);
  }
  removeNode(e) {
    var n = this;
    if (Ht(this._nodes, e)) {
      var i = function(r) {
        n.removeEdge(n._edgeObjs[r]);
      };
      delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], gt(this.children(e), function(r) {
        n.setParent(r);
      }), delete this._children[e]), gt(Pn(this._in[e]), i), delete this._in[e], delete this._preds[e], gt(Pn(this._out[e]), i), delete this._out[e], delete this._sucs[e], --this._nodeCount;
    }
    return this;
  }
  setParent(e, n) {
    if (!this._isCompound)
      throw new Error("Cannot set parent in a non-compound graph");
    if (De(n))
      n = Qr;
    else {
      n += "";
      for (var i = n; !De(i); i = this.parent(i))
        if (i === e)
          throw new Error("Setting " + n + " as parent of " + e + " would create a cycle");
      this.setNode(n);
    }
    return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = n, this._children[n][e] = !0, this;
  }
  _removeFromParentsChildList(e) {
    delete this._children[this._parent[e]][e];
  }
  parent(e) {
    if (this._isCompound) {
      var n = this._parent[e];
      if (n !== Qr)
        return n;
    }
  }
  children(e) {
    if (De(e) && (e = Qr), this._isCompound) {
      var n = this._children[e];
      if (n)
        return Pn(n);
    } else {
      if (e === Qr)
        return this.nodes();
      if (this.hasNode(e))
        return [];
    }
  }
  predecessors(e) {
    var n = this._preds[e];
    if (n)
      return Pn(n);
  }
  successors(e) {
    var n = this._sucs[e];
    if (n)
      return Pn(n);
  }
  neighbors(e) {
    var n = this.predecessors(e);
    if (n)
      return XR(n, this.successors(e));
  }
  isLeaf(e) {
    var n;
    return this.isDirected() ? n = this.successors(e) : n = this.neighbors(e), n.length === 0;
  }
  filterNodes(e) {
    var n = new this.constructor({
      directed: this._isDirected,
      multigraph: this._isMultigraph,
      compound: this._isCompound
    });
    n.setGraph(this.graph());
    var i = this;
    gt(this._nodes, function(a, o) {
      e(o) && n.setNode(o, a);
    }), gt(this._edgeObjs, function(a) {
      n.hasNode(a.v) && n.hasNode(a.w) && n.setEdge(a, i.edge(a));
    });
    var r = {};
    function s(a) {
      var o = i.parent(a);
      return o === void 0 || n.hasNode(o) ? (r[a] = o, o) : o in r ? r[o] : s(o);
    }
    return this._isCompound && gt(n.nodes(), function(a) {
      n.setParent(a, s(a));
    }), n;
  }
  /* === Edge functions ========== */
  setDefaultEdgeLabel(e) {
    return ka(e) || (e = Qs(e)), this._defaultEdgeLabelFn = e, this;
  }
  edgeCount() {
    return this._edgeCount;
  }
  edges() {
    return mr(this._edgeObjs);
  }
  setPath(e, n) {
    var i = this, r = arguments;
    return Ll(e, function(s, a) {
      return r.length > 1 ? i.setEdge(s, a, n) : i.setEdge(s, a), a;
    }), this;
  }
  /*
   * setEdge(v, w, [value, [name]])
   * setEdge({ v, w, [name] }, [value])
   */
  setEdge() {
    var e, n, i, r, s = !1, a = arguments[0];
    typeof a == "object" && a !== null && "v" in a ? (e = a.v, n = a.w, i = a.name, arguments.length === 2 && (r = arguments[1], s = !0)) : (e = a, n = arguments[1], i = arguments[3], arguments.length > 2 && (r = arguments[2], s = !0)), e = "" + e, n = "" + n, De(i) || (i = "" + i);
    var o = yo(this._isDirected, e, n, i);
    if (Ht(this._edgeLabels, o))
      return s && (this._edgeLabels[o] = r), this;
    if (!De(i) && !this._isMultigraph)
      throw new Error("Cannot set a named edge when isMultigraph = false");
    this.setNode(e), this.setNode(n), this._edgeLabels[o] = s ? r : this._defaultEdgeLabelFn(e, n, i);
    var l = tM(this._isDirected, e, n, i);
    return e = l.v, n = l.w, Object.freeze(l), this._edgeObjs[o] = l, n2(this._preds[n], e), n2(this._sucs[e], n), this._in[n][o] = l, this._out[e][o] = l, this._edgeCount++, this;
  }
  edge(e, n, i) {
    var r = arguments.length === 1 ? ad(this._isDirected, arguments[0]) : yo(this._isDirected, e, n, i);
    return this._edgeLabels[r];
  }
  hasEdge(e, n, i) {
    var r = arguments.length === 1 ? ad(this._isDirected, arguments[0]) : yo(this._isDirected, e, n, i);
    return Ht(this._edgeLabels, r);
  }
  removeEdge(e, n, i) {
    var r = arguments.length === 1 ? ad(this._isDirected, arguments[0]) : yo(this._isDirected, e, n, i), s = this._edgeObjs[r];
    return s && (e = s.v, n = s.w, delete this._edgeLabels[r], delete this._edgeObjs[r], i2(this._preds[n], e), i2(this._sucs[e], n), delete this._in[n][r], delete this._out[e][r], this._edgeCount--), this;
  }
  inEdges(e, n) {
    var i = this._in[e];
    if (i) {
      var r = mr(i);
      return n ? hr(r, function(s) {
        return s.v === n;
      }) : r;
    }
  }
  outEdges(e, n) {
    var i = this._out[e];
    if (i) {
      var r = mr(i);
      return n ? hr(r, function(s) {
        return s.w === n;
      }) : r;
    }
  }
  nodeEdges(e, n) {
    var i = this.inEdges(e, n);
    if (i)
      return i.concat(this.outEdges(e, n));
  }
}
qe.prototype._nodeCount = 0;
qe.prototype._edgeCount = 0;
function n2(t, e) {
  t[e] ? t[e]++ : t[e] = 1;
}
function i2(t, e) {
  --t[e] || delete t[e];
}
function yo(t, e, n, i) {
  var r = "" + e, s = "" + n;
  if (!t && r > s) {
    var a = r;
    r = s, s = a;
  }
  return r + e2 + s + e2 + (De(i) ? JR : i);
}
function tM(t, e, n, i) {
  var r = "" + e, s = "" + n;
  if (!t && r > s) {
    var a = r;
    r = s, s = a;
  }
  var o = { v: r, w: s };
  return i && (o.name = i), o;
}
function ad(t, e) {
  return yo(t, e.v, e.w, e.name);
}
class eM {
  constructor() {
    var e = {};
    e._next = e._prev = e, this._sentinel = e;
  }
  dequeue() {
    var e = this._sentinel, n = e._prev;
    if (n !== e)
      return r2(n), n;
  }
  enqueue(e) {
    var n = this._sentinel;
    e._prev && e._next && r2(e), e._next = n._next, n._next._prev = e, n._next = e, e._prev = n;
  }
  toString() {
    for (var e = [], n = this._sentinel, i = n._prev; i !== n; )
      e.push(JSON.stringify(i, nM)), i = i._prev;
    return "[" + e.join(", ") + "]";
  }
}
function r2(t) {
  t._prev._next = t._next, t._next._prev = t._prev, delete t._next, delete t._prev;
}
function nM(t, e) {
  if (t !== "_next" && t !== "_prev")
    return e;
}
var iM = Qs(1);
function rM(t, e) {
  if (t.nodeCount() <= 1)
    return [];
  var n = aM(t, e || iM), i = sM(n.graph, n.buckets, n.zeroIdx);
  return Wa(
    ze(i, function(r) {
      return t.outEdges(r.v, r.w);
    })
  );
}
function sM(t, e, n) {
  for (var i = [], r = e[e.length - 1], s = e[0], a; t.nodeCount(); ) {
    for (; a = s.dequeue(); )
      od(t, e, n, a);
    for (; a = r.dequeue(); )
      od(t, e, n, a);
    if (t.nodeCount()) {
      for (var o = e.length - 2; o > 0; --o)
        if (a = e[o].dequeue(), a) {
          i = i.concat(od(t, e, n, a, !0));
          break;
        }
    }
  }
  return i;
}
function od(t, e, n, i, r) {
  var s = r ? [] : void 0;
  return gt(t.inEdges(i.v), function(a) {
    var o = t.edge(a), l = t.node(a.v);
    r && s.push({ v: a.v, w: a.w }), l.out -= o, o1(e, n, l);
  }), gt(t.outEdges(i.v), function(a) {
    var o = t.edge(a), l = a.w, u = t.node(l);
    u.in -= o, o1(e, n, u);
  }), t.removeNode(i.v), s;
}
function aM(t, e) {
  var n = new qe(), i = 0, r = 0;
  gt(t.nodes(), function(o) {
    n.setNode(o, { v: o, in: 0, out: 0 });
  }), gt(t.edges(), function(o) {
    var l = n.edge(o.v, o.w) || 0, u = e(o), h = l + u;
    n.setEdge(o.v, o.w, h), r = Math.max(r, n.node(o.v).out += u), i = Math.max(i, n.node(o.w).in += u);
  });
  var s = ks(r + i + 3).map(function() {
    return new eM();
  }), a = i + 1;
  return gt(n.nodes(), function(o) {
    o1(s, a, n.node(o));
  }), { graph: n, buckets: s, zeroIdx: a };
}
function o1(t, e, n) {
  n.out ? n.in ? t[n.out - n.in + e].enqueue(n) : t[t.length - 1].enqueue(n) : t[0].enqueue(n);
}
function oM(t) {
  var e = t.graph().acyclicer === "greedy" ? rM(t, n(t)) : lM(t);
  gt(e, function(i) {
    var r = t.edge(i);
    t.removeEdge(i), r.forwardName = i.name, r.reversed = !0, t.setEdge(i.w, i.v, r, yh("rev"));
  });
  function n(i) {
    return function(r) {
      return i.edge(r).weight;
    };
  }
}
function lM(t) {
  var e = [], n = {}, i = {};
  function r(s) {
    Ht(i, s) || (i[s] = !0, n[s] = !0, gt(t.outEdges(s), function(a) {
      Ht(n, a.w) ? e.push(a) : r(a.w);
    }), delete n[s]);
  }
  return gt(t.nodes(), r), e;
}
function cM(t) {
  gt(t.edges(), function(e) {
    var n = t.edge(e);
    if (n.reversed) {
      t.removeEdge(e);
      var i = n.forwardName;
      delete n.reversed, delete n.forwardName, t.setEdge(e.w, e.v, n, i);
    }
  });
}
function Ua(t, e, n, i) {
  var r;
  do
    r = yh(i);
  while (t.hasNode(r));
  return n.dummy = e, t.setNode(r, n), r;
}
function uM(t) {
  var e = new qe().setGraph(t.graph());
  return gt(t.nodes(), function(n) {
    e.setNode(n, t.node(n));
  }), gt(t.edges(), function(n) {
    var i = e.edge(n.v, n.w) || { weight: 0, minlen: 1 }, r = t.edge(n);
    e.setEdge(n.v, n.w, {
      weight: i.weight + r.weight,
      minlen: Math.max(i.minlen, r.minlen)
    });
  }), e;
}
function j3(t) {
  var e = new qe({ multigraph: t.isMultigraph() }).setGraph(t.graph());
  return gt(t.nodes(), function(n) {
    t.children(n).length || e.setNode(n, t.node(n));
  }), gt(t.edges(), function(n) {
    e.setEdge(n, t.edge(n));
  }), e;
}
function s2(t, e) {
  var n = t.x, i = t.y, r = e.x - n, s = e.y - i, a = t.width / 2, o = t.height / 2;
  if (!r && !s)
    throw new Error("Not possible to find intersection inside of the rectangle");
  var l, u;
  return Math.abs(s) * a > Math.abs(r) * o ? (s < 0 && (o = -o), l = o * r / s, u = o) : (r < 0 && (a = -a), l = a, u = a * s / r), { x: n + l, y: i + u };
}
function mh(t) {
  var e = ze(ks(X3(t) + 1), function() {
    return [];
  });
  return gt(t.nodes(), function(n) {
    var i = t.node(n), r = i.rank;
    De(r) || (e[r][i.order] = n);
  }), e;
}
function hM(t) {
  var e = el(
    ze(t.nodes(), function(n) {
      return t.node(n).rank;
    })
  );
  gt(t.nodes(), function(n) {
    var i = t.node(n);
    Ht(i, "rank") && (i.rank -= e);
  });
}
function dM(t) {
  var e = el(
    ze(t.nodes(), function(s) {
      return t.node(s).rank;
    })
  ), n = [];
  gt(t.nodes(), function(s) {
    var a = t.node(s).rank - e;
    n[a] || (n[a] = []), n[a].push(s);
  });
  var i = 0, r = t.graph().nodeRankFactor;
  gt(n, function(s, a) {
    De(s) && a % r !== 0 ? --i : i && gt(s, function(o) {
      t.node(o).rank += i;
    });
  });
}
function a2(t, e, n, i) {
  var r = {
    width: 0,
    height: 0
  };
  return arguments.length >= 4 && (r.rank = n, r.order = i), Ua(t, "border", r, e);
}
function X3(t) {
  return _s(
    ze(t.nodes(), function(e) {
      var n = t.node(e).rank;
      if (!De(n))
        return n;
    })
  );
}
function fM(t, e) {
  var n = { lhs: [], rhs: [] };
  return gt(t, function(i) {
    e(i) ? n.lhs.push(i) : n.rhs.push(i);
  }), n;
}
function pM(t, e) {
  return e();
}
function gM(t) {
  function e(n) {
    var i = t.children(n), r = t.node(n);
    if (i.length && gt(i, e), Ht(r, "minRank")) {
      r.borderLeft = [], r.borderRight = [];
      for (var s = r.minRank, a = r.maxRank + 1; s < a; ++s)
        o2(t, "borderLeft", "_bl", n, r, s), o2(t, "borderRight", "_br", n, r, s);
    }
  }
  gt(t.children(), e);
}
function o2(t, e, n, i, r, s) {
  var a = { width: 0, height: 0, rank: s, borderType: e }, o = r[e][s - 1], l = Ua(t, "border", a, n);
  r[e][s] = l, t.setParent(l, i), o && t.setEdge(o, l, { weight: 1 });
}
function yM(t) {
  var e = t.graph().rankdir.toLowerCase();
  (e === "lr" || e === "rl") && K3(t);
}
function mM(t) {
  var e = t.graph().rankdir.toLowerCase();
  (e === "bt" || e === "rl") && xM(t), (e === "lr" || e === "rl") && (bM(t), K3(t));
}
function K3(t) {
  gt(t.nodes(), function(e) {
    l2(t.node(e));
  }), gt(t.edges(), function(e) {
    l2(t.edge(e));
  });
}
function l2(t) {
  var e = t.width;
  t.width = t.height, t.height = e;
}
function xM(t) {
  gt(t.nodes(), function(e) {
    ld(t.node(e));
  }), gt(t.edges(), function(e) {
    var n = t.edge(e);
    gt(n.points, ld), Ht(n, "y") && ld(n);
  });
}
function ld(t) {
  t.y = -t.y;
}
function bM(t) {
  gt(t.nodes(), function(e) {
    cd(t.node(e));
  }), gt(t.edges(), function(e) {
    var n = t.edge(e);
    gt(n.points, cd), Ht(n, "x") && cd(n);
  });
}
function cd(t) {
  var e = t.x;
  t.x = t.y, t.y = e;
}
function _M(t) {
  t.graph().dummyChains = [], gt(t.edges(), function(e) {
    kM(t, e);
  });
}
function kM(t, e) {
  var n = e.v, i = t.node(n).rank, r = e.w, s = t.node(r).rank, a = e.name, o = t.edge(e), l = o.labelRank;
  if (s !== i + 1) {
    t.removeEdge(e);
    var u, h, f;
    for (f = 0, ++i; i < s; ++f, ++i)
      o.points = [], h = {
        width: 0,
        height: 0,
        edgeLabel: o,
        edgeObj: e,
        rank: i
      }, u = Ua(t, "edge", h, "_d"), i === l && (h.width = o.width, h.height = o.height, h.dummy = "edge-label", h.labelpos = o.labelpos), t.setEdge(n, u, { weight: o.weight }, a), f === 0 && t.graph().dummyChains.push(u), n = u;
    t.setEdge(n, r, { weight: o.weight }, a);
  }
}
function TM(t) {
  gt(t.graph().dummyChains, function(e) {
    var n = t.node(e), i = n.edgeLabel, r;
    for (t.setEdge(n.edgeObj, i); n.dummy; )
      r = t.successors(e)[0], t.removeNode(e), i.points.push({ x: n.x, y: n.y }), n.dummy === "edge-label" && (i.x = n.x, i.y = n.y, i.width = n.width, i.height = n.height), e = r, n = t.node(e);
  });
}
function e0(t) {
  var e = {};
  function n(i) {
    var r = t.node(i);
    if (Ht(e, i))
      return r.rank;
    e[i] = !0;
    var s = el(
      ze(t.outEdges(i), function(a) {
        return n(a.w) - t.edge(a).minlen;
      })
    );
    return (s === Number.POSITIVE_INFINITY || // return value of _.map([]) for Lodash 3
    s === void 0 || // return value of _.map([]) for Lodash 4
    s === null) && (s = 0), r.rank = s;
  }
  gt(t.sources(), n);
}
function il(t, e) {
  return t.node(e.w).rank - t.node(e.v).rank - t.edge(e).minlen;
}
function Q3(t) {
  var e = new qe({ directed: !1 }), n = t.nodes()[0], i = t.nodeCount();
  e.setNode(n, {});
  for (var r, s; wM(e, t) < i; )
    r = vM(e, t), s = e.hasNode(r.v) ? il(t, r) : -il(t, r), EM(e, t, s);
  return e;
}
function wM(t, e) {
  function n(i) {
    gt(e.nodeEdges(i), function(r) {
      var s = r.v, a = i === s ? r.w : s;
      !t.hasNode(a) && !il(e, r) && (t.setNode(a, {}), t.setEdge(i, a, {}), n(a));
    });
  }
  return gt(t.nodes(), n), t.nodeCount();
}
function vM(t, e) {
  return t0(e.edges(), function(n) {
    if (t.hasNode(n.v) !== t.hasNode(n.w))
      return il(e, n);
  });
}
function EM(t, e, n) {
  gt(t.nodes(), function(i) {
    e.node(i).rank += n;
  });
}
function CM() {
}
CM.prototype = new Error();
function Z3(t, e, n) {
  Ve(e) || (e = [e]);
  var i = (t.isDirected() ? t.successors : t.neighbors).bind(t), r = [], s = {};
  return gt(e, function(a) {
    if (!t.hasNode(a))
      throw new Error("Graph does not have node: " + a);
    J3(t, a, n === "post", s, i, r);
  }), r;
}
function J3(t, e, n, i, r, s) {
  Ht(i, e) || (i[e] = !0, n || s.push(e), gt(r(e), function(a) {
    J3(t, a, n, i, r, s);
  }), n && s.push(e));
}
function SM(t, e) {
  return Z3(t, e, "post");
}
function AM(t, e) {
  return Z3(t, e, "pre");
}
qs.initLowLimValues = i0;
qs.initCutValues = n0;
qs.calcCutValue = t4;
qs.leaveEdge = n4;
qs.enterEdge = i4;
qs.exchangeEdges = r4;
function qs(t) {
  t = uM(t), e0(t);
  var e = Q3(t);
  i0(e), n0(e, t);
  for (var n, i; n = n4(e); )
    i = i4(e, t, n), r4(e, t, n, i);
}
function n0(t, e) {
  var n = SM(t, t.nodes());
  n = n.slice(0, n.length - 1), gt(n, function(i) {
    LM(t, e, i);
  });
}
function LM(t, e, n) {
  var i = t.node(n), r = i.parent;
  t.edge(n, r).cutvalue = t4(t, e, n);
}
function t4(t, e, n) {
  var i = t.node(n), r = i.parent, s = !0, a = e.edge(n, r), o = 0;
  return a || (s = !1, a = e.edge(r, n)), o = a.weight, gt(e.nodeEdges(n), function(l) {
    var u = l.v === n, h = u ? l.w : l.v;
    if (h !== r) {
      var f = u === s, d = e.edge(l).weight;
      if (o += f ? d : -d, BM(t, n, h)) {
        var p = t.edge(n, h).cutvalue;
        o += f ? -p : p;
      }
    }
  }), o;
}
function i0(t, e) {
  arguments.length < 2 && (e = t.nodes()[0]), e4(t, {}, 1, e);
}
function e4(t, e, n, i, r) {
  var s = n, a = t.node(i);
  return e[i] = !0, gt(t.neighbors(i), function(o) {
    Ht(e, o) || (n = e4(t, e, n, o, i));
  }), a.low = s, a.lim = n++, r ? a.parent = r : delete a.parent, n;
}
function n4(t) {
  return Zf(t.edges(), function(e) {
    return t.edge(e).cutvalue < 0;
  });
}
function i4(t, e, n) {
  var i = n.v, r = n.w;
  e.hasEdge(i, r) || (i = n.w, r = n.v);
  var s = t.node(i), a = t.node(r), o = s, l = !1;
  s.lim > a.lim && (o = a, l = !0);
  var u = hr(e.edges(), function(h) {
    return l === c2(t, t.node(h.v), o) && l !== c2(t, t.node(h.w), o);
  });
  return t0(u, function(h) {
    return il(e, h);
  });
}
function r4(t, e, n, i) {
  var r = n.v, s = n.w;
  t.removeEdge(r, s), t.setEdge(i.v, i.w, {}), i0(t), n0(t, e), IM(t, e);
}
function IM(t, e) {
  var n = Zf(t.nodes(), function(r) {
    return !e.node(r).parent;
  }), i = AM(t, n);
  i = i.slice(1), gt(i, function(r) {
    var s = t.node(r).parent, a = e.edge(r, s), o = !1;
    a || (a = e.edge(s, r), o = !0), e.node(r).rank = e.node(s).rank + (o ? a.minlen : -a.minlen);
  });
}
function BM(t, e, n) {
  return t.hasEdge(e, n);
}
function c2(t, e, n) {
  return n.low <= e.lim && e.lim <= n.lim;
}
function DM(t) {
  switch (t.graph().ranker) {
    case "network-simplex":
      u2(t);
      break;
    case "tight-tree":
      FM(t);
      break;
    case "longest-path":
      NM(t);
      break;
    default:
      u2(t);
  }
}
var NM = e0;
function FM(t) {
  e0(t), Q3(t);
}
function u2(t) {
  qs(t);
}
function OM(t) {
  var e = Ua(t, "root", {}, "_root"), n = RM(t), i = _s(mr(n)) - 1, r = 2 * i + 1;
  t.graph().nestingRoot = e, gt(t.edges(), function(a) {
    t.edge(a).minlen *= r;
  });
  var s = MM(t) + 1;
  gt(t.children(), function(a) {
    s4(t, e, r, s, i, n, a);
  }), t.graph().nodeRankFactor = r;
}
function s4(t, e, n, i, r, s, a) {
  var o = t.children(a);
  if (!o.length) {
    a !== e && t.setEdge(e, a, { weight: 0, minlen: n });
    return;
  }
  var l = a2(t, "_bt"), u = a2(t, "_bb"), h = t.node(a);
  t.setParent(l, a), h.borderTop = l, t.setParent(u, a), h.borderBottom = u, gt(o, function(f) {
    s4(t, e, n, i, r, s, f);
    var d = t.node(f), p = d.borderTop ? d.borderTop : f, y = d.borderBottom ? d.borderBottom : f, m = d.borderTop ? i : 2 * i, _ = p !== y ? 1 : r - s[a] + 1;
    t.setEdge(l, p, {
      weight: m,
      minlen: _,
      nestingEdge: !0
    }), t.setEdge(y, u, {
      weight: m,
      minlen: _,
      nestingEdge: !0
    });
  }), t.parent(a) || t.setEdge(e, l, { weight: 0, minlen: r + s[a] });
}
function RM(t) {
  var e = {};
  function n(i, r) {
    var s = t.children(i);
    s && s.length && gt(s, function(a) {
      n(a, r + 1);
    }), e[i] = r;
  }
  return gt(t.children(), function(i) {
    n(i, 1);
  }), e;
}
function MM(t) {
  return Ll(
    t.edges(),
    function(e, n) {
      return e + t.edge(n).weight;
    },
    0
  );
}
function PM(t) {
  var e = t.graph();
  t.removeNode(e.nestingRoot), delete e.nestingRoot, gt(t.edges(), function(n) {
    var i = t.edge(n);
    i.nestingEdge && t.removeEdge(n);
  });
}
function zM(t, e, n) {
  var i = {}, r;
  gt(n, function(s) {
    for (var a = t.parent(s), o, l; a; ) {
      if (o = t.parent(a), o ? (l = i[o], i[o] = a) : (l = r, r = a), l && l !== a) {
        e.setEdge(l, a);
        return;
      }
      a = o;
    }
  });
}
function VM(t, e, n) {
  var i = qM(t), r = new qe({ compound: !0 }).setGraph({ root: i }).setDefaultNodeLabel(function(s) {
    return t.node(s);
  });
  return gt(t.nodes(), function(s) {
    var a = t.node(s), o = t.parent(s);
    (a.rank === e || a.minRank <= e && e <= a.maxRank) && (r.setNode(s), r.setParent(s, o || i), gt(t[n](s), function(l) {
      var u = l.v === s ? l.w : l.v, h = r.edge(u, s), f = De(h) ? 0 : h.weight;
      r.setEdge(u, s, { weight: t.edge(l).weight + f });
    }), Ht(a, "minRank") && r.setNode(s, {
      borderLeft: a.borderLeft[e],
      borderRight: a.borderRight[e]
    }));
  }), r;
}
function qM(t) {
  for (var e; t.hasNode(e = yh("_root")); ) ;
  return e;
}
function $M(t, e) {
  for (var n = 0, i = 1; i < e.length; ++i)
    n += YM(t, e[i - 1], e[i]);
  return n;
}
function YM(t, e, n) {
  for (var i = ZR(
    n,
    ze(n, function(u, h) {
      return h;
    })
  ), r = Wa(
    ze(e, function(u) {
      return Il(
        ze(t.outEdges(u), function(h) {
          return { pos: i[h.w], weight: t.edge(h).weight };
        }),
        "pos"
      );
    })
  ), s = 1; s < n.length; ) s <<= 1;
  var a = 2 * s - 1;
  s -= 1;
  var o = ze(new Array(a), function() {
    return 0;
  }), l = 0;
  return gt(
    // @ts-expect-error
    r.forEach(function(u) {
      var h = u.pos + s;
      o[h] += u.weight;
      for (var f = 0; h > 0; )
        h % 2 && (f += o[h + 1]), h = h - 1 >> 1, o[h] += u.weight;
      l += u.weight * f;
    })
  ), l;
}
function WM(t) {
  var e = {}, n = hr(t.nodes(), function(o) {
    return !t.children(o).length;
  }), i = _s(
    ze(n, function(o) {
      return t.node(o).rank;
    })
  ), r = ze(ks(i + 1), function() {
    return [];
  });
  function s(o) {
    if (!Ht(e, o)) {
      e[o] = !0;
      var l = t.node(o);
      r[l.rank].push(o), gt(t.successors(o), s);
    }
  }
  var a = Il(n, function(o) {
    return t.node(o).rank;
  });
  return gt(a, s), r;
}
function UM(t, e) {
  return ze(e, function(n) {
    var i = t.inEdges(n);
    if (i.length) {
      var r = Ll(
        i,
        function(s, a) {
          var o = t.edge(a), l = t.node(a.v);
          return {
            sum: s.sum + o.weight * l.order,
            weight: s.weight + o.weight
          };
        },
        { sum: 0, weight: 0 }
      );
      return {
        v: n,
        barycenter: r.sum / r.weight,
        weight: r.weight
      };
    } else
      return { v: n };
  });
}
function HM(t, e) {
  var n = {};
  gt(t, function(r, s) {
    var a = n[r.v] = {
      indegree: 0,
      in: [],
      out: [],
      vs: [r.v],
      i: s
    };
    De(r.barycenter) || (a.barycenter = r.barycenter, a.weight = r.weight);
  }), gt(e.edges(), function(r) {
    var s = n[r.v], a = n[r.w];
    !De(s) && !De(a) && (a.indegree++, s.out.push(n[r.w]));
  });
  var i = hr(n, function(r) {
    return !r.indegree;
  });
  return GM(i);
}
function GM(t) {
  var e = [];
  function n(s) {
    return function(a) {
      a.merged || (De(a.barycenter) || De(s.barycenter) || a.barycenter >= s.barycenter) && jM(s, a);
    };
  }
  function i(s) {
    return function(a) {
      a.in.push(s), --a.indegree === 0 && t.push(a);
    };
  }
  for (; t.length; ) {
    var r = t.pop();
    e.push(r), gt(r.in.reverse(), n(r)), gt(r.out, i(r));
  }
  return ze(
    hr(e, function(s) {
      return !s.merged;
    }),
    function(s) {
      return nl(s, ["vs", "i", "barycenter", "weight"]);
    }
  );
}
function jM(t, e) {
  var n = 0, i = 0;
  t.weight && (n += t.barycenter * t.weight, i += t.weight), e.weight && (n += e.barycenter * e.weight, i += e.weight), t.vs = e.vs.concat(t.vs), t.barycenter = n / i, t.weight = i, t.i = Math.min(e.i, t.i), e.merged = !0;
}
function XM(t, e) {
  var n = fM(t, function(h) {
    return Ht(h, "barycenter");
  }), i = n.lhs, r = Il(n.rhs, function(h) {
    return -h.i;
  }), s = [], a = 0, o = 0, l = 0;
  i.sort(KM(!!e)), l = h2(s, r, l), gt(i, function(h) {
    l += h.vs.length, s.push(h.vs), a += h.barycenter * h.weight, o += h.weight, l = h2(s, r, l);
  });
  var u = { vs: Wa(s) };
  return o && (u.barycenter = a / o, u.weight = o), u;
}
function h2(t, e, n) {
  for (var i; e.length && (i = pu(e)).i <= n; )
    e.pop(), t.push(i.vs), n++;
  return n;
}
function KM(t) {
  return function(e, n) {
    return e.barycenter < n.barycenter ? -1 : e.barycenter > n.barycenter ? 1 : t ? n.i - e.i : e.i - n.i;
  };
}
function a4(t, e, n, i) {
  var r = t.children(e), s = t.node(e), a = s ? s.borderLeft : void 0, o = s ? s.borderRight : void 0, l = {};
  a && (r = hr(r, function(y) {
    return y !== a && y !== o;
  }));
  var u = UM(t, r);
  gt(u, function(y) {
    if (t.children(y.v).length) {
      var m = a4(t, y.v, n, i);
      l[y.v] = m, Ht(m, "barycenter") && ZM(y, m);
    }
  });
  var h = HM(u, n);
  QM(h, l);
  var f = XM(h, i);
  if (a && (f.vs = Wa([a, f.vs, o]), t.predecessors(a).length)) {
    var d = t.node(t.predecessors(a)[0]), p = t.node(t.predecessors(o)[0]);
    Ht(f, "barycenter") || (f.barycenter = 0, f.weight = 0), f.barycenter = (f.barycenter * f.weight + d.order + p.order) / (f.weight + 2), f.weight += 2;
  }
  return f;
}
function QM(t, e) {
  gt(t, function(n) {
    n.vs = Wa(
      n.vs.map(function(i) {
        return e[i] ? e[i].vs : i;
      })
    );
  });
}
function ZM(t, e) {
  De(t.barycenter) ? (t.barycenter = e.barycenter, t.weight = e.weight) : (t.barycenter = (t.barycenter * t.weight + e.barycenter * e.weight) / (t.weight + e.weight), t.weight += e.weight);
}
function JM(t) {
  var e = X3(t), n = d2(t, ks(1, e + 1), "inEdges"), i = d2(t, ks(e - 1, -1, -1), "outEdges"), r = WM(t);
  f2(t, r);
  for (var s = Number.POSITIVE_INFINITY, a, o = 0, l = 0; l < 4; ++o, ++l) {
    tP(o % 2 ? n : i, o % 4 >= 2), r = mh(t);
    var u = $M(t, r);
    u < s && (l = 0, a = NO(r), s = u);
  }
  f2(t, a);
}
function d2(t, e, n) {
  return ze(e, function(i) {
    return VM(t, i, n);
  });
}
function tP(t, e) {
  var n = new qe();
  gt(t, function(i) {
    var r = i.graph().root, s = a4(i, r, n, e);
    gt(s.vs, function(a, o) {
      i.node(a).order = o;
    }), zM(i, n, s.vs);
  });
}
function f2(t, e) {
  gt(e, function(n) {
    gt(n, function(i, r) {
      t.node(i).order = r;
    });
  });
}
function eP(t) {
  var e = iP(t);
  gt(t.graph().dummyChains, function(n) {
    for (var i = t.node(n), r = i.edgeObj, s = nP(t, e, r.v, r.w), a = s.path, o = s.lca, l = 0, u = a[l], h = !0; n !== r.w; ) {
      if (i = t.node(n), h) {
        for (; (u = a[l]) !== o && t.node(u).maxRank < i.rank; )
          l++;
        u === o && (h = !1);
      }
      if (!h) {
        for (; l < a.length - 1 && t.node(u = a[l + 1]).minRank <= i.rank; )
          l++;
        u = a[l];
      }
      t.setParent(n, u), n = t.successors(n)[0];
    }
  });
}
function nP(t, e, n, i) {
  var r = [], s = [], a = Math.min(e[n].low, e[i].low), o = Math.max(e[n].lim, e[i].lim), l, u;
  l = n;
  do
    l = t.parent(l), r.push(l);
  while (l && (e[l].low > a || o > e[l].lim));
  for (u = l, l = i; (l = t.parent(l)) !== u; )
    s.push(l);
  return { path: r.concat(s.reverse()), lca: u };
}
function iP(t) {
  var e = {}, n = 0;
  function i(r) {
    var s = n;
    gt(t.children(r), i), e[r] = { low: s, lim: n++ };
  }
  return gt(t.children(), i), e;
}
function rP(t, e) {
  var n = {};
  function i(r, s) {
    var a = 0, o = 0, l = r.length, u = pu(s);
    return gt(s, function(h, f) {
      var d = aP(t, h), p = d ? t.node(d).order : l;
      (d || h === u) && (gt(s.slice(o, f + 1), function(y) {
        gt(t.predecessors(y), function(m) {
          var _ = t.node(m), T = _.order;
          (T < a || p < T) && !(_.dummy && t.node(y).dummy) && o4(n, m, y);
        });
      }), o = f + 1, a = p);
    }), s;
  }
  return Ll(e, i), n;
}
function sP(t, e) {
  var n = {};
  function i(s, a, o, l, u) {
    var h;
    gt(ks(a, o), function(f) {
      h = s[f], t.node(h).dummy && gt(t.predecessors(h), function(d) {
        var p = t.node(d);
        p.dummy && (p.order < l || p.order > u) && o4(n, d, h);
      });
    });
  }
  function r(s, a) {
    var o = -1, l, u = 0;
    return gt(a, function(h, f) {
      if (t.node(h).dummy === "border") {
        var d = t.predecessors(h);
        d.length && (l = t.node(d[0]).order, i(a, u, f, o, l), u = f, o = l);
      }
      i(a, u, a.length, l, s.length);
    }), a;
  }
  return Ll(e, r), n;
}
function aP(t, e) {
  if (t.node(e).dummy)
    return Zf(t.predecessors(e), function(n) {
      return t.node(n).dummy;
    });
}
function o4(t, e, n) {
  if (e > n) {
    var i = e;
    e = n, n = i;
  }
  var r = t[e];
  r || (t[e] = r = {}), r[n] = !0;
}
function oP(t, e, n) {
  if (e > n) {
    var i = e;
    e = n, n = i;
  }
  return Ht(t[e], n);
}
function lP(t, e, n, i) {
  var r = {}, s = {}, a = {};
  return gt(e, function(o) {
    gt(o, function(l, u) {
      r[l] = l, s[l] = l, a[l] = u;
    });
  }), gt(e, function(o) {
    var l = -1;
    gt(o, function(u) {
      var h = i(u);
      if (h.length) {
        h = Il(h, function(m) {
          return a[m];
        });
        for (var f = (h.length - 1) / 2, d = Math.floor(f), p = Math.ceil(f); d <= p; ++d) {
          var y = h[d];
          s[u] === u && l < a[y] && !oP(n, u, y) && (s[y] = u, s[u] = r[u] = r[y], l = a[y]);
        }
      }
    });
  }), { root: r, align: s };
}
function cP(t, e, n, i, r) {
  var s = {}, a = uP(t, e, n, r), o = r ? "borderLeft" : "borderRight";
  function l(f, d) {
    for (var p = a.nodes(), y = p.pop(), m = {}; y; )
      m[y] ? f(y) : (m[y] = !0, p.push(y), p = p.concat(d(y))), y = p.pop();
  }
  function u(f) {
    s[f] = a.inEdges(f).reduce(function(d, p) {
      return Math.max(d, s[p.v] + a.edge(p));
    }, 0);
  }
  function h(f) {
    var d = a.outEdges(f).reduce(function(y, m) {
      return Math.min(y, s[m.w] - a.edge(m));
    }, Number.POSITIVE_INFINITY), p = t.node(f);
    d !== Number.POSITIVE_INFINITY && p.borderType !== o && (s[f] = Math.max(s[f], d));
  }
  return l(u, a.predecessors.bind(a)), l(h, a.successors.bind(a)), gt(i, function(f) {
    s[f] = s[n[f]];
  }), s;
}
function uP(t, e, n, i) {
  var r = new qe(), s = t.graph(), a = gP(s.nodesep, s.edgesep, i);
  return gt(e, function(o) {
    var l;
    gt(o, function(u) {
      var h = n[u];
      if (r.setNode(h), l) {
        var f = n[l], d = r.edge(f, h);
        r.setEdge(f, h, Math.max(a(t, u, l), d || 0));
      }
      l = u;
    });
  }), r;
}
function hP(t, e) {
  return t0(mr(e), function(n) {
    var i = Number.NEGATIVE_INFINITY, r = Number.POSITIVE_INFINITY;
    return CR(n, function(s, a) {
      var o = yP(t, a) / 2;
      i = Math.max(s + o, i), r = Math.min(s - o, r);
    }), i - r;
  });
}
function dP(t, e) {
  var n = mr(e), i = el(n), r = _s(n);
  gt(["u", "d"], function(s) {
    gt(["l", "r"], function(a) {
      var o = s + a, l = t[o], u;
      if (l !== e) {
        var h = mr(l);
        u = a === "l" ? i - el(h) : r - _s(h), u && (t[o] = gh(l, function(f) {
          return f + u;
        }));
      }
    });
  });
}
function fP(t, e) {
  return gh(t.ul, function(n, i) {
    if (e)
      return t[e.toLowerCase()][i];
    var r = Il(ze(t, i));
    return (r[1] + r[2]) / 2;
  });
}
function pP(t) {
  var e = mh(t), n = Zc(rP(t, e), sP(t, e)), i = {}, r;
  gt(["u", "d"], function(a) {
    r = a === "u" ? e : mr(e).reverse(), gt(["l", "r"], function(o) {
      o === "r" && (r = ze(r, function(f) {
        return mr(f).reverse();
      }));
      var l = (a === "u" ? t.predecessors : t.successors).bind(t), u = lP(t, r, n, l), h = cP(t, r, u.root, u.align, o === "r");
      o === "r" && (h = gh(h, function(f) {
        return -f;
      })), i[a + o] = h;
    });
  });
  var s = hP(t, i);
  return dP(i, s), fP(i, t.graph().align);
}
function gP(t, e, n) {
  return function(i, r, s) {
    var a = i.node(r), o = i.node(s), l = 0, u;
    if (l += a.width / 2, Ht(a, "labelpos"))
      switch (a.labelpos.toLowerCase()) {
        case "l":
          u = -a.width / 2;
          break;
        case "r":
          u = a.width / 2;
          break;
      }
    if (u && (l += n ? u : -u), u = 0, l += (a.dummy ? e : t) / 2, l += (o.dummy ? e : t) / 2, l += o.width / 2, Ht(o, "labelpos"))
      switch (o.labelpos.toLowerCase()) {
        case "l":
          u = o.width / 2;
          break;
        case "r":
          u = -o.width / 2;
          break;
      }
    return u && (l += n ? u : -u), u = 0, l;
  };
}
function yP(t, e) {
  return t.node(e).width;
}
function mP(t) {
  t = j3(t), xP(t), SR(pP(t), function(e, n) {
    t.node(n).x = e;
  });
}
function xP(t) {
  var e = mh(t), n = t.graph().ranksep, i = 0;
  gt(e, function(r) {
    var s = _s(
      ze(r, function(a) {
        return t.node(a).height;
      })
    );
    gt(r, function(a) {
      t.node(a).y = i + s / 2;
    }), i += s + n;
  });
}
function Ha(t, e) {
  var n = pM;
  n("layout", function() {
    var i = n("  buildLayoutGraph", function() {
      return LP(t);
    });
    n("  runLayout", function() {
      bP(i, n);
    }), n("  updateInputGraph", function() {
      _P(t, i);
    });
  });
}
function bP(t, e) {
  e("    makeSpaceForEdgeLabels", function() {
    IP(t);
  }), e("    removeSelfEdges", function() {
    zP(t);
  }), e("    acyclic", function() {
    oM(t);
  }), e("    nestingGraph.run", function() {
    OM(t);
  }), e("    rank", function() {
    DM(j3(t));
  }), e("    injectEdgeLabelProxies", function() {
    BP(t);
  }), e("    removeEmptyRanks", function() {
    dM(t);
  }), e("    nestingGraph.cleanup", function() {
    PM(t);
  }), e("    normalizeRanks", function() {
    hM(t);
  }), e("    assignRankMinMax", function() {
    DP(t);
  }), e("    removeEdgeLabelProxies", function() {
    NP(t);
  }), e("    normalize.run", function() {
    _M(t);
  }), e("    parentDummyChains", function() {
    eP(t);
  }), e("    addBorderSegments", function() {
    gM(t);
  }), e("    order", function() {
    JM(t);
  }), e("    insertSelfEdges", function() {
    VP(t);
  }), e("    adjustCoordinateSystem", function() {
    yM(t);
  }), e("    position", function() {
    mP(t);
  }), e("    positionSelfEdges", function() {
    qP(t);
  }), e("    removeBorderNodes", function() {
    PP(t);
  }), e("    normalize.undo", function() {
    TM(t);
  }), e("    fixupEdgeLabelCoords", function() {
    RP(t);
  }), e("    undoCoordinateSystem", function() {
    mM(t);
  }), e("    translateGraph", function() {
    FP(t);
  }), e("    assignNodeIntersects", function() {
    OP(t);
  }), e("    reversePoints", function() {
    MP(t);
  }), e("    acyclic.undo", function() {
    cM(t);
  });
}
function _P(t, e) {
  gt(t.nodes(), function(n) {
    var i = t.node(n), r = e.node(n);
    i && (i.x = r.x, i.y = r.y, e.children(n).length && (i.width = r.width, i.height = r.height));
  }), gt(t.edges(), function(n) {
    var i = t.edge(n), r = e.edge(n);
    i.points = r.points, Ht(r, "x") && (i.x = r.x, i.y = r.y);
  }), t.graph().width = e.graph().width, t.graph().height = e.graph().height;
}
var kP = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], TP = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, wP = ["acyclicer", "ranker", "rankdir", "align"], vP = ["width", "height"], EP = { width: 0, height: 0 }, CP = ["minlen", "weight", "width", "height", "labeloffset"], SP = {
  minlen: 1,
  weight: 1,
  width: 0,
  height: 0,
  labeloffset: 10,
  labelpos: "r"
}, AP = ["labelpos"];
function LP(t) {
  var e = new qe({ multigraph: !0, compound: !0 }), n = hd(t.graph());
  return e.setGraph(
    Zc({}, TP, ud(n, kP), nl(n, wP))
  ), gt(t.nodes(), function(i) {
    var r = hd(t.node(i));
    e.setNode(i, Hs(ud(r, vP), EP)), e.setParent(i, t.parent(i));
  }), gt(t.edges(), function(i) {
    var r = hd(t.edge(i));
    e.setEdge(
      i,
      Zc({}, SP, ud(r, CP), nl(r, AP))
    );
  }), e;
}
function IP(t) {
  var e = t.graph();
  e.ranksep /= 2, gt(t.edges(), function(n) {
    var i = t.edge(n);
    i.minlen *= 2, i.labelpos.toLowerCase() !== "c" && (e.rankdir === "TB" || e.rankdir === "BT" ? i.width += i.labeloffset : i.height += i.labeloffset);
  });
}
function BP(t) {
  gt(t.edges(), function(e) {
    var n = t.edge(e);
    if (n.width && n.height) {
      var i = t.node(e.v), r = t.node(e.w), s = { rank: (r.rank - i.rank) / 2 + i.rank, e };
      Ua(t, "edge-proxy", s, "_ep");
    }
  });
}
function DP(t) {
  var e = 0;
  gt(t.nodes(), function(n) {
    var i = t.node(n);
    i.borderTop && (i.minRank = t.node(i.borderTop).rank, i.maxRank = t.node(i.borderBottom).rank, e = _s(e, i.maxRank));
  }), t.graph().maxRank = e;
}
function NP(t) {
  gt(t.nodes(), function(e) {
    var n = t.node(e);
    n.dummy === "edge-proxy" && (t.edge(n.e).labelRank = n.rank, t.removeNode(e));
  });
}
function FP(t) {
  var e = Number.POSITIVE_INFINITY, n = 0, i = Number.POSITIVE_INFINITY, r = 0, s = t.graph(), a = s.marginx || 0, o = s.marginy || 0;
  function l(u) {
    var h = u.x, f = u.y, d = u.width, p = u.height;
    e = Math.min(e, h - d / 2), n = Math.max(n, h + d / 2), i = Math.min(i, f - p / 2), r = Math.max(r, f + p / 2);
  }
  gt(t.nodes(), function(u) {
    l(t.node(u));
  }), gt(t.edges(), function(u) {
    var h = t.edge(u);
    Ht(h, "x") && l(h);
  }), e -= a, i -= o, gt(t.nodes(), function(u) {
    var h = t.node(u);
    h.x -= e, h.y -= i;
  }), gt(t.edges(), function(u) {
    var h = t.edge(u);
    gt(h.points, function(f) {
      f.x -= e, f.y -= i;
    }), Ht(h, "x") && (h.x -= e), Ht(h, "y") && (h.y -= i);
  }), s.width = n - e + a, s.height = r - i + o;
}
function OP(t) {
  gt(t.edges(), function(e) {
    var n = t.edge(e), i = t.node(e.v), r = t.node(e.w), s, a;
    n.points ? (s = n.points[0], a = n.points[n.points.length - 1]) : (n.points = [], s = r, a = i), n.points.unshift(s2(i, s)), n.points.push(s2(r, a));
  });
}
function RP(t) {
  gt(t.edges(), function(e) {
    var n = t.edge(e);
    if (Ht(n, "x"))
      switch ((n.labelpos === "l" || n.labelpos === "r") && (n.width -= n.labeloffset), n.labelpos) {
        case "l":
          n.x -= n.width / 2 + n.labeloffset;
          break;
        case "r":
          n.x += n.width / 2 + n.labeloffset;
          break;
      }
  });
}
function MP(t) {
  gt(t.edges(), function(e) {
    var n = t.edge(e);
    n.reversed && n.points.reverse();
  });
}
function PP(t) {
  gt(t.nodes(), function(e) {
    if (t.children(e).length) {
      var n = t.node(e), i = t.node(n.borderTop), r = t.node(n.borderBottom), s = t.node(pu(n.borderLeft)), a = t.node(pu(n.borderRight));
      n.width = Math.abs(a.x - s.x), n.height = Math.abs(r.y - i.y), n.x = s.x + n.width / 2, n.y = i.y + n.height / 2;
    }
  }), gt(t.nodes(), function(e) {
    t.node(e).dummy === "border" && t.removeNode(e);
  });
}
function zP(t) {
  gt(t.edges(), function(e) {
    if (e.v === e.w) {
      var n = t.node(e.v);
      n.selfEdges || (n.selfEdges = []), n.selfEdges.push({ e, label: t.edge(e) }), t.removeEdge(e);
    }
  });
}
function VP(t) {
  var e = mh(t);
  gt(e, function(n) {
    var i = 0;
    gt(n, function(r, s) {
      var a = t.node(r);
      a.order = s + i, gt(a.selfEdges, function(o) {
        Ua(
          t,
          "selfedge",
          {
            width: o.label.width,
            height: o.label.height,
            rank: a.rank,
            order: s + ++i,
            e: o.e,
            label: o.label
          },
          "_se"
        );
      }), delete a.selfEdges;
    });
  });
}
function qP(t) {
  gt(t.nodes(), function(e) {
    var n = t.node(e);
    if (n.dummy === "selfedge") {
      var i = t.node(n.e.v), r = i.x + i.width / 2, s = i.y, a = n.x - r, o = i.height / 2;
      t.setEdge(n.e, n.label), t.removeNode(e), n.label.points = [
        { x: r + 2 * a / 3, y: s - o },
        { x: r + 5 * a / 6, y: s - o },
        { x: r + a, y: s },
        { x: r + 5 * a / 6, y: s + o },
        { x: r + 2 * a / 3, y: s + o }
      ], n.label.x = n.x, n.label.y = n.y;
    }
  });
}
function ud(t, e) {
  return gh(nl(t, e), Number);
}
function hd(t) {
  var e = {};
  return gt(t, function(n, i) {
    e[i.toLowerCase()] = n;
  }), e;
}
function l4(t, e) {
  return !!t.children(e).length;
}
function c4(t) {
  return dd(t.v) + ":" + dd(t.w) + ":" + dd(t.name);
}
var $P = /:/g;
function dd(t) {
  return t ? String(t).replace($P, "\\:") : "";
}
function Ki(t, e) {
  e && t.attr("style", e);
}
function u4(t, e, n) {
  e && t.attr("class", e).attr("class", n + " " + t.attr("class"));
}
function Li(t, e) {
  var n = e.graph();
  if (px(n)) {
    var i = n.transition;
    if (ka(i))
      return i(t);
  }
  return t;
}
var l1 = {
  normal: WP,
  vee: UP,
  undirected: HP
};
function YP(t) {
  l1 = t;
}
function WP(t, e, n, i) {
  var r = t.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = r.append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
  Ki(s, n[i + "Style"]), n[i + "Class"] && s.attr("class", n[i + "Class"]);
}
function UP(t, e, n, i) {
  var r = t.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = r.append("path").attr("d", "M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width", 1).style("stroke-dasharray", "1,0");
  Ki(s, n[i + "Style"]), n[i + "Class"] && s.attr("class", n[i + "Class"]);
}
function HP(t, e, n, i) {
  var r = t.append("marker").attr("id", e).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto"), s = r.append("path").attr("d", "M 0 5 L 10 5").style("stroke-width", 1).style("stroke-dasharray", "1,0");
  Ki(s, n[i + "Style"]), n[i + "Class"] && s.attr("class", n[i + "Class"]);
}
function r0(t, e) {
  var n = t.append("foreignObject").attr("width", "100000"), i = n.append("xhtml:div");
  i.attr("xmlns", "http://www.w3.org/1999/xhtml");
  var r = e.label;
  switch (typeof r) {
    case "function":
      i.insert(r);
      break;
    case "object":
      i.insert(function() {
        return r;
      });
      break;
    default:
      i.html(r);
  }
  Ki(i, e.labelStyle), i.style("display", "inline-block"), i.style("white-space", "nowrap");
  var s = i.node().getBoundingClientRect();
  return n.attr("width", s.width).attr("height", s.height), n;
}
function GP(t, e) {
  var n = t;
  return n.node().appendChild(e.label), Ki(n, e.labelStyle), n;
}
function jP(t, e) {
  for (var n = t.append("text"), i = XP(e.label).split(`
`), r = 0; r < i.length; r++)
    n.append("tspan").attr("xml:space", "preserve").attr("dy", "1em").attr("x", "1").text(i[r]);
  return Ki(n, e.labelStyle), n;
}
function XP(t) {
  for (var e = "", n = !1, i, r = 0; r < t.length; ++r)
    if (i = t[r], n) {
      switch (i) {
        case "n":
          e += `
`;
          break;
        default:
          e += i;
      }
      n = !1;
    } else i === "\\" ? n = !0 : e += i;
  return e;
}
function s0(t, e, n) {
  var i = e.label, r = t.append("g");
  e.labelType === "svg" ? GP(r, e) : typeof i != "string" || e.labelType === "html" ? r0(r, e) : jP(r, e);
  var s = r.node().getBBox(), a;
  switch (n) {
    case "top":
      a = -e.height / 2;
      break;
    case "bottom":
      a = e.height / 2 - s.height;
      break;
    default:
      a = -s.height / 2;
  }
  return r.attr("transform", "translate(" + -s.width / 2 + "," + a + ")"), r;
}
var c1 = function(t, e) {
  var n = e.nodes().filter(function(s) {
    return l4(e, s);
  }), i = t.selectAll("g.cluster").data(n, function(s) {
    return s;
  });
  Li(i.exit(), e).style("opacity", 0).remove();
  var r = i.enter().append("g").attr("class", "cluster").attr("id", function(s) {
    var a = e.node(s);
    return a.id;
  }).style("opacity", 0).each(function(s) {
    var a = e.node(s), o = yt(this);
    yt(this).append("rect");
    var l = o.append("g").attr("class", "label");
    s0(l, a, a.clusterLabelPos);
  });
  return i = i.merge(r), i = Li(i, e).style("opacity", 1), i.selectAll("rect").each(function(s) {
    var a = e.node(s), o = yt(this);
    Ki(o, a.style);
  }), i;
};
function KP(t) {
  c1 = t;
}
let u1 = function(t, e) {
  var n = t.selectAll("g.edgeLabel").data(e.edges(), function(r) {
    return c4(r);
  }).classed("update", !0);
  n.exit().remove(), n.enter().append("g").classed("edgeLabel", !0).style("opacity", 0), n = t.selectAll("g.edgeLabel"), n.each(function(r) {
    var s = yt(this);
    s.select(".label").remove();
    var a = e.edge(r), o = s0(s, e.edge(r), 0).classed("label", !0), l = o.node().getBBox();
    a.labelId && o.attr("id", a.labelId), Ht(a, "width") || (a.width = l.width), Ht(a, "height") || (a.height = l.height);
  });
  var i;
  return n.exit ? i = n.exit() : i = n.selectAll(null), Li(i, e).style("opacity", 0).remove(), n;
};
function QP(t) {
  u1 = t;
}
function p2(t, e) {
  return t.intersect(e);
}
var h1 = function(t, e, n) {
  var i = t.selectAll("g.edgePath").data(e.edges(), function(a) {
    return c4(a);
  }).classed("update", !0), r = nz(i, e);
  iz(i, e);
  var s = i.merge !== void 0 ? i.merge(r) : i;
  return Li(s, e).style("opacity", 1), s.each(function(a) {
    var o = yt(this), l = e.edge(a);
    l.elem = this, l.id && o.attr("id", l.id), u4(
      o,
      l.class,
      (o.classed("update") ? "update " : "") + "edgePath"
    );
  }), s.selectAll("path.path").each(function(a) {
    var o = e.edge(a);
    o.arrowheadId = yh("arrowhead");
    var l = yt(this).attr("marker-end", function() {
      return "url(" + JP(location.href, o.arrowheadId) + ")";
    }).style("fill", "none");
    Li(l, e).attr("d", function(u) {
      return tz(e, u);
    }), Ki(l, o.style);
  }), s.selectAll("defs *").remove(), s.selectAll("defs").each(function(a) {
    var o = e.edge(a), l = n[o.arrowhead];
    l(yt(this), o.arrowheadId, o, "arrowhead");
  }), s;
};
function ZP(t) {
  h1 = t;
}
function JP(t, e) {
  var n = t.split("#")[0];
  return n + "#" + e;
}
function tz(t, e) {
  var n = t.edge(e), i = t.node(e.v), r = t.node(e.w), s = n.points.slice(1, n.points.length - 1);
  return s.unshift(p2(i, s[0])), s.push(p2(r, s[s.length - 1])), h4(n, s);
}
function h4(t, e) {
  var n = (Tr || wv.line)().x(function(i) {
    return i.x;
  }).y(function(i) {
    return i.y;
  });
  return (n.curve || n.interpolate)(t.curve), n(e);
}
function ez(t) {
  var e = t.getBBox(), n = t.ownerSVGElement.getScreenCTM().inverse().multiply(t.getScreenCTM()).translate(e.width / 2, e.height / 2);
  return { x: n.e, y: n.f };
}
function nz(t, e) {
  var n = t.enter().append("g").attr("class", "edgePath").style("opacity", 0);
  return n.append("path").attr("class", "path").attr("d", function(i) {
    var r = e.edge(i), s = e.node(i.v).elem, a = ks(r.points.length).map(function() {
      return ez(s);
    });
    return h4(r, a);
  }), n.append("defs"), n;
}
function iz(t, e) {
  var n = t.exit();
  Li(n, e).style("opacity", 0).remove();
}
var d1 = function(t, e, n) {
  var i = e.nodes().filter(function(a) {
    return !l4(e, a);
  }), r = t.selectAll("g.node").data(i, function(a) {
    return a;
  }).classed("update", !0);
  r.exit().remove(), r.enter().append("g").attr("class", "node").style("opacity", 0), r = t.selectAll("g.node"), r.each(function(a) {
    var o = e.node(a), l = yt(this);
    u4(
      l,
      o.class,
      (l.classed("update") ? "update " : "") + "node"
    ), l.select("g.label").remove();
    var u = l.append("g").attr("class", "label"), h = s0(u, o), f = n[o.shape], d = nl(h.node().getBBox(), "width", "height");
    o.elem = this, o.id && l.attr("id", o.id), o.labelId && u.attr("id", o.labelId), Ht(o, "width") && (d.width = o.width), Ht(o, "height") && (d.height = o.height), d.width += o.paddingLeft + o.paddingRight, d.height += o.paddingTop + o.paddingBottom, u.attr(
      "transform",
      "translate(" + (o.paddingLeft - o.paddingRight) / 2 + "," + (o.paddingTop - o.paddingBottom) / 2 + ")"
    );
    var p = yt(this);
    p.select(".label-container").remove();
    var y = f(p, d, o).classed("label-container", !0);
    Ki(y, o.style);
    var m = y.node().getBBox();
    o.width = m.width, o.height = m.height;
  });
  var s;
  return r.exit ? s = r.exit() : s = r.selectAll(null), Li(s, e).style("opacity", 0).remove(), r;
};
function rz(t) {
  d1 = t;
}
function sz(t, e) {
  var n = t.filter(function() {
    return !yt(this).classed("update");
  });
  function i(r) {
    var s = e.node(r);
    return "translate(" + s.x + "," + s.y + ")";
  }
  n.attr("transform", i), Li(t, e).style("opacity", 1).attr("transform", i), Li(n.selectAll("rect"), e).attr("width", function(r) {
    return e.node(r).width;
  }).attr("height", function(r) {
    return e.node(r).height;
  }).attr("x", function(r) {
    var s = e.node(r);
    return -s.width / 2;
  }).attr("y", function(r) {
    var s = e.node(r);
    return -s.height / 2;
  });
}
function az(t, e) {
  var n = t.filter(function() {
    return !yt(this).classed("update");
  });
  function i(r) {
    var s = e.edge(r);
    return Ht(s, "x") ? "translate(" + s.x + "," + s.y + ")" : "";
  }
  n.attr("transform", i), Li(t, e).style("opacity", 1).attr("transform", i);
}
function oz(t, e) {
  var n = t.filter(function() {
    return !yt(this).classed("update");
  });
  function i(r) {
    var s = e.node(r);
    return "translate(" + s.x + "," + s.y + ")";
  }
  n.attr("transform", i), Li(t, e).style("opacity", 1).attr("transform", i);
}
function d4(t, e, n, i) {
  var r = t.x, s = t.y, a = r - i.x, o = s - i.y, l = Math.sqrt(e * e * o * o + n * n * a * a), u = Math.abs(e * n * a / l);
  i.x < r && (u = -u);
  var h = Math.abs(e * n * o / l);
  return i.y < s && (h = -h), { x: r + u, y: s + h };
}
function lz(t, e, n) {
  return d4(t, e, e, n);
}
function cz(t, e, n, i) {
  var r, s, a, o, l, u, h, f, d, p, y, m, _, T, v;
  if (r = e.y - t.y, a = t.x - e.x, l = e.x * t.y - t.x * e.y, d = r * n.x + a * n.y + l, p = r * i.x + a * i.y + l, !(d !== 0 && p !== 0 && g2(d, p)) && (s = i.y - n.y, o = n.x - i.x, u = i.x * n.y - n.x * i.y, h = s * t.x + o * t.y + u, f = s * e.x + o * e.y + u, !(h !== 0 && f !== 0 && g2(h, f)) && (y = r * o - s * a, y !== 0)))
    return m = Math.abs(y / 2), _ = a * u - o * l, T = _ < 0 ? (_ - m) / y : (_ + m) / y, _ = s * l - r * u, v = _ < 0 ? (_ - m) / y : (_ + m) / y, { x: T, y: v };
}
function g2(t, e) {
  return t * e > 0;
}
function Qi(t, e, n) {
  var i = t.x, r = t.y, s = [], a = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY;
  e.forEach(function(y) {
    a = Math.min(a, y.x), o = Math.min(o, y.y);
  });
  for (var l = i - t.width / 2 - a, u = r - t.height / 2 - o, h = 0; h < e.length; h++) {
    var f = e[h], d = e[h < e.length - 1 ? h + 1 : 0], p = cz(
      t,
      n,
      { x: l + f.x, y: u + f.y },
      { x: l + d.x, y: u + d.y }
    );
    p && s.push(p);
  }
  return s.length ? (s.length > 1 && s.sort(function(y, m) {
    var _ = y.x - n.x, T = y.y - n.y, v = Math.sqrt(_ * _ + T * T), A = m.x - n.x, L = m.y - n.y, w = Math.sqrt(A * A + L * L);
    return v < w ? -1 : v === w ? 0 : 1;
  }), s[0]) : (console.log("NO INTERSECTION FOUND, RETURN NODE CENTER", t), t);
}
function a0(t, e) {
  var n = t.x, i = t.y, r = e.x - n, s = e.y - i, a = t.width / 2, o = t.height / 2, l, u;
  return Math.abs(s) * a > Math.abs(r) * o ? (s < 0 && (o = -o), l = s === 0 ? 0 : o * r / s, u = o) : (r < 0 && (a = -a), l = a, u = r === 0 ? 0 : a * s / r), { x: n + l, y: i + u };
}
var f1 = {
  rect: hz,
  ellipse: dz,
  circle: fz,
  diamond: pz
};
function uz(t) {
  f1 = t;
}
function hz(t, e, n) {
  var i = t.insert("rect", ":first-child").attr("rx", n.rx).attr("ry", n.ry).attr("x", -e.width / 2).attr("y", -e.height / 2).attr("width", e.width).attr("height", e.height);
  return n.intersect = function(r) {
    return a0(n, r);
  }, i;
}
function dz(t, e, n) {
  var i = e.width / 2, r = e.height / 2, s = t.insert("ellipse", ":first-child").attr("x", -e.width / 2).attr("y", -e.height / 2).attr("rx", i).attr("ry", r);
  return n.intersect = function(a) {
    return d4(n, i, r, a);
  }, s;
}
function fz(t, e, n) {
  var i = Math.max(e.width, e.height) / 2, r = t.insert("circle", ":first-child").attr("x", -e.width / 2).attr("y", -e.height / 2).attr("r", i);
  return n.intersect = function(s) {
    return lz(n, i, s);
  }, r;
}
function pz(t, e, n) {
  var i = e.width * Math.SQRT2 / 2, r = e.height * Math.SQRT2 / 2, s = [
    { x: 0, y: -r },
    { x: -i, y: 0 },
    { x: 0, y: r },
    { x: i, y: 0 }
  ], a = t.insert("polygon", ":first-child").attr(
    "points",
    s.map(function(o) {
      return o.x + "," + o.y;
    }).join(" ")
  );
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function gz() {
  var t = function(e, n) {
    xz(n);
    var i = oo(e, "output"), r = oo(i, "clusters"), s = oo(i, "edgePaths"), a = u1(oo(i, "edgeLabels"), n), o = d1(oo(i, "nodes"), n, f1);
    Ha(n), oz(o, n), az(a, n), h1(s, n, l1);
    var l = c1(r, n);
    sz(l, n), bz(n);
  };
  return t.createNodes = function(e) {
    return arguments.length ? (rz(e), t) : d1;
  }, t.createClusters = function(e) {
    return arguments.length ? (KP(e), t) : c1;
  }, t.createEdgeLabels = function(e) {
    return arguments.length ? (QP(e), t) : u1;
  }, t.createEdgePaths = function(e) {
    return arguments.length ? (ZP(e), t) : h1;
  }, t.shapes = function(e) {
    return arguments.length ? (uz(e), t) : f1;
  }, t.arrows = function(e) {
    return arguments.length ? (YP(e), t) : l1;
  }, t;
}
var yz = {
  paddingLeft: 10,
  paddingRight: 10,
  paddingTop: 10,
  paddingBottom: 10,
  rx: 0,
  ry: 0,
  shape: "rect"
}, mz = {
  arrowhead: "normal",
  curve: bn
};
function xz(t) {
  t.nodes().forEach(function(e) {
    var n = t.node(e);
    !Ht(n, "label") && !t.children(e).length && (n.label = e), Ht(n, "paddingX") && Hs(n, {
      paddingLeft: n.paddingX,
      paddingRight: n.paddingX
    }), Ht(n, "paddingY") && Hs(n, {
      paddingTop: n.paddingY,
      paddingBottom: n.paddingY
    }), Ht(n, "padding") && Hs(n, {
      paddingLeft: n.padding,
      paddingRight: n.padding,
      paddingTop: n.padding,
      paddingBottom: n.padding
    }), Hs(n, yz), gt(["paddingLeft", "paddingRight", "paddingTop", "paddingBottom"], function(i) {
      n[i] = Number(n[i]);
    }), Ht(n, "width") && (n._prevWidth = n.width), Ht(n, "height") && (n._prevHeight = n.height);
  }), t.edges().forEach(function(e) {
    var n = t.edge(e);
    Ht(n, "label") || (n.label = ""), Hs(n, mz);
  });
}
function bz(t) {
  gt(t.nodes(), function(e) {
    var n = t.node(e);
    Ht(n, "_prevWidth") ? n.width = n._prevWidth : delete n.width, Ht(n, "_prevHeight") ? n.height = n._prevHeight : delete n.height, delete n._prevWidth, delete n._prevHeight;
  });
}
function oo(t, e) {
  var n = t.select("g." + e);
  return n.empty() && (n = t.append("g").attr("class", e)), n;
}
function dr(t) {
  var e = {
    options: {
      directed: t.isDirected(),
      multigraph: t.isMultigraph(),
      compound: t.isCompound()
    },
    nodes: _z(t),
    edges: kz(t)
  };
  return De(t.graph()) || (e.value = P3(t.graph())), e;
}
function _z(t) {
  return ze(t.nodes(), function(e) {
    var n = t.node(e), i = t.parent(e), r = { v: e };
    return De(n) || (r.value = n), De(i) || (r.parent = i), r;
  });
}
function kz(t) {
  return ze(t.edges(), function(e) {
    var n = t.edge(e), i = { v: e.v, w: e.w };
    return De(e.name) || (i.name = e.name), De(n) || (i.value = n), i;
  });
}
const Tz = {};
function wz(t, e) {
  const n = Tz, i = typeof n.includeImageAlt == "boolean" ? n.includeImageAlt : !0, r = typeof n.includeHtml == "boolean" ? n.includeHtml : !0;
  return f4(t, i, r);
}
function f4(t, e, n) {
  if (vz(t)) {
    if ("value" in t)
      return t.type === "html" && !n ? "" : t.value;
    if (e && "alt" in t && t.alt)
      return t.alt;
    if ("children" in t)
      return y2(t.children, e, n);
  }
  return Array.isArray(t) ? y2(t, e, n) : "";
}
function y2(t, e, n) {
  const i = [];
  let r = -1;
  for (; ++r < t.length; )
    i[r] = f4(t[r], e, n);
  return i.join("");
}
function vz(t) {
  return !!(t && typeof t == "object");
}
function Gi(t, e, n, i) {
  const r = t.length;
  let s = 0, a;
  if (e < 0 ? e = -e > r ? 0 : r + e : e = e > r ? r : e, n = n > 0 ? n : 0, i.length < 1e4)
    a = Array.from(i), a.unshift(e, n), t.splice(...a);
  else
    for (n && t.splice(e, n); s < i.length; )
      a = i.slice(s, s + 1e4), a.unshift(e, 0), t.splice(...a), s += 1e4, e += 1e4;
}
function si(t, e) {
  return t.length > 0 ? (Gi(t, t.length, 0, e), t) : e;
}
const m2 = {}.hasOwnProperty;
function Ez(t) {
  const e = {};
  let n = -1;
  for (; ++n < t.length; )
    Cz(e, t[n]);
  return e;
}
function Cz(t, e) {
  let n;
  for (n in e) {
    const r = (m2.call(t, n) ? t[n] : void 0) || (t[n] = {}), s = e[n];
    let a;
    if (s)
      for (a in s) {
        m2.call(r, a) || (r[a] = []);
        const o = s[a];
        Sz(
          // @ts-expect-error Looks like a list.
          r[a],
          Array.isArray(o) ? o : o ? [o] : []
        );
      }
  }
}
function Sz(t, e) {
  let n = -1;
  const i = [];
  for (; ++n < e.length; )
    (e[n].add === "after" ? t : i).push(e[n]);
  Gi(t, 0, 0, i);
}
const Az = /[!-\/:-@\[-`\{-~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]/, Mi = Gr(/[A-Za-z]/), ki = Gr(/[\dA-Za-z]/), Lz = Gr(/[#-'*+\--9=?A-Z^-~]/);
function p1(t) {
  return (
    // Special whitespace codes (which have negative values), C0 and Control
    // character DEL
    t !== null && (t < 32 || t === 127)
  );
}
const g1 = Gr(/\d/), Iz = Gr(/[\dA-Fa-f]/), Bz = Gr(/[!-/:-@[-`{-~]/);
function qt(t) {
  return t !== null && t < -2;
}
function Rn(t) {
  return t !== null && (t < 0 || t === 32);
}
function ce(t) {
  return t === -2 || t === -1 || t === 32;
}
const Dz = Gr(Az), Nz = Gr(/\s/);
function Gr(t) {
  return e;
  function e(n) {
    return n !== null && t.test(String.fromCharCode(n));
  }
}
function me(t, e, n, i) {
  const r = i ? i - 1 : Number.POSITIVE_INFINITY;
  let s = 0;
  return a;
  function a(l) {
    return ce(l) ? (t.enter(n), o(l)) : e(l);
  }
  function o(l) {
    return ce(l) && s++ < r ? (t.consume(l), o) : (t.exit(n), e(l));
  }
}
const Fz = {
  tokenize: Oz
};
function Oz(t) {
  const e = t.attempt(
    this.parser.constructs.contentInitial,
    i,
    r
  );
  let n;
  return e;
  function i(o) {
    if (o === null) {
      t.consume(o);
      return;
    }
    return t.enter("lineEnding"), t.consume(o), t.exit("lineEnding"), me(t, e, "linePrefix");
  }
  function r(o) {
    return t.enter("paragraph"), s(o);
  }
  function s(o) {
    const l = t.enter("chunkText", {
      contentType: "text",
      previous: n
    });
    return n && (n.next = l), n = l, a(o);
  }
  function a(o) {
    if (o === null) {
      t.exit("chunkText"), t.exit("paragraph"), t.consume(o);
      return;
    }
    return qt(o) ? (t.consume(o), t.exit("chunkText"), s) : (t.consume(o), a);
  }
}
const Rz = {
  tokenize: Mz
}, x2 = {
  tokenize: Pz
};
function Mz(t) {
  const e = this, n = [];
  let i = 0, r, s, a;
  return o;
  function o(A) {
    if (i < n.length) {
      const L = n[i];
      return e.containerState = L[1], t.attempt(
        L[0].continuation,
        l,
        u
      )(A);
    }
    return u(A);
  }
  function l(A) {
    if (i++, e.containerState._closeFlow) {
      e.containerState._closeFlow = void 0, r && v();
      const L = e.events.length;
      let w = L, b;
      for (; w--; )
        if (e.events[w][0] === "exit" && e.events[w][1].type === "chunkFlow") {
          b = e.events[w][1].end;
          break;
        }
      T(i);
      let F = L;
      for (; F < e.events.length; )
        e.events[F][1].end = Object.assign({}, b), F++;
      return Gi(
        e.events,
        w + 1,
        0,
        e.events.slice(L)
      ), e.events.length = F, u(A);
    }
    return o(A);
  }
  function u(A) {
    if (i === n.length) {
      if (!r)
        return d(A);
      if (r.currentConstruct && r.currentConstruct.concrete)
        return y(A);
      e.interrupt = !!(r.currentConstruct && !r._gfmTableDynamicInterruptHack);
    }
    return e.containerState = {}, t.check(
      x2,
      h,
      f
    )(A);
  }
  function h(A) {
    return r && v(), T(i), d(A);
  }
  function f(A) {
    return e.parser.lazy[e.now().line] = i !== n.length, a = e.now().offset, y(A);
  }
  function d(A) {
    return e.containerState = {}, t.attempt(
      x2,
      p,
      y
    )(A);
  }
  function p(A) {
    return i++, n.push([e.currentConstruct, e.containerState]), d(A);
  }
  function y(A) {
    if (A === null) {
      r && v(), T(0), t.consume(A);
      return;
    }
    return r = r || e.parser.flow(e.now()), t.enter("chunkFlow", {
      contentType: "flow",
      previous: s,
      _tokenizer: r
    }), m(A);
  }
  function m(A) {
    if (A === null) {
      _(t.exit("chunkFlow"), !0), T(0), t.consume(A);
      return;
    }
    return qt(A) ? (t.consume(A), _(t.exit("chunkFlow")), i = 0, e.interrupt = void 0, o) : (t.consume(A), m);
  }
  function _(A, L) {
    const w = e.sliceStream(A);
    if (L && w.push(null), A.previous = s, s && (s.next = A), s = A, r.defineSkip(A.start), r.write(w), e.parser.lazy[A.start.line]) {
      let b = r.events.length;
      for (; b--; )
        if (
          // The token starts before the line ending…
          r.events[b][1].start.offset < a && // …and either is not ended yet…
          (!r.events[b][1].end || // …or ends after it.
          r.events[b][1].end.offset > a)
        )
          return;
      const F = e.events.length;
      let S = F, x, C;
      for (; S--; )
        if (e.events[S][0] === "exit" && e.events[S][1].type === "chunkFlow") {
          if (x) {
            C = e.events[S][1].end;
            break;
          }
          x = !0;
        }
      for (T(i), b = F; b < e.events.length; )
        e.events[b][1].end = Object.assign({}, C), b++;
      Gi(
        e.events,
        S + 1,
        0,
        e.events.slice(F)
      ), e.events.length = b;
    }
  }
  function T(A) {
    let L = n.length;
    for (; L-- > A; ) {
      const w = n[L];
      e.containerState = w[1], w[0].exit.call(e, t);
    }
    n.length = A;
  }
  function v() {
    r.write([null]), s = void 0, r = void 0, e.containerState._closeFlow = void 0;
  }
}
function Pz(t, e, n) {
  return me(
    t,
    t.attempt(this.parser.constructs.document, e, n),
    "linePrefix",
    this.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
  );
}
function b2(t) {
  if (t === null || Rn(t) || Nz(t))
    return 1;
  if (Dz(t))
    return 2;
}
function o0(t, e, n) {
  const i = [];
  let r = -1;
  for (; ++r < t.length; ) {
    const s = t[r].resolveAll;
    s && !i.includes(s) && (e = s(e, n), i.push(s));
  }
  return e;
}
const y1 = {
  name: "attention",
  tokenize: Vz,
  resolveAll: zz
};
function zz(t, e) {
  let n = -1, i, r, s, a, o, l, u, h;
  for (; ++n < t.length; )
    if (t[n][0] === "enter" && t[n][1].type === "attentionSequence" && t[n][1]._close) {
      for (i = n; i--; )
        if (t[i][0] === "exit" && t[i][1].type === "attentionSequence" && t[i][1]._open && // If the markers are the same:
        e.sliceSerialize(t[i][1]).charCodeAt(0) === e.sliceSerialize(t[n][1]).charCodeAt(0)) {
          if ((t[i][1]._close || t[n][1]._open) && (t[n][1].end.offset - t[n][1].start.offset) % 3 && !((t[i][1].end.offset - t[i][1].start.offset + t[n][1].end.offset - t[n][1].start.offset) % 3))
            continue;
          l = t[i][1].end.offset - t[i][1].start.offset > 1 && t[n][1].end.offset - t[n][1].start.offset > 1 ? 2 : 1;
          const f = Object.assign({}, t[i][1].end), d = Object.assign({}, t[n][1].start);
          _2(f, -l), _2(d, l), a = {
            type: l > 1 ? "strongSequence" : "emphasisSequence",
            start: f,
            end: Object.assign({}, t[i][1].end)
          }, o = {
            type: l > 1 ? "strongSequence" : "emphasisSequence",
            start: Object.assign({}, t[n][1].start),
            end: d
          }, s = {
            type: l > 1 ? "strongText" : "emphasisText",
            start: Object.assign({}, t[i][1].end),
            end: Object.assign({}, t[n][1].start)
          }, r = {
            type: l > 1 ? "strong" : "emphasis",
            start: Object.assign({}, a.start),
            end: Object.assign({}, o.end)
          }, t[i][1].end = Object.assign({}, a.start), t[n][1].start = Object.assign({}, o.end), u = [], t[i][1].end.offset - t[i][1].start.offset && (u = si(u, [
            ["enter", t[i][1], e],
            ["exit", t[i][1], e]
          ])), u = si(u, [
            ["enter", r, e],
            ["enter", a, e],
            ["exit", a, e],
            ["enter", s, e]
          ]), u = si(
            u,
            o0(
              e.parser.constructs.insideSpan.null,
              t.slice(i + 1, n),
              e
            )
          ), u = si(u, [
            ["exit", s, e],
            ["enter", o, e],
            ["exit", o, e],
            ["exit", r, e]
          ]), t[n][1].end.offset - t[n][1].start.offset ? (h = 2, u = si(u, [
            ["enter", t[n][1], e],
            ["exit", t[n][1], e]
          ])) : h = 0, Gi(t, i - 1, n - i + 3, u), n = i + u.length - h - 2;
          break;
        }
    }
  for (n = -1; ++n < t.length; )
    t[n][1].type === "attentionSequence" && (t[n][1].type = "data");
  return t;
}
function Vz(t, e) {
  const n = this.parser.constructs.attentionMarkers.null, i = this.previous, r = b2(i);
  let s;
  return a;
  function a(l) {
    return s = l, t.enter("attentionSequence"), o(l);
  }
  function o(l) {
    if (l === s)
      return t.consume(l), o;
    const u = t.exit("attentionSequence"), h = b2(l), f = !h || h === 2 && r || n.includes(l), d = !r || r === 2 && h || n.includes(i);
    return u._open = !!(s === 42 ? f : f && (r || !d)), u._close = !!(s === 42 ? d : d && (h || !f)), e(l);
  }
}
function _2(t, e) {
  t.column += e, t.offset += e, t._bufferIndex += e;
}
const qz = {
  name: "autolink",
  tokenize: $z
};
function $z(t, e, n) {
  let i = 0;
  return r;
  function r(p) {
    return t.enter("autolink"), t.enter("autolinkMarker"), t.consume(p), t.exit("autolinkMarker"), t.enter("autolinkProtocol"), s;
  }
  function s(p) {
    return Mi(p) ? (t.consume(p), a) : u(p);
  }
  function a(p) {
    return p === 43 || p === 45 || p === 46 || ki(p) ? (i = 1, o(p)) : u(p);
  }
  function o(p) {
    return p === 58 ? (t.consume(p), i = 0, l) : (p === 43 || p === 45 || p === 46 || ki(p)) && i++ < 32 ? (t.consume(p), o) : (i = 0, u(p));
  }
  function l(p) {
    return p === 62 ? (t.exit("autolinkProtocol"), t.enter("autolinkMarker"), t.consume(p), t.exit("autolinkMarker"), t.exit("autolink"), e) : p === null || p === 32 || p === 60 || p1(p) ? n(p) : (t.consume(p), l);
  }
  function u(p) {
    return p === 64 ? (t.consume(p), h) : Lz(p) ? (t.consume(p), u) : n(p);
  }
  function h(p) {
    return ki(p) ? f(p) : n(p);
  }
  function f(p) {
    return p === 46 ? (t.consume(p), i = 0, h) : p === 62 ? (t.exit("autolinkProtocol").type = "autolinkEmail", t.enter("autolinkMarker"), t.consume(p), t.exit("autolinkMarker"), t.exit("autolink"), e) : d(p);
  }
  function d(p) {
    if ((p === 45 || ki(p)) && i++ < 63) {
      const y = p === 45 ? d : f;
      return t.consume(p), y;
    }
    return n(p);
  }
}
const xh = {
  tokenize: Yz,
  partial: !0
};
function Yz(t, e, n) {
  return i;
  function i(s) {
    return ce(s) ? me(t, r, "linePrefix")(s) : r(s);
  }
  function r(s) {
    return s === null || qt(s) ? e(s) : n(s);
  }
}
const p4 = {
  name: "blockQuote",
  tokenize: Wz,
  continuation: {
    tokenize: Uz
  },
  exit: Hz
};
function Wz(t, e, n) {
  const i = this;
  return r;
  function r(a) {
    if (a === 62) {
      const o = i.containerState;
      return o.open || (t.enter("blockQuote", {
        _container: !0
      }), o.open = !0), t.enter("blockQuotePrefix"), t.enter("blockQuoteMarker"), t.consume(a), t.exit("blockQuoteMarker"), s;
    }
    return n(a);
  }
  function s(a) {
    return ce(a) ? (t.enter("blockQuotePrefixWhitespace"), t.consume(a), t.exit("blockQuotePrefixWhitespace"), t.exit("blockQuotePrefix"), e) : (t.exit("blockQuotePrefix"), e(a));
  }
}
function Uz(t, e, n) {
  const i = this;
  return r;
  function r(a) {
    return ce(a) ? me(
      t,
      s,
      "linePrefix",
      i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
    )(a) : s(a);
  }
  function s(a) {
    return t.attempt(p4, e, n)(a);
  }
}
function Hz(t) {
  t.exit("blockQuote");
}
const g4 = {
  name: "characterEscape",
  tokenize: Gz
};
function Gz(t, e, n) {
  return i;
  function i(s) {
    return t.enter("characterEscape"), t.enter("escapeMarker"), t.consume(s), t.exit("escapeMarker"), r;
  }
  function r(s) {
    return Bz(s) ? (t.enter("characterEscapeValue"), t.consume(s), t.exit("characterEscapeValue"), t.exit("characterEscape"), e) : n(s);
  }
}
const k2 = document.createElement("i");
function l0(t) {
  const e = "&" + t + ";";
  k2.innerHTML = e;
  const n = k2.textContent;
  return n.charCodeAt(n.length - 1) === 59 && t !== "semi" || n === e ? !1 : n;
}
const y4 = {
  name: "characterReference",
  tokenize: jz
};
function jz(t, e, n) {
  const i = this;
  let r = 0, s, a;
  return o;
  function o(f) {
    return t.enter("characterReference"), t.enter("characterReferenceMarker"), t.consume(f), t.exit("characterReferenceMarker"), l;
  }
  function l(f) {
    return f === 35 ? (t.enter("characterReferenceMarkerNumeric"), t.consume(f), t.exit("characterReferenceMarkerNumeric"), u) : (t.enter("characterReferenceValue"), s = 31, a = ki, h(f));
  }
  function u(f) {
    return f === 88 || f === 120 ? (t.enter("characterReferenceMarkerHexadecimal"), t.consume(f), t.exit("characterReferenceMarkerHexadecimal"), t.enter("characterReferenceValue"), s = 6, a = Iz, h) : (t.enter("characterReferenceValue"), s = 7, a = g1, h(f));
  }
  function h(f) {
    if (f === 59 && r) {
      const d = t.exit("characterReferenceValue");
      return a === ki && !l0(i.sliceSerialize(d)) ? n(f) : (t.enter("characterReferenceMarker"), t.consume(f), t.exit("characterReferenceMarker"), t.exit("characterReference"), e);
    }
    return a(f) && r++ < s ? (t.consume(f), h) : n(f);
  }
}
const T2 = {
  tokenize: Kz,
  partial: !0
}, w2 = {
  name: "codeFenced",
  tokenize: Xz,
  concrete: !0
};
function Xz(t, e, n) {
  const i = this, r = {
    tokenize: w,
    partial: !0
  };
  let s = 0, a = 0, o;
  return l;
  function l(b) {
    return u(b);
  }
  function u(b) {
    const F = i.events[i.events.length - 1];
    return s = F && F[1].type === "linePrefix" ? F[2].sliceSerialize(F[1], !0).length : 0, o = b, t.enter("codeFenced"), t.enter("codeFencedFence"), t.enter("codeFencedFenceSequence"), h(b);
  }
  function h(b) {
    return b === o ? (a++, t.consume(b), h) : a < 3 ? n(b) : (t.exit("codeFencedFenceSequence"), ce(b) ? me(t, f, "whitespace")(b) : f(b));
  }
  function f(b) {
    return b === null || qt(b) ? (t.exit("codeFencedFence"), i.interrupt ? e(b) : t.check(T2, m, L)(b)) : (t.enter("codeFencedFenceInfo"), t.enter("chunkString", {
      contentType: "string"
    }), d(b));
  }
  function d(b) {
    return b === null || qt(b) ? (t.exit("chunkString"), t.exit("codeFencedFenceInfo"), f(b)) : ce(b) ? (t.exit("chunkString"), t.exit("codeFencedFenceInfo"), me(t, p, "whitespace")(b)) : b === 96 && b === o ? n(b) : (t.consume(b), d);
  }
  function p(b) {
    return b === null || qt(b) ? f(b) : (t.enter("codeFencedFenceMeta"), t.enter("chunkString", {
      contentType: "string"
    }), y(b));
  }
  function y(b) {
    return b === null || qt(b) ? (t.exit("chunkString"), t.exit("codeFencedFenceMeta"), f(b)) : b === 96 && b === o ? n(b) : (t.consume(b), y);
  }
  function m(b) {
    return t.attempt(r, L, _)(b);
  }
  function _(b) {
    return t.enter("lineEnding"), t.consume(b), t.exit("lineEnding"), T;
  }
  function T(b) {
    return s > 0 && ce(b) ? me(
      t,
      v,
      "linePrefix",
      s + 1
    )(b) : v(b);
  }
  function v(b) {
    return b === null || qt(b) ? t.check(T2, m, L)(b) : (t.enter("codeFlowValue"), A(b));
  }
  function A(b) {
    return b === null || qt(b) ? (t.exit("codeFlowValue"), v(b)) : (t.consume(b), A);
  }
  function L(b) {
    return t.exit("codeFenced"), e(b);
  }
  function w(b, F, S) {
    let x = 0;
    return C;
    function C(R) {
      return b.enter("lineEnding"), b.consume(R), b.exit("lineEnding"), g;
    }
    function g(R) {
      return b.enter("codeFencedFence"), ce(R) ? me(
        b,
        I,
        "linePrefix",
        i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
      )(R) : I(R);
    }
    function I(R) {
      return R === o ? (b.enter("codeFencedFenceSequence"), k(R)) : S(R);
    }
    function k(R) {
      return R === o ? (x++, b.consume(R), k) : x >= a ? (b.exit("codeFencedFenceSequence"), ce(R) ? me(b, P, "whitespace")(R) : P(R)) : S(R);
    }
    function P(R) {
      return R === null || qt(R) ? (b.exit("codeFencedFence"), F(R)) : S(R);
    }
  }
}
function Kz(t, e, n) {
  const i = this;
  return r;
  function r(a) {
    return a === null ? n(a) : (t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), s);
  }
  function s(a) {
    return i.parser.lazy[i.now().line] ? n(a) : e(a);
  }
}
const fd = {
  name: "codeIndented",
  tokenize: Zz
}, Qz = {
  tokenize: Jz,
  partial: !0
};
function Zz(t, e, n) {
  const i = this;
  return r;
  function r(u) {
    return t.enter("codeIndented"), me(t, s, "linePrefix", 5)(u);
  }
  function s(u) {
    const h = i.events[i.events.length - 1];
    return h && h[1].type === "linePrefix" && h[2].sliceSerialize(h[1], !0).length >= 4 ? a(u) : n(u);
  }
  function a(u) {
    return u === null ? l(u) : qt(u) ? t.attempt(Qz, a, l)(u) : (t.enter("codeFlowValue"), o(u));
  }
  function o(u) {
    return u === null || qt(u) ? (t.exit("codeFlowValue"), a(u)) : (t.consume(u), o);
  }
  function l(u) {
    return t.exit("codeIndented"), e(u);
  }
}
function Jz(t, e, n) {
  const i = this;
  return r;
  function r(a) {
    return i.parser.lazy[i.now().line] ? n(a) : qt(a) ? (t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), r) : me(t, s, "linePrefix", 5)(a);
  }
  function s(a) {
    const o = i.events[i.events.length - 1];
    return o && o[1].type === "linePrefix" && o[2].sliceSerialize(o[1], !0).length >= 4 ? e(a) : qt(a) ? r(a) : n(a);
  }
}
const tV = {
  name: "codeText",
  tokenize: iV,
  resolve: eV,
  previous: nV
};
function eV(t) {
  let e = t.length - 4, n = 3, i, r;
  if ((t[n][1].type === "lineEnding" || t[n][1].type === "space") && (t[e][1].type === "lineEnding" || t[e][1].type === "space")) {
    for (i = n; ++i < e; )
      if (t[i][1].type === "codeTextData") {
        t[n][1].type = "codeTextPadding", t[e][1].type = "codeTextPadding", n += 2, e -= 2;
        break;
      }
  }
  for (i = n - 1, e++; ++i <= e; )
    r === void 0 ? i !== e && t[i][1].type !== "lineEnding" && (r = i) : (i === e || t[i][1].type === "lineEnding") && (t[r][1].type = "codeTextData", i !== r + 2 && (t[r][1].end = t[i - 1][1].end, t.splice(r + 2, i - r - 2), e -= i - r - 2, i = r + 2), r = void 0);
  return t;
}
function nV(t) {
  return t !== 96 || this.events[this.events.length - 1][1].type === "characterEscape";
}
function iV(t, e, n) {
  let i = 0, r, s;
  return a;
  function a(f) {
    return t.enter("codeText"), t.enter("codeTextSequence"), o(f);
  }
  function o(f) {
    return f === 96 ? (t.consume(f), i++, o) : (t.exit("codeTextSequence"), l(f));
  }
  function l(f) {
    return f === null ? n(f) : f === 32 ? (t.enter("space"), t.consume(f), t.exit("space"), l) : f === 96 ? (s = t.enter("codeTextSequence"), r = 0, h(f)) : qt(f) ? (t.enter("lineEnding"), t.consume(f), t.exit("lineEnding"), l) : (t.enter("codeTextData"), u(f));
  }
  function u(f) {
    return f === null || f === 32 || f === 96 || qt(f) ? (t.exit("codeTextData"), l(f)) : (t.consume(f), u);
  }
  function h(f) {
    return f === 96 ? (t.consume(f), r++, h) : r === i ? (t.exit("codeTextSequence"), t.exit("codeText"), e(f)) : (s.type = "codeTextData", u(f));
  }
}
function m4(t) {
  const e = {};
  let n = -1, i, r, s, a, o, l, u;
  for (; ++n < t.length; ) {
    for (; n in e; )
      n = e[n];
    if (i = t[n], n && i[1].type === "chunkFlow" && t[n - 1][1].type === "listItemPrefix" && (l = i[1]._tokenizer.events, s = 0, s < l.length && l[s][1].type === "lineEndingBlank" && (s += 2), s < l.length && l[s][1].type === "content"))
      for (; ++s < l.length && l[s][1].type !== "content"; )
        l[s][1].type === "chunkText" && (l[s][1]._isInFirstContentOfListItem = !0, s++);
    if (i[0] === "enter")
      i[1].contentType && (Object.assign(e, rV(t, n)), n = e[n], u = !0);
    else if (i[1]._container) {
      for (s = n, r = void 0; s-- && (a = t[s], a[1].type === "lineEnding" || a[1].type === "lineEndingBlank"); )
        a[0] === "enter" && (r && (t[r][1].type = "lineEndingBlank"), a[1].type = "lineEnding", r = s);
      r && (i[1].end = Object.assign({}, t[r][1].start), o = t.slice(r, n), o.unshift(i), Gi(t, r, n - r + 1, o));
    }
  }
  return !u;
}
function rV(t, e) {
  const n = t[e][1], i = t[e][2];
  let r = e - 1;
  const s = [], a = n._tokenizer || i.parser[n.contentType](n.start), o = a.events, l = [], u = {};
  let h, f, d = -1, p = n, y = 0, m = 0;
  const _ = [m];
  for (; p; ) {
    for (; t[++r][1] !== p; )
      ;
    s.push(r), p._tokenizer || (h = i.sliceStream(p), p.next || h.push(null), f && a.defineSkip(p.start), p._isInFirstContentOfListItem && (a._gfmTasklistFirstContentOfListItem = !0), a.write(h), p._isInFirstContentOfListItem && (a._gfmTasklistFirstContentOfListItem = void 0)), f = p, p = p.next;
  }
  for (p = n; ++d < o.length; )
    // Find a void token that includes a break.
    o[d][0] === "exit" && o[d - 1][0] === "enter" && o[d][1].type === o[d - 1][1].type && o[d][1].start.line !== o[d][1].end.line && (m = d + 1, _.push(m), p._tokenizer = void 0, p.previous = void 0, p = p.next);
  for (a.events = [], p ? (p._tokenizer = void 0, p.previous = void 0) : _.pop(), d = _.length; d--; ) {
    const T = o.slice(_[d], _[d + 1]), v = s.pop();
    l.unshift([v, v + T.length - 1]), Gi(t, v, 2, T);
  }
  for (d = -1; ++d < l.length; )
    u[y + l[d][0]] = y + l[d][1], y += l[d][1] - l[d][0] - 1;
  return u;
}
const sV = {
  tokenize: lV,
  resolve: oV
}, aV = {
  tokenize: cV,
  partial: !0
};
function oV(t) {
  return m4(t), t;
}
function lV(t, e) {
  let n;
  return i;
  function i(o) {
    return t.enter("content"), n = t.enter("chunkContent", {
      contentType: "content"
    }), r(o);
  }
  function r(o) {
    return o === null ? s(o) : qt(o) ? t.check(
      aV,
      a,
      s
    )(o) : (t.consume(o), r);
  }
  function s(o) {
    return t.exit("chunkContent"), t.exit("content"), e(o);
  }
  function a(o) {
    return t.consume(o), t.exit("chunkContent"), n.next = t.enter("chunkContent", {
      contentType: "content",
      previous: n
    }), n = n.next, r;
  }
}
function cV(t, e, n) {
  const i = this;
  return r;
  function r(a) {
    return t.exit("chunkContent"), t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), me(t, s, "linePrefix");
  }
  function s(a) {
    if (a === null || qt(a))
      return n(a);
    const o = i.events[i.events.length - 1];
    return !i.parser.constructs.disable.null.includes("codeIndented") && o && o[1].type === "linePrefix" && o[2].sliceSerialize(o[1], !0).length >= 4 ? e(a) : t.interrupt(i.parser.constructs.flow, n, e)(a);
  }
}
function x4(t, e, n, i, r, s, a, o, l) {
  const u = l || Number.POSITIVE_INFINITY;
  let h = 0;
  return f;
  function f(T) {
    return T === 60 ? (t.enter(i), t.enter(r), t.enter(s), t.consume(T), t.exit(s), d) : T === null || T === 32 || T === 41 || p1(T) ? n(T) : (t.enter(i), t.enter(a), t.enter(o), t.enter("chunkString", {
      contentType: "string"
    }), m(T));
  }
  function d(T) {
    return T === 62 ? (t.enter(s), t.consume(T), t.exit(s), t.exit(r), t.exit(i), e) : (t.enter(o), t.enter("chunkString", {
      contentType: "string"
    }), p(T));
  }
  function p(T) {
    return T === 62 ? (t.exit("chunkString"), t.exit(o), d(T)) : T === null || T === 60 || qt(T) ? n(T) : (t.consume(T), T === 92 ? y : p);
  }
  function y(T) {
    return T === 60 || T === 62 || T === 92 ? (t.consume(T), p) : p(T);
  }
  function m(T) {
    return !h && (T === null || T === 41 || Rn(T)) ? (t.exit("chunkString"), t.exit(o), t.exit(a), t.exit(i), e(T)) : h < u && T === 40 ? (t.consume(T), h++, m) : T === 41 ? (t.consume(T), h--, m) : T === null || T === 32 || T === 40 || p1(T) ? n(T) : (t.consume(T), T === 92 ? _ : m);
  }
  function _(T) {
    return T === 40 || T === 41 || T === 92 ? (t.consume(T), m) : m(T);
  }
}
function b4(t, e, n, i, r, s) {
  const a = this;
  let o = 0, l;
  return u;
  function u(p) {
    return t.enter(i), t.enter(r), t.consume(p), t.exit(r), t.enter(s), h;
  }
  function h(p) {
    return o > 999 || p === null || p === 91 || p === 93 && !l || // To do: remove in the future once we’ve switched from
    // `micromark-extension-footnote` to `micromark-extension-gfm-footnote`,
    // which doesn’t need this.
    // Hidden footnotes hook.
    /* c8 ignore next 3 */
    p === 94 && !o && "_hiddenFootnoteSupport" in a.parser.constructs ? n(p) : p === 93 ? (t.exit(s), t.enter(r), t.consume(p), t.exit(r), t.exit(i), e) : qt(p) ? (t.enter("lineEnding"), t.consume(p), t.exit("lineEnding"), h) : (t.enter("chunkString", {
      contentType: "string"
    }), f(p));
  }
  function f(p) {
    return p === null || p === 91 || p === 93 || qt(p) || o++ > 999 ? (t.exit("chunkString"), h(p)) : (t.consume(p), l || (l = !ce(p)), p === 92 ? d : f);
  }
  function d(p) {
    return p === 91 || p === 92 || p === 93 ? (t.consume(p), o++, f) : f(p);
  }
}
function _4(t, e, n, i, r, s) {
  let a;
  return o;
  function o(d) {
    return d === 34 || d === 39 || d === 40 ? (t.enter(i), t.enter(r), t.consume(d), t.exit(r), a = d === 40 ? 41 : d, l) : n(d);
  }
  function l(d) {
    return d === a ? (t.enter(r), t.consume(d), t.exit(r), t.exit(i), e) : (t.enter(s), u(d));
  }
  function u(d) {
    return d === a ? (t.exit(s), l(a)) : d === null ? n(d) : qt(d) ? (t.enter("lineEnding"), t.consume(d), t.exit("lineEnding"), me(t, u, "linePrefix")) : (t.enter("chunkString", {
      contentType: "string"
    }), h(d));
  }
  function h(d) {
    return d === a || d === null || qt(d) ? (t.exit("chunkString"), u(d)) : (t.consume(d), d === 92 ? f : h);
  }
  function f(d) {
    return d === a || d === 92 ? (t.consume(d), h) : h(d);
  }
}
function Bo(t, e) {
  let n;
  return i;
  function i(r) {
    return qt(r) ? (t.enter("lineEnding"), t.consume(r), t.exit("lineEnding"), n = !0, i) : ce(r) ? me(
      t,
      i,
      n ? "linePrefix" : "lineSuffix"
    )(r) : e(r);
  }
}
function ca(t) {
  return t.replace(/[\t\n\r ]+/g, " ").replace(/^ | $/g, "").toLowerCase().toUpperCase();
}
const uV = {
  name: "definition",
  tokenize: dV
}, hV = {
  tokenize: fV,
  partial: !0
};
function dV(t, e, n) {
  const i = this;
  let r;
  return s;
  function s(p) {
    return t.enter("definition"), a(p);
  }
  function a(p) {
    return b4.call(
      i,
      t,
      o,
      // Note: we don’t need to reset the way `markdown-rs` does.
      n,
      "definitionLabel",
      "definitionLabelMarker",
      "definitionLabelString"
    )(p);
  }
  function o(p) {
    return r = ca(
      i.sliceSerialize(i.events[i.events.length - 1][1]).slice(1, -1)
    ), p === 58 ? (t.enter("definitionMarker"), t.consume(p), t.exit("definitionMarker"), l) : n(p);
  }
  function l(p) {
    return Rn(p) ? Bo(t, u)(p) : u(p);
  }
  function u(p) {
    return x4(
      t,
      h,
      // Note: we don’t need to reset the way `markdown-rs` does.
      n,
      "definitionDestination",
      "definitionDestinationLiteral",
      "definitionDestinationLiteralMarker",
      "definitionDestinationRaw",
      "definitionDestinationString"
    )(p);
  }
  function h(p) {
    return t.attempt(hV, f, f)(p);
  }
  function f(p) {
    return ce(p) ? me(t, d, "whitespace")(p) : d(p);
  }
  function d(p) {
    return p === null || qt(p) ? (t.exit("definition"), i.parser.defined.push(r), e(p)) : n(p);
  }
}
function fV(t, e, n) {
  return i;
  function i(o) {
    return Rn(o) ? Bo(t, r)(o) : n(o);
  }
  function r(o) {
    return _4(
      t,
      s,
      n,
      "definitionTitle",
      "definitionTitleMarker",
      "definitionTitleString"
    )(o);
  }
  function s(o) {
    return ce(o) ? me(t, a, "whitespace")(o) : a(o);
  }
  function a(o) {
    return o === null || qt(o) ? e(o) : n(o);
  }
}
const pV = {
  name: "hardBreakEscape",
  tokenize: gV
};
function gV(t, e, n) {
  return i;
  function i(s) {
    return t.enter("hardBreakEscape"), t.consume(s), r;
  }
  function r(s) {
    return qt(s) ? (t.exit("hardBreakEscape"), e(s)) : n(s);
  }
}
const yV = {
  name: "headingAtx",
  tokenize: xV,
  resolve: mV
};
function mV(t, e) {
  let n = t.length - 2, i = 3, r, s;
  return t[i][1].type === "whitespace" && (i += 2), n - 2 > i && t[n][1].type === "whitespace" && (n -= 2), t[n][1].type === "atxHeadingSequence" && (i === n - 1 || n - 4 > i && t[n - 2][1].type === "whitespace") && (n -= i + 1 === n ? 2 : 4), n > i && (r = {
    type: "atxHeadingText",
    start: t[i][1].start,
    end: t[n][1].end
  }, s = {
    type: "chunkText",
    start: t[i][1].start,
    end: t[n][1].end,
    contentType: "text"
  }, Gi(t, i, n - i + 1, [
    ["enter", r, e],
    ["enter", s, e],
    ["exit", s, e],
    ["exit", r, e]
  ])), t;
}
function xV(t, e, n) {
  let i = 0;
  return r;
  function r(h) {
    return t.enter("atxHeading"), s(h);
  }
  function s(h) {
    return t.enter("atxHeadingSequence"), a(h);
  }
  function a(h) {
    return h === 35 && i++ < 6 ? (t.consume(h), a) : h === null || Rn(h) ? (t.exit("atxHeadingSequence"), o(h)) : n(h);
  }
  function o(h) {
    return h === 35 ? (t.enter("atxHeadingSequence"), l(h)) : h === null || qt(h) ? (t.exit("atxHeading"), e(h)) : ce(h) ? me(t, o, "whitespace")(h) : (t.enter("atxHeadingText"), u(h));
  }
  function l(h) {
    return h === 35 ? (t.consume(h), l) : (t.exit("atxHeadingSequence"), o(h));
  }
  function u(h) {
    return h === null || h === 35 || Rn(h) ? (t.exit("atxHeadingText"), o(h)) : (t.consume(h), u);
  }
}
const bV = [
  "address",
  "article",
  "aside",
  "base",
  "basefont",
  "blockquote",
  "body",
  "caption",
  "center",
  "col",
  "colgroup",
  "dd",
  "details",
  "dialog",
  "dir",
  "div",
  "dl",
  "dt",
  "fieldset",
  "figcaption",
  "figure",
  "footer",
  "form",
  "frame",
  "frameset",
  "h1",
  "h2",
  "h3",
  "h4",
  "h5",
  "h6",
  "head",
  "header",
  "hr",
  "html",
  "iframe",
  "legend",
  "li",
  "link",
  "main",
  "menu",
  "menuitem",
  "nav",
  "noframes",
  "ol",
  "optgroup",
  "option",
  "p",
  "param",
  "search",
  "section",
  "summary",
  "table",
  "tbody",
  "td",
  "tfoot",
  "th",
  "thead",
  "title",
  "tr",
  "track",
  "ul"
], v2 = ["pre", "script", "style", "textarea"], _V = {
  name: "htmlFlow",
  tokenize: vV,
  resolveTo: wV,
  concrete: !0
}, kV = {
  tokenize: CV,
  partial: !0
}, TV = {
  tokenize: EV,
  partial: !0
};
function wV(t) {
  let e = t.length;
  for (; e-- && !(t[e][0] === "enter" && t[e][1].type === "htmlFlow"); )
    ;
  return e > 1 && t[e - 2][1].type === "linePrefix" && (t[e][1].start = t[e - 2][1].start, t[e + 1][1].start = t[e - 2][1].start, t.splice(e - 2, 2)), t;
}
function vV(t, e, n) {
  const i = this;
  let r, s, a, o, l;
  return u;
  function u(O) {
    return h(O);
  }
  function h(O) {
    return t.enter("htmlFlow"), t.enter("htmlFlowData"), t.consume(O), f;
  }
  function f(O) {
    return O === 33 ? (t.consume(O), d) : O === 47 ? (t.consume(O), s = !0, m) : O === 63 ? (t.consume(O), r = 3, i.interrupt ? e : E) : Mi(O) ? (t.consume(O), a = String.fromCharCode(O), _) : n(O);
  }
  function d(O) {
    return O === 45 ? (t.consume(O), r = 2, p) : O === 91 ? (t.consume(O), r = 5, o = 0, y) : Mi(O) ? (t.consume(O), r = 4, i.interrupt ? e : E) : n(O);
  }
  function p(O) {
    return O === 45 ? (t.consume(O), i.interrupt ? e : E) : n(O);
  }
  function y(O) {
    const ct = "CDATA[";
    return O === ct.charCodeAt(o++) ? (t.consume(O), o === ct.length ? i.interrupt ? e : I : y) : n(O);
  }
  function m(O) {
    return Mi(O) ? (t.consume(O), a = String.fromCharCode(O), _) : n(O);
  }
  function _(O) {
    if (O === null || O === 47 || O === 62 || Rn(O)) {
      const ct = O === 47, X = a.toLowerCase();
      return !ct && !s && v2.includes(X) ? (r = 1, i.interrupt ? e(O) : I(O)) : bV.includes(a.toLowerCase()) ? (r = 6, ct ? (t.consume(O), T) : i.interrupt ? e(O) : I(O)) : (r = 7, i.interrupt && !i.parser.lazy[i.now().line] ? n(O) : s ? v(O) : A(O));
    }
    return O === 45 || ki(O) ? (t.consume(O), a += String.fromCharCode(O), _) : n(O);
  }
  function T(O) {
    return O === 62 ? (t.consume(O), i.interrupt ? e : I) : n(O);
  }
  function v(O) {
    return ce(O) ? (t.consume(O), v) : C(O);
  }
  function A(O) {
    return O === 47 ? (t.consume(O), C) : O === 58 || O === 95 || Mi(O) ? (t.consume(O), L) : ce(O) ? (t.consume(O), A) : C(O);
  }
  function L(O) {
    return O === 45 || O === 46 || O === 58 || O === 95 || ki(O) ? (t.consume(O), L) : w(O);
  }
  function w(O) {
    return O === 61 ? (t.consume(O), b) : ce(O) ? (t.consume(O), w) : A(O);
  }
  function b(O) {
    return O === null || O === 60 || O === 61 || O === 62 || O === 96 ? n(O) : O === 34 || O === 39 ? (t.consume(O), l = O, F) : ce(O) ? (t.consume(O), b) : S(O);
  }
  function F(O) {
    return O === l ? (t.consume(O), l = null, x) : O === null || qt(O) ? n(O) : (t.consume(O), F);
  }
  function S(O) {
    return O === null || O === 34 || O === 39 || O === 47 || O === 60 || O === 61 || O === 62 || O === 96 || Rn(O) ? w(O) : (t.consume(O), S);
  }
  function x(O) {
    return O === 47 || O === 62 || ce(O) ? A(O) : n(O);
  }
  function C(O) {
    return O === 62 ? (t.consume(O), g) : n(O);
  }
  function g(O) {
    return O === null || qt(O) ? I(O) : ce(O) ? (t.consume(O), g) : n(O);
  }
  function I(O) {
    return O === 45 && r === 2 ? (t.consume(O), M) : O === 60 && r === 1 ? (t.consume(O), B) : O === 62 && r === 4 ? (t.consume(O), V) : O === 63 && r === 3 ? (t.consume(O), E) : O === 93 && r === 5 ? (t.consume(O), D) : qt(O) && (r === 6 || r === 7) ? (t.exit("htmlFlowData"), t.check(
      kV,
      nt,
      k
    )(O)) : O === null || qt(O) ? (t.exit("htmlFlowData"), k(O)) : (t.consume(O), I);
  }
  function k(O) {
    return t.check(
      TV,
      P,
      nt
    )(O);
  }
  function P(O) {
    return t.enter("lineEnding"), t.consume(O), t.exit("lineEnding"), R;
  }
  function R(O) {
    return O === null || qt(O) ? k(O) : (t.enter("htmlFlowData"), I(O));
  }
  function M(O) {
    return O === 45 ? (t.consume(O), E) : I(O);
  }
  function B(O) {
    return O === 47 ? (t.consume(O), a = "", N) : I(O);
  }
  function N(O) {
    if (O === 62) {
      const ct = a.toLowerCase();
      return v2.includes(ct) ? (t.consume(O), V) : I(O);
    }
    return Mi(O) && a.length < 8 ? (t.consume(O), a += String.fromCharCode(O), N) : I(O);
  }
  function D(O) {
    return O === 93 ? (t.consume(O), E) : I(O);
  }
  function E(O) {
    return O === 62 ? (t.consume(O), V) : O === 45 && r === 2 ? (t.consume(O), E) : I(O);
  }
  function V(O) {
    return O === null || qt(O) ? (t.exit("htmlFlowData"), nt(O)) : (t.consume(O), V);
  }
  function nt(O) {
    return t.exit("htmlFlow"), e(O);
  }
}
function EV(t, e, n) {
  const i = this;
  return r;
  function r(a) {
    return qt(a) ? (t.enter("lineEnding"), t.consume(a), t.exit("lineEnding"), s) : n(a);
  }
  function s(a) {
    return i.parser.lazy[i.now().line] ? n(a) : e(a);
  }
}
function CV(t, e, n) {
  return i;
  function i(r) {
    return t.enter("lineEnding"), t.consume(r), t.exit("lineEnding"), t.attempt(xh, e, n);
  }
}
const SV = {
  name: "htmlText",
  tokenize: AV
};
function AV(t, e, n) {
  const i = this;
  let r, s, a;
  return o;
  function o(E) {
    return t.enter("htmlText"), t.enter("htmlTextData"), t.consume(E), l;
  }
  function l(E) {
    return E === 33 ? (t.consume(E), u) : E === 47 ? (t.consume(E), w) : E === 63 ? (t.consume(E), A) : Mi(E) ? (t.consume(E), S) : n(E);
  }
  function u(E) {
    return E === 45 ? (t.consume(E), h) : E === 91 ? (t.consume(E), s = 0, y) : Mi(E) ? (t.consume(E), v) : n(E);
  }
  function h(E) {
    return E === 45 ? (t.consume(E), p) : n(E);
  }
  function f(E) {
    return E === null ? n(E) : E === 45 ? (t.consume(E), d) : qt(E) ? (a = f, B(E)) : (t.consume(E), f);
  }
  function d(E) {
    return E === 45 ? (t.consume(E), p) : f(E);
  }
  function p(E) {
    return E === 62 ? M(E) : E === 45 ? d(E) : f(E);
  }
  function y(E) {
    const V = "CDATA[";
    return E === V.charCodeAt(s++) ? (t.consume(E), s === V.length ? m : y) : n(E);
  }
  function m(E) {
    return E === null ? n(E) : E === 93 ? (t.consume(E), _) : qt(E) ? (a = m, B(E)) : (t.consume(E), m);
  }
  function _(E) {
    return E === 93 ? (t.consume(E), T) : m(E);
  }
  function T(E) {
    return E === 62 ? M(E) : E === 93 ? (t.consume(E), T) : m(E);
  }
  function v(E) {
    return E === null || E === 62 ? M(E) : qt(E) ? (a = v, B(E)) : (t.consume(E), v);
  }
  function A(E) {
    return E === null ? n(E) : E === 63 ? (t.consume(E), L) : qt(E) ? (a = A, B(E)) : (t.consume(E), A);
  }
  function L(E) {
    return E === 62 ? M(E) : A(E);
  }
  function w(E) {
    return Mi(E) ? (t.consume(E), b) : n(E);
  }
  function b(E) {
    return E === 45 || ki(E) ? (t.consume(E), b) : F(E);
  }
  function F(E) {
    return qt(E) ? (a = F, B(E)) : ce(E) ? (t.consume(E), F) : M(E);
  }
  function S(E) {
    return E === 45 || ki(E) ? (t.consume(E), S) : E === 47 || E === 62 || Rn(E) ? x(E) : n(E);
  }
  function x(E) {
    return E === 47 ? (t.consume(E), M) : E === 58 || E === 95 || Mi(E) ? (t.consume(E), C) : qt(E) ? (a = x, B(E)) : ce(E) ? (t.consume(E), x) : M(E);
  }
  function C(E) {
    return E === 45 || E === 46 || E === 58 || E === 95 || ki(E) ? (t.consume(E), C) : g(E);
  }
  function g(E) {
    return E === 61 ? (t.consume(E), I) : qt(E) ? (a = g, B(E)) : ce(E) ? (t.consume(E), g) : x(E);
  }
  function I(E) {
    return E === null || E === 60 || E === 61 || E === 62 || E === 96 ? n(E) : E === 34 || E === 39 ? (t.consume(E), r = E, k) : qt(E) ? (a = I, B(E)) : ce(E) ? (t.consume(E), I) : (t.consume(E), P);
  }
  function k(E) {
    return E === r ? (t.consume(E), r = void 0, R) : E === null ? n(E) : qt(E) ? (a = k, B(E)) : (t.consume(E), k);
  }
  function P(E) {
    return E === null || E === 34 || E === 39 || E === 60 || E === 61 || E === 96 ? n(E) : E === 47 || E === 62 || Rn(E) ? x(E) : (t.consume(E), P);
  }
  function R(E) {
    return E === 47 || E === 62 || Rn(E) ? x(E) : n(E);
  }
  function M(E) {
    return E === 62 ? (t.consume(E), t.exit("htmlTextData"), t.exit("htmlText"), e) : n(E);
  }
  function B(E) {
    return t.exit("htmlTextData"), t.enter("lineEnding"), t.consume(E), t.exit("lineEnding"), N;
  }
  function N(E) {
    return ce(E) ? me(
      t,
      D,
      "linePrefix",
      i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
    )(E) : D(E);
  }
  function D(E) {
    return t.enter("htmlTextData"), a(E);
  }
}
const c0 = {
  name: "labelEnd",
  tokenize: FV,
  resolveTo: NV,
  resolveAll: DV
}, LV = {
  tokenize: OV
}, IV = {
  tokenize: RV
}, BV = {
  tokenize: MV
};
function DV(t) {
  let e = -1;
  for (; ++e < t.length; ) {
    const n = t[e][1];
    (n.type === "labelImage" || n.type === "labelLink" || n.type === "labelEnd") && (t.splice(e + 1, n.type === "labelImage" ? 4 : 2), n.type = "data", e++);
  }
  return t;
}
function NV(t, e) {
  let n = t.length, i = 0, r, s, a, o;
  for (; n--; )
    if (r = t[n][1], s) {
      if (r.type === "link" || r.type === "labelLink" && r._inactive)
        break;
      t[n][0] === "enter" && r.type === "labelLink" && (r._inactive = !0);
    } else if (a) {
      if (t[n][0] === "enter" && (r.type === "labelImage" || r.type === "labelLink") && !r._balanced && (s = n, r.type !== "labelLink")) {
        i = 2;
        break;
      }
    } else r.type === "labelEnd" && (a = n);
  const l = {
    type: t[s][1].type === "labelLink" ? "link" : "image",
    start: Object.assign({}, t[s][1].start),
    end: Object.assign({}, t[t.length - 1][1].end)
  }, u = {
    type: "label",
    start: Object.assign({}, t[s][1].start),
    end: Object.assign({}, t[a][1].end)
  }, h = {
    type: "labelText",
    start: Object.assign({}, t[s + i + 2][1].end),
    end: Object.assign({}, t[a - 2][1].start)
  };
  return o = [
    ["enter", l, e],
    ["enter", u, e]
  ], o = si(o, t.slice(s + 1, s + i + 3)), o = si(o, [["enter", h, e]]), o = si(
    o,
    o0(
      e.parser.constructs.insideSpan.null,
      t.slice(s + i + 4, a - 3),
      e
    )
  ), o = si(o, [
    ["exit", h, e],
    t[a - 2],
    t[a - 1],
    ["exit", u, e]
  ]), o = si(o, t.slice(a + 1)), o = si(o, [["exit", l, e]]), Gi(t, s, t.length, o), t;
}
function FV(t, e, n) {
  const i = this;
  let r = i.events.length, s, a;
  for (; r--; )
    if ((i.events[r][1].type === "labelImage" || i.events[r][1].type === "labelLink") && !i.events[r][1]._balanced) {
      s = i.events[r][1];
      break;
    }
  return o;
  function o(d) {
    return s ? s._inactive ? f(d) : (a = i.parser.defined.includes(
      ca(
        i.sliceSerialize({
          start: s.end,
          end: i.now()
        })
      )
    ), t.enter("labelEnd"), t.enter("labelMarker"), t.consume(d), t.exit("labelMarker"), t.exit("labelEnd"), l) : n(d);
  }
  function l(d) {
    return d === 40 ? t.attempt(
      LV,
      h,
      a ? h : f
    )(d) : d === 91 ? t.attempt(
      IV,
      h,
      a ? u : f
    )(d) : a ? h(d) : f(d);
  }
  function u(d) {
    return t.attempt(
      BV,
      h,
      f
    )(d);
  }
  function h(d) {
    return e(d);
  }
  function f(d) {
    return s._balanced = !0, n(d);
  }
}
function OV(t, e, n) {
  return i;
  function i(f) {
    return t.enter("resource"), t.enter("resourceMarker"), t.consume(f), t.exit("resourceMarker"), r;
  }
  function r(f) {
    return Rn(f) ? Bo(t, s)(f) : s(f);
  }
  function s(f) {
    return f === 41 ? h(f) : x4(
      t,
      a,
      o,
      "resourceDestination",
      "resourceDestinationLiteral",
      "resourceDestinationLiteralMarker",
      "resourceDestinationRaw",
      "resourceDestinationString",
      32
    )(f);
  }
  function a(f) {
    return Rn(f) ? Bo(t, l)(f) : h(f);
  }
  function o(f) {
    return n(f);
  }
  function l(f) {
    return f === 34 || f === 39 || f === 40 ? _4(
      t,
      u,
      n,
      "resourceTitle",
      "resourceTitleMarker",
      "resourceTitleString"
    )(f) : h(f);
  }
  function u(f) {
    return Rn(f) ? Bo(t, h)(f) : h(f);
  }
  function h(f) {
    return f === 41 ? (t.enter("resourceMarker"), t.consume(f), t.exit("resourceMarker"), t.exit("resource"), e) : n(f);
  }
}
function RV(t, e, n) {
  const i = this;
  return r;
  function r(o) {
    return b4.call(
      i,
      t,
      s,
      a,
      "reference",
      "referenceMarker",
      "referenceString"
    )(o);
  }
  function s(o) {
    return i.parser.defined.includes(
      ca(
        i.sliceSerialize(i.events[i.events.length - 1][1]).slice(1, -1)
      )
    ) ? e(o) : n(o);
  }
  function a(o) {
    return n(o);
  }
}
function MV(t, e, n) {
  return i;
  function i(s) {
    return t.enter("reference"), t.enter("referenceMarker"), t.consume(s), t.exit("referenceMarker"), r;
  }
  function r(s) {
    return s === 93 ? (t.enter("referenceMarker"), t.consume(s), t.exit("referenceMarker"), t.exit("reference"), e) : n(s);
  }
}
const PV = {
  name: "labelStartImage",
  tokenize: zV,
  resolveAll: c0.resolveAll
};
function zV(t, e, n) {
  const i = this;
  return r;
  function r(o) {
    return t.enter("labelImage"), t.enter("labelImageMarker"), t.consume(o), t.exit("labelImageMarker"), s;
  }
  function s(o) {
    return o === 91 ? (t.enter("labelMarker"), t.consume(o), t.exit("labelMarker"), t.exit("labelImage"), a) : n(o);
  }
  function a(o) {
    return o === 94 && "_hiddenFootnoteSupport" in i.parser.constructs ? n(o) : e(o);
  }
}
const VV = {
  name: "labelStartLink",
  tokenize: qV,
  resolveAll: c0.resolveAll
};
function qV(t, e, n) {
  const i = this;
  return r;
  function r(a) {
    return t.enter("labelLink"), t.enter("labelMarker"), t.consume(a), t.exit("labelMarker"), t.exit("labelLink"), s;
  }
  function s(a) {
    return a === 94 && "_hiddenFootnoteSupport" in i.parser.constructs ? n(a) : e(a);
  }
}
const pd = {
  name: "lineEnding",
  tokenize: $V
};
function $V(t, e) {
  return n;
  function n(i) {
    return t.enter("lineEnding"), t.consume(i), t.exit("lineEnding"), me(t, e, "linePrefix");
  }
}
const _c = {
  name: "thematicBreak",
  tokenize: YV
};
function YV(t, e, n) {
  let i = 0, r;
  return s;
  function s(u) {
    return t.enter("thematicBreak"), a(u);
  }
  function a(u) {
    return r = u, o(u);
  }
  function o(u) {
    return u === r ? (t.enter("thematicBreakSequence"), l(u)) : i >= 3 && (u === null || qt(u)) ? (t.exit("thematicBreak"), e(u)) : n(u);
  }
  function l(u) {
    return u === r ? (t.consume(u), i++, l) : (t.exit("thematicBreakSequence"), ce(u) ? me(t, o, "whitespace")(u) : o(u));
  }
}
const Ln = {
  name: "list",
  tokenize: HV,
  continuation: {
    tokenize: GV
  },
  exit: XV
}, WV = {
  tokenize: KV,
  partial: !0
}, UV = {
  tokenize: jV,
  partial: !0
};
function HV(t, e, n) {
  const i = this, r = i.events[i.events.length - 1];
  let s = r && r[1].type === "linePrefix" ? r[2].sliceSerialize(r[1], !0).length : 0, a = 0;
  return o;
  function o(p) {
    const y = i.containerState.type || (p === 42 || p === 43 || p === 45 ? "listUnordered" : "listOrdered");
    if (y === "listUnordered" ? !i.containerState.marker || p === i.containerState.marker : g1(p)) {
      if (i.containerState.type || (i.containerState.type = y, t.enter(y, {
        _container: !0
      })), y === "listUnordered")
        return t.enter("listItemPrefix"), p === 42 || p === 45 ? t.check(_c, n, u)(p) : u(p);
      if (!i.interrupt || p === 49)
        return t.enter("listItemPrefix"), t.enter("listItemValue"), l(p);
    }
    return n(p);
  }
  function l(p) {
    return g1(p) && ++a < 10 ? (t.consume(p), l) : (!i.interrupt || a < 2) && (i.containerState.marker ? p === i.containerState.marker : p === 41 || p === 46) ? (t.exit("listItemValue"), u(p)) : n(p);
  }
  function u(p) {
    return t.enter("listItemMarker"), t.consume(p), t.exit("listItemMarker"), i.containerState.marker = i.containerState.marker || p, t.check(
      xh,
      // Can’t be empty when interrupting.
      i.interrupt ? n : h,
      t.attempt(
        WV,
        d,
        f
      )
    );
  }
  function h(p) {
    return i.containerState.initialBlankLine = !0, s++, d(p);
  }
  function f(p) {
    return ce(p) ? (t.enter("listItemPrefixWhitespace"), t.consume(p), t.exit("listItemPrefixWhitespace"), d) : n(p);
  }
  function d(p) {
    return i.containerState.size = s + i.sliceSerialize(t.exit("listItemPrefix"), !0).length, e(p);
  }
}
function GV(t, e, n) {
  const i = this;
  return i.containerState._closeFlow = void 0, t.check(xh, r, s);
  function r(o) {
    return i.containerState.furtherBlankLines = i.containerState.furtherBlankLines || i.containerState.initialBlankLine, me(
      t,
      e,
      "listItemIndent",
      i.containerState.size + 1
    )(o);
  }
  function s(o) {
    return i.containerState.furtherBlankLines || !ce(o) ? (i.containerState.furtherBlankLines = void 0, i.containerState.initialBlankLine = void 0, a(o)) : (i.containerState.furtherBlankLines = void 0, i.containerState.initialBlankLine = void 0, t.attempt(UV, e, a)(o));
  }
  function a(o) {
    return i.containerState._closeFlow = !0, i.interrupt = void 0, me(
      t,
      t.attempt(Ln, e, n),
      "linePrefix",
      i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 4
    )(o);
  }
}
function jV(t, e, n) {
  const i = this;
  return me(
    t,
    r,
    "listItemIndent",
    i.containerState.size + 1
  );
  function r(s) {
    const a = i.events[i.events.length - 1];
    return a && a[1].type === "listItemIndent" && a[2].sliceSerialize(a[1], !0).length === i.containerState.size ? e(s) : n(s);
  }
}
function XV(t) {
  t.exit(this.containerState.type);
}
function KV(t, e, n) {
  const i = this;
  return me(
    t,
    r,
    "listItemPrefixWhitespace",
    i.parser.constructs.disable.null.includes("codeIndented") ? void 0 : 5
  );
  function r(s) {
    const a = i.events[i.events.length - 1];
    return !ce(s) && a && a[1].type === "listItemPrefixWhitespace" ? e(s) : n(s);
  }
}
const E2 = {
  name: "setextUnderline",
  tokenize: ZV,
  resolveTo: QV
};
function QV(t, e) {
  let n = t.length, i, r, s;
  for (; n--; )
    if (t[n][0] === "enter") {
      if (t[n][1].type === "content") {
        i = n;
        break;
      }
      t[n][1].type === "paragraph" && (r = n);
    } else
      t[n][1].type === "content" && t.splice(n, 1), !s && t[n][1].type === "definition" && (s = n);
  const a = {
    type: "setextHeading",
    start: Object.assign({}, t[r][1].start),
    end: Object.assign({}, t[t.length - 1][1].end)
  };
  return t[r][1].type = "setextHeadingText", s ? (t.splice(r, 0, ["enter", a, e]), t.splice(s + 1, 0, ["exit", t[i][1], e]), t[i][1].end = Object.assign({}, t[s][1].end)) : t[i][1] = a, t.push(["exit", a, e]), t;
}
function ZV(t, e, n) {
  const i = this;
  let r;
  return s;
  function s(u) {
    let h = i.events.length, f;
    for (; h--; )
      if (i.events[h][1].type !== "lineEnding" && i.events[h][1].type !== "linePrefix" && i.events[h][1].type !== "content") {
        f = i.events[h][1].type === "paragraph";
        break;
      }
    return !i.parser.lazy[i.now().line] && (i.interrupt || f) ? (t.enter("setextHeadingLine"), r = u, a(u)) : n(u);
  }
  function a(u) {
    return t.enter("setextHeadingLineSequence"), o(u);
  }
  function o(u) {
    return u === r ? (t.consume(u), o) : (t.exit("setextHeadingLineSequence"), ce(u) ? me(t, l, "lineSuffix")(u) : l(u));
  }
  function l(u) {
    return u === null || qt(u) ? (t.exit("setextHeadingLine"), e(u)) : n(u);
  }
}
const JV = {
  tokenize: tq
};
function tq(t) {
  const e = this, n = t.attempt(
    // Try to parse a blank line.
    xh,
    i,
    // Try to parse initial flow (essentially, only code).
    t.attempt(
      this.parser.constructs.flowInitial,
      r,
      me(
        t,
        t.attempt(
          this.parser.constructs.flow,
          r,
          t.attempt(sV, r)
        ),
        "linePrefix"
      )
    )
  );
  return n;
  function i(s) {
    if (s === null) {
      t.consume(s);
      return;
    }
    return t.enter("lineEndingBlank"), t.consume(s), t.exit("lineEndingBlank"), e.currentConstruct = void 0, n;
  }
  function r(s) {
    if (s === null) {
      t.consume(s);
      return;
    }
    return t.enter("lineEnding"), t.consume(s), t.exit("lineEnding"), e.currentConstruct = void 0, n;
  }
}
const eq = {
  resolveAll: T4()
}, nq = k4("string"), iq = k4("text");
function k4(t) {
  return {
    tokenize: e,
    resolveAll: T4(
      t === "text" ? rq : void 0
    )
  };
  function e(n) {
    const i = this, r = this.parser.constructs[t], s = n.attempt(r, a, o);
    return a;
    function a(h) {
      return u(h) ? s(h) : o(h);
    }
    function o(h) {
      if (h === null) {
        n.consume(h);
        return;
      }
      return n.enter("data"), n.consume(h), l;
    }
    function l(h) {
      return u(h) ? (n.exit("data"), s(h)) : (n.consume(h), l);
    }
    function u(h) {
      if (h === null)
        return !0;
      const f = r[h];
      let d = -1;
      if (f)
        for (; ++d < f.length; ) {
          const p = f[d];
          if (!p.previous || p.previous.call(i, i.previous))
            return !0;
        }
      return !1;
    }
  }
}
function T4(t) {
  return e;
  function e(n, i) {
    let r = -1, s;
    for (; ++r <= n.length; )
      s === void 0 ? n[r] && n[r][1].type === "data" && (s = r, r++) : (!n[r] || n[r][1].type !== "data") && (r !== s + 2 && (n[s][1].end = n[r - 1][1].end, n.splice(s + 2, r - s - 2), r = s + 2), s = void 0);
    return t ? t(n, i) : n;
  }
}
function rq(t, e) {
  let n = 0;
  for (; ++n <= t.length; )
    if ((n === t.length || t[n][1].type === "lineEnding") && t[n - 1][1].type === "data") {
      const i = t[n - 1][1], r = e.sliceStream(i);
      let s = r.length, a = -1, o = 0, l;
      for (; s--; ) {
        const u = r[s];
        if (typeof u == "string") {
          for (a = u.length; u.charCodeAt(a - 1) === 32; )
            o++, a--;
          if (a) break;
          a = -1;
        } else if (u === -2)
          l = !0, o++;
        else if (u !== -1) {
          s++;
          break;
        }
      }
      if (o) {
        const u = {
          type: n === t.length || l || o < 2 ? "lineSuffix" : "hardBreakTrailing",
          start: {
            line: i.end.line,
            column: i.end.column - o,
            offset: i.end.offset - o,
            _index: i.start._index + s,
            _bufferIndex: s ? a : i.start._bufferIndex + a
          },
          end: Object.assign({}, i.end)
        };
        i.end = Object.assign({}, u.start), i.start.offset === i.end.offset ? Object.assign(i, u) : (t.splice(
          n,
          0,
          ["enter", u, e],
          ["exit", u, e]
        ), n += 2);
      }
      n++;
    }
  return t;
}
function sq(t, e, n) {
  let i = Object.assign(
    n ? Object.assign({}, n) : {
      line: 1,
      column: 1,
      offset: 0
    },
    {
      _index: 0,
      _bufferIndex: -1
    }
  );
  const r = {}, s = [];
  let a = [], o = [];
  const l = {
    consume: v,
    enter: A,
    exit: L,
    attempt: F(w),
    check: F(b),
    interrupt: F(b, {
      interrupt: !0
    })
  }, u = {
    previous: null,
    code: null,
    containerState: {},
    events: [],
    parser: t,
    sliceStream: p,
    sliceSerialize: d,
    now: y,
    defineSkip: m,
    write: f
  };
  let h = e.tokenize.call(u, l);
  return e.resolveAll && s.push(e), u;
  function f(g) {
    return a = si(a, g), _(), a[a.length - 1] !== null ? [] : (S(e, 0), u.events = o0(s, u.events, u), u.events);
  }
  function d(g, I) {
    return oq(p(g), I);
  }
  function p(g) {
    return aq(a, g);
  }
  function y() {
    const { line: g, column: I, offset: k, _index: P, _bufferIndex: R } = i;
    return {
      line: g,
      column: I,
      offset: k,
      _index: P,
      _bufferIndex: R
    };
  }
  function m(g) {
    r[g.line] = g.column, C();
  }
  function _() {
    let g;
    for (; i._index < a.length; ) {
      const I = a[i._index];
      if (typeof I == "string")
        for (g = i._index, i._bufferIndex < 0 && (i._bufferIndex = 0); i._index === g && i._bufferIndex < I.length; )
          T(I.charCodeAt(i._bufferIndex));
      else
        T(I);
    }
  }
  function T(g) {
    h = h(g);
  }
  function v(g) {
    qt(g) ? (i.line++, i.column = 1, i.offset += g === -3 ? 2 : 1, C()) : g !== -1 && (i.column++, i.offset++), i._bufferIndex < 0 ? i._index++ : (i._bufferIndex++, i._bufferIndex === a[i._index].length && (i._bufferIndex = -1, i._index++)), u.previous = g;
  }
  function A(g, I) {
    const k = I || {};
    return k.type = g, k.start = y(), u.events.push(["enter", k, u]), o.push(k), k;
  }
  function L(g) {
    const I = o.pop();
    return I.end = y(), u.events.push(["exit", I, u]), I;
  }
  function w(g, I) {
    S(g, I.from);
  }
  function b(g, I) {
    I.restore();
  }
  function F(g, I) {
    return k;
    function k(P, R, M) {
      let B, N, D, E;
      return Array.isArray(P) ? nt(P) : "tokenize" in P ? (
        // @ts-expect-error Looks like a construct.
        nt([P])
      ) : V(P);
      function V(H) {
        return it;
        function it(ot) {
          const W = ot !== null && H[ot], Z = ot !== null && H.null, q = [
            // To do: add more extension tests.
            /* c8 ignore next 2 */
            ...Array.isArray(W) ? W : W ? [W] : [],
            ...Array.isArray(Z) ? Z : Z ? [Z] : []
          ];
          return nt(q)(ot);
        }
      }
      function nt(H) {
        return B = H, N = 0, H.length === 0 ? M : O(H[N]);
      }
      function O(H) {
        return it;
        function it(ot) {
          return E = x(), D = H, H.partial || (u.currentConstruct = H), H.name && u.parser.constructs.disable.null.includes(H.name) ? X() : H.tokenize.call(
            // If we do have fields, create an object w/ `context` as its
            // prototype.
            // This allows a “live binding”, which is needed for `interrupt`.
            I ? Object.assign(Object.create(u), I) : u,
            l,
            ct,
            X
          )(ot);
        }
      }
      function ct(H) {
        return g(D, E), R;
      }
      function X(H) {
        return E.restore(), ++N < B.length ? O(B[N]) : M;
      }
    }
  }
  function S(g, I) {
    g.resolveAll && !s.includes(g) && s.push(g), g.resolve && Gi(
      u.events,
      I,
      u.events.length - I,
      g.resolve(u.events.slice(I), u)
    ), g.resolveTo && (u.events = g.resolveTo(u.events, u));
  }
  function x() {
    const g = y(), I = u.previous, k = u.currentConstruct, P = u.events.length, R = Array.from(o);
    return {
      restore: M,
      from: P
    };
    function M() {
      i = g, u.previous = I, u.currentConstruct = k, u.events.length = P, o = R, C();
    }
  }
  function C() {
    i.line in r && i.column < 2 && (i.column = r[i.line], i.offset += r[i.line] - 1);
  }
}
function aq(t, e) {
  const n = e.start._index, i = e.start._bufferIndex, r = e.end._index, s = e.end._bufferIndex;
  let a;
  if (n === r)
    a = [t[n].slice(i, s)];
  else {
    if (a = t.slice(n, r), i > -1) {
      const o = a[0];
      typeof o == "string" ? a[0] = o.slice(i) : a.shift();
    }
    s > 0 && a.push(t[r].slice(0, s));
  }
  return a;
}
function oq(t, e) {
  let n = -1;
  const i = [];
  let r;
  for (; ++n < t.length; ) {
    const s = t[n];
    let a;
    if (typeof s == "string")
      a = s;
    else
      switch (s) {
        case -5: {
          a = "\r";
          break;
        }
        case -4: {
          a = `
`;
          break;
        }
        case -3: {
          a = `\r
`;
          break;
        }
        case -2: {
          a = e ? " " : "	";
          break;
        }
        case -1: {
          if (!e && r) continue;
          a = " ";
          break;
        }
        default:
          a = String.fromCharCode(s);
      }
    r = s === -2, i.push(a);
  }
  return i.join("");
}
const lq = {
  42: Ln,
  43: Ln,
  45: Ln,
  48: Ln,
  49: Ln,
  50: Ln,
  51: Ln,
  52: Ln,
  53: Ln,
  54: Ln,
  55: Ln,
  56: Ln,
  57: Ln,
  62: p4
}, cq = {
  91: uV
}, uq = {
  [-2]: fd,
  [-1]: fd,
  32: fd
}, hq = {
  35: yV,
  42: _c,
  45: [E2, _c],
  60: _V,
  61: E2,
  95: _c,
  96: w2,
  126: w2
}, dq = {
  38: y4,
  92: g4
}, fq = {
  [-5]: pd,
  [-4]: pd,
  [-3]: pd,
  33: PV,
  38: y4,
  42: y1,
  60: [qz, SV],
  91: VV,
  92: [pV, g4],
  93: c0,
  95: y1,
  96: tV
}, pq = {
  null: [y1, eq]
}, gq = {
  null: [42, 95]
}, yq = {
  null: []
}, mq = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  attentionMarkers: gq,
  contentInitial: cq,
  disable: yq,
  document: lq,
  flow: hq,
  flowInitial: uq,
  insideSpan: pq,
  string: dq,
  text: fq
}, Symbol.toStringTag, { value: "Module" }));
function xq(t) {
  const n = (
    /** @type {FullNormalizedExtension} */
    Ez([mq, ...(t || {}).extensions || []])
  ), i = {
    defined: [],
    lazy: {},
    constructs: n,
    content: r(Fz),
    document: r(Rz),
    flow: r(JV),
    string: r(nq),
    text: r(iq)
  };
  return i;
  function r(s) {
    return a;
    function a(o) {
      return sq(i, s, o);
    }
  }
}
const C2 = /[\0\t\n\r]/g;
function bq() {
  let t = 1, e = "", n = !0, i;
  return r;
  function r(s, a, o) {
    const l = [];
    let u, h, f, d, p;
    for (s = e + s.toString(a), f = 0, e = "", n && (s.charCodeAt(0) === 65279 && f++, n = void 0); f < s.length; ) {
      if (C2.lastIndex = f, u = C2.exec(s), d = u && u.index !== void 0 ? u.index : s.length, p = s.charCodeAt(d), !u) {
        e = s.slice(f);
        break;
      }
      if (p === 10 && f === d && i)
        l.push(-3), i = void 0;
      else
        switch (i && (l.push(-5), i = void 0), f < d && (l.push(s.slice(f, d)), t += d - f), p) {
          case 0: {
            l.push(65533), t++;
            break;
          }
          case 9: {
            for (h = Math.ceil(t / 4) * 4, l.push(-2); t++ < h; ) l.push(-1);
            break;
          }
          case 10: {
            l.push(-4), t = 1;
            break;
          }
          default:
            i = !0, t = 1;
        }
      f = d + 1;
    }
    return o && (i && l.push(-5), e && l.push(e), l.push(null)), l;
  }
}
function _q(t) {
  for (; !m4(t); )
    ;
  return t;
}
function w4(t, e) {
  const n = Number.parseInt(t, e);
  return (
    // C0 except for HT, LF, FF, CR, space.
    n < 9 || n === 11 || n > 13 && n < 32 || // Control character (DEL) of C0, and C1 controls.
    n > 126 && n < 160 || // Lone high surrogates and low surrogates.
    n > 55295 && n < 57344 || // Noncharacters.
    n > 64975 && n < 65008 || (n & 65535) === 65535 || (n & 65535) === 65534 || // Out of range
    n > 1114111 ? "�" : String.fromCharCode(n)
  );
}
const kq = /\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;
function Tq(t) {
  return t.replace(kq, wq);
}
function wq(t, e, n) {
  if (e)
    return e;
  if (n.charCodeAt(0) === 35) {
    const r = n.charCodeAt(1), s = r === 120 || r === 88;
    return w4(n.slice(s ? 2 : 1), s ? 16 : 10);
  }
  return l0(n) || t;
}
function kc(t) {
  return !t || typeof t != "object" ? "" : "position" in t || "type" in t ? S2(t.position) : "start" in t || "end" in t ? S2(t) : "line" in t || "column" in t ? m1(t) : "";
}
function m1(t) {
  return A2(t && t.line) + ":" + A2(t && t.column);
}
function S2(t) {
  return m1(t && t.start) + "-" + m1(t && t.end);
}
function A2(t) {
  return t && typeof t == "number" ? t : 1;
}
const v4 = {}.hasOwnProperty, E4 = (
  /**
   * @type {(
   *   ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &
   *   ((value: Value, options?: Options | null | undefined) => Root)
   * )}
   */
  /**
   * @param {Value} value
   * @param {Encoding | Options | null | undefined} [encoding]
   * @param {Options | null | undefined} [options]
   * @returns {Root}
   */
  function(t, e, n) {
    return typeof e != "string" && (n = e, e = void 0), vq(n)(
      _q(
        xq(n).document().write(bq()(t, e, !0))
      )
    );
  }
);
function vq(t) {
  const e = {
    transforms: [],
    canContainEols: ["emphasis", "fragment", "heading", "paragraph", "strong"],
    enter: {
      autolink: o($t),
      autolinkProtocol: g,
      autolinkEmail: g,
      atxHeading: o(wt),
      blockQuote: o(q),
      characterEscape: g,
      characterReference: g,
      codeFenced: o(G),
      codeFencedFenceInfo: l,
      codeFencedFenceMeta: l,
      codeIndented: o(G, l),
      codeText: o(U, l),
      codeTextData: g,
      data: g,
      codeFlowValue: g,
      definition: o(ht),
      definitionDestinationString: l,
      definitionLabelString: l,
      definitionTitleString: l,
      emphasis: o(Y),
      hardBreakEscape: o(J),
      hardBreakTrailing: o(J),
      htmlFlow: o(Ct, l),
      htmlFlowData: g,
      htmlText: o(Ct, l),
      htmlTextData: g,
      image: o(Tt),
      label: l,
      link: o($t),
      listItem: o(te),
      listItemValue: y,
      listOrdered: o(Rt, p),
      listUnordered: o(Rt),
      paragraph: o(mt),
      reference: X,
      referenceString: l,
      resourceDestinationString: l,
      resourceTitleString: l,
      setextHeading: o(wt),
      strong: o(pt),
      thematicBreak: o(ft)
    },
    exit: {
      atxHeading: h(),
      atxHeadingSequence: F,
      autolink: h(),
      autolinkEmail: Z,
      autolinkProtocol: W,
      blockQuote: h(),
      characterEscapeValue: I,
      characterReferenceMarkerHexadecimal: it,
      characterReferenceMarkerNumeric: it,
      characterReferenceValue: ot,
      codeFenced: h(v),
      codeFencedFence: T,
      codeFencedFenceInfo: m,
      codeFencedFenceMeta: _,
      codeFlowValue: I,
      codeIndented: h(A),
      codeText: h(B),
      codeTextData: I,
      data: I,
      definition: h(),
      definitionDestinationString: b,
      definitionLabelString: L,
      definitionTitleString: w,
      emphasis: h(),
      hardBreakEscape: h(P),
      hardBreakTrailing: h(P),
      htmlFlow: h(R),
      htmlFlowData: I,
      htmlText: h(M),
      htmlTextData: I,
      image: h(D),
      label: V,
      labelText: E,
      lineEnding: k,
      link: h(N),
      listItem: h(),
      listOrdered: h(),
      listUnordered: h(),
      paragraph: h(),
      referenceString: H,
      resourceDestinationString: nt,
      resourceTitleString: O,
      resource: ct,
      setextHeading: h(C),
      setextHeadingLineSequence: x,
      setextHeadingText: S,
      strong: h(),
      thematicBreak: h()
    }
  };
  C4(e, (t || {}).mdastExtensions || []);
  const n = {};
  return i;
  function i(j) {
    let $ = {
      type: "root",
      children: []
    };
    const et = {
      stack: [$],
      tokenStack: [],
      config: e,
      enter: u,
      exit: f,
      buffer: l,
      resume: d,
      setData: s,
      getData: a
    }, rt = [];
    let ut = -1;
    for (; ++ut < j.length; )
      if (j[ut][1].type === "listOrdered" || j[ut][1].type === "listUnordered")
        if (j[ut][0] === "enter")
          rt.push(ut);
        else {
          const Kt = rt.pop();
          ut = r(j, Kt, ut);
        }
    for (ut = -1; ++ut < j.length; ) {
      const Kt = e[j[ut][0]];
      v4.call(Kt, j[ut][1].type) && Kt[j[ut][1].type].call(
        Object.assign(
          {
            sliceSerialize: j[ut][2].sliceSerialize
          },
          et
        ),
        j[ut][1]
      );
    }
    if (et.tokenStack.length > 0) {
      const Kt = et.tokenStack[et.tokenStack.length - 1];
      (Kt[1] || L2).call(et, void 0, Kt[0]);
    }
    for ($.position = {
      start: Ir(
        j.length > 0 ? j[0][1].start : {
          line: 1,
          column: 1,
          offset: 0
        }
      ),
      end: Ir(
        j.length > 0 ? j[j.length - 2][1].end : {
          line: 1,
          column: 1,
          offset: 0
        }
      )
    }, ut = -1; ++ut < e.transforms.length; )
      $ = e.transforms[ut]($) || $;
    return $;
  }
  function r(j, $, et) {
    let rt = $ - 1, ut = -1, Kt = !1, Zt, Qt, Mt, ne;
    for (; ++rt <= et; ) {
      const Bt = j[rt];
      if (Bt[1].type === "listUnordered" || Bt[1].type === "listOrdered" || Bt[1].type === "blockQuote" ? (Bt[0] === "enter" ? ut++ : ut--, ne = void 0) : Bt[1].type === "lineEndingBlank" ? Bt[0] === "enter" && (Zt && !ne && !ut && !Mt && (Mt = rt), ne = void 0) : Bt[1].type === "linePrefix" || Bt[1].type === "listItemValue" || Bt[1].type === "listItemMarker" || Bt[1].type === "listItemPrefix" || Bt[1].type === "listItemPrefixWhitespace" || (ne = void 0), !ut && Bt[0] === "enter" && Bt[1].type === "listItemPrefix" || ut === -1 && Bt[0] === "exit" && (Bt[1].type === "listUnordered" || Bt[1].type === "listOrdered")) {
        if (Zt) {
          let Te = rt;
          for (Qt = void 0; Te--; ) {
            const ie = j[Te];
            if (ie[1].type === "lineEnding" || ie[1].type === "lineEndingBlank") {
              if (ie[0] === "exit") continue;
              Qt && (j[Qt][1].type = "lineEndingBlank", Kt = !0), ie[1].type = "lineEnding", Qt = Te;
            } else if (!(ie[1].type === "linePrefix" || ie[1].type === "blockQuotePrefix" || ie[1].type === "blockQuotePrefixWhitespace" || ie[1].type === "blockQuoteMarker" || ie[1].type === "listItemIndent")) break;
          }
          Mt && (!Qt || Mt < Qt) && (Zt._spread = !0), Zt.end = Object.assign(
            {},
            Qt ? j[Qt][1].start : Bt[1].end
          ), j.splice(Qt || rt, 0, ["exit", Zt, Bt[2]]), rt++, et++;
        }
        Bt[1].type === "listItemPrefix" && (Zt = {
          type: "listItem",
          _spread: !1,
          start: Object.assign({}, Bt[1].start),
          // @ts-expect-error: we’ll add `end` in a second.
          end: void 0
        }, j.splice(rt, 0, ["enter", Zt, Bt[2]]), rt++, et++, Mt = void 0, ne = !0);
      }
    }
    return j[$][1]._spread = Kt, et;
  }
  function s(j, $) {
    n[j] = $;
  }
  function a(j) {
    return n[j];
  }
  function o(j, $) {
    return et;
    function et(rt) {
      u.call(this, j(rt), rt), $ && $.call(this, rt);
    }
  }
  function l() {
    this.stack.push({
      type: "fragment",
      children: []
    });
  }
  function u(j, $, et) {
    return this.stack[this.stack.length - 1].children.push(j), this.stack.push(j), this.tokenStack.push([$, et]), j.position = {
      start: Ir($.start)
    }, j;
  }
  function h(j) {
    return $;
    function $(et) {
      j && j.call(this, et), f.call(this, et);
    }
  }
  function f(j, $) {
    const et = this.stack.pop(), rt = this.tokenStack.pop();
    if (rt)
      rt[0].type !== j.type && ($ ? $.call(this, j, rt[0]) : (rt[1] || L2).call(this, j, rt[0]));
    else throw new Error(
      "Cannot close `" + j.type + "` (" + kc({
        start: j.start,
        end: j.end
      }) + "): it’s not open"
    );
    return et.position.end = Ir(j.end), et;
  }
  function d() {
    return wz(this.stack.pop());
  }
  function p() {
    s("expectingFirstListItemValue", !0);
  }
  function y(j) {
    if (a("expectingFirstListItemValue")) {
      const $ = this.stack[this.stack.length - 2];
      $.start = Number.parseInt(this.sliceSerialize(j), 10), s("expectingFirstListItemValue");
    }
  }
  function m() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.lang = j;
  }
  function _() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.meta = j;
  }
  function T() {
    a("flowCodeInside") || (this.buffer(), s("flowCodeInside", !0));
  }
  function v() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.value = j.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g, ""), s("flowCodeInside");
  }
  function A() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.value = j.replace(/(\r?\n|\r)$/g, "");
  }
  function L(j) {
    const $ = this.resume(), et = this.stack[this.stack.length - 1];
    et.label = $, et.identifier = ca(
      this.sliceSerialize(j)
    ).toLowerCase();
  }
  function w() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.title = j;
  }
  function b() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.url = j;
  }
  function F(j) {
    const $ = this.stack[this.stack.length - 1];
    if (!$.depth) {
      const et = this.sliceSerialize(j).length;
      $.depth = et;
    }
  }
  function S() {
    s("setextHeadingSlurpLineEnding", !0);
  }
  function x(j) {
    const $ = this.stack[this.stack.length - 1];
    $.depth = this.sliceSerialize(j).charCodeAt(0) === 61 ? 1 : 2;
  }
  function C() {
    s("setextHeadingSlurpLineEnding");
  }
  function g(j) {
    const $ = this.stack[this.stack.length - 1];
    let et = $.children[$.children.length - 1];
    (!et || et.type !== "text") && (et = dt(), et.position = {
      start: Ir(j.start)
    }, $.children.push(et)), this.stack.push(et);
  }
  function I(j) {
    const $ = this.stack.pop();
    $.value += this.sliceSerialize(j), $.position.end = Ir(j.end);
  }
  function k(j) {
    const $ = this.stack[this.stack.length - 1];
    if (a("atHardBreak")) {
      const et = $.children[$.children.length - 1];
      et.position.end = Ir(j.end), s("atHardBreak");
      return;
    }
    !a("setextHeadingSlurpLineEnding") && e.canContainEols.includes($.type) && (g.call(this, j), I.call(this, j));
  }
  function P() {
    s("atHardBreak", !0);
  }
  function R() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.value = j;
  }
  function M() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.value = j;
  }
  function B() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.value = j;
  }
  function N() {
    const j = this.stack[this.stack.length - 1];
    if (a("inReference")) {
      const $ = a("referenceType") || "shortcut";
      j.type += "Reference", j.referenceType = $, delete j.url, delete j.title;
    } else
      delete j.identifier, delete j.label;
    s("referenceType");
  }
  function D() {
    const j = this.stack[this.stack.length - 1];
    if (a("inReference")) {
      const $ = a("referenceType") || "shortcut";
      j.type += "Reference", j.referenceType = $, delete j.url, delete j.title;
    } else
      delete j.identifier, delete j.label;
    s("referenceType");
  }
  function E(j) {
    const $ = this.sliceSerialize(j), et = this.stack[this.stack.length - 2];
    et.label = Tq($), et.identifier = ca($).toLowerCase();
  }
  function V() {
    const j = this.stack[this.stack.length - 1], $ = this.resume(), et = this.stack[this.stack.length - 1];
    if (s("inReference", !0), et.type === "link") {
      const rt = j.children;
      et.children = rt;
    } else
      et.alt = $;
  }
  function nt() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.url = j;
  }
  function O() {
    const j = this.resume(), $ = this.stack[this.stack.length - 1];
    $.title = j;
  }
  function ct() {
    s("inReference");
  }
  function X() {
    s("referenceType", "collapsed");
  }
  function H(j) {
    const $ = this.resume(), et = this.stack[this.stack.length - 1];
    et.label = $, et.identifier = ca(
      this.sliceSerialize(j)
    ).toLowerCase(), s("referenceType", "full");
  }
  function it(j) {
    s("characterReferenceType", j.type);
  }
  function ot(j) {
    const $ = this.sliceSerialize(j), et = a("characterReferenceType");
    let rt;
    et ? (rt = w4(
      $,
      et === "characterReferenceMarkerNumeric" ? 10 : 16
    ), s("characterReferenceType")) : rt = l0($);
    const ut = this.stack.pop();
    ut.value += rt, ut.position.end = Ir(j.end);
  }
  function W(j) {
    I.call(this, j);
    const $ = this.stack[this.stack.length - 1];
    $.url = this.sliceSerialize(j);
  }
  function Z(j) {
    I.call(this, j);
    const $ = this.stack[this.stack.length - 1];
    $.url = "mailto:" + this.sliceSerialize(j);
  }
  function q() {
    return {
      type: "blockquote",
      children: []
    };
  }
  function G() {
    return {
      type: "code",
      lang: null,
      meta: null,
      value: ""
    };
  }
  function U() {
    return {
      type: "inlineCode",
      value: ""
    };
  }
  function ht() {
    return {
      type: "definition",
      identifier: "",
      label: null,
      title: null,
      url: ""
    };
  }
  function Y() {
    return {
      type: "emphasis",
      children: []
    };
  }
  function wt() {
    return {
      type: "heading",
      depth: void 0,
      children: []
    };
  }
  function J() {
    return {
      type: "break"
    };
  }
  function Ct() {
    return {
      type: "html",
      value: ""
    };
  }
  function Tt() {
    return {
      type: "image",
      title: null,
      url: "",
      alt: null
    };
  }
  function $t() {
    return {
      type: "link",
      title: null,
      url: "",
      children: []
    };
  }
  function Rt(j) {
    return {
      type: "list",
      ordered: j.type === "listOrdered",
      start: null,
      spread: j._spread,
      children: []
    };
  }
  function te(j) {
    return {
      type: "listItem",
      spread: j._spread,
      checked: null,
      children: []
    };
  }
  function mt() {
    return {
      type: "paragraph",
      children: []
    };
  }
  function pt() {
    return {
      type: "strong",
      children: []
    };
  }
  function dt() {
    return {
      type: "text",
      value: ""
    };
  }
  function ft() {
    return {
      type: "thematicBreak"
    };
  }
}
function Ir(t) {
  return {
    line: t.line,
    column: t.column,
    offset: t.offset
  };
}
function C4(t, e) {
  let n = -1;
  for (; ++n < e.length; ) {
    const i = e[n];
    Array.isArray(i) ? C4(t, i) : Eq(t, i);
  }
}
function Eq(t, e) {
  let n;
  for (n in e)
    if (v4.call(e, n)) {
      if (n === "canContainEols") {
        const i = e[n];
        i && t[n].push(...i);
      } else if (n === "transforms") {
        const i = e[n];
        i && t[n].push(...i);
      } else if (n === "enter" || n === "exit") {
        const i = e[n];
        i && Object.assign(t[n], i);
      }
    }
}
function L2(t, e) {
  throw t ? new Error(
    "Cannot close `" + t.type + "` (" + kc({
      start: t.start,
      end: t.end
    }) + "): a different token (`" + e.type + "`, " + kc({
      start: e.start,
      end: e.end
    }) + ") is open"
  ) : new Error(
    "Cannot close document, a token (`" + e.type + "`, " + kc({
      start: e.start,
      end: e.end
    }) + ") is still open"
  );
}
function Cq(t) {
  const e = t.replace(/\n{2,}/g, `
`);
  return Ry(e);
}
function Sq(t) {
  const e = Cq(t), { children: n } = E4(e), i = [[]];
  let r = 0;
  function s(a, o = "normal") {
    a.type === "text" ? a.value.split(`
`).forEach((u, h) => {
      h !== 0 && (r++, i.push([])), u.split(" ").forEach((f) => {
        f && i[r].push({ content: f, type: o });
      });
    }) : (a.type === "strong" || a.type === "emphasis") && a.children.forEach((l) => {
      s(l, a.type);
    });
  }
  return n.forEach((a) => {
    a.type === "paragraph" && a.children.forEach((o) => {
      s(o);
    });
  }), i;
}
function Aq(t) {
  const { children: e } = E4(t);
  function n(i) {
    return i.type === "text" ? i.value.replace(/\n/g, "<br/>") : i.type === "strong" ? `<strong>${i.children.map(n).join("")}</strong>` : i.type === "emphasis" ? `<em>${i.children.map(n).join("")}</em>` : i.type === "paragraph" ? `<p>${i.children.map(n).join("")}</p>` : `Unsupported markdown: ${i.type}`;
  }
  return e.map(n).join("");
}
function Lq(t) {
  return Intl.Segmenter ? [...new Intl.Segmenter().segment(t)].map((e) => e.segment) : [...t];
}
function Iq(t, e) {
  const n = Lq(e.content);
  return S4(t, [], n, e.type);
}
function S4(t, e, n, i) {
  if (n.length === 0)
    return [
      { content: e.join(""), type: i },
      { content: "", type: i }
    ];
  const [r, ...s] = n, a = [...e, r];
  return t([{ content: a.join(""), type: i }]) ? S4(t, a, s, i) : (e.length === 0 && r && (e.push(r), n.shift()), [
    { content: e.join(""), type: i },
    { content: n.join(""), type: i }
  ]);
}
function Bq(t, e) {
  if (t.some(({ content: n }) => n.includes(`
`)))
    throw new Error("splitLineToFitWidth does not support newlines in the line");
  return x1(t, e);
}
function x1(t, e, n = [], i = []) {
  if (t.length === 0)
    return i.length > 0 && n.push(i), n.length > 0 ? n : [];
  let r = "";
  t[0].content === " " && (r = " ", t.shift());
  const s = t.shift() ?? { content: " ", type: "normal" }, a = [...i];
  if (r !== "" && a.push({ content: r, type: "normal" }), a.push(s), e(a))
    return x1(t, e, n, a);
  if (i.length > 0)
    n.push(i), t.unshift(s);
  else if (s.content) {
    const [o, l] = Iq(e, s);
    n.push([o]), l.content && t.unshift(l);
  }
  return x1(t, e, n);
}
function Dq(t, e) {
  e && t.attr("style", e);
}
function Nq(t, e, n, i, r = !1) {
  const s = t.append("foreignObject"), a = s.append("xhtml:div"), o = e.label, l = e.isNode ? "nodeLabel" : "edgeLabel";
  a.html(
    `
    <span class="${l} ${i}" ` + (e.labelStyle ? 'style="' + e.labelStyle + '"' : "") + ">" + o + "</span>"
  ), Dq(a, e.labelStyle), a.style("display", "table-cell"), a.style("white-space", "nowrap"), a.style("max-width", n + "px"), a.attr("xmlns", "http://www.w3.org/1999/xhtml"), r && a.attr("class", "labelBkg");
  let u = a.node().getBoundingClientRect();
  return u.width === n && (a.style("display", "table"), a.style("white-space", "break-spaces"), a.style("width", n + "px"), u = a.node().getBoundingClientRect()), s.style("width", u.width), s.style("height", u.height), s.node();
}
function u0(t, e, n) {
  return t.append("tspan").attr("class", "text-outer-tspan").attr("x", 0).attr("y", e * n - 0.1 + "em").attr("dy", n + "em");
}
function Fq(t, e, n) {
  const i = t.append("text"), r = u0(i, 1, e);
  h0(r, n);
  const s = r.node().getComputedTextLength();
  return i.remove(), s;
}
function Oq(t, e, n) {
  var i;
  const r = t.append("text"), s = u0(r, 1, e);
  h0(s, [{ content: n, type: "normal" }]);
  const a = (i = s.node()) == null ? void 0 : i.getBoundingClientRect();
  return a && r.remove(), a;
}
function Rq(t, e, n, i = !1) {
  const s = e.append("g"), a = s.insert("rect").attr("class", "background"), o = s.append("text").attr("y", "-10.1");
  let l = 0;
  for (const u of n) {
    const h = (d) => Fq(s, 1.1, d) <= t, f = h(u) ? [u] : Bq(u, h);
    for (const d of f) {
      const p = u0(o, l, 1.1);
      h0(p, d), l++;
    }
  }
  if (i) {
    const u = o.node().getBBox(), h = 2;
    return a.attr("x", -h).attr("y", -h).attr("width", u.width + 2 * h).attr("height", u.height + 2 * h), s.node();
  } else
    return o.node();
}
function h0(t, e) {
  t.text(""), e.forEach((n, i) => {
    const r = t.append("tspan").attr("font-style", n.type === "emphasis" ? "italic" : "normal").attr("class", "text-inner-tspan").attr("font-weight", n.type === "strong" ? "bold" : "normal");
    i === 0 ? r.text(n.content) : r.text(" " + n.content);
  });
}
const bh = (t, e = "", {
  style: n = "",
  isTitle: i = !1,
  classes: r = "",
  useHtmlLabels: s = !0,
  isNode: a = !0,
  width: o = 200,
  addSvgBackground: l = !1
} = {}) => {
  if (z.info("createText", e, n, i, r, s, a, l), s) {
    const u = Aq(e), h = {
      isNode: a,
      label: Ko(u).replace(
        /fa[blrs]?:fa-[\w-]+/g,
        // cspell: disable-line
        (d) => `<i class='${d.replace(":", " ")}'></i>`
      ),
      labelStyle: n.replace("fill:", "color:")
    };
    return Nq(t, h, o, r, l);
  } else {
    const u = Sq(e);
    return Rq(o, t, u, l);
  }
}, Mq = (t, e, n, i) => {
  e.forEach((r) => {
    Gq[r](t, n, i);
  });
}, Pq = (t, e, n) => {
  z.trace("Making markers for ", n), t.append("defs").append("marker").attr("id", n + "_" + e + "-extensionStart").attr("class", "marker extension " + e).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), t.append("defs").append("marker").attr("id", n + "_" + e + "-extensionEnd").attr("class", "marker extension " + e).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z");
}, zq = (t, e, n) => {
  t.append("defs").append("marker").attr("id", n + "_" + e + "-compositionStart").attr("class", "marker composition " + e).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", n + "_" + e + "-compositionEnd").attr("class", "marker composition " + e).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
}, Vq = (t, e, n) => {
  t.append("defs").append("marker").attr("id", n + "_" + e + "-aggregationStart").attr("class", "marker aggregation " + e).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", n + "_" + e + "-aggregationEnd").attr("class", "marker aggregation " + e).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z");
}, qq = (t, e, n) => {
  t.append("defs").append("marker").attr("id", n + "_" + e + "-dependencyStart").attr("class", "marker dependency " + e).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", n + "_" + e + "-dependencyEnd").attr("class", "marker dependency " + e).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
}, $q = (t, e, n) => {
  t.append("defs").append("marker").attr("id", n + "_" + e + "-lollipopStart").attr("class", "marker lollipop " + e).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6), t.append("defs").append("marker").attr("id", n + "_" + e + "-lollipopEnd").attr("class", "marker lollipop " + e).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6);
}, Yq = (t, e, n) => {
  t.append("marker").attr("id", n + "_" + e + "-pointEnd").attr("class", "marker " + e).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), t.append("marker").attr("id", n + "_" + e + "-pointStart").attr("class", "marker " + e).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
}, Wq = (t, e, n) => {
  t.append("marker").attr("id", n + "_" + e + "-circleEnd").attr("class", "marker " + e).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), t.append("marker").attr("id", n + "_" + e + "-circleStart").attr("class", "marker " + e).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
}, Uq = (t, e, n) => {
  t.append("marker").attr("id", n + "_" + e + "-crossEnd").attr("class", "marker cross " + e).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), t.append("marker").attr("id", n + "_" + e + "-crossStart").attr("class", "marker cross " + e).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0");
}, Hq = (t, e, n) => {
  t.append("defs").append("marker").attr("id", n + "_" + e + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
}, Gq = {
  extension: Pq,
  composition: zq,
  aggregation: Vq,
  dependency: qq,
  lollipop: $q,
  point: Yq,
  circle: Wq,
  cross: Uq,
  barb: Hq
}, d0 = Mq;
function jq(t, e) {
  e && t.attr("style", e);
}
function Xq(t) {
  const e = yt(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), n = e.append("xhtml:div"), i = t.label, r = t.isNode ? "nodeLabel" : "edgeLabel";
  return n.html(
    '<span class="' + r + '" ' + (t.labelStyle ? 'style="' + t.labelStyle + '"' : "") + ">" + i + "</span>"
  ), jq(n, t.labelStyle), n.style("display", "inline-block"), n.style("white-space", "nowrap"), n.attr("xmlns", "http://www.w3.org/1999/xhtml"), e.node();
}
const Kq = (t, e, n, i) => {
  let r = t || "";
  if (typeof r == "object" && (r = r[0]), Ge(Q().flowchart.htmlLabels)) {
    r = r.replace(/\\n|\n/g, "<br />"), z.debug("vertexText" + r);
    const s = {
      isNode: i,
      label: Ko(r).replace(
        /fa[blrs]?:fa-[\w-]+/g,
        // cspell: disable-line
        (o) => `<i class='${o.replace(":", " ")}'></i>`
      ),
      labelStyle: e.replace("fill:", "color:")
    };
    return Xq(s);
  } else {
    const s = document.createElementNS("http://www.w3.org/2000/svg", "text");
    s.setAttribute("style", e.replace("color:", "fill:"));
    let a = [];
    typeof r == "string" ? a = r.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(r) ? a = r : a = [];
    for (const o of a) {
      const l = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
      l.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), l.setAttribute("dy", "1em"), l.setAttribute("x", "0"), n ? l.setAttribute("class", "title-row") : l.setAttribute("class", "row"), l.textContent = o.trim(), s.appendChild(l);
    }
    return s;
  }
}, Dn = Kq, Xe = async (t, e, n, i) => {
  let r;
  const s = e.useHtmlLabels || Ge(Q().flowchart.htmlLabels);
  n ? r = n : r = "node default";
  const a = t.insert("g").attr("class", r).attr("id", e.domId || e.id), o = a.insert("g").attr("class", "label").attr("style", e.labelStyle);
  let l;
  e.labelText === void 0 ? l = "" : l = typeof e.labelText == "string" ? e.labelText : e.labelText[0];
  const u = o.node();
  let h;
  e.labelType === "markdown" ? h = bh(o, Ne(Ko(l), Q()), {
    useHtmlLabels: s,
    width: e.width || Q().flowchart.wrappingWidth,
    classes: "markdown-node-label"
  }) : h = u.appendChild(
    Dn(
      Ne(Ko(l), Q()),
      e.labelStyle,
      !1,
      i
    )
  );
  let f = h.getBBox();
  const d = e.padding / 2;
  if (Ge(Q().flowchart.htmlLabels)) {
    const p = h.children[0], y = yt(h), m = p.getElementsByTagName("img");
    if (m) {
      const _ = l.replace(/<img[^>]*>/g, "").trim() === "";
      await Promise.all(
        [...m].map(
          (T) => new Promise((v) => {
            function A() {
              if (T.style.display = "flex", T.style.flexDirection = "column", _) {
                const L = Q().fontSize ? Q().fontSize : window.getComputedStyle(document.body).fontSize, b = parseInt(L, 10) * 5 + "px";
                T.style.minWidth = b, T.style.maxWidth = b;
              } else
                T.style.width = "100%";
              v(T);
            }
            setTimeout(() => {
              T.complete && A();
            }), T.addEventListener("error", A), T.addEventListener("load", A);
          })
        )
      );
    }
    f = p.getBoundingClientRect(), y.attr("width", f.width), y.attr("height", f.height);
  }
  return s ? o.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")") : o.attr("transform", "translate(0, " + -f.height / 2 + ")"), e.centerLabel && o.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), o.insert("rect", ":first-child"), { shapeSvg: a, bbox: f, halfPadding: d, label: o };
}, Ce = (t, e) => {
  const n = e.node().getBBox();
  t.width = n.width, t.height = n.height;
};
function Zi(t, e, n, i) {
  return t.insert("polygon", ":first-child").attr(
    "points",
    i.map(function(r) {
      return r.x + "," + r.y;
    }).join(" ")
  ).attr("class", "label-container").attr("transform", "translate(" + -e / 2 + "," + n / 2 + ")");
}
function Qq(t, e) {
  return t.intersect(e);
}
function A4(t, e, n, i) {
  var r = t.x, s = t.y, a = r - i.x, o = s - i.y, l = Math.sqrt(e * e * o * o + n * n * a * a), u = Math.abs(e * n * a / l);
  i.x < r && (u = -u);
  var h = Math.abs(e * n * o / l);
  return i.y < s && (h = -h), { x: r + u, y: s + h };
}
function Zq(t, e, n) {
  return A4(t, e, e, n);
}
function Jq(t, e, n, i) {
  var r, s, a, o, l, u, h, f, d, p, y, m, _, T, v;
  if (r = e.y - t.y, a = t.x - e.x, l = e.x * t.y - t.x * e.y, d = r * n.x + a * n.y + l, p = r * i.x + a * i.y + l, !(d !== 0 && p !== 0 && I2(d, p)) && (s = i.y - n.y, o = n.x - i.x, u = i.x * n.y - n.x * i.y, h = s * t.x + o * t.y + u, f = s * e.x + o * e.y + u, !(h !== 0 && f !== 0 && I2(h, f)) && (y = r * o - s * a, y !== 0)))
    return m = Math.abs(y / 2), _ = a * u - o * l, T = _ < 0 ? (_ - m) / y : (_ + m) / y, _ = s * l - r * u, v = _ < 0 ? (_ - m) / y : (_ + m) / y, { x: T, y: v };
}
function I2(t, e) {
  return t * e > 0;
}
function t$(t, e, n) {
  var i = t.x, r = t.y, s = [], a = Number.POSITIVE_INFINITY, o = Number.POSITIVE_INFINITY;
  typeof e.forEach == "function" ? e.forEach(function(y) {
    a = Math.min(a, y.x), o = Math.min(o, y.y);
  }) : (a = Math.min(a, e.x), o = Math.min(o, e.y));
  for (var l = i - t.width / 2 - a, u = r - t.height / 2 - o, h = 0; h < e.length; h++) {
    var f = e[h], d = e[h < e.length - 1 ? h + 1 : 0], p = Jq(
      t,
      n,
      { x: l + f.x, y: u + f.y },
      { x: l + d.x, y: u + d.y }
    );
    p && s.push(p);
  }
  return s.length ? (s.length > 1 && s.sort(function(y, m) {
    var _ = y.x - n.x, T = y.y - n.y, v = Math.sqrt(_ * _ + T * T), A = m.x - n.x, L = m.y - n.y, w = Math.sqrt(A * A + L * L);
    return v < w ? -1 : v === w ? 0 : 1;
  }), s[0]) : t;
}
const e$ = (t, e) => {
  var n = t.x, i = t.y, r = e.x - n, s = e.y - i, a = t.width / 2, o = t.height / 2, l, u;
  return Math.abs(s) * a > Math.abs(r) * o ? (s < 0 && (o = -o), l = s === 0 ? 0 : o * r / s, u = o) : (r < 0 && (a = -a), l = a, u = r === 0 ? 0 : a * s / r), { x: n + l, y: i + u };
}, Bl = e$, ve = {
  node: Qq,
  circle: Zq,
  ellipse: A4,
  polygon: t$,
  rect: Bl
}, n$ = async (t, e) => {
  e.useHtmlLabels || Q().flowchart.htmlLabels || (e.centerLabel = !0);
  const { shapeSvg: i, bbox: r, halfPadding: s } = await Xe(
    t,
    e,
    "node " + e.classes,
    !0
  );
  z.info("Classes = ", e.classes);
  const a = i.insert("rect", ":first-child");
  return a.attr("rx", e.rx).attr("ry", e.ry).attr("x", -r.width / 2 - s).attr("y", -r.height / 2 - s).attr("width", r.width + e.padding).attr("height", r.height + e.padding), Ce(e, a), e.intersect = function(o) {
    return ve.rect(e, o);
  }, i;
}, i$ = n$, r$ = (t) => {
  const e = /* @__PURE__ */ new Set();
  for (const n of t)
    switch (n) {
      case "x":
        e.add("right"), e.add("left");
        break;
      case "y":
        e.add("up"), e.add("down");
        break;
      default:
        e.add(n);
        break;
    }
  return e;
}, s$ = (t, e, n) => {
  const i = r$(t), r = 2, s = e.height + 2 * n.padding, a = s / r, o = e.width + 2 * a + n.padding, l = n.padding / 2;
  return i.has("right") && i.has("left") && i.has("up") && i.has("down") ? [
    // Bottom
    { x: 0, y: 0 },
    { x: a, y: 0 },
    { x: o / 2, y: 2 * l },
    { x: o - a, y: 0 },
    { x: o, y: 0 },
    // Right
    { x: o, y: -s / 3 },
    { x: o + 2 * l, y: -s / 2 },
    { x: o, y: -2 * s / 3 },
    { x: o, y: -s },
    // Top
    { x: o - a, y: -s },
    { x: o / 2, y: -s - 2 * l },
    { x: a, y: -s },
    // Left
    { x: 0, y: -s },
    { x: 0, y: -2 * s / 3 },
    { x: -2 * l, y: -s / 2 },
    { x: 0, y: -s / 3 }
  ] : i.has("right") && i.has("left") && i.has("up") ? [
    { x: a, y: 0 },
    { x: o - a, y: 0 },
    { x: o, y: -s / 2 },
    { x: o - a, y: -s },
    { x: a, y: -s },
    { x: 0, y: -s / 2 }
  ] : i.has("right") && i.has("left") && i.has("down") ? [
    { x: 0, y: 0 },
    { x: a, y: -s },
    { x: o - a, y: -s },
    { x: o, y: 0 }
  ] : i.has("right") && i.has("up") && i.has("down") ? [
    { x: 0, y: 0 },
    { x: o, y: -a },
    { x: o, y: -s + a },
    { x: 0, y: -s }
  ] : i.has("left") && i.has("up") && i.has("down") ? [
    { x: o, y: 0 },
    { x: 0, y: -a },
    { x: 0, y: -s + a },
    { x: o, y: -s }
  ] : i.has("right") && i.has("left") ? [
    { x: a, y: 0 },
    { x: a, y: -l },
    { x: o - a, y: -l },
    { x: o - a, y: 0 },
    { x: o, y: -s / 2 },
    { x: o - a, y: -s },
    { x: o - a, y: -s + l },
    { x: a, y: -s + l },
    { x: a, y: -s },
    { x: 0, y: -s / 2 }
  ] : i.has("up") && i.has("down") ? [
    // Bottom center
    { x: o / 2, y: 0 },
    // Left pont of bottom arrow
    { x: 0, y: -l },
    { x: a, y: -l },
    // Left top over vertical section
    { x: a, y: -s + l },
    { x: 0, y: -s + l },
    // Top of arrow
    { x: o / 2, y: -s },
    { x: o, y: -s + l },
    // Top of right vertical bar
    { x: o - a, y: -s + l },
    { x: o - a, y: -l },
    { x: o, y: -l }
  ] : i.has("right") && i.has("up") ? [
    { x: 0, y: 0 },
    { x: o, y: -a },
    { x: 0, y: -s }
  ] : i.has("right") && i.has("down") ? [
    { x: 0, y: 0 },
    { x: o, y: 0 },
    { x: 0, y: -s }
  ] : i.has("left") && i.has("up") ? [
    { x: o, y: 0 },
    { x: 0, y: -a },
    { x: o, y: -s }
  ] : i.has("left") && i.has("down") ? [
    { x: o, y: 0 },
    { x: 0, y: 0 },
    { x: o, y: -s }
  ] : i.has("right") ? [
    { x: a, y: -l },
    { x: a, y: -l },
    { x: o - a, y: -l },
    { x: o - a, y: 0 },
    { x: o, y: -s / 2 },
    { x: o - a, y: -s },
    { x: o - a, y: -s + l },
    // top left corner of arrow
    { x: a, y: -s + l },
    { x: a, y: -s + l }
  ] : i.has("left") ? [
    { x: a, y: 0 },
    { x: a, y: -l },
    // Two points, the right corners
    { x: o - a, y: -l },
    { x: o - a, y: -s + l },
    { x: a, y: -s + l },
    { x: a, y: -s },
    { x: 0, y: -s / 2 }
  ] : i.has("up") ? [
    // Bottom center
    { x: a, y: -l },
    // Left top over vertical section
    { x: a, y: -s + l },
    { x: 0, y: -s + l },
    // Top of arrow
    { x: o / 2, y: -s },
    { x: o, y: -s + l },
    // Top of right vertical bar
    { x: o - a, y: -s + l },
    { x: o - a, y: -l }
  ] : i.has("down") ? [
    // Bottom center
    { x: o / 2, y: 0 },
    // Left pont of bottom arrow
    { x: 0, y: -l },
    { x: a, y: -l },
    // Left top over vertical section
    { x: a, y: -s + l },
    { x: o - a, y: -s + l },
    { x: o - a, y: -l },
    { x: o, y: -l }
  ] : [{ x: 0, y: 0 }];
}, B2 = (t) => t ? " " + t : "", Wn = (t, e) => `node default${B2(t.classes)} ${B2(
  t.class
)}`, D2 = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = i.height + e.padding, a = r + s, o = [
    { x: a / 2, y: 0 },
    { x: a, y: -a / 2 },
    { x: a / 2, y: -a },
    { x: 0, y: -a / 2 }
  ];
  z.info("Question main (Circle)");
  const l = Zi(n, a, a, o);
  return l.attr("style", e.style), Ce(e, l), e.intersect = function(u) {
    return z.warn("Intersect called"), ve.polygon(e, o, u);
  }, n;
}, a$ = (t, e) => {
  const n = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id), i = 28, r = [
    { x: 0, y: i / 2 },
    { x: i / 2, y: 0 },
    { x: 0, y: -i / 2 },
    { x: -i / 2, y: 0 }
  ];
  return n.insert("polygon", ":first-child").attr(
    "points",
    r.map(function(a) {
      return a.x + "," + a.y;
    }).join(" ")
  ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), e.width = 28, e.height = 28, e.intersect = function(a) {
    return ve.circle(e, 14, a);
  }, n;
}, o$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = 4, s = i.height + e.padding, a = s / r, o = i.width + 2 * a + e.padding, l = [
    { x: a, y: 0 },
    { x: o - a, y: 0 },
    { x: o, y: -s / 2 },
    { x: o - a, y: -s },
    { x: a, y: -s },
    { x: 0, y: -s / 2 }
  ], u = Zi(n, o, s, l);
  return u.attr("style", e.style), Ce(e, u), e.intersect = function(h) {
    return ve.polygon(e, l, h);
  }, n;
}, l$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(t, e, void 0, !0), r = 2, s = i.height + 2 * e.padding, a = s / r, o = i.width + 2 * a + e.padding, l = s$(e.directions, i, e), u = Zi(n, o, s, l);
  return u.attr("style", e.style), Ce(e, u), e.intersect = function(h) {
    return ve.polygon(e, l, h);
  }, n;
}, c$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = i.height + e.padding, a = [
    { x: -s / 2, y: 0 },
    { x: r, y: 0 },
    { x: r, y: -s },
    { x: -s / 2, y: -s },
    { x: 0, y: -s / 2 }
  ];
  return Zi(n, r, s, a).attr("style", e.style), e.width = r + s, e.height = s, e.intersect = function(l) {
    return ve.polygon(e, a, l);
  }, n;
}, u$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(t, e, Wn(e), !0), r = i.width + e.padding, s = i.height + e.padding, a = [
    { x: -2 * s / 6, y: 0 },
    { x: r - s / 6, y: 0 },
    { x: r + 2 * s / 6, y: -s },
    { x: s / 6, y: -s }
  ], o = Zi(n, r, s, a);
  return o.attr("style", e.style), Ce(e, o), e.intersect = function(l) {
    return ve.polygon(e, a, l);
  }, n;
}, h$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = i.height + e.padding, a = [
    { x: 2 * s / 6, y: 0 },
    { x: r + s / 6, y: 0 },
    { x: r - 2 * s / 6, y: -s },
    { x: -s / 6, y: -s }
  ], o = Zi(n, r, s, a);
  return o.attr("style", e.style), Ce(e, o), e.intersect = function(l) {
    return ve.polygon(e, a, l);
  }, n;
}, d$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = i.height + e.padding, a = [
    { x: -2 * s / 6, y: 0 },
    { x: r + 2 * s / 6, y: 0 },
    { x: r - s / 6, y: -s },
    { x: s / 6, y: -s }
  ], o = Zi(n, r, s, a);
  return o.attr("style", e.style), Ce(e, o), e.intersect = function(l) {
    return ve.polygon(e, a, l);
  }, n;
}, f$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = i.height + e.padding, a = [
    { x: s / 6, y: 0 },
    { x: r - s / 6, y: 0 },
    { x: r + 2 * s / 6, y: -s },
    { x: -2 * s / 6, y: -s }
  ], o = Zi(n, r, s, a);
  return o.attr("style", e.style), Ce(e, o), e.intersect = function(l) {
    return ve.polygon(e, a, l);
  }, n;
}, p$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = i.height + e.padding, a = [
    { x: 0, y: 0 },
    { x: r + s / 2, y: 0 },
    { x: r, y: -s / 2 },
    { x: r + s / 2, y: -s },
    { x: 0, y: -s }
  ], o = Zi(n, r, s, a);
  return o.attr("style", e.style), Ce(e, o), e.intersect = function(l) {
    return ve.polygon(e, a, l);
  }, n;
}, g$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = r / 2, a = s / (2.5 + r / 50), o = i.height + a + e.padding, l = "M 0," + a + " a " + s + "," + a + " 0,0,0 " + r + " 0 a " + s + "," + a + " 0,0,0 " + -r + " 0 l 0," + o + " a " + s + "," + a + " 0,0,0 " + r + " 0 l 0," + -o, u = n.attr("label-offset-y", a).insert("path", ":first-child").attr("style", e.style).attr("d", l).attr("transform", "translate(" + -r / 2 + "," + -(o / 2 + a) + ")");
  return Ce(e, u), e.intersect = function(h) {
    const f = ve.rect(e, h), d = f.x - e.x;
    if (s != 0 && (Math.abs(d) < e.width / 2 || Math.abs(d) == e.width / 2 && Math.abs(f.y - e.y) > e.height / 2 - a)) {
      let p = a * a * (1 - d * d / (s * s));
      p != 0 && (p = Math.sqrt(p)), p = a - p, h.y - e.y > 0 && (p = -p), f.y += p;
    }
    return f;
  }, n;
}, y$ = async (t, e) => {
  const { shapeSvg: n, bbox: i, halfPadding: r } = await Xe(
    t,
    e,
    "node " + e.classes + " " + e.class,
    !0
  ), s = n.insert("rect", ":first-child"), a = e.positioned ? e.width : i.width + e.padding, o = e.positioned ? e.height : i.height + e.padding, l = e.positioned ? -a / 2 : -i.width / 2 - r, u = e.positioned ? -o / 2 : -i.height / 2 - r;
  if (s.attr("class", "basic label-container").attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("x", l).attr("y", u).attr("width", a).attr("height", o), e.props) {
    const h = new Set(Object.keys(e.props));
    e.props.borders && (f0(s, e.props.borders, a, o), h.delete("borders")), h.forEach((f) => {
      z.warn(`Unknown node property ${f}`);
    });
  }
  return Ce(e, s), e.intersect = function(h) {
    return ve.rect(e, h);
  }, n;
}, m$ = async (t, e) => {
  const { shapeSvg: n, bbox: i, halfPadding: r } = await Xe(
    t,
    e,
    "node " + e.classes,
    !0
  ), s = n.insert("rect", ":first-child"), a = e.positioned ? e.width : i.width + e.padding, o = e.positioned ? e.height : i.height + e.padding, l = e.positioned ? -a / 2 : -i.width / 2 - r, u = e.positioned ? -o / 2 : -i.height / 2 - r;
  if (s.attr("class", "basic cluster composite label-container").attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("x", l).attr("y", u).attr("width", a).attr("height", o), e.props) {
    const h = new Set(Object.keys(e.props));
    e.props.borders && (f0(s, e.props.borders, a, o), h.delete("borders")), h.forEach((f) => {
      z.warn(`Unknown node property ${f}`);
    });
  }
  return Ce(e, s), e.intersect = function(h) {
    return ve.rect(e, h);
  }, n;
}, x$ = async (t, e) => {
  const { shapeSvg: n } = await Xe(t, e, "label", !0);
  z.trace("Classes = ", e.class);
  const i = n.insert("rect", ":first-child"), r = 0, s = 0;
  if (i.attr("width", r).attr("height", s), n.attr("class", "label edgeLabel"), e.props) {
    const a = new Set(Object.keys(e.props));
    e.props.borders && (f0(i, e.props.borders, r, s), a.delete("borders")), a.forEach((o) => {
      z.warn(`Unknown node property ${o}`);
    });
  }
  return Ce(e, i), e.intersect = function(a) {
    return ve.rect(e, a);
  }, n;
};
function f0(t, e, n, i) {
  const r = [], s = (o) => {
    r.push(o, 0);
  }, a = (o) => {
    r.push(0, o);
  };
  e.includes("t") ? (z.debug("add top border"), s(n)) : a(n), e.includes("r") ? (z.debug("add right border"), s(i)) : a(i), e.includes("b") ? (z.debug("add bottom border"), s(n)) : a(n), e.includes("l") ? (z.debug("add left border"), s(i)) : a(i), t.attr("stroke-dasharray", r.join(" "));
}
const b$ = (t, e) => {
  let n;
  e.classes ? n = "node " + e.classes : n = "node default";
  const i = t.insert("g").attr("class", n).attr("id", e.domId || e.id), r = i.insert("rect", ":first-child"), s = i.insert("line"), a = i.insert("g").attr("class", "label"), o = e.labelText.flat ? e.labelText.flat() : e.labelText;
  let l = "";
  typeof o == "object" ? l = o[0] : l = o, z.info("Label text abc79", l, o, typeof o == "object");
  const u = a.node().appendChild(Dn(l, e.labelStyle, !0, !0));
  let h = { width: 0, height: 0 };
  if (Ge(Q().flowchart.htmlLabels)) {
    const m = u.children[0], _ = yt(u);
    h = m.getBoundingClientRect(), _.attr("width", h.width), _.attr("height", h.height);
  }
  z.info("Text 2", o);
  const f = o.slice(1, o.length);
  let d = u.getBBox();
  const p = a.node().appendChild(
    Dn(f.join ? f.join("<br/>") : f, e.labelStyle, !0, !0)
  );
  if (Ge(Q().flowchart.htmlLabels)) {
    const m = p.children[0], _ = yt(p);
    h = m.getBoundingClientRect(), _.attr("width", h.width), _.attr("height", h.height);
  }
  const y = e.padding / 2;
  return yt(p).attr(
    "transform",
    "translate( " + // (titleBox.width - bbox.width) / 2 +
    (h.width > d.width ? 0 : (d.width - h.width) / 2) + ", " + (d.height + y + 5) + ")"
  ), yt(u).attr(
    "transform",
    "translate( " + // (titleBox.width - bbox.width) / 2 +
    (h.width < d.width ? 0 : -(d.width - h.width) / 2) + ", 0)"
  ), h = a.node().getBBox(), a.attr(
    "transform",
    "translate(" + -h.width / 2 + ", " + (-h.height / 2 - y + 3) + ")"
  ), r.attr("class", "outer title-state").attr("x", -h.width / 2 - y).attr("y", -h.height / 2 - y).attr("width", h.width + e.padding).attr("height", h.height + e.padding), s.attr("class", "divider").attr("x1", -h.width / 2 - y).attr("x2", h.width / 2 + y).attr("y1", -h.height / 2 - y + d.height + y).attr("y2", -h.height / 2 - y + d.height + y), Ce(e, r), e.intersect = function(m) {
    return ve.rect(e, m);
  }, i;
}, _$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.height + e.padding, s = i.width + r / 4 + e.padding, a = n.insert("rect", ":first-child").attr("style", e.style).attr("rx", r / 2).attr("ry", r / 2).attr("x", -s / 2).attr("y", -r / 2).attr("width", s).attr("height", r);
  return Ce(e, a), e.intersect = function(o) {
    return ve.rect(e, o);
  }, n;
}, k$ = async (t, e) => {
  const { shapeSvg: n, bbox: i, halfPadding: r } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), s = n.insert("circle", ":first-child");
  return s.attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("r", i.width / 2 + r).attr("width", i.width + e.padding).attr("height", i.height + e.padding), z.info("Circle main"), Ce(e, s), e.intersect = function(a) {
    return z.info("Circle intersect", e, i.width / 2 + r, a), ve.circle(e, i.width / 2 + r, a);
  }, n;
}, T$ = async (t, e) => {
  const { shapeSvg: n, bbox: i, halfPadding: r } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), s = 5, a = n.insert("g", ":first-child"), o = a.insert("circle"), l = a.insert("circle");
  return a.attr("class", e.class), o.attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("r", i.width / 2 + r + s).attr("width", i.width + e.padding + s * 2).attr("height", i.height + e.padding + s * 2), l.attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("r", i.width / 2 + r).attr("width", i.width + e.padding).attr("height", i.height + e.padding), z.info("DoubleCircle main"), Ce(e, o), e.intersect = function(u) {
    return z.info("DoubleCircle intersect", e, i.width / 2 + r + s, u), ve.circle(e, i.width / 2 + r + s, u);
  }, n;
}, w$ = async (t, e) => {
  const { shapeSvg: n, bbox: i } = await Xe(
    t,
    e,
    Wn(e),
    !0
  ), r = i.width + e.padding, s = i.height + e.padding, a = [
    { x: 0, y: 0 },
    { x: r, y: 0 },
    { x: r, y: -s },
    { x: 0, y: -s },
    { x: 0, y: 0 },
    { x: -8, y: 0 },
    { x: r + 8, y: 0 },
    { x: r + 8, y: -s },
    { x: -8, y: -s },
    { x: -8, y: 0 }
  ], o = Zi(n, r, s, a);
  return o.attr("style", e.style), Ce(e, o), e.intersect = function(l) {
    return ve.polygon(e, a, l);
  }, n;
}, v$ = (t, e) => {
  const n = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id), i = n.insert("circle", ":first-child");
  return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), Ce(e, i), e.intersect = function(r) {
    return ve.circle(e, 7, r);
  }, n;
}, N2 = (t, e, n) => {
  const i = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id);
  let r = 70, s = 10;
  n === "LR" && (r = 10, s = 70);
  const a = i.append("rect").attr("x", -1 * r / 2).attr("y", -1 * s / 2).attr("width", r).attr("height", s).attr("class", "fork-join");
  return Ce(e, a), e.height = e.height + e.padding / 2, e.width = e.width + e.padding / 2, e.intersect = function(o) {
    return ve.rect(e, o);
  }, i;
}, E$ = (t, e) => {
  const n = t.insert("g").attr("class", "node default").attr("id", e.domId || e.id), i = n.insert("circle", ":first-child"), r = n.insert("circle", ":first-child");
  return r.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), i.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), Ce(e, r), e.intersect = function(s) {
    return ve.circle(e, 7, s);
  }, n;
}, C$ = (t, e) => {
  const n = e.padding / 2, i = 4, r = 8;
  let s;
  e.classes ? s = "node " + e.classes : s = "node default";
  const a = t.insert("g").attr("class", s).attr("id", e.domId || e.id), o = a.insert("rect", ":first-child"), l = a.insert("line"), u = a.insert("line");
  let h = 0, f = i;
  const d = a.insert("g").attr("class", "label");
  let p = 0;
  const y = e.classData.annotations && e.classData.annotations[0], m = e.classData.annotations[0] ? "«" + e.classData.annotations[0] + "»" : "", _ = d.node().appendChild(Dn(m, e.labelStyle, !0, !0));
  let T = _.getBBox();
  if (Ge(Q().flowchart.htmlLabels)) {
    const S = _.children[0], x = yt(_);
    T = S.getBoundingClientRect(), x.attr("width", T.width), x.attr("height", T.height);
  }
  e.classData.annotations[0] && (f += T.height + i, h += T.width);
  let v = e.classData.label;
  e.classData.type !== void 0 && e.classData.type !== "" && (Q().flowchart.htmlLabels ? v += "&lt;" + e.classData.type + "&gt;" : v += "<" + e.classData.type + ">");
  const A = d.node().appendChild(Dn(v, e.labelStyle, !0, !0));
  yt(A).attr("class", "classTitle");
  let L = A.getBBox();
  if (Ge(Q().flowchart.htmlLabels)) {
    const S = A.children[0], x = yt(A);
    L = S.getBoundingClientRect(), x.attr("width", L.width), x.attr("height", L.height);
  }
  f += L.height + i, L.width > h && (h = L.width);
  const w = [];
  e.classData.members.forEach((S) => {
    const x = S.getDisplayDetails();
    let C = x.displayText;
    Q().flowchart.htmlLabels && (C = C.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
    const g = d.node().appendChild(
      Dn(
        C,
        x.cssStyle ? x.cssStyle : e.labelStyle,
        !0,
        !0
      )
    );
    let I = g.getBBox();
    if (Ge(Q().flowchart.htmlLabels)) {
      const k = g.children[0], P = yt(g);
      I = k.getBoundingClientRect(), P.attr("width", I.width), P.attr("height", I.height);
    }
    I.width > h && (h = I.width), f += I.height + i, w.push(g);
  }), f += r;
  const b = [];
  if (e.classData.methods.forEach((S) => {
    const x = S.getDisplayDetails();
    let C = x.displayText;
    Q().flowchart.htmlLabels && (C = C.replace(/</g, "&lt;").replace(/>/g, "&gt;"));
    const g = d.node().appendChild(
      Dn(
        C,
        x.cssStyle ? x.cssStyle : e.labelStyle,
        !0,
        !0
      )
    );
    let I = g.getBBox();
    if (Ge(Q().flowchart.htmlLabels)) {
      const k = g.children[0], P = yt(g);
      I = k.getBoundingClientRect(), P.attr("width", I.width), P.attr("height", I.height);
    }
    I.width > h && (h = I.width), f += I.height + i, b.push(g);
  }), f += r, y) {
    let S = (h - T.width) / 2;
    yt(_).attr(
      "transform",
      "translate( " + (-1 * h / 2 + S) + ", " + -1 * f / 2 + ")"
    ), p = T.height + i;
  }
  let F = (h - L.width) / 2;
  return yt(A).attr(
    "transform",
    "translate( " + (-1 * h / 2 + F) + ", " + (-1 * f / 2 + p) + ")"
  ), p += L.height + i, l.attr("class", "divider").attr("x1", -h / 2 - n).attr("x2", h / 2 + n).attr("y1", -f / 2 - n + r + p).attr("y2", -f / 2 - n + r + p), p += r, w.forEach((S) => {
    yt(S).attr(
      "transform",
      "translate( " + -h / 2 + ", " + (-1 * f / 2 + p + r / 2) + ")"
    );
    const x = S?.getBBox();
    p += (x?.height ?? 0) + i;
  }), p += r, u.attr("class", "divider").attr("x1", -h / 2 - n).attr("x2", h / 2 + n).attr("y1", -f / 2 - n + r + p).attr("y2", -f / 2 - n + r + p), p += r, b.forEach((S) => {
    yt(S).attr(
      "transform",
      "translate( " + -h / 2 + ", " + (-1 * f / 2 + p) + ")"
    );
    const x = S?.getBBox();
    p += (x?.height ?? 0) + i;
  }), o.attr("style", e.style).attr("class", "outer title-state").attr("x", -h / 2 - n).attr("y", -(f / 2) - n).attr("width", h + e.padding).attr("height", f + e.padding), Ce(e, o), e.intersect = function(S) {
    return ve.rect(e, S);
  }, a;
}, F2 = {
  rhombus: D2,
  composite: m$,
  question: D2,
  rect: y$,
  labelRect: x$,
  rectWithTitle: b$,
  choice: a$,
  circle: k$,
  doublecircle: T$,
  stadium: _$,
  hexagon: o$,
  block_arrow: l$,
  rect_left_inv_arrow: c$,
  lean_right: u$,
  lean_left: h$,
  trapezoid: d$,
  inv_trapezoid: f$,
  rect_right_inv_arrow: p$,
  cylinder: g$,
  start: v$,
  end: E$,
  note: i$,
  subroutine: w$,
  fork: N2,
  join: N2,
  class_box: C$
};
let ua = {};
const _h = async (t, e, n) => {
  let i, r;
  if (e.link) {
    let s;
    Q().securityLevel === "sandbox" ? s = "_top" : e.linkTarget && (s = e.linkTarget || "_blank"), i = t.insert("svg:a").attr("xlink:href", e.link).attr("target", s), r = await F2[e.shape](i, e, n);
  } else
    r = await F2[e.shape](t, e, n), i = r;
  return e.tooltip && r.attr("title", e.tooltip), e.class && r.attr("class", "node default " + e.class), i.attr("data-node", "true"), i.attr("data-id", e.id), ua[e.id] = i, e.haveCallback && ua[e.id].attr("class", ua[e.id].attr("class") + " clickable"), i;
}, S$ = (t, e) => {
  ua[e.id] = t;
}, A$ = () => {
  ua = {};
}, b1 = (t) => {
  const e = ua[t.id];
  z.trace(
    "Transforming node",
    t.diff,
    t,
    "translate(" + (t.x - t.width / 2 - 5) + ", " + t.width / 2 + ")"
  );
  const n = 8, i = t.diff || 0;
  return t.clusterNode ? e.attr(
    "transform",
    "translate(" + (t.x + i - t.width / 2) + ", " + (t.y - t.height / 2 - n) + ")"
  ) : e.attr("transform", "translate(" + t.x + ", " + t.y + ")"), i;
}, kh = ({
  flowchart: t
}) => {
  var e, n;
  const i = ((e = t?.subGraphTitleMargin) == null ? void 0 : e.top) ?? 0, r = ((n = t?.subGraphTitleMargin) == null ? void 0 : n.bottom) ?? 0, s = i + r;
  return {
    subGraphTitleTopMargin: i,
    subGraphTitleBottomMargin: r,
    subGraphTitleTotalMargin: s
  };
}, Br = {
  aggregation: 18,
  extension: 18,
  composition: 18,
  dependency: 6,
  lollipop: 13.5,
  arrow_point: 5.3
};
function Zl(t, e) {
  if (t === void 0 || e === void 0)
    return { angle: 0, deltaX: 0, deltaY: 0 };
  t = gu(t), e = gu(e);
  const [n, i] = [t.x, t.y], [r, s] = [e.x, e.y], a = r - n, o = s - i;
  return { angle: Math.atan(o / a), deltaX: a, deltaY: o };
}
const gu = (t) => Array.isArray(t) ? { x: t[0], y: t[1] } : t, L4 = (t) => ({
  x: function(e, n, i) {
    let r = 0;
    if (n === 0 && Object.hasOwn(Br, t.arrowTypeStart)) {
      const { angle: s, deltaX: a } = Zl(i[0], i[1]);
      r = Br[t.arrowTypeStart] * Math.cos(s) * (a >= 0 ? 1 : -1);
    } else if (n === i.length - 1 && Object.hasOwn(Br, t.arrowTypeEnd)) {
      const { angle: s, deltaX: a } = Zl(
        i[i.length - 1],
        i[i.length - 2]
      );
      r = Br[t.arrowTypeEnd] * Math.cos(s) * (a >= 0 ? 1 : -1);
    }
    return gu(e).x + r;
  },
  y: function(e, n, i) {
    let r = 0;
    if (n === 0 && Object.hasOwn(Br, t.arrowTypeStart)) {
      const { angle: s, deltaY: a } = Zl(i[0], i[1]);
      r = Br[t.arrowTypeStart] * Math.abs(Math.sin(s)) * (a >= 0 ? 1 : -1);
    } else if (n === i.length - 1 && Object.hasOwn(Br, t.arrowTypeEnd)) {
      const { angle: s, deltaY: a } = Zl(
        i[i.length - 1],
        i[i.length - 2]
      );
      r = Br[t.arrowTypeEnd] * Math.abs(Math.sin(s)) * (a >= 0 ? 1 : -1);
    }
    return gu(e).y + r;
  }
}), I4 = (t, e, n, i, r) => {
  e.arrowTypeStart && O2(t, "start", e.arrowTypeStart, n, i, r), e.arrowTypeEnd && O2(t, "end", e.arrowTypeEnd, n, i, r);
}, L$ = {
  arrow_cross: "cross",
  arrow_point: "point",
  arrow_barb: "barb",
  arrow_circle: "circle",
  aggregation: "aggregation",
  extension: "extension",
  composition: "composition",
  dependency: "dependency",
  lollipop: "lollipop"
}, O2 = (t, e, n, i, r, s) => {
  const a = L$[n];
  if (!a) {
    z.warn(`Unknown arrow type: ${n}`);
    return;
  }
  const o = e === "start" ? "Start" : "End";
  t.attr(`marker-${e}`, `url(${i}#${r}_${s}-${a}${o})`);
};
let yu = {}, nn = {};
const I$ = () => {
  yu = {}, nn = {};
}, p0 = (t, e) => {
  const n = Ge(Q().flowchart.htmlLabels), i = e.labelType === "markdown" ? bh(t, e.label, {
    style: e.labelStyle,
    useHtmlLabels: n,
    addSvgBackground: !0
  }) : Dn(e.label, e.labelStyle), r = t.insert("g").attr("class", "edgeLabel"), s = r.insert("g").attr("class", "label");
  s.node().appendChild(i);
  let a = i.getBBox();
  if (n) {
    const l = i.children[0], u = yt(i);
    a = l.getBoundingClientRect(), u.attr("width", a.width), u.attr("height", a.height);
  }
  s.attr("transform", "translate(" + -a.width / 2 + ", " + -a.height / 2 + ")"), yu[e.id] = r, e.width = a.width, e.height = a.height;
  let o;
  if (e.startLabelLeft) {
    const l = Dn(e.startLabelLeft, e.labelStyle), u = t.insert("g").attr("class", "edgeTerminals"), h = u.insert("g").attr("class", "inner");
    o = h.node().appendChild(l);
    const f = l.getBBox();
    h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), nn[e.id] || (nn[e.id] = {}), nn[e.id].startLeft = u, Jl(o, e.startLabelLeft);
  }
  if (e.startLabelRight) {
    const l = Dn(e.startLabelRight, e.labelStyle), u = t.insert("g").attr("class", "edgeTerminals"), h = u.insert("g").attr("class", "inner");
    o = u.node().appendChild(l), h.node().appendChild(l);
    const f = l.getBBox();
    h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), nn[e.id] || (nn[e.id] = {}), nn[e.id].startRight = u, Jl(o, e.startLabelRight);
  }
  if (e.endLabelLeft) {
    const l = Dn(e.endLabelLeft, e.labelStyle), u = t.insert("g").attr("class", "edgeTerminals"), h = u.insert("g").attr("class", "inner");
    o = h.node().appendChild(l);
    const f = l.getBBox();
    h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), u.node().appendChild(l), nn[e.id] || (nn[e.id] = {}), nn[e.id].endLeft = u, Jl(o, e.endLabelLeft);
  }
  if (e.endLabelRight) {
    const l = Dn(e.endLabelRight, e.labelStyle), u = t.insert("g").attr("class", "edgeTerminals"), h = u.insert("g").attr("class", "inner");
    o = h.node().appendChild(l);
    const f = l.getBBox();
    h.attr("transform", "translate(" + -f.width / 2 + ", " + -f.height / 2 + ")"), u.node().appendChild(l), nn[e.id] || (nn[e.id] = {}), nn[e.id].endRight = u, Jl(o, e.endLabelRight);
  }
  return i;
};
function Jl(t, e) {
  Q().flowchart.htmlLabels && t && (t.style.width = e.length * 9 + "px", t.style.height = "12px");
}
const B4 = (t, e) => {
  z.debug("Moving label abc88 ", t.id, t.label, yu[t.id], e);
  let n = e.updatedPath ? e.updatedPath : e.originalPath;
  const i = Q(), { subGraphTitleTotalMargin: r } = kh(i);
  if (t.label) {
    const s = yu[t.id];
    let a = t.x, o = t.y;
    if (n) {
      const l = Gt.calcLabelPosition(n);
      z.debug(
        "Moving label " + t.label + " from (",
        a,
        ",",
        o,
        ") to (",
        l.x,
        ",",
        l.y,
        ") abc88"
      ), e.updatedPath && (a = l.x, o = l.y);
    }
    s.attr("transform", `translate(${a}, ${o + r / 2})`);
  }
  if (t.startLabelLeft) {
    const s = nn[t.id].startLeft;
    let a = t.x, o = t.y;
    if (n) {
      const l = Gt.calcTerminalLabelPosition(t.arrowTypeStart ? 10 : 0, "start_left", n);
      a = l.x, o = l.y;
    }
    s.attr("transform", `translate(${a}, ${o})`);
  }
  if (t.startLabelRight) {
    const s = nn[t.id].startRight;
    let a = t.x, o = t.y;
    if (n) {
      const l = Gt.calcTerminalLabelPosition(
        t.arrowTypeStart ? 10 : 0,
        "start_right",
        n
      );
      a = l.x, o = l.y;
    }
    s.attr("transform", `translate(${a}, ${o})`);
  }
  if (t.endLabelLeft) {
    const s = nn[t.id].endLeft;
    let a = t.x, o = t.y;
    if (n) {
      const l = Gt.calcTerminalLabelPosition(t.arrowTypeEnd ? 10 : 0, "end_left", n);
      a = l.x, o = l.y;
    }
    s.attr("transform", `translate(${a}, ${o})`);
  }
  if (t.endLabelRight) {
    const s = nn[t.id].endRight;
    let a = t.x, o = t.y;
    if (n) {
      const l = Gt.calcTerminalLabelPosition(t.arrowTypeEnd ? 10 : 0, "end_right", n);
      a = l.x, o = l.y;
    }
    s.attr("transform", `translate(${a}, ${o})`);
  }
}, B$ = (t, e) => {
  const n = t.x, i = t.y, r = Math.abs(e.x - n), s = Math.abs(e.y - i), a = t.width / 2, o = t.height / 2;
  return r >= a || s >= o;
}, D$ = (t, e, n) => {
  z.debug(`intersection calc abc89:
  outsidePoint: ${JSON.stringify(e)}
  insidePoint : ${JSON.stringify(n)}
  node        : x:${t.x} y:${t.y} w:${t.width} h:${t.height}`);
  const i = t.x, r = t.y, s = Math.abs(i - n.x), a = t.width / 2;
  let o = n.x < e.x ? a - s : a + s;
  const l = t.height / 2, u = Math.abs(e.y - n.y), h = Math.abs(e.x - n.x);
  if (Math.abs(r - e.y) * a > Math.abs(i - e.x) * l) {
    let f = n.y < e.y ? e.y - l - r : r - l - e.y;
    o = h * f / u;
    const d = {
      x: n.x < e.x ? n.x + o : n.x - h + o,
      y: n.y < e.y ? n.y + u - f : n.y - u + f
    };
    return o === 0 && (d.x = e.x, d.y = e.y), h === 0 && (d.x = e.x), u === 0 && (d.y = e.y), z.debug(`abc89 topp/bott calc, Q ${u}, q ${f}, R ${h}, r ${o}`, d), d;
  } else {
    n.x < e.x ? o = e.x - a - i : o = i - a - e.x;
    let f = u * o / h, d = n.x < e.x ? n.x + h - o : n.x - h + o, p = n.y < e.y ? n.y + f : n.y - f;
    return z.debug(`sides calc abc89, Q ${u}, q ${f}, R ${h}, r ${o}`, { _x: d, _y: p }), o === 0 && (d = e.x, p = e.y), h === 0 && (d = e.x), u === 0 && (p = e.y), { x: d, y: p };
  }
}, R2 = (t, e) => {
  z.debug("abc88 cutPathAtIntersect", t, e);
  let n = [], i = t[0], r = !1;
  return t.forEach((s) => {
    if (!B$(e, s) && !r) {
      const a = D$(e, i, s);
      let o = !1;
      n.forEach((l) => {
        o = o || l.x === a.x && l.y === a.y;
      }), n.some((l) => l.x === a.x && l.y === a.y) || n.push(a), r = !0;
    } else
      i = s, r || n.push(s);
  }), n;
}, D4 = function(t, e, n, i, r, s, a) {
  let o = n.points;
  z.debug("abc88 InsertEdge: edge=", n, "e=", e);
  let l = !1;
  const u = s.node(e.v);
  var h = s.node(e.w);
  h?.intersect && u?.intersect && (o = o.slice(1, n.points.length - 1), o.unshift(u.intersect(o[0])), o.push(h.intersect(o[o.length - 1]))), n.toCluster && (z.debug("to cluster abc88", i[n.toCluster]), o = R2(n.points, i[n.toCluster].node), l = !0), n.fromCluster && (z.debug("from cluster abc88", i[n.fromCluster]), o = R2(o.reverse(), i[n.fromCluster].node).reverse(), l = !0);
  const f = o.filter((L) => !Number.isNaN(L.y));
  let d = Tl;
  n.curve && (r === "graph" || r === "flowchart") && (d = n.curve);
  const { x: p, y } = L4(n), m = Tr().x(p).y(y).curve(d);
  let _;
  switch (n.thickness) {
    case "normal":
      _ = "edge-thickness-normal";
      break;
    case "thick":
      _ = "edge-thickness-thick";
      break;
    case "invisible":
      _ = "edge-thickness-thick";
      break;
    default:
      _ = "";
  }
  switch (n.pattern) {
    case "solid":
      _ += " edge-pattern-solid";
      break;
    case "dotted":
      _ += " edge-pattern-dotted";
      break;
    case "dashed":
      _ += " edge-pattern-dashed";
      break;
  }
  const T = t.append("path").attr("d", m(f)).attr("id", n.id).attr("class", " " + _ + (n.classes ? " " + n.classes : "")).attr("style", n.style);
  let v = "";
  (Q().flowchart.arrowMarkerAbsolute || Q().state.arrowMarkerAbsolute) && (v = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, v = v.replace(/\(/g, "\\("), v = v.replace(/\)/g, "\\)")), I4(T, n, v, a, r);
  let A = {};
  return l && (A.updatedPath = o), A.originalPath = n.points, A;
};
let Ut = {}, Ti = {}, N4 = {};
const N$ = () => {
  Ti = {}, N4 = {}, Ut = {};
}, mu = (t, e) => (z.trace("In isDescendant", e, " ", t, " = ", Ti[e].includes(t)), !!Ti[e].includes(t)), F$ = (t, e) => (z.info("Descendants of ", e, " is ", Ti[e]), z.info("Edge is ", t), t.v === e || t.w === e ? !1 : Ti[e] ? Ti[e].includes(t.v) || mu(t.v, e) || mu(t.w, e) || Ti[e].includes(t.w) : (z.debug("Tilt, ", e, ",not in descendants"), !1)), F4 = (t, e, n, i) => {
  z.warn(
    "Copying children of ",
    t,
    "root",
    i,
    "data",
    e.node(t),
    i
  );
  const r = e.children(t) || [];
  t !== i && r.push(t), z.warn("Copying (nodes) clusterId", t, "nodes", r), r.forEach((s) => {
    if (e.children(s).length > 0)
      F4(s, e, n, i);
    else {
      const a = e.node(s);
      z.info("cp ", s, " to ", i, " with parent ", t), n.setNode(s, a), i !== e.parent(s) && (z.warn("Setting parent", s, e.parent(s)), n.setParent(s, e.parent(s))), t !== i && s !== t ? (z.debug("Setting parent", s, t), n.setParent(s, t)) : (z.info("In copy ", t, "root", i, "data", e.node(t), i), z.debug(
        "Not Setting parent for node=",
        s,
        "cluster!==rootId",
        t !== i,
        "node!==clusterId",
        s !== t
      ));
      const o = e.edges(s);
      z.debug("Copying Edges", o), o.forEach((l) => {
        z.info("Edge", l);
        const u = e.edge(l.v, l.w, l.name);
        z.info("Edge data", u, i);
        try {
          F$(l, i) ? (z.info("Copying as ", l.v, l.w, u, l.name), n.setEdge(l.v, l.w, u, l.name), z.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : z.info(
            "Skipping copy of edge ",
            l.v,
            "-->",
            l.w,
            " rootId: ",
            i,
            " clusterId:",
            t
          );
        } catch (h) {
          z.error(h);
        }
      });
    }
    z.debug("Removing node", s), e.removeNode(s);
  });
}, O4 = (t, e) => {
  const n = e.children(t);
  let i = [...n];
  for (const r of n)
    N4[r] = t, i = [...i, ...O4(r, e)];
  return i;
}, rl = (t, e) => {
  z.trace("Searching", t);
  const n = e.children(t);
  if (z.trace("Searching children of id ", t, n), n.length < 1)
    return z.trace("This is a valid node", t), t;
  for (const i of n) {
    const r = rl(i, e);
    if (r)
      return z.trace("Found replacement for", t, " => ", r), r;
  }
}, tc = (t) => !Ut[t] || !Ut[t].externalConnections ? t : Ut[t] ? Ut[t].id : t, O$ = (t, e) => {
  if (!t || e > 10) {
    z.debug("Opting out, no graph ");
    return;
  } else
    z.debug("Opting in, graph ");
  t.nodes().forEach(function(n) {
    t.children(n).length > 0 && (z.warn(
      "Cluster identified",
      n,
      " Replacement id in edges: ",
      rl(n, t)
    ), Ti[n] = O4(n, t), Ut[n] = { id: rl(n, t), clusterData: t.node(n) });
  }), t.nodes().forEach(function(n) {
    const i = t.children(n), r = t.edges();
    i.length > 0 ? (z.debug("Cluster identified", n, Ti), r.forEach((s) => {
      if (s.v !== n && s.w !== n) {
        const a = mu(s.v, n), o = mu(s.w, n);
        a ^ o && (z.warn("Edge: ", s, " leaves cluster ", n), z.warn("Descendants of XXX ", n, ": ", Ti[n]), Ut[n].externalConnections = !0);
      }
    })) : z.debug("Not a cluster ", n, Ti);
  });
  for (let n of Object.keys(Ut)) {
    const i = Ut[n].id, r = t.parent(i);
    r !== n && Ut[r] && !Ut[r].externalConnections && (Ut[n].id = r);
  }
  t.edges().forEach(function(n) {
    const i = t.edge(n);
    z.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), z.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(t.edge(n)));
    let r = n.v, s = n.w;
    if (z.warn(
      "Fix XXX",
      Ut,
      "ids:",
      n.v,
      n.w,
      "Translating: ",
      Ut[n.v],
      " --- ",
      Ut[n.w]
    ), Ut[n.v] && Ut[n.w] && Ut[n.v] === Ut[n.w]) {
      z.warn("Fixing and trixing link to self - removing XXX", n.v, n.w, n.name), z.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), r = tc(n.v), s = tc(n.w), t.removeEdge(n.v, n.w, n.name);
      const a = n.w + "---" + n.v;
      t.setNode(a, {
        domId: a,
        id: a,
        labelStyle: "",
        labelText: i.label,
        padding: 0,
        shape: "labelRect",
        style: ""
      });
      const o = structuredClone(i), l = structuredClone(i);
      o.label = "", o.arrowTypeEnd = "none", l.label = "", o.fromCluster = n.v, l.toCluster = n.v, t.setEdge(r, a, o, n.name + "-cyclic-special"), t.setEdge(a, s, l, n.name + "-cyclic-special");
    } else if (Ut[n.v] || Ut[n.w]) {
      if (z.warn("Fixing and trixing - removing XXX", n.v, n.w, n.name), r = tc(n.v), s = tc(n.w), t.removeEdge(n.v, n.w, n.name), r !== n.v) {
        const a = t.parent(r);
        Ut[a].externalConnections = !0, i.fromCluster = n.v;
      }
      if (s !== n.w) {
        const a = t.parent(s);
        Ut[a].externalConnections = !0, i.toCluster = n.w;
      }
      z.warn("Fix Replacing with XXX", r, s, n.name), t.setEdge(r, s, i, n.name);
    }
  }), z.warn("Adjusted Graph", dr(t)), R4(t, 0), z.trace(Ut);
}, R4 = (t, e) => {
  if (z.warn("extractor - ", e, dr(t), t.children("D")), e > 10) {
    z.error("Bailing out");
    return;
  }
  let n = t.nodes(), i = !1;
  for (const r of n) {
    const s = t.children(r);
    i = i || s.length > 0;
  }
  if (!i) {
    z.debug("Done, no node has children", t.nodes());
    return;
  }
  z.debug("Nodes = ", n, e);
  for (const r of n)
    if (z.debug(
      "Extracting node",
      r,
      Ut,
      Ut[r] && !Ut[r].externalConnections,
      !t.parent(r),
      t.node(r),
      t.children("D"),
      " Depth ",
      e
    ), !Ut[r])
      z.debug("Not a cluster", r, e);
    else if (!Ut[r].externalConnections && // !graph.parent(node) &&
    t.children(r) && t.children(r).length > 0) {
      z.warn(
        "Cluster without external connections, without a parent and with children",
        r,
        e
      );
      let a = t.graph().rankdir === "TB" ? "LR" : "TB";
      Ut[r] && Ut[r].clusterData && Ut[r].clusterData.dir && (a = Ut[r].clusterData.dir, z.warn("Fixing dir", Ut[r].clusterData.dir, a));
      const o = new qe({
        multigraph: !0,
        compound: !0
      }).setGraph({
        rankdir: a,
        // Todo: set proper spacing
        nodesep: 50,
        ranksep: 50,
        marginx: 8,
        marginy: 8
      }).setDefaultEdgeLabel(function() {
        return {};
      });
      z.warn("Old graph before copy", dr(t)), F4(r, t, o, r), t.setNode(r, {
        clusterNode: !0,
        id: r,
        clusterData: Ut[r].clusterData,
        labelText: Ut[r].labelText,
        graph: o
      }), z.warn("New graph after copy node: (", r, ")", dr(o)), z.debug("Old graph after copy", dr(t));
    } else
      z.warn(
        "Cluster ** ",
        r,
        " **not meeting the criteria !externalConnections:",
        !Ut[r].externalConnections,
        " no parent: ",
        !t.parent(r),
        " children ",
        t.children(r) && t.children(r).length > 0,
        t.children("D"),
        e
      ), z.debug(Ut);
  n = t.nodes(), z.warn("New list of nodes", n);
  for (const r of n) {
    const s = t.node(r);
    z.warn(" Now next level", r, s), s.clusterNode && R4(s.graph, e + 1);
  }
}, M4 = (t, e) => {
  if (e.length === 0)
    return [];
  let n = Object.assign(e);
  return e.forEach((i) => {
    const r = t.children(i), s = M4(t, r);
    n = [...n, ...s];
  }), n;
}, R$ = (t) => M4(t, t.children()), M$ = (t, e) => {
  z.info("Creating subgraph rect for ", e.id, e);
  const n = Q(), i = t.insert("g").attr("class", "cluster" + (e.class ? " " + e.class : "")).attr("id", e.id), r = i.insert("rect", ":first-child"), s = Ge(n.flowchart.htmlLabels), a = i.insert("g").attr("class", "cluster-label"), o = e.labelType === "markdown" ? bh(a, e.labelText, { style: e.labelStyle, useHtmlLabels: s }) : a.node().appendChild(Dn(e.labelText, e.labelStyle, void 0, !0));
  let l = o.getBBox();
  if (Ge(n.flowchart.htmlLabels)) {
    const y = o.children[0], m = yt(o);
    l = y.getBoundingClientRect(), m.attr("width", l.width), m.attr("height", l.height);
  }
  const u = 0 * e.padding, h = u / 2, f = e.width <= l.width + u ? l.width + u : e.width;
  e.width <= l.width + u ? e.diff = (l.width - e.width) / 2 - e.padding / 2 : e.diff = -e.padding / 2, z.trace("Data ", e, JSON.stringify(e)), r.attr("style", e.style).attr("rx", e.rx).attr("ry", e.ry).attr("x", e.x - f / 2).attr("y", e.y - e.height / 2 - h).attr("width", f).attr("height", e.height + u);
  const { subGraphTitleTopMargin: d } = kh(n);
  s ? a.attr(
    "transform",
    // This puts the label on top of the box instead of inside it
    `translate(${e.x - l.width / 2}, ${e.y - e.height / 2 + d})`
  ) : a.attr(
    "transform",
    // This puts the label on top of the box instead of inside it
    `translate(${e.x}, ${e.y - e.height / 2 + d})`
  );
  const p = r.node().getBBox();
  return e.width = p.width, e.height = p.height, e.intersect = function(y) {
    return Bl(e, y);
  }, i;
}, P$ = (t, e) => {
  const n = t.insert("g").attr("class", "note-cluster").attr("id", e.id), i = n.insert("rect", ":first-child"), r = 0 * e.padding, s = r / 2;
  i.attr("rx", e.rx).attr("ry", e.ry).attr("x", e.x - e.width / 2 - s).attr("y", e.y - e.height / 2 - s).attr("width", e.width + r).attr("height", e.height + r).attr("fill", "none");
  const a = i.node().getBBox();
  return e.width = a.width, e.height = a.height, e.intersect = function(o) {
    return Bl(e, o);
  }, n;
}, z$ = (t, e) => {
  const n = Q(), i = t.insert("g").attr("class", e.classes).attr("id", e.id), r = i.insert("rect", ":first-child"), s = i.insert("g").attr("class", "cluster-label"), a = i.append("rect"), o = s.node().appendChild(Dn(e.labelText, e.labelStyle, void 0, !0));
  let l = o.getBBox();
  if (Ge(n.flowchart.htmlLabels)) {
    const y = o.children[0], m = yt(o);
    l = y.getBoundingClientRect(), m.attr("width", l.width), m.attr("height", l.height);
  }
  l = o.getBBox();
  const u = 0 * e.padding, h = u / 2, f = e.width <= l.width + e.padding ? l.width + e.padding : e.width;
  e.width <= l.width + e.padding ? e.diff = (l.width + e.padding * 0 - e.width) / 2 : e.diff = -e.padding / 2, r.attr("class", "outer").attr("x", e.x - f / 2 - h).attr("y", e.y - e.height / 2 - h).attr("width", f + u).attr("height", e.height + u), a.attr("class", "inner").attr("x", e.x - f / 2 - h).attr("y", e.y - e.height / 2 - h + l.height - 1).attr("width", f + u).attr("height", e.height + u - l.height - 3);
  const { subGraphTitleTopMargin: d } = kh(n);
  s.attr(
    "transform",
    `translate(${e.x - l.width / 2}, ${e.y - e.height / 2 - e.padding / 3 + (Ge(n.flowchart.htmlLabels) ? 5 : 3) + d})`
  );
  const p = r.node().getBBox();
  return e.height = p.height, e.intersect = function(y) {
    return Bl(e, y);
  }, i;
}, V$ = (t, e) => {
  const n = t.insert("g").attr("class", e.classes).attr("id", e.id), i = n.insert("rect", ":first-child"), r = 0 * e.padding, s = r / 2;
  i.attr("class", "divider").attr("x", e.x - e.width / 2 - s).attr("y", e.y - e.height / 2).attr("width", e.width + r).attr("height", e.height + r);
  const a = i.node().getBBox();
  return e.width = a.width, e.height = a.height, e.diff = -e.padding / 2, e.intersect = function(o) {
    return Bl(e, o);
  }, n;
}, q$ = { rect: M$, roundedWithTitle: z$, noteGroup: P$, divider: V$ };
let P4 = {};
const $$ = (t, e) => {
  z.trace("Inserting cluster");
  const n = e.shape || "rect";
  P4[e.id] = q$[n](t, e);
}, Y$ = () => {
  P4 = {};
}, z4 = async (t, e, n, i, r, s) => {
  z.info("Graph in recursive render: XXX", dr(e), r);
  const a = e.graph().rankdir;
  z.trace("Dir in recursive render - dir:", a);
  const o = t.insert("g").attr("class", "root");
  e.nodes() ? z.info("Recursive render XXX", e.nodes()) : z.info("No nodes found for", e), e.edges().length > 0 && z.trace("Recursive edges", e.edge(e.edges()[0]));
  const l = o.insert("g").attr("class", "clusters"), u = o.insert("g").attr("class", "edgePaths"), h = o.insert("g").attr("class", "edgeLabels"), f = o.insert("g").attr("class", "nodes");
  await Promise.all(
    e.nodes().map(async function(y) {
      const m = e.node(y);
      if (r !== void 0) {
        const _ = JSON.parse(JSON.stringify(r.clusterData));
        z.info("Setting data for cluster XXX (", y, ") ", _, r), e.setNode(r.id, _), e.parent(y) || (z.trace("Setting parent", y, r.id), e.setParent(y, r.id, _));
      }
      if (z.info("(Insert) Node XXX" + y + ": " + JSON.stringify(e.node(y))), m && m.clusterNode) {
        z.info("Cluster identified", y, m.width, e.node(y));
        const _ = await z4(
          f,
          m.graph,
          n,
          i,
          e.node(y),
          s
        ), T = _.elem;
        Ce(m, T), m.diff = _.diff || 0, z.info("Node bounds (abc123)", y, m, m.width, m.x, m.y), S$(T, m), z.warn("Recursive render complete ", T, m);
      } else
        e.children(y).length > 0 ? (z.info("Cluster - the non recursive path XXX", y, m.id, m, e), z.info(rl(m.id, e)), Ut[m.id] = { id: rl(m.id, e), node: m }) : (z.info("Node - the non recursive path", y, m.id, m), await _h(f, e.node(y), a));
    })
  ), e.edges().forEach(function(y) {
    const m = e.edge(y.v, y.w, y.name);
    z.info("Edge " + y.v + " -> " + y.w + ": " + JSON.stringify(y)), z.info("Edge " + y.v + " -> " + y.w + ": ", y, " ", JSON.stringify(e.edge(y))), z.info("Fix", Ut, "ids:", y.v, y.w, "Translating: ", Ut[y.v], Ut[y.w]), p0(h, m);
  }), e.edges().forEach(function(y) {
    z.info("Edge " + y.v + " -> " + y.w + ": " + JSON.stringify(y));
  }), z.info("#############################################"), z.info("###                Layout                 ###"), z.info("#############################################"), z.info(e), Ha(e), z.info("Graph after layout:", dr(e));
  let d = 0;
  const { subGraphTitleTotalMargin: p } = kh(s);
  return R$(e).forEach(function(y) {
    const m = e.node(y);
    z.info("Position " + y + ": " + JSON.stringify(e.node(y))), z.info(
      "Position " + y + ": (" + m.x,
      "," + m.y,
      ") width: ",
      m.width,
      " height: ",
      m.height
    ), m && m.clusterNode ? (m.y += p, b1(m)) : e.children(y).length > 0 ? (m.height += p, $$(l, m), Ut[m.id].node = m) : (m.y += p / 2, b1(m));
  }), e.edges().forEach(function(y) {
    const m = e.edge(y);
    z.info("Edge " + y.v + " -> " + y.w + ": " + JSON.stringify(m), m), m.points.forEach((T) => T.y += p / 2);
    const _ = D4(u, y, m, Ut, n, e, i);
    B4(m, _);
  }), e.nodes().forEach(function(y) {
    const m = e.node(y);
    z.info(y, m.type, m.diff), m.type === "group" && (d = m.diff);
  }), { elem: o, diff: d };
}, g0 = async (t, e, n, i, r) => {
  d0(t, n, i, r), A$(), I$(), Y$(), N$(), z.warn("Graph at first:", JSON.stringify(dr(e))), O$(e), z.warn("Graph after:", JSON.stringify(dr(e)));
  const s = Q();
  await z4(t, e, i, r, void 0, s);
}, V4 = {}, W$ = function(t) {
  const e = Object.keys(t);
  for (const n of e)
    V4[n] = t[n];
}, q4 = async function(t, e, n, i, r, s) {
  const a = i.select(`[id="${n}"]`), o = Object.keys(t);
  for (const l of o) {
    const u = t[l];
    let h = "default";
    u.classes.length > 0 && (h = u.classes.join(" ")), h = h + " flowchart-label";
    const f = $n(u.styles);
    let d = u.text !== void 0 ? u.text : u.id, p;
    if (z.info("vertex", u, u.labelType), u.labelType === "markdown")
      z.info("vertex", u, u.labelType);
    else if (Ge(Q().flowchart.htmlLabels))
      p = r0(a, {
        label: d
      }).node(), p.parentNode.removeChild(p);
    else {
      const T = r.createElementNS("http://www.w3.org/2000/svg", "text");
      T.setAttribute("style", f.labelStyle.replace("color:", "fill:"));
      const v = d.split(bt.lineBreakRegex);
      for (const A of v) {
        const L = r.createElementNS("http://www.w3.org/2000/svg", "tspan");
        L.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), L.setAttribute("dy", "1em"), L.setAttribute("x", "1"), L.textContent = A, T.appendChild(L);
      }
      p = T;
    }
    let y = 0, m = "";
    switch (u.type) {
      case "round":
        y = 5, m = "rect";
        break;
      case "square":
        m = "rect";
        break;
      case "diamond":
        m = "question";
        break;
      case "hexagon":
        m = "hexagon";
        break;
      case "odd":
        m = "rect_left_inv_arrow";
        break;
      case "lean_right":
        m = "lean_right";
        break;
      case "lean_left":
        m = "lean_left";
        break;
      case "trapezoid":
        m = "trapezoid";
        break;
      case "inv_trapezoid":
        m = "inv_trapezoid";
        break;
      case "odd_right":
        m = "rect_left_inv_arrow";
        break;
      case "circle":
        m = "circle";
        break;
      case "ellipse":
        m = "ellipse";
        break;
      case "stadium":
        m = "stadium";
        break;
      case "subroutine":
        m = "subroutine";
        break;
      case "cylinder":
        m = "cylinder";
        break;
      case "group":
        m = "rect";
        break;
      case "doublecircle":
        m = "doublecircle";
        break;
      default:
        m = "rect";
    }
    const _ = await Ps(d, Q());
    e.setNode(u.id, {
      labelStyle: f.labelStyle,
      shape: m,
      labelText: _,
      labelType: u.labelType,
      rx: y,
      ry: y,
      class: h,
      style: f.style,
      id: u.id,
      link: u.link,
      linkTarget: u.linkTarget,
      tooltip: s.db.getTooltip(u.id) || "",
      domId: s.db.lookUpDomId(u.id),
      haveCallback: u.haveCallback,
      width: u.type === "group" ? 500 : void 0,
      dir: u.dir,
      type: u.type,
      props: u.props,
      padding: Q().flowchart.padding
    }), z.info("setNode", {
      labelStyle: f.labelStyle,
      labelType: u.labelType,
      shape: m,
      labelText: _,
      rx: y,
      ry: y,
      class: h,
      style: f.style,
      id: u.id,
      domId: s.db.lookUpDomId(u.id),
      width: u.type === "group" ? 500 : void 0,
      type: u.type,
      dir: u.dir,
      props: u.props,
      padding: Q().flowchart.padding
    });
  }
}, $4 = async function(t, e, n) {
  z.info("abc78 edges = ", t);
  let i = 0, r = {}, s, a;
  if (t.defaultStyle !== void 0) {
    const o = $n(t.defaultStyle);
    s = o.style, a = o.labelStyle;
  }
  for (const o of t) {
    i++;
    const l = "L-" + o.start + "-" + o.end;
    r[l] === void 0 ? (r[l] = 0, z.info("abc78 new entry", l, r[l])) : (r[l]++, z.info("abc78 new entry", l, r[l]));
    let u = l + "-" + r[l];
    z.info("abc78 new link id to be used is", l, u, r[l]);
    const h = "LS-" + o.start, f = "LE-" + o.end, d = { style: "", labelStyle: "" };
    switch (d.minlen = o.length || 1, o.type === "arrow_open" ? d.arrowhead = "none" : d.arrowhead = "normal", d.arrowTypeStart = "arrow_open", d.arrowTypeEnd = "arrow_open", o.type) {
      case "double_arrow_cross":
        d.arrowTypeStart = "arrow_cross";
      case "arrow_cross":
        d.arrowTypeEnd = "arrow_cross";
        break;
      case "double_arrow_point":
        d.arrowTypeStart = "arrow_point";
      case "arrow_point":
        d.arrowTypeEnd = "arrow_point";
        break;
      case "double_arrow_circle":
        d.arrowTypeStart = "arrow_circle";
      case "arrow_circle":
        d.arrowTypeEnd = "arrow_circle";
        break;
    }
    let p = "", y = "";
    switch (o.stroke) {
      case "normal":
        p = "fill:none;", s !== void 0 && (p = s), a !== void 0 && (y = a), d.thickness = "normal", d.pattern = "solid";
        break;
      case "dotted":
        d.thickness = "normal", d.pattern = "dotted", d.style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
        break;
      case "thick":
        d.thickness = "thick", d.pattern = "solid", d.style = "stroke-width: 3.5px;fill:none;";
        break;
      case "invisible":
        d.thickness = "invisible", d.pattern = "solid", d.style = "stroke-width: 0;fill:none;";
        break;
    }
    if (o.style !== void 0) {
      const m = $n(o.style);
      p = m.style, y = m.labelStyle;
    }
    d.style = d.style += p, d.labelStyle = d.labelStyle += y, o.interpolate !== void 0 ? d.curve = oi(o.interpolate, bn) : t.defaultInterpolate !== void 0 ? d.curve = oi(t.defaultInterpolate, bn) : d.curve = oi(V4.curve, bn), o.text === void 0 ? o.style !== void 0 && (d.arrowheadStyle = "fill: #333") : (d.arrowheadStyle = "fill: #333", d.labelpos = "c"), d.labelType = o.labelType, d.label = await Ps(o.text.replace(bt.lineBreakRegex, `
`), Q()), o.style === void 0 && (d.style = d.style || "stroke: #333; stroke-width: 1.5px;fill:none;"), d.labelStyle = d.labelStyle.replace("color:", "fill:"), d.id = u, d.classes = "flowchart-link " + h + " " + f, e.setEdge(o.start, o.end, d, i);
  }
}, U$ = function(t, e) {
  return e.db.getClasses();
}, H$ = async function(t, e, n, i) {
  z.info("Drawing flowchart");
  let r = i.db.getDirection();
  r === void 0 && (r = "TD");
  const { securityLevel: s, flowchart: a } = Q(), o = a.nodeSpacing || 50, l = a.rankSpacing || 50;
  let u;
  s === "sandbox" && (u = yt("#i" + e));
  const h = yt(s === "sandbox" ? u.nodes()[0].contentDocument.body : "body"), f = s === "sandbox" ? u.nodes()[0].contentDocument : document, d = new qe({
    multigraph: !0,
    compound: !0
  }).setGraph({
    rankdir: r,
    nodesep: o,
    ranksep: l,
    marginx: 0,
    marginy: 0
  }).setDefaultEdgeLabel(function() {
    return {};
  });
  let p;
  const y = i.db.getSubGraphs();
  z.info("Subgraphs - ", y);
  for (let w = y.length - 1; w >= 0; w--)
    p = y[w], z.info("Subgraph - ", p), i.db.addVertex(
      p.id,
      { text: p.title, type: p.labelType },
      "group",
      void 0,
      p.classes,
      p.dir
    );
  const m = i.db.getVertices(), _ = i.db.getEdges();
  z.info("Edges", _);
  let T = 0;
  for (T = y.length - 1; T >= 0; T--) {
    p = y[T], Qy("cluster").append("text");
    for (let w = 0; w < p.nodes.length; w++)
      z.info("Setting up subgraphs", p.nodes[w], p.id), d.setParent(p.nodes[w], p.id);
  }
  await q4(m, d, e, h, f, i), await $4(_, d);
  const v = h.select(`[id="${e}"]`), A = h.select("#" + e + " g");
  if (await g0(A, d, ["point", "circle", "cross"], "flowchart", e), Gt.insertTitle(v, "flowchartTitleText", a.titleTopMargin, i.db.getDiagramTitle()), Wr(d, v, a.diagramPadding, a.useMaxWidth), i.db.indexNodes("subGraph" + T), !a.htmlLabels) {
    const w = f.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
    for (const b of w) {
      const F = b.getBBox(), S = f.createElementNS("http://www.w3.org/2000/svg", "rect");
      S.setAttribute("rx", 0), S.setAttribute("ry", 0), S.setAttribute("width", F.width), S.setAttribute("height", F.height), b.insertBefore(S, b.firstChild);
    }
  }
  Object.keys(m).forEach(function(w) {
    const b = m[w];
    if (b.link) {
      const F = yt("#" + e + ' [id="' + w + '"]');
      if (F) {
        const S = f.createElementNS("http://www.w3.org/2000/svg", "a");
        S.setAttributeNS("http://www.w3.org/2000/svg", "class", b.classes.join(" ")), S.setAttributeNS("http://www.w3.org/2000/svg", "href", b.link), S.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener"), s === "sandbox" ? S.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top") : b.linkTarget && S.setAttributeNS("http://www.w3.org/2000/svg", "target", b.linkTarget);
        const x = F.insert(function() {
          return S;
        }, ":first-child"), C = F.select(".label-container");
        C && x.append(function() {
          return C.node();
        });
        const g = F.select(".label");
        g && x.append(function() {
          return g.node();
        });
      }
    }
  });
}, _1 = {
  setConf: W$,
  addVertices: q4,
  addEdges: $4,
  getClasses: U$,
  draw: H$
}, G$ = (t, e) => {
  const n = tx, i = n(t, "r"), r = n(t, "g"), s = n(t, "b");
  return cs(i, r, s, e);
}, j$ = (t) => `.label {
    font-family: ${t.fontFamily};
    color: ${t.nodeTextColor || t.textColor};
  }
  .cluster-label text {
    fill: ${t.titleColor};
  }
  .cluster-label span,p {
    color: ${t.titleColor};
  }

  .label text,span,p {
    fill: ${t.nodeTextColor || t.textColor};
    color: ${t.nodeTextColor || t.textColor};
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
    stroke-width: 1px;
  }
  .flowchart-label text {
    text-anchor: middle;
  }
  // .flowchart-label .text-outer-tspan {
  //   text-anchor: middle;
  // }
  // .flowchart-label .text-inner-tspan {
  //   text-anchor: start;
  // }

  .node .katex path {
    fill: #000;
    stroke: #000;
    stroke-width: 1px;
  }

  .node .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }

  .arrowheadPath {
    fill: ${t.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${t.lineColor};
    stroke-width: 2.0px;
  }

  .flowchart-link {
    stroke: ${t.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${t.edgeLabelBackground};
    rect {
      opacity: 0.5;
      background-color: ${t.edgeLabelBackground};
      fill: ${t.edgeLabelBackground};
    }
    text-align: center;
  }

  /* For html labels only */
  .labelBkg {
    background-color: ${G$(t.edgeLabelBackground, 0.5)};
    // background-color: 
  }

  .cluster rect {
    fill: ${t.clusterBkg};
    stroke: ${t.clusterBorder};
    stroke-width: 1px;
  }

  .cluster text {
    fill: ${t.titleColor};
  }

  .cluster span,p {
    color: ${t.titleColor};
  }
  /* .cluster div {
    color: ${t.titleColor};
  } */

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: ${t.fontFamily};
    font-size: 12px;
    background: ${t.tertiaryColor};
    border: 1px solid ${t.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .flowchartTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.textColor};
  }
`, Y4 = j$;
function W4(t, e, n) {
  const i = e.width, r = e.height, s = (i + r) * 0.9, a = [
    { x: s / 2, y: 0 },
    { x: s, y: -s / 2 },
    { x: s / 2, y: -s },
    { x: 0, y: -s / 2 }
  ], o = Cr(t, s, s, a);
  return n.intersect = function(l) {
    return Qi(n, a, l);
  }, o;
}
function U4(t, e, n) {
  const r = e.height, s = r / 4, a = e.width + 2 * s, o = [
    { x: s, y: 0 },
    { x: a - s, y: 0 },
    { x: a, y: -r / 2 },
    { x: a - s, y: -r },
    { x: s, y: -r },
    { x: 0, y: -r / 2 }
  ], l = Cr(t, a, r, o);
  return n.intersect = function(u) {
    return Qi(n, o, u);
  }, l;
}
function H4(t, e, n) {
  const i = e.width, r = e.height, s = [
    { x: -r / 2, y: 0 },
    { x: i, y: 0 },
    { x: i, y: -r },
    { x: -r / 2, y: -r },
    { x: 0, y: -r / 2 }
  ], a = Cr(t, i, r, s);
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function G4(t, e, n) {
  const i = e.width, r = e.height, s = [
    { x: -2 * r / 6, y: 0 },
    { x: i - r / 6, y: 0 },
    { x: i + 2 * r / 6, y: -r },
    { x: r / 6, y: -r }
  ], a = Cr(t, i, r, s);
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function j4(t, e, n) {
  const i = e.width, r = e.height, s = [
    { x: 2 * r / 6, y: 0 },
    { x: i + r / 6, y: 0 },
    { x: i - 2 * r / 6, y: -r },
    { x: -r / 6, y: -r }
  ], a = Cr(t, i, r, s);
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function X4(t, e, n) {
  const i = e.width, r = e.height, s = [
    { x: -2 * r / 6, y: 0 },
    { x: i + 2 * r / 6, y: 0 },
    { x: i - r / 6, y: -r },
    { x: r / 6, y: -r }
  ], a = Cr(t, i, r, s);
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function K4(t, e, n) {
  const i = e.width, r = e.height, s = [
    { x: r / 6, y: 0 },
    { x: i - r / 6, y: 0 },
    { x: i + 2 * r / 6, y: -r },
    { x: -2 * r / 6, y: -r }
  ], a = Cr(t, i, r, s);
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function Q4(t, e, n) {
  const i = e.width, r = e.height, s = [
    { x: 0, y: 0 },
    { x: i + r / 2, y: 0 },
    { x: i, y: -r / 2 },
    { x: i + r / 2, y: -r },
    { x: 0, y: -r }
  ], a = Cr(t, i, r, s);
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function Z4(t, e, n) {
  const i = e.height, r = e.width + i / 4, s = t.insert("rect", ":first-child").attr("rx", i / 2).attr("ry", i / 2).attr("x", -r / 2).attr("y", -i / 2).attr("width", r).attr("height", i);
  return n.intersect = function(a) {
    return a0(n, a);
  }, s;
}
function J4(t, e, n) {
  const i = e.width, r = e.height, s = [
    { x: 0, y: 0 },
    { x: i, y: 0 },
    { x: i, y: -r },
    { x: 0, y: -r },
    { x: 0, y: 0 },
    { x: -8, y: 0 },
    { x: i + 8, y: 0 },
    { x: i + 8, y: -r },
    { x: -8, y: -r },
    { x: -8, y: 0 }
  ], a = Cr(t, i, r, s);
  return n.intersect = function(o) {
    return Qi(n, s, o);
  }, a;
}
function t_(t, e, n) {
  const i = e.width, r = i / 2, s = r / (2.5 + i / 50), a = e.height + s, o = "M 0," + s + " a " + r + "," + s + " 0,0,0 " + i + " 0 a " + r + "," + s + " 0,0,0 " + -i + " 0 l 0," + a + " a " + r + "," + s + " 0,0,0 " + i + " 0 l 0," + -a, l = t.attr("label-offset-y", s).insert("path", ":first-child").attr("d", o).attr("transform", "translate(" + -i / 2 + "," + -(a / 2 + s) + ")");
  return n.intersect = function(u) {
    const h = a0(n, u), f = h.x - n.x;
    if (r != 0 && (Math.abs(f) < n.width / 2 || Math.abs(f) == n.width / 2 && Math.abs(h.y - n.y) > n.height / 2 - s)) {
      let d = s * s * (1 - f * f / (r * r));
      d != 0 && (d = Math.sqrt(d)), d = s - d, u.y - n.y > 0 && (d = -d), h.y += d;
    }
    return h;
  }, l;
}
function X$(t) {
  t.shapes().question = W4, t.shapes().hexagon = U4, t.shapes().stadium = Z4, t.shapes().subroutine = J4, t.shapes().cylinder = t_, t.shapes().rect_left_inv_arrow = H4, t.shapes().lean_right = G4, t.shapes().lean_left = j4, t.shapes().trapezoid = X4, t.shapes().inv_trapezoid = K4, t.shapes().rect_right_inv_arrow = Q4;
}
function K$(t) {
  t({ question: W4 }), t({ hexagon: U4 }), t({ stadium: Z4 }), t({ subroutine: J4 }), t({ cylinder: t_ }), t({ rect_left_inv_arrow: H4 }), t({ lean_right: G4 }), t({ lean_left: j4 }), t({ trapezoid: X4 }), t({ inv_trapezoid: K4 }), t({ rect_right_inv_arrow: Q4 });
}
function Cr(t, e, n, i) {
  return t.insert("polygon", ":first-child").attr(
    "points",
    i.map(function(r) {
      return r.x + "," + r.y;
    }).join(" ")
  ).attr("transform", "translate(" + -e / 2 + "," + n / 2 + ")");
}
const Q$ = {
  addToRender: X$,
  addToRenderV2: K$
}, e_ = {}, Z$ = function(t) {
  const e = Object.keys(t);
  for (const n of e)
    e_[n] = t[n];
}, n_ = async function(t, e, n, i, r, s) {
  const a = i ? i.select(`[id="${n}"]`) : yt(`[id="${n}"]`), o = r || document, l = Object.keys(t);
  for (const u of l) {
    const h = t[u];
    let f = "default";
    h.classes.length > 0 && (f = h.classes.join(" "));
    const d = $n(h.styles);
    let p = h.text !== void 0 ? h.text : h.id, y;
    if (Ge(Q().flowchart.htmlLabels)) {
      const T = {
        label: await Ps(
          p.replace(
            /fa[blrs]?:fa-[\w-]+/g,
            // cspell:disable-line
            (v) => `<i class='${v.replace(":", " ")}'></i>`
          ),
          Q()
        )
      };
      y = r0(a, T).node(), y.parentNode.removeChild(y);
    } else {
      const T = o.createElementNS("http://www.w3.org/2000/svg", "text");
      T.setAttribute("style", d.labelStyle.replace("color:", "fill:"));
      const v = p.split(bt.lineBreakRegex);
      for (const A of v) {
        const L = o.createElementNS("http://www.w3.org/2000/svg", "tspan");
        L.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), L.setAttribute("dy", "1em"), L.setAttribute("x", "1"), L.textContent = A, T.appendChild(L);
      }
      y = T;
    }
    let m = 0, _ = "";
    switch (h.type) {
      case "round":
        m = 5, _ = "rect";
        break;
      case "square":
        _ = "rect";
        break;
      case "diamond":
        _ = "question";
        break;
      case "hexagon":
        _ = "hexagon";
        break;
      case "odd":
        _ = "rect_left_inv_arrow";
        break;
      case "lean_right":
        _ = "lean_right";
        break;
      case "lean_left":
        _ = "lean_left";
        break;
      case "trapezoid":
        _ = "trapezoid";
        break;
      case "inv_trapezoid":
        _ = "inv_trapezoid";
        break;
      case "odd_right":
        _ = "rect_left_inv_arrow";
        break;
      case "circle":
        _ = "circle";
        break;
      case "ellipse":
        _ = "ellipse";
        break;
      case "stadium":
        _ = "stadium";
        break;
      case "subroutine":
        _ = "subroutine";
        break;
      case "cylinder":
        _ = "cylinder";
        break;
      case "group":
        _ = "rect";
        break;
      default:
        _ = "rect";
    }
    z.warn("Adding node", h.id, h.domId), e.setNode(s.db.lookUpDomId(h.id), {
      labelType: "svg",
      labelStyle: d.labelStyle,
      shape: _,
      label: y,
      rx: m,
      ry: m,
      class: f,
      style: d.style,
      id: s.db.lookUpDomId(h.id)
    });
  }
}, i_ = async function(t, e, n) {
  let i = 0, r, s;
  if (t.defaultStyle !== void 0) {
    const a = $n(t.defaultStyle);
    r = a.style, s = a.labelStyle;
  }
  for (const a of t) {
    i++;
    const o = "L-" + a.start + "-" + a.end, l = "LS-" + a.start, u = "LE-" + a.end, h = {};
    a.type === "arrow_open" ? h.arrowhead = "none" : h.arrowhead = "normal";
    let f = "", d = "";
    if (a.style !== void 0) {
      const p = $n(a.style);
      f = p.style, d = p.labelStyle;
    } else
      switch (a.stroke) {
        case "normal":
          f = "fill:none", r !== void 0 && (f = r), s !== void 0 && (d = s);
          break;
        case "dotted":
          f = "fill:none;stroke-width:2px;stroke-dasharray:3;";
          break;
        case "thick":
          f = " stroke-width: 3.5px;fill:none";
          break;
      }
    h.style = f, h.labelStyle = d, a.interpolate !== void 0 ? h.curve = oi(a.interpolate, bn) : t.defaultInterpolate !== void 0 ? h.curve = oi(t.defaultInterpolate, bn) : h.curve = oi(e_.curve, bn), a.text === void 0 ? a.style !== void 0 && (h.arrowheadStyle = "fill: #333") : (h.arrowheadStyle = "fill: #333", h.labelpos = "c", Ge(Q().flowchart.htmlLabels) ? (h.labelType = "html", h.label = `<span id="L-${o}" class="edgeLabel L-${l}' L-${u}" style="${h.labelStyle}">${await Ps(
      a.text.replace(
        /fa[blrs]?:fa-[\w-]+/g,
        // cspell:disable-line
        (p) => `<i class='${p.replace(":", " ")}'></i>`
      ),
      Q()
    )}</span>`) : (h.labelType = "text", h.label = a.text.replace(bt.lineBreakRegex, `
`), a.style === void 0 && (h.style = h.style || "stroke: #333; stroke-width: 1.5px;fill:none"), h.labelStyle = h.labelStyle.replace("color:", "fill:"))), h.id = o, h.class = l + " " + u, h.minlen = a.length || 1, e.setEdge(n.db.lookUpDomId(a.start), n.db.lookUpDomId(a.end), h, i);
  }
}, J$ = function(t, e) {
  return z.info("Extracting classes"), e.db.getClasses();
}, tY = async function(t, e, n, i) {
  z.info("Drawing flowchart");
  const { securityLevel: r, flowchart: s } = Q();
  let a;
  r === "sandbox" && (a = yt("#i" + e));
  const o = yt(r === "sandbox" ? a.nodes()[0].contentDocument.body : "body"), l = r === "sandbox" ? a.nodes()[0].contentDocument : document;
  let u = i.db.getDirection();
  u === void 0 && (u = "TD");
  const h = s.nodeSpacing || 50, f = s.rankSpacing || 50, d = new qe({
    multigraph: !0,
    compound: !0
  }).setGraph({
    rankdir: u,
    nodesep: h,
    ranksep: f,
    marginx: 8,
    marginy: 8
  }).setDefaultEdgeLabel(function() {
    return {};
  });
  let p;
  const y = i.db.getSubGraphs();
  for (let b = y.length - 1; b >= 0; b--)
    p = y[b], i.db.addVertex(p.id, p.title, "group", void 0, p.classes);
  const m = i.db.getVertices();
  z.warn("Get vertices", m);
  const _ = i.db.getEdges();
  let T = 0;
  for (T = y.length - 1; T >= 0; T--) {
    p = y[T], Qy("cluster").append("text");
    for (let b = 0; b < p.nodes.length; b++)
      z.warn(
        "Setting subgraph",
        p.nodes[b],
        i.db.lookUpDomId(p.nodes[b]),
        i.db.lookUpDomId(p.id)
      ), d.setParent(i.db.lookUpDomId(p.nodes[b]), i.db.lookUpDomId(p.id));
  }
  await n_(m, d, e, o, l, i), await i_(_, d, i);
  const v = new gz();
  Q$.addToRender(v), v.arrows().none = function(F, S, x, C) {
    const I = F.append("marker").attr("id", S).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 0 0 L 0 0 L 0 0 z");
    Ki(I, x[C + "Style"]);
  }, v.arrows().normal = function(F, S) {
    F.append("marker").attr("id", S).attr("viewBox", "0 0 10 10").attr("refX", 9).attr("refY", 5).attr("markerUnits", "strokeWidth").attr("markerWidth", 8).attr("markerHeight", 6).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowheadPath").style("stroke-width", 1).style("stroke-dasharray", "1,0");
  };
  const A = o.select(`[id="${e}"]`), L = o.select("#" + e + " g");
  for (v(L, d), L.selectAll("g.node").attr("title", function() {
    return i.db.getTooltip(this.id);
  }), i.db.indexNodes("subGraph" + T), T = 0; T < y.length; T++)
    if (p = y[T], p.title !== "undefined") {
      const b = l.querySelectorAll(
        "#" + e + ' [id="' + i.db.lookUpDomId(p.id) + '"] rect'
      ), F = l.querySelectorAll(
        "#" + e + ' [id="' + i.db.lookUpDomId(p.id) + '"]'
      ), S = b[0].x.baseVal.value, x = b[0].y.baseVal.value, C = b[0].width.baseVal.value, I = yt(F[0]).select(".label");
      I.attr("transform", `translate(${S + C / 2}, ${x + 14})`), I.attr("id", e + "Text");
      for (let k = 0; k < p.classes.length; k++)
        F[0].classList.add(p.classes[k]);
    }
  if (!s.htmlLabels) {
    const b = l.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
    for (const F of b) {
      const S = F.getBBox(), x = l.createElementNS("http://www.w3.org/2000/svg", "rect");
      x.setAttribute("rx", 0), x.setAttribute("ry", 0), x.setAttribute("width", S.width), x.setAttribute("height", S.height), F.insertBefore(x, F.firstChild);
    }
  }
  Wr(d, A, s.diagramPadding, s.useMaxWidth), Object.keys(m).forEach(function(b) {
    const F = m[b];
    if (F.link) {
      const S = o.select("#" + e + ' [id="' + i.db.lookUpDomId(b) + '"]');
      if (S) {
        const x = l.createElementNS("http://www.w3.org/2000/svg", "a");
        x.setAttributeNS("http://www.w3.org/2000/svg", "class", F.classes.join(" ")), x.setAttributeNS("http://www.w3.org/2000/svg", "href", F.link), x.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener"), r === "sandbox" ? x.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top") : F.linkTarget && x.setAttributeNS("http://www.w3.org/2000/svg", "target", F.linkTarget);
        const C = S.insert(function() {
          return x;
        }, ":first-child"), g = S.select(".label-container");
        g && C.append(function() {
          return g.node();
        });
        const I = S.select(".label");
        I && C.append(function() {
          return I.node();
        });
      }
    }
  });
}, eY = {
  setConf: Z$,
  addVertices: n_,
  addEdges: i_,
  getClasses: J$,
  draw: tY
}, nY = {
  parser: Yf,
  db: hs,
  renderer: _1,
  styles: Y4,
  init: (t) => {
    t.flowchart || (t.flowchart = {}), t.flowchart.arrowMarkerAbsolute = t.arrowMarkerAbsolute, eY.setConf(t.flowchart), hs.clear(), hs.setGen("gen-1");
  }
}, iY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: nY
}, Symbol.toStringTag, { value: "Module" })), rY = {
  parser: Yf,
  db: hs,
  renderer: _1,
  styles: Y4,
  init: (t) => {
    t.flowchart || (t.flowchart = {}), t.flowchart.arrowMarkerAbsolute = t.arrowMarkerAbsolute, uL({ flowchart: { arrowMarkerAbsolute: t.arrowMarkerAbsolute } }), _1.setConf(t.flowchart), hs.clear(), hs.setGen("gen-2");
  }
}, sY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: rY
}, Symbol.toStringTag, { value: "Module" })), aY = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
function oY(t) {
  return typeof t == "string" && aY.test(t);
}
const en = [];
for (let t = 0; t < 256; ++t)
  en.push((t + 256).toString(16).slice(1));
function lY(t, e = 0) {
  return en[t[e + 0]] + en[t[e + 1]] + en[t[e + 2]] + en[t[e + 3]] + "-" + en[t[e + 4]] + en[t[e + 5]] + "-" + en[t[e + 6]] + en[t[e + 7]] + "-" + en[t[e + 8]] + en[t[e + 9]] + "-" + en[t[e + 10]] + en[t[e + 11]] + en[t[e + 12]] + en[t[e + 13]] + en[t[e + 14]] + en[t[e + 15]];
}
function cY(t) {
  if (!oY(t))
    throw TypeError("Invalid UUID");
  let e;
  const n = new Uint8Array(16);
  return n[0] = (e = parseInt(t.slice(0, 8), 16)) >>> 24, n[1] = e >>> 16 & 255, n[2] = e >>> 8 & 255, n[3] = e & 255, n[4] = (e = parseInt(t.slice(9, 13), 16)) >>> 8, n[5] = e & 255, n[6] = (e = parseInt(t.slice(14, 18), 16)) >>> 8, n[7] = e & 255, n[8] = (e = parseInt(t.slice(19, 23), 16)) >>> 8, n[9] = e & 255, n[10] = (e = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, n[11] = e / 4294967296 & 255, n[12] = e >>> 24 & 255, n[13] = e >>> 16 & 255, n[14] = e >>> 8 & 255, n[15] = e & 255, n;
}
function uY(t) {
  t = unescape(encodeURIComponent(t));
  const e = [];
  for (let n = 0; n < t.length; ++n)
    e.push(t.charCodeAt(n));
  return e;
}
const hY = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", dY = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
function fY(t, e, n) {
  function i(r, s, a, o) {
    var l;
    if (typeof r == "string" && (r = uY(r)), typeof s == "string" && (s = cY(s)), ((l = s) === null || l === void 0 ? void 0 : l.length) !== 16)
      throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
    let u = new Uint8Array(16 + r.length);
    if (u.set(s), u.set(r, s.length), u = n(u), u[6] = u[6] & 15 | e, u[8] = u[8] & 63 | 128, a) {
      o = o || 0;
      for (let h = 0; h < 16; ++h)
        a[o + h] = u[h];
      return a;
    }
    return lY(u);
  }
  try {
    i.name = t;
  } catch {
  }
  return i.DNS = hY, i.URL = dY, i;
}
function pY(t, e, n, i) {
  switch (t) {
    case 0:
      return e & n ^ ~e & i;
    case 1:
      return e ^ n ^ i;
    case 2:
      return e & n ^ e & i ^ n & i;
    case 3:
      return e ^ n ^ i;
  }
}
function gd(t, e) {
  return t << e | t >>> 32 - e;
}
function gY(t) {
  const e = [1518500249, 1859775393, 2400959708, 3395469782], n = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
  if (typeof t == "string") {
    const a = unescape(encodeURIComponent(t));
    t = [];
    for (let o = 0; o < a.length; ++o)
      t.push(a.charCodeAt(o));
  } else Array.isArray(t) || (t = Array.prototype.slice.call(t));
  t.push(128);
  const i = t.length / 4 + 2, r = Math.ceil(i / 16), s = new Array(r);
  for (let a = 0; a < r; ++a) {
    const o = new Uint32Array(16);
    for (let l = 0; l < 16; ++l)
      o[l] = t[a * 64 + l * 4] << 24 | t[a * 64 + l * 4 + 1] << 16 | t[a * 64 + l * 4 + 2] << 8 | t[a * 64 + l * 4 + 3];
    s[a] = o;
  }
  s[r - 1][14] = (t.length - 1) * 8 / Math.pow(2, 32), s[r - 1][14] = Math.floor(s[r - 1][14]), s[r - 1][15] = (t.length - 1) * 8 & 4294967295;
  for (let a = 0; a < r; ++a) {
    const o = new Uint32Array(80);
    for (let p = 0; p < 16; ++p)
      o[p] = s[a][p];
    for (let p = 16; p < 80; ++p)
      o[p] = gd(o[p - 3] ^ o[p - 8] ^ o[p - 14] ^ o[p - 16], 1);
    let l = n[0], u = n[1], h = n[2], f = n[3], d = n[4];
    for (let p = 0; p < 80; ++p) {
      const y = Math.floor(p / 20), m = gd(l, 5) + pY(y, u, h, f) + d + e[y] + o[p] >>> 0;
      d = f, f = h, h = gd(u, 30) >>> 0, u = l, l = m;
    }
    n[0] = n[0] + l >>> 0, n[1] = n[1] + u >>> 0, n[2] = n[2] + h >>> 0, n[3] = n[3] + f >>> 0, n[4] = n[4] + d >>> 0;
  }
  return [n[0] >> 24 & 255, n[0] >> 16 & 255, n[0] >> 8 & 255, n[0] & 255, n[1] >> 24 & 255, n[1] >> 16 & 255, n[1] >> 8 & 255, n[1] & 255, n[2] >> 24 & 255, n[2] >> 16 & 255, n[2] >> 8 & 255, n[2] & 255, n[3] >> 24 & 255, n[3] >> 16 & 255, n[3] >> 8 & 255, n[3] & 255, n[4] >> 24 & 255, n[4] >> 16 & 255, n[4] >> 8 & 255, n[4] & 255];
}
const yY = fY("v5", 80, gY);
var k1 = (function() {
  var t = function(S, x, C, g) {
    for (C = C || {}, g = S.length; g--; C[S[g]] = x)
      ;
    return C;
  }, e = [6, 8, 10, 20, 22, 24, 26, 27, 28], n = [1, 10], i = [1, 11], r = [1, 12], s = [1, 13], a = [1, 14], o = [1, 15], l = [1, 21], u = [1, 22], h = [1, 23], f = [1, 24], d = [1, 25], p = [6, 8, 10, 13, 15, 18, 19, 20, 22, 24, 26, 27, 28, 41, 42, 43, 44, 45], y = [1, 34], m = [27, 28, 46, 47], _ = [41, 42, 43, 44, 45], T = [17, 34], v = [1, 54], A = [1, 53], L = [17, 34, 36, 38], w = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, ER_DIAGRAM: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, entityName: 11, relSpec: 12, ":": 13, role: 14, BLOCK_START: 15, attributes: 16, BLOCK_STOP: 17, SQS: 18, SQE: 19, title: 20, title_value: 21, acc_title: 22, acc_title_value: 23, acc_descr: 24, acc_descr_value: 25, acc_descr_multiline_value: 26, ALPHANUM: 27, ENTITY_NAME: 28, attribute: 29, attributeType: 30, attributeName: 31, attributeKeyTypeList: 32, attributeComment: 33, ATTRIBUTE_WORD: 34, attributeKeyType: 35, COMMA: 36, ATTRIBUTE_KEY: 37, COMMENT: 38, cardinality: 39, relType: 40, ZERO_OR_ONE: 41, ZERO_OR_MORE: 42, ONE_OR_MORE: 43, ONLY_ONE: 44, MD_PARENT: 45, NON_IDENTIFYING: 46, IDENTIFYING: 47, WORD: 48, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: ":", 15: "BLOCK_START", 17: "BLOCK_STOP", 18: "SQS", 19: "SQE", 20: "title", 21: "title_value", 22: "acc_title", 23: "acc_title_value", 24: "acc_descr", 25: "acc_descr_value", 26: "acc_descr_multiline_value", 27: "ALPHANUM", 28: "ENTITY_NAME", 34: "ATTRIBUTE_WORD", 36: "COMMA", 37: "ATTRIBUTE_KEY", 38: "COMMENT", 41: "ZERO_OR_ONE", 42: "ZERO_OR_MORE", 43: "ONE_OR_MORE", 44: "ONLY_ONE", 45: "MD_PARENT", 46: "NON_IDENTIFYING", 47: "IDENTIFYING", 48: "WORD" },
    productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 4], [9, 3], [9, 1], [9, 7], [9, 6], [9, 4], [9, 2], [9, 2], [9, 2], [9, 1], [11, 1], [11, 1], [16, 1], [16, 2], [29, 2], [29, 3], [29, 3], [29, 4], [30, 1], [31, 1], [32, 1], [32, 3], [35, 1], [33, 1], [12, 3], [39, 1], [39, 1], [39, 1], [39, 1], [39, 1], [40, 1], [40, 1], [14, 1], [14, 1], [14, 1]],
    performAction: function(x, C, g, I, k, P, R) {
      var M = P.length - 1;
      switch (k) {
        case 1:
          break;
        case 2:
          this.$ = [];
          break;
        case 3:
          P[M - 1].push(P[M]), this.$ = P[M - 1];
          break;
        case 4:
        case 5:
          this.$ = P[M];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          I.addEntity(P[M - 4]), I.addEntity(P[M - 2]), I.addRelationship(P[M - 4], P[M], P[M - 2], P[M - 3]);
          break;
        case 9:
          I.addEntity(P[M - 3]), I.addAttributes(P[M - 3], P[M - 1]);
          break;
        case 10:
          I.addEntity(P[M - 2]);
          break;
        case 11:
          I.addEntity(P[M]);
          break;
        case 12:
          I.addEntity(P[M - 6], P[M - 4]), I.addAttributes(P[M - 6], P[M - 1]);
          break;
        case 13:
          I.addEntity(P[M - 5], P[M - 3]);
          break;
        case 14:
          I.addEntity(P[M - 3], P[M - 1]);
          break;
        case 15:
        case 16:
          this.$ = P[M].trim(), I.setAccTitle(this.$);
          break;
        case 17:
        case 18:
          this.$ = P[M].trim(), I.setAccDescription(this.$);
          break;
        case 19:
        case 43:
          this.$ = P[M];
          break;
        case 20:
        case 41:
        case 42:
          this.$ = P[M].replace(/"/g, "");
          break;
        case 21:
        case 29:
          this.$ = [P[M]];
          break;
        case 22:
          P[M].push(P[M - 1]), this.$ = P[M];
          break;
        case 23:
          this.$ = { attributeType: P[M - 1], attributeName: P[M] };
          break;
        case 24:
          this.$ = { attributeType: P[M - 2], attributeName: P[M - 1], attributeKeyTypeList: P[M] };
          break;
        case 25:
          this.$ = { attributeType: P[M - 2], attributeName: P[M - 1], attributeComment: P[M] };
          break;
        case 26:
          this.$ = { attributeType: P[M - 3], attributeName: P[M - 2], attributeKeyTypeList: P[M - 1], attributeComment: P[M] };
          break;
        case 27:
        case 28:
        case 31:
          this.$ = P[M];
          break;
        case 30:
          P[M - 2].push(P[M]), this.$ = P[M - 2];
          break;
        case 32:
          this.$ = P[M].replace(/"/g, "");
          break;
        case 33:
          this.$ = { cardA: P[M], relType: P[M - 1], cardB: P[M - 2] };
          break;
        case 34:
          this.$ = I.Cardinality.ZERO_OR_ONE;
          break;
        case 35:
          this.$ = I.Cardinality.ZERO_OR_MORE;
          break;
        case 36:
          this.$ = I.Cardinality.ONE_OR_MORE;
          break;
        case 37:
          this.$ = I.Cardinality.ONLY_ONE;
          break;
        case 38:
          this.$ = I.Cardinality.MD_PARENT;
          break;
        case 39:
          this.$ = I.Identification.NON_IDENTIFYING;
          break;
        case 40:
          this.$ = I.Identification.IDENTIFYING;
          break;
      }
    },
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 20: n, 22: i, 24: r, 26: s, 27: a, 28: o }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 16, 11: 9, 20: n, 22: i, 24: r, 26: s, 27: a, 28: o }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 11], { 12: 17, 39: 20, 15: [1, 18], 18: [1, 19], 41: l, 42: u, 43: h, 44: f, 45: d }), { 21: [1, 26] }, { 23: [1, 27] }, { 25: [1, 28] }, t(e, [2, 18]), t(p, [2, 19]), t(p, [2, 20]), t(e, [2, 4]), { 11: 29, 27: a, 28: o }, { 16: 30, 17: [1, 31], 29: 32, 30: 33, 34: y }, { 11: 35, 27: a, 28: o }, { 40: 36, 46: [1, 37], 47: [1, 38] }, t(m, [2, 34]), t(m, [2, 35]), t(m, [2, 36]), t(m, [2, 37]), t(m, [2, 38]), t(e, [2, 15]), t(e, [2, 16]), t(e, [2, 17]), { 13: [1, 39] }, { 17: [1, 40] }, t(e, [2, 10]), { 16: 41, 17: [2, 21], 29: 32, 30: 33, 34: y }, { 31: 42, 34: [1, 43] }, { 34: [2, 27] }, { 19: [1, 44] }, { 39: 45, 41: l, 42: u, 43: h, 44: f, 45: d }, t(_, [2, 39]), t(_, [2, 40]), { 14: 46, 27: [1, 49], 28: [1, 48], 48: [1, 47] }, t(e, [2, 9]), { 17: [2, 22] }, t(T, [2, 23], { 32: 50, 33: 51, 35: 52, 37: v, 38: A }), t([17, 34, 37, 38], [2, 28]), t(e, [2, 14], { 15: [1, 55] }), t([27, 28], [2, 33]), t(e, [2, 8]), t(e, [2, 41]), t(e, [2, 42]), t(e, [2, 43]), t(T, [2, 24], { 33: 56, 36: [1, 57], 38: A }), t(T, [2, 25]), t(L, [2, 29]), t(T, [2, 32]), t(L, [2, 31]), { 16: 58, 17: [1, 59], 29: 32, 30: 33, 34: y }, t(T, [2, 26]), { 35: 60, 37: v }, { 17: [1, 61] }, t(e, [2, 13]), t(L, [2, 30]), t(e, [2, 12])],
    defaultActions: { 34: [2, 27], 41: [2, 22] },
    parseError: function(x, C) {
      if (C.recoverable)
        this.trace(x);
      else {
        var g = new Error(x);
        throw g.hash = C, g;
      }
    },
    parse: function(x) {
      var C = this, g = [0], I = [], k = [null], P = [], R = this.table, M = "", B = 0, N = 0, D = 2, E = 1, V = P.slice.call(arguments, 1), nt = Object.create(this.lexer), O = { yy: {} };
      for (var ct in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, ct) && (O.yy[ct] = this.yy[ct]);
      nt.setInput(x, O.yy), O.yy.lexer = nt, O.yy.parser = this, typeof nt.yylloc > "u" && (nt.yylloc = {});
      var X = nt.yylloc;
      P.push(X);
      var H = nt.options && nt.options.ranges;
      typeof O.yy.parseError == "function" ? this.parseError = O.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function it() {
        var Ct;
        return Ct = I.pop() || nt.lex() || E, typeof Ct != "number" && (Ct instanceof Array && (I = Ct, Ct = I.pop()), Ct = C.symbols_[Ct] || Ct), Ct;
      }
      for (var ot, W, Z, q, G = {}, U, ht, Y, wt; ; ) {
        if (W = g[g.length - 1], this.defaultActions[W] ? Z = this.defaultActions[W] : ((ot === null || typeof ot > "u") && (ot = it()), Z = R[W] && R[W][ot]), typeof Z > "u" || !Z.length || !Z[0]) {
          var J = "";
          wt = [];
          for (U in R[W])
            this.terminals_[U] && U > D && wt.push("'" + this.terminals_[U] + "'");
          nt.showPosition ? J = "Parse error on line " + (B + 1) + `:
` + nt.showPosition() + `
Expecting ` + wt.join(", ") + ", got '" + (this.terminals_[ot] || ot) + "'" : J = "Parse error on line " + (B + 1) + ": Unexpected " + (ot == E ? "end of input" : "'" + (this.terminals_[ot] || ot) + "'"), this.parseError(J, {
            text: nt.match,
            token: this.terminals_[ot] || ot,
            line: nt.yylineno,
            loc: X,
            expected: wt
          });
        }
        if (Z[0] instanceof Array && Z.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + W + ", token: " + ot);
        switch (Z[0]) {
          case 1:
            g.push(ot), k.push(nt.yytext), P.push(nt.yylloc), g.push(Z[1]), ot = null, N = nt.yyleng, M = nt.yytext, B = nt.yylineno, X = nt.yylloc;
            break;
          case 2:
            if (ht = this.productions_[Z[1]][1], G.$ = k[k.length - ht], G._$ = {
              first_line: P[P.length - (ht || 1)].first_line,
              last_line: P[P.length - 1].last_line,
              first_column: P[P.length - (ht || 1)].first_column,
              last_column: P[P.length - 1].last_column
            }, H && (G._$.range = [
              P[P.length - (ht || 1)].range[0],
              P[P.length - 1].range[1]
            ]), q = this.performAction.apply(G, [
              M,
              N,
              B,
              O.yy,
              Z[1],
              k,
              P
            ].concat(V)), typeof q < "u")
              return q;
            ht && (g = g.slice(0, -1 * ht * 2), k = k.slice(0, -1 * ht), P = P.slice(0, -1 * ht)), g.push(this.productions_[Z[1]][0]), k.push(G.$), P.push(G._$), Y = R[g[g.length - 2]][g[g.length - 1]], g.push(Y);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, b = /* @__PURE__ */ (function() {
    var S = {
      EOF: 1,
      parseError: function(C, g) {
        if (this.yy.parser)
          this.yy.parser.parseError(C, g);
        else
          throw new Error(C);
      },
      // resets the lexer, sets new input
      setInput: function(x, C) {
        return this.yy = C || this.yy || {}, this._input = x, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var x = this._input[0];
        this.yytext += x, this.yyleng++, this.offset++, this.match += x, this.matched += x;
        var C = x.match(/(?:\r\n?|\n).*/g);
        return C ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), x;
      },
      // unshifts one char (or a string) into the input
      unput: function(x) {
        var C = x.length, g = x.split(/(?:\r\n?|\n)/g);
        this._input = x + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - C), this.offset -= C;
        var I = 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), g.length - 1 && (this.yylineno -= g.length - 1);
        var k = 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: g ? (g.length === I.length ? this.yylloc.first_column : 0) + I[I.length - g.length].length - g[0].length : this.yylloc.first_column - C
        }, this.options.ranges && (this.yylloc.range = [k[0], k[0] + this.yyleng - C]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(x) {
        this.unput(this.match.slice(x));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var x = this.matched.substr(0, this.matched.length - this.match.length);
        return (x.length > 20 ? "..." : "") + x.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var x = this.match;
        return x.length < 20 && (x += this._input.substr(0, 20 - x.length)), (x.substr(0, 20) + (x.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var x = this.pastInput(), C = new Array(x.length + 1).join("-");
        return x + this.upcomingInput() + `
` + C + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(x, C) {
        var g, I, k;
        if (this.options.backtrack_lexer && (k = {
          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 && (k.yylloc.range = this.yylloc.range.slice(0))), I = x[0].match(/(?:\r\n?|\n).*/g), I && (this.yylineno += I.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: I ? I[I.length - 1].length - I[I.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + x[0].length
        }, this.yytext += x[0], this.match += x[0], this.matches = x, 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(x[0].length), this.matched += x[0], g = this.performAction.call(this, this.yy, this, C, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), g)
          return g;
        if (this._backtrack) {
          for (var P in k)
            this[P] = k[P];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var x, C, g, I;
        this._more || (this.yytext = "", this.match = "");
        for (var k = this._currentRules(), P = 0; P < k.length; P++)
          if (g = this._input.match(this.rules[k[P]]), g && (!C || g[0].length > C[0].length)) {
            if (C = g, I = P, this.options.backtrack_lexer) {
              if (x = this.test_match(g, k[P]), x !== !1)
                return x;
              if (this._backtrack) {
                C = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return C ? (x = this.test_match(C, k[I]), x !== !1 ? x : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var C = this.next();
        return C || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(C) {
        this.conditionStack.push(C);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var C = this.conditionStack.length - 1;
        return C > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(C) {
        return C = this.conditionStack.length - 1 - Math.abs(C || 0), C >= 0 ? this.conditionStack[C] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(C) {
        this.begin(C);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(C, g, I, k) {
        switch (I) {
          case 0:
            return this.begin("acc_title"), 22;
          case 1:
            return this.popState(), "acc_title_value";
          case 2:
            return this.begin("acc_descr"), 24;
          case 3:
            return this.popState(), "acc_descr_value";
          case 4:
            this.begin("acc_descr_multiline");
            break;
          case 5:
            this.popState();
            break;
          case 6:
            return "acc_descr_multiline_value";
          case 7:
            return 10;
          case 8:
            break;
          case 9:
            return 8;
          case 10:
            return 28;
          case 11:
            return 48;
          case 12:
            return 4;
          case 13:
            return this.begin("block"), 15;
          case 14:
            return 36;
          case 15:
            break;
          case 16:
            return 37;
          case 17:
            return 34;
          case 18:
            return 34;
          case 19:
            return 38;
          case 20:
            break;
          case 21:
            return this.popState(), 17;
          case 22:
            return g.yytext[0];
          case 23:
            return 18;
          case 24:
            return 19;
          case 25:
            return 41;
          case 26:
            return 43;
          case 27:
            return 43;
          case 28:
            return 43;
          case 29:
            return 41;
          case 30:
            return 41;
          case 31:
            return 42;
          case 32:
            return 42;
          case 33:
            return 42;
          case 34:
            return 42;
          case 35:
            return 42;
          case 36:
            return 43;
          case 37:
            return 42;
          case 38:
            return 43;
          case 39:
            return 44;
          case 40:
            return 44;
          case 41:
            return 44;
          case 42:
            return 44;
          case 43:
            return 41;
          case 44:
            return 42;
          case 45:
            return 43;
          case 46:
            return 45;
          case 47:
            return 46;
          case 48:
            return 47;
          case 49:
            return 47;
          case 50:
            return 46;
          case 51:
            return 46;
          case 52:
            return 46;
          case 53:
            return 27;
          case 54:
            return g.yytext[0];
          case 55:
            return 6;
        }
      },
      rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:,)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:(.*?)[~](.*?)*[~])/i, /^(?:[\*A-Za-z_][A-Za-z0-9\-_\[\]\(\)]*)/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i, /^(?:.)/i, /^(?:$)/i],
      conditions: { acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, block: { rules: [14, 15, 16, 17, 18, 19, 20, 21, 22], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 23, 24, 25, 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, 53, 54, 55], inclusive: !0 } }
    };
    return S;
  })();
  w.lexer = b;
  function F() {
    this.yy = {};
  }
  return F.prototype = w, w.Parser = F, new F();
})();
k1.parser = k1;
const mY = k1;
let Nr = {}, y0 = [];
const xY = {
  ZERO_OR_ONE: "ZERO_OR_ONE",
  ZERO_OR_MORE: "ZERO_OR_MORE",
  ONE_OR_MORE: "ONE_OR_MORE",
  ONLY_ONE: "ONLY_ONE",
  MD_PARENT: "MD_PARENT"
}, bY = {
  NON_IDENTIFYING: "NON_IDENTIFYING",
  IDENTIFYING: "IDENTIFYING"
}, r_ = function(t, e = void 0) {
  return Nr[t] === void 0 ? (Nr[t] = { attributes: [], alias: e }, z.info("Added new entity :", t)) : Nr[t] && !Nr[t].alias && e && (Nr[t].alias = e, z.info(`Add alias '${e}' to entity '${t}'`)), Nr[t];
}, _Y = () => Nr, kY = function(t, e) {
  let n = r_(t), i;
  for (i = e.length - 1; i >= 0; i--)
    n.attributes.push(e[i]), z.debug("Added attribute ", e[i].attributeName);
}, TY = function(t, e, n, i) {
  let r = {
    entityA: t,
    roleA: e,
    entityB: n,
    relSpec: i
  };
  y0.push(r), z.debug("Added new relationship :", r);
}, wY = () => y0, vY = function() {
  Nr = {}, y0 = [], fn();
}, EY = {
  Cardinality: xY,
  Identification: bY,
  getConfig: () => Q().er,
  addEntity: r_,
  addAttributes: kY,
  getEntities: _Y,
  addRelationship: TY,
  getRelationships: wY,
  clear: vY,
  setAccTitle: pn,
  getAccTitle: vn,
  setAccDescription: En,
  getAccDescription: Cn,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn
}, pi = {
  ONLY_ONE_START: "ONLY_ONE_START",
  ONLY_ONE_END: "ONLY_ONE_END",
  ZERO_OR_ONE_START: "ZERO_OR_ONE_START",
  ZERO_OR_ONE_END: "ZERO_OR_ONE_END",
  ONE_OR_MORE_START: "ONE_OR_MORE_START",
  ONE_OR_MORE_END: "ONE_OR_MORE_END",
  ZERO_OR_MORE_START: "ZERO_OR_MORE_START",
  ZERO_OR_MORE_END: "ZERO_OR_MORE_END",
  MD_PARENT_END: "MD_PARENT_END",
  MD_PARENT_START: "MD_PARENT_START"
}, CY = function(t, e) {
  let n;
  t.append("defs").append("marker").attr("id", pi.MD_PARENT_START).attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", pi.MD_PARENT_END).attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", pi.ONLY_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18 M15,0 L15,18"), t.append("defs").append("marker").attr("id", pi.ONLY_ONE_END).attr("refX", 18).attr("refY", 9).attr("markerWidth", 18).attr("markerHeight", 18).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,0 L3,18 M9,0 L9,18"), n = t.append("defs").append("marker").attr("id", pi.ZERO_OR_ONE_START).attr("refX", 0).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), n.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 21).attr("cy", 9).attr("r", 6), n.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M9,0 L9,18"), n = t.append("defs").append("marker").attr("id", pi.ZERO_OR_ONE_END).attr("refX", 30).attr("refY", 9).attr("markerWidth", 30).attr("markerHeight", 18).attr("orient", "auto"), n.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 9).attr("r", 6), n.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,0 L21,18"), t.append("defs").append("marker").attr("id", pi.ONE_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"), t.append("defs").append("marker").attr("id", pi.ONE_OR_MORE_END).attr("refX", 27).attr("refY", 18).attr("markerWidth", 45).attr("markerHeight", 36).attr("orient", "auto").append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18"), n = t.append("defs").append("marker").attr("id", pi.ZERO_OR_MORE_START).attr("refX", 18).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), n.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 48).attr("cy", 18).attr("r", 6), n.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M0,18 Q18,0 36,18 Q18,36 0,18"), n = t.append("defs").append("marker").attr("id", pi.ZERO_OR_MORE_END).attr("refX", 39).attr("refY", 18).attr("markerWidth", 57).attr("markerHeight", 36).attr("orient", "auto"), n.append("circle").attr("stroke", e.stroke).attr("fill", "white").attr("cx", 9).attr("cy", 18).attr("r", 6), n.append("path").attr("stroke", e.stroke).attr("fill", "none").attr("d", "M21,18 Q39,0 57,18 Q39,36 21,18");
}, gi = {
  ERMarkers: pi,
  insertMarkers: CY
}, SY = /[^\dA-Za-z](\W)*/g;
let We = {}, sl = /* @__PURE__ */ new Map();
const AY = function(t) {
  const e = Object.keys(t);
  for (const n of e)
    We[n] = t[n];
}, LY = (t, e, n) => {
  const i = We.entityPadding / 3, r = We.entityPadding / 3, s = We.fontSize * 0.85, a = e.node().getBBox(), o = [];
  let l = !1, u = !1, h = 0, f = 0, d = 0, p = 0, y = a.height + i * 2, m = 1;
  n.forEach((A) => {
    A.attributeKeyTypeList !== void 0 && A.attributeKeyTypeList.length > 0 && (l = !0), A.attributeComment !== void 0 && (u = !0);
  }), n.forEach((A) => {
    const L = `${e.node().id}-attr-${m}`;
    let w = 0;
    const b = So(A.attributeType), F = t.append("text").classed("er entityLabel", !0).attr("id", `${L}-type`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Q().fontFamily).style("font-size", s + "px").text(b), S = t.append("text").classed("er entityLabel", !0).attr("id", `${L}-name`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Q().fontFamily).style("font-size", s + "px").text(A.attributeName), x = {};
    x.tn = F, x.nn = S;
    const C = F.node().getBBox(), g = S.node().getBBox();
    if (h = Math.max(h, C.width), f = Math.max(f, g.width), w = Math.max(C.height, g.height), l) {
      const I = A.attributeKeyTypeList !== void 0 ? A.attributeKeyTypeList.join(",") : "", k = t.append("text").classed("er entityLabel", !0).attr("id", `${L}-key`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Q().fontFamily).style("font-size", s + "px").text(I);
      x.kn = k;
      const P = k.node().getBBox();
      d = Math.max(d, P.width), w = Math.max(w, P.height);
    }
    if (u) {
      const I = t.append("text").classed("er entityLabel", !0).attr("id", `${L}-comment`).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "left").style("font-family", Q().fontFamily).style("font-size", s + "px").text(A.attributeComment || "");
      x.cn = I;
      const k = I.node().getBBox();
      p = Math.max(p, k.width), w = Math.max(w, k.height);
    }
    x.height = w, o.push(x), y += w + i * 2, m += 1;
  });
  let _ = 4;
  l && (_ += 2), u && (_ += 2);
  const T = h + f + d + p, v = {
    width: Math.max(
      We.minEntityWidth,
      Math.max(
        a.width + We.entityPadding * 2,
        T + r * _
      )
    ),
    height: n.length > 0 ? y : Math.max(We.minEntityHeight, a.height + We.entityPadding * 2)
  };
  if (n.length > 0) {
    const A = Math.max(
      0,
      (v.width - T - r * _) / (_ / 2)
    );
    e.attr(
      "transform",
      "translate(" + v.width / 2 + "," + (i + a.height / 2) + ")"
    );
    let L = a.height + i * 2, w = "attributeBoxOdd";
    o.forEach((b) => {
      const F = L + i + b.height / 2;
      b.tn.attr("transform", "translate(" + r + "," + F + ")");
      const S = t.insert("rect", "#" + b.tn.node().id).classed(`er ${w}`, !0).attr("x", 0).attr("y", L).attr("width", h + r * 2 + A).attr("height", b.height + i * 2), x = parseFloat(S.attr("x")) + parseFloat(S.attr("width"));
      b.nn.attr(
        "transform",
        "translate(" + (x + r) + "," + F + ")"
      );
      const C = t.insert("rect", "#" + b.nn.node().id).classed(`er ${w}`, !0).attr("x", x).attr("y", L).attr("width", f + r * 2 + A).attr("height", b.height + i * 2);
      let g = parseFloat(C.attr("x")) + parseFloat(C.attr("width"));
      if (l) {
        b.kn.attr(
          "transform",
          "translate(" + (g + r) + "," + F + ")"
        );
        const I = t.insert("rect", "#" + b.kn.node().id).classed(`er ${w}`, !0).attr("x", g).attr("y", L).attr("width", d + r * 2 + A).attr("height", b.height + i * 2);
        g = parseFloat(I.attr("x")) + parseFloat(I.attr("width"));
      }
      u && (b.cn.attr(
        "transform",
        "translate(" + (g + r) + "," + F + ")"
      ), t.insert("rect", "#" + b.cn.node().id).classed(`er ${w}`, "true").attr("x", g).attr("y", L).attr("width", p + r * 2 + A).attr("height", b.height + i * 2)), L += b.height + i * 2, w = w === "attributeBoxOdd" ? "attributeBoxEven" : "attributeBoxOdd";
    });
  } else
    v.height = Math.max(We.minEntityHeight, y), e.attr("transform", "translate(" + v.width / 2 + "," + v.height / 2 + ")");
  return v;
}, IY = function(t, e, n) {
  const i = Object.keys(e);
  let r;
  return i.forEach(function(s) {
    const a = RY(s, "entity");
    sl.set(s, a);
    const o = t.append("g").attr("id", a);
    r = r === void 0 ? a : r;
    const l = "text-" + a, u = o.append("text").classed("er entityLabel", !0).attr("id", l).attr("x", 0).attr("y", 0).style("dominant-baseline", "middle").style("text-anchor", "middle").style("font-family", Q().fontFamily).style("font-size", We.fontSize + "px").text(e[s].alias ?? s), { width: h, height: f } = LY(
      o,
      u,
      e[s].attributes
    ), p = o.insert("rect", "#" + l).classed("er entityBox", !0).attr("x", 0).attr("y", 0).attr("width", h).attr("height", f).node().getBBox();
    n.setNode(a, {
      width: p.width,
      height: p.height,
      shape: "rect",
      id: a
    });
  }), r;
}, BY = function(t, e) {
  e.nodes().forEach(function(n) {
    n !== void 0 && e.node(n) !== void 0 && t.select("#" + n).attr(
      "transform",
      "translate(" + (e.node(n).x - e.node(n).width / 2) + "," + (e.node(n).y - e.node(n).height / 2) + " )"
    );
  });
}, s_ = function(t) {
  return (t.entityA + t.roleA + t.entityB).replace(/\s/g, "");
}, DY = function(t, e) {
  return t.forEach(function(n) {
    e.setEdge(
      sl.get(n.entityA),
      sl.get(n.entityB),
      { relationship: n },
      s_(n)
    );
  }), t;
};
let M2 = 0;
const NY = function(t, e, n, i, r) {
  M2++;
  const s = n.edge(
    sl.get(e.entityA),
    sl.get(e.entityB),
    s_(e)
  ), a = Tr().x(function(y) {
    return y.x;
  }).y(function(y) {
    return y.y;
  }).curve(Tl), o = t.insert("path", "#" + i).classed("er relationshipLine", !0).attr("d", a(s.points)).style("stroke", We.stroke).style("fill", "none");
  e.relSpec.relType === r.db.Identification.NON_IDENTIFYING && o.attr("stroke-dasharray", "8,8");
  let l = "";
  switch (We.arrowMarkerAbsolute && (l = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, l = l.replace(/\(/g, "\\("), l = l.replace(/\)/g, "\\)")), e.relSpec.cardA) {
    case r.db.Cardinality.ZERO_OR_ONE:
      o.attr("marker-end", "url(" + l + "#" + gi.ERMarkers.ZERO_OR_ONE_END + ")");
      break;
    case r.db.Cardinality.ZERO_OR_MORE:
      o.attr("marker-end", "url(" + l + "#" + gi.ERMarkers.ZERO_OR_MORE_END + ")");
      break;
    case r.db.Cardinality.ONE_OR_MORE:
      o.attr("marker-end", "url(" + l + "#" + gi.ERMarkers.ONE_OR_MORE_END + ")");
      break;
    case r.db.Cardinality.ONLY_ONE:
      o.attr("marker-end", "url(" + l + "#" + gi.ERMarkers.ONLY_ONE_END + ")");
      break;
    case r.db.Cardinality.MD_PARENT:
      o.attr("marker-end", "url(" + l + "#" + gi.ERMarkers.MD_PARENT_END + ")");
      break;
  }
  switch (e.relSpec.cardB) {
    case r.db.Cardinality.ZERO_OR_ONE:
      o.attr(
        "marker-start",
        "url(" + l + "#" + gi.ERMarkers.ZERO_OR_ONE_START + ")"
      );
      break;
    case r.db.Cardinality.ZERO_OR_MORE:
      o.attr(
        "marker-start",
        "url(" + l + "#" + gi.ERMarkers.ZERO_OR_MORE_START + ")"
      );
      break;
    case r.db.Cardinality.ONE_OR_MORE:
      o.attr(
        "marker-start",
        "url(" + l + "#" + gi.ERMarkers.ONE_OR_MORE_START + ")"
      );
      break;
    case r.db.Cardinality.ONLY_ONE:
      o.attr("marker-start", "url(" + l + "#" + gi.ERMarkers.ONLY_ONE_START + ")");
      break;
    case r.db.Cardinality.MD_PARENT:
      o.attr("marker-start", "url(" + l + "#" + gi.ERMarkers.MD_PARENT_START + ")");
      break;
  }
  const u = o.node().getTotalLength(), h = o.node().getPointAtLength(u * 0.5), f = "rel" + M2, p = t.append("text").classed("er relationshipLabel", !0).attr("id", f).attr("x", h.x).attr("y", h.y).style("text-anchor", "middle").style("dominant-baseline", "middle").style("font-family", Q().fontFamily).style("font-size", We.fontSize + "px").text(e.roleA).node().getBBox();
  t.insert("rect", "#" + f).classed("er relationshipLabelBox", !0).attr("x", h.x - p.width / 2).attr("y", h.y - p.height / 2).attr("width", p.width).attr("height", p.height);
}, FY = function(t, e, n, i) {
  We = Q().er, z.info("Drawing ER diagram");
  const r = Q().securityLevel;
  let s;
  r === "sandbox" && (s = yt("#i" + e));
  const o = yt(r === "sandbox" ? s.nodes()[0].contentDocument.body : "body").select(`[id='${e}']`);
  gi.insertMarkers(o, We);
  let l;
  l = new qe({
    multigraph: !0,
    directed: !0,
    compound: !1
  }).setGraph({
    rankdir: We.layoutDirection,
    marginx: 20,
    marginy: 20,
    nodesep: 100,
    edgesep: 100,
    ranksep: 100
  }).setDefaultEdgeLabel(function() {
    return {};
  });
  const u = IY(o, i.db.getEntities(), l), h = DY(i.db.getRelationships(), l);
  Ha(l), BY(o, l), h.forEach(function(m) {
    NY(o, m, l, u, i);
  });
  const f = We.diagramPadding;
  Gt.insertTitle(o, "entityTitleText", We.titleTopMargin, i.db.getDiagramTitle());
  const d = o.node().getBBox(), p = d.width + f * 2, y = d.height + f * 2;
  dn(o, y, p, We.useMaxWidth), o.attr("viewBox", `${d.x - f} ${d.y - f} ${p} ${y}`);
}, OY = "28e9f9db-3c8d-5aa5-9faf-44286ae5937c";
function RY(t = "", e = "") {
  const n = t.replace(SY, "");
  return `${P2(e)}${P2(n)}${yY(
    t,
    OY
  )}`;
}
function P2(t = "") {
  return t.length > 0 ? `${t}-` : "";
}
const MY = {
  setConf: AY,
  draw: FY
}, PY = (t) => `
  .entityBox {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
  }

  .attributeBoxOdd {
    fill: ${t.attributeBackgroundColorOdd};
    stroke: ${t.nodeBorder};
  }

  .attributeBoxEven {
    fill:  ${t.attributeBackgroundColorEven};
    stroke: ${t.nodeBorder};
  }

  .relationshipLabelBox {
    fill: ${t.tertiaryColor};
    opacity: 0.7;
    background-color: ${t.tertiaryColor};
      rect {
        opacity: 0.5;
      }
  }

    .relationshipLine {
      stroke: ${t.lineColor};
    }

  .entityTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.textColor};
  }    
  #MD_PARENT_START {
    fill: #f5f5f5 !important;
    stroke: ${t.lineColor} !important;
    stroke-width: 1;
  }
  #MD_PARENT_END {
    fill: #f5f5f5 !important;
    stroke: ${t.lineColor} !important;
    stroke-width: 1;
  }
  
`, zY = PY, VY = {
  parser: mY,
  db: EY,
  renderer: MY,
  styles: zY
}, qY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: VY
}, Symbol.toStringTag, { value: "Module" }));
var T1 = (function() {
  var t = function(w, b, F, S) {
    for (F = F || {}, S = w.length; S--; F[w[S]] = b)
      ;
    return F;
  }, e = [1, 3], n = [1, 6], i = [1, 4], r = [1, 5], s = [2, 5], a = [1, 12], o = [5, 7, 13, 19, 21, 23, 24, 26, 28, 31, 37, 40, 47], l = [7, 13, 19, 21, 23, 24, 26, 28, 31, 37, 40], u = [7, 12, 13, 19, 21, 23, 24, 26, 28, 31, 37, 40], h = [7, 13, 47], f = [1, 42], d = [1, 41], p = [7, 13, 29, 32, 35, 38, 47], y = [1, 55], m = [1, 56], _ = [1, 57], T = [7, 13, 32, 35, 42, 47], v = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, eol: 4, GG: 5, document: 6, EOF: 7, ":": 8, DIR: 9, options: 10, body: 11, OPT: 12, NL: 13, line: 14, statement: 15, commitStatement: 16, mergeStatement: 17, cherryPickStatement: 18, acc_title: 19, acc_title_value: 20, acc_descr: 21, acc_descr_value: 22, acc_descr_multiline_value: 23, section: 24, branchStatement: 25, CHECKOUT: 26, ref: 27, BRANCH: 28, ORDER: 29, NUM: 30, CHERRY_PICK: 31, COMMIT_ID: 32, STR: 33, PARENT_COMMIT: 34, COMMIT_TAG: 35, EMPTYSTR: 36, MERGE: 37, COMMIT_TYPE: 38, commitType: 39, COMMIT: 40, commit_arg: 41, COMMIT_MSG: 42, NORMAL: 43, REVERSE: 44, HIGHLIGHT: 45, ID: 46, ";": 47, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 5: "GG", 7: "EOF", 8: ":", 9: "DIR", 12: "OPT", 13: "NL", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "section", 26: "CHECKOUT", 28: "BRANCH", 29: "ORDER", 30: "NUM", 31: "CHERRY_PICK", 32: "COMMIT_ID", 33: "STR", 34: "PARENT_COMMIT", 35: "COMMIT_TAG", 36: "EMPTYSTR", 37: "MERGE", 38: "COMMIT_TYPE", 40: "COMMIT", 42: "COMMIT_MSG", 43: "NORMAL", 44: "REVERSE", 45: "HIGHLIGHT", 46: "ID", 47: ";" },
    productions_: [0, [3, 2], [3, 3], [3, 4], [3, 5], [6, 0], [6, 2], [10, 2], [10, 1], [11, 0], [11, 2], [14, 2], [14, 1], [15, 1], [15, 1], [15, 1], [15, 2], [15, 2], [15, 1], [15, 1], [15, 1], [15, 2], [25, 2], [25, 4], [18, 3], [18, 5], [18, 5], [18, 7], [18, 7], [18, 5], [18, 5], [18, 5], [18, 7], [18, 7], [18, 7], [18, 7], [17, 2], [17, 4], [17, 4], [17, 4], [17, 6], [17, 6], [17, 6], [17, 6], [17, 6], [17, 6], [17, 8], [17, 8], [17, 8], [17, 8], [17, 8], [17, 8], [16, 2], [16, 3], [16, 3], [16, 5], [16, 5], [16, 3], [16, 5], [16, 5], [16, 5], [16, 5], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 3], [16, 5], [16, 5], [16, 5], [16, 5], [16, 5], [16, 5], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 7], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [16, 9], [41, 0], [41, 1], [39, 1], [39, 1], [39, 1], [27, 1], [27, 1], [4, 1], [4, 1], [4, 1]],
    performAction: function(b, F, S, x, C, g, I) {
      var k = g.length - 1;
      switch (C) {
        case 2:
          return g[k];
        case 3:
          return g[k - 1];
        case 4:
          return x.setDirection(g[k - 3]), g[k - 1];
        case 6:
          x.setOptions(g[k - 1]), this.$ = g[k];
          break;
        case 7:
          g[k - 1] += g[k], this.$ = g[k - 1];
          break;
        case 9:
          this.$ = [];
          break;
        case 10:
          g[k - 1].push(g[k]), this.$ = g[k - 1];
          break;
        case 11:
          this.$ = g[k - 1];
          break;
        case 16:
          this.$ = g[k].trim(), x.setAccTitle(this.$);
          break;
        case 17:
        case 18:
          this.$ = g[k].trim(), x.setAccDescription(this.$);
          break;
        case 19:
          x.addSection(g[k].substr(8)), this.$ = g[k].substr(8);
          break;
        case 21:
          x.checkout(g[k]);
          break;
        case 22:
          x.branch(g[k]);
          break;
        case 23:
          x.branch(g[k - 2], g[k]);
          break;
        case 24:
          x.cherryPick(g[k], "", void 0);
          break;
        case 25:
          x.cherryPick(g[k - 2], "", void 0, g[k]);
          break;
        case 26:
          x.cherryPick(g[k - 2], "", g[k]);
          break;
        case 27:
          x.cherryPick(g[k - 4], "", g[k], g[k - 2]);
          break;
        case 28:
          x.cherryPick(g[k - 4], "", g[k - 2], g[k]);
          break;
        case 29:
          x.cherryPick(g[k], "", g[k - 2]);
          break;
        case 30:
          x.cherryPick(g[k], "", "");
          break;
        case 31:
          x.cherryPick(g[k - 2], "", "");
          break;
        case 32:
          x.cherryPick(g[k - 4], "", "", g[k - 2]);
          break;
        case 33:
          x.cherryPick(g[k - 4], "", "", g[k]);
          break;
        case 34:
          x.cherryPick(g[k - 2], "", g[k - 4], g[k]);
          break;
        case 35:
          x.cherryPick(g[k - 2], "", "", g[k]);
          break;
        case 36:
          x.merge(g[k], "", "", "");
          break;
        case 37:
          x.merge(g[k - 2], g[k], "", "");
          break;
        case 38:
          x.merge(g[k - 2], "", g[k], "");
          break;
        case 39:
          x.merge(g[k - 2], "", "", g[k]);
          break;
        case 40:
          x.merge(g[k - 4], g[k], "", g[k - 2]);
          break;
        case 41:
          x.merge(g[k - 4], "", g[k], g[k - 2]);
          break;
        case 42:
          x.merge(g[k - 4], "", g[k - 2], g[k]);
          break;
        case 43:
          x.merge(g[k - 4], g[k - 2], g[k], "");
          break;
        case 44:
          x.merge(g[k - 4], g[k - 2], "", g[k]);
          break;
        case 45:
          x.merge(g[k - 4], g[k], g[k - 2], "");
          break;
        case 46:
          x.merge(g[k - 6], g[k - 4], g[k - 2], g[k]);
          break;
        case 47:
          x.merge(g[k - 6], g[k], g[k - 4], g[k - 2]);
          break;
        case 48:
          x.merge(g[k - 6], g[k - 4], g[k], g[k - 2]);
          break;
        case 49:
          x.merge(g[k - 6], g[k - 2], g[k - 4], g[k]);
          break;
        case 50:
          x.merge(g[k - 6], g[k], g[k - 2], g[k - 4]);
          break;
        case 51:
          x.merge(g[k - 6], g[k - 2], g[k], g[k - 4]);
          break;
        case 52:
          x.commit(g[k]);
          break;
        case 53:
          x.commit("", "", x.commitType.NORMAL, g[k]);
          break;
        case 54:
          x.commit("", "", g[k], "");
          break;
        case 55:
          x.commit("", "", g[k], g[k - 2]);
          break;
        case 56:
          x.commit("", "", g[k - 2], g[k]);
          break;
        case 57:
          x.commit("", g[k], x.commitType.NORMAL, "");
          break;
        case 58:
          x.commit("", g[k - 2], x.commitType.NORMAL, g[k]);
          break;
        case 59:
          x.commit("", g[k], x.commitType.NORMAL, g[k - 2]);
          break;
        case 60:
          x.commit("", g[k - 2], g[k], "");
          break;
        case 61:
          x.commit("", g[k], g[k - 2], "");
          break;
        case 62:
          x.commit("", g[k - 4], g[k - 2], g[k]);
          break;
        case 63:
          x.commit("", g[k - 4], g[k], g[k - 2]);
          break;
        case 64:
          x.commit("", g[k - 2], g[k - 4], g[k]);
          break;
        case 65:
          x.commit("", g[k], g[k - 4], g[k - 2]);
          break;
        case 66:
          x.commit("", g[k], g[k - 2], g[k - 4]);
          break;
        case 67:
          x.commit("", g[k - 2], g[k], g[k - 4]);
          break;
        case 68:
          x.commit(g[k], "", x.commitType.NORMAL, "");
          break;
        case 69:
          x.commit(g[k], "", x.commitType.NORMAL, g[k - 2]);
          break;
        case 70:
          x.commit(g[k - 2], "", x.commitType.NORMAL, g[k]);
          break;
        case 71:
          x.commit(g[k - 2], "", g[k], "");
          break;
        case 72:
          x.commit(g[k], "", g[k - 2], "");
          break;
        case 73:
          x.commit(g[k], g[k - 2], x.commitType.NORMAL, "");
          break;
        case 74:
          x.commit(g[k - 2], g[k], x.commitType.NORMAL, "");
          break;
        case 75:
          x.commit(g[k - 4], "", g[k - 2], g[k]);
          break;
        case 76:
          x.commit(g[k - 4], "", g[k], g[k - 2]);
          break;
        case 77:
          x.commit(g[k - 2], "", g[k - 4], g[k]);
          break;
        case 78:
          x.commit(g[k], "", g[k - 4], g[k - 2]);
          break;
        case 79:
          x.commit(g[k], "", g[k - 2], g[k - 4]);
          break;
        case 80:
          x.commit(g[k - 2], "", g[k], g[k - 4]);
          break;
        case 81:
          x.commit(g[k - 4], g[k], g[k - 2], "");
          break;
        case 82:
          x.commit(g[k - 4], g[k - 2], g[k], "");
          break;
        case 83:
          x.commit(g[k - 2], g[k], g[k - 4], "");
          break;
        case 84:
          x.commit(g[k], g[k - 2], g[k - 4], "");
          break;
        case 85:
          x.commit(g[k], g[k - 4], g[k - 2], "");
          break;
        case 86:
          x.commit(g[k - 2], g[k - 4], g[k], "");
          break;
        case 87:
          x.commit(g[k - 4], g[k], x.commitType.NORMAL, g[k - 2]);
          break;
        case 88:
          x.commit(g[k - 4], g[k - 2], x.commitType.NORMAL, g[k]);
          break;
        case 89:
          x.commit(g[k - 2], g[k], x.commitType.NORMAL, g[k - 4]);
          break;
        case 90:
          x.commit(g[k], g[k - 2], x.commitType.NORMAL, g[k - 4]);
          break;
        case 91:
          x.commit(g[k], g[k - 4], x.commitType.NORMAL, g[k - 2]);
          break;
        case 92:
          x.commit(g[k - 2], g[k - 4], x.commitType.NORMAL, g[k]);
          break;
        case 93:
          x.commit(g[k - 6], g[k - 4], g[k - 2], g[k]);
          break;
        case 94:
          x.commit(g[k - 6], g[k - 4], g[k], g[k - 2]);
          break;
        case 95:
          x.commit(g[k - 6], g[k - 2], g[k - 4], g[k]);
          break;
        case 96:
          x.commit(g[k - 6], g[k], g[k - 4], g[k - 2]);
          break;
        case 97:
          x.commit(g[k - 6], g[k - 2], g[k], g[k - 4]);
          break;
        case 98:
          x.commit(g[k - 6], g[k], g[k - 2], g[k - 4]);
          break;
        case 99:
          x.commit(g[k - 4], g[k - 6], g[k - 2], g[k]);
          break;
        case 100:
          x.commit(g[k - 4], g[k - 6], g[k], g[k - 2]);
          break;
        case 101:
          x.commit(g[k - 2], g[k - 6], g[k - 4], g[k]);
          break;
        case 102:
          x.commit(g[k], g[k - 6], g[k - 4], g[k - 2]);
          break;
        case 103:
          x.commit(g[k - 2], g[k - 6], g[k], g[k - 4]);
          break;
        case 104:
          x.commit(g[k], g[k - 6], g[k - 2], g[k - 4]);
          break;
        case 105:
          x.commit(g[k], g[k - 4], g[k - 2], g[k - 6]);
          break;
        case 106:
          x.commit(g[k - 2], g[k - 4], g[k], g[k - 6]);
          break;
        case 107:
          x.commit(g[k], g[k - 2], g[k - 4], g[k - 6]);
          break;
        case 108:
          x.commit(g[k - 2], g[k], g[k - 4], g[k - 6]);
          break;
        case 109:
          x.commit(g[k - 4], g[k - 2], g[k], g[k - 6]);
          break;
        case 110:
          x.commit(g[k - 4], g[k], g[k - 2], g[k - 6]);
          break;
        case 111:
          x.commit(g[k - 2], g[k - 4], g[k - 6], g[k]);
          break;
        case 112:
          x.commit(g[k], g[k - 4], g[k - 6], g[k - 2]);
          break;
        case 113:
          x.commit(g[k - 2], g[k], g[k - 6], g[k - 4]);
          break;
        case 114:
          x.commit(g[k], g[k - 2], g[k - 6], g[k - 4]);
          break;
        case 115:
          x.commit(g[k - 4], g[k - 2], g[k - 6], g[k]);
          break;
        case 116:
          x.commit(g[k - 4], g[k], g[k - 6], g[k - 2]);
          break;
        case 117:
          this.$ = "";
          break;
        case 118:
          this.$ = g[k];
          break;
        case 119:
          this.$ = x.commitType.NORMAL;
          break;
        case 120:
          this.$ = x.commitType.REVERSE;
          break;
        case 121:
          this.$ = x.commitType.HIGHLIGHT;
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 5: e, 7: n, 13: i, 47: r }, { 1: [3] }, { 3: 7, 4: 2, 5: e, 7: n, 13: i, 47: r }, { 6: 8, 7: s, 8: [1, 9], 9: [1, 10], 10: 11, 13: a }, t(o, [2, 124]), t(o, [2, 125]), t(o, [2, 126]), { 1: [2, 1] }, { 7: [1, 13] }, { 6: 14, 7: s, 10: 11, 13: a }, { 8: [1, 15] }, t(l, [2, 9], { 11: 16, 12: [1, 17] }), t(u, [2, 8]), { 1: [2, 2] }, { 7: [1, 18] }, { 6: 19, 7: s, 10: 11, 13: a }, { 7: [2, 6], 13: [1, 22], 14: 20, 15: 21, 16: 23, 17: 24, 18: 25, 19: [1, 26], 21: [1, 27], 23: [1, 28], 24: [1, 29], 25: 30, 26: [1, 31], 28: [1, 35], 31: [1, 34], 37: [1, 33], 40: [1, 32] }, t(u, [2, 7]), { 1: [2, 3] }, { 7: [1, 36] }, t(l, [2, 10]), { 4: 37, 7: n, 13: i, 47: r }, t(l, [2, 12]), t(h, [2, 13]), t(h, [2, 14]), t(h, [2, 15]), { 20: [1, 38] }, { 22: [1, 39] }, t(h, [2, 18]), t(h, [2, 19]), t(h, [2, 20]), { 27: 40, 33: f, 46: d }, t(h, [2, 117], { 41: 43, 32: [1, 46], 33: [1, 48], 35: [1, 44], 38: [1, 45], 42: [1, 47] }), { 27: 49, 33: f, 46: d }, { 32: [1, 50], 35: [1, 51] }, { 27: 52, 33: f, 46: d }, { 1: [2, 4] }, t(l, [2, 11]), t(h, [2, 16]), t(h, [2, 17]), t(h, [2, 21]), t(p, [2, 122]), t(p, [2, 123]), t(h, [2, 52]), { 33: [1, 53] }, { 39: 54, 43: y, 44: m, 45: _ }, { 33: [1, 58] }, { 33: [1, 59] }, t(h, [2, 118]), t(h, [2, 36], { 32: [1, 60], 35: [1, 62], 38: [1, 61] }), { 33: [1, 63] }, { 33: [1, 64], 36: [1, 65] }, t(h, [2, 22], { 29: [1, 66] }), t(h, [2, 53], { 32: [1, 68], 38: [1, 67], 42: [1, 69] }), t(h, [2, 54], { 32: [1, 71], 35: [1, 70], 42: [1, 72] }), t(T, [2, 119]), t(T, [2, 120]), t(T, [2, 121]), t(h, [2, 57], { 35: [1, 73], 38: [1, 74], 42: [1, 75] }), t(h, [2, 68], { 32: [1, 78], 35: [1, 76], 38: [1, 77] }), { 33: [1, 79] }, { 39: 80, 43: y, 44: m, 45: _ }, { 33: [1, 81] }, t(h, [2, 24], { 34: [1, 82], 35: [1, 83] }), { 32: [1, 84] }, { 32: [1, 85] }, { 30: [1, 86] }, { 39: 87, 43: y, 44: m, 45: _ }, { 33: [1, 88] }, { 33: [1, 89] }, { 33: [1, 90] }, { 33: [1, 91] }, { 33: [1, 92] }, { 33: [1, 93] }, { 39: 94, 43: y, 44: m, 45: _ }, { 33: [1, 95] }, { 33: [1, 96] }, { 39: 97, 43: y, 44: m, 45: _ }, { 33: [1, 98] }, t(h, [2, 37], { 35: [1, 100], 38: [1, 99] }), t(h, [2, 38], { 32: [1, 102], 35: [1, 101] }), t(h, [2, 39], { 32: [1, 103], 38: [1, 104] }), { 33: [1, 105] }, { 33: [1, 106], 36: [1, 107] }, { 33: [1, 108] }, { 33: [1, 109] }, t(h, [2, 23]), t(h, [2, 55], { 32: [1, 110], 42: [1, 111] }), t(h, [2, 59], { 38: [1, 112], 42: [1, 113] }), t(h, [2, 69], { 32: [1, 115], 38: [1, 114] }), t(h, [2, 56], { 32: [1, 116], 42: [1, 117] }), t(h, [2, 61], { 35: [1, 118], 42: [1, 119] }), t(h, [2, 72], { 32: [1, 121], 35: [1, 120] }), t(h, [2, 58], { 38: [1, 122], 42: [1, 123] }), t(h, [2, 60], { 35: [1, 124], 42: [1, 125] }), t(h, [2, 73], { 35: [1, 127], 38: [1, 126] }), t(h, [2, 70], { 32: [1, 129], 38: [1, 128] }), t(h, [2, 71], { 32: [1, 131], 35: [1, 130] }), t(h, [2, 74], { 35: [1, 133], 38: [1, 132] }), { 39: 134, 43: y, 44: m, 45: _ }, { 33: [1, 135] }, { 33: [1, 136] }, { 33: [1, 137] }, { 33: [1, 138] }, { 39: 139, 43: y, 44: m, 45: _ }, t(h, [2, 25], { 35: [1, 140] }), t(h, [2, 26], { 34: [1, 141] }), t(h, [2, 31], { 34: [1, 142] }), t(h, [2, 29], { 34: [1, 143] }), t(h, [2, 30], { 34: [1, 144] }), { 33: [1, 145] }, { 33: [1, 146] }, { 39: 147, 43: y, 44: m, 45: _ }, { 33: [1, 148] }, { 39: 149, 43: y, 44: m, 45: _ }, { 33: [1, 150] }, { 33: [1, 151] }, { 33: [1, 152] }, { 33: [1, 153] }, { 33: [1, 154] }, { 33: [1, 155] }, { 33: [1, 156] }, { 39: 157, 43: y, 44: m, 45: _ }, { 33: [1, 158] }, { 33: [1, 159] }, { 33: [1, 160] }, { 39: 161, 43: y, 44: m, 45: _ }, { 33: [1, 162] }, { 39: 163, 43: y, 44: m, 45: _ }, { 33: [1, 164] }, { 33: [1, 165] }, { 33: [1, 166] }, { 39: 167, 43: y, 44: m, 45: _ }, { 33: [1, 168] }, t(h, [2, 43], { 35: [1, 169] }), t(h, [2, 44], { 38: [1, 170] }), t(h, [2, 42], { 32: [1, 171] }), t(h, [2, 45], { 35: [1, 172] }), t(h, [2, 40], { 38: [1, 173] }), t(h, [2, 41], { 32: [1, 174] }), { 33: [1, 175], 36: [1, 176] }, { 33: [1, 177] }, { 33: [1, 178] }, { 33: [1, 179] }, { 33: [1, 180] }, t(h, [2, 66], { 42: [1, 181] }), t(h, [2, 79], { 32: [1, 182] }), t(h, [2, 67], { 42: [1, 183] }), t(h, [2, 90], { 38: [1, 184] }), t(h, [2, 80], { 32: [1, 185] }), t(h, [2, 89], { 38: [1, 186] }), t(h, [2, 65], { 42: [1, 187] }), t(h, [2, 78], { 32: [1, 188] }), t(h, [2, 64], { 42: [1, 189] }), t(h, [2, 84], { 35: [1, 190] }), t(h, [2, 77], { 32: [1, 191] }), t(h, [2, 83], { 35: [1, 192] }), t(h, [2, 63], { 42: [1, 193] }), t(h, [2, 91], { 38: [1, 194] }), t(h, [2, 62], { 42: [1, 195] }), t(h, [2, 85], { 35: [1, 196] }), t(h, [2, 86], { 35: [1, 197] }), t(h, [2, 92], { 38: [1, 198] }), t(h, [2, 76], { 32: [1, 199] }), t(h, [2, 87], { 38: [1, 200] }), t(h, [2, 75], { 32: [1, 201] }), t(h, [2, 81], { 35: [1, 202] }), t(h, [2, 82], { 35: [1, 203] }), t(h, [2, 88], { 38: [1, 204] }), { 33: [1, 205] }, { 39: 206, 43: y, 44: m, 45: _ }, { 33: [1, 207] }, { 33: [1, 208] }, { 39: 209, 43: y, 44: m, 45: _ }, { 33: [1, 210] }, t(h, [2, 27]), t(h, [2, 32]), t(h, [2, 28]), t(h, [2, 33]), t(h, [2, 34]), t(h, [2, 35]), { 33: [1, 211] }, { 33: [1, 212] }, { 33: [1, 213] }, { 39: 214, 43: y, 44: m, 45: _ }, { 33: [1, 215] }, { 39: 216, 43: y, 44: m, 45: _ }, { 33: [1, 217] }, { 33: [1, 218] }, { 33: [1, 219] }, { 33: [1, 220] }, { 33: [1, 221] }, { 33: [1, 222] }, { 33: [1, 223] }, { 39: 224, 43: y, 44: m, 45: _ }, { 33: [1, 225] }, { 33: [1, 226] }, { 33: [1, 227] }, { 39: 228, 43: y, 44: m, 45: _ }, { 33: [1, 229] }, { 39: 230, 43: y, 44: m, 45: _ }, { 33: [1, 231] }, { 33: [1, 232] }, { 33: [1, 233] }, { 39: 234, 43: y, 44: m, 45: _ }, t(h, [2, 46]), t(h, [2, 48]), t(h, [2, 47]), t(h, [2, 49]), t(h, [2, 51]), t(h, [2, 50]), t(h, [2, 107]), t(h, [2, 108]), t(h, [2, 105]), t(h, [2, 106]), t(h, [2, 110]), t(h, [2, 109]), t(h, [2, 114]), t(h, [2, 113]), t(h, [2, 112]), t(h, [2, 111]), t(h, [2, 116]), t(h, [2, 115]), t(h, [2, 104]), t(h, [2, 103]), t(h, [2, 102]), t(h, [2, 101]), t(h, [2, 99]), t(h, [2, 100]), t(h, [2, 98]), t(h, [2, 97]), t(h, [2, 96]), t(h, [2, 95]), t(h, [2, 93]), t(h, [2, 94])],
    defaultActions: { 7: [2, 1], 13: [2, 2], 18: [2, 3], 36: [2, 4] },
    parseError: function(b, F) {
      if (F.recoverable)
        this.trace(b);
      else {
        var S = new Error(b);
        throw S.hash = F, S;
      }
    },
    parse: function(b) {
      var F = this, S = [0], x = [], C = [null], g = [], I = this.table, k = "", P = 0, R = 0, M = 2, B = 1, N = g.slice.call(arguments, 1), D = Object.create(this.lexer), E = { yy: {} };
      for (var V in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, V) && (E.yy[V] = this.yy[V]);
      D.setInput(b, E.yy), E.yy.lexer = D, E.yy.parser = this, typeof D.yylloc > "u" && (D.yylloc = {});
      var nt = D.yylloc;
      g.push(nt);
      var O = D.options && D.options.ranges;
      typeof E.yy.parseError == "function" ? this.parseError = E.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function ct() {
        var Y;
        return Y = x.pop() || D.lex() || B, typeof Y != "number" && (Y instanceof Array && (x = Y, Y = x.pop()), Y = F.symbols_[Y] || Y), Y;
      }
      for (var X, H, it, ot, W = {}, Z, q, G, U; ; ) {
        if (H = S[S.length - 1], this.defaultActions[H] ? it = this.defaultActions[H] : ((X === null || typeof X > "u") && (X = ct()), it = I[H] && I[H][X]), typeof it > "u" || !it.length || !it[0]) {
          var ht = "";
          U = [];
          for (Z in I[H])
            this.terminals_[Z] && Z > M && U.push("'" + this.terminals_[Z] + "'");
          D.showPosition ? ht = "Parse error on line " + (P + 1) + `:
` + D.showPosition() + `
Expecting ` + U.join(", ") + ", got '" + (this.terminals_[X] || X) + "'" : ht = "Parse error on line " + (P + 1) + ": Unexpected " + (X == B ? "end of input" : "'" + (this.terminals_[X] || X) + "'"), this.parseError(ht, {
            text: D.match,
            token: this.terminals_[X] || X,
            line: D.yylineno,
            loc: nt,
            expected: U
          });
        }
        if (it[0] instanceof Array && it.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + H + ", token: " + X);
        switch (it[0]) {
          case 1:
            S.push(X), C.push(D.yytext), g.push(D.yylloc), S.push(it[1]), X = null, R = D.yyleng, k = D.yytext, P = D.yylineno, nt = D.yylloc;
            break;
          case 2:
            if (q = this.productions_[it[1]][1], W.$ = C[C.length - q], W._$ = {
              first_line: g[g.length - (q || 1)].first_line,
              last_line: g[g.length - 1].last_line,
              first_column: g[g.length - (q || 1)].first_column,
              last_column: g[g.length - 1].last_column
            }, O && (W._$.range = [
              g[g.length - (q || 1)].range[0],
              g[g.length - 1].range[1]
            ]), ot = this.performAction.apply(W, [
              k,
              R,
              P,
              E.yy,
              it[1],
              C,
              g
            ].concat(N)), typeof ot < "u")
              return ot;
            q && (S = S.slice(0, -1 * q * 2), C = C.slice(0, -1 * q), g = g.slice(0, -1 * q)), S.push(this.productions_[it[1]][0]), C.push(W.$), g.push(W._$), G = I[S[S.length - 2]][S[S.length - 1]], S.push(G);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, A = /* @__PURE__ */ (function() {
    var w = {
      EOF: 1,
      parseError: function(F, S) {
        if (this.yy.parser)
          this.yy.parser.parseError(F, S);
        else
          throw new Error(F);
      },
      // resets the lexer, sets new input
      setInput: function(b, F) {
        return this.yy = F || this.yy || {}, this._input = b, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var b = this._input[0];
        this.yytext += b, this.yyleng++, this.offset++, this.match += b, this.matched += b;
        var F = b.match(/(?:\r\n?|\n).*/g);
        return F ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), b;
      },
      // unshifts one char (or a string) into the input
      unput: function(b) {
        var F = b.length, S = b.split(/(?:\r\n?|\n)/g);
        this._input = b + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - F), this.offset -= F;
        var x = 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), S.length - 1 && (this.yylineno -= S.length - 1);
        var C = 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: S ? (S.length === x.length ? this.yylloc.first_column : 0) + x[x.length - S.length].length - S[0].length : this.yylloc.first_column - F
        }, this.options.ranges && (this.yylloc.range = [C[0], C[0] + this.yyleng - F]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(b) {
        this.unput(this.match.slice(b));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var b = this.matched.substr(0, this.matched.length - this.match.length);
        return (b.length > 20 ? "..." : "") + b.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var b = this.match;
        return b.length < 20 && (b += this._input.substr(0, 20 - b.length)), (b.substr(0, 20) + (b.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var b = this.pastInput(), F = new Array(b.length + 1).join("-");
        return b + this.upcomingInput() + `
` + F + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(b, F) {
        var S, x, C;
        if (this.options.backtrack_lexer && (C = {
          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 && (C.yylloc.range = this.yylloc.range.slice(0))), x = b[0].match(/(?:\r\n?|\n).*/g), x && (this.yylineno += x.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: x ? x[x.length - 1].length - x[x.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + b[0].length
        }, this.yytext += b[0], this.match += b[0], this.matches = b, 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(b[0].length), this.matched += b[0], S = this.performAction.call(this, this.yy, this, F, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), S)
          return S;
        if (this._backtrack) {
          for (var g in C)
            this[g] = C[g];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var b, F, S, x;
        this._more || (this.yytext = "", this.match = "");
        for (var C = this._currentRules(), g = 0; g < C.length; g++)
          if (S = this._input.match(this.rules[C[g]]), S && (!F || S[0].length > F[0].length)) {
            if (F = S, x = g, this.options.backtrack_lexer) {
              if (b = this.test_match(S, C[g]), b !== !1)
                return b;
              if (this._backtrack) {
                F = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return F ? (b = this.test_match(F, C[x]), b !== !1 ? b : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var F = this.next();
        return F || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(F) {
        this.conditionStack.push(F);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var F = this.conditionStack.length - 1;
        return F > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(F) {
        return F = this.conditionStack.length - 1 - Math.abs(F || 0), F >= 0 ? this.conditionStack[F] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(F) {
        this.begin(F);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(F, S, x, C) {
        switch (x) {
          case 0:
            return this.begin("acc_title"), 19;
          case 1:
            return this.popState(), "acc_title_value";
          case 2:
            return this.begin("acc_descr"), 21;
          case 3:
            return this.popState(), "acc_descr_value";
          case 4:
            this.begin("acc_descr_multiline");
            break;
          case 5:
            this.popState();
            break;
          case 6:
            return "acc_descr_multiline_value";
          case 7:
            return 13;
          case 8:
            break;
          case 9:
            break;
          case 10:
            return 5;
          case 11:
            return 40;
          case 12:
            return 32;
          case 13:
            return 38;
          case 14:
            return 42;
          case 15:
            return 43;
          case 16:
            return 44;
          case 17:
            return 45;
          case 18:
            return 35;
          case 19:
            return 28;
          case 20:
            return 29;
          case 21:
            return 37;
          case 22:
            return 31;
          case 23:
            return 34;
          case 24:
            return 26;
          case 25:
            return 9;
          case 26:
            return 9;
          case 27:
            return 8;
          case 28:
            return "CARET";
          case 29:
            this.begin("options");
            break;
          case 30:
            this.popState();
            break;
          case 31:
            return 12;
          case 32:
            return 36;
          case 33:
            this.begin("string");
            break;
          case 34:
            this.popState();
            break;
          case 35:
            return 33;
          case 36:
            return 30;
          case 37:
            return 46;
          case 38:
            return 7;
        }
      },
      rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:(\r?\n)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:gitGraph\b)/i, /^(?:commit(?=\s|$))/i, /^(?:id:)/i, /^(?:type:)/i, /^(?:msg:)/i, /^(?:NORMAL\b)/i, /^(?:REVERSE\b)/i, /^(?:HIGHLIGHT\b)/i, /^(?:tag:)/i, /^(?:branch(?=\s|$))/i, /^(?:order:)/i, /^(?:merge(?=\s|$))/i, /^(?:cherry-pick(?=\s|$))/i, /^(?:parent:)/i, /^(?:checkout(?=\s|$))/i, /^(?:LR\b)/i, /^(?:TB\b)/i, /^(?::)/i, /^(?:\^)/i, /^(?:options\r?\n)/i, /^(?:[ \r\n\t]+end\b)/i, /^(?:[\s\S]+(?=[ \r\n\t]+end))/i, /^(?:["]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[0-9]+(?=\s|$))/i, /^(?:\w([-\./\w]*[-\w])?)/i, /^(?:$)/i, /^(?:\s+)/i],
      conditions: { acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, options: { rules: [30, 31], inclusive: !1 }, string: { rules: [34, 35], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 32, 33, 36, 37, 38, 39], inclusive: !0 } }
    };
    return w;
  })();
  v.lexer = A;
  function L() {
    this.yy = {};
  }
  return L.prototype = v, v.Parser = L, new L();
})();
T1.parser = T1;
const $Y = T1;
let xu = Q().gitGraph.mainBranchName, YY = Q().gitGraph.mainBranchOrder, He = {}, kn = null, al = {};
al[xu] = { name: xu, order: YY };
let Me = {};
Me[xu] = kn;
let Ze = xu, a_ = "LR", Ts = 0;
function m0() {
  return Px({ length: 7 });
}
function WY(t, e) {
  const n = /* @__PURE__ */ Object.create(null);
  return t.reduce((i, r) => {
    const s = e(r);
    return n[s] || (n[s] = !0, i.push(r)), i;
  }, []);
}
const UY = function(t) {
  a_ = t;
};
let o_ = {};
const HY = function(t) {
  z.debug("options str", t), t = t && t.trim(), t = t || "{}";
  try {
    o_ = JSON.parse(t);
  } catch (e) {
    z.error("error while parsing gitGraph options", e.message);
  }
}, GY = function() {
  return o_;
}, jY = function(t, e, n, i) {
  z.debug("Entering commit:", t, e, n, i), e = bt.sanitizeText(e, Q()), t = bt.sanitizeText(t, Q()), i = bt.sanitizeText(i, Q());
  const r = {
    id: e || Ts + "-" + m0(),
    message: t,
    seq: Ts++,
    type: n || ha.NORMAL,
    tag: i || "",
    parents: kn == null ? [] : [kn.id],
    branch: Ze
  };
  kn = r, He[r.id] = r, Me[Ze] = r.id, z.debug("in pushCommit " + r.id);
}, XY = function(t, e) {
  if (t = bt.sanitizeText(t, Q()), Me[t] === void 0)
    Me[t] = kn != null ? kn.id : null, al[t] = { name: t, order: e ? parseInt(e, 10) : null }, l_(t), z.debug("in createBranch");
  else {
    let n = new Error(
      'Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ' + t + '")'
    );
    throw n.hash = {
      text: "branch " + t,
      token: "branch " + t,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ['"checkout ' + t + '"']
    }, n;
  }
}, KY = function(t, e, n, i) {
  t = bt.sanitizeText(t, Q()), e = bt.sanitizeText(e, Q());
  const r = He[Me[Ze]], s = He[Me[t]];
  if (Ze === t) {
    let o = new Error('Incorrect usage of "merge". Cannot merge a branch to itself');
    throw o.hash = {
      text: "merge " + t,
      token: "merge " + t,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ["branch abc"]
    }, o;
  } else if (r === void 0 || !r) {
    let o = new Error(
      'Incorrect usage of "merge". Current branch (' + Ze + ")has no commits"
    );
    throw o.hash = {
      text: "merge " + t,
      token: "merge " + t,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ["commit"]
    }, o;
  } else if (Me[t] === void 0) {
    let o = new Error(
      'Incorrect usage of "merge". Branch to be merged (' + t + ") does not exist"
    );
    throw o.hash = {
      text: "merge " + t,
      token: "merge " + t,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ["branch " + t]
    }, o;
  } else if (s === void 0 || !s) {
    let o = new Error(
      'Incorrect usage of "merge". Branch to be merged (' + t + ") has no commits"
    );
    throw o.hash = {
      text: "merge " + t,
      token: "merge " + t,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ['"commit"']
    }, o;
  } else if (r === s) {
    let o = new Error('Incorrect usage of "merge". Both branches have same head');
    throw o.hash = {
      text: "merge " + t,
      token: "merge " + t,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ["branch abc"]
    }, o;
  } else if (e && He[e] !== void 0) {
    let o = new Error(
      'Incorrect usage of "merge". Commit with id:' + e + " already exists, use different custom Id"
    );
    throw o.hash = {
      text: "merge " + t + e + n + i,
      token: "merge " + t + e + n + i,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: [
        "merge " + t + " " + e + "_UNIQUE " + n + " " + i
      ]
    }, o;
  }
  const a = {
    id: e || Ts + "-" + m0(),
    message: "merged branch " + t + " into " + Ze,
    seq: Ts++,
    parents: [kn == null ? null : kn.id, Me[t]],
    branch: Ze,
    type: ha.MERGE,
    customType: n,
    customId: !!e,
    tag: i || ""
  };
  kn = a, He[a.id] = a, Me[Ze] = a.id, z.debug(Me), z.debug("in mergeBranch");
}, QY = function(t, e, n, i) {
  if (z.debug("Entering cherryPick:", t, e, n), t = bt.sanitizeText(t, Q()), e = bt.sanitizeText(e, Q()), n = bt.sanitizeText(n, Q()), i = bt.sanitizeText(i, Q()), !t || He[t] === void 0) {
    let a = new Error(
      'Incorrect usage of "cherryPick". Source commit id should exist and provided'
    );
    throw a.hash = {
      text: "cherryPick " + t + " " + e,
      token: "cherryPick " + t + " " + e,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ["cherry-pick abc"]
    }, a;
  }
  let r = He[t], s = r.branch;
  if (i && !(Array.isArray(r.parents) && r.parents.includes(i)))
    throw new Error(
      "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit."
    );
  if (r.type === ha.MERGE && !i)
    throw new Error(
      "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified."
    );
  if (!e || He[e] === void 0) {
    if (s === Ze) {
      let l = new Error(
        'Incorrect usage of "cherryPick". Source commit is already on current branch'
      );
      throw l.hash = {
        text: "cherryPick " + t + " " + e,
        token: "cherryPick " + t + " " + e,
        line: "1",
        loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
        expected: ["cherry-pick abc"]
      }, l;
    }
    const a = He[Me[Ze]];
    if (a === void 0 || !a) {
      let l = new Error(
        'Incorrect usage of "cherry-pick". Current branch (' + Ze + ")has no commits"
      );
      throw l.hash = {
        text: "cherryPick " + t + " " + e,
        token: "cherryPick " + t + " " + e,
        line: "1",
        loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
        expected: ["cherry-pick abc"]
      }, l;
    }
    const o = {
      id: Ts + "-" + m0(),
      message: "cherry-picked " + r + " into " + Ze,
      seq: Ts++,
      parents: [kn == null ? null : kn.id, r.id],
      branch: Ze,
      type: ha.CHERRY_PICK,
      tag: n ?? `cherry-pick:${r.id}${r.type === ha.MERGE ? `|parent:${i}` : ""}`
    };
    kn = o, He[o.id] = o, Me[Ze] = o.id, z.debug(Me), z.debug("in cherryPick");
  }
}, l_ = function(t) {
  if (t = bt.sanitizeText(t, Q()), Me[t] === void 0) {
    let e = new Error(
      'Trying to checkout branch which is not yet created. (Help try using "branch ' + t + '")'
    );
    throw e.hash = {
      text: "checkout " + t,
      token: "checkout " + t,
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ['"branch ' + t + '"']
    }, e;
  } else {
    Ze = t;
    const e = Me[Ze];
    kn = He[e];
  }
};
function z2(t, e, n) {
  const i = t.indexOf(e);
  i === -1 ? t.push(n) : t.splice(i, 1, n);
}
function c_(t) {
  const e = t.reduce((r, s) => r.seq > s.seq ? r : s, t[0]);
  let n = "";
  t.forEach(function(r) {
    r === e ? n += "	*" : n += "	|";
  });
  const i = [n, e.id, e.seq];
  for (let r in Me)
    Me[r] === e.id && i.push(r);
  if (z.debug(i.join(" ")), e.parents && e.parents.length == 2) {
    const r = He[e.parents[0]];
    z2(t, e, r), t.push(He[e.parents[1]]);
  } else {
    if (e.parents.length == 0)
      return;
    {
      const r = He[e.parents];
      z2(t, e, r);
    }
  }
  t = WY(t, (r) => r.id), c_(t);
}
const ZY = function() {
  z.debug(He);
  const t = u_()[0];
  c_([t]);
}, JY = function() {
  He = {}, kn = null;
  let t = Q().gitGraph.mainBranchName, e = Q().gitGraph.mainBranchOrder;
  Me = {}, Me[t] = null, al = {}, al[t] = { name: t, order: e }, Ze = t, Ts = 0, fn();
}, tW = function() {
  return Object.values(al).map((e, n) => e.order !== null ? e : {
    ...e,
    order: parseFloat(`0.${n}`, 10)
  }).sort((e, n) => e.order - n.order).map(({ name: e }) => ({ name: e }));
}, eW = function() {
  return Me;
}, nW = function() {
  return He;
}, u_ = function() {
  const t = Object.keys(He).map(function(e) {
    return He[e];
  });
  return t.forEach(function(e) {
    z.debug(e.id);
  }), t.sort((e, n) => e.seq - n.seq), t;
}, iW = function() {
  return Ze;
}, rW = function() {
  return a_;
}, sW = function() {
  return kn;
}, ha = {
  NORMAL: 0,
  REVERSE: 1,
  HIGHLIGHT: 2,
  MERGE: 3,
  CHERRY_PICK: 4
}, aW = {
  getConfig: () => Q().gitGraph,
  setDirection: UY,
  setOptions: HY,
  getOptions: GY,
  commit: jY,
  branch: XY,
  merge: KY,
  cherryPick: QY,
  checkout: l_,
  //reset,
  prettyPrint: ZY,
  clear: JY,
  getBranchesAsObjArray: tW,
  getBranches: eW,
  getCommits: nW,
  getCommitsArray: u_,
  getCurrentBranch: iW,
  getDirection: rW,
  getHead: sW,
  setAccTitle: pn,
  getAccTitle: vn,
  getAccDescription: Cn,
  setAccDescription: En,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn,
  commitType: ha
};
let mo = {};
const Qe = {
  NORMAL: 0,
  REVERSE: 1,
  HIGHLIGHT: 2,
  MERGE: 3,
  CHERRY_PICK: 4
}, ns = 8;
let In = {}, fr = {}, bu = [], ol = 0, Oe = "LR";
const oW = () => {
  In = {}, fr = {}, mo = {}, ol = 0, bu = [], Oe = "LR";
}, h_ = (t) => {
  const e = document.createElementNS("http://www.w3.org/2000/svg", "text");
  let n = [];
  typeof t == "string" ? n = t.split(/\\n|\n|<br\s*\/?>/gi) : Array.isArray(t) ? n = t : n = [];
  for (const i of n) {
    const r = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
    r.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), r.setAttribute("dy", "1em"), r.setAttribute("x", "0"), r.setAttribute("class", "row"), r.textContent = i.trim(), e.appendChild(r);
  }
  return e;
}, lW = (t) => {
  let e = "", n = 0;
  return t.forEach((i) => {
    const r = Oe === "TB" ? fr[i].y : fr[i].x;
    r >= n && (e = i, n = r);
  }), e || void 0;
}, V2 = (t, e, n) => {
  const i = Q().gitGraph, r = t.append("g").attr("class", "commit-bullets"), s = t.append("g").attr("class", "commit-labels");
  let a = 0;
  Oe === "TB" && (a = 30);
  const l = Object.keys(e).sort((d, p) => e[d].seq - e[p].seq), u = i.parallelCommits, h = 10, f = 40;
  l.forEach((d) => {
    const p = e[d];
    if (u)
      if (p.parents.length) {
        const T = lW(p.parents);
        a = Oe === "TB" ? fr[T].y + f : fr[T].x + f;
      } else
        a = 0, Oe === "TB" && (a = 30);
    const y = a + h, m = Oe === "TB" ? y : In[p.branch].pos, _ = Oe === "TB" ? In[p.branch].pos : y;
    if (n) {
      let T, v = p.customType !== void 0 && p.customType !== "" ? p.customType : p.type;
      switch (v) {
        case Qe.NORMAL:
          T = "commit-normal";
          break;
        case Qe.REVERSE:
          T = "commit-reverse";
          break;
        case Qe.HIGHLIGHT:
          T = "commit-highlight";
          break;
        case Qe.MERGE:
          T = "commit-merge";
          break;
        case Qe.CHERRY_PICK:
          T = "commit-cherry-pick";
          break;
        default:
          T = "commit-normal";
      }
      if (v === Qe.HIGHLIGHT) {
        const A = r.append("rect");
        A.attr("x", _ - 10), A.attr("y", m - 10), A.attr("height", 20), A.attr("width", 20), A.attr(
          "class",
          `commit ${p.id} commit-highlight${In[p.branch].index % ns} ${T}-outer`
        ), r.append("rect").attr("x", _ - 6).attr("y", m - 6).attr("height", 12).attr("width", 12).attr(
          "class",
          `commit ${p.id} commit${In[p.branch].index % ns} ${T}-inner`
        );
      } else if (v === Qe.CHERRY_PICK)
        r.append("circle").attr("cx", _).attr("cy", m).attr("r", 10).attr("class", `commit ${p.id} ${T}`), r.append("circle").attr("cx", _ - 3).attr("cy", m + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${p.id} ${T}`), r.append("circle").attr("cx", _ + 3).attr("cy", m + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${p.id} ${T}`), r.append("line").attr("x1", _ + 3).attr("y1", m + 1).attr("x2", _).attr("y2", m - 5).attr("stroke", "#fff").attr("class", `commit ${p.id} ${T}`), r.append("line").attr("x1", _ - 3).attr("y1", m + 1).attr("x2", _).attr("y2", m - 5).attr("stroke", "#fff").attr("class", `commit ${p.id} ${T}`);
      else {
        const A = r.append("circle");
        if (A.attr("cx", _), A.attr("cy", m), A.attr("r", p.type === Qe.MERGE ? 9 : 10), A.attr(
          "class",
          `commit ${p.id} commit${In[p.branch].index % ns}`
        ), v === Qe.MERGE) {
          const L = r.append("circle");
          L.attr("cx", _), L.attr("cy", m), L.attr("r", 6), L.attr(
            "class",
            `commit ${T} ${p.id} commit${In[p.branch].index % ns}`
          );
        }
        v === Qe.REVERSE && r.append("path").attr("d", `M ${_ - 5},${m - 5}L${_ + 5},${m + 5}M${_ - 5},${m + 5}L${_ + 5},${m - 5}`).attr(
          "class",
          `commit ${T} ${p.id} commit${In[p.branch].index % ns}`
        );
      }
    }
    if (Oe === "TB" ? fr[p.id] = { x: _, y } : fr[p.id] = { x: y, y: m }, n) {
      if (p.type !== Qe.CHERRY_PICK && (p.customId && p.type === Qe.MERGE || p.type !== Qe.MERGE) && i.showCommitLabel) {
        const A = s.append("g"), L = A.insert("rect").attr("class", "commit-label-bkg"), w = A.append("text").attr("x", a).attr("y", m + 25).attr("class", "commit-label").text(p.id);
        let b = w.node().getBBox();
        if (L.attr("x", y - b.width / 2 - 2).attr("y", m + 13.5).attr("width", b.width + 4).attr("height", b.height + 4), Oe === "TB" && (L.attr("x", _ - (b.width + 16 + 5)).attr("y", m - 12), w.attr("x", _ - (b.width + 16)).attr("y", m + b.height - 12)), Oe !== "TB" && w.attr("x", y - b.width / 2), i.rotateCommitLabel)
          if (Oe === "TB")
            w.attr("transform", "rotate(-45, " + _ + ", " + m + ")"), L.attr("transform", "rotate(-45, " + _ + ", " + m + ")");
          else {
            let F = -7.5 - (b.width + 10) / 25 * 9.5, S = 10 + b.width / 25 * 8.5;
            A.attr(
              "transform",
              "translate(" + F + ", " + S + ") rotate(-45, " + a + ", " + m + ")"
            );
          }
      }
      if (p.tag) {
        const A = s.insert("polygon"), L = s.append("circle"), w = s.append("text").attr("y", m - 16).attr("class", "tag-label").text(p.tag);
        let b = w.node().getBBox();
        w.attr("x", y - b.width / 2);
        const F = b.height / 2, S = m - 19.2;
        A.attr("class", "tag-label-bkg").attr(
          "points",
          `
          ${a - b.width / 2 - 4 / 2},${S + 2}
          ${a - b.width / 2 - 4 / 2},${S - 2}
          ${y - b.width / 2 - 4},${S - F - 2}
          ${y + b.width / 2 + 4},${S - F - 2}
          ${y + b.width / 2 + 4},${S + F + 2}
          ${y - b.width / 2 - 4},${S + F + 2}`
        ), L.attr("cx", a - b.width / 2 + 4 / 2).attr("cy", S).attr("r", 1.5).attr("class", "tag-hole"), Oe === "TB" && (A.attr("class", "tag-label-bkg").attr(
          "points",
          `
            ${_},${a + 2}
            ${_},${a - 2}
            ${_ + h},${a - F - 2}
            ${_ + h + b.width + 4},${a - F - 2}
            ${_ + h + b.width + 4},${a + F + 2}
            ${_ + h},${a + F + 2}`
        ).attr("transform", "translate(12,12) rotate(45, " + _ + "," + a + ")"), L.attr("cx", _ + 4 / 2).attr("cy", a).attr("transform", "translate(12,12) rotate(45, " + _ + "," + a + ")"), w.attr("x", _ + 5).attr("y", a + 3).attr("transform", "translate(14,14) rotate(45, " + _ + "," + a + ")"));
      }
    }
    a += f + h, a > ol && (ol = a);
  });
}, cW = (t, e, n, i, r) => {
  const a = (Oe === "TB" ? n.x < i.x : n.y < i.y) ? e.branch : t.branch, o = (u) => u.branch === a, l = (u) => u.seq > t.seq && u.seq < e.seq;
  return Object.values(r).some((u) => l(u) && o(u));
}, xo = (t, e, n = 0) => {
  const i = t + Math.abs(t - e) / 2;
  if (n > 5)
    return i;
  if (bu.every((a) => Math.abs(a - i) >= 10))
    return bu.push(i), i;
  const s = Math.abs(t - e);
  return xo(t, e - s / 5, n + 1);
}, uW = (t, e, n, i) => {
  const r = fr[e.id], s = fr[n.id], a = cW(e, n, r, s, i);
  let o = "", l = "", u = 0, h = 0, f = In[n.branch].index;
  n.type === Qe.MERGE && e.id !== n.parents[0] && (f = In[e.branch].index);
  let d;
  if (a) {
    o = "A 10 10, 0, 0, 0,", l = "A 10 10, 0, 0, 1,", u = 10, h = 10;
    const p = r.y < s.y ? xo(r.y, s.y) : xo(s.y, r.y), y = r.x < s.x ? xo(r.x, s.x) : xo(s.x, r.x);
    Oe === "TB" ? r.x < s.x ? d = `M ${r.x} ${r.y} L ${y - u} ${r.y} ${l} ${y} ${r.y + h} L ${y} ${s.y - u} ${o} ${y + h} ${s.y} L ${s.x} ${s.y}` : (f = In[e.branch].index, d = `M ${r.x} ${r.y} L ${y + u} ${r.y} ${o} ${y} ${r.y + h} L ${y} ${s.y - u} ${l} ${y - h} ${s.y} L ${s.x} ${s.y}`) : r.y < s.y ? d = `M ${r.x} ${r.y} L ${r.x} ${p - u} ${o} ${r.x + h} ${p} L ${s.x - u} ${p} ${l} ${s.x} ${p + h} L ${s.x} ${s.y}` : (f = In[e.branch].index, d = `M ${r.x} ${r.y} L ${r.x} ${p + u} ${l} ${r.x + h} ${p} L ${s.x - u} ${p} ${o} ${s.x} ${p - h} L ${s.x} ${s.y}`);
  } else
    o = "A 20 20, 0, 0, 0,", l = "A 20 20, 0, 0, 1,", u = 20, h = 20, Oe === "TB" ? (r.x < s.x && (n.type === Qe.MERGE && e.id !== n.parents[0] ? d = `M ${r.x} ${r.y} L ${r.x} ${s.y - u} ${o} ${r.x + h} ${s.y} L ${s.x} ${s.y}` : d = `M ${r.x} ${r.y} L ${s.x - u} ${r.y} ${l} ${s.x} ${r.y + h} L ${s.x} ${s.y}`), r.x > s.x && (o = "A 20 20, 0, 0, 0,", l = "A 20 20, 0, 0, 1,", u = 20, h = 20, n.type === Qe.MERGE && e.id !== n.parents[0] ? d = `M ${r.x} ${r.y} L ${r.x} ${s.y - u} ${l} ${r.x - h} ${s.y} L ${s.x} ${s.y}` : d = `M ${r.x} ${r.y} L ${s.x + u} ${r.y} ${o} ${s.x} ${r.y + h} L ${s.x} ${s.y}`), r.x === s.x && (d = `M ${r.x} ${r.y} L ${s.x} ${s.y}`)) : (r.y < s.y && (n.type === Qe.MERGE && e.id !== n.parents[0] ? d = `M ${r.x} ${r.y} L ${s.x - u} ${r.y} ${l} ${s.x} ${r.y + h} L ${s.x} ${s.y}` : d = `M ${r.x} ${r.y} L ${r.x} ${s.y - u} ${o} ${r.x + h} ${s.y} L ${s.x} ${s.y}`), r.y > s.y && (n.type === Qe.MERGE && e.id !== n.parents[0] ? d = `M ${r.x} ${r.y} L ${s.x - u} ${r.y} ${o} ${s.x} ${r.y - h} L ${s.x} ${s.y}` : d = `M ${r.x} ${r.y} L ${r.x} ${s.y + u} ${l} ${r.x + h} ${s.y} L ${s.x} ${s.y}`), r.y === s.y && (d = `M ${r.x} ${r.y} L ${s.x} ${s.y}`));
  t.append("path").attr("d", d).attr("class", "arrow arrow" + f % ns);
}, hW = (t, e) => {
  const n = t.append("g").attr("class", "commit-arrows");
  Object.keys(e).forEach((i) => {
    const r = e[i];
    r.parents && r.parents.length > 0 && r.parents.forEach((s) => {
      uW(n, e[s], r, e);
    });
  });
}, dW = (t, e) => {
  const n = Q().gitGraph, i = t.append("g");
  e.forEach((r, s) => {
    const a = s % ns, o = In[r.name].pos, l = i.append("line");
    l.attr("x1", 0), l.attr("y1", o), l.attr("x2", ol), l.attr("y2", o), l.attr("class", "branch branch" + a), Oe === "TB" && (l.attr("y1", 30), l.attr("x1", o), l.attr("y2", ol), l.attr("x2", o)), bu.push(o);
    let u = r.name;
    const h = h_(u), f = i.insert("rect"), p = i.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + a);
    p.node().appendChild(h);
    let y = h.getBBox();
    f.attr("class", "branchLabelBkg label" + a).attr("rx", 4).attr("ry", 4).attr("x", -y.width - 4 - (n.rotateCommitLabel === !0 ? 30 : 0)).attr("y", -y.height / 2 + 8).attr("width", y.width + 18).attr("height", y.height + 4), p.attr(
      "transform",
      "translate(" + (-y.width - 14 - (n.rotateCommitLabel === !0 ? 30 : 0)) + ", " + (o - y.height / 2 - 1) + ")"
    ), Oe === "TB" && (f.attr("x", o - y.width / 2 - 10).attr("y", 0), p.attr("transform", "translate(" + (o - y.width / 2 - 5) + ", 0)")), Oe !== "TB" && f.attr("transform", "translate(-19, " + (o - y.height / 2) + ")");
  });
}, fW = function(t, e, n, i) {
  oW();
  const r = Q(), s = r.gitGraph;
  z.debug("in gitgraph renderer", t + `
`, "id:", e, n), mo = i.db.getCommits();
  const a = i.db.getBranchesAsObjArray();
  Oe = i.db.getDirection();
  const o = yt(`[id="${e}"]`);
  let l = 0;
  a.forEach((u, h) => {
    const f = h_(u.name), d = o.append("g"), p = d.insert("g").attr("class", "branchLabel"), y = p.insert("g").attr("class", "label branch-label");
    y.node().appendChild(f);
    let m = f.getBBox();
    In[u.name] = { pos: l, index: h }, l += 50 + (s.rotateCommitLabel ? 40 : 0) + (Oe === "TB" ? m.width / 2 : 0), y.remove(), p.remove(), d.remove();
  }), V2(o, mo, !1), s.showBranches && dW(o, a), hW(o, mo), V2(o, mo, !0), Gt.insertTitle(
    o,
    "gitTitleText",
    s.titleTopMargin,
    i.db.getDiagramTitle()
  ), hb(
    void 0,
    o,
    s.diagramPadding,
    s.useMaxWidth ?? r.useMaxWidth
  );
}, pW = {
  draw: fW
}, gW = (t) => `
  .commit-id,
  .commit-msg,
  .branch-label {
    fill: lightgrey;
    color: lightgrey;
    font-family: 'trebuchet ms', verdana, arial, sans-serif;
    font-family: var(--mermaid-font-family);
  }
  ${[0, 1, 2, 3, 4, 5, 6, 7].map(
  (e) => `
        .branch-label${e} { fill: ${t["gitBranchLabel" + e]}; }
        .commit${e} { stroke: ${t["git" + e]}; fill: ${t["git" + e]}; }
        .commit-highlight${e} { stroke: ${t["gitInv" + e]}; fill: ${t["gitInv" + e]}; }
        .label${e}  { fill: ${t["git" + e]}; }
        .arrow${e} { stroke: ${t["git" + e]}; }
        `
).join(`
`)}

  .branch {
    stroke-width: 1;
    stroke: ${t.lineColor};
    stroke-dasharray: 2;
  }
  .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
  .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
  .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
  .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
  .tag-hole { fill: ${t.textColor}; }

  .commit-merge {
    stroke: ${t.primaryColor};
    fill: ${t.primaryColor};
  }
  .commit-reverse {
    stroke: ${t.primaryColor};
    fill: ${t.primaryColor};
    stroke-width: 3;
  }
  .commit-highlight-outer {
  }
  .commit-highlight-inner {
    stroke: ${t.primaryColor};
    fill: ${t.primaryColor};
  }

  .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
  .gitTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.textColor};
  }
`, yW = gW, mW = {
  parser: $Y,
  db: aW,
  renderer: pW,
  styles: yW
}, xW = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: mW
}, Symbol.toStringTag, { value: "Module" }));
var Tc = { exports: {} }, bW = Tc.exports, q2;
function _W() {
  return q2 || (q2 = 1, (function(t, e) {
    (function(n, i) {
      t.exports = i();
    })(bW, (function() {
      var n = "day";
      return function(i, r, s) {
        var a = function(u) {
          return u.add(4 - u.isoWeekday(), n);
        }, o = r.prototype;
        o.isoWeekYear = function() {
          return a(this).year();
        }, o.isoWeek = function(u) {
          if (!this.$utils().u(u)) return this.add(7 * (u - this.isoWeek()), n);
          var h, f, d, p, y = a(this), m = (h = this.isoWeekYear(), f = this.$u, d = (f ? s.utc : s)().year(h).startOf("year"), p = 4 - d.isoWeekday(), d.isoWeekday() > 4 && (p += 7), d.add(p, n));
          return y.diff(m, "week") + 1;
        }, o.isoWeekday = function(u) {
          return this.$utils().u(u) ? this.day() || 7 : this.day(this.day() % 7 ? u : u - 7);
        };
        var l = o.startOf;
        o.startOf = function(u, h) {
          var f = this.$utils(), d = !!f.u(h) || h;
          return f.p(u) === "isoweek" ? d ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : l.bind(this)(u, h);
        };
      };
    }));
  })(Tc)), Tc.exports;
}
var kW = _W();
const TW = /* @__PURE__ */ Nu(kW);
var wc = { exports: {} }, wW = wc.exports, $2;
function vW() {
  return $2 || ($2 = 1, (function(t, e) {
    (function(n, i) {
      t.exports = i();
    })(wW, (function() {
      var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, i = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, r = /\d/, s = /\d\d/, a = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, l = {}, u = function(_) {
        return (_ = +_) + (_ > 68 ? 1900 : 2e3);
      }, h = function(_) {
        return function(T) {
          this[_] = +T;
        };
      }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(_) {
        (this.zone || (this.zone = {})).offset = (function(T) {
          if (!T || T === "Z") return 0;
          var v = T.match(/([+-]|\d\d)/g), A = 60 * v[1] + (+v[2] || 0);
          return A === 0 ? 0 : v[0] === "+" ? -A : A;
        })(_);
      }], d = function(_) {
        var T = l[_];
        return T && (T.indexOf ? T : T.s.concat(T.f));
      }, p = function(_, T) {
        var v, A = l.meridiem;
        if (A) {
          for (var L = 1; L <= 24; L += 1) if (_.indexOf(A(L, 0, T)) > -1) {
            v = L > 12;
            break;
          }
        } else v = _ === (T ? "pm" : "PM");
        return v;
      }, y = { A: [o, function(_) {
        this.afternoon = p(_, !1);
      }], a: [o, function(_) {
        this.afternoon = p(_, !0);
      }], Q: [r, function(_) {
        this.month = 3 * (_ - 1) + 1;
      }], S: [r, function(_) {
        this.milliseconds = 100 * +_;
      }], SS: [s, function(_) {
        this.milliseconds = 10 * +_;
      }], SSS: [/\d{3}/, function(_) {
        this.milliseconds = +_;
      }], s: [a, h("seconds")], ss: [a, h("seconds")], m: [a, h("minutes")], mm: [a, h("minutes")], H: [a, h("hours")], h: [a, h("hours")], HH: [a, h("hours")], hh: [a, h("hours")], D: [a, h("day")], DD: [s, h("day")], Do: [o, function(_) {
        var T = l.ordinal, v = _.match(/\d+/);
        if (this.day = v[0], T) for (var A = 1; A <= 31; A += 1) T(A).replace(/\[|\]/g, "") === _ && (this.day = A);
      }], w: [a, h("week")], ww: [s, h("week")], M: [a, h("month")], MM: [s, h("month")], MMM: [o, function(_) {
        var T = d("months"), v = (d("monthsShort") || T.map((function(A) {
          return A.slice(0, 3);
        }))).indexOf(_) + 1;
        if (v < 1) throw new Error();
        this.month = v % 12 || v;
      }], MMMM: [o, function(_) {
        var T = d("months").indexOf(_) + 1;
        if (T < 1) throw new Error();
        this.month = T % 12 || T;
      }], Y: [/[+-]?\d+/, h("year")], YY: [s, function(_) {
        this.year = u(_);
      }], YYYY: [/\d{4}/, h("year")], Z: f, ZZ: f };
      function m(_) {
        var T, v;
        T = _, v = l && l.formats;
        for (var A = (_ = T.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(C, g, I) {
          var k = I && I.toUpperCase();
          return g || v[I] || n[I] || v[k].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(P, R, M) {
            return R || M.slice(1);
          }));
        }))).match(i), L = A.length, w = 0; w < L; w += 1) {
          var b = A[w], F = y[b], S = F && F[0], x = F && F[1];
          A[w] = x ? { regex: S, parser: x } : b.replace(/^\[|\]$/g, "");
        }
        return function(C) {
          for (var g = {}, I = 0, k = 0; I < L; I += 1) {
            var P = A[I];
            if (typeof P == "string") k += P.length;
            else {
              var R = P.regex, M = P.parser, B = C.slice(k), N = R.exec(B)[0];
              M.call(g, N), C = C.replace(N, "");
            }
          }
          return (function(D) {
            var E = D.afternoon;
            if (E !== void 0) {
              var V = D.hours;
              E ? V < 12 && (D.hours += 12) : V === 12 && (D.hours = 0), delete D.afternoon;
            }
          })(g), g;
        };
      }
      return function(_, T, v) {
        v.p.customParseFormat = !0, _ && _.parseTwoDigitYear && (u = _.parseTwoDigitYear);
        var A = T.prototype, L = A.parse;
        A.parse = function(w) {
          var b = w.date, F = w.utc, S = w.args;
          this.$u = F;
          var x = S[1];
          if (typeof x == "string") {
            var C = S[2] === !0, g = S[3] === !0, I = C || g, k = S[2];
            g && (k = S[2]), l = this.$locale(), !C && k && (l = v.Ls[k]), this.$d = (function(B, N, D, E) {
              try {
                if (["x", "X"].indexOf(N) > -1) return new Date((N === "X" ? 1e3 : 1) * B);
                var V = m(N)(B), nt = V.year, O = V.month, ct = V.day, X = V.hours, H = V.minutes, it = V.seconds, ot = V.milliseconds, W = V.zone, Z = V.week, q = /* @__PURE__ */ new Date(), G = ct || (nt || O ? 1 : q.getDate()), U = nt || q.getFullYear(), ht = 0;
                nt && !O || (ht = O > 0 ? O - 1 : q.getMonth());
                var Y, wt = X || 0, J = H || 0, Ct = it || 0, Tt = ot || 0;
                return W ? new Date(Date.UTC(U, ht, G, wt, J, Ct, Tt + 60 * W.offset * 1e3)) : D ? new Date(Date.UTC(U, ht, G, wt, J, Ct, Tt)) : (Y = new Date(U, ht, G, wt, J, Ct, Tt), Z && (Y = E(Y).week(Z).toDate()), Y);
              } catch {
                return /* @__PURE__ */ new Date("");
              }
            })(b, x, F, v), this.init(), k && k !== !0 && (this.$L = this.locale(k).$L), I && b != this.format(x) && (this.$d = /* @__PURE__ */ new Date("")), l = {};
          } else if (x instanceof Array) for (var P = x.length, R = 1; R <= P; R += 1) {
            S[1] = x[R - 1];
            var M = v.apply(this, S);
            if (M.isValid()) {
              this.$d = M.$d, this.$L = M.$L, this.init();
              break;
            }
            R === P && (this.$d = /* @__PURE__ */ new Date(""));
          }
          else L.call(this, w);
        };
      };
    }));
  })(wc)), wc.exports;
}
var EW = vW();
const CW = /* @__PURE__ */ Nu(EW);
var vc = { exports: {} }, SW = vc.exports, Y2;
function AW() {
  return Y2 || (Y2 = 1, (function(t, e) {
    (function(n, i) {
      t.exports = i();
    })(SW, (function() {
      return function(n, i) {
        var r = i.prototype, s = r.format;
        r.format = function(a) {
          var o = this, l = this.$locale();
          if (!this.isValid()) return s.bind(this)(a);
          var u = this.$utils(), h = (a || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, (function(f) {
            switch (f) {
              case "Q":
                return Math.ceil((o.$M + 1) / 3);
              case "Do":
                return l.ordinal(o.$D);
              case "gggg":
                return o.weekYear();
              case "GGGG":
                return o.isoWeekYear();
              case "wo":
                return l.ordinal(o.week(), "W");
              case "w":
              case "ww":
                return u.s(o.week(), f === "w" ? 1 : 2, "0");
              case "W":
              case "WW":
                return u.s(o.isoWeek(), f === "W" ? 1 : 2, "0");
              case "k":
              case "kk":
                return u.s(String(o.$H === 0 ? 24 : o.$H), f === "k" ? 1 : 2, "0");
              case "X":
                return Math.floor(o.$d.getTime() / 1e3);
              case "x":
                return o.$d.getTime();
              case "z":
                return "[" + o.offsetName() + "]";
              case "zzz":
                return "[" + o.offsetName("long") + "]";
              default:
                return f;
            }
          }));
          return s.bind(this)(h);
        };
      };
    }));
  })(vc)), vc.exports;
}
var LW = AW();
const IW = /* @__PURE__ */ Nu(LW);
var w1 = (function() {
  var t = function(g, I, k, P) {
    for (k = k || {}, P = g.length; P--; k[g[P]] = I)
      ;
    return k;
  }, e = [6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 32, 33, 35, 37], n = [1, 25], i = [1, 26], r = [1, 27], s = [1, 28], a = [1, 29], o = [1, 30], l = [1, 31], u = [1, 9], h = [1, 10], f = [1, 11], d = [1, 12], p = [1, 13], y = [1, 14], m = [1, 15], _ = [1, 16], T = [1, 18], v = [1, 19], A = [1, 20], L = [1, 21], w = [1, 22], b = [1, 24], F = [1, 32], S = {
    trace: function() {
    },
    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, dateFormat: 19, inclusiveEndDates: 20, topAxis: 21, axisFormat: 22, tickInterval: 23, excludes: 24, includes: 25, todayMarker: 26, title: 27, acc_title: 28, acc_title_value: 29, acc_descr: 30, acc_descr_value: 31, acc_descr_multiline_value: 32, section: 33, clickStatement: 34, taskTxt: 35, taskData: 36, click: 37, callbackname: 38, callbackargs: 39, href: 40, clickStatementDebug: 41, $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", 19: "dateFormat", 20: "inclusiveEndDates", 21: "topAxis", 22: "axisFormat", 23: "tickInterval", 24: "excludes", 25: "includes", 26: "todayMarker", 27: "title", 28: "acc_title", 29: "acc_title_value", 30: "acc_descr", 31: "acc_descr_value", 32: "acc_descr_multiline_value", 33: "section", 35: "taskTxt", 36: "taskData", 37: "click", 38: "callbackname", 39: "callbackargs", 40: "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], [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], [34, 2], [34, 3], [34, 3], [34, 4], [34, 3], [34, 4], [34, 2], [41, 2], [41, 3], [41, 3], [41, 4], [41, 3], [41, 4], [41, 2]],
    performAction: function(I, k, P, R, M, B, N) {
      var D = B.length - 1;
      switch (M) {
        case 1:
          return B[D - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          B[D - 1].push(B[D]), this.$ = B[D - 1];
          break;
        case 4:
        case 5:
          this.$ = B[D];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          R.setWeekday("monday");
          break;
        case 9:
          R.setWeekday("tuesday");
          break;
        case 10:
          R.setWeekday("wednesday");
          break;
        case 11:
          R.setWeekday("thursday");
          break;
        case 12:
          R.setWeekday("friday");
          break;
        case 13:
          R.setWeekday("saturday");
          break;
        case 14:
          R.setWeekday("sunday");
          break;
        case 15:
          R.setDateFormat(B[D].substr(11)), this.$ = B[D].substr(11);
          break;
        case 16:
          R.enableInclusiveEndDates(), this.$ = B[D].substr(18);
          break;
        case 17:
          R.TopAxis(), this.$ = B[D].substr(8);
          break;
        case 18:
          R.setAxisFormat(B[D].substr(11)), this.$ = B[D].substr(11);
          break;
        case 19:
          R.setTickInterval(B[D].substr(13)), this.$ = B[D].substr(13);
          break;
        case 20:
          R.setExcludes(B[D].substr(9)), this.$ = B[D].substr(9);
          break;
        case 21:
          R.setIncludes(B[D].substr(9)), this.$ = B[D].substr(9);
          break;
        case 22:
          R.setTodayMarker(B[D].substr(12)), this.$ = B[D].substr(12);
          break;
        case 24:
          R.setDiagramTitle(B[D].substr(6)), this.$ = B[D].substr(6);
          break;
        case 25:
          this.$ = B[D].trim(), R.setAccTitle(this.$);
          break;
        case 26:
        case 27:
          this.$ = B[D].trim(), R.setAccDescription(this.$);
          break;
        case 28:
          R.addSection(B[D].substr(8)), this.$ = B[D].substr(8);
          break;
        case 30:
          R.addTask(B[D - 1], B[D]), this.$ = "task";
          break;
        case 31:
          this.$ = B[D - 1], R.setClickEvent(B[D - 1], B[D], null);
          break;
        case 32:
          this.$ = B[D - 2], R.setClickEvent(B[D - 2], B[D - 1], B[D]);
          break;
        case 33:
          this.$ = B[D - 2], R.setClickEvent(B[D - 2], B[D - 1], null), R.setLink(B[D - 2], B[D]);
          break;
        case 34:
          this.$ = B[D - 3], R.setClickEvent(B[D - 3], B[D - 2], B[D - 1]), R.setLink(B[D - 3], B[D]);
          break;
        case 35:
          this.$ = B[D - 2], R.setClickEvent(B[D - 2], B[D], null), R.setLink(B[D - 2], B[D - 1]);
          break;
        case 36:
          this.$ = B[D - 3], R.setClickEvent(B[D - 3], B[D - 1], B[D]), R.setLink(B[D - 3], B[D - 2]);
          break;
        case 37:
          this.$ = B[D - 1], R.setLink(B[D - 1], B[D]);
          break;
        case 38:
        case 44:
          this.$ = B[D - 1] + " " + B[D];
          break;
        case 39:
        case 40:
        case 42:
          this.$ = B[D - 2] + " " + B[D - 1] + " " + B[D];
          break;
        case 41:
        case 43:
          this.$ = B[D - 3] + " " + B[D - 2] + " " + B[D - 1] + " " + B[D];
          break;
      }
    },
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 17, 12: n, 13: i, 14: r, 15: s, 16: a, 17: o, 18: l, 19: u, 20: h, 21: f, 22: d, 23: p, 24: y, 25: m, 26: _, 27: T, 28: v, 30: A, 32: L, 33: w, 34: 23, 35: b, 37: F }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 33, 11: 17, 12: n, 13: i, 14: r, 15: s, 16: a, 17: o, 18: l, 19: u, 20: h, 21: f, 22: d, 23: p, 24: y, 25: m, 26: _, 27: T, 28: v, 30: A, 32: L, 33: w, 34: 23, 35: b, 37: F }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 15]), t(e, [2, 16]), t(e, [2, 17]), t(e, [2, 18]), t(e, [2, 19]), t(e, [2, 20]), t(e, [2, 21]), t(e, [2, 22]), t(e, [2, 23]), t(e, [2, 24]), { 29: [1, 34] }, { 31: [1, 35] }, t(e, [2, 27]), t(e, [2, 28]), t(e, [2, 29]), { 36: [1, 36] }, t(e, [2, 8]), t(e, [2, 9]), t(e, [2, 10]), t(e, [2, 11]), t(e, [2, 12]), t(e, [2, 13]), t(e, [2, 14]), { 38: [1, 37], 40: [1, 38] }, t(e, [2, 4]), t(e, [2, 25]), t(e, [2, 26]), t(e, [2, 30]), t(e, [2, 31], { 39: [1, 39], 40: [1, 40] }), t(e, [2, 37], { 38: [1, 41] }), t(e, [2, 32], { 40: [1, 42] }), t(e, [2, 33]), t(e, [2, 35], { 39: [1, 43] }), t(e, [2, 34]), t(e, [2, 36])],
    defaultActions: {},
    parseError: function(I, k) {
      if (k.recoverable)
        this.trace(I);
      else {
        var P = new Error(I);
        throw P.hash = k, P;
      }
    },
    parse: function(I) {
      var k = this, P = [0], R = [], M = [null], B = [], N = this.table, D = "", E = 0, V = 0, nt = 2, O = 1, ct = B.slice.call(arguments, 1), X = Object.create(this.lexer), H = { yy: {} };
      for (var it in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, it) && (H.yy[it] = this.yy[it]);
      X.setInput(I, H.yy), H.yy.lexer = X, H.yy.parser = this, typeof X.yylloc > "u" && (X.yylloc = {});
      var ot = X.yylloc;
      B.push(ot);
      var W = X.options && X.options.ranges;
      typeof H.yy.parseError == "function" ? this.parseError = H.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function Z() {
        var Rt;
        return Rt = R.pop() || X.lex() || O, typeof Rt != "number" && (Rt instanceof Array && (R = Rt, Rt = R.pop()), Rt = k.symbols_[Rt] || Rt), Rt;
      }
      for (var q, G, U, ht, Y = {}, wt, J, Ct, Tt; ; ) {
        if (G = P[P.length - 1], this.defaultActions[G] ? U = this.defaultActions[G] : ((q === null || typeof q > "u") && (q = Z()), U = N[G] && N[G][q]), typeof U > "u" || !U.length || !U[0]) {
          var $t = "";
          Tt = [];
          for (wt in N[G])
            this.terminals_[wt] && wt > nt && Tt.push("'" + this.terminals_[wt] + "'");
          X.showPosition ? $t = "Parse error on line " + (E + 1) + `:
` + X.showPosition() + `
Expecting ` + Tt.join(", ") + ", got '" + (this.terminals_[q] || q) + "'" : $t = "Parse error on line " + (E + 1) + ": Unexpected " + (q == O ? "end of input" : "'" + (this.terminals_[q] || q) + "'"), this.parseError($t, {
            text: X.match,
            token: this.terminals_[q] || q,
            line: X.yylineno,
            loc: ot,
            expected: Tt
          });
        }
        if (U[0] instanceof Array && U.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + G + ", token: " + q);
        switch (U[0]) {
          case 1:
            P.push(q), M.push(X.yytext), B.push(X.yylloc), P.push(U[1]), q = null, V = X.yyleng, D = X.yytext, E = X.yylineno, ot = X.yylloc;
            break;
          case 2:
            if (J = this.productions_[U[1]][1], Y.$ = M[M.length - J], Y._$ = {
              first_line: B[B.length - (J || 1)].first_line,
              last_line: B[B.length - 1].last_line,
              first_column: B[B.length - (J || 1)].first_column,
              last_column: B[B.length - 1].last_column
            }, W && (Y._$.range = [
              B[B.length - (J || 1)].range[0],
              B[B.length - 1].range[1]
            ]), ht = this.performAction.apply(Y, [
              D,
              V,
              E,
              H.yy,
              U[1],
              M,
              B
            ].concat(ct)), typeof ht < "u")
              return ht;
            J && (P = P.slice(0, -1 * J * 2), M = M.slice(0, -1 * J), B = B.slice(0, -1 * J)), P.push(this.productions_[U[1]][0]), M.push(Y.$), B.push(Y._$), Ct = N[P[P.length - 2]][P[P.length - 1]], P.push(Ct);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, x = /* @__PURE__ */ (function() {
    var g = {
      EOF: 1,
      parseError: function(k, P) {
        if (this.yy.parser)
          this.yy.parser.parseError(k, P);
        else
          throw new Error(k);
      },
      // resets the lexer, sets new input
      setInput: function(I, k) {
        return this.yy = k || this.yy || {}, this._input = I, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var I = this._input[0];
        this.yytext += I, this.yyleng++, this.offset++, this.match += I, this.matched += I;
        var k = I.match(/(?:\r\n?|\n).*/g);
        return k ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), I;
      },
      // unshifts one char (or a string) into the input
      unput: function(I) {
        var k = I.length, P = I.split(/(?:\r\n?|\n)/g);
        this._input = I + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - k), this.offset -= k;
        var R = this.match.split(/(?:\r\n?|\n)/g);
        this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), P.length - 1 && (this.yylineno -= P.length - 1);
        var M = 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 === R.length ? this.yylloc.first_column : 0) + R[R.length - P.length].length - P[0].length : this.yylloc.first_column - k
        }, this.options.ranges && (this.yylloc.range = [M[0], M[0] + this.yyleng - k]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(I) {
        this.unput(this.match.slice(I));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var I = this.matched.substr(0, this.matched.length - this.match.length);
        return (I.length > 20 ? "..." : "") + I.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var I = this.match;
        return I.length < 20 && (I += this._input.substr(0, 20 - I.length)), (I.substr(0, 20) + (I.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var I = this.pastInput(), k = new Array(I.length + 1).join("-");
        return I + this.upcomingInput() + `
` + k + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(I, k) {
        var P, R, M;
        if (this.options.backtrack_lexer && (M = {
          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 && (M.yylloc.range = this.yylloc.range.slice(0))), R = I[0].match(/(?:\r\n?|\n).*/g), R && (this.yylineno += R.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: R ? R[R.length - 1].length - R[R.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + I[0].length
        }, this.yytext += I[0], this.match += I[0], this.matches = I, 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(I[0].length), this.matched += I[0], P = this.performAction.call(this, this.yy, this, k, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), P)
          return P;
        if (this._backtrack) {
          for (var B in M)
            this[B] = M[B];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var I, k, P, R;
        this._more || (this.yytext = "", this.match = "");
        for (var M = this._currentRules(), B = 0; B < M.length; B++)
          if (P = this._input.match(this.rules[M[B]]), P && (!k || P[0].length > k[0].length)) {
            if (k = P, R = B, this.options.backtrack_lexer) {
              if (I = this.test_match(P, M[B]), I !== !1)
                return I;
              if (this._backtrack) {
                k = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return k ? (I = this.test_match(k, M[R]), I !== !1 ? I : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var k = this.next();
        return k || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(k) {
        this.conditionStack.push(k);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var k = this.conditionStack.length - 1;
        return k > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(k) {
        return k = this.conditionStack.length - 1 - Math.abs(k || 0), k >= 0 ? this.conditionStack[k] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(k) {
        this.begin(k);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(k, P, R, M) {
        switch (R) {
          case 0:
            return this.begin("open_directive"), "open_directive";
          case 1:
            return this.begin("acc_title"), 28;
          case 2:
            return this.popState(), "acc_title_value";
          case 3:
            return this.begin("acc_descr"), 30;
          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 40;
          case 17:
            this.begin("callbackname");
            break;
          case 18:
            this.popState();
            break;
          case 19:
            this.popState(), this.begin("callbackargs");
            break;
          case 20:
            return 38;
          case 21:
            this.popState();
            break;
          case 22:
            return 39;
          case 23:
            this.begin("click");
            break;
          case 24:
            this.popState();
            break;
          case 25:
            return 37;
          case 26:
            return 4;
          case 27:
            return 19;
          case 28:
            return 20;
          case 29:
            return 21;
          case 30:
            return 22;
          case 31:
            return 23;
          case 32:
            return 25;
          case 33:
            return 24;
          case 34:
            return 26;
          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 "date";
          case 43:
            return 27;
          case 44:
            return "accDescription";
          case 45:
            return 33;
          case 46:
            return 35;
          case 47:
            return 36;
          case 48:
            return ":";
          case 49:
            return 6;
          case 50:
            return "INVALID";
        }
      },
      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, /^(?:\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], inclusive: !0 } }
    };
    return g;
  })();
  S.lexer = x;
  function C() {
    this.yy = {};
  }
  return C.prototype = S, S.Parser = C, new C();
})();
w1.parser = w1;
const BW = w1;
ln.extend(TW);
ln.extend(CW);
ln.extend(IW);
let zi = "", x0 = "", b0, _0 = "", Dl = [], Nl = [], k0 = {}, T0 = [], _u = [], Da = "", w0 = "";
const d_ = ["active", "done", "crit", "milestone"];
let v0 = [], Fl = !1, E0 = !1, C0 = "sunday", v1 = 0;
const DW = function() {
  T0 = [], _u = [], Da = "", v0 = [], Ec = 0, C1 = void 0, Cc = void 0, Ye = [], zi = "", x0 = "", w0 = "", b0 = void 0, _0 = "", Dl = [], Nl = [], Fl = !1, E0 = !1, v1 = 0, k0 = {}, fn(), C0 = "sunday";
}, NW = function(t) {
  x0 = t;
}, FW = function() {
  return x0;
}, OW = function(t) {
  b0 = t;
}, RW = function() {
  return b0;
}, MW = function(t) {
  _0 = t;
}, PW = function() {
  return _0;
}, zW = function(t) {
  zi = t;
}, VW = function() {
  Fl = !0;
}, qW = function() {
  return Fl;
}, $W = function() {
  E0 = !0;
}, YW = function() {
  return E0;
}, WW = function(t) {
  w0 = t;
}, UW = function() {
  return w0;
}, HW = function() {
  return zi;
}, GW = function(t) {
  Dl = t.toLowerCase().split(/[\s,]+/);
}, jW = function() {
  return Dl;
}, XW = function(t) {
  Nl = t.toLowerCase().split(/[\s,]+/);
}, KW = function() {
  return Nl;
}, QW = function() {
  return k0;
}, ZW = function(t) {
  Da = t, T0.push(t);
}, JW = function() {
  return T0;
}, tU = function() {
  let t = W2();
  const e = 10;
  let n = 0;
  for (; !t && n < e; )
    t = W2(), n++;
  return _u = Ye, _u;
}, f_ = function(t, e, n, i) {
  return i.includes(t.format(e.trim())) ? !1 : t.isoWeekday() >= 6 && n.includes("weekends") || n.includes(t.format("dddd").toLowerCase()) ? !0 : n.includes(t.format(e.trim()));
}, eU = function(t) {
  C0 = t;
}, nU = function() {
  return C0;
}, p_ = function(t, e, n, i) {
  if (!n.length || t.manualEndTime)
    return;
  let r;
  t.startTime instanceof Date ? r = ln(t.startTime) : r = ln(t.startTime, e, !0), r = r.add(1, "d");
  let s;
  t.endTime instanceof Date ? s = ln(t.endTime) : s = ln(t.endTime, e, !0);
  const [a, o] = iU(
    r,
    s,
    e,
    n,
    i
  );
  t.endTime = a.toDate(), t.renderEndTime = o;
}, iU = function(t, e, n, i, r) {
  let s = !1, a = null;
  for (; t <= e; )
    s || (a = e.toDate()), s = f_(t, n, i, r), s && (e = e.add(1, "d")), t = t.add(1, "d");
  return [e, a];
}, E1 = function(t, e, n) {
  n = n.trim();
  const r = /^after\s+(?<ids>[\d\w- ]+)/.exec(n);
  if (r !== null) {
    let a = null;
    for (const l of r.groups.ids.split(" ")) {
      let u = $s(l);
      u !== void 0 && (!a || u.endTime > a.endTime) && (a = u);
    }
    if (a)
      return a.endTime;
    const o = /* @__PURE__ */ new Date();
    return o.setHours(0, 0, 0, 0), o;
  }
  let s = ln(n, e.trim(), !0);
  if (s.isValid())
    return s.toDate();
  {
    z.debug("Invalid date:" + n), z.debug("With date format:" + e.trim());
    const a = new Date(n);
    if (a === void 0 || isNaN(a.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.
    a.getFullYear() < -1e4 || a.getFullYear() > 1e4)
      throw new Error("Invalid date:" + n);
    return a;
  }
}, g_ = function(t) {
  const e = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim());
  return e !== null ? [Number.parseFloat(e[1]), e[2]] : [NaN, "ms"];
}, y_ = function(t, e, n, i = !1) {
  n = n.trim();
  const s = /^until\s+(?<ids>[\d\w- ]+)/.exec(n);
  if (s !== null) {
    let h = null;
    for (const d of s.groups.ids.split(" ")) {
      let p = $s(d);
      p !== void 0 && (!h || p.startTime < h.startTime) && (h = p);
    }
    if (h)
      return h.startTime;
    const f = /* @__PURE__ */ new Date();
    return f.setHours(0, 0, 0, 0), f;
  }
  let a = ln(n, e.trim(), !0);
  if (a.isValid())
    return i && (a = a.add(1, "d")), a.toDate();
  let o = ln(t);
  const [l, u] = g_(n);
  if (!Number.isNaN(l)) {
    const h = o.add(l, u);
    h.isValid() && (o = h);
  }
  return o.toDate();
};
let Ec = 0;
const da = function(t) {
  return t === void 0 ? (Ec = Ec + 1, "task" + Ec) : t;
}, rU = function(t, e) {
  let n;
  e.substr(0, 1) === ":" ? n = e.substr(1, e.length) : n = e;
  const i = n.split(","), r = {};
  __(i, r, d_);
  for (let a = 0; a < i.length; a++)
    i[a] = i[a].trim();
  let s = "";
  switch (i.length) {
    case 1:
      r.id = da(), r.startTime = t.endTime, s = i[0];
      break;
    case 2:
      r.id = da(), r.startTime = E1(void 0, zi, i[0]), s = i[1];
      break;
    case 3:
      r.id = da(i[0]), r.startTime = E1(void 0, zi, i[1]), s = i[2];
      break;
  }
  return s && (r.endTime = y_(r.startTime, zi, s, Fl), r.manualEndTime = ln(s, "YYYY-MM-DD", !0).isValid(), p_(r, zi, Nl, Dl)), r;
}, sU = function(t, e) {
  let n;
  e.substr(0, 1) === ":" ? n = e.substr(1, e.length) : n = e;
  const i = n.split(","), r = {};
  __(i, r, d_);
  for (let s = 0; s < i.length; s++)
    i[s] = i[s].trim();
  switch (i.length) {
    case 1:
      r.id = da(), r.startTime = {
        type: "prevTaskEnd",
        id: t
      }, r.endTime = {
        data: i[0]
      };
      break;
    case 2:
      r.id = da(), r.startTime = {
        type: "getStartDate",
        startData: i[0]
      }, r.endTime = {
        data: i[1]
      };
      break;
    case 3:
      r.id = da(i[0]), r.startTime = {
        type: "getStartDate",
        startData: i[1]
      }, r.endTime = {
        data: i[2]
      };
      break;
  }
  return r;
};
let C1, Cc, Ye = [];
const m_ = {}, aU = function(t, e) {
  const n = {
    section: Da,
    type: Da,
    processed: !1,
    manualEndTime: !1,
    renderEndTime: null,
    raw: { data: e },
    task: t,
    classes: []
  }, i = sU(Cc, e);
  n.raw.startTime = i.startTime, n.raw.endTime = i.endTime, n.id = i.id, n.prevTaskId = Cc, n.active = i.active, n.done = i.done, n.crit = i.crit, n.milestone = i.milestone, n.order = v1, v1++;
  const r = Ye.push(n);
  Cc = n.id, m_[n.id] = r - 1;
}, $s = function(t) {
  const e = m_[t];
  return Ye[e];
}, oU = function(t, e) {
  const n = {
    section: Da,
    type: Da,
    description: t,
    task: t,
    classes: []
  }, i = rU(C1, e);
  n.startTime = i.startTime, n.endTime = i.endTime, n.id = i.id, n.active = i.active, n.done = i.done, n.crit = i.crit, n.milestone = i.milestone, C1 = n, _u.push(n);
}, W2 = function() {
  const t = function(n) {
    const i = Ye[n];
    let r = "";
    switch (Ye[n].raw.startTime.type) {
      case "prevTaskEnd": {
        const s = $s(i.prevTaskId);
        i.startTime = s.endTime;
        break;
      }
      case "getStartDate":
        r = E1(void 0, zi, Ye[n].raw.startTime.startData), r && (Ye[n].startTime = r);
        break;
    }
    return Ye[n].startTime && (Ye[n].endTime = y_(
      Ye[n].startTime,
      zi,
      Ye[n].raw.endTime.data,
      Fl
    ), Ye[n].endTime && (Ye[n].processed = !0, Ye[n].manualEndTime = ln(
      Ye[n].raw.endTime.data,
      "YYYY-MM-DD",
      !0
    ).isValid(), p_(Ye[n], zi, Nl, Dl))), Ye[n].processed;
  };
  let e = !0;
  for (const [n, i] of Ye.entries())
    t(n), e = e && i.processed;
  return e;
}, lU = function(t, e) {
  let n = e;
  Q().securityLevel !== "loose" && (n = As.sanitizeUrl(e)), t.split(",").forEach(function(i) {
    $s(i) !== void 0 && (b_(i, () => {
      window.open(n, "_self");
    }), k0[i] = n);
  }), x_(t, "clickable");
}, x_ = function(t, e) {
  t.split(",").forEach(function(n) {
    let i = $s(n);
    i !== void 0 && i.classes.push(e);
  });
}, cU = function(t, e, n) {
  if (Q().securityLevel !== "loose" || e === void 0)
    return;
  let i = [];
  if (typeof n == "string") {
    i = n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
    for (let s = 0; s < i.length; s++) {
      let a = i[s].trim();
      a.charAt(0) === '"' && a.charAt(a.length - 1) === '"' && (a = a.substr(1, a.length - 2)), i[s] = a;
    }
  }
  i.length === 0 && i.push(t), $s(t) !== void 0 && b_(t, () => {
    Gt.runFunc(e, ...i);
  });
}, b_ = function(t, e) {
  v0.push(
    function() {
      const n = document.querySelector(`[id="${t}"]`);
      n !== null && n.addEventListener("click", function() {
        e();
      });
    },
    function() {
      const n = document.querySelector(`[id="${t}-text"]`);
      n !== null && n.addEventListener("click", function() {
        e();
      });
    }
  );
}, uU = function(t, e, n) {
  t.split(",").forEach(function(i) {
    cU(i, e, n);
  }), x_(t, "clickable");
}, hU = function(t) {
  v0.forEach(function(e) {
    e(t);
  });
}, dU = {
  getConfig: () => Q().gantt,
  clear: DW,
  setDateFormat: zW,
  getDateFormat: HW,
  enableInclusiveEndDates: VW,
  endDatesAreInclusive: qW,
  enableTopAxis: $W,
  topAxisEnabled: YW,
  setAxisFormat: NW,
  getAxisFormat: FW,
  setTickInterval: OW,
  getTickInterval: RW,
  setTodayMarker: MW,
  getTodayMarker: PW,
  setAccTitle: pn,
  getAccTitle: vn,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn,
  setDisplayMode: WW,
  getDisplayMode: UW,
  setAccDescription: En,
  getAccDescription: Cn,
  addSection: ZW,
  getSections: JW,
  getTasks: tU,
  addTask: aU,
  findTaskById: $s,
  addTaskOrg: oU,
  setIncludes: GW,
  getIncludes: jW,
  setExcludes: XW,
  getExcludes: KW,
  setClickEvent: uU,
  setLink: lU,
  getLinks: QW,
  bindFunctions: hU,
  parseDuration: g_,
  isInvalidDate: f_,
  setWeekday: eU,
  getWeekday: nU
};
function __(t, e, n) {
  let i = !0;
  for (; i; )
    i = !1, n.forEach(function(r) {
      const s = "^\\s*" + r + "\\s*$", a = new RegExp(s);
      t[0].match(a) && (e[r] = !0, t.shift(1), i = !0);
    });
}
const fU = function() {
  z.debug("Something is calling, setConf, remove the call");
}, U2 = {
  monday: Yo,
  tuesday: wm,
  wednesday: vm,
  thursday: gs,
  friday: Em,
  saturday: Cm,
  sunday: kl
}, pU = (t, e) => {
  let n = [...t].map(() => -1 / 0), i = [...t].sort((s, a) => s.startTime - a.startTime || s.order - a.order), r = 0;
  for (const s of i)
    for (let a = 0; a < n.length; a++)
      if (s.startTime >= n[a]) {
        n[a] = s.endTime, s.order = a + e, a > r && (r = a);
        break;
      }
  return r;
};
let rr;
const gU = function(t, e, n, i) {
  const r = Q().gantt, s = Q().securityLevel;
  let a;
  s === "sandbox" && (a = yt("#i" + e));
  const o = yt(s === "sandbox" ? a.nodes()[0].contentDocument.body : "body"), l = s === "sandbox" ? a.nodes()[0].contentDocument : document, u = l.getElementById(e);
  rr = u.parentElement.offsetWidth, rr === void 0 && (rr = 1200), r.useWidth !== void 0 && (rr = r.useWidth);
  const h = i.db.getTasks();
  let f = [];
  for (const S of h)
    f.push(S.type);
  f = F(f);
  const d = {};
  let p = 2 * r.topPadding;
  if (i.db.getDisplayMode() === "compact" || r.displayMode === "compact") {
    const S = {};
    for (const C of h)
      S[C.section] === void 0 ? S[C.section] = [C] : S[C.section].push(C);
    let x = 0;
    for (const C of Object.keys(S)) {
      const g = pU(S[C], x) + 1;
      x += g, p += g * (r.barHeight + r.barGap), d[C] = g;
    }
  } else {
    p += h.length * (r.barHeight + r.barGap);
    for (const S of f)
      d[S] = h.filter((x) => x.type === S).length;
  }
  u.setAttribute("viewBox", "0 0 " + rr + " " + p);
  const y = o.select(`[id="${e}"]`), m = rC().domain([
    Rk(h, function(S) {
      return S.startTime;
    }),
    Ok(h, function(S) {
      return S.endTime;
    })
  ]).rangeRound([0, rr - r.leftPadding - r.rightPadding]);
  function _(S, x) {
    const C = S.startTime, g = x.startTime;
    let I = 0;
    return C > g ? I = 1 : C < g && (I = -1), I;
  }
  h.sort(_), T(h, rr, p), dn(y, p, rr, r.useMaxWidth), y.append("text").text(i.db.getDiagramTitle()).attr("x", rr / 2).attr("y", r.titleTopMargin).attr("class", "titleText");
  function T(S, x, C) {
    const g = r.barHeight, I = g + r.barGap, k = r.topPadding, P = r.leftPadding, R = ya().domain([0, f.length]).range(["#00B9FA", "#F95002"]).interpolate(rw);
    A(
      I,
      k,
      P,
      x,
      C,
      S,
      i.db.getExcludes(),
      i.db.getIncludes()
    ), L(P, k, x, C), v(S, I, k, P, g, R, x), w(I, k), b(P, k, x, C);
  }
  function v(S, x, C, g, I, k, P) {
    const M = [...new Set(S.map((E) => E.order))].map((E) => S.find((V) => V.order === E));
    y.append("g").selectAll("rect").data(M).enter().append("rect").attr("x", 0).attr("y", function(E, V) {
      return V = E.order, V * x + C - 2;
    }).attr("width", function() {
      return P - r.rightPadding / 2;
    }).attr("height", x).attr("class", function(E) {
      for (const [V, nt] of f.entries())
        if (E.type === nt)
          return "section section" + V % r.numberSectionStyles;
      return "section section0";
    });
    const B = y.append("g").selectAll("rect").data(S).enter(), N = i.db.getLinks();
    if (B.append("rect").attr("id", function(E) {
      return E.id;
    }).attr("rx", 3).attr("ry", 3).attr("x", function(E) {
      return E.milestone ? m(E.startTime) + g + 0.5 * (m(E.endTime) - m(E.startTime)) - 0.5 * I : m(E.startTime) + g;
    }).attr("y", function(E, V) {
      return V = E.order, V * x + C;
    }).attr("width", function(E) {
      return E.milestone ? I : m(E.renderEndTime || E.endTime) - m(E.startTime);
    }).attr("height", I).attr("transform-origin", function(E, V) {
      return V = E.order, (m(E.startTime) + g + 0.5 * (m(E.endTime) - m(E.startTime))).toString() + "px " + (V * x + C + 0.5 * I).toString() + "px";
    }).attr("class", function(E) {
      const V = "task";
      let nt = "";
      E.classes.length > 0 && (nt = E.classes.join(" "));
      let O = 0;
      for (const [X, H] of f.entries())
        E.type === H && (O = X % r.numberSectionStyles);
      let ct = "";
      return E.active ? E.crit ? ct += " activeCrit" : ct = " active" : E.done ? E.crit ? ct = " doneCrit" : ct = " done" : E.crit && (ct += " crit"), ct.length === 0 && (ct = " task"), E.milestone && (ct = " milestone " + ct), ct += O, ct += " " + nt, V + ct;
    }), B.append("text").attr("id", function(E) {
      return E.id + "-text";
    }).text(function(E) {
      return E.task;
    }).attr("font-size", r.fontSize).attr("x", function(E) {
      let V = m(E.startTime), nt = m(E.renderEndTime || E.endTime);
      E.milestone && (V += 0.5 * (m(E.endTime) - m(E.startTime)) - 0.5 * I), E.milestone && (nt = V + I);
      const O = this.getBBox().width;
      return O > nt - V ? nt + O + 1.5 * r.leftPadding > P ? V + g - 5 : nt + g + 5 : (nt - V) / 2 + V + g;
    }).attr("y", function(E, V) {
      return V = E.order, V * x + r.barHeight / 2 + (r.fontSize / 2 - 2) + C;
    }).attr("text-height", I).attr("class", function(E) {
      const V = m(E.startTime);
      let nt = m(E.endTime);
      E.milestone && (nt = V + I);
      const O = this.getBBox().width;
      let ct = "";
      E.classes.length > 0 && (ct = E.classes.join(" "));
      let X = 0;
      for (const [it, ot] of f.entries())
        E.type === ot && (X = it % r.numberSectionStyles);
      let H = "";
      return E.active && (E.crit ? H = "activeCritText" + X : H = "activeText" + X), E.done ? E.crit ? H = H + " doneCritText" + X : H = H + " doneText" + X : E.crit && (H = H + " critText" + X), E.milestone && (H += " milestoneText"), O > nt - V ? nt + O + 1.5 * r.leftPadding > P ? ct + " taskTextOutsideLeft taskTextOutside" + X + " " + H : ct + " taskTextOutsideRight taskTextOutside" + X + " " + H + " width-" + O : ct + " taskText taskText" + X + " " + H + " width-" + O;
    }), Q().securityLevel === "sandbox") {
      let E;
      E = yt("#i" + e);
      const V = E.nodes()[0].contentDocument;
      B.filter(function(nt) {
        return N[nt.id] !== void 0;
      }).each(function(nt) {
        var O = V.querySelector("#" + nt.id), ct = V.querySelector("#" + nt.id + "-text");
        const X = O.parentNode;
        var H = V.createElement("a");
        H.setAttribute("xlink:href", N[nt.id]), H.setAttribute("target", "_top"), X.appendChild(H), H.appendChild(O), H.appendChild(ct);
      });
    }
  }
  function A(S, x, C, g, I, k, P, R) {
    if (P.length === 0 && R.length === 0)
      return;
    let M, B;
    for (const { startTime: O, endTime: ct } of k)
      (M === void 0 || O < M) && (M = O), (B === void 0 || ct > B) && (B = ct);
    if (!M || !B)
      return;
    if (ln(B).diff(ln(M), "year") > 5) {
      z.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 N = i.db.getDateFormat(), D = [];
    let E = null, V = ln(M);
    for (; V.valueOf() <= B; )
      i.db.isInvalidDate(V, N, P, R) ? E ? E.end = V : E = {
        start: V,
        end: V
      } : E && (D.push(E), E = null), V = V.add(1, "d");
    y.append("g").selectAll("rect").data(D).enter().append("rect").attr("id", function(O) {
      return "exclude-" + O.start.format("YYYY-MM-DD");
    }).attr("x", function(O) {
      return m(O.start) + C;
    }).attr("y", r.gridLineStartPadding).attr("width", function(O) {
      const ct = O.end.add(1, "day");
      return m(ct) - m(O.start);
    }).attr("height", I - x - r.gridLineStartPadding).attr("transform-origin", function(O, ct) {
      return (m(O.start) + C + 0.5 * (m(O.end) - m(O.start))).toString() + "px " + (ct * S + 0.5 * I).toString() + "px";
    }).attr("class", "exclude-range");
  }
  function L(S, x, C, g) {
    let I = Uk(m).tickSize(-g + x + r.gridLineStartPadding).tickFormat(Uc(i.db.getAxisFormat() || r.axisFormat || "%Y-%m-%d"));
    const P = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec(
      i.db.getTickInterval() || r.tickInterval
    );
    if (P !== null) {
      const R = P[1], M = P[2], B = i.db.getWeekday() || r.weekday;
      switch (M) {
        case "millisecond":
          I.ticks(ma.every(R));
          break;
        case "second":
          I.ticks(Or.every(R));
          break;
        case "minute":
          I.ticks(qo.every(R));
          break;
        case "hour":
          I.ticks($o.every(R));
          break;
        case "day":
          I.ticks(ps.every(R));
          break;
        case "week":
          I.ticks(U2[B].every(R));
          break;
        case "month":
          I.ticks(Wo.every(R));
          break;
      }
    }
    if (y.append("g").attr("class", "grid").attr("transform", "translate(" + S + ", " + (g - 50) + ")").call(I).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em"), i.db.topAxisEnabled() || r.topAxis) {
      let R = Wk(m).tickSize(-g + x + r.gridLineStartPadding).tickFormat(Uc(i.db.getAxisFormat() || r.axisFormat || "%Y-%m-%d"));
      if (P !== null) {
        const M = P[1], B = P[2], N = i.db.getWeekday() || r.weekday;
        switch (B) {
          case "millisecond":
            R.ticks(ma.every(M));
            break;
          case "second":
            R.ticks(Or.every(M));
            break;
          case "minute":
            R.ticks(qo.every(M));
            break;
          case "hour":
            R.ticks($o.every(M));
            break;
          case "day":
            R.ticks(ps.every(M));
            break;
          case "week":
            R.ticks(U2[N].every(M));
            break;
          case "month":
            R.ticks(Wo.every(M));
            break;
        }
      }
      y.append("g").attr("class", "grid").attr("transform", "translate(" + S + ", " + x + ")").call(R).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10);
    }
  }
  function w(S, x) {
    let C = 0;
    const g = Object.keys(d).map((I) => [I, d[I]]);
    y.append("g").selectAll("text").data(g).enter().append(function(I) {
      const k = I[0].split(bt.lineBreakRegex), P = -(k.length - 1) / 2, R = l.createElementNS("http://www.w3.org/2000/svg", "text");
      R.setAttribute("dy", P + "em");
      for (const [M, B] of k.entries()) {
        const N = l.createElementNS("http://www.w3.org/2000/svg", "tspan");
        N.setAttribute("alignment-baseline", "central"), N.setAttribute("x", "10"), M > 0 && N.setAttribute("dy", "1em"), N.textContent = B, R.appendChild(N);
      }
      return R;
    }).attr("x", 10).attr("y", function(I, k) {
      if (k > 0)
        for (let P = 0; P < k; P++)
          return C += g[k - 1][1], I[1] * S / 2 + C * S + x;
      else
        return I[1] * S / 2 + x;
    }).attr("font-size", r.sectionFontSize).attr("class", function(I) {
      for (const [k, P] of f.entries())
        if (I[0] === P)
          return "sectionTitle sectionTitle" + k % r.numberSectionStyles;
      return "sectionTitle";
    });
  }
  function b(S, x, C, g) {
    const I = i.db.getTodayMarker();
    if (I === "off")
      return;
    const k = y.append("g").attr("class", "today"), P = /* @__PURE__ */ new Date(), R = k.append("line");
    R.attr("x1", m(P) + S).attr("x2", m(P) + S).attr("y1", r.titleTopMargin).attr("y2", g - r.titleTopMargin).attr("class", "today"), I !== "" && R.attr("style", I.replace(/,/g, ";"));
  }
  function F(S) {
    const x = {}, C = [];
    for (let g = 0, I = S.length; g < I; ++g)
      Object.prototype.hasOwnProperty.call(x, S[g]) || (x[S[g]] = !0, C.push(S[g]));
    return C;
  }
}, yU = {
  setConf: fU,
  draw: gU
}, mU = (t) => `
  .mermaid-main-font {
    font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
  }

  .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: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
  }


  /* 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: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
  }

  .taskTextOutsideRight {
    fill: ${t.taskTextDarkColor};
    text-anchor: start;
    font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
  }

  .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;
  }

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

  .titleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.titleColor || t.textColor};
    font-family: var(--mermaid-font-family, "trebuchet ms", verdana, arial, sans-serif);
  }
`, xU = mU, bU = {
  parser: BW,
  db: dU,
  renderer: yU,
  styles: xU
}, _U = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: bU
}, Symbol.toStringTag, { value: "Module" }));
var S1 = (function() {
  var t = function(s, a, o, l) {
    for (o = o || {}, l = s.length; l--; o[s[l]] = a)
      ;
    return o;
  }, e = [6, 9, 10], n = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, info: 4, document: 5, EOF: 6, line: 7, statement: 8, NL: 9, showInfo: 10, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "info", 6: "EOF", 9: "NL", 10: "showInfo" },
    productions_: [0, [3, 3], [5, 0], [5, 2], [7, 1], [7, 1], [8, 1]],
    performAction: function(a, o, l, u, h, f, d) {
      switch (f.length - 1, h) {
        case 1:
          return u;
        case 4:
          break;
        case 6:
          u.setInfo(!0);
          break;
      }
    },
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: 6, 9: [1, 7], 10: [1, 8] }, { 1: [2, 1] }, t(e, [2, 3]), t(e, [2, 4]), t(e, [2, 5]), t(e, [2, 6])],
    defaultActions: { 4: [2, 1] },
    parseError: function(a, o) {
      if (o.recoverable)
        this.trace(a);
      else {
        var l = new Error(a);
        throw l.hash = o, l;
      }
    },
    parse: function(a) {
      var o = this, l = [0], u = [], h = [null], f = [], d = this.table, p = "", y = 0, m = 0, _ = 2, T = 1, v = f.slice.call(arguments, 1), A = Object.create(this.lexer), L = { yy: {} };
      for (var w in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, w) && (L.yy[w] = this.yy[w]);
      A.setInput(a, L.yy), L.yy.lexer = A, L.yy.parser = this, typeof A.yylloc > "u" && (A.yylloc = {});
      var b = A.yylloc;
      f.push(b);
      var F = A.options && A.options.ranges;
      typeof L.yy.parseError == "function" ? this.parseError = L.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function S() {
        var D;
        return D = u.pop() || A.lex() || T, typeof D != "number" && (D instanceof Array && (u = D, D = u.pop()), D = o.symbols_[D] || D), D;
      }
      for (var x, C, g, I, k = {}, P, R, M, B; ; ) {
        if (C = l[l.length - 1], this.defaultActions[C] ? g = this.defaultActions[C] : ((x === null || typeof x > "u") && (x = S()), g = d[C] && d[C][x]), typeof g > "u" || !g.length || !g[0]) {
          var N = "";
          B = [];
          for (P in d[C])
            this.terminals_[P] && P > _ && B.push("'" + this.terminals_[P] + "'");
          A.showPosition ? N = "Parse error on line " + (y + 1) + `:
` + A.showPosition() + `
Expecting ` + B.join(", ") + ", got '" + (this.terminals_[x] || x) + "'" : N = "Parse error on line " + (y + 1) + ": Unexpected " + (x == T ? "end of input" : "'" + (this.terminals_[x] || x) + "'"), this.parseError(N, {
            text: A.match,
            token: this.terminals_[x] || x,
            line: A.yylineno,
            loc: b,
            expected: B
          });
        }
        if (g[0] instanceof Array && g.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + C + ", token: " + x);
        switch (g[0]) {
          case 1:
            l.push(x), h.push(A.yytext), f.push(A.yylloc), l.push(g[1]), x = null, m = A.yyleng, p = A.yytext, y = A.yylineno, b = A.yylloc;
            break;
          case 2:
            if (R = this.productions_[g[1]][1], k.$ = h[h.length - R], k._$ = {
              first_line: f[f.length - (R || 1)].first_line,
              last_line: f[f.length - 1].last_line,
              first_column: f[f.length - (R || 1)].first_column,
              last_column: f[f.length - 1].last_column
            }, F && (k._$.range = [
              f[f.length - (R || 1)].range[0],
              f[f.length - 1].range[1]
            ]), I = this.performAction.apply(k, [
              p,
              m,
              y,
              L.yy,
              g[1],
              h,
              f
            ].concat(v)), typeof I < "u")
              return I;
            R && (l = l.slice(0, -1 * R * 2), h = h.slice(0, -1 * R), f = f.slice(0, -1 * R)), l.push(this.productions_[g[1]][0]), h.push(k.$), f.push(k._$), M = d[l[l.length - 2]][l[l.length - 1]], l.push(M);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, i = /* @__PURE__ */ (function() {
    var s = {
      EOF: 1,
      parseError: function(o, l) {
        if (this.yy.parser)
          this.yy.parser.parseError(o, l);
        else
          throw new Error(o);
      },
      // resets the lexer, sets new input
      setInput: function(a, o) {
        return this.yy = o || this.yy || {}, this._input = a, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var a = this._input[0];
        this.yytext += a, this.yyleng++, this.offset++, this.match += a, this.matched += a;
        var o = a.match(/(?:\r\n?|\n).*/g);
        return o ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), a;
      },
      // unshifts one char (or a string) into the input
      unput: function(a) {
        var o = a.length, l = a.split(/(?:\r\n?|\n)/g);
        this._input = a + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - o), this.offset -= o;
        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), l.length - 1 && (this.yylineno -= l.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: l ? (l.length === u.length ? this.yylloc.first_column : 0) + u[u.length - l.length].length - l[0].length : this.yylloc.first_column - o
        }, this.options.ranges && (this.yylloc.range = [h[0], h[0] + this.yyleng - o]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(a) {
        this.unput(this.match.slice(a));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var a = this.matched.substr(0, this.matched.length - this.match.length);
        return (a.length > 20 ? "..." : "") + a.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var a = this.match;
        return a.length < 20 && (a += this._input.substr(0, 20 - a.length)), (a.substr(0, 20) + (a.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var a = this.pastInput(), o = new Array(a.length + 1).join("-");
        return a + this.upcomingInput() + `
` + o + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(a, o) {
        var l, u, 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))), u = a[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 + a[0].length
        }, this.yytext += a[0], this.match += a[0], this.matches = a, 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(a[0].length), this.matched += a[0], l = this.performAction.call(this, this.yy, this, o, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), l)
          return l;
        if (this._backtrack) {
          for (var f in h)
            this[f] = h[f];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var a, o, l, u;
        this._more || (this.yytext = "", this.match = "");
        for (var h = this._currentRules(), f = 0; f < h.length; f++)
          if (l = this._input.match(this.rules[h[f]]), l && (!o || l[0].length > o[0].length)) {
            if (o = l, u = f, this.options.backtrack_lexer) {
              if (a = this.test_match(l, h[f]), a !== !1)
                return a;
              if (this._backtrack) {
                o = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return o ? (a = this.test_match(o, h[u]), a !== !1 ? a : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var o = this.next();
        return o || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(o) {
        this.conditionStack.push(o);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var o = this.conditionStack.length - 1;
        return o > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(o) {
        return o = this.conditionStack.length - 1 - Math.abs(o || 0), o >= 0 ? this.conditionStack[o] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(o) {
        this.begin(o);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(o, l, u, h) {
        switch (u) {
          case 0:
            return 4;
          case 1:
            return 9;
          case 2:
            return "space";
          case 3:
            return 10;
          case 4:
            return 6;
          case 5:
            return "TXT";
        }
      },
      rules: [/^(?:info\b)/i, /^(?:[\s\n\r]+)/i, /^(?:[\s]+)/i, /^(?:showInfo\b)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { INITIAL: { rules: [0, 1, 2, 3, 4, 5], inclusive: !0 } }
    };
    return s;
  })();
  n.lexer = i;
  function r() {
    this.yy = {};
  }
  return r.prototype = n, n.Parser = r, new r();
})();
S1.parser = S1;
const kU = S1, k_ = {
  info: !1
};
let S0 = k_.info;
const TU = (t) => {
  S0 = t;
}, wU = () => S0, vU = () => {
  S0 = k_.info;
}, EU = {
  clear: vU,
  setInfo: TU,
  getInfo: wU
}, CU = (t, e, n) => {
  z.debug(`rendering info diagram
` + t);
  const i = Cl(e);
  dn(i, 100, 400, !0), i.append("g").append("text").attr("x", 100).attr("y", 40).attr("class", "version").attr("font-size", 32).style("text-anchor", "middle").text(`v${n}`);
}, SU = { draw: CU }, AU = {
  parser: kU,
  db: EU,
  renderer: SU
}, LU = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: AU
}, Symbol.toStringTag, { value: "Module" }));
var A1 = (function() {
  var t = function(A, L, w, b) {
    for (w = w || {}, b = A.length; b--; w[A[b]] = L)
      ;
    return w;
  }, e = [1, 3], n = [1, 4], i = [1, 5], r = [1, 6], s = [1, 10, 12, 14, 16, 18, 19, 20, 21, 22], a = [2, 4], o = [1, 5, 10, 12, 14, 16, 18, 19, 20, 21, 22], l = [20, 21, 22], u = [2, 7], h = [1, 12], f = [1, 13], d = [1, 14], p = [1, 15], y = [1, 16], m = [1, 17], _ = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, eol: 4, PIE: 5, document: 6, showData: 7, line: 8, statement: 9, txt: 10, value: 11, title: 12, title_value: 13, acc_title: 14, acc_title_value: 15, acc_descr: 16, acc_descr_value: 17, acc_descr_multiline_value: 18, section: 19, NEWLINE: 20, ";": 21, EOF: 22, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 5: "PIE", 7: "showData", 10: "txt", 11: "value", 12: "title", 13: "title_value", 14: "acc_title", 15: "acc_title_value", 16: "acc_descr", 17: "acc_descr_value", 18: "acc_descr_multiline_value", 19: "section", 20: "NEWLINE", 21: ";", 22: "EOF" },
    productions_: [0, [3, 2], [3, 2], [3, 3], [6, 0], [6, 2], [8, 2], [9, 0], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [4, 1], [4, 1], [4, 1]],
    performAction: function(L, w, b, F, S, x, C) {
      var g = x.length - 1;
      switch (S) {
        case 3:
          F.setShowData(!0);
          break;
        case 6:
          this.$ = x[g - 1];
          break;
        case 8:
          F.addSection(x[g - 1], F.cleanupValue(x[g]));
          break;
        case 9:
          this.$ = x[g].trim(), F.setDiagramTitle(this.$);
          break;
        case 10:
          this.$ = x[g].trim(), F.setAccTitle(this.$);
          break;
        case 11:
        case 12:
          this.$ = x[g].trim(), F.setAccDescription(this.$);
          break;
        case 13:
          F.addSection(x[g].substr(8)), this.$ = x[g].substr(8);
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 5: e, 20: n, 21: i, 22: r }, { 1: [3] }, { 3: 7, 4: 2, 5: e, 20: n, 21: i, 22: r }, t(s, a, { 6: 8, 7: [1, 9] }), t(o, [2, 14]), t(o, [2, 15]), t(o, [2, 16]), { 1: [2, 1] }, t(l, u, { 8: 10, 9: 11, 1: [2, 2], 10: h, 12: f, 14: d, 16: p, 18: y, 19: m }), t(s, a, { 6: 18 }), t(s, [2, 5]), { 4: 19, 20: n, 21: i, 22: r }, { 11: [1, 20] }, { 13: [1, 21] }, { 15: [1, 22] }, { 17: [1, 23] }, t(l, [2, 12]), t(l, [2, 13]), t(l, u, { 8: 10, 9: 11, 1: [2, 3], 10: h, 12: f, 14: d, 16: p, 18: y, 19: m }), t(s, [2, 6]), t(l, [2, 8]), t(l, [2, 9]), t(l, [2, 10]), t(l, [2, 11])],
    defaultActions: { 7: [2, 1] },
    parseError: function(L, w) {
      if (w.recoverable)
        this.trace(L);
      else {
        var b = new Error(L);
        throw b.hash = w, b;
      }
    },
    parse: function(L) {
      var w = this, b = [0], F = [], S = [null], x = [], C = this.table, g = "", I = 0, k = 0, P = 2, R = 1, M = x.slice.call(arguments, 1), B = Object.create(this.lexer), N = { yy: {} };
      for (var D in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, D) && (N.yy[D] = this.yy[D]);
      B.setInput(L, N.yy), N.yy.lexer = B, N.yy.parser = this, typeof B.yylloc > "u" && (B.yylloc = {});
      var E = B.yylloc;
      x.push(E);
      var V = B.options && B.options.ranges;
      typeof N.yy.parseError == "function" ? this.parseError = N.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function nt() {
        var U;
        return U = F.pop() || B.lex() || R, typeof U != "number" && (U instanceof Array && (F = U, U = F.pop()), U = w.symbols_[U] || U), U;
      }
      for (var O, ct, X, H, it = {}, ot, W, Z, q; ; ) {
        if (ct = b[b.length - 1], this.defaultActions[ct] ? X = this.defaultActions[ct] : ((O === null || typeof O > "u") && (O = nt()), X = C[ct] && C[ct][O]), typeof X > "u" || !X.length || !X[0]) {
          var G = "";
          q = [];
          for (ot in C[ct])
            this.terminals_[ot] && ot > P && q.push("'" + this.terminals_[ot] + "'");
          B.showPosition ? G = "Parse error on line " + (I + 1) + `:
` + B.showPosition() + `
Expecting ` + q.join(", ") + ", got '" + (this.terminals_[O] || O) + "'" : G = "Parse error on line " + (I + 1) + ": Unexpected " + (O == R ? "end of input" : "'" + (this.terminals_[O] || O) + "'"), this.parseError(G, {
            text: B.match,
            token: this.terminals_[O] || O,
            line: B.yylineno,
            loc: E,
            expected: q
          });
        }
        if (X[0] instanceof Array && X.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + ct + ", token: " + O);
        switch (X[0]) {
          case 1:
            b.push(O), S.push(B.yytext), x.push(B.yylloc), b.push(X[1]), O = null, k = B.yyleng, g = B.yytext, I = B.yylineno, E = B.yylloc;
            break;
          case 2:
            if (W = this.productions_[X[1]][1], it.$ = S[S.length - W], it._$ = {
              first_line: x[x.length - (W || 1)].first_line,
              last_line: x[x.length - 1].last_line,
              first_column: x[x.length - (W || 1)].first_column,
              last_column: x[x.length - 1].last_column
            }, V && (it._$.range = [
              x[x.length - (W || 1)].range[0],
              x[x.length - 1].range[1]
            ]), H = this.performAction.apply(it, [
              g,
              k,
              I,
              N.yy,
              X[1],
              S,
              x
            ].concat(M)), typeof H < "u")
              return H;
            W && (b = b.slice(0, -1 * W * 2), S = S.slice(0, -1 * W), x = x.slice(0, -1 * W)), b.push(this.productions_[X[1]][0]), S.push(it.$), x.push(it._$), Z = C[b[b.length - 2]][b[b.length - 1]], b.push(Z);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, T = /* @__PURE__ */ (function() {
    var A = {
      EOF: 1,
      parseError: function(w, b) {
        if (this.yy.parser)
          this.yy.parser.parseError(w, b);
        else
          throw new Error(w);
      },
      // resets the lexer, sets new input
      setInput: function(L, w) {
        return this.yy = w || this.yy || {}, this._input = L, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var L = this._input[0];
        this.yytext += L, this.yyleng++, this.offset++, this.match += L, this.matched += L;
        var w = L.match(/(?:\r\n?|\n).*/g);
        return w ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), L;
      },
      // unshifts one char (or a string) into the input
      unput: function(L) {
        var w = L.length, b = L.split(/(?:\r\n?|\n)/g);
        this._input = L + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - w), this.offset -= w;
        var F = 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), b.length - 1 && (this.yylineno -= b.length - 1);
        var S = 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: b ? (b.length === F.length ? this.yylloc.first_column : 0) + F[F.length - b.length].length - b[0].length : this.yylloc.first_column - w
        }, this.options.ranges && (this.yylloc.range = [S[0], S[0] + this.yyleng - w]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(L) {
        this.unput(this.match.slice(L));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var L = this.matched.substr(0, this.matched.length - this.match.length);
        return (L.length > 20 ? "..." : "") + L.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var L = this.match;
        return L.length < 20 && (L += this._input.substr(0, 20 - L.length)), (L.substr(0, 20) + (L.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var L = this.pastInput(), w = new Array(L.length + 1).join("-");
        return L + this.upcomingInput() + `
` + w + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(L, w) {
        var b, F, S;
        if (this.options.backtrack_lexer && (S = {
          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 && (S.yylloc.range = this.yylloc.range.slice(0))), F = L[0].match(/(?:\r\n?|\n).*/g), F && (this.yylineno += F.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: F ? F[F.length - 1].length - F[F.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + L[0].length
        }, this.yytext += L[0], this.match += L[0], this.matches = L, 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(L[0].length), this.matched += L[0], b = this.performAction.call(this, this.yy, this, w, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), b)
          return b;
        if (this._backtrack) {
          for (var x in S)
            this[x] = S[x];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var L, w, b, F;
        this._more || (this.yytext = "", this.match = "");
        for (var S = this._currentRules(), x = 0; x < S.length; x++)
          if (b = this._input.match(this.rules[S[x]]), b && (!w || b[0].length > w[0].length)) {
            if (w = b, F = x, this.options.backtrack_lexer) {
              if (L = this.test_match(b, S[x]), L !== !1)
                return L;
              if (this._backtrack) {
                w = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return w ? (L = this.test_match(w, S[F]), L !== !1 ? L : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var w = this.next();
        return w || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(w) {
        this.conditionStack.push(w);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var w = this.conditionStack.length - 1;
        return w > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(w) {
        return w = this.conditionStack.length - 1 - Math.abs(w || 0), w >= 0 ? this.conditionStack[w] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(w) {
        this.begin(w);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(w, b, F, S) {
        switch (F) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 20;
          case 3:
            break;
          case 4:
            break;
          case 5:
            return this.begin("title"), 12;
          case 6:
            return this.popState(), "title_value";
          case 7:
            return this.begin("acc_title"), 14;
          case 8:
            return this.popState(), "acc_title_value";
          case 9:
            return this.begin("acc_descr"), 16;
          case 10:
            return this.popState(), "acc_descr_value";
          case 11:
            this.begin("acc_descr_multiline");
            break;
          case 12:
            this.popState();
            break;
          case 13:
            return "acc_descr_multiline_value";
          case 14:
            this.begin("string");
            break;
          case 15:
            this.popState();
            break;
          case 16:
            return "txt";
          case 17:
            return 5;
          case 18:
            return 7;
          case 19:
            return "value";
          case 20:
            return 22;
        }
      },
      rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:[\s]+)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:pie\b)/i, /^(?:showData\b)/i, /^(?::[\s]*[\d]+(?:\.[\d]+)?)/i, /^(?:$)/i],
      conditions: { acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, title: { rules: [6], inclusive: !1 }, string: { rules: [15, 16], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 7, 9, 11, 14, 17, 18, 19, 20], inclusive: !0 } }
    };
    return A;
  })();
  _.lexer = T;
  function v() {
    this.yy = {};
  }
  return v.prototype = _, _.Parser = v, new v();
})();
A1.parser = A1;
const IU = A1, BU = be.pie, ku = {
  sections: {},
  showData: !1
};
let Tu = ku.sections, A0 = ku.showData;
const DU = structuredClone(BU), NU = () => structuredClone(DU), FU = () => {
  Tu = structuredClone(ku.sections), A0 = ku.showData, fn();
}, OU = (t, e) => {
  t = Ne(t, Q()), Tu[t] === void 0 && (Tu[t] = e, z.debug(`added new section: ${t}, with value: ${e}`));
}, RU = () => Tu, MU = (t) => (t.substring(0, 1) === ":" && (t = t.substring(1).trim()), Number(t.trim())), PU = (t) => {
  A0 = t;
}, zU = () => A0, VU = {
  getConfig: NU,
  clear: FU,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn,
  setAccTitle: pn,
  getAccTitle: vn,
  setAccDescription: En,
  getAccDescription: Cn,
  addSection: OU,
  getSections: RU,
  cleanupValue: MU,
  setShowData: PU,
  getShowData: zU
}, qU = (t) => `
  .pieCircle{
    stroke: ${t.pieStrokeColor};
    stroke-width : ${t.pieStrokeWidth};
    opacity : ${t.pieOpacity};
  }
  .pieOuterCircle{
    stroke: ${t.pieOuterStrokeColor};
    stroke-width: ${t.pieOuterStrokeWidth};
    fill: none;
  }
  .pieTitleText {
    text-anchor: middle;
    font-size: ${t.pieTitleTextSize};
    fill: ${t.pieTitleTextColor};
    font-family: ${t.fontFamily};
  }
  .slice {
    font-family: ${t.fontFamily};
    fill: ${t.pieSectionTextColor};
    font-size:${t.pieSectionTextSize};
    // fill: white;
  }
  .legend text {
    fill: ${t.pieLegendTextColor};
    font-family: ${t.fontFamily};
    font-size: ${t.pieLegendTextSize};
  }
`, $U = qU, YU = (t) => {
  const e = Object.entries(t).map((i) => ({
    label: i[0],
    value: i[1]
  })).sort((i, r) => r.value - i.value);
  return xC().value(
    (i) => i.value
  )(e);
}, WU = (t, e, n, i) => {
  z.debug(`rendering pie chart
` + t);
  const r = i.db, s = Q(), a = El(r.getConfig(), s.pie), o = 40, l = 18, u = 4, h = 450, f = h, d = Cl(e), p = d.append("g"), y = r.getSections();
  p.attr("transform", "translate(" + f / 2 + "," + h / 2 + ")");
  const { themeVariables: m } = s;
  let [_] = zs(m.pieOuterStrokeWidth);
  _ ?? (_ = 2);
  const T = a.textPosition, v = Math.min(f, h) / 2 - o, A = ba().innerRadius(0).outerRadius(v), L = ba().innerRadius(v * T).outerRadius(v * T);
  p.append("circle").attr("cx", 0).attr("cy", 0).attr("r", v + _ / 2).attr("class", "pieOuterCircle");
  const w = YU(y), b = [
    m.pie1,
    m.pie2,
    m.pie3,
    m.pie4,
    m.pie5,
    m.pie6,
    m.pie7,
    m.pie8,
    m.pie9,
    m.pie10,
    m.pie11,
    m.pie12
  ], F = _l(b);
  p.selectAll("mySlices").data(w).enter().append("path").attr("d", A).attr("fill", (I) => F(I.data.label)).attr("class", "pieCircle");
  let S = 0;
  Object.keys(y).forEach((I) => {
    S += y[I];
  }), p.selectAll("mySlices").data(w).enter().append("text").text((I) => (I.data.value / S * 100).toFixed(0) + "%").attr("transform", (I) => "translate(" + L.centroid(I) + ")").style("text-anchor", "middle").attr("class", "slice"), p.append("text").text(r.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
  const x = p.selectAll(".legend").data(F.domain()).enter().append("g").attr("class", "legend").attr("transform", (I, k) => {
    const P = l + u, R = P * F.domain().length / 2, M = 12 * l, B = k * P - R;
    return "translate(" + M + "," + B + ")";
  });
  x.append("rect").attr("width", l).attr("height", l).style("fill", F).style("stroke", F), x.data(w).append("text").attr("x", l + u).attr("y", l - u).text((I) => {
    const { label: k, value: P } = I.data;
    return r.getShowData() ? `${k} [${P}]` : k;
  });
  const C = Math.max(
    ...x.selectAll("text").nodes().map((I) => I?.getBoundingClientRect().width ?? 0)
  ), g = f + o + l + u + C;
  d.attr("viewBox", `0 0 ${g} ${h}`), dn(d, h, g, a.useMaxWidth);
}, UU = { draw: WU }, HU = {
  parser: IU,
  db: VU,
  renderer: UU,
  styles: $U
}, GU = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: HU
}, Symbol.toStringTag, { value: "Module" }));
var L1 = (function() {
  var t = function(X, H, it, ot) {
    for (it = it || {}, ot = X.length; ot--; it[X[ot]] = H)
      ;
    return it;
  }, e = [1, 3], n = [1, 4], i = [1, 5], r = [1, 6], s = [1, 7], a = [1, 5, 13, 15, 17, 19, 20, 25, 27, 28, 29, 30, 31, 32, 33, 34, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], o = [1, 5, 6, 13, 15, 17, 19, 20, 25, 27, 28, 29, 30, 31, 32, 33, 34, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], l = [32, 33, 34], u = [2, 7], h = [1, 13], f = [1, 17], d = [1, 18], p = [1, 19], y = [1, 20], m = [1, 21], _ = [1, 22], T = [1, 23], v = [1, 24], A = [1, 25], L = [1, 26], w = [1, 27], b = [1, 30], F = [1, 31], S = [1, 32], x = [1, 33], C = [1, 34], g = [1, 35], I = [1, 36], k = [1, 37], P = [1, 38], R = [1, 39], M = [1, 40], B = [1, 41], N = [1, 42], D = [1, 57], E = [1, 58], V = [5, 22, 26, 32, 33, 34, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], nt = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, eol: 4, SPACE: 5, QUADRANT: 6, document: 7, line: 8, statement: 9, axisDetails: 10, quadrantDetails: 11, points: 12, title: 13, title_value: 14, acc_title: 15, acc_title_value: 16, acc_descr: 17, acc_descr_value: 18, acc_descr_multiline_value: 19, section: 20, text: 21, point_start: 22, point_x: 23, point_y: 24, "X-AXIS": 25, "AXIS-TEXT-DELIMITER": 26, "Y-AXIS": 27, QUADRANT_1: 28, QUADRANT_2: 29, QUADRANT_3: 30, QUADRANT_4: 31, NEWLINE: 32, SEMI: 33, EOF: 34, alphaNumToken: 35, textNoTagsToken: 36, STR: 37, MD_STR: 38, alphaNum: 39, PUNCTUATION: 40, AMP: 41, NUM: 42, ALPHA: 43, COMMA: 44, PLUS: 45, EQUALS: 46, MULT: 47, DOT: 48, BRKT: 49, UNDERSCORE: 50, MINUS: 51, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 5: "SPACE", 6: "QUADRANT", 13: "title", 14: "title_value", 15: "acc_title", 16: "acc_title_value", 17: "acc_descr", 18: "acc_descr_value", 19: "acc_descr_multiline_value", 20: "section", 22: "point_start", 23: "point_x", 24: "point_y", 25: "X-AXIS", 26: "AXIS-TEXT-DELIMITER", 27: "Y-AXIS", 28: "QUADRANT_1", 29: "QUADRANT_2", 30: "QUADRANT_3", 31: "QUADRANT_4", 32: "NEWLINE", 33: "SEMI", 34: "EOF", 37: "STR", 38: "MD_STR", 40: "PUNCTUATION", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "COMMA", 45: "PLUS", 46: "EQUALS", 47: "MULT", 48: "DOT", 49: "BRKT", 50: "UNDERSCORE", 51: "MINUS" },
    productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [9, 0], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [12, 4], [10, 4], [10, 3], [10, 2], [10, 4], [10, 3], [10, 2], [11, 2], [11, 2], [11, 2], [11, 2], [4, 1], [4, 1], [4, 1], [21, 1], [21, 2], [21, 1], [21, 1], [39, 1], [39, 2], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [35, 1], [36, 1], [36, 1], [36, 1]],
    performAction: function(H, it, ot, W, Z, q, G) {
      var U = q.length - 1;
      switch (Z) {
        case 12:
          this.$ = q[U].trim(), W.setDiagramTitle(this.$);
          break;
        case 13:
          this.$ = q[U].trim(), W.setAccTitle(this.$);
          break;
        case 14:
        case 15:
          this.$ = q[U].trim(), W.setAccDescription(this.$);
          break;
        case 16:
          W.addSection(q[U].substr(8)), this.$ = q[U].substr(8);
          break;
        case 17:
          W.addPoint(q[U - 3], q[U - 1], q[U]);
          break;
        case 18:
          W.setXAxisLeftText(q[U - 2]), W.setXAxisRightText(q[U]);
          break;
        case 19:
          q[U - 1].text += " ⟶ ", W.setXAxisLeftText(q[U - 1]);
          break;
        case 20:
          W.setXAxisLeftText(q[U]);
          break;
        case 21:
          W.setYAxisBottomText(q[U - 2]), W.setYAxisTopText(q[U]);
          break;
        case 22:
          q[U - 1].text += " ⟶ ", W.setYAxisBottomText(q[U - 1]);
          break;
        case 23:
          W.setYAxisBottomText(q[U]);
          break;
        case 24:
          W.setQuadrant1Text(q[U]);
          break;
        case 25:
          W.setQuadrant2Text(q[U]);
          break;
        case 26:
          W.setQuadrant3Text(q[U]);
          break;
        case 27:
          W.setQuadrant4Text(q[U]);
          break;
        case 31:
          this.$ = { text: q[U], type: "text" };
          break;
        case 32:
          this.$ = { text: q[U - 1].text + "" + q[U], type: q[U - 1].type };
          break;
        case 33:
          this.$ = { text: q[U], type: "text" };
          break;
        case 34:
          this.$ = { text: q[U], type: "markdown" };
          break;
        case 35:
          this.$ = q[U];
          break;
        case 36:
          this.$ = q[U - 1] + "" + q[U];
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 5: e, 6: n, 32: i, 33: r, 34: s }, { 1: [3] }, { 3: 8, 4: 2, 5: e, 6: n, 32: i, 33: r, 34: s }, { 3: 9, 4: 2, 5: e, 6: n, 32: i, 33: r, 34: s }, t(a, [2, 4], { 7: 10 }), t(o, [2, 28]), t(o, [2, 29]), t(o, [2, 30]), { 1: [2, 1] }, { 1: [2, 2] }, t(l, u, { 8: 11, 9: 12, 10: 14, 11: 15, 12: 16, 21: 28, 35: 29, 1: [2, 3], 5: h, 13: f, 15: d, 17: p, 19: y, 20: m, 25: _, 27: T, 28: v, 29: A, 30: L, 31: w, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }), t(a, [2, 5]), { 4: 43, 32: i, 33: r, 34: s }, t(l, u, { 10: 14, 11: 15, 12: 16, 21: 28, 35: 29, 9: 44, 5: h, 13: f, 15: d, 17: p, 19: y, 20: m, 25: _, 27: T, 28: v, 29: A, 30: L, 31: w, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }), t(l, [2, 9]), t(l, [2, 10]), t(l, [2, 11]), { 14: [1, 45] }, { 16: [1, 46] }, { 18: [1, 47] }, t(l, [2, 15]), t(l, [2, 16]), { 21: 48, 35: 29, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }, { 21: 49, 35: 29, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }, { 21: 50, 35: 29, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }, { 21: 51, 35: 29, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }, { 21: 52, 35: 29, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }, { 21: 53, 35: 29, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }, { 5: D, 22: [1, 54], 35: 56, 36: 55, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }, t(V, [2, 31]), t(V, [2, 33]), t(V, [2, 34]), t(V, [2, 37]), t(V, [2, 38]), t(V, [2, 39]), t(V, [2, 40]), t(V, [2, 41]), t(V, [2, 42]), t(V, [2, 43]), t(V, [2, 44]), t(V, [2, 45]), t(V, [2, 46]), t(V, [2, 47]), t(a, [2, 6]), t(l, [2, 8]), t(l, [2, 12]), t(l, [2, 13]), t(l, [2, 14]), t(l, [2, 20], { 36: 55, 35: 56, 5: D, 26: [1, 59], 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), t(l, [2, 23], { 36: 55, 35: 56, 5: D, 26: [1, 60], 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), t(l, [2, 24], { 36: 55, 35: 56, 5: D, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), t(l, [2, 25], { 36: 55, 35: 56, 5: D, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), t(l, [2, 26], { 36: 55, 35: 56, 5: D, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), t(l, [2, 27], { 36: 55, 35: 56, 5: D, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), { 23: [1, 61] }, t(V, [2, 32]), t(V, [2, 48]), t(V, [2, 49]), t(V, [2, 50]), t(l, [2, 19], { 35: 29, 21: 62, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }), t(l, [2, 22], { 35: 29, 21: 63, 37: b, 38: F, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N }), { 24: [1, 64] }, t(l, [2, 18], { 36: 55, 35: 56, 5: D, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), t(l, [2, 21], { 36: 55, 35: 56, 5: D, 40: S, 41: x, 42: C, 43: g, 44: I, 45: k, 46: P, 47: R, 48: M, 49: B, 50: N, 51: E }), t(l, [2, 17])],
    defaultActions: { 8: [2, 1], 9: [2, 2] },
    parseError: function(H, it) {
      if (it.recoverable)
        this.trace(H);
      else {
        var ot = new Error(H);
        throw ot.hash = it, ot;
      }
    },
    parse: function(H) {
      var it = this, ot = [0], W = [], Z = [null], q = [], G = this.table, U = "", ht = 0, Y = 0, wt = 2, J = 1, Ct = q.slice.call(arguments, 1), Tt = Object.create(this.lexer), $t = { yy: {} };
      for (var Rt in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Rt) && ($t.yy[Rt] = this.yy[Rt]);
      Tt.setInput(H, $t.yy), $t.yy.lexer = Tt, $t.yy.parser = this, typeof Tt.yylloc > "u" && (Tt.yylloc = {});
      var te = Tt.yylloc;
      q.push(te);
      var mt = Tt.options && Tt.options.ranges;
      typeof $t.yy.parseError == "function" ? this.parseError = $t.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function pt() {
        var Mt;
        return Mt = W.pop() || Tt.lex() || J, typeof Mt != "number" && (Mt instanceof Array && (W = Mt, Mt = W.pop()), Mt = it.symbols_[Mt] || Mt), Mt;
      }
      for (var dt, ft, j, $, et = {}, rt, ut, Kt, Zt; ; ) {
        if (ft = ot[ot.length - 1], this.defaultActions[ft] ? j = this.defaultActions[ft] : ((dt === null || typeof dt > "u") && (dt = pt()), j = G[ft] && G[ft][dt]), typeof j > "u" || !j.length || !j[0]) {
          var Qt = "";
          Zt = [];
          for (rt in G[ft])
            this.terminals_[rt] && rt > wt && Zt.push("'" + this.terminals_[rt] + "'");
          Tt.showPosition ? Qt = "Parse error on line " + (ht + 1) + `:
` + Tt.showPosition() + `
Expecting ` + Zt.join(", ") + ", got '" + (this.terminals_[dt] || dt) + "'" : Qt = "Parse error on line " + (ht + 1) + ": Unexpected " + (dt == J ? "end of input" : "'" + (this.terminals_[dt] || dt) + "'"), this.parseError(Qt, {
            text: Tt.match,
            token: this.terminals_[dt] || dt,
            line: Tt.yylineno,
            loc: te,
            expected: Zt
          });
        }
        if (j[0] instanceof Array && j.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + ft + ", token: " + dt);
        switch (j[0]) {
          case 1:
            ot.push(dt), Z.push(Tt.yytext), q.push(Tt.yylloc), ot.push(j[1]), dt = null, Y = Tt.yyleng, U = Tt.yytext, ht = Tt.yylineno, te = Tt.yylloc;
            break;
          case 2:
            if (ut = this.productions_[j[1]][1], et.$ = Z[Z.length - ut], et._$ = {
              first_line: q[q.length - (ut || 1)].first_line,
              last_line: q[q.length - 1].last_line,
              first_column: q[q.length - (ut || 1)].first_column,
              last_column: q[q.length - 1].last_column
            }, mt && (et._$.range = [
              q[q.length - (ut || 1)].range[0],
              q[q.length - 1].range[1]
            ]), $ = this.performAction.apply(et, [
              U,
              Y,
              ht,
              $t.yy,
              j[1],
              Z,
              q
            ].concat(Ct)), typeof $ < "u")
              return $;
            ut && (ot = ot.slice(0, -1 * ut * 2), Z = Z.slice(0, -1 * ut), q = q.slice(0, -1 * ut)), ot.push(this.productions_[j[1]][0]), Z.push(et.$), q.push(et._$), Kt = G[ot[ot.length - 2]][ot[ot.length - 1]], ot.push(Kt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, O = /* @__PURE__ */ (function() {
    var X = {
      EOF: 1,
      parseError: function(it, ot) {
        if (this.yy.parser)
          this.yy.parser.parseError(it, ot);
        else
          throw new Error(it);
      },
      // resets the lexer, sets new input
      setInput: function(H, it) {
        return this.yy = it || this.yy || {}, this._input = H, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var H = this._input[0];
        this.yytext += H, this.yyleng++, this.offset++, this.match += H, this.matched += H;
        var it = H.match(/(?:\r\n?|\n).*/g);
        return it ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), H;
      },
      // unshifts one char (or a string) into the input
      unput: function(H) {
        var it = H.length, ot = H.split(/(?:\r\n?|\n)/g);
        this._input = H + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - it), this.offset -= it;
        var W = 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), ot.length - 1 && (this.yylineno -= ot.length - 1);
        var Z = 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: ot ? (ot.length === W.length ? this.yylloc.first_column : 0) + W[W.length - ot.length].length - ot[0].length : this.yylloc.first_column - it
        }, this.options.ranges && (this.yylloc.range = [Z[0], Z[0] + this.yyleng - it]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(H) {
        this.unput(this.match.slice(H));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var H = this.matched.substr(0, this.matched.length - this.match.length);
        return (H.length > 20 ? "..." : "") + H.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var H = this.match;
        return H.length < 20 && (H += this._input.substr(0, 20 - H.length)), (H.substr(0, 20) + (H.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var H = this.pastInput(), it = new Array(H.length + 1).join("-");
        return H + this.upcomingInput() + `
` + it + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(H, it) {
        var ot, W, Z;
        if (this.options.backtrack_lexer && (Z = {
          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 && (Z.yylloc.range = this.yylloc.range.slice(0))), W = H[0].match(/(?:\r\n?|\n).*/g), W && (this.yylineno += W.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: W ? W[W.length - 1].length - W[W.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + H[0].length
        }, this.yytext += H[0], this.match += H[0], this.matches = H, 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(H[0].length), this.matched += H[0], ot = this.performAction.call(this, this.yy, this, it, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), ot)
          return ot;
        if (this._backtrack) {
          for (var q in Z)
            this[q] = Z[q];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var H, it, ot, W;
        this._more || (this.yytext = "", this.match = "");
        for (var Z = this._currentRules(), q = 0; q < Z.length; q++)
          if (ot = this._input.match(this.rules[Z[q]]), ot && (!it || ot[0].length > it[0].length)) {
            if (it = ot, W = q, this.options.backtrack_lexer) {
              if (H = this.test_match(ot, Z[q]), H !== !1)
                return H;
              if (this._backtrack) {
                it = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return it ? (H = this.test_match(it, Z[W]), H !== !1 ? H : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var it = this.next();
        return it || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(it) {
        this.conditionStack.push(it);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var it = this.conditionStack.length - 1;
        return it > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(it) {
        return it = this.conditionStack.length - 1 - Math.abs(it || 0), it >= 0 ? this.conditionStack[it] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(it) {
        this.begin(it);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(it, ot, W, Z) {
        switch (W) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 32;
          case 3:
            break;
          case 4:
            return this.begin("title"), 13;
          case 5:
            return this.popState(), "title_value";
          case 6:
            return this.begin("acc_title"), 15;
          case 7:
            return this.popState(), "acc_title_value";
          case 8:
            return this.begin("acc_descr"), 17;
          case 9:
            return this.popState(), "acc_descr_value";
          case 10:
            this.begin("acc_descr_multiline");
            break;
          case 11:
            this.popState();
            break;
          case 12:
            return "acc_descr_multiline_value";
          case 13:
            return 25;
          case 14:
            return 27;
          case 15:
            return 26;
          case 16:
            return 28;
          case 17:
            return 29;
          case 18:
            return 30;
          case 19:
            return 31;
          case 20:
            this.begin("md_string");
            break;
          case 21:
            return "MD_STR";
          case 22:
            this.popState();
            break;
          case 23:
            this.begin("string");
            break;
          case 24:
            this.popState();
            break;
          case 25:
            return "STR";
          case 26:
            return this.begin("point_start"), 22;
          case 27:
            return this.begin("point_x"), 23;
          case 28:
            this.popState();
            break;
          case 29:
            this.popState(), this.begin("point_y");
            break;
          case 30:
            return this.popState(), 24;
          case 31:
            return 6;
          case 32:
            return 43;
          case 33:
            return "COLON";
          case 34:
            return 45;
          case 35:
            return 44;
          case 36:
            return 46;
          case 37:
            return 46;
          case 38:
            return 47;
          case 39:
            return 49;
          case 40:
            return 50;
          case 41:
            return 48;
          case 42:
            return 41;
          case 43:
            return 51;
          case 44:
            return 42;
          case 45:
            return 5;
          case 46:
            return 33;
          case 47:
            return 40;
          case 48:
            return 34;
        }
      },
      rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?: *x-axis *)/i, /^(?: *y-axis *)/i, /^(?: *--+> *)/i, /^(?: *quadrant-1 *)/i, /^(?: *quadrant-2 *)/i, /^(?: *quadrant-3 *)/i, /^(?: *quadrant-4 *)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\s*:\s*\[\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?:\s*\] *)/i, /^(?:\s*,\s*)/i, /^(?:(1)|(0(.\d+)?))/i, /^(?: *quadrantChart *)/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s)/i, /^(?:;)/i, /^(?:[!"#$%&'*+,-.`?\\_/])/i, /^(?:$)/i],
      conditions: { point_y: { rules: [30], inclusive: !1 }, point_x: { rules: [29], inclusive: !1 }, point_start: { rules: [27, 28], inclusive: !1 }, acc_descr_multiline: { rules: [11, 12], inclusive: !1 }, acc_descr: { rules: [9], inclusive: !1 }, acc_title: { rules: [7], inclusive: !1 }, title: { rules: [5], inclusive: !1 }, md_string: { rules: [21, 22], inclusive: !1 }, string: { rules: [24, 25], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 23, 26, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48], inclusive: !0 } }
    };
    return X;
  })();
  nt.lexer = O;
  function ct() {
    this.yy = {};
  }
  return ct.prototype = nt, nt.Parser = ct, new ct();
})();
L1.parser = L1;
const jU = L1, yn = Ef();
class XU {
  constructor() {
    this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData();
  }
  getDefaultData() {
    return {
      titleText: "",
      quadrant1Text: "",
      quadrant2Text: "",
      quadrant3Text: "",
      quadrant4Text: "",
      xAxisLeftText: "",
      xAxisRightText: "",
      yAxisBottomText: "",
      yAxisTopText: "",
      points: []
    };
  }
  getDefaultConfig() {
    var e, n, i, r, s, a, o, l, u, h, f, d, p, y, m, _, T, v;
    return {
      showXAxis: !0,
      showYAxis: !0,
      showTitle: !0,
      chartHeight: ((e = be.quadrantChart) == null ? void 0 : e.chartWidth) || 500,
      chartWidth: ((n = be.quadrantChart) == null ? void 0 : n.chartHeight) || 500,
      titlePadding: ((i = be.quadrantChart) == null ? void 0 : i.titlePadding) || 10,
      titleFontSize: ((r = be.quadrantChart) == null ? void 0 : r.titleFontSize) || 20,
      quadrantPadding: ((s = be.quadrantChart) == null ? void 0 : s.quadrantPadding) || 5,
      xAxisLabelPadding: ((a = be.quadrantChart) == null ? void 0 : a.xAxisLabelPadding) || 5,
      yAxisLabelPadding: ((o = be.quadrantChart) == null ? void 0 : o.yAxisLabelPadding) || 5,
      xAxisLabelFontSize: ((l = be.quadrantChart) == null ? void 0 : l.xAxisLabelFontSize) || 16,
      yAxisLabelFontSize: ((u = be.quadrantChart) == null ? void 0 : u.yAxisLabelFontSize) || 16,
      quadrantLabelFontSize: ((h = be.quadrantChart) == null ? void 0 : h.quadrantLabelFontSize) || 16,
      quadrantTextTopPadding: ((f = be.quadrantChart) == null ? void 0 : f.quadrantTextTopPadding) || 5,
      pointTextPadding: ((d = be.quadrantChart) == null ? void 0 : d.pointTextPadding) || 5,
      pointLabelFontSize: ((p = be.quadrantChart) == null ? void 0 : p.pointLabelFontSize) || 12,
      pointRadius: ((y = be.quadrantChart) == null ? void 0 : y.pointRadius) || 5,
      xAxisPosition: ((m = be.quadrantChart) == null ? void 0 : m.xAxisPosition) || "top",
      yAxisPosition: ((_ = be.quadrantChart) == null ? void 0 : _.yAxisPosition) || "left",
      quadrantInternalBorderStrokeWidth: ((T = be.quadrantChart) == null ? void 0 : T.quadrantInternalBorderStrokeWidth) || 1,
      quadrantExternalBorderStrokeWidth: ((v = be.quadrantChart) == null ? void 0 : v.quadrantExternalBorderStrokeWidth) || 2
    };
  }
  getDefaultThemeConfig() {
    return {
      quadrant1Fill: yn.quadrant1Fill,
      quadrant2Fill: yn.quadrant2Fill,
      quadrant3Fill: yn.quadrant3Fill,
      quadrant4Fill: yn.quadrant4Fill,
      quadrant1TextFill: yn.quadrant1TextFill,
      quadrant2TextFill: yn.quadrant2TextFill,
      quadrant3TextFill: yn.quadrant3TextFill,
      quadrant4TextFill: yn.quadrant4TextFill,
      quadrantPointFill: yn.quadrantPointFill,
      quadrantPointTextFill: yn.quadrantPointTextFill,
      quadrantXAxisTextFill: yn.quadrantXAxisTextFill,
      quadrantYAxisTextFill: yn.quadrantYAxisTextFill,
      quadrantTitleFill: yn.quadrantTitleFill,
      quadrantInternalBorderStrokeFill: yn.quadrantInternalBorderStrokeFill,
      quadrantExternalBorderStrokeFill: yn.quadrantExternalBorderStrokeFill
    };
  }
  clear() {
    this.config = this.getDefaultConfig(), this.themeConfig = this.getDefaultThemeConfig(), this.data = this.getDefaultData(), z.info("clear called");
  }
  setData(e) {
    this.data = { ...this.data, ...e };
  }
  addPoints(e) {
    this.data.points = [...e, ...this.data.points];
  }
  setConfig(e) {
    z.trace("setConfig called with: ", e), this.config = { ...this.config, ...e };
  }
  setThemeConfig(e) {
    z.trace("setThemeConfig called with: ", e), this.themeConfig = { ...this.themeConfig, ...e };
  }
  calculateSpace(e, n, i, r) {
    const s = this.config.xAxisLabelPadding * 2 + this.config.xAxisLabelFontSize, a = {
      top: e === "top" && n ? s : 0,
      bottom: e === "bottom" && n ? s : 0
    }, o = this.config.yAxisLabelPadding * 2 + this.config.yAxisLabelFontSize, l = {
      left: this.config.yAxisPosition === "left" && i ? o : 0,
      right: this.config.yAxisPosition === "right" && i ? o : 0
    }, u = this.config.titleFontSize + this.config.titlePadding * 2, h = {
      top: r ? u : 0
    }, f = this.config.quadrantPadding + l.left, d = this.config.quadrantPadding + a.top + h.top, p = this.config.chartWidth - this.config.quadrantPadding * 2 - l.left - l.right, y = this.config.chartHeight - this.config.quadrantPadding * 2 - a.top - a.bottom - h.top, m = p / 2, _ = y / 2;
    return {
      xAxisSpace: a,
      yAxisSpace: l,
      titleSpace: h,
      quadrantSpace: {
        quadrantLeft: f,
        quadrantTop: d,
        quadrantWidth: p,
        quadrantHalfWidth: m,
        quadrantHeight: y,
        quadrantHalfHeight: _
      }
    };
  }
  getAxisLabels(e, n, i, r) {
    const { quadrantSpace: s, titleSpace: a } = r, {
      quadrantHalfHeight: o,
      quadrantHeight: l,
      quadrantLeft: u,
      quadrantHalfWidth: h,
      quadrantTop: f,
      quadrantWidth: d
    } = s, p = !!this.data.xAxisRightText, y = !!this.data.yAxisTopText, m = [];
    return this.data.xAxisLeftText && n && m.push({
      text: this.data.xAxisLeftText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: u + (p ? h / 2 : 0),
      y: e === "top" ? this.config.xAxisLabelPadding + a.top : this.config.xAxisLabelPadding + f + l + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: p ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.xAxisRightText && n && m.push({
      text: this.data.xAxisRightText,
      fill: this.themeConfig.quadrantXAxisTextFill,
      x: u + h + (p ? h / 2 : 0),
      y: e === "top" ? this.config.xAxisLabelPadding + a.top : this.config.xAxisLabelPadding + f + l + this.config.quadrantPadding,
      fontSize: this.config.xAxisLabelFontSize,
      verticalPos: p ? "center" : "left",
      horizontalPos: "top",
      rotation: 0
    }), this.data.yAxisBottomText && i && m.push({
      text: this.data.yAxisBottomText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + u + d + this.config.quadrantPadding,
      y: f + l - (y ? o / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: y ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), this.data.yAxisTopText && i && m.push({
      text: this.data.yAxisTopText,
      fill: this.themeConfig.quadrantYAxisTextFill,
      x: this.config.yAxisPosition === "left" ? this.config.yAxisLabelPadding : this.config.yAxisLabelPadding + u + d + this.config.quadrantPadding,
      y: f + o - (y ? o / 2 : 0),
      fontSize: this.config.yAxisLabelFontSize,
      verticalPos: y ? "center" : "left",
      horizontalPos: "top",
      rotation: -90
    }), m;
  }
  getQuadrants(e) {
    const { quadrantSpace: n } = e, { quadrantHalfHeight: i, quadrantLeft: r, quadrantHalfWidth: s, quadrantTop: a } = n, o = [
      {
        text: {
          text: this.data.quadrant1Text,
          fill: this.themeConfig.quadrant1TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: r + s,
        y: a,
        width: s,
        height: i,
        fill: this.themeConfig.quadrant1Fill
      },
      {
        text: {
          text: this.data.quadrant2Text,
          fill: this.themeConfig.quadrant2TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: r,
        y: a,
        width: s,
        height: i,
        fill: this.themeConfig.quadrant2Fill
      },
      {
        text: {
          text: this.data.quadrant3Text,
          fill: this.themeConfig.quadrant3TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: r,
        y: a + i,
        width: s,
        height: i,
        fill: this.themeConfig.quadrant3Fill
      },
      {
        text: {
          text: this.data.quadrant4Text,
          fill: this.themeConfig.quadrant4TextFill,
          x: 0,
          y: 0,
          fontSize: this.config.quadrantLabelFontSize,
          verticalPos: "center",
          horizontalPos: "middle",
          rotation: 0
        },
        x: r + s,
        y: a + i,
        width: s,
        height: i,
        fill: this.themeConfig.quadrant4Fill
      }
    ];
    for (const l of o)
      l.text.x = l.x + l.width / 2, this.data.points.length === 0 ? (l.text.y = l.y + l.height / 2, l.text.horizontalPos = "middle") : (l.text.y = l.y + this.config.quadrantTextTopPadding, l.text.horizontalPos = "top");
    return o;
  }
  getQuadrantPoints(e) {
    const { quadrantSpace: n } = e, { quadrantHeight: i, quadrantLeft: r, quadrantTop: s, quadrantWidth: a } = n, o = ya().domain([0, 1]).range([r, a + r]), l = ya().domain([0, 1]).range([i + s, s]);
    return this.data.points.map((h) => ({
      x: o(h.x),
      y: l(h.y),
      fill: this.themeConfig.quadrantPointFill,
      radius: this.config.pointRadius,
      text: {
        text: h.text,
        fill: this.themeConfig.quadrantPointTextFill,
        x: o(h.x),
        y: l(h.y) + this.config.pointTextPadding,
        verticalPos: "center",
        horizontalPos: "top",
        fontSize: this.config.pointLabelFontSize,
        rotation: 0
      }
    }));
  }
  getBorders(e) {
    const n = this.config.quadrantExternalBorderStrokeWidth / 2, { quadrantSpace: i } = e, {
      quadrantHalfHeight: r,
      quadrantHeight: s,
      quadrantLeft: a,
      quadrantHalfWidth: o,
      quadrantTop: l,
      quadrantWidth: u
    } = i;
    return [
      // top border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a - n,
        y1: l,
        x2: a + u + n,
        y2: l
      },
      // right border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a + u,
        y1: l + n,
        x2: a + u,
        y2: l + s - n
      },
      // bottom border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a - n,
        y1: l + s,
        x2: a + u + n,
        y2: l + s
      },
      // left border
      {
        strokeFill: this.themeConfig.quadrantExternalBorderStrokeFill,
        strokeWidth: this.config.quadrantExternalBorderStrokeWidth,
        x1: a,
        y1: l + n,
        x2: a,
        y2: l + s - n
      },
      // vertical inner border
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: a + o,
        y1: l + n,
        x2: a + o,
        y2: l + s - n
      },
      // horizontal inner border
      {
        strokeFill: this.themeConfig.quadrantInternalBorderStrokeFill,
        strokeWidth: this.config.quadrantInternalBorderStrokeWidth,
        x1: a + n,
        y1: l + r,
        x2: a + u - n,
        y2: l + r
      }
    ];
  }
  getTitle(e) {
    if (e)
      return {
        text: this.data.titleText,
        fill: this.themeConfig.quadrantTitleFill,
        fontSize: this.config.titleFontSize,
        horizontalPos: "top",
        verticalPos: "center",
        rotation: 0,
        y: this.config.titlePadding,
        x: this.config.chartWidth / 2
      };
  }
  build() {
    const e = this.config.showXAxis && !!(this.data.xAxisLeftText || this.data.xAxisRightText), n = this.config.showYAxis && !!(this.data.yAxisTopText || this.data.yAxisBottomText), i = this.config.showTitle && !!this.data.titleText, r = this.data.points.length > 0 ? "bottom" : this.config.xAxisPosition, s = this.calculateSpace(r, e, n, i);
    return {
      points: this.getQuadrantPoints(s),
      quadrants: this.getQuadrants(s),
      axisLabels: this.getAxisLabels(r, e, n, s),
      borderLines: this.getBorders(s),
      title: this.getTitle(i)
    };
  }
}
const KU = Q();
function Sr(t) {
  return Ne(t.trim(), KU);
}
const un = new XU();
function QU(t) {
  un.setData({ quadrant1Text: Sr(t.text) });
}
function ZU(t) {
  un.setData({ quadrant2Text: Sr(t.text) });
}
function JU(t) {
  un.setData({ quadrant3Text: Sr(t.text) });
}
function tH(t) {
  un.setData({ quadrant4Text: Sr(t.text) });
}
function eH(t) {
  un.setData({ xAxisLeftText: Sr(t.text) });
}
function nH(t) {
  un.setData({ xAxisRightText: Sr(t.text) });
}
function iH(t) {
  un.setData({ yAxisTopText: Sr(t.text) });
}
function rH(t) {
  un.setData({ yAxisBottomText: Sr(t.text) });
}
function sH(t, e, n) {
  un.addPoints([{ x: e, y: n, text: Sr(t.text) }]);
}
function aH(t) {
  un.setConfig({ chartWidth: t });
}
function oH(t) {
  un.setConfig({ chartHeight: t });
}
function lH() {
  const t = Q(), { themeVariables: e, quadrantChart: n } = t;
  return n && un.setConfig(n), un.setThemeConfig({
    quadrant1Fill: e.quadrant1Fill,
    quadrant2Fill: e.quadrant2Fill,
    quadrant3Fill: e.quadrant3Fill,
    quadrant4Fill: e.quadrant4Fill,
    quadrant1TextFill: e.quadrant1TextFill,
    quadrant2TextFill: e.quadrant2TextFill,
    quadrant3TextFill: e.quadrant3TextFill,
    quadrant4TextFill: e.quadrant4TextFill,
    quadrantPointFill: e.quadrantPointFill,
    quadrantPointTextFill: e.quadrantPointTextFill,
    quadrantXAxisTextFill: e.quadrantXAxisTextFill,
    quadrantYAxisTextFill: e.quadrantYAxisTextFill,
    quadrantExternalBorderStrokeFill: e.quadrantExternalBorderStrokeFill,
    quadrantInternalBorderStrokeFill: e.quadrantInternalBorderStrokeFill,
    quadrantTitleFill: e.quadrantTitleFill
  }), un.setData({ titleText: Sn() }), un.build();
}
const cH = function() {
  un.clear(), fn();
}, uH = {
  setWidth: aH,
  setHeight: oH,
  setQuadrant1Text: QU,
  setQuadrant2Text: ZU,
  setQuadrant3Text: JU,
  setQuadrant4Text: tH,
  setXAxisLeftText: eH,
  setXAxisRightText: nH,
  setYAxisTopText: iH,
  setYAxisBottomText: rH,
  addPoint: sH,
  getQuadrantData: lH,
  clear: cH,
  setAccTitle: pn,
  getAccTitle: vn,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn,
  getAccDescription: Cn,
  setAccDescription: En
}, hH = (t, e, n, i) => {
  var r, s, a;
  function o(g) {
    return g === "top" ? "hanging" : "middle";
  }
  function l(g) {
    return g === "left" ? "start" : "middle";
  }
  function u(g) {
    return `translate(${g.x}, ${g.y}) rotate(${g.rotation || 0})`;
  }
  const h = Q();
  z.debug(`Rendering quadrant chart
` + t);
  const f = h.securityLevel;
  let d;
  f === "sandbox" && (d = yt("#i" + e));
  const y = yt(f === "sandbox" ? d.nodes()[0].contentDocument.body : "body").select(`[id="${e}"]`), m = y.append("g").attr("class", "main"), _ = ((r = h.quadrantChart) == null ? void 0 : r.chartWidth) || 500, T = ((s = h.quadrantChart) == null ? void 0 : s.chartHeight) || 500;
  dn(y, T, _, ((a = h.quadrantChart) == null ? void 0 : a.useMaxWidth) || !0), y.attr("viewBox", "0 0 " + _ + " " + T), i.db.setHeight(T), i.db.setWidth(_);
  const v = i.db.getQuadrantData(), A = m.append("g").attr("class", "quadrants"), L = m.append("g").attr("class", "border"), w = m.append("g").attr("class", "data-points"), b = m.append("g").attr("class", "labels"), F = m.append("g").attr("class", "title");
  v.title && F.append("text").attr("x", 0).attr("y", 0).attr("fill", v.title.fill).attr("font-size", v.title.fontSize).attr("dominant-baseline", o(v.title.horizontalPos)).attr("text-anchor", l(v.title.verticalPos)).attr("transform", u(v.title)).text(v.title.text), v.borderLines && L.selectAll("line").data(v.borderLines).enter().append("line").attr("x1", (g) => g.x1).attr("y1", (g) => g.y1).attr("x2", (g) => g.x2).attr("y2", (g) => g.y2).style("stroke", (g) => g.strokeFill).style("stroke-width", (g) => g.strokeWidth);
  const S = A.selectAll("g.quadrant").data(v.quadrants).enter().append("g").attr("class", "quadrant");
  S.append("rect").attr("x", (g) => g.x).attr("y", (g) => g.y).attr("width", (g) => g.width).attr("height", (g) => g.height).attr("fill", (g) => g.fill), S.append("text").attr("x", 0).attr("y", 0).attr("fill", (g) => g.text.fill).attr("font-size", (g) => g.text.fontSize).attr(
    "dominant-baseline",
    (g) => o(g.text.horizontalPos)
  ).attr("text-anchor", (g) => l(g.text.verticalPos)).attr("transform", (g) => u(g.text)).text((g) => g.text.text), b.selectAll("g.label").data(v.axisLabels).enter().append("g").attr("class", "label").append("text").attr("x", 0).attr("y", 0).text((g) => g.text).attr("fill", (g) => g.fill).attr("font-size", (g) => g.fontSize).attr("dominant-baseline", (g) => o(g.horizontalPos)).attr("text-anchor", (g) => l(g.verticalPos)).attr("transform", (g) => u(g));
  const C = w.selectAll("g.data-point").data(v.points).enter().append("g").attr("class", "data-point");
  C.append("circle").attr("cx", (g) => g.x).attr("cy", (g) => g.y).attr("r", (g) => g.radius).attr("fill", (g) => g.fill), C.append("text").attr("x", 0).attr("y", 0).text((g) => g.text.text).attr("fill", (g) => g.text.fill).attr("font-size", (g) => g.text.fontSize).attr(
    "dominant-baseline",
    (g) => o(g.text.horizontalPos)
  ).attr("text-anchor", (g) => l(g.text.verticalPos)).attr("transform", (g) => u(g.text));
}, dH = {
  draw: hH
}, fH = {
  parser: jU,
  db: uH,
  renderer: dH,
  styles: () => ""
}, pH = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: fH
}, Symbol.toStringTag, { value: "Module" }));
var I1 = (function() {
  var t = function(R, M, B, N) {
    for (B = B || {}, N = R.length; N--; B[R[N]] = M)
      ;
    return B;
  }, e = [1, 10, 12, 14, 16, 18, 19, 21, 23], n = [2, 6], i = [1, 3], r = [1, 5], s = [1, 6], a = [1, 7], o = [1, 5, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], l = [1, 25], u = [1, 26], h = [1, 28], f = [1, 29], d = [1, 30], p = [1, 31], y = [1, 32], m = [1, 33], _ = [1, 34], T = [1, 35], v = [1, 36], A = [1, 37], L = [1, 43], w = [1, 42], b = [1, 47], F = [1, 50], S = [1, 10, 12, 14, 16, 18, 19, 21, 23, 34, 35, 36], x = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36], C = [1, 10, 12, 14, 16, 18, 19, 21, 23, 24, 26, 27, 28, 34, 35, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50], g = [1, 64], I = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, eol: 4, XYCHART: 5, chartConfig: 6, document: 7, CHART_ORIENTATION: 8, statement: 9, title: 10, text: 11, X_AXIS: 12, parseXAxis: 13, Y_AXIS: 14, parseYAxis: 15, LINE: 16, plotData: 17, BAR: 18, acc_title: 19, acc_title_value: 20, acc_descr: 21, acc_descr_value: 22, acc_descr_multiline_value: 23, SQUARE_BRACES_START: 24, commaSeparatedNumbers: 25, SQUARE_BRACES_END: 26, NUMBER_WITH_DECIMAL: 27, COMMA: 28, xAxisData: 29, bandData: 30, ARROW_DELIMITER: 31, commaSeparatedTexts: 32, yAxisData: 33, NEWLINE: 34, SEMI: 35, EOF: 36, alphaNum: 37, STR: 38, MD_STR: 39, alphaNumToken: 40, AMP: 41, NUM: 42, ALPHA: 43, PLUS: 44, EQUALS: 45, MULT: 46, DOT: 47, BRKT: 48, MINUS: 49, UNDERSCORE: 50, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 5: "XYCHART", 8: "CHART_ORIENTATION", 10: "title", 12: "X_AXIS", 14: "Y_AXIS", 16: "LINE", 18: "BAR", 19: "acc_title", 20: "acc_title_value", 21: "acc_descr", 22: "acc_descr_value", 23: "acc_descr_multiline_value", 24: "SQUARE_BRACES_START", 26: "SQUARE_BRACES_END", 27: "NUMBER_WITH_DECIMAL", 28: "COMMA", 31: "ARROW_DELIMITER", 34: "NEWLINE", 35: "SEMI", 36: "EOF", 38: "STR", 39: "MD_STR", 41: "AMP", 42: "NUM", 43: "ALPHA", 44: "PLUS", 45: "EQUALS", 46: "MULT", 47: "DOT", 48: "BRKT", 49: "MINUS", 50: "UNDERSCORE" },
    productions_: [0, [3, 2], [3, 3], [3, 2], [3, 1], [6, 1], [7, 0], [7, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 3], [9, 2], [9, 3], [9, 2], [9, 2], [9, 1], [17, 3], [25, 3], [25, 1], [13, 1], [13, 2], [13, 1], [29, 1], [29, 3], [30, 3], [32, 3], [32, 1], [15, 1], [15, 2], [15, 1], [33, 3], [4, 1], [4, 1], [4, 1], [11, 1], [11, 1], [11, 1], [37, 1], [37, 2], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1], [40, 1]],
    performAction: function(M, B, N, D, E, V, nt) {
      var O = V.length - 1;
      switch (E) {
        case 5:
          D.setOrientation(V[O]);
          break;
        case 9:
          D.setDiagramTitle(V[O].text.trim());
          break;
        case 12:
          D.setLineData({ text: "", type: "text" }, V[O]);
          break;
        case 13:
          D.setLineData(V[O - 1], V[O]);
          break;
        case 14:
          D.setBarData({ text: "", type: "text" }, V[O]);
          break;
        case 15:
          D.setBarData(V[O - 1], V[O]);
          break;
        case 16:
          this.$ = V[O].trim(), D.setAccTitle(this.$);
          break;
        case 17:
        case 18:
          this.$ = V[O].trim(), D.setAccDescription(this.$);
          break;
        case 19:
          this.$ = V[O - 1];
          break;
        case 20:
          this.$ = [Number(V[O - 2]), ...V[O]];
          break;
        case 21:
          this.$ = [Number(V[O])];
          break;
        case 22:
          D.setXAxisTitle(V[O]);
          break;
        case 23:
          D.setXAxisTitle(V[O - 1]);
          break;
        case 24:
          D.setXAxisTitle({ type: "text", text: "" });
          break;
        case 25:
          D.setXAxisBand(V[O]);
          break;
        case 26:
          D.setXAxisRangeData(Number(V[O - 2]), Number(V[O]));
          break;
        case 27:
          this.$ = V[O - 1];
          break;
        case 28:
          this.$ = [V[O - 2], ...V[O]];
          break;
        case 29:
          this.$ = [V[O]];
          break;
        case 30:
          D.setYAxisTitle(V[O]);
          break;
        case 31:
          D.setYAxisTitle(V[O - 1]);
          break;
        case 32:
          D.setYAxisTitle({ type: "text", text: "" });
          break;
        case 33:
          D.setYAxisRangeData(Number(V[O - 2]), Number(V[O]));
          break;
        case 37:
          this.$ = { text: V[O], type: "text" };
          break;
        case 38:
          this.$ = { text: V[O], type: "text" };
          break;
        case 39:
          this.$ = { text: V[O], type: "markdown" };
          break;
        case 40:
          this.$ = V[O];
          break;
        case 41:
          this.$ = V[O - 1] + "" + V[O];
          break;
      }
    },
    table: [t(e, n, { 3: 1, 4: 2, 7: 4, 5: i, 34: r, 35: s, 36: a }), { 1: [3] }, t(e, n, { 4: 2, 7: 4, 3: 8, 5: i, 34: r, 35: s, 36: a }), t(e, n, { 4: 2, 7: 4, 6: 9, 3: 10, 5: i, 8: [1, 11], 34: r, 35: s, 36: a }), { 1: [2, 4], 9: 12, 10: [1, 13], 12: [1, 14], 14: [1, 15], 16: [1, 16], 18: [1, 17], 19: [1, 18], 21: [1, 19], 23: [1, 20] }, t(o, [2, 34]), t(o, [2, 35]), t(o, [2, 36]), { 1: [2, 1] }, t(e, n, { 4: 2, 7: 4, 3: 21, 5: i, 34: r, 35: s, 36: a }), { 1: [2, 3] }, t(o, [2, 5]), t(e, [2, 7], { 4: 22, 34: r, 35: s, 36: a }), { 11: 23, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }, { 11: 39, 13: 38, 24: L, 27: w, 29: 40, 30: 41, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }, { 11: 45, 15: 44, 27: b, 33: 46, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }, { 11: 49, 17: 48, 24: F, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }, { 11: 52, 17: 51, 24: F, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }, { 20: [1, 53] }, { 22: [1, 54] }, t(S, [2, 18]), { 1: [2, 2] }, t(S, [2, 8]), t(S, [2, 9]), t(x, [2, 37], { 40: 55, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }), t(x, [2, 38]), t(x, [2, 39]), t(C, [2, 40]), t(C, [2, 42]), t(C, [2, 43]), t(C, [2, 44]), t(C, [2, 45]), t(C, [2, 46]), t(C, [2, 47]), t(C, [2, 48]), t(C, [2, 49]), t(C, [2, 50]), t(C, [2, 51]), t(S, [2, 10]), t(S, [2, 22], { 30: 41, 29: 56, 24: L, 27: w }), t(S, [2, 24]), t(S, [2, 25]), { 31: [1, 57] }, { 11: 59, 32: 58, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }, t(S, [2, 11]), t(S, [2, 30], { 33: 60, 27: b }), t(S, [2, 32]), { 31: [1, 61] }, t(S, [2, 12]), { 17: 62, 24: F }, { 25: 63, 27: g }, t(S, [2, 14]), { 17: 65, 24: F }, t(S, [2, 16]), t(S, [2, 17]), t(C, [2, 41]), t(S, [2, 23]), { 27: [1, 66] }, { 26: [1, 67] }, { 26: [2, 29], 28: [1, 68] }, t(S, [2, 31]), { 27: [1, 69] }, t(S, [2, 13]), { 26: [1, 70] }, { 26: [2, 21], 28: [1, 71] }, t(S, [2, 15]), t(S, [2, 26]), t(S, [2, 27]), { 11: 59, 32: 72, 37: 24, 38: l, 39: u, 40: 27, 41: h, 42: f, 43: d, 44: p, 45: y, 46: m, 47: _, 48: T, 49: v, 50: A }, t(S, [2, 33]), t(S, [2, 19]), { 25: 73, 27: g }, { 26: [2, 28] }, { 26: [2, 20] }],
    defaultActions: { 8: [2, 1], 10: [2, 3], 21: [2, 2], 72: [2, 28], 73: [2, 20] },
    parseError: function(M, B) {
      if (B.recoverable)
        this.trace(M);
      else {
        var N = new Error(M);
        throw N.hash = B, N;
      }
    },
    parse: function(M) {
      var B = this, N = [0], D = [], E = [null], V = [], nt = this.table, O = "", ct = 0, X = 0, H = 2, it = 1, ot = V.slice.call(arguments, 1), W = Object.create(this.lexer), Z = { yy: {} };
      for (var q in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, q) && (Z.yy[q] = this.yy[q]);
      W.setInput(M, Z.yy), Z.yy.lexer = W, Z.yy.parser = this, typeof W.yylloc > "u" && (W.yylloc = {});
      var G = W.yylloc;
      V.push(G);
      var U = W.options && W.options.ranges;
      typeof Z.yy.parseError == "function" ? this.parseError = Z.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function ht() {
        var dt;
        return dt = D.pop() || W.lex() || it, typeof dt != "number" && (dt instanceof Array && (D = dt, dt = D.pop()), dt = B.symbols_[dt] || dt), dt;
      }
      for (var Y, wt, J, Ct, Tt = {}, $t, Rt, te, mt; ; ) {
        if (wt = N[N.length - 1], this.defaultActions[wt] ? J = this.defaultActions[wt] : ((Y === null || typeof Y > "u") && (Y = ht()), J = nt[wt] && nt[wt][Y]), typeof J > "u" || !J.length || !J[0]) {
          var pt = "";
          mt = [];
          for ($t in nt[wt])
            this.terminals_[$t] && $t > H && mt.push("'" + this.terminals_[$t] + "'");
          W.showPosition ? pt = "Parse error on line " + (ct + 1) + `:
` + W.showPosition() + `
Expecting ` + mt.join(", ") + ", got '" + (this.terminals_[Y] || Y) + "'" : pt = "Parse error on line " + (ct + 1) + ": Unexpected " + (Y == it ? "end of input" : "'" + (this.terminals_[Y] || Y) + "'"), this.parseError(pt, {
            text: W.match,
            token: this.terminals_[Y] || Y,
            line: W.yylineno,
            loc: G,
            expected: mt
          });
        }
        if (J[0] instanceof Array && J.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + wt + ", token: " + Y);
        switch (J[0]) {
          case 1:
            N.push(Y), E.push(W.yytext), V.push(W.yylloc), N.push(J[1]), Y = null, X = W.yyleng, O = W.yytext, ct = W.yylineno, G = W.yylloc;
            break;
          case 2:
            if (Rt = this.productions_[J[1]][1], Tt.$ = E[E.length - Rt], Tt._$ = {
              first_line: V[V.length - (Rt || 1)].first_line,
              last_line: V[V.length - 1].last_line,
              first_column: V[V.length - (Rt || 1)].first_column,
              last_column: V[V.length - 1].last_column
            }, U && (Tt._$.range = [
              V[V.length - (Rt || 1)].range[0],
              V[V.length - 1].range[1]
            ]), Ct = this.performAction.apply(Tt, [
              O,
              X,
              ct,
              Z.yy,
              J[1],
              E,
              V
            ].concat(ot)), typeof Ct < "u")
              return Ct;
            Rt && (N = N.slice(0, -1 * Rt * 2), E = E.slice(0, -1 * Rt), V = V.slice(0, -1 * Rt)), N.push(this.productions_[J[1]][0]), E.push(Tt.$), V.push(Tt._$), te = nt[N[N.length - 2]][N[N.length - 1]], N.push(te);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, k = /* @__PURE__ */ (function() {
    var R = {
      EOF: 1,
      parseError: function(B, N) {
        if (this.yy.parser)
          this.yy.parser.parseError(B, N);
        else
          throw new Error(B);
      },
      // resets the lexer, sets new input
      setInput: function(M, B) {
        return this.yy = B || this.yy || {}, this._input = M, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var M = this._input[0];
        this.yytext += M, this.yyleng++, this.offset++, this.match += M, this.matched += M;
        var B = M.match(/(?:\r\n?|\n).*/g);
        return B ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), M;
      },
      // unshifts one char (or a string) into the input
      unput: function(M) {
        var B = M.length, N = M.split(/(?:\r\n?|\n)/g);
        this._input = M + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - B), this.offset -= B;
        var D = this.match.split(/(?:\r\n?|\n)/g);
        this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), N.length - 1 && (this.yylineno -= N.length - 1);
        var E = this.yylloc.range;
        return this.yylloc = {
          first_line: this.yylloc.first_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.first_column,
          last_column: N ? (N.length === D.length ? this.yylloc.first_column : 0) + D[D.length - N.length].length - N[0].length : this.yylloc.first_column - B
        }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - B]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(M) {
        this.unput(this.match.slice(M));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var M = this.matched.substr(0, this.matched.length - this.match.length);
        return (M.length > 20 ? "..." : "") + M.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var M = this.match;
        return M.length < 20 && (M += this._input.substr(0, 20 - M.length)), (M.substr(0, 20) + (M.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var M = this.pastInput(), B = new Array(M.length + 1).join("-");
        return M + this.upcomingInput() + `
` + B + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(M, B) {
        var N, D, E;
        if (this.options.backtrack_lexer && (E = {
          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 && (E.yylloc.range = this.yylloc.range.slice(0))), D = M[0].match(/(?:\r\n?|\n).*/g), D && (this.yylineno += D.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: D ? D[D.length - 1].length - D[D.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + M[0].length
        }, this.yytext += M[0], this.match += M[0], this.matches = M, 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(M[0].length), this.matched += M[0], N = this.performAction.call(this, this.yy, this, B, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), N)
          return N;
        if (this._backtrack) {
          for (var V in E)
            this[V] = E[V];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var M, B, N, D;
        this._more || (this.yytext = "", this.match = "");
        for (var E = this._currentRules(), V = 0; V < E.length; V++)
          if (N = this._input.match(this.rules[E[V]]), N && (!B || N[0].length > B[0].length)) {
            if (B = N, D = V, this.options.backtrack_lexer) {
              if (M = this.test_match(N, E[V]), M !== !1)
                return M;
              if (this._backtrack) {
                B = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return B ? (M = this.test_match(B, E[D]), M !== !1 ? M : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var B = this.next();
        return B || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(B) {
        this.conditionStack.push(B);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var B = this.conditionStack.length - 1;
        return B > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(B) {
        return B = this.conditionStack.length - 1 - Math.abs(B || 0), B >= 0 ? this.conditionStack[B] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(B) {
        this.begin(B);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(B, N, D, E) {
        switch (D) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return this.popState(), 34;
          case 3:
            return this.popState(), 34;
          case 4:
            return 34;
          case 5:
            break;
          case 6:
            return 10;
          case 7:
            return this.pushState("acc_title"), 19;
          case 8:
            return this.popState(), "acc_title_value";
          case 9:
            return this.pushState("acc_descr"), 21;
          case 10:
            return this.popState(), "acc_descr_value";
          case 11:
            this.pushState("acc_descr_multiline");
            break;
          case 12:
            this.popState();
            break;
          case 13:
            return "acc_descr_multiline_value";
          case 14:
            return 5;
          case 15:
            return 8;
          case 16:
            return this.pushState("axis_data"), "X_AXIS";
          case 17:
            return this.pushState("axis_data"), "Y_AXIS";
          case 18:
            return this.pushState("axis_band_data"), 24;
          case 19:
            return 31;
          case 20:
            return this.pushState("data"), 16;
          case 21:
            return this.pushState("data"), 18;
          case 22:
            return this.pushState("data_inner"), 24;
          case 23:
            return 27;
          case 24:
            return this.popState(), 26;
          case 25:
            this.popState();
            break;
          case 26:
            this.pushState("string");
            break;
          case 27:
            this.popState();
            break;
          case 28:
            return "STR";
          case 29:
            return 24;
          case 30:
            return 26;
          case 31:
            return 43;
          case 32:
            return "COLON";
          case 33:
            return 44;
          case 34:
            return 28;
          case 35:
            return 45;
          case 36:
            return 46;
          case 37:
            return 48;
          case 38:
            return 50;
          case 39:
            return 47;
          case 40:
            return 41;
          case 41:
            return 49;
          case 42:
            return 42;
          case 43:
            break;
          case 44:
            return 35;
          case 45:
            return 36;
        }
      },
      rules: [/^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:(\r?\n))/i, /^(?:(\r?\n))/i, /^(?:[\n\r]+)/i, /^(?:%%[^\n]*)/i, /^(?:title\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:\{)/i, /^(?:[^\}]*)/i, /^(?:xychart-beta\b)/i, /^(?:(?:vertical|horizontal))/i, /^(?:x-axis\b)/i, /^(?:y-axis\b)/i, /^(?:\[)/i, /^(?:-->)/i, /^(?:line\b)/i, /^(?:bar\b)/i, /^(?:\[)/i, /^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i, /^(?:\])/i, /^(?:(?:`\)                                    \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+                  \{ return MD_STR; \}\n<md_string>\(\?:`))/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:[A-Za-z]+)/i, /^(?::)/i, /^(?:\+)/i, /^(?:,)/i, /^(?:=)/i, /^(?:\*)/i, /^(?:#)/i, /^(?:[\_])/i, /^(?:\.)/i, /^(?:&)/i, /^(?:-)/i, /^(?:[0-9]+)/i, /^(?:\s+)/i, /^(?:;)/i, /^(?:$)/i],
      conditions: { data_inner: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 23, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, data: { rules: [0, 1, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 22, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, axis_band_data: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 24, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, axis_data: { rules: [0, 1, 2, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19, 20, 21, 23, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 }, acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, title: { rules: [], inclusive: !1 }, md_string: { rules: [], inclusive: !1 }, string: { rules: [27, 28], inclusive: !1 }, INITIAL: { rules: [0, 1, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 20, 21, 25, 26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45], inclusive: !0 } }
    };
    return R;
  })();
  I.lexer = k;
  function P() {
    this.yy = {};
  }
  return P.prototype = I, I.Parser = P, new P();
})();
I1.parser = I1;
const gH = I1;
function H2(t) {
  return t.type === "bar";
}
function T_(t) {
  return t.type === "band";
}
function Do(t) {
  return t.type === "linear";
}
class w_ {
  constructor(e) {
    this.parentGroup = e;
  }
  getMaxDimension(e, n) {
    if (!this.parentGroup)
      return {
        width: e.reduce((s, a) => Math.max(a.length, s), 0) * n,
        height: n
      };
    const i = {
      width: 0,
      height: 0
    }, r = this.parentGroup.append("g").attr("visibility", "hidden").attr("font-size", n);
    for (const s of e) {
      const a = Oq(r, 1, s), o = a ? a.width : s.length * n, l = a ? a.height : n;
      i.width = Math.max(i.width, o), i.height = Math.max(i.height, l);
    }
    return r.remove(), i;
  }
}
const G2 = 0.7, j2 = 0.2;
class v_ {
  constructor(e, n, i, r) {
    this.axisConfig = e, this.title = n, this.textDimensionCalculator = i, this.axisThemeConfig = r, this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left", this.showTitle = !1, this.showLabel = !1, this.showTick = !1, this.showAxisLine = !1, this.outerPadding = 0, this.titleTextHeight = 0, this.labelTextHeight = 0, this.range = [0, 10], this.boundingRect = { x: 0, y: 0, width: 0, height: 0 }, this.axisPosition = "left";
  }
  setRange(e) {
    this.range = e, this.axisPosition === "left" || this.axisPosition === "right" ? this.boundingRect.height = e[1] - e[0] : this.boundingRect.width = e[1] - e[0], this.recalculateScale();
  }
  getRange() {
    return [this.range[0] + this.outerPadding, this.range[1] - this.outerPadding];
  }
  setAxisPosition(e) {
    this.axisPosition = e, this.setRange(this.range);
  }
  getTickDistance() {
    const e = this.getRange();
    return Math.abs(e[0] - e[1]) / this.getTickValues().length;
  }
  getAxisOuterPadding() {
    return this.outerPadding;
  }
  getLabelDimension() {
    return this.textDimensionCalculator.getMaxDimension(
      this.getTickValues().map((e) => e.toString()),
      this.axisConfig.labelFontSize
    );
  }
  recalculateOuterPaddingToDrawBar() {
    G2 * this.getTickDistance() > this.outerPadding * 2 && (this.outerPadding = Math.floor(G2 * this.getTickDistance() / 2)), this.recalculateScale();
  }
  calculateSpaceIfDrawnHorizontally(e) {
    let n = e.height;
    if (this.axisConfig.showAxisLine && n > this.axisConfig.axisLineWidth && (n -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
      const i = this.getLabelDimension(), r = j2 * e.width;
      this.outerPadding = Math.min(i.width / 2, r);
      const s = i.height + this.axisConfig.labelPadding * 2;
      this.labelTextHeight = i.height, s <= n && (n -= s, this.showLabel = !0);
    }
    if (this.axisConfig.showTick && n >= this.axisConfig.tickLength && (this.showTick = !0, n -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
      const i = this.textDimensionCalculator.getMaxDimension(
        [this.title],
        this.axisConfig.titleFontSize
      ), r = i.height + this.axisConfig.titlePadding * 2;
      this.titleTextHeight = i.height, r <= n && (n -= r, this.showTitle = !0);
    }
    this.boundingRect.width = e.width, this.boundingRect.height = e.height - n;
  }
  calculateSpaceIfDrawnVertical(e) {
    let n = e.width;
    if (this.axisConfig.showAxisLine && n > this.axisConfig.axisLineWidth && (n -= this.axisConfig.axisLineWidth, this.showAxisLine = !0), this.axisConfig.showLabel) {
      const i = this.getLabelDimension(), r = j2 * e.height;
      this.outerPadding = Math.min(i.height / 2, r);
      const s = i.width + this.axisConfig.labelPadding * 2;
      s <= n && (n -= s, this.showLabel = !0);
    }
    if (this.axisConfig.showTick && n >= this.axisConfig.tickLength && (this.showTick = !0, n -= this.axisConfig.tickLength), this.axisConfig.showTitle && this.title) {
      const i = this.textDimensionCalculator.getMaxDimension(
        [this.title],
        this.axisConfig.titleFontSize
      ), r = i.height + this.axisConfig.titlePadding * 2;
      this.titleTextHeight = i.height, r <= n && (n -= r, this.showTitle = !0);
    }
    this.boundingRect.width = e.width - n, this.boundingRect.height = e.height;
  }
  calculateSpace(e) {
    return this.axisPosition === "left" || this.axisPosition === "right" ? this.calculateSpaceIfDrawnVertical(e) : this.calculateSpaceIfDrawnHorizontally(e), this.recalculateScale(), {
      width: this.boundingRect.width,
      height: this.boundingRect.height
    };
  }
  setBoundingBoxXY(e) {
    this.boundingRect.x = e.x, this.boundingRect.y = e.y;
  }
  getDrawableElementsForLeftAxis() {
    const e = [];
    if (this.showAxisLine) {
      const n = this.boundingRect.x + this.boundingRect.width - this.axisConfig.axisLineWidth / 2;
      e.push({
        type: "path",
        groupTexts: ["left-axis", "axisl-line"],
        data: [
          {
            path: `M ${n},${this.boundingRect.y} L ${n},${this.boundingRect.y + this.boundingRect.height} `,
            strokeFill: this.axisThemeConfig.axisLineColor,
            strokeWidth: this.axisConfig.axisLineWidth
          }
        ]
      });
    }
    if (this.showLabel && e.push({
      type: "text",
      groupTexts: ["left-axis", "label"],
      data: this.getTickValues().map((n) => ({
        text: n.toString(),
        x: this.boundingRect.x + this.boundingRect.width - (this.showLabel ? this.axisConfig.labelPadding : 0) - (this.showTick ? this.axisConfig.tickLength : 0) - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
        y: this.getScaleValue(n),
        fill: this.axisThemeConfig.labelColor,
        fontSize: this.axisConfig.labelFontSize,
        rotation: 0,
        verticalPos: "middle",
        horizontalPos: "right"
      }))
    }), this.showTick) {
      const n = this.boundingRect.x + this.boundingRect.width - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
      e.push({
        type: "path",
        groupTexts: ["left-axis", "ticks"],
        data: this.getTickValues().map((i) => ({
          path: `M ${n},${this.getScaleValue(i)} L ${n - this.axisConfig.tickLength},${this.getScaleValue(i)}`,
          strokeFill: this.axisThemeConfig.tickColor,
          strokeWidth: this.axisConfig.tickWidth
        }))
      });
    }
    return this.showTitle && e.push({
      type: "text",
      groupTexts: ["left-axis", "title"],
      data: [
        {
          text: this.title,
          x: this.boundingRect.x + this.axisConfig.titlePadding,
          y: this.boundingRect.y + this.boundingRect.height / 2,
          fill: this.axisThemeConfig.titleColor,
          fontSize: this.axisConfig.titleFontSize,
          rotation: 270,
          verticalPos: "top",
          horizontalPos: "center"
        }
      ]
    }), e;
  }
  getDrawableElementsForBottomAxis() {
    const e = [];
    if (this.showAxisLine) {
      const n = this.boundingRect.y + this.axisConfig.axisLineWidth / 2;
      e.push({
        type: "path",
        groupTexts: ["bottom-axis", "axis-line"],
        data: [
          {
            path: `M ${this.boundingRect.x},${n} L ${this.boundingRect.x + this.boundingRect.width},${n}`,
            strokeFill: this.axisThemeConfig.axisLineColor,
            strokeWidth: this.axisConfig.axisLineWidth
          }
        ]
      });
    }
    if (this.showLabel && e.push({
      type: "text",
      groupTexts: ["bottom-axis", "label"],
      data: this.getTickValues().map((n) => ({
        text: n.toString(),
        x: this.getScaleValue(n),
        y: this.boundingRect.y + this.axisConfig.labelPadding + (this.showTick ? this.axisConfig.tickLength : 0) + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0),
        fill: this.axisThemeConfig.labelColor,
        fontSize: this.axisConfig.labelFontSize,
        rotation: 0,
        verticalPos: "top",
        horizontalPos: "center"
      }))
    }), this.showTick) {
      const n = this.boundingRect.y + (this.showAxisLine ? this.axisConfig.axisLineWidth : 0);
      e.push({
        type: "path",
        groupTexts: ["bottom-axis", "ticks"],
        data: this.getTickValues().map((i) => ({
          path: `M ${this.getScaleValue(i)},${n} L ${this.getScaleValue(i)},${n + this.axisConfig.tickLength}`,
          strokeFill: this.axisThemeConfig.tickColor,
          strokeWidth: this.axisConfig.tickWidth
        }))
      });
    }
    return this.showTitle && e.push({
      type: "text",
      groupTexts: ["bottom-axis", "title"],
      data: [
        {
          text: this.title,
          x: this.range[0] + (this.range[1] - this.range[0]) / 2,
          y: this.boundingRect.y + this.boundingRect.height - this.axisConfig.titlePadding - this.titleTextHeight,
          fill: this.axisThemeConfig.titleColor,
          fontSize: this.axisConfig.titleFontSize,
          rotation: 0,
          verticalPos: "top",
          horizontalPos: "center"
        }
      ]
    }), e;
  }
  getDrawableElementsForTopAxis() {
    const e = [];
    if (this.showAxisLine) {
      const n = this.boundingRect.y + this.boundingRect.height - this.axisConfig.axisLineWidth / 2;
      e.push({
        type: "path",
        groupTexts: ["top-axis", "axis-line"],
        data: [
          {
            path: `M ${this.boundingRect.x},${n} L ${this.boundingRect.x + this.boundingRect.width},${n}`,
            strokeFill: this.axisThemeConfig.axisLineColor,
            strokeWidth: this.axisConfig.axisLineWidth
          }
        ]
      });
    }
    if (this.showLabel && e.push({
      type: "text",
      groupTexts: ["top-axis", "label"],
      data: this.getTickValues().map((n) => ({
        text: n.toString(),
        x: this.getScaleValue(n),
        y: this.boundingRect.y + (this.showTitle ? this.titleTextHeight + this.axisConfig.titlePadding * 2 : 0) + this.axisConfig.labelPadding,
        fill: this.axisThemeConfig.labelColor,
        fontSize: this.axisConfig.labelFontSize,
        rotation: 0,
        verticalPos: "top",
        horizontalPos: "center"
      }))
    }), this.showTick) {
      const n = this.boundingRect.y;
      e.push({
        type: "path",
        groupTexts: ["top-axis", "ticks"],
        data: this.getTickValues().map((i) => ({
          path: `M ${this.getScaleValue(i)},${n + this.boundingRect.height - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)} L ${this.getScaleValue(i)},${n + this.boundingRect.height - this.axisConfig.tickLength - (this.showAxisLine ? this.axisConfig.axisLineWidth : 0)}`,
          strokeFill: this.axisThemeConfig.tickColor,
          strokeWidth: this.axisConfig.tickWidth
        }))
      });
    }
    return this.showTitle && e.push({
      type: "text",
      groupTexts: ["top-axis", "title"],
      data: [
        {
          text: this.title,
          x: this.boundingRect.x + this.boundingRect.width / 2,
          y: this.boundingRect.y + this.axisConfig.titlePadding,
          fill: this.axisThemeConfig.titleColor,
          fontSize: this.axisConfig.titleFontSize,
          rotation: 0,
          verticalPos: "top",
          horizontalPos: "center"
        }
      ]
    }), e;
  }
  getDrawableElements() {
    if (this.axisPosition === "left")
      return this.getDrawableElementsForLeftAxis();
    if (this.axisPosition === "right")
      throw Error("Drawing of right axis is not implemented");
    return this.axisPosition === "bottom" ? this.getDrawableElementsForBottomAxis() : this.axisPosition === "top" ? this.getDrawableElementsForTopAxis() : [];
  }
}
class yH extends v_ {
  constructor(e, n, i, r, s) {
    super(e, r, s, n), this.categories = i, this.scale = Md().domain(this.categories).range(this.getRange());
  }
  setRange(e) {
    super.setRange(e);
  }
  recalculateScale() {
    this.scale = Md().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5), z.trace("BandAxis axis final categories, range: ", this.categories, this.getRange());
  }
  getTickValues() {
    return this.categories;
  }
  getScaleValue(e) {
    return this.scale(e) || this.getRange()[0];
  }
}
class mH extends v_ {
  constructor(e, n, i, r, s) {
    super(e, r, s, n), this.domain = i, this.scale = ya().domain(this.domain).range(this.getRange());
  }
  getTickValues() {
    return this.scale.ticks();
  }
  recalculateScale() {
    const e = [...this.domain];
    this.axisPosition === "left" && e.reverse(), this.scale = ya().domain(e).range(this.getRange());
  }
  getScaleValue(e) {
    return this.scale(e);
  }
}
function X2(t, e, n, i) {
  const r = new w_(i);
  return T_(t) ? new yH(
    e,
    n,
    t.categories,
    t.title,
    r
  ) : new mH(
    e,
    n,
    [t.min, t.max],
    t.title,
    r
  );
}
class xH {
  constructor(e, n, i, r) {
    this.textDimensionCalculator = e, this.chartConfig = n, this.chartData = i, this.chartThemeConfig = r, this.boundingRect = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    }, this.showChartTitle = !1;
  }
  setBoundingBoxXY(e) {
    this.boundingRect.x = e.x, this.boundingRect.y = e.y;
  }
  calculateSpace(e) {
    const n = this.textDimensionCalculator.getMaxDimension(
      [this.chartData.title],
      this.chartConfig.titleFontSize
    ), i = Math.max(n.width, e.width), r = n.height + 2 * this.chartConfig.titlePadding;
    return n.width <= i && n.height <= r && this.chartConfig.showTitle && this.chartData.title && (this.boundingRect.width = i, this.boundingRect.height = r, this.showChartTitle = !0), {
      width: this.boundingRect.width,
      height: this.boundingRect.height
    };
  }
  getDrawableElements() {
    const e = [];
    return this.showChartTitle && e.push({
      groupTexts: ["chart-title"],
      type: "text",
      data: [
        {
          fontSize: this.chartConfig.titleFontSize,
          text: this.chartData.title,
          verticalPos: "middle",
          horizontalPos: "center",
          x: this.boundingRect.x + this.boundingRect.width / 2,
          y: this.boundingRect.y + this.boundingRect.height / 2,
          fill: this.chartThemeConfig.titleColor,
          rotation: 0
        }
      ]
    }), e;
  }
}
function bH(t, e, n, i) {
  const r = new w_(i);
  return new xH(r, t, e, n);
}
class _H {
  constructor(e, n, i, r, s) {
    this.plotData = e, this.xAxis = n, this.yAxis = i, this.orientation = r, this.plotIndex = s;
  }
  getDrawableElement() {
    const e = this.plotData.data.map((i) => [
      this.xAxis.getScaleValue(i[0]),
      this.yAxis.getScaleValue(i[1])
    ]);
    let n;
    return this.orientation === "horizontal" ? n = Tr().y((i) => i[0]).x((i) => i[1])(e) : n = Tr().x((i) => i[0]).y((i) => i[1])(e), n ? [
      {
        groupTexts: ["plot", `line-plot-${this.plotIndex}`],
        type: "path",
        data: [
          {
            path: n,
            strokeFill: this.plotData.strokeFill,
            strokeWidth: this.plotData.strokeWidth
          }
        ]
      }
    ] : [];
  }
}
class kH {
  constructor(e, n, i, r, s, a) {
    this.barData = e, this.boundingRect = n, this.xAxis = i, this.yAxis = r, this.orientation = s, this.plotIndex = a;
  }
  getDrawableElement() {
    const e = this.barData.data.map((s) => [
      this.xAxis.getScaleValue(s[0]),
      this.yAxis.getScaleValue(s[1])
    ]), i = Math.min(this.xAxis.getAxisOuterPadding() * 2, this.xAxis.getTickDistance()) * (1 - 0.05), r = i / 2;
    return this.orientation === "horizontal" ? [
      {
        groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
        type: "rect",
        data: e.map((s) => ({
          x: this.boundingRect.x,
          y: s[0] - r,
          height: i,
          width: s[1] - this.boundingRect.x,
          fill: this.barData.fill,
          strokeWidth: 0,
          strokeFill: this.barData.fill
        }))
      }
    ] : [
      {
        groupTexts: ["plot", `bar-plot-${this.plotIndex}`],
        type: "rect",
        data: e.map((s) => ({
          x: s[0] - r,
          y: s[1],
          width: i,
          height: this.boundingRect.y + this.boundingRect.height - s[1],
          fill: this.barData.fill,
          strokeWidth: 0,
          strokeFill: this.barData.fill
        }))
      }
    ];
  }
}
class TH {
  constructor(e, n, i) {
    this.chartConfig = e, this.chartData = n, this.chartThemeConfig = i, this.boundingRect = {
      x: 0,
      y: 0,
      width: 0,
      height: 0
    };
  }
  setAxes(e, n) {
    this.xAxis = e, this.yAxis = n;
  }
  setBoundingBoxXY(e) {
    this.boundingRect.x = e.x, this.boundingRect.y = e.y;
  }
  calculateSpace(e) {
    return this.boundingRect.width = e.width, this.boundingRect.height = e.height, {
      width: this.boundingRect.width,
      height: this.boundingRect.height
    };
  }
  getDrawableElements() {
    if (!(this.xAxis && this.yAxis))
      throw Error("Axes must be passed to render Plots");
    const e = [];
    for (const [n, i] of this.chartData.plots.entries())
      switch (i.type) {
        case "line":
          {
            const r = new _H(
              i,
              this.xAxis,
              this.yAxis,
              this.chartConfig.chartOrientation,
              n
            );
            e.push(...r.getDrawableElement());
          }
          break;
        case "bar":
          {
            const r = new kH(
              i,
              this.boundingRect,
              this.xAxis,
              this.yAxis,
              this.chartConfig.chartOrientation,
              n
            );
            e.push(...r.getDrawableElement());
          }
          break;
      }
    return e;
  }
}
function wH(t, e, n) {
  return new TH(t, e, n);
}
class vH {
  constructor(e, n, i, r) {
    this.chartConfig = e, this.chartData = n, this.componentStore = {
      title: bH(e, n, i, r),
      plot: wH(e, n, i),
      xAxis: X2(
        n.xAxis,
        e.xAxis,
        {
          titleColor: i.xAxisTitleColor,
          labelColor: i.xAxisLabelColor,
          tickColor: i.xAxisTickColor,
          axisLineColor: i.xAxisLineColor
        },
        r
      ),
      yAxis: X2(
        n.yAxis,
        e.yAxis,
        {
          titleColor: i.yAxisTitleColor,
          labelColor: i.yAxisLabelColor,
          tickColor: i.yAxisTickColor,
          axisLineColor: i.yAxisLineColor
        },
        r
      )
    };
  }
  calculateVerticalSpace() {
    let e = this.chartConfig.width, n = this.chartConfig.height, i = 0, r = 0, s = Math.floor(e * this.chartConfig.plotReservedSpacePercent / 100), a = Math.floor(
      n * this.chartConfig.plotReservedSpacePercent / 100
    ), o = this.componentStore.plot.calculateSpace({
      width: s,
      height: a
    });
    e -= o.width, n -= o.height, o = this.componentStore.title.calculateSpace({
      width: this.chartConfig.width,
      height: n
    }), r = o.height, n -= o.height, this.componentStore.xAxis.setAxisPosition("bottom"), o = this.componentStore.xAxis.calculateSpace({
      width: e,
      height: n
    }), n -= o.height, this.componentStore.yAxis.setAxisPosition("left"), o = this.componentStore.yAxis.calculateSpace({
      width: e,
      height: n
    }), i = o.width, e -= o.width, e > 0 && (s += e, e = 0), n > 0 && (a += n, n = 0), this.componentStore.plot.calculateSpace({
      width: s,
      height: a
    }), this.componentStore.plot.setBoundingBoxXY({ x: i, y: r }), this.componentStore.xAxis.setRange([i, i + s]), this.componentStore.xAxis.setBoundingBoxXY({ x: i, y: r + a }), this.componentStore.yAxis.setRange([r, r + a]), this.componentStore.yAxis.setBoundingBoxXY({ x: 0, y: r }), this.chartData.plots.some((l) => H2(l)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
  }
  calculateHorizontalSpace() {
    let e = this.chartConfig.width, n = this.chartConfig.height, i = 0, r = 0, s = 0, a = Math.floor(e * this.chartConfig.plotReservedSpacePercent / 100), o = Math.floor(
      n * this.chartConfig.plotReservedSpacePercent / 100
    ), l = this.componentStore.plot.calculateSpace({
      width: a,
      height: o
    });
    e -= l.width, n -= l.height, l = this.componentStore.title.calculateSpace({
      width: this.chartConfig.width,
      height: n
    }), i = l.height, n -= l.height, this.componentStore.xAxis.setAxisPosition("left"), l = this.componentStore.xAxis.calculateSpace({
      width: e,
      height: n
    }), e -= l.width, r = l.width, this.componentStore.yAxis.setAxisPosition("top"), l = this.componentStore.yAxis.calculateSpace({
      width: e,
      height: n
    }), n -= l.height, s = i + l.height, e > 0 && (a += e, e = 0), n > 0 && (o += n, n = 0), this.componentStore.plot.calculateSpace({
      width: a,
      height: o
    }), this.componentStore.plot.setBoundingBoxXY({ x: r, y: s }), this.componentStore.yAxis.setRange([r, r + a]), this.componentStore.yAxis.setBoundingBoxXY({ x: r, y: i }), this.componentStore.xAxis.setRange([s, s + o]), this.componentStore.xAxis.setBoundingBoxXY({ x: 0, y: s }), this.chartData.plots.some((u) => H2(u)) && this.componentStore.xAxis.recalculateOuterPaddingToDrawBar();
  }
  calculateSpace() {
    this.chartConfig.chartOrientation === "horizontal" ? this.calculateHorizontalSpace() : this.calculateVerticalSpace();
  }
  getDrawableElement() {
    this.calculateSpace();
    const e = [];
    this.componentStore.plot.setAxes(this.componentStore.xAxis, this.componentStore.yAxis);
    for (const n of Object.values(this.componentStore))
      e.push(...n.getDrawableElements());
    return e;
  }
}
class EH {
  static build(e, n, i, r) {
    return new vH(e, n, i, r).getDrawableElement();
  }
}
let ll = 0, E_, cl = S_(), ul = C_(), ue = A_(), B1 = ul.plotColorPalette.split(",").map((t) => t.trim()), Th = !1, L0 = !1;
function C_() {
  const t = Ef(), e = Ee();
  return El(t.xyChart, e.themeVariables.xyChart);
}
function S_() {
  const t = Ee();
  return El(
    be.xyChart,
    t.xyChart
  );
}
function A_() {
  return {
    yAxis: {
      type: "linear",
      title: "",
      min: 1 / 0,
      max: -1 / 0
    },
    xAxis: {
      type: "band",
      title: "",
      categories: []
    },
    title: "",
    plots: []
  };
}
function I0(t) {
  const e = Ee();
  return Ne(t.trim(), e);
}
function CH(t) {
  E_ = t;
}
function SH(t) {
  t === "horizontal" ? cl.chartOrientation = "horizontal" : cl.chartOrientation = "vertical";
}
function AH(t) {
  ue.xAxis.title = I0(t.text);
}
function L_(t, e) {
  ue.xAxis = { type: "linear", title: ue.xAxis.title, min: t, max: e }, Th = !0;
}
function LH(t) {
  ue.xAxis = {
    type: "band",
    title: ue.xAxis.title,
    categories: t.map((e) => I0(e.text))
  }, Th = !0;
}
function IH(t) {
  ue.yAxis.title = I0(t.text);
}
function BH(t, e) {
  ue.yAxis = { type: "linear", title: ue.yAxis.title, min: t, max: e }, L0 = !0;
}
function DH(t) {
  const e = Math.min(...t), n = Math.max(...t), i = Do(ue.yAxis) ? ue.yAxis.min : 1 / 0, r = Do(ue.yAxis) ? ue.yAxis.max : -1 / 0;
  ue.yAxis = {
    type: "linear",
    title: ue.yAxis.title,
    min: Math.min(i, e),
    max: Math.max(r, n)
  };
}
function I_(t) {
  let e = [];
  if (t.length === 0)
    return e;
  if (!Th) {
    const n = Do(ue.xAxis) ? ue.xAxis.min : 1 / 0, i = Do(ue.xAxis) ? ue.xAxis.max : -1 / 0;
    L_(Math.min(n, 1), Math.max(i, t.length));
  }
  if (L0 || DH(t), T_(ue.xAxis) && (e = ue.xAxis.categories.map((n, i) => [n, t[i]])), Do(ue.xAxis)) {
    const n = ue.xAxis.min, i = ue.xAxis.max, r = (i - n + 1) / t.length, s = [];
    for (let a = n; a <= i; a += r)
      s.push(`${a}`);
    e = s.map((a, o) => [a, t[o]]);
  }
  return e;
}
function B_(t) {
  return B1[t === 0 ? 0 : t % B1.length];
}
function NH(t, e) {
  const n = I_(e);
  ue.plots.push({
    type: "line",
    strokeFill: B_(ll),
    strokeWidth: 2,
    data: n
  }), ll++;
}
function FH(t, e) {
  const n = I_(e);
  ue.plots.push({
    type: "bar",
    fill: B_(ll),
    data: n
  }), ll++;
}
function OH() {
  if (ue.plots.length === 0)
    throw Error("No Plot to render, please provide a plot with some data");
  return ue.title = Sn(), EH.build(cl, ue, ul, E_);
}
function RH() {
  return ul;
}
function MH() {
  return cl;
}
const PH = function() {
  fn(), ll = 0, cl = S_(), ue = A_(), ul = C_(), B1 = ul.plotColorPalette.split(",").map((t) => t.trim()), Th = !1, L0 = !1;
}, zH = {
  getDrawableElem: OH,
  clear: PH,
  setAccTitle: pn,
  getAccTitle: vn,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn,
  getAccDescription: Cn,
  setAccDescription: En,
  setOrientation: SH,
  setXAxisTitle: AH,
  setXAxisRangeData: L_,
  setXAxisBand: LH,
  setYAxisTitle: IH,
  setYAxisRangeData: BH,
  setLineData: NH,
  setBarData: FH,
  setTmpSVGG: CH,
  getChartThemeConfig: RH,
  getChartConfig: MH
}, VH = (t, e, n, i) => {
  const r = i.db, s = r.getChartThemeConfig(), a = r.getChartConfig();
  function o(_) {
    return _ === "top" ? "text-before-edge" : "middle";
  }
  function l(_) {
    return _ === "left" ? "start" : _ === "right" ? "end" : "middle";
  }
  function u(_) {
    return `translate(${_.x}, ${_.y}) rotate(${_.rotation || 0})`;
  }
  z.debug(`Rendering xychart chart
` + t);
  const h = Cl(e), f = h.append("g").attr("class", "main"), d = f.append("rect").attr("width", a.width).attr("height", a.height).attr("class", "background");
  dn(h, a.height, a.width, !0), h.attr("viewBox", `0 0 ${a.width} ${a.height}`), d.attr("fill", s.backgroundColor), r.setTmpSVGG(h.append("g").attr("class", "mermaid-tmp-group"));
  const p = r.getDrawableElem(), y = {};
  function m(_) {
    let T = f, v = "";
    for (const [A] of _.entries()) {
      let L = f;
      A > 0 && y[v] && (L = y[v]), v += _[A], T = y[v], T || (T = y[v] = L.append("g").attr("class", _[A]));
    }
    return T;
  }
  for (const _ of p) {
    if (_.data.length === 0)
      continue;
    const T = m(_.groupTexts);
    switch (_.type) {
      case "rect":
        T.selectAll("rect").data(_.data).enter().append("rect").attr("x", (v) => v.x).attr("y", (v) => v.y).attr("width", (v) => v.width).attr("height", (v) => v.height).attr("fill", (v) => v.fill).attr("stroke", (v) => v.strokeFill).attr("stroke-width", (v) => v.strokeWidth);
        break;
      case "text":
        T.selectAll("text").data(_.data).enter().append("text").attr("x", 0).attr("y", 0).attr("fill", (v) => v.fill).attr("font-size", (v) => v.fontSize).attr("dominant-baseline", (v) => o(v.verticalPos)).attr("text-anchor", (v) => l(v.horizontalPos)).attr("transform", (v) => u(v)).text((v) => v.text);
        break;
      case "path":
        T.selectAll("path").data(_.data).enter().append("path").attr("d", (v) => v.path).attr("fill", (v) => v.fill ? v.fill : "none").attr("stroke", (v) => v.strokeFill).attr("stroke-width", (v) => v.strokeWidth);
        break;
    }
  }
}, qH = {
  draw: VH
}, $H = {
  parser: gH,
  db: zH,
  renderer: qH
}, YH = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: $H
}, Symbol.toStringTag, { value: "Module" }));
var D1 = (function() {
  var t = function(X, H, it, ot) {
    for (it = it || {}, ot = X.length; ot--; it[X[ot]] = H)
      ;
    return it;
  }, e = [1, 3], n = [1, 4], i = [1, 5], r = [1, 6], s = [5, 6, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 62, 63], a = [1, 18], o = [2, 7], l = [1, 22], u = [1, 23], h = [1, 24], f = [1, 25], d = [1, 26], p = [1, 27], y = [1, 20], m = [1, 28], _ = [1, 29], T = [62, 63], v = [5, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 51, 53, 62, 63], A = [1, 47], L = [1, 48], w = [1, 49], b = [1, 50], F = [1, 51], S = [1, 52], x = [1, 53], C = [53, 54], g = [1, 64], I = [1, 60], k = [1, 61], P = [1, 62], R = [1, 63], M = [1, 65], B = [1, 69], N = [1, 70], D = [1, 67], E = [1, 68], V = [5, 8, 9, 11, 13, 31, 32, 33, 34, 35, 36, 44, 62, 63], nt = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, directive: 4, NEWLINE: 5, RD: 6, diagram: 7, EOF: 8, acc_title: 9, acc_title_value: 10, acc_descr: 11, acc_descr_value: 12, acc_descr_multiline_value: 13, requirementDef: 14, elementDef: 15, relationshipDef: 16, requirementType: 17, requirementName: 18, STRUCT_START: 19, requirementBody: 20, ID: 21, COLONSEP: 22, id: 23, TEXT: 24, text: 25, RISK: 26, riskLevel: 27, VERIFYMTHD: 28, verifyType: 29, STRUCT_STOP: 30, REQUIREMENT: 31, FUNCTIONAL_REQUIREMENT: 32, INTERFACE_REQUIREMENT: 33, PERFORMANCE_REQUIREMENT: 34, PHYSICAL_REQUIREMENT: 35, DESIGN_CONSTRAINT: 36, LOW_RISK: 37, MED_RISK: 38, HIGH_RISK: 39, VERIFY_ANALYSIS: 40, VERIFY_DEMONSTRATION: 41, VERIFY_INSPECTION: 42, VERIFY_TEST: 43, ELEMENT: 44, elementName: 45, elementBody: 46, TYPE: 47, type: 48, DOCREF: 49, ref: 50, END_ARROW_L: 51, relationship: 52, LINE: 53, END_ARROW_R: 54, CONTAINS: 55, COPIES: 56, DERIVES: 57, SATISFIES: 58, VERIFIES: 59, REFINES: 60, TRACES: 61, unqString: 62, qString: 63, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 5: "NEWLINE", 6: "RD", 8: "EOF", 9: "acc_title", 10: "acc_title_value", 11: "acc_descr", 12: "acc_descr_value", 13: "acc_descr_multiline_value", 19: "STRUCT_START", 21: "ID", 22: "COLONSEP", 24: "TEXT", 26: "RISK", 28: "VERIFYMTHD", 30: "STRUCT_STOP", 31: "REQUIREMENT", 32: "FUNCTIONAL_REQUIREMENT", 33: "INTERFACE_REQUIREMENT", 34: "PERFORMANCE_REQUIREMENT", 35: "PHYSICAL_REQUIREMENT", 36: "DESIGN_CONSTRAINT", 37: "LOW_RISK", 38: "MED_RISK", 39: "HIGH_RISK", 40: "VERIFY_ANALYSIS", 41: "VERIFY_DEMONSTRATION", 42: "VERIFY_INSPECTION", 43: "VERIFY_TEST", 44: "ELEMENT", 47: "TYPE", 49: "DOCREF", 51: "END_ARROW_L", 53: "LINE", 54: "END_ARROW_R", 55: "CONTAINS", 56: "COPIES", 57: "DERIVES", 58: "SATISFIES", 59: "VERIFIES", 60: "REFINES", 61: "TRACES", 62: "unqString", 63: "qString" },
    productions_: [0, [3, 3], [3, 2], [3, 4], [4, 2], [4, 2], [4, 1], [7, 0], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [14, 5], [20, 5], [20, 5], [20, 5], [20, 5], [20, 2], [20, 1], [17, 1], [17, 1], [17, 1], [17, 1], [17, 1], [17, 1], [27, 1], [27, 1], [27, 1], [29, 1], [29, 1], [29, 1], [29, 1], [15, 5], [46, 5], [46, 5], [46, 2], [46, 1], [16, 5], [16, 5], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [52, 1], [18, 1], [18, 1], [23, 1], [23, 1], [25, 1], [25, 1], [45, 1], [45, 1], [48, 1], [48, 1], [50, 1], [50, 1]],
    performAction: function(H, it, ot, W, Z, q, G) {
      var U = q.length - 1;
      switch (Z) {
        case 4:
          this.$ = q[U].trim(), W.setAccTitle(this.$);
          break;
        case 5:
        case 6:
          this.$ = q[U].trim(), W.setAccDescription(this.$);
          break;
        case 7:
          this.$ = [];
          break;
        case 13:
          W.addRequirement(q[U - 3], q[U - 4]);
          break;
        case 14:
          W.setNewReqId(q[U - 2]);
          break;
        case 15:
          W.setNewReqText(q[U - 2]);
          break;
        case 16:
          W.setNewReqRisk(q[U - 2]);
          break;
        case 17:
          W.setNewReqVerifyMethod(q[U - 2]);
          break;
        case 20:
          this.$ = W.RequirementType.REQUIREMENT;
          break;
        case 21:
          this.$ = W.RequirementType.FUNCTIONAL_REQUIREMENT;
          break;
        case 22:
          this.$ = W.RequirementType.INTERFACE_REQUIREMENT;
          break;
        case 23:
          this.$ = W.RequirementType.PERFORMANCE_REQUIREMENT;
          break;
        case 24:
          this.$ = W.RequirementType.PHYSICAL_REQUIREMENT;
          break;
        case 25:
          this.$ = W.RequirementType.DESIGN_CONSTRAINT;
          break;
        case 26:
          this.$ = W.RiskLevel.LOW_RISK;
          break;
        case 27:
          this.$ = W.RiskLevel.MED_RISK;
          break;
        case 28:
          this.$ = W.RiskLevel.HIGH_RISK;
          break;
        case 29:
          this.$ = W.VerifyType.VERIFY_ANALYSIS;
          break;
        case 30:
          this.$ = W.VerifyType.VERIFY_DEMONSTRATION;
          break;
        case 31:
          this.$ = W.VerifyType.VERIFY_INSPECTION;
          break;
        case 32:
          this.$ = W.VerifyType.VERIFY_TEST;
          break;
        case 33:
          W.addElement(q[U - 3]);
          break;
        case 34:
          W.setNewElementType(q[U - 2]);
          break;
        case 35:
          W.setNewElementDocRef(q[U - 2]);
          break;
        case 38:
          W.addRelationship(q[U - 2], q[U], q[U - 4]);
          break;
        case 39:
          W.addRelationship(q[U - 2], q[U - 4], q[U]);
          break;
        case 40:
          this.$ = W.Relationships.CONTAINS;
          break;
        case 41:
          this.$ = W.Relationships.COPIES;
          break;
        case 42:
          this.$ = W.Relationships.DERIVES;
          break;
        case 43:
          this.$ = W.Relationships.SATISFIES;
          break;
        case 44:
          this.$ = W.Relationships.VERIFIES;
          break;
        case 45:
          this.$ = W.Relationships.REFINES;
          break;
        case 46:
          this.$ = W.Relationships.TRACES;
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 6: e, 9: n, 11: i, 13: r }, { 1: [3] }, { 3: 8, 4: 2, 5: [1, 7], 6: e, 9: n, 11: i, 13: r }, { 5: [1, 9] }, { 10: [1, 10] }, { 12: [1, 11] }, t(s, [2, 6]), { 3: 12, 4: 2, 6: e, 9: n, 11: i, 13: r }, { 1: [2, 2] }, { 4: 17, 5: a, 7: 13, 8: o, 9: n, 11: i, 13: r, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: l, 32: u, 33: h, 34: f, 35: d, 36: p, 44: y, 62: m, 63: _ }, t(s, [2, 4]), t(s, [2, 5]), { 1: [2, 1] }, { 8: [1, 30] }, { 4: 17, 5: a, 7: 31, 8: o, 9: n, 11: i, 13: r, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: l, 32: u, 33: h, 34: f, 35: d, 36: p, 44: y, 62: m, 63: _ }, { 4: 17, 5: a, 7: 32, 8: o, 9: n, 11: i, 13: r, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: l, 32: u, 33: h, 34: f, 35: d, 36: p, 44: y, 62: m, 63: _ }, { 4: 17, 5: a, 7: 33, 8: o, 9: n, 11: i, 13: r, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: l, 32: u, 33: h, 34: f, 35: d, 36: p, 44: y, 62: m, 63: _ }, { 4: 17, 5: a, 7: 34, 8: o, 9: n, 11: i, 13: r, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: l, 32: u, 33: h, 34: f, 35: d, 36: p, 44: y, 62: m, 63: _ }, { 4: 17, 5: a, 7: 35, 8: o, 9: n, 11: i, 13: r, 14: 14, 15: 15, 16: 16, 17: 19, 23: 21, 31: l, 32: u, 33: h, 34: f, 35: d, 36: p, 44: y, 62: m, 63: _ }, { 18: 36, 62: [1, 37], 63: [1, 38] }, { 45: 39, 62: [1, 40], 63: [1, 41] }, { 51: [1, 42], 53: [1, 43] }, t(T, [2, 20]), t(T, [2, 21]), t(T, [2, 22]), t(T, [2, 23]), t(T, [2, 24]), t(T, [2, 25]), t(v, [2, 49]), t(v, [2, 50]), { 1: [2, 3] }, { 8: [2, 8] }, { 8: [2, 9] }, { 8: [2, 10] }, { 8: [2, 11] }, { 8: [2, 12] }, { 19: [1, 44] }, { 19: [2, 47] }, { 19: [2, 48] }, { 19: [1, 45] }, { 19: [2, 53] }, { 19: [2, 54] }, { 52: 46, 55: A, 56: L, 57: w, 58: b, 59: F, 60: S, 61: x }, { 52: 54, 55: A, 56: L, 57: w, 58: b, 59: F, 60: S, 61: x }, { 5: [1, 55] }, { 5: [1, 56] }, { 53: [1, 57] }, t(C, [2, 40]), t(C, [2, 41]), t(C, [2, 42]), t(C, [2, 43]), t(C, [2, 44]), t(C, [2, 45]), t(C, [2, 46]), { 54: [1, 58] }, { 5: g, 20: 59, 21: I, 24: k, 26: P, 28: R, 30: M }, { 5: B, 30: N, 46: 66, 47: D, 49: E }, { 23: 71, 62: m, 63: _ }, { 23: 72, 62: m, 63: _ }, t(V, [2, 13]), { 22: [1, 73] }, { 22: [1, 74] }, { 22: [1, 75] }, { 22: [1, 76] }, { 5: g, 20: 77, 21: I, 24: k, 26: P, 28: R, 30: M }, t(V, [2, 19]), t(V, [2, 33]), { 22: [1, 78] }, { 22: [1, 79] }, { 5: B, 30: N, 46: 80, 47: D, 49: E }, t(V, [2, 37]), t(V, [2, 38]), t(V, [2, 39]), { 23: 81, 62: m, 63: _ }, { 25: 82, 62: [1, 83], 63: [1, 84] }, { 27: 85, 37: [1, 86], 38: [1, 87], 39: [1, 88] }, { 29: 89, 40: [1, 90], 41: [1, 91], 42: [1, 92], 43: [1, 93] }, t(V, [2, 18]), { 48: 94, 62: [1, 95], 63: [1, 96] }, { 50: 97, 62: [1, 98], 63: [1, 99] }, t(V, [2, 36]), { 5: [1, 100] }, { 5: [1, 101] }, { 5: [2, 51] }, { 5: [2, 52] }, { 5: [1, 102] }, { 5: [2, 26] }, { 5: [2, 27] }, { 5: [2, 28] }, { 5: [1, 103] }, { 5: [2, 29] }, { 5: [2, 30] }, { 5: [2, 31] }, { 5: [2, 32] }, { 5: [1, 104] }, { 5: [2, 55] }, { 5: [2, 56] }, { 5: [1, 105] }, { 5: [2, 57] }, { 5: [2, 58] }, { 5: g, 20: 106, 21: I, 24: k, 26: P, 28: R, 30: M }, { 5: g, 20: 107, 21: I, 24: k, 26: P, 28: R, 30: M }, { 5: g, 20: 108, 21: I, 24: k, 26: P, 28: R, 30: M }, { 5: g, 20: 109, 21: I, 24: k, 26: P, 28: R, 30: M }, { 5: B, 30: N, 46: 110, 47: D, 49: E }, { 5: B, 30: N, 46: 111, 47: D, 49: E }, t(V, [2, 14]), t(V, [2, 15]), t(V, [2, 16]), t(V, [2, 17]), t(V, [2, 34]), t(V, [2, 35])],
    defaultActions: { 8: [2, 2], 12: [2, 1], 30: [2, 3], 31: [2, 8], 32: [2, 9], 33: [2, 10], 34: [2, 11], 35: [2, 12], 37: [2, 47], 38: [2, 48], 40: [2, 53], 41: [2, 54], 83: [2, 51], 84: [2, 52], 86: [2, 26], 87: [2, 27], 88: [2, 28], 90: [2, 29], 91: [2, 30], 92: [2, 31], 93: [2, 32], 95: [2, 55], 96: [2, 56], 98: [2, 57], 99: [2, 58] },
    parseError: function(H, it) {
      if (it.recoverable)
        this.trace(H);
      else {
        var ot = new Error(H);
        throw ot.hash = it, ot;
      }
    },
    parse: function(H) {
      var it = this, ot = [0], W = [], Z = [null], q = [], G = this.table, U = "", ht = 0, Y = 0, wt = 2, J = 1, Ct = q.slice.call(arguments, 1), Tt = Object.create(this.lexer), $t = { yy: {} };
      for (var Rt in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Rt) && ($t.yy[Rt] = this.yy[Rt]);
      Tt.setInput(H, $t.yy), $t.yy.lexer = Tt, $t.yy.parser = this, typeof Tt.yylloc > "u" && (Tt.yylloc = {});
      var te = Tt.yylloc;
      q.push(te);
      var mt = Tt.options && Tt.options.ranges;
      typeof $t.yy.parseError == "function" ? this.parseError = $t.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function pt() {
        var Mt;
        return Mt = W.pop() || Tt.lex() || J, typeof Mt != "number" && (Mt instanceof Array && (W = Mt, Mt = W.pop()), Mt = it.symbols_[Mt] || Mt), Mt;
      }
      for (var dt, ft, j, $, et = {}, rt, ut, Kt, Zt; ; ) {
        if (ft = ot[ot.length - 1], this.defaultActions[ft] ? j = this.defaultActions[ft] : ((dt === null || typeof dt > "u") && (dt = pt()), j = G[ft] && G[ft][dt]), typeof j > "u" || !j.length || !j[0]) {
          var Qt = "";
          Zt = [];
          for (rt in G[ft])
            this.terminals_[rt] && rt > wt && Zt.push("'" + this.terminals_[rt] + "'");
          Tt.showPosition ? Qt = "Parse error on line " + (ht + 1) + `:
` + Tt.showPosition() + `
Expecting ` + Zt.join(", ") + ", got '" + (this.terminals_[dt] || dt) + "'" : Qt = "Parse error on line " + (ht + 1) + ": Unexpected " + (dt == J ? "end of input" : "'" + (this.terminals_[dt] || dt) + "'"), this.parseError(Qt, {
            text: Tt.match,
            token: this.terminals_[dt] || dt,
            line: Tt.yylineno,
            loc: te,
            expected: Zt
          });
        }
        if (j[0] instanceof Array && j.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + ft + ", token: " + dt);
        switch (j[0]) {
          case 1:
            ot.push(dt), Z.push(Tt.yytext), q.push(Tt.yylloc), ot.push(j[1]), dt = null, Y = Tt.yyleng, U = Tt.yytext, ht = Tt.yylineno, te = Tt.yylloc;
            break;
          case 2:
            if (ut = this.productions_[j[1]][1], et.$ = Z[Z.length - ut], et._$ = {
              first_line: q[q.length - (ut || 1)].first_line,
              last_line: q[q.length - 1].last_line,
              first_column: q[q.length - (ut || 1)].first_column,
              last_column: q[q.length - 1].last_column
            }, mt && (et._$.range = [
              q[q.length - (ut || 1)].range[0],
              q[q.length - 1].range[1]
            ]), $ = this.performAction.apply(et, [
              U,
              Y,
              ht,
              $t.yy,
              j[1],
              Z,
              q
            ].concat(Ct)), typeof $ < "u")
              return $;
            ut && (ot = ot.slice(0, -1 * ut * 2), Z = Z.slice(0, -1 * ut), q = q.slice(0, -1 * ut)), ot.push(this.productions_[j[1]][0]), Z.push(et.$), q.push(et._$), Kt = G[ot[ot.length - 2]][ot[ot.length - 1]], ot.push(Kt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, O = /* @__PURE__ */ (function() {
    var X = {
      EOF: 1,
      parseError: function(it, ot) {
        if (this.yy.parser)
          this.yy.parser.parseError(it, ot);
        else
          throw new Error(it);
      },
      // resets the lexer, sets new input
      setInput: function(H, it) {
        return this.yy = it || this.yy || {}, this._input = H, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var H = this._input[0];
        this.yytext += H, this.yyleng++, this.offset++, this.match += H, this.matched += H;
        var it = H.match(/(?:\r\n?|\n).*/g);
        return it ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), H;
      },
      // unshifts one char (or a string) into the input
      unput: function(H) {
        var it = H.length, ot = H.split(/(?:\r\n?|\n)/g);
        this._input = H + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - it), this.offset -= it;
        var W = 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), ot.length - 1 && (this.yylineno -= ot.length - 1);
        var Z = 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: ot ? (ot.length === W.length ? this.yylloc.first_column : 0) + W[W.length - ot.length].length - ot[0].length : this.yylloc.first_column - it
        }, this.options.ranges && (this.yylloc.range = [Z[0], Z[0] + this.yyleng - it]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(H) {
        this.unput(this.match.slice(H));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var H = this.matched.substr(0, this.matched.length - this.match.length);
        return (H.length > 20 ? "..." : "") + H.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var H = this.match;
        return H.length < 20 && (H += this._input.substr(0, 20 - H.length)), (H.substr(0, 20) + (H.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var H = this.pastInput(), it = new Array(H.length + 1).join("-");
        return H + this.upcomingInput() + `
` + it + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(H, it) {
        var ot, W, Z;
        if (this.options.backtrack_lexer && (Z = {
          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 && (Z.yylloc.range = this.yylloc.range.slice(0))), W = H[0].match(/(?:\r\n?|\n).*/g), W && (this.yylineno += W.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: W ? W[W.length - 1].length - W[W.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + H[0].length
        }, this.yytext += H[0], this.match += H[0], this.matches = H, 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(H[0].length), this.matched += H[0], ot = this.performAction.call(this, this.yy, this, it, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), ot)
          return ot;
        if (this._backtrack) {
          for (var q in Z)
            this[q] = Z[q];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var H, it, ot, W;
        this._more || (this.yytext = "", this.match = "");
        for (var Z = this._currentRules(), q = 0; q < Z.length; q++)
          if (ot = this._input.match(this.rules[Z[q]]), ot && (!it || ot[0].length > it[0].length)) {
            if (it = ot, W = q, this.options.backtrack_lexer) {
              if (H = this.test_match(ot, Z[q]), H !== !1)
                return H;
              if (this._backtrack) {
                it = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return it ? (H = this.test_match(it, Z[W]), H !== !1 ? H : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var it = this.next();
        return it || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(it) {
        this.conditionStack.push(it);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var it = this.conditionStack.length - 1;
        return it > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(it) {
        return it = this.conditionStack.length - 1 - Math.abs(it || 0), it >= 0 ? this.conditionStack[it] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(it) {
        this.begin(it);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(it, ot, W, Z) {
        switch (W) {
          case 0:
            return "title";
          case 1:
            return this.begin("acc_title"), 9;
          case 2:
            return this.popState(), "acc_title_value";
          case 3:
            return this.begin("acc_descr"), 11;
          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:
            return 5;
          case 9:
            break;
          case 10:
            break;
          case 11:
            break;
          case 12:
            return 8;
          case 13:
            return 6;
          case 14:
            return 19;
          case 15:
            return 30;
          case 16:
            return 22;
          case 17:
            return 21;
          case 18:
            return 24;
          case 19:
            return 26;
          case 20:
            return 28;
          case 21:
            return 31;
          case 22:
            return 32;
          case 23:
            return 33;
          case 24:
            return 34;
          case 25:
            return 35;
          case 26:
            return 36;
          case 27:
            return 37;
          case 28:
            return 38;
          case 29:
            return 39;
          case 30:
            return 40;
          case 31:
            return 41;
          case 32:
            return 42;
          case 33:
            return 43;
          case 34:
            return 44;
          case 35:
            return 55;
          case 36:
            return 56;
          case 37:
            return 57;
          case 38:
            return 58;
          case 39:
            return 59;
          case 40:
            return 60;
          case 41:
            return 61;
          case 42:
            return 47;
          case 43:
            return 49;
          case 44:
            return 51;
          case 45:
            return 54;
          case 46:
            return 53;
          case 47:
            this.begin("string");
            break;
          case 48:
            this.popState();
            break;
          case 49:
            return "qString";
          case 50:
            return ot.yytext = ot.yytext.trim(), 62;
        }
      },
      rules: [/^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:(\r?\n)+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:$)/i, /^(?:requirementDiagram\b)/i, /^(?:\{)/i, /^(?:\})/i, /^(?::)/i, /^(?:id\b)/i, /^(?:text\b)/i, /^(?:risk\b)/i, /^(?:verifyMethod\b)/i, /^(?:requirement\b)/i, /^(?:functionalRequirement\b)/i, /^(?:interfaceRequirement\b)/i, /^(?:performanceRequirement\b)/i, /^(?:physicalRequirement\b)/i, /^(?:designConstraint\b)/i, /^(?:low\b)/i, /^(?:medium\b)/i, /^(?:high\b)/i, /^(?:analysis\b)/i, /^(?:demonstration\b)/i, /^(?:inspection\b)/i, /^(?:test\b)/i, /^(?:element\b)/i, /^(?:contains\b)/i, /^(?:copies\b)/i, /^(?:derives\b)/i, /^(?:satisfies\b)/i, /^(?:verifies\b)/i, /^(?:refines\b)/i, /^(?:traces\b)/i, /^(?:type\b)/i, /^(?:docref\b)/i, /^(?:<-)/i, /^(?:->)/i, /^(?:-)/i, /^(?:["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[\w][^\r\n\{\<\>\-\=]*)/i],
      conditions: { acc_descr_multiline: { rules: [6, 7], inclusive: !1 }, acc_descr: { rules: [4], inclusive: !1 }, acc_title: { rules: [2], inclusive: !1 }, unqString: { rules: [], inclusive: !1 }, token: { rules: [], inclusive: !1 }, string: { rules: [48, 49], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 50], inclusive: !0 } }
    };
    return X;
  })();
  nt.lexer = O;
  function ct() {
    this.yy = {};
  }
  return ct.prototype = nt, nt.Parser = ct, new ct();
})();
D1.parser = D1;
const WH = D1;
let B0 = [], Nn = {}, No = {}, zr = {}, Fo = {};
const UH = {
  REQUIREMENT: "Requirement",
  FUNCTIONAL_REQUIREMENT: "Functional Requirement",
  INTERFACE_REQUIREMENT: "Interface Requirement",
  PERFORMANCE_REQUIREMENT: "Performance Requirement",
  PHYSICAL_REQUIREMENT: "Physical Requirement",
  DESIGN_CONSTRAINT: "Design Constraint"
}, HH = {
  LOW_RISK: "Low",
  MED_RISK: "Medium",
  HIGH_RISK: "High"
}, GH = {
  VERIFY_ANALYSIS: "Analysis",
  VERIFY_DEMONSTRATION: "Demonstration",
  VERIFY_INSPECTION: "Inspection",
  VERIFY_TEST: "Test"
}, jH = {
  CONTAINS: "contains",
  COPIES: "copies",
  DERIVES: "derives",
  SATISFIES: "satisfies",
  VERIFIES: "verifies",
  REFINES: "refines",
  TRACES: "traces"
}, XH = (t, e) => (No[t] === void 0 && (No[t] = {
  name: t,
  type: e,
  id: Nn.id,
  text: Nn.text,
  risk: Nn.risk,
  verifyMethod: Nn.verifyMethod
}), Nn = {}, No[t]), KH = () => No, QH = (t) => {
  Nn !== void 0 && (Nn.id = t);
}, ZH = (t) => {
  Nn !== void 0 && (Nn.text = t);
}, JH = (t) => {
  Nn !== void 0 && (Nn.risk = t);
}, tG = (t) => {
  Nn !== void 0 && (Nn.verifyMethod = t);
}, eG = (t) => (Fo[t] === void 0 && (Fo[t] = {
  name: t,
  type: zr.type,
  docRef: zr.docRef
}, z.info("Added new requirement: ", t)), zr = {}, Fo[t]), nG = () => Fo, iG = (t) => {
  zr !== void 0 && (zr.type = t);
}, rG = (t) => {
  zr !== void 0 && (zr.docRef = t);
}, sG = (t, e, n) => {
  B0.push({
    type: t,
    src: e,
    dst: n
  });
}, aG = () => B0, oG = () => {
  B0 = [], Nn = {}, No = {}, zr = {}, Fo = {}, fn();
}, lG = {
  RequirementType: UH,
  RiskLevel: HH,
  VerifyType: GH,
  Relationships: jH,
  getConfig: () => Q().req,
  addRequirement: XH,
  getRequirements: KH,
  setNewReqId: QH,
  setNewReqText: ZH,
  setNewReqRisk: JH,
  setNewReqVerifyMethod: tG,
  setAccTitle: pn,
  getAccTitle: vn,
  setAccDescription: En,
  getAccDescription: Cn,
  addElement: eG,
  getElements: nG,
  setNewElementType: iG,
  setNewElementDocRef: rG,
  addRelationship: sG,
  getRelationships: aG,
  clear: oG
}, cG = (t) => `

  marker {
    fill: ${t.relationColor};
    stroke: ${t.relationColor};
  }

  marker.cross {
    stroke: ${t.lineColor};
  }

  svg {
    font-family: ${t.fontFamily};
    font-size: ${t.fontSize};
  }

  .reqBox {
    fill: ${t.requirementBackground};
    fill-opacity: 1.0;
    stroke: ${t.requirementBorderColor};
    stroke-width: ${t.requirementBorderSize};
  }
  
  .reqTitle, .reqLabel{
    fill:  ${t.requirementTextColor};
  }
  .reqLabelBox {
    fill: ${t.relationLabelBackground};
    fill-opacity: 1.0;
  }

  .req-title-line {
    stroke: ${t.requirementBorderColor};
    stroke-width: ${t.requirementBorderSize};
  }
  .relationshipLine {
    stroke: ${t.relationColor};
    stroke-width: 1;
  }
  .relationshipLabel {
    fill: ${t.relationLabelColor};
  }

`, uG = cG, N1 = {
  CONTAINS: "contains",
  ARROW: "arrow"
}, hG = (t, e) => {
  let n = t.append("defs").append("marker").attr("id", N1.CONTAINS + "_line_ending").attr("refX", 0).attr("refY", e.line_height / 2).attr("markerWidth", e.line_height).attr("markerHeight", e.line_height).attr("orient", "auto").append("g");
  n.append("circle").attr("cx", e.line_height / 2).attr("cy", e.line_height / 2).attr("r", e.line_height / 2).attr("fill", "none"), n.append("line").attr("x1", 0).attr("x2", e.line_height).attr("y1", e.line_height / 2).attr("y2", e.line_height / 2).attr("stroke-width", 1), n.append("line").attr("y1", 0).attr("y2", e.line_height).attr("x1", e.line_height / 2).attr("x2", e.line_height / 2).attr("stroke-width", 1), t.append("defs").append("marker").attr("id", N1.ARROW + "_line_ending").attr("refX", e.line_height).attr("refY", 0.5 * e.line_height).attr("markerWidth", e.line_height).attr("markerHeight", e.line_height).attr("orient", "auto").append("path").attr(
    "d",
    `M0,0
      L${e.line_height},${e.line_height / 2}
      M${e.line_height},${e.line_height / 2}
      L0,${e.line_height}`
  ).attr("stroke-width", 1);
}, D_ = {
  ReqMarkers: N1,
  insertLineEndings: hG
};
let Se = {}, K2 = 0;
const N_ = (t, e) => t.insert("rect", "#" + e).attr("class", "req reqBox").attr("x", 0).attr("y", 0).attr("width", Se.rect_min_width + "px").attr("height", Se.rect_min_height + "px"), F_ = (t, e, n) => {
  let i = Se.rect_min_width / 2, r = t.append("text").attr("class", "req reqLabel reqTitle").attr("id", e).attr("x", i).attr("y", Se.rect_padding).attr("dominant-baseline", "hanging"), s = 0;
  n.forEach((u) => {
    s == 0 ? r.append("tspan").attr("text-anchor", "middle").attr("x", Se.rect_min_width / 2).attr("dy", 0).text(u) : r.append("tspan").attr("text-anchor", "middle").attr("x", Se.rect_min_width / 2).attr("dy", Se.line_height * 0.75).text(u), s++;
  });
  let a = 1.5 * Se.rect_padding, o = s * Se.line_height * 0.75, l = a + o;
  return t.append("line").attr("class", "req-title-line").attr("x1", "0").attr("x2", Se.rect_min_width).attr("y1", l).attr("y2", l), {
    titleNode: r,
    y: l
  };
}, O_ = (t, e, n, i) => {
  let r = t.append("text").attr("class", "req reqLabel").attr("id", e).attr("x", Se.rect_padding).attr("y", i).attr("dominant-baseline", "hanging"), s = 0;
  const a = 30;
  let o = [];
  return n.forEach((l) => {
    let u = l.length;
    for (; u > a && s < 3; ) {
      let h = l.substring(0, a);
      l = l.substring(a, l.length), u = l.length, o[o.length] = h, s++;
    }
    if (s == 3) {
      let h = o[o.length - 1];
      o[o.length - 1] = h.substring(0, h.length - 4) + "...";
    } else
      o[o.length] = l;
    s = 0;
  }), o.forEach((l) => {
    r.append("tspan").attr("x", Se.rect_padding).attr("dy", Se.line_height).text(l);
  }), r;
}, dG = (t, e, n, i) => {
  const r = e.node().getTotalLength(), s = e.node().getPointAtLength(r * 0.5), a = "rel" + K2;
  K2++;
  const l = t.append("text").attr("class", "req relationshipLabel").attr("id", a).attr("x", s.x).attr("y", s.y).attr("text-anchor", "middle").attr("dominant-baseline", "middle").text(i).node().getBBox();
  t.insert("rect", "#" + a).attr("class", "req reqLabelBox").attr("x", s.x - l.width / 2).attr("y", s.y - l.height / 2).attr("width", l.width).attr("height", l.height).attr("fill", "white").attr("fill-opacity", "85%");
}, fG = function(t, e, n, i, r) {
  const s = n.edge(Na(e.src), Na(e.dst)), a = Tr().x(function(l) {
    return l.x;
  }).y(function(l) {
    return l.y;
  }), o = t.insert("path", "#" + i).attr("class", "er relationshipLine").attr("d", a(s.points)).attr("fill", "none");
  e.type == r.db.Relationships.CONTAINS ? o.attr(
    "marker-start",
    "url(" + bt.getUrl(Se.arrowMarkerAbsolute) + "#" + e.type + "_line_ending)"
  ) : (o.attr("stroke-dasharray", "10,7"), o.attr(
    "marker-end",
    "url(" + bt.getUrl(Se.arrowMarkerAbsolute) + "#" + D_.ReqMarkers.ARROW + "_line_ending)"
  )), dG(t, o, Se, `<<${e.type}>>`);
}, pG = (t, e, n) => {
  Object.keys(t).forEach((i) => {
    let r = t[i];
    i = Na(i), z.info("Added new requirement: ", i);
    const s = n.append("g").attr("id", i), a = "req-" + i, o = N_(s, a);
    let l = F_(s, i + "_title", [
      `<<${r.type}>>`,
      `${r.name}`
    ]);
    O_(
      s,
      i + "_body",
      [
        `Id: ${r.id}`,
        `Text: ${r.text}`,
        `Risk: ${r.risk}`,
        `Verification: ${r.verifyMethod}`
      ],
      l.y
    );
    const u = o.node().getBBox();
    e.setNode(i, {
      width: u.width,
      height: u.height,
      shape: "rect",
      id: i
    });
  });
}, gG = (t, e, n) => {
  Object.keys(t).forEach((i) => {
    let r = t[i];
    const s = Na(i), a = n.append("g").attr("id", s), o = "element-" + s, l = N_(a, o);
    let u = F_(a, o + "_title", ["<<Element>>", `${i}`]);
    O_(
      a,
      o + "_body",
      [`Type: ${r.type || "Not Specified"}`, `Doc Ref: ${r.docRef || "None"}`],
      u.y
    );
    const h = l.node().getBBox();
    e.setNode(s, {
      width: h.width,
      height: h.height,
      shape: "rect",
      id: s
    });
  });
}, yG = (t, e) => (t.forEach(function(n) {
  let i = Na(n.src), r = Na(n.dst);
  e.setEdge(i, r, { relationship: n });
}), t), mG = function(t, e) {
  e.nodes().forEach(function(n) {
    n !== void 0 && e.node(n) !== void 0 && (t.select("#" + n), t.select("#" + n).attr(
      "transform",
      "translate(" + (e.node(n).x - e.node(n).width / 2) + "," + (e.node(n).y - e.node(n).height / 2) + " )"
    ));
  });
}, Na = (t) => t.replace(/\s/g, "").replace(/\./g, "_"), xG = (t, e, n, i) => {
  Se = Q().requirement;
  const r = Se.securityLevel;
  let s;
  r === "sandbox" && (s = yt("#i" + e));
  const o = yt(r === "sandbox" ? s.nodes()[0].contentDocument.body : "body").select(`[id='${e}']`);
  D_.insertLineEndings(o, Se);
  const l = new qe({
    multigraph: !1,
    compound: !1,
    directed: !0
  }).setGraph({
    rankdir: Se.layoutDirection,
    marginx: 20,
    marginy: 20,
    nodesep: 100,
    edgesep: 100,
    ranksep: 100
  }).setDefaultEdgeLabel(function() {
    return {};
  });
  let u = i.db.getRequirements(), h = i.db.getElements(), f = i.db.getRelationships();
  pG(u, l, o), gG(h, l, o), yG(f, l), Ha(l), mG(o, l), f.forEach(function(_) {
    fG(o, _, l, e, i);
  });
  const d = Se.rect_padding, p = o.node().getBBox(), y = p.width + d * 2, m = p.height + d * 2;
  dn(o, m, y, Se.useMaxWidth), o.attr("viewBox", `${p.x - d} ${p.y - d} ${y} ${m}`);
}, bG = {
  draw: xG
}, _G = {
  parser: WH,
  db: lG,
  renderer: bG,
  styles: uG
}, kG = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: _G
}, Symbol.toStringTag, { value: "Module" }));
var F1 = (function() {
  var t = function(W, Z, q, G) {
    for (q = q || {}, G = W.length; G--; q[W[G]] = Z)
      ;
    return q;
  }, e = [1, 2], n = [1, 3], i = [1, 4], r = [2, 4], s = [1, 9], a = [1, 11], o = [1, 13], l = [1, 14], u = [1, 16], h = [1, 17], f = [1, 18], d = [1, 24], p = [1, 25], y = [1, 26], m = [1, 27], _ = [1, 28], T = [1, 29], v = [1, 30], A = [1, 31], L = [1, 32], w = [1, 33], b = [1, 34], F = [1, 35], S = [1, 36], x = [1, 37], C = [1, 38], g = [1, 39], I = [1, 41], k = [1, 42], P = [1, 43], R = [1, 44], M = [1, 45], B = [1, 46], N = [1, 4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 48, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], D = [4, 5, 16, 50, 52, 53], E = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], V = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 49, 50, 52, 53, 54, 59, 60, 61, 62, 70], nt = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 48, 50, 52, 53, 54, 59, 60, 61, 62, 70], O = [4, 5, 13, 14, 16, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 47, 50, 52, 53, 54, 59, 60, 61, 62, 70], ct = [68, 69, 70], X = [1, 120], H = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, SPACE: 4, NEWLINE: 5, SD: 6, document: 7, line: 8, statement: 9, box_section: 10, box_line: 11, participant_statement: 12, create: 13, box: 14, restOfLine: 15, end: 16, signal: 17, autonumber: 18, NUM: 19, off: 20, activate: 21, actor: 22, deactivate: 23, note_statement: 24, links_statement: 25, link_statement: 26, properties_statement: 27, details_statement: 28, title: 29, legacy_title: 30, acc_title: 31, acc_title_value: 32, acc_descr: 33, acc_descr_value: 34, acc_descr_multiline_value: 35, loop: 36, rect: 37, opt: 38, alt: 39, else_sections: 40, par: 41, par_sections: 42, par_over: 43, critical: 44, option_sections: 45, break: 46, option: 47, and: 48, else: 49, participant: 50, AS: 51, participant_actor: 52, destroy: 53, note: 54, placement: 55, text2: 56, over: 57, actor_pair: 58, links: 59, link: 60, properties: 61, details: 62, spaceList: 63, ",": 64, left_of: 65, right_of: 66, signaltype: 67, "+": 68, "-": 69, ACTOR: 70, SOLID_OPEN_ARROW: 71, DOTTED_OPEN_ARROW: 72, SOLID_ARROW: 73, DOTTED_ARROW: 74, SOLID_CROSS: 75, DOTTED_CROSS: 76, SOLID_POINT: 77, DOTTED_POINT: 78, TXT: 79, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "SPACE", 5: "NEWLINE", 6: "SD", 13: "create", 14: "box", 15: "restOfLine", 16: "end", 18: "autonumber", 19: "NUM", 20: "off", 21: "activate", 23: "deactivate", 29: "title", 30: "legacy_title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "loop", 37: "rect", 38: "opt", 39: "alt", 41: "par", 43: "par_over", 44: "critical", 46: "break", 47: "option", 48: "and", 49: "else", 50: "participant", 51: "AS", 52: "participant_actor", 53: "destroy", 54: "note", 57: "over", 59: "links", 60: "link", 61: "properties", 62: "details", 64: ",", 65: "left_of", 66: "right_of", 68: "+", 69: "-", 70: "ACTOR", 71: "SOLID_OPEN_ARROW", 72: "DOTTED_OPEN_ARROW", 73: "SOLID_ARROW", 74: "DOTTED_ARROW", 75: "SOLID_CROSS", 76: "DOTTED_CROSS", 77: "SOLID_POINT", 78: "DOTTED_POINT", 79: "TXT" },
    productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [10, 0], [10, 2], [11, 2], [11, 1], [11, 1], [9, 1], [9, 2], [9, 4], [9, 2], [9, 4], [9, 3], [9, 3], [9, 2], [9, 3], [9, 3], [9, 2], [9, 2], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [9, 4], [45, 1], [45, 4], [42, 1], [42, 4], [40, 1], [40, 4], [12, 5], [12, 3], [12, 5], [12, 3], [12, 3], [24, 4], [24, 4], [25, 3], [26, 3], [27, 3], [28, 3], [63, 2], [63, 1], [58, 3], [58, 1], [55, 1], [55, 1], [17, 5], [17, 5], [17, 4], [22, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [67, 1], [56, 1]],
    performAction: function(Z, q, G, U, ht, Y, wt) {
      var J = Y.length - 1;
      switch (ht) {
        case 3:
          return U.apply(Y[J]), Y[J];
        case 4:
        case 9:
          this.$ = [];
          break;
        case 5:
        case 10:
          Y[J - 1].push(Y[J]), this.$ = Y[J - 1];
          break;
        case 6:
        case 7:
        case 11:
        case 12:
          this.$ = Y[J];
          break;
        case 8:
        case 13:
          this.$ = [];
          break;
        case 15:
          Y[J].type = "createParticipant", this.$ = Y[J];
          break;
        case 16:
          Y[J - 1].unshift({ type: "boxStart", boxData: U.parseBoxData(Y[J - 2]) }), Y[J - 1].push({ type: "boxEnd", boxText: Y[J - 2] }), this.$ = Y[J - 1];
          break;
        case 18:
          this.$ = { type: "sequenceIndex", sequenceIndex: Number(Y[J - 2]), sequenceIndexStep: Number(Y[J - 1]), sequenceVisible: !0, signalType: U.LINETYPE.AUTONUMBER };
          break;
        case 19:
          this.$ = { type: "sequenceIndex", sequenceIndex: Number(Y[J - 1]), sequenceIndexStep: 1, sequenceVisible: !0, signalType: U.LINETYPE.AUTONUMBER };
          break;
        case 20:
          this.$ = { type: "sequenceIndex", sequenceVisible: !1, signalType: U.LINETYPE.AUTONUMBER };
          break;
        case 21:
          this.$ = { type: "sequenceIndex", sequenceVisible: !0, signalType: U.LINETYPE.AUTONUMBER };
          break;
        case 22:
          this.$ = { type: "activeStart", signalType: U.LINETYPE.ACTIVE_START, actor: Y[J - 1] };
          break;
        case 23:
          this.$ = { type: "activeEnd", signalType: U.LINETYPE.ACTIVE_END, actor: Y[J - 1] };
          break;
        case 29:
          U.setDiagramTitle(Y[J].substring(6)), this.$ = Y[J].substring(6);
          break;
        case 30:
          U.setDiagramTitle(Y[J].substring(7)), this.$ = Y[J].substring(7);
          break;
        case 31:
          this.$ = Y[J].trim(), U.setAccTitle(this.$);
          break;
        case 32:
        case 33:
          this.$ = Y[J].trim(), U.setAccDescription(this.$);
          break;
        case 34:
          Y[J - 1].unshift({ type: "loopStart", loopText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.LOOP_START }), Y[J - 1].push({ type: "loopEnd", loopText: Y[J - 2], signalType: U.LINETYPE.LOOP_END }), this.$ = Y[J - 1];
          break;
        case 35:
          Y[J - 1].unshift({ type: "rectStart", color: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.RECT_START }), Y[J - 1].push({ type: "rectEnd", color: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.RECT_END }), this.$ = Y[J - 1];
          break;
        case 36:
          Y[J - 1].unshift({ type: "optStart", optText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.OPT_START }), Y[J - 1].push({ type: "optEnd", optText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.OPT_END }), this.$ = Y[J - 1];
          break;
        case 37:
          Y[J - 1].unshift({ type: "altStart", altText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.ALT_START }), Y[J - 1].push({ type: "altEnd", signalType: U.LINETYPE.ALT_END }), this.$ = Y[J - 1];
          break;
        case 38:
          Y[J - 1].unshift({ type: "parStart", parText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.PAR_START }), Y[J - 1].push({ type: "parEnd", signalType: U.LINETYPE.PAR_END }), this.$ = Y[J - 1];
          break;
        case 39:
          Y[J - 1].unshift({ type: "parStart", parText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.PAR_OVER_START }), Y[J - 1].push({ type: "parEnd", signalType: U.LINETYPE.PAR_END }), this.$ = Y[J - 1];
          break;
        case 40:
          Y[J - 1].unshift({ type: "criticalStart", criticalText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.CRITICAL_START }), Y[J - 1].push({ type: "criticalEnd", signalType: U.LINETYPE.CRITICAL_END }), this.$ = Y[J - 1];
          break;
        case 41:
          Y[J - 1].unshift({ type: "breakStart", breakText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.BREAK_START }), Y[J - 1].push({ type: "breakEnd", optText: U.parseMessage(Y[J - 2]), signalType: U.LINETYPE.BREAK_END }), this.$ = Y[J - 1];
          break;
        case 43:
          this.$ = Y[J - 3].concat([{ type: "option", optionText: U.parseMessage(Y[J - 1]), signalType: U.LINETYPE.CRITICAL_OPTION }, Y[J]]);
          break;
        case 45:
          this.$ = Y[J - 3].concat([{ type: "and", parText: U.parseMessage(Y[J - 1]), signalType: U.LINETYPE.PAR_AND }, Y[J]]);
          break;
        case 47:
          this.$ = Y[J - 3].concat([{ type: "else", altText: U.parseMessage(Y[J - 1]), signalType: U.LINETYPE.ALT_ELSE }, Y[J]]);
          break;
        case 48:
          Y[J - 3].draw = "participant", Y[J - 3].type = "addParticipant", Y[J - 3].description = U.parseMessage(Y[J - 1]), this.$ = Y[J - 3];
          break;
        case 49:
          Y[J - 1].draw = "participant", Y[J - 1].type = "addParticipant", this.$ = Y[J - 1];
          break;
        case 50:
          Y[J - 3].draw = "actor", Y[J - 3].type = "addParticipant", Y[J - 3].description = U.parseMessage(Y[J - 1]), this.$ = Y[J - 3];
          break;
        case 51:
          Y[J - 1].draw = "actor", Y[J - 1].type = "addParticipant", this.$ = Y[J - 1];
          break;
        case 52:
          Y[J - 1].type = "destroyParticipant", this.$ = Y[J - 1];
          break;
        case 53:
          this.$ = [Y[J - 1], { type: "addNote", placement: Y[J - 2], actor: Y[J - 1].actor, text: Y[J] }];
          break;
        case 54:
          Y[J - 2] = [].concat(Y[J - 1], Y[J - 1]).slice(0, 2), Y[J - 2][0] = Y[J - 2][0].actor, Y[J - 2][1] = Y[J - 2][1].actor, this.$ = [Y[J - 1], { type: "addNote", placement: U.PLACEMENT.OVER, actor: Y[J - 2].slice(0, 2), text: Y[J] }];
          break;
        case 55:
          this.$ = [Y[J - 1], { type: "addLinks", actor: Y[J - 1].actor, text: Y[J] }];
          break;
        case 56:
          this.$ = [Y[J - 1], { type: "addALink", actor: Y[J - 1].actor, text: Y[J] }];
          break;
        case 57:
          this.$ = [Y[J - 1], { type: "addProperties", actor: Y[J - 1].actor, text: Y[J] }];
          break;
        case 58:
          this.$ = [Y[J - 1], { type: "addDetails", actor: Y[J - 1].actor, text: Y[J] }];
          break;
        case 61:
          this.$ = [Y[J - 2], Y[J]];
          break;
        case 62:
          this.$ = Y[J];
          break;
        case 63:
          this.$ = U.PLACEMENT.LEFTOF;
          break;
        case 64:
          this.$ = U.PLACEMENT.RIGHTOF;
          break;
        case 65:
          this.$ = [
            Y[J - 4],
            Y[J - 1],
            { type: "addMessage", from: Y[J - 4].actor, to: Y[J - 1].actor, signalType: Y[J - 3], msg: Y[J], activate: !0 },
            { type: "activeStart", signalType: U.LINETYPE.ACTIVE_START, actor: Y[J - 1] }
          ];
          break;
        case 66:
          this.$ = [
            Y[J - 4],
            Y[J - 1],
            { type: "addMessage", from: Y[J - 4].actor, to: Y[J - 1].actor, signalType: Y[J - 3], msg: Y[J] },
            { type: "activeEnd", signalType: U.LINETYPE.ACTIVE_END, actor: Y[J - 4] }
          ];
          break;
        case 67:
          this.$ = [Y[J - 3], Y[J - 1], { type: "addMessage", from: Y[J - 3].actor, to: Y[J - 1].actor, signalType: Y[J - 2], msg: Y[J] }];
          break;
        case 68:
          this.$ = { type: "addParticipant", actor: Y[J] };
          break;
        case 69:
          this.$ = U.LINETYPE.SOLID_OPEN;
          break;
        case 70:
          this.$ = U.LINETYPE.DOTTED_OPEN;
          break;
        case 71:
          this.$ = U.LINETYPE.SOLID;
          break;
        case 72:
          this.$ = U.LINETYPE.DOTTED;
          break;
        case 73:
          this.$ = U.LINETYPE.SOLID_CROSS;
          break;
        case 74:
          this.$ = U.LINETYPE.DOTTED_CROSS;
          break;
        case 75:
          this.$ = U.LINETYPE.SOLID_POINT;
          break;
        case 76:
          this.$ = U.LINETYPE.DOTTED_POINT;
          break;
        case 77:
          this.$ = U.parseMessage(Y[J].trim().substring(1));
          break;
      }
    },
    table: [{ 3: 1, 4: e, 5: n, 6: i }, { 1: [3] }, { 3: 5, 4: e, 5: n, 6: i }, { 3: 6, 4: e, 5: n, 6: i }, t([1, 4, 5, 13, 14, 18, 21, 23, 29, 30, 31, 33, 35, 36, 37, 38, 39, 41, 43, 44, 46, 50, 52, 53, 54, 59, 60, 61, 62, 70], r, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, t(N, [2, 5]), { 9: 47, 12: 12, 13: o, 14: l, 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, t(N, [2, 7]), t(N, [2, 8]), t(N, [2, 14]), { 12: 48, 50: x, 52: C, 53: g }, { 15: [1, 49] }, { 5: [1, 50] }, { 5: [1, 53], 19: [1, 51], 20: [1, 52] }, { 22: 54, 70: B }, { 22: 55, 70: B }, { 5: [1, 56] }, { 5: [1, 57] }, { 5: [1, 58] }, { 5: [1, 59] }, { 5: [1, 60] }, t(N, [2, 29]), t(N, [2, 30]), { 32: [1, 61] }, { 34: [1, 62] }, t(N, [2, 33]), { 15: [1, 63] }, { 15: [1, 64] }, { 15: [1, 65] }, { 15: [1, 66] }, { 15: [1, 67] }, { 15: [1, 68] }, { 15: [1, 69] }, { 15: [1, 70] }, { 22: 71, 70: B }, { 22: 72, 70: B }, { 22: 73, 70: B }, { 67: 74, 71: [1, 75], 72: [1, 76], 73: [1, 77], 74: [1, 78], 75: [1, 79], 76: [1, 80], 77: [1, 81], 78: [1, 82] }, { 55: 83, 57: [1, 84], 65: [1, 85], 66: [1, 86] }, { 22: 87, 70: B }, { 22: 88, 70: B }, { 22: 89, 70: B }, { 22: 90, 70: B }, t([5, 51, 64, 71, 72, 73, 74, 75, 76, 77, 78, 79], [2, 68]), t(N, [2, 6]), t(N, [2, 15]), t(D, [2, 9], { 10: 91 }), t(N, [2, 17]), { 5: [1, 93], 19: [1, 92] }, { 5: [1, 94] }, t(N, [2, 21]), { 5: [1, 95] }, { 5: [1, 96] }, t(N, [2, 24]), t(N, [2, 25]), t(N, [2, 26]), t(N, [2, 27]), t(N, [2, 28]), t(N, [2, 31]), t(N, [2, 32]), t(E, r, { 7: 97 }), t(E, r, { 7: 98 }), t(E, r, { 7: 99 }), t(V, r, { 40: 100, 7: 101 }), t(nt, r, { 42: 102, 7: 103 }), t(nt, r, { 7: 103, 42: 104 }), t(O, r, { 45: 105, 7: 106 }), t(E, r, { 7: 107 }), { 5: [1, 109], 51: [1, 108] }, { 5: [1, 111], 51: [1, 110] }, { 5: [1, 112] }, { 22: 115, 68: [1, 113], 69: [1, 114], 70: B }, t(ct, [2, 69]), t(ct, [2, 70]), t(ct, [2, 71]), t(ct, [2, 72]), t(ct, [2, 73]), t(ct, [2, 74]), t(ct, [2, 75]), t(ct, [2, 76]), { 22: 116, 70: B }, { 22: 118, 58: 117, 70: B }, { 70: [2, 63] }, { 70: [2, 64] }, { 56: 119, 79: X }, { 56: 121, 79: X }, { 56: 122, 79: X }, { 56: 123, 79: X }, { 4: [1, 126], 5: [1, 128], 11: 125, 12: 127, 16: [1, 124], 50: x, 52: C, 53: g }, { 5: [1, 129] }, t(N, [2, 19]), t(N, [2, 20]), t(N, [2, 22]), t(N, [2, 23]), { 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 130], 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, { 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 131], 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, { 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 132], 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, { 16: [1, 133] }, { 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [2, 46], 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 49: [1, 134], 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, { 16: [1, 135] }, { 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [2, 44], 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 48: [1, 136], 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, { 16: [1, 137] }, { 16: [1, 138] }, { 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [2, 42], 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 47: [1, 139], 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, { 4: s, 5: a, 8: 8, 9: 10, 12: 12, 13: o, 14: l, 16: [1, 140], 17: 15, 18: u, 21: h, 22: 40, 23: f, 24: 19, 25: 20, 26: 21, 27: 22, 28: 23, 29: d, 30: p, 31: y, 33: m, 35: _, 36: T, 37: v, 38: A, 39: L, 41: w, 43: b, 44: F, 46: S, 50: x, 52: C, 53: g, 54: I, 59: k, 60: P, 61: R, 62: M, 70: B }, { 15: [1, 141] }, t(N, [2, 49]), { 15: [1, 142] }, t(N, [2, 51]), t(N, [2, 52]), { 22: 143, 70: B }, { 22: 144, 70: B }, { 56: 145, 79: X }, { 56: 146, 79: X }, { 56: 147, 79: X }, { 64: [1, 148], 79: [2, 62] }, { 5: [2, 55] }, { 5: [2, 77] }, { 5: [2, 56] }, { 5: [2, 57] }, { 5: [2, 58] }, t(N, [2, 16]), t(D, [2, 10]), { 12: 149, 50: x, 52: C, 53: g }, t(D, [2, 12]), t(D, [2, 13]), t(N, [2, 18]), t(N, [2, 34]), t(N, [2, 35]), t(N, [2, 36]), t(N, [2, 37]), { 15: [1, 150] }, t(N, [2, 38]), { 15: [1, 151] }, t(N, [2, 39]), t(N, [2, 40]), { 15: [1, 152] }, t(N, [2, 41]), { 5: [1, 153] }, { 5: [1, 154] }, { 56: 155, 79: X }, { 56: 156, 79: X }, { 5: [2, 67] }, { 5: [2, 53] }, { 5: [2, 54] }, { 22: 157, 70: B }, t(D, [2, 11]), t(V, r, { 7: 101, 40: 158 }), t(nt, r, { 7: 103, 42: 159 }), t(O, r, { 7: 106, 45: 160 }), t(N, [2, 48]), t(N, [2, 50]), { 5: [2, 65] }, { 5: [2, 66] }, { 79: [2, 61] }, { 16: [2, 47] }, { 16: [2, 45] }, { 16: [2, 43] }],
    defaultActions: { 5: [2, 1], 6: [2, 2], 85: [2, 63], 86: [2, 64], 119: [2, 55], 120: [2, 77], 121: [2, 56], 122: [2, 57], 123: [2, 58], 145: [2, 67], 146: [2, 53], 147: [2, 54], 155: [2, 65], 156: [2, 66], 157: [2, 61], 158: [2, 47], 159: [2, 45], 160: [2, 43] },
    parseError: function(Z, q) {
      if (q.recoverable)
        this.trace(Z);
      else {
        var G = new Error(Z);
        throw G.hash = q, G;
      }
    },
    parse: function(Z) {
      var q = this, G = [0], U = [], ht = [null], Y = [], wt = this.table, J = "", Ct = 0, Tt = 0, $t = 2, Rt = 1, te = Y.slice.call(arguments, 1), mt = Object.create(this.lexer), pt = { yy: {} };
      for (var dt in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, dt) && (pt.yy[dt] = this.yy[dt]);
      mt.setInput(Z, pt.yy), pt.yy.lexer = mt, pt.yy.parser = this, typeof mt.yylloc > "u" && (mt.yylloc = {});
      var ft = mt.yylloc;
      Y.push(ft);
      var j = mt.options && mt.options.ranges;
      typeof pt.yy.parseError == "function" ? this.parseError = pt.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function $() {
        var ie;
        return ie = U.pop() || mt.lex() || Rt, typeof ie != "number" && (ie instanceof Array && (U = ie, ie = U.pop()), ie = q.symbols_[ie] || ie), ie;
      }
      for (var et, rt, ut, Kt, Zt = {}, Qt, Mt, ne, Bt; ; ) {
        if (rt = G[G.length - 1], this.defaultActions[rt] ? ut = this.defaultActions[rt] : ((et === null || typeof et > "u") && (et = $()), ut = wt[rt] && wt[rt][et]), typeof ut > "u" || !ut.length || !ut[0]) {
          var Te = "";
          Bt = [];
          for (Qt in wt[rt])
            this.terminals_[Qt] && Qt > $t && Bt.push("'" + this.terminals_[Qt] + "'");
          mt.showPosition ? Te = "Parse error on line " + (Ct + 1) + `:
` + mt.showPosition() + `
Expecting ` + Bt.join(", ") + ", got '" + (this.terminals_[et] || et) + "'" : Te = "Parse error on line " + (Ct + 1) + ": Unexpected " + (et == Rt ? "end of input" : "'" + (this.terminals_[et] || et) + "'"), this.parseError(Te, {
            text: mt.match,
            token: this.terminals_[et] || et,
            line: mt.yylineno,
            loc: ft,
            expected: Bt
          });
        }
        if (ut[0] instanceof Array && ut.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + rt + ", token: " + et);
        switch (ut[0]) {
          case 1:
            G.push(et), ht.push(mt.yytext), Y.push(mt.yylloc), G.push(ut[1]), et = null, Tt = mt.yyleng, J = mt.yytext, Ct = mt.yylineno, ft = mt.yylloc;
            break;
          case 2:
            if (Mt = this.productions_[ut[1]][1], Zt.$ = ht[ht.length - Mt], Zt._$ = {
              first_line: Y[Y.length - (Mt || 1)].first_line,
              last_line: Y[Y.length - 1].last_line,
              first_column: Y[Y.length - (Mt || 1)].first_column,
              last_column: Y[Y.length - 1].last_column
            }, j && (Zt._$.range = [
              Y[Y.length - (Mt || 1)].range[0],
              Y[Y.length - 1].range[1]
            ]), Kt = this.performAction.apply(Zt, [
              J,
              Tt,
              Ct,
              pt.yy,
              ut[1],
              ht,
              Y
            ].concat(te)), typeof Kt < "u")
              return Kt;
            Mt && (G = G.slice(0, -1 * Mt * 2), ht = ht.slice(0, -1 * Mt), Y = Y.slice(0, -1 * Mt)), G.push(this.productions_[ut[1]][0]), ht.push(Zt.$), Y.push(Zt._$), ne = wt[G[G.length - 2]][G[G.length - 1]], G.push(ne);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, it = /* @__PURE__ */ (function() {
    var W = {
      EOF: 1,
      parseError: function(q, G) {
        if (this.yy.parser)
          this.yy.parser.parseError(q, G);
        else
          throw new Error(q);
      },
      // resets the lexer, sets new input
      setInput: function(Z, q) {
        return this.yy = q || this.yy || {}, this._input = Z, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var Z = this._input[0];
        this.yytext += Z, this.yyleng++, this.offset++, this.match += Z, this.matched += Z;
        var q = Z.match(/(?:\r\n?|\n).*/g);
        return q ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), Z;
      },
      // unshifts one char (or a string) into the input
      unput: function(Z) {
        var q = Z.length, G = Z.split(/(?:\r\n?|\n)/g);
        this._input = Z + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - q), this.offset -= q;
        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), G.length - 1 && (this.yylineno -= G.length - 1);
        var ht = 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: G ? (G.length === U.length ? this.yylloc.first_column : 0) + U[U.length - G.length].length - G[0].length : this.yylloc.first_column - q
        }, this.options.ranges && (this.yylloc.range = [ht[0], ht[0] + this.yyleng - q]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(Z) {
        this.unput(this.match.slice(Z));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var Z = this.matched.substr(0, this.matched.length - this.match.length);
        return (Z.length > 20 ? "..." : "") + Z.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var Z = this.match;
        return Z.length < 20 && (Z += this._input.substr(0, 20 - Z.length)), (Z.substr(0, 20) + (Z.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var Z = this.pastInput(), q = new Array(Z.length + 1).join("-");
        return Z + this.upcomingInput() + `
` + q + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(Z, q) {
        var G, U, ht;
        if (this.options.backtrack_lexer && (ht = {
          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 && (ht.yylloc.range = this.yylloc.range.slice(0))), U = Z[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 + Z[0].length
        }, this.yytext += Z[0], this.match += Z[0], this.matches = Z, 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(Z[0].length), this.matched += Z[0], G = this.performAction.call(this, this.yy, this, q, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), G)
          return G;
        if (this._backtrack) {
          for (var Y in ht)
            this[Y] = ht[Y];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var Z, q, G, U;
        this._more || (this.yytext = "", this.match = "");
        for (var ht = this._currentRules(), Y = 0; Y < ht.length; Y++)
          if (G = this._input.match(this.rules[ht[Y]]), G && (!q || G[0].length > q[0].length)) {
            if (q = G, U = Y, this.options.backtrack_lexer) {
              if (Z = this.test_match(G, ht[Y]), Z !== !1)
                return Z;
              if (this._backtrack) {
                q = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return q ? (Z = this.test_match(q, ht[U]), Z !== !1 ? Z : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var q = this.next();
        return q || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(q) {
        this.conditionStack.push(q);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var q = this.conditionStack.length - 1;
        return q > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(q) {
        return q = this.conditionStack.length - 1 - Math.abs(q || 0), q >= 0 ? this.conditionStack[q] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(q) {
        this.begin(q);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(q, G, U, ht) {
        switch (U) {
          case 0:
            return 5;
          case 1:
            break;
          case 2:
            break;
          case 3:
            break;
          case 4:
            break;
          case 5:
            break;
          case 6:
            return 19;
          case 7:
            return this.begin("LINE"), 14;
          case 8:
            return this.begin("ID"), 50;
          case 9:
            return this.begin("ID"), 52;
          case 10:
            return 13;
          case 11:
            return this.begin("ID"), 53;
          case 12:
            return G.yytext = G.yytext.trim(), this.begin("ALIAS"), 70;
          case 13:
            return this.popState(), this.popState(), this.begin("LINE"), 51;
          case 14:
            return this.popState(), this.popState(), 5;
          case 15:
            return this.begin("LINE"), 36;
          case 16:
            return this.begin("LINE"), 37;
          case 17:
            return this.begin("LINE"), 38;
          case 18:
            return this.begin("LINE"), 39;
          case 19:
            return this.begin("LINE"), 49;
          case 20:
            return this.begin("LINE"), 41;
          case 21:
            return this.begin("LINE"), 43;
          case 22:
            return this.begin("LINE"), 48;
          case 23:
            return this.begin("LINE"), 44;
          case 24:
            return this.begin("LINE"), 47;
          case 25:
            return this.begin("LINE"), 46;
          case 26:
            return this.popState(), 15;
          case 27:
            return 16;
          case 28:
            return 65;
          case 29:
            return 66;
          case 30:
            return 59;
          case 31:
            return 60;
          case 32:
            return 61;
          case 33:
            return 62;
          case 34:
            return 57;
          case 35:
            return 54;
          case 36:
            return this.begin("ID"), 21;
          case 37:
            return this.begin("ID"), 23;
          case 38:
            return 29;
          case 39:
            return 30;
          case 40:
            return this.begin("acc_title"), 31;
          case 41:
            return this.popState(), "acc_title_value";
          case 42:
            return this.begin("acc_descr"), 33;
          case 43:
            return this.popState(), "acc_descr_value";
          case 44:
            this.begin("acc_descr_multiline");
            break;
          case 45:
            this.popState();
            break;
          case 46:
            return "acc_descr_multiline_value";
          case 47:
            return 6;
          case 48:
            return 18;
          case 49:
            return 20;
          case 50:
            return 64;
          case 51:
            return 5;
          case 52:
            return G.yytext = G.yytext.trim(), 70;
          case 53:
            return 73;
          case 54:
            return 74;
          case 55:
            return 71;
          case 56:
            return 72;
          case 57:
            return 75;
          case 58:
            return 76;
          case 59:
            return 77;
          case 60:
            return 78;
          case 61:
            return 79;
          case 62:
            return 68;
          case 63:
            return 69;
          case 64:
            return 5;
          case 65:
            return "INVALID";
        }
      },
      rules: [/^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[0-9]+(?=[ \n]+))/i, /^(?:box\b)/i, /^(?:participant\b)/i, /^(?:actor\b)/i, /^(?:create\b)/i, /^(?:destroy\b)/i, /^(?:[^\->:\n,;]+?([\-]*[^\->:\n,;]+?)*?(?=((?!\n)\s)+as(?!\n)\s|[#\n;]|$))/i, /^(?:as\b)/i, /^(?:(?:))/i, /^(?:loop\b)/i, /^(?:rect\b)/i, /^(?:opt\b)/i, /^(?:alt\b)/i, /^(?:else\b)/i, /^(?:par\b)/i, /^(?:par_over\b)/i, /^(?:and\b)/i, /^(?:critical\b)/i, /^(?:option\b)/i, /^(?:break\b)/i, /^(?:(?:[:]?(?:no)?wrap)?[^#\n;]*)/i, /^(?:end\b)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:links\b)/i, /^(?:link\b)/i, /^(?:properties\b)/i, /^(?:details\b)/i, /^(?:over\b)/i, /^(?:note\b)/i, /^(?:activate\b)/i, /^(?:deactivate\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:title:\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:sequenceDiagram\b)/i, /^(?:autonumber\b)/i, /^(?:off\b)/i, /^(?:,)/i, /^(?:;)/i, /^(?:[^\+\->:\n,;]+((?!(-x|--x|-\)|--\)))[\-]*[^\+\->:\n,;]+)*)/i, /^(?:->>)/i, /^(?:-->>)/i, /^(?:->)/i, /^(?:-->)/i, /^(?:-[x])/i, /^(?:--[x])/i, /^(?:-[\)])/i, /^(?:--[\)])/i, /^(?::(?:(?:no)?wrap)?[^#\n;]+)/i, /^(?:\+)/i, /^(?:-)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { acc_descr_multiline: { rules: [45, 46], inclusive: !1 }, acc_descr: { rules: [43], inclusive: !1 }, acc_title: { rules: [41], inclusive: !1 }, ID: { rules: [2, 3, 12], inclusive: !1 }, ALIAS: { rules: [2, 3, 13, 14], inclusive: !1 }, LINE: { rules: [2, 3, 26], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 44, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65], inclusive: !0 } }
    };
    return W;
  })();
  H.lexer = it;
  function ot() {
    this.yy = {};
  }
  return ot.prototype = H, H.Parser = ot, new ot();
})();
F1.parser = F1;
const TG = F1;
class wG {
  /**
   * @param init - Function that creates the default state.
   */
  constructor(e) {
    this.init = e, this.records = this.init();
  }
  reset() {
    this.records = this.init();
  }
}
const It = new wG(() => ({
  prevActor: void 0,
  actors: {},
  createdActors: {},
  destroyedActors: {},
  boxes: [],
  messages: [],
  notes: [],
  sequenceNumbersEnabled: !1,
  wrapEnabled: void 0,
  currentBox: void 0,
  lastCreated: void 0,
  lastDestroyed: void 0
})), vG = function(t) {
  It.records.boxes.push({
    name: t.text,
    wrap: t.wrap === void 0 && ws() || !!t.wrap,
    fill: t.color,
    actorKeys: []
  }), It.records.currentBox = It.records.boxes.slice(-1)[0];
}, O1 = function(t, e, n, i) {
  let r = It.records.currentBox;
  const s = It.records.actors[t];
  if (s) {
    if (It.records.currentBox && s.box && It.records.currentBox !== s.box)
      throw new Error(
        "A same participant should only be defined in one Box: " + s.name + " can't be in '" + s.box.name + "' and in '" + It.records.currentBox.name + "' at the same time."
      );
    if (r = s.box ? s.box : It.records.currentBox, s.box = r, s && e === s.name && n == null)
      return;
  }
  (n == null || n.text == null) && (n = { text: e, wrap: null, type: i }), (i == null || n.text == null) && (n = { text: e, wrap: null, type: i }), It.records.actors[t] = {
    box: r,
    name: e,
    description: n.text,
    wrap: n.wrap === void 0 && ws() || !!n.wrap,
    prevActor: It.records.prevActor,
    links: {},
    properties: {},
    actorCnt: null,
    rectData: null,
    type: i || "participant"
  }, It.records.prevActor && It.records.actors[It.records.prevActor] && (It.records.actors[It.records.prevActor].nextActor = t), It.records.currentBox && It.records.currentBox.actorKeys.push(t), It.records.prevActor = t;
}, EG = (t) => {
  let e, n = 0;
  for (e = 0; e < It.records.messages.length; e++)
    It.records.messages[e].type === hl.ACTIVE_START && It.records.messages[e].from.actor === t && n++, It.records.messages[e].type === hl.ACTIVE_END && It.records.messages[e].from.actor === t && n--;
  return n;
}, CG = function(t, e, n, i) {
  It.records.messages.push({
    from: t,
    to: e,
    message: n.text,
    wrap: n.wrap === void 0 && ws() || !!n.wrap,
    answer: i
  });
}, Ae = function(t, e, n = { text: void 0, wrap: void 0 }, i, r = !1) {
  if (i === hl.ACTIVE_END && EG(t.actor) < 1) {
    let a = new Error("Trying to inactivate an inactive participant (" + t.actor + ")");
    throw a.hash = {
      text: "->>-",
      token: "->>-",
      line: "1",
      loc: { first_line: 1, last_line: 1, first_column: 1, last_column: 1 },
      expected: ["'ACTIVE_PARTICIPANT'"]
    }, a;
  }
  return It.records.messages.push({
    from: t,
    to: e,
    message: n.text,
    wrap: n.wrap === void 0 && ws() || !!n.wrap,
    type: i,
    activate: r
  }), !0;
}, SG = function() {
  return It.records.boxes.length > 0;
}, AG = function() {
  return It.records.boxes.some((t) => t.name);
}, LG = function() {
  return It.records.messages;
}, IG = function() {
  return It.records.boxes;
}, BG = function() {
  return It.records.actors;
}, DG = function() {
  return It.records.createdActors;
}, NG = function() {
  return It.records.destroyedActors;
}, Ol = function(t) {
  return It.records.actors[t];
}, FG = function() {
  return Object.keys(It.records.actors);
}, OG = function() {
  It.records.sequenceNumbersEnabled = !0;
}, RG = function() {
  It.records.sequenceNumbersEnabled = !1;
}, MG = () => It.records.sequenceNumbersEnabled, PG = function(t) {
  It.records.wrapEnabled = t;
}, ws = () => It.records.wrapEnabled !== void 0 ? It.records.wrapEnabled : Q().sequence.wrap, zG = function() {
  It.reset(), fn();
}, VG = function(t) {
  const e = t.trim(), n = {
    text: e.replace(/^:?(?:no)?wrap:/, "").trim(),
    wrap: e.match(/^:?wrap:/) !== null ? !0 : e.match(/^:?nowrap:/) !== null ? !1 : void 0
  };
  return z.debug("parseMessage:", n), n;
}, qG = function(t) {
  const e = t.match(/^((?:rgba?|hsla?)\s*\(.*\)|\w*)(.*)$/);
  let n = e != null && e[1] ? e[1].trim() : "transparent", i = e != null && e[2] ? e[2].trim() : void 0;
  if (window && window.CSS)
    window.CSS.supports("color", n) || (n = "transparent", i = t.trim());
  else {
    const r = new Option().style;
    r.color = n, r.color !== n && (n = "transparent", i = t.trim());
  }
  return {
    color: n,
    text: i !== void 0 ? Ne(i.replace(/^:?(?:no)?wrap:/, ""), Q()) : void 0,
    wrap: i !== void 0 ? i.match(/^:?wrap:/) !== null ? !0 : i.match(/^:?nowrap:/) !== null ? !1 : void 0 : void 0
  };
}, hl = {
  SOLID: 0,
  DOTTED: 1,
  NOTE: 2,
  SOLID_CROSS: 3,
  DOTTED_CROSS: 4,
  SOLID_OPEN: 5,
  DOTTED_OPEN: 6,
  LOOP_START: 10,
  LOOP_END: 11,
  ALT_START: 12,
  ALT_ELSE: 13,
  ALT_END: 14,
  OPT_START: 15,
  OPT_END: 16,
  ACTIVE_START: 17,
  ACTIVE_END: 18,
  PAR_START: 19,
  PAR_AND: 20,
  PAR_END: 21,
  RECT_START: 22,
  RECT_END: 23,
  SOLID_POINT: 24,
  DOTTED_POINT: 25,
  AUTONUMBER: 26,
  CRITICAL_START: 27,
  CRITICAL_OPTION: 28,
  CRITICAL_END: 29,
  BREAK_START: 30,
  BREAK_END: 31,
  PAR_OVER_START: 32
}, $G = {
  FILLED: 0,
  OPEN: 1
}, YG = {
  LEFTOF: 0,
  RIGHTOF: 1,
  OVER: 2
}, R_ = function(t, e, n) {
  const i = {
    actor: t,
    placement: e,
    message: n.text,
    wrap: n.wrap === void 0 && ws() || !!n.wrap
  }, r = [].concat(t, t);
  It.records.notes.push(i), It.records.messages.push({
    from: r[0],
    to: r[1],
    message: n.text,
    wrap: n.wrap === void 0 && ws() || !!n.wrap,
    type: hl.NOTE,
    placement: e
  });
}, M_ = function(t, e) {
  const n = Ol(t);
  try {
    let i = Ne(e.text, Q());
    i = i.replace(/&amp;/g, "&"), i = i.replace(/&equals;/g, "=");
    const r = JSON.parse(i);
    D0(n, r);
  } catch (i) {
    z.error("error while parsing actor link text", i);
  }
}, WG = function(t, e) {
  const n = Ol(t);
  try {
    const a = {};
    let o = Ne(e.text, Q());
    var i = o.indexOf("@");
    o = o.replace(/&amp;/g, "&"), o = o.replace(/&equals;/g, "=");
    var r = o.slice(0, i - 1).trim(), s = o.slice(i + 1).trim();
    a[r] = s, D0(n, a);
  } catch (a) {
    z.error("error while parsing actor link text", a);
  }
};
function D0(t, e) {
  if (t.links == null)
    t.links = e;
  else
    for (let n in e)
      t.links[n] = e[n];
}
const P_ = function(t, e) {
  const n = Ol(t);
  try {
    let i = Ne(e.text, Q());
    const r = JSON.parse(i);
    z_(n, r);
  } catch (i) {
    z.error("error while parsing actor properties text", i);
  }
};
function z_(t, e) {
  if (t.properties == null)
    t.properties = e;
  else
    for (let n in e)
      t.properties[n] = e[n];
}
function UG() {
  It.records.currentBox = void 0;
}
const V_ = function(t, e) {
  const n = Ol(t), i = document.getElementById(e.text);
  try {
    const r = i.innerHTML, s = JSON.parse(r);
    s.properties && z_(n, s.properties), s.links && D0(n, s.links);
  } catch (r) {
    z.error("error while parsing actor details text", r);
  }
}, HG = function(t, e) {
  if (t !== void 0 && t.properties !== void 0)
    return t.properties[e];
}, q_ = function(t) {
  if (Array.isArray(t))
    t.forEach(function(e) {
      q_(e);
    });
  else
    switch (t.type) {
      case "sequenceIndex":
        It.records.messages.push({
          from: void 0,
          to: void 0,
          message: {
            start: t.sequenceIndex,
            step: t.sequenceIndexStep,
            visible: t.sequenceVisible
          },
          wrap: !1,
          type: t.signalType
        });
        break;
      case "addParticipant":
        O1(t.actor, t.actor, t.description, t.draw);
        break;
      case "createParticipant":
        if (It.records.actors[t.actor])
          throw new Error(
            "It is not possible to have actors with the same id, even if one is destroyed before the next is created. Use 'AS' aliases to simulate the behavior"
          );
        It.records.lastCreated = t.actor, O1(t.actor, t.actor, t.description, t.draw), It.records.createdActors[t.actor] = It.records.messages.length;
        break;
      case "destroyParticipant":
        It.records.lastDestroyed = t.actor, It.records.destroyedActors[t.actor] = It.records.messages.length;
        break;
      case "activeStart":
        Ae(t.actor, void 0, void 0, t.signalType);
        break;
      case "activeEnd":
        Ae(t.actor, void 0, void 0, t.signalType);
        break;
      case "addNote":
        R_(t.actor, t.placement, t.text);
        break;
      case "addLinks":
        M_(t.actor, t.text);
        break;
      case "addALink":
        WG(t.actor, t.text);
        break;
      case "addProperties":
        P_(t.actor, t.text);
        break;
      case "addDetails":
        V_(t.actor, t.text);
        break;
      case "addMessage":
        if (It.records.lastCreated) {
          if (t.to !== It.records.lastCreated)
            throw new Error(
              "The created participant " + It.records.lastCreated + " does not have an associated creating message after its declaration. Please check the sequence diagram."
            );
          It.records.lastCreated = void 0;
        } else if (It.records.lastDestroyed) {
          if (t.to !== It.records.lastDestroyed && t.from !== It.records.lastDestroyed)
            throw new Error(
              "The destroyed participant " + It.records.lastDestroyed + " does not have an associated destroying message after its declaration. Please check the sequence diagram."
            );
          It.records.lastDestroyed = void 0;
        }
        Ae(t.from, t.to, t.msg, t.signalType, t.activate);
        break;
      case "boxStart":
        vG(t.boxData);
        break;
      case "boxEnd":
        UG();
        break;
      case "loopStart":
        Ae(void 0, void 0, t.loopText, t.signalType);
        break;
      case "loopEnd":
        Ae(void 0, void 0, void 0, t.signalType);
        break;
      case "rectStart":
        Ae(void 0, void 0, t.color, t.signalType);
        break;
      case "rectEnd":
        Ae(void 0, void 0, void 0, t.signalType);
        break;
      case "optStart":
        Ae(void 0, void 0, t.optText, t.signalType);
        break;
      case "optEnd":
        Ae(void 0, void 0, void 0, t.signalType);
        break;
      case "altStart":
        Ae(void 0, void 0, t.altText, t.signalType);
        break;
      case "else":
        Ae(void 0, void 0, t.altText, t.signalType);
        break;
      case "altEnd":
        Ae(void 0, void 0, void 0, t.signalType);
        break;
      case "setAccTitle":
        pn(t.text);
        break;
      case "parStart":
        Ae(void 0, void 0, t.parText, t.signalType);
        break;
      case "and":
        Ae(void 0, void 0, t.parText, t.signalType);
        break;
      case "parEnd":
        Ae(void 0, void 0, void 0, t.signalType);
        break;
      case "criticalStart":
        Ae(void 0, void 0, t.criticalText, t.signalType);
        break;
      case "option":
        Ae(void 0, void 0, t.optionText, t.signalType);
        break;
      case "criticalEnd":
        Ae(void 0, void 0, void 0, t.signalType);
        break;
      case "breakStart":
        Ae(void 0, void 0, t.breakText, t.signalType);
        break;
      case "breakEnd":
        Ae(void 0, void 0, void 0, t.signalType);
        break;
    }
}, Q2 = {
  addActor: O1,
  addMessage: CG,
  addSignal: Ae,
  addLinks: M_,
  addDetails: V_,
  addProperties: P_,
  autoWrap: ws,
  setWrap: PG,
  enableSequenceNumbers: OG,
  disableSequenceNumbers: RG,
  showSequenceNumbers: MG,
  getMessages: LG,
  getActors: BG,
  getCreatedActors: DG,
  getDestroyedActors: NG,
  getActor: Ol,
  getActorKeys: FG,
  getActorProperty: HG,
  getAccTitle: vn,
  getBoxes: IG,
  getDiagramTitle: Sn,
  setDiagramTitle: Yn,
  getConfig: () => Q().sequence,
  clear: zG,
  parseMessage: VG,
  parseBoxData: qG,
  LINETYPE: hl,
  ARROWTYPE: $G,
  PLACEMENT: YG,
  addNote: R_,
  setAccTitle: pn,
  apply: q_,
  setAccDescription: En,
  getAccDescription: Cn,
  hasAtLeastOneBox: SG,
  hasAtLeastOneBoxWithTitle: AG
}, GG = (t) => `.actor {
    stroke: ${t.actorBorder};
    fill: ${t.actorBkg};
  }

  text.actor > tspan {
    fill: ${t.actorTextColor};
    stroke: none;
  }

  .actor-line {
    stroke: ${t.actorLineColor};
  }

  .messageLine0 {
    stroke-width: 1.5;
    stroke-dasharray: none;
    stroke: ${t.signalColor};
  }

  .messageLine1 {
    stroke-width: 1.5;
    stroke-dasharray: 2, 2;
    stroke: ${t.signalColor};
  }

  #arrowhead path {
    fill: ${t.signalColor};
    stroke: ${t.signalColor};
  }

  .sequenceNumber {
    fill: ${t.sequenceNumberColor};
  }

  #sequencenumber {
    fill: ${t.signalColor};
  }

  #crosshead path {
    fill: ${t.signalColor};
    stroke: ${t.signalColor};
  }

  .messageText {
    fill: ${t.signalTextColor};
    stroke: none;
  }

  .labelBox {
    stroke: ${t.labelBoxBorderColor};
    fill: ${t.labelBoxBkgColor};
  }

  .labelText, .labelText > tspan {
    fill: ${t.labelTextColor};
    stroke: none;
  }

  .loopText, .loopText > tspan {
    fill: ${t.loopTextColor};
    stroke: none;
  }

  .loopLine {
    stroke-width: 2px;
    stroke-dasharray: 2, 2;
    stroke: ${t.labelBoxBorderColor};
    fill: ${t.labelBoxBorderColor};
  }

  .note {
    //stroke: #decc93;
    stroke: ${t.noteBorderColor};
    fill: ${t.noteBkgColor};
  }

  .noteText, .noteText > tspan {
    fill: ${t.noteTextColor};
    stroke: none;
  }

  .activation0 {
    fill: ${t.activationBkgColor};
    stroke: ${t.activationBorderColor};
  }

  .activation1 {
    fill: ${t.activationBkgColor};
    stroke: ${t.activationBorderColor};
  }

  .activation2 {
    fill: ${t.activationBkgColor};
    stroke: ${t.activationBorderColor};
  }

  .actorPopupMenu {
    position: absolute;
  }

  .actorPopupMenuPanel {
    position: absolute;
    fill: ${t.actorBkg};
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    filter: drop-shadow(3px 5px 2px rgb(0 0 0 / 0.4));
}
  .actor-man line {
    stroke: ${t.actorBorder};
    fill: ${t.actorBkg};
  }
  .actor-man circle, line {
    stroke: ${t.actorBorder};
    fill: ${t.actorBkg};
    stroke-width: 2px;
  }
`, jG = GG, os = 36, $_ = "actor-top", Y_ = "actor-bottom", N0 = function(t, e) {
  return oh(t, e);
}, XG = function(t, e, n, i, r) {
  if (e.links === void 0 || e.links === null || Object.keys(e.links).length === 0)
    return { height: 0, width: 0 };
  const s = e.links, a = e.actorCnt, o = e.rectData;
  var l = "none";
  r && (l = "block !important");
  const u = t.append("g");
  u.attr("id", "actor" + a + "_popup"), u.attr("class", "actorPopupMenu"), u.attr("display", l);
  var h = "";
  o.class !== void 0 && (h = " " + o.class);
  let f = o.width > n ? o.width : n;
  const d = u.append("rect");
  if (d.attr("class", "actorPopupMenuPanel" + h), d.attr("x", o.x), d.attr("y", o.height), d.attr("fill", o.fill), d.attr("stroke", o.stroke), d.attr("width", f), d.attr("height", o.height), d.attr("rx", o.rx), d.attr("ry", o.ry), s != null) {
    var p = 20;
    for (let _ in s) {
      var y = u.append("a"), m = As.sanitizeUrl(s[_]);
      y.attr("xlink:href", m), y.attr("target", "_blank"), dj(i)(
        _,
        y,
        o.x + 10,
        o.height + p,
        f,
        20,
        { class: "actor" },
        i
      ), p += 30;
    }
  }
  return d.attr("height", p), { height: o.height + p, width: f };
}, KG = function(t) {
  return "var pu = document.getElementById('" + t + "'); if (pu != null) { pu.style.display = pu.style.display == 'block' ? 'none' : 'block'; }";
}, wu = async function(t, e, n = null) {
  let i = t.append("foreignObject");
  const r = await Ps(e.text, Ee()), a = i.append("xhtml:div").attr("style", "width: fit-content;").attr("xmlns", "http://www.w3.org/1999/xhtml").html(r).node().getBoundingClientRect();
  if (i.attr("height", Math.round(a.height)).attr("width", Math.round(a.width)), e.class === "noteText") {
    const o = t.node().firstChild;
    o.setAttribute("height", a.height + 2 * e.textMargin);
    const l = o.getBBox();
    i.attr("x", Math.round(l.x + l.width / 2 - a.width / 2)).attr("y", Math.round(l.y + l.height / 2 - a.height / 2));
  } else if (n) {
    let { startx: o, stopx: l, starty: u } = n;
    if (o > l) {
      const h = o;
      o = l, l = h;
    }
    i.attr("x", Math.round(o + Math.abs(o - l) / 2 - a.width / 2)), e.class === "loopText" ? i.attr("y", Math.round(u)) : i.attr("y", Math.round(u - a.height));
  }
  return [i];
}, Fa = function(t, e) {
  let n = 0, i = 0;
  const r = e.text.split(bt.lineBreakRegex), [s, a] = zs(e.fontSize);
  let o = [], l = 0, u = () => e.y;
  if (e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0)
    switch (e.valign) {
      case "top":
      case "start":
        u = () => Math.round(e.y + e.textMargin);
        break;
      case "middle":
      case "center":
        u = () => Math.round(e.y + (n + i + e.textMargin) / 2);
        break;
      case "bottom":
      case "end":
        u = () => Math.round(
          e.y + (n + i + 2 * e.textMargin) - e.textMargin
        );
        break;
    }
  if (e.anchor !== void 0 && e.textMargin !== void 0 && e.width !== void 0)
    switch (e.anchor) {
      case "left":
      case "start":
        e.x = Math.round(e.x + e.textMargin), e.anchor = "start", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
        break;
      case "middle":
      case "center":
        e.x = Math.round(e.x + e.width / 2), e.anchor = "middle", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
        break;
      case "right":
      case "end":
        e.x = Math.round(e.x + e.width - e.textMargin), e.anchor = "end", e.dominantBaseline = "middle", e.alignmentBaseline = "middle";
        break;
    }
  for (let [h, f] of r.entries()) {
    e.textMargin !== void 0 && e.textMargin === 0 && s !== void 0 && (l = h * s);
    const d = t.append("text");
    d.attr("x", e.x), d.attr("y", u()), e.anchor !== void 0 && d.attr("text-anchor", e.anchor).attr("dominant-baseline", e.dominantBaseline).attr("alignment-baseline", e.alignmentBaseline), e.fontFamily !== void 0 && d.style("font-family", e.fontFamily), a !== void 0 && d.style("font-size", a), e.fontWeight !== void 0 && d.style("font-weight", e.fontWeight), e.fill !== void 0 && d.attr("fill", e.fill), e.class !== void 0 && d.attr("class", e.class), e.dy !== void 0 ? d.attr("dy", e.dy) : l !== 0 && d.attr("dy", l);
    const p = f || Fx;
    if (e.tspan) {
      const y = d.append("tspan");
      y.attr("x", e.x), e.fill !== void 0 && y.attr("fill", e.fill), y.text(p);
    } else
      d.text(p);
    e.valign !== void 0 && e.textMargin !== void 0 && e.textMargin > 0 && (i += (d._groups || d)[0][0].getBBox().height, n = i), o.push(d);
  }
  return o;
}, W_ = function(t, e) {
  function n(r, s, a, o, l) {
    return r + "," + s + " " + (r + a) + "," + s + " " + (r + a) + "," + (s + o - l) + " " + (r + a - l * 1.2) + "," + (s + o) + " " + r + "," + (s + o);
  }
  const i = t.append("polygon");
  return i.attr("points", n(e.x, e.y, e.width, e.height, 7)), i.attr("class", "labelBox"), e.y = e.y + e.height / 2, Fa(t, e), i;
};
let Pi = -1;
const U_ = (t, e, n, i) => {
  t.select && n.forEach((r) => {
    const s = e[r], a = t.select("#actor" + s.actorCnt);
    !i.mirrorActors && s.stopy ? a.attr("y2", s.stopy + s.height / 2) : i.mirrorActors && a.attr("y2", s.stopy);
  });
}, QG = async function(t, e, n, i) {
  const r = i ? e.stopy : e.starty, s = e.x + e.width / 2, a = r + 5, o = t.append("g").lower();
  var l = o;
  i || (Pi++, Object.keys(e.links || {}).length && !n.forceMenus && l.attr("onclick", KG(`actor${Pi}_popup`)).attr("cursor", "pointer"), l.append("line").attr("id", "actor" + Pi).attr("x1", s).attr("y1", a).attr("x2", s).attr("y2", 2e3).attr("class", "actor-line").attr("class", "200").attr("stroke-width", "0.5px").attr("stroke", "#999"), l = o.append("g"), e.actorCnt = Pi, e.links != null && l.attr("id", "root-" + Pi));
  const u = Vs();
  var h = "actor";
  e.properties != null && e.properties.class ? h = e.properties.class : u.fill = "#eaeaea", i ? h += ` ${Y_}` : h += ` ${$_}`, u.x = e.x, u.y = r, u.width = e.width, u.height = e.height, u.class = h, u.rx = 3, u.ry = 3, u.name = e.name;
  const f = N0(l, u);
  if (e.rectData = u, e.properties != null && e.properties.icon) {
    const p = e.properties.icon.trim();
    p.charAt(0) === "@" ? zD(l, u.x + u.width - 20, u.y + 10, p.substr(1)) : PD(l, u.x + u.width - 20, u.y + 10, p);
  }
  await F0(n, hi(e.description))(
    e.description,
    l,
    u.x,
    u.y,
    u.width,
    u.height,
    { class: "actor" },
    n
  );
  let d = e.height;
  if (f.node) {
    const p = f.node().getBBox();
    e.height = p.height, d = p.height;
  }
  return d;
}, ZG = async function(t, e, n, i) {
  const r = i ? e.stopy : e.starty, s = e.x + e.width / 2, a = r + 80;
  t.lower(), i || (Pi++, t.append("line").attr("id", "actor" + Pi).attr("x1", s).attr("y1", a).attr("x2", s).attr("y2", 2e3).attr("class", "actor-line").attr("class", "200").attr("stroke-width", "0.5px").attr("stroke", "#999"), e.actorCnt = Pi);
  const o = t.append("g");
  let l = "actor-man";
  i ? l += ` ${Y_}` : l += ` ${$_}`, o.attr("class", l), o.attr("name", e.name);
  const u = Vs();
  u.x = e.x, u.y = r, u.fill = "#eaeaea", u.width = e.width, u.height = e.height, u.class = "actor", u.rx = 3, u.ry = 3, o.append("line").attr("id", "actor-man-torso" + Pi).attr("x1", s).attr("y1", r + 25).attr("x2", s).attr("y2", r + 45), o.append("line").attr("id", "actor-man-arms" + Pi).attr("x1", s - os / 2).attr("y1", r + 33).attr("x2", s + os / 2).attr("y2", r + 33), o.append("line").attr("x1", s - os / 2).attr("y1", r + 60).attr("x2", s).attr("y2", r + 45), o.append("line").attr("x1", s).attr("y1", r + 45).attr("x2", s + os / 2 - 2).attr("y2", r + 60);
  const h = o.append("circle");
  h.attr("cx", e.x + e.width / 2), h.attr("cy", r + 10), h.attr("r", 15), h.attr("width", e.width), h.attr("height", e.height);
  const f = o.node().getBBox();
  return e.height = f.height, await F0(n, hi(e.description))(
    e.description,
    o,
    u.x,
    u.y + 35,
    u.width,
    u.height,
    { class: "actor" },
    n
  ), e.height;
}, JG = async function(t, e, n, i) {
  switch (e.type) {
    case "actor":
      return await ZG(t, e, n, i);
    case "participant":
      return await QG(t, e, n, i);
  }
}, tj = async function(t, e, n) {
  const r = t.append("g");
  H_(r, e), e.name && await F0(n)(
    e.name,
    r,
    e.x,
    e.y + (e.textMaxHeight || 0) / 2,
    e.width,
    0,
    { class: "text" },
    n
  ), r.lower();
}, ej = function(t) {
  return t.append("g");
}, nj = function(t, e, n, i, r) {
  const s = Vs(), a = e.anchored;
  s.x = e.startx, s.y = e.starty, s.class = "activation" + r % 3, s.width = e.stopx - e.startx, s.height = n - e.starty, N0(a, s);
}, ij = async function(t, e, n, i) {
  const {
    boxMargin: r,
    boxTextMargin: s,
    labelBoxHeight: a,
    labelBoxWidth: o,
    messageFontFamily: l,
    messageFontSize: u,
    messageFontWeight: h
  } = i, f = t.append("g"), d = function(m, _, T, v) {
    return f.append("line").attr("x1", m).attr("y1", _).attr("x2", T).attr("y2", v).attr("class", "loopLine");
  };
  d(e.startx, e.starty, e.stopx, e.starty), d(e.stopx, e.starty, e.stopx, e.stopy), d(e.startx, e.stopy, e.stopx, e.stopy), d(e.startx, e.starty, e.startx, e.stopy), e.sections !== void 0 && e.sections.forEach(function(m) {
    d(e.startx, m.y, e.stopx, m.y).style(
      "stroke-dasharray",
      "3, 3"
    );
  });
  let p = zf();
  p.text = n, p.x = e.startx, p.y = e.starty, p.fontFamily = l, p.fontSize = u, p.fontWeight = h, p.anchor = "middle", p.valign = "middle", p.tspan = !1, p.width = o || 50, p.height = a || 20, p.textMargin = s, p.class = "labelText", W_(f, p), p = G_(), p.text = e.title, p.x = e.startx + o / 2 + (e.stopx - e.startx) / 2, p.y = e.starty + r + s, p.anchor = "middle", p.valign = "middle", p.textMargin = s, p.class = "loopText", p.fontFamily = l, p.fontSize = u, p.fontWeight = h, p.wrap = !0;
  let y = hi(p.text) ? await wu(f, p, e) : Fa(f, p);
  if (e.sectionTitles !== void 0) {
    for (const [m, _] of Object.entries(e.sectionTitles))
      if (_.message) {
        p.text = _.message, p.x = e.startx + (e.stopx - e.startx) / 2, p.y = e.sections[m].y + r + s, p.class = "loopText", p.anchor = "middle", p.valign = "middle", p.tspan = !1, p.fontFamily = l, p.fontSize = u, p.fontWeight = h, p.wrap = e.wrap, hi(p.text) ? (e.starty = e.sections[m].y, await wu(f, p, e)) : Fa(f, p);
        let T = Math.round(
          y.map((v) => (v._groups || v)[0][0].getBBox().height).reduce((v, A) => v + A)
        );
        e.sections[m].height += T - (r + s);
      }
  }
  return e.height = Math.round(e.stopy - e.starty), f;
}, H_ = function(t, e) {
  qb(t, e);
}, rj = function(t) {
  t.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr(
    "d",
    "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z"
  );
}, sj = function(t) {
  t.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
    "d",
    "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z"
  );
}, aj = function(t) {
  t.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr(
    "d",
    "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z"
  );
}, oj = function(t) {
  t.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 7.9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z");
}, lj = function(t) {
  t.append("defs").append("marker").attr("id", "filled-head").attr("refX", 15.5).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
}, cj = function(t) {
  t.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6);
}, uj = function(t) {
  t.append("defs").append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 4).attr("refY", 4.5).append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1pt").attr("d", "M 1,2 L 6,7 M 6,2 L 1,7");
}, G_ = function() {
  return {
    x: 0,
    y: 0,
    fill: void 0,
    anchor: void 0,
    style: "#666",
    width: void 0,
    height: void 0,
    textMargin: 0,
    rx: 0,
    ry: 0,
    tspan: !0,
    valign: void 0
  };
}, hj = function() {
  return {
    x: 0,
    y: 0,
    fill: "#EDF2AE",
    stroke: "#666",
    width: 100,
    anchor: "start",
    height: 100,
    rx: 0,
    ry: 0
  };
}, F0 = /* @__PURE__ */ (function() {
  function t(s, a, o, l, u, h, f) {
    const d = a.append("text").attr("x", o + u / 2).attr("y", l + h / 2 + 5).style("text-anchor", "middle").text(s);
    r(d, f);
  }
  function e(s, a, o, l, u, h, f, d) {
    const { actorFontSize: p, actorFontFamily: y, actorFontWeight: m } = d, [_, T] = zs(p), v = s.split(bt.lineBreakRegex);
    for (let A = 0; A < v.length; A++) {
      const L = A * _ - _ * (v.length - 1) / 2, w = a.append("text").attr("x", o + u / 2).attr("y", l).style("text-anchor", "middle").style("font-size", T).style("font-weight", m).style("font-family", y);
      w.append("tspan").attr("x", o + u / 2).attr("dy", L).text(v[A]), w.attr("y", l + h / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), r(w, f);
    }
  }
  function n(s, a, o, l, u, h, f, d) {
    const p = a.append("switch"), m = p.append("foreignObject").attr("x", o).attr("y", l).attr("width", u).attr("height", h).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    m.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(s), e(s, p, o, l, u, h, f, d), r(m, f);
  }
  async function i(s, a, o, l, u, h, f, d) {
    const p = await vl(s, Ee()), y = a.append("switch"), _ = y.append("foreignObject").attr("x", o + u / 2 - p.width / 2).attr("y", l + h / 2 - p.height / 2).attr("width", p.width).attr("height", p.height).append("xhtml:div").style("height", "100%").style("width", "100%");
    _.append("div").style("text-align", "center").style("vertical-align", "middle").html(await Ps(s, Ee())), e(s, y, o, l, u, h, f, d), r(_, f);
  }
  function r(s, a) {
    for (const o in a)
      a.hasOwnProperty(o) && s.attr(o, a[o]);
  }
  return function(s, a = !1) {
    return a ? i : s.textPlacement === "fo" ? n : s.textPlacement === "old" ? t : e;
  };
})(), dj = /* @__PURE__ */ (function() {
  function t(r, s, a, o, l, u, h) {
    const f = s.append("text").attr("x", a).attr("y", o).style("text-anchor", "start").text(r);
    i(f, h);
  }
  function e(r, s, a, o, l, u, h, f) {
    const { actorFontSize: d, actorFontFamily: p, actorFontWeight: y } = f, m = r.split(bt.lineBreakRegex);
    for (let _ = 0; _ < m.length; _++) {
      const T = _ * d - d * (m.length - 1) / 2, v = s.append("text").attr("x", a).attr("y", o).style("text-anchor", "start").style("font-size", d).style("font-weight", y).style("font-family", p);
      v.append("tspan").attr("x", a).attr("dy", T).text(m[_]), v.attr("y", o + u / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), i(v, h);
    }
  }
  function n(r, s, a, o, l, u, h, f) {
    const d = s.append("switch"), y = d.append("foreignObject").attr("x", a).attr("y", o).attr("width", l).attr("height", u).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    y.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(r), e(r, d, a, o, l, u, h, f), i(y, h);
  }
  function i(r, s) {
    for (const a in s)
      s.hasOwnProperty(a) && r.attr(a, s[a]);
  }
  return function(r) {
    return r.textPlacement === "fo" ? n : r.textPlacement === "old" ? t : e;
  };
})(), Le = {
  drawRect: N0,
  drawText: Fa,
  drawLabel: W_,
  drawActor: JG,
  drawBox: tj,
  drawPopup: XG,
  anchorElement: ej,
  drawActivation: nj,
  drawLoop: ij,
  drawBackgroundRect: H_,
  insertArrowHead: oj,
  insertArrowFilledHead: lj,
  insertSequenceNumber: cj,
  insertArrowCrossHead: uj,
  insertDatabaseIcon: rj,
  insertComputerIcon: sj,
  insertClockIcon: aj,
  getTextObj: G_,
  getNoteRect: hj,
  fixLifeLineHeights: U_,
  sanitizeUrl: As.sanitizeUrl
};
let at = {};
const xt = {
  data: {
    startx: void 0,
    stopx: void 0,
    starty: void 0,
    stopy: void 0
  },
  verticalPos: 0,
  sequenceItems: [],
  activations: [],
  models: {
    getHeight: function() {
      return Math.max.apply(
        null,
        this.actors.length === 0 ? [0] : this.actors.map((t) => t.height || 0)
      ) + (this.loops.length === 0 ? 0 : this.loops.map((t) => t.height || 0).reduce((t, e) => t + e)) + (this.messages.length === 0 ? 0 : this.messages.map((t) => t.height || 0).reduce((t, e) => t + e)) + (this.notes.length === 0 ? 0 : this.notes.map((t) => t.height || 0).reduce((t, e) => t + e));
    },
    clear: function() {
      this.actors = [], this.boxes = [], this.loops = [], this.messages = [], this.notes = [];
    },
    addBox: function(t) {
      this.boxes.push(t);
    },
    addActor: function(t) {
      this.actors.push(t);
    },
    addLoop: function(t) {
      this.loops.push(t);
    },
    addMessage: function(t) {
      this.messages.push(t);
    },
    addNote: function(t) {
      this.notes.push(t);
    },
    lastActor: function() {
      return this.actors[this.actors.length - 1];
    },
    lastLoop: function() {
      return this.loops[this.loops.length - 1];
    },
    lastMessage: function() {
      return this.messages[this.messages.length - 1];
    },
    lastNote: function() {
      return this.notes[this.notes.length - 1];
    },
    actors: [],
    boxes: [],
    loops: [],
    messages: [],
    notes: []
  },
  init: function() {
    this.sequenceItems = [], this.activations = [], this.models.clear(), this.data = {
      startx: void 0,
      stopx: void 0,
      starty: void 0,
      stopy: void 0
    }, this.verticalPos = 0, X_(Q());
  },
  updateVal: function(t, e, n, i) {
    t[e] === void 0 ? t[e] = n : t[e] = i(n, t[e]);
  },
  updateBounds: function(t, e, n, i) {
    const r = this;
    let s = 0;
    function a(o) {
      return function(u) {
        s++;
        const h = r.sequenceItems.length - s + 1;
        r.updateVal(u, "starty", e - h * at.boxMargin, Math.min), r.updateVal(u, "stopy", i + h * at.boxMargin, Math.max), r.updateVal(xt.data, "startx", t - h * at.boxMargin, Math.min), r.updateVal(xt.data, "stopx", n + h * at.boxMargin, Math.max), o !== "activation" && (r.updateVal(u, "startx", t - h * at.boxMargin, Math.min), r.updateVal(u, "stopx", n + h * at.boxMargin, Math.max), r.updateVal(xt.data, "starty", e - h * at.boxMargin, Math.min), r.updateVal(xt.data, "stopy", i + h * at.boxMargin, Math.max));
      };
    }
    this.sequenceItems.forEach(a()), this.activations.forEach(a("activation"));
  },
  insert: function(t, e, n, i) {
    const r = bt.getMin(t, n), s = bt.getMax(t, n), a = bt.getMin(e, i), o = bt.getMax(e, i);
    this.updateVal(xt.data, "startx", r, Math.min), this.updateVal(xt.data, "starty", a, Math.min), this.updateVal(xt.data, "stopx", s, Math.max), this.updateVal(xt.data, "stopy", o, Math.max), this.updateBounds(r, a, s, o);
  },
  newActivation: function(t, e, n) {
    const i = n[t.from.actor], r = wh(t.from.actor).length || 0, s = i.x + i.width / 2 + (r - 1) * at.activationWidth / 2;
    this.activations.push({
      startx: s,
      starty: this.verticalPos + 2,
      stopx: s + at.activationWidth,
      stopy: void 0,
      actor: t.from.actor,
      anchored: Le.anchorElement(e)
    });
  },
  endActivation: function(t) {
    const e = this.activations.map(function(n) {
      return n.actor;
    }).lastIndexOf(t.from.actor);
    return this.activations.splice(e, 1)[0];
  },
  createLoop: function(t = { message: void 0, wrap: !1, width: void 0 }, e) {
    return {
      startx: void 0,
      starty: this.verticalPos,
      stopx: void 0,
      stopy: void 0,
      title: t.message,
      wrap: t.wrap,
      width: t.width,
      height: 0,
      fill: e
    };
  },
  newLoop: function(t = { message: void 0, wrap: !1, width: void 0 }, e) {
    this.sequenceItems.push(this.createLoop(t, e));
  },
  endLoop: function() {
    return this.sequenceItems.pop();
  },
  isLoopOverlap: function() {
    return this.sequenceItems.length ? this.sequenceItems[this.sequenceItems.length - 1].overlap : !1;
  },
  addSectionToLoop: function(t) {
    const e = this.sequenceItems.pop();
    e.sections = e.sections || [], e.sectionTitles = e.sectionTitles || [], e.sections.push({ y: xt.getVerticalPos(), height: 0 }), e.sectionTitles.push(t), this.sequenceItems.push(e);
  },
  saveVerticalPos: function() {
    this.isLoopOverlap() && (this.savedVerticalPos = this.verticalPos);
  },
  resetVerticalPos: function() {
    this.isLoopOverlap() && (this.verticalPos = this.savedVerticalPos);
  },
  bumpVerticalPos: function(t) {
    this.verticalPos = this.verticalPos + t, this.data.stopy = bt.getMax(this.data.stopy, this.verticalPos);
  },
  getVerticalPos: function() {
    return this.verticalPos;
  },
  getBounds: function() {
    return { bounds: this.data, models: this.models };
  }
}, fj = async function(t, e) {
  xt.bumpVerticalPos(at.boxMargin), e.height = at.boxMargin, e.starty = xt.getVerticalPos();
  const n = Vs();
  n.x = e.startx, n.y = e.starty, n.width = e.width || at.width, n.class = "note";
  const i = t.append("g"), r = Le.drawRect(i, n), s = zf();
  s.x = e.startx, s.y = e.starty, s.width = n.width, s.dy = "1em", s.text = e.message, s.class = "noteText", s.fontFamily = at.noteFontFamily, s.fontSize = at.noteFontSize, s.fontWeight = at.noteFontWeight, s.anchor = at.noteAlign, s.textMargin = at.noteMargin, s.valign = "center";
  const a = hi(s.text) ? await wu(i, s) : Fa(i, s), o = Math.round(
    a.map((l) => (l._groups || l)[0][0].getBBox().height).reduce((l, u) => l + u)
  );
  r.attr("height", o + 2 * at.noteMargin), e.height += o + 2 * at.noteMargin, xt.bumpVerticalPos(o + 2 * at.noteMargin), e.stopy = e.starty + o + 2 * at.noteMargin, e.stopx = e.startx + n.width, xt.insert(e.startx, e.starty, e.stopx, e.stopy), xt.models.addNote(e);
}, vs = (t) => ({
  fontFamily: t.messageFontFamily,
  fontSize: t.messageFontSize,
  fontWeight: t.messageFontWeight
}), Gs = (t) => ({
  fontFamily: t.noteFontFamily,
  fontSize: t.noteFontSize,
  fontWeight: t.noteFontWeight
}), R1 = (t) => ({
  fontFamily: t.actorFontFamily,
  fontSize: t.actorFontSize,
  fontWeight: t.actorFontWeight
});
async function pj(t, e) {
  xt.bumpVerticalPos(10);
  const { startx: n, stopx: i, message: r } = e, s = bt.splitBreaks(r).length, a = hi(r), o = a ? await vl(r, Q()) : Gt.calculateTextDimensions(r, vs(at));
  if (!a) {
    const f = o.height / s;
    e.height += f, xt.bumpVerticalPos(f);
  }
  let l, u = o.height - 10;
  const h = o.width;
  if (n === i) {
    l = xt.getVerticalPos() + u, at.rightAngles || (u += at.boxMargin, l = xt.getVerticalPos() + u), u += 30;
    const f = bt.getMax(h / 2, at.width / 2);
    xt.insert(
      n - f,
      xt.getVerticalPos() - 10 + u,
      i + f,
      xt.getVerticalPos() + 30 + u
    );
  } else
    u += at.boxMargin, l = xt.getVerticalPos() + u, xt.insert(n, l - 10, i, l);
  return xt.bumpVerticalPos(u), e.height += u, e.stopy = e.starty + e.height, xt.insert(e.fromBounds, e.starty, e.toBounds, e.stopy), l;
}
const gj = async function(t, e, n, i) {
  const { startx: r, stopx: s, starty: a, message: o, type: l, sequenceIndex: u, sequenceVisible: h } = e, f = Gt.calculateTextDimensions(o, vs(at)), d = zf();
  d.x = r, d.y = a + 10, d.width = s - r, d.class = "messageText", d.dy = "1em", d.text = o, d.fontFamily = at.messageFontFamily, d.fontSize = at.messageFontSize, d.fontWeight = at.messageFontWeight, d.anchor = at.messageAlign, d.valign = "center", d.textMargin = at.wrapPadding, d.tspan = !1, hi(d.text) ? await wu(t, d, { startx: r, stopx: s, starty: n }) : Fa(t, d);
  const p = f.width;
  let y;
  r === s ? at.rightAngles ? y = t.append("path").attr(
    "d",
    `M  ${r},${n} H ${r + bt.getMax(at.width / 2, p / 2)} V ${n + 25} H ${r}`
  ) : y = t.append("path").attr(
    "d",
    "M " + r + "," + n + " C " + (r + 60) + "," + (n - 10) + " " + (r + 60) + "," + (n + 30) + " " + r + "," + (n + 20)
  ) : (y = t.append("line"), y.attr("x1", r), y.attr("y1", n), y.attr("x2", s), y.attr("y2", n)), l === i.db.LINETYPE.DOTTED || l === i.db.LINETYPE.DOTTED_CROSS || l === i.db.LINETYPE.DOTTED_POINT || l === i.db.LINETYPE.DOTTED_OPEN ? (y.style("stroke-dasharray", "3, 3"), y.attr("class", "messageLine1")) : y.attr("class", "messageLine0");
  let m = "";
  at.arrowMarkerAbsolute && (m = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, m = m.replace(/\(/g, "\\("), m = m.replace(/\)/g, "\\)")), y.attr("stroke-width", 2), y.attr("stroke", "none"), y.style("fill", "none"), (l === i.db.LINETYPE.SOLID || l === i.db.LINETYPE.DOTTED) && y.attr("marker-end", "url(" + m + "#arrowhead)"), (l === i.db.LINETYPE.SOLID_POINT || l === i.db.LINETYPE.DOTTED_POINT) && y.attr("marker-end", "url(" + m + "#filled-head)"), (l === i.db.LINETYPE.SOLID_CROSS || l === i.db.LINETYPE.DOTTED_CROSS) && y.attr("marker-end", "url(" + m + "#crosshead)"), (h || at.showSequenceNumbers) && (y.attr("marker-start", "url(" + m + "#sequencenumber)"), t.append("text").attr("x", r).attr("y", n + 4).attr("font-family", "sans-serif").attr("font-size", "12px").attr("text-anchor", "middle").attr("class", "sequenceNumber").text(u));
}, yj = async function(t, e, n, i, r, s, a) {
  let o = 0, l = 0, u, h = 0;
  for (const f of i) {
    const d = e[f], p = d.box;
    u && u != p && (xt.models.addBox(u), l += at.boxMargin + u.margin), p && p != u && (p.x = o + l, p.y = r, l += p.margin), d.width = d.width || at.width, d.height = bt.getMax(d.height || at.height, at.height), d.margin = d.margin || at.actorMargin, h = bt.getMax(h, d.height), n[d.name] && (l += d.width / 2), d.x = o + l, d.starty = xt.getVerticalPos(), xt.insert(d.x, r, d.x + d.width, d.height), o += d.width + l, d.box && (d.box.width = o + p.margin - d.box.x), l = d.margin, u = d.box, xt.models.addActor(d);
  }
  u && xt.models.addBox(u), xt.bumpVerticalPos(h);
}, M1 = async function(t, e, n, i) {
  if (i) {
    let r = 0;
    xt.bumpVerticalPos(at.boxMargin * 2);
    for (const s of n) {
      const a = e[s];
      a.stopy || (a.stopy = xt.getVerticalPos());
      const o = await Le.drawActor(t, a, at, !0);
      r = bt.getMax(r, o);
    }
    xt.bumpVerticalPos(r + at.boxMargin);
  } else
    for (const r of n) {
      const s = e[r];
      await Le.drawActor(t, s, at, !1);
    }
}, j_ = function(t, e, n, i) {
  let r = 0, s = 0;
  for (const a of n) {
    const o = e[a], l = _j(o), u = Le.drawPopup(
      t,
      o,
      l,
      at,
      at.forceMenus,
      i
    );
    u.height > r && (r = u.height), u.width + o.x > s && (s = u.width + o.x);
  }
  return { maxHeight: r, maxWidth: s };
}, X_ = function(t) {
  Je(at, t), t.fontFamily && (at.actorFontFamily = at.noteFontFamily = at.messageFontFamily = t.fontFamily), t.fontSize && (at.actorFontSize = at.noteFontSize = at.messageFontSize = t.fontSize), t.fontWeight && (at.actorFontWeight = at.noteFontWeight = at.messageFontWeight = t.fontWeight);
}, wh = function(t) {
  return xt.activations.filter(function(e) {
    return e.actor === t;
  });
}, Z2 = function(t, e) {
  const n = e[t], i = wh(t), r = i.reduce(function(a, o) {
    return bt.getMin(a, o.startx);
  }, n.x + n.width / 2 - 1), s = i.reduce(function(a, o) {
    return bt.getMax(a, o.stopx);
  }, n.x + n.width / 2 + 1);
  return [r, s];
};
function Ni(t, e, n, i, r) {
  xt.bumpVerticalPos(n);
  let s = i;
  if (e.id && e.message && t[e.id]) {
    const a = t[e.id].width, o = vs(at);
    e.message = Gt.wrapLabel(`[${e.message}]`, a - 2 * at.wrapPadding, o), e.width = a, e.wrap = !0;
    const l = Gt.calculateTextDimensions(e.message, o), u = bt.getMax(l.height, at.labelBoxHeight);
    s = i + u, z.debug(`${u} - ${e.message}`);
  }
  r(e), xt.bumpVerticalPos(s);
}
function mj(t, e, n, i, r, s, a) {
  function o(u, h) {
    u.x < r[t.from].x ? (xt.insert(
      e.stopx - h,
      e.starty,
      e.startx,
      e.stopy + u.height / 2 + at.noteMargin
    ), e.stopx = e.stopx + h) : (xt.insert(
      e.startx,
      e.starty,
      e.stopx + h,
      e.stopy + u.height / 2 + at.noteMargin
    ), e.stopx = e.stopx - h);
  }
  function l(u, h) {
    u.x < r[t.to].x ? (xt.insert(
      e.startx - h,
      e.starty,
      e.stopx,
      e.stopy + u.height / 2 + at.noteMargin
    ), e.startx = e.startx + h) : (xt.insert(
      e.stopx,
      e.starty,
      e.startx + h,
      e.stopy + u.height / 2 + at.noteMargin
    ), e.startx = e.startx - h);
  }
  if (s[t.to] == i) {
    const u = r[t.to], h = u.type == "actor" ? os / 2 + 3 : u.width / 2 + 3;
    o(u, h), u.starty = n - u.height / 2, xt.bumpVerticalPos(u.height / 2);
  } else if (a[t.from] == i) {
    const u = r[t.from];
    if (at.mirrorActors) {
      const h = u.type == "actor" ? os / 2 : u.width / 2;
      l(u, h);
    }
    u.stopy = n - u.height / 2, xt.bumpVerticalPos(u.height / 2);
  } else if (a[t.to] == i) {
    const u = r[t.to];
    if (at.mirrorActors) {
      const h = u.type == "actor" ? os / 2 + 3 : u.width / 2 + 3;
      o(u, h);
    }
    u.stopy = n - u.height / 2, xt.bumpVerticalPos(u.height / 2);
  }
}
const xj = async function(t, e, n, i) {
  const { securityLevel: r, sequence: s } = Q();
  at = s;
  let a;
  r === "sandbox" && (a = yt("#i" + e));
  const o = yt(r === "sandbox" ? a.nodes()[0].contentDocument.body : "body"), l = r === "sandbox" ? a.nodes()[0].contentDocument : document;
  xt.init(), z.debug(i.db);
  const u = r === "sandbox" ? o.select(`[id="${e}"]`) : yt(`[id="${e}"]`), h = i.db.getActors(), f = i.db.getCreatedActors(), d = i.db.getDestroyedActors(), p = i.db.getBoxes();
  let y = i.db.getActorKeys();
  const m = i.db.getMessages(), _ = i.db.getDiagramTitle(), T = i.db.hasAtLeastOneBox(), v = i.db.hasAtLeastOneBoxWithTitle(), A = await bj(h, m, i);
  if (at.height = await kj(h, A, p), Le.insertComputerIcon(u), Le.insertDatabaseIcon(u), Le.insertClockIcon(u), T && (xt.bumpVerticalPos(at.boxMargin), v && xt.bumpVerticalPos(p[0].textMaxHeight)), at.hideUnusedParticipants === !0) {
    const N = /* @__PURE__ */ new Set();
    m.forEach((D) => {
      N.add(D.from), N.add(D.to);
    }), y = y.filter((D) => N.has(D));
  }
  await yj(u, h, f, y, 0);
  const L = await vj(m, h, A, i);
  Le.insertArrowHead(u), Le.insertArrowCrossHead(u), Le.insertArrowFilledHead(u), Le.insertSequenceNumber(u);
  function w(N, D) {
    const E = xt.endActivation(N);
    E.starty + 18 > D && (E.starty = D - 6, D += 12), Le.drawActivation(
      u,
      E,
      D,
      at,
      wh(N.from.actor).length
    ), xt.insert(E.startx, D - 10, E.stopx, D);
  }
  let b = 1, F = 1;
  const S = [], x = [];
  let C = 0;
  for (const N of m) {
    let D, E, V;
    switch (N.type) {
      case i.db.LINETYPE.NOTE:
        xt.resetVerticalPos(), E = N.noteModel, await fj(u, E);
        break;
      case i.db.LINETYPE.ACTIVE_START:
        xt.newActivation(N, u, h);
        break;
      case i.db.LINETYPE.ACTIVE_END:
        w(N, xt.getVerticalPos());
        break;
      case i.db.LINETYPE.LOOP_START:
        Ni(
          L,
          N,
          at.boxMargin,
          at.boxMargin + at.boxTextMargin,
          (nt) => xt.newLoop(nt)
        );
        break;
      case i.db.LINETYPE.LOOP_END:
        D = xt.endLoop(), await Le.drawLoop(u, D, "loop", at), xt.bumpVerticalPos(D.stopy - xt.getVerticalPos()), xt.models.addLoop(D);
        break;
      case i.db.LINETYPE.RECT_START:
        Ni(
          L,
          N,
          at.boxMargin,
          at.boxMargin,
          (nt) => xt.newLoop(void 0, nt.message)
        );
        break;
      case i.db.LINETYPE.RECT_END:
        D = xt.endLoop(), x.push(D), xt.models.addLoop(D), xt.bumpVerticalPos(D.stopy - xt.getVerticalPos());
        break;
      case i.db.LINETYPE.OPT_START:
        Ni(
          L,
          N,
          at.boxMargin,
          at.boxMargin + at.boxTextMargin,
          (nt) => xt.newLoop(nt)
        );
        break;
      case i.db.LINETYPE.OPT_END:
        D = xt.endLoop(), await Le.drawLoop(u, D, "opt", at), xt.bumpVerticalPos(D.stopy - xt.getVerticalPos()), xt.models.addLoop(D);
        break;
      case i.db.LINETYPE.ALT_START:
        Ni(
          L,
          N,
          at.boxMargin,
          at.boxMargin + at.boxTextMargin,
          (nt) => xt.newLoop(nt)
        );
        break;
      case i.db.LINETYPE.ALT_ELSE:
        Ni(
          L,
          N,
          at.boxMargin + at.boxTextMargin,
          at.boxMargin,
          (nt) => xt.addSectionToLoop(nt)
        );
        break;
      case i.db.LINETYPE.ALT_END:
        D = xt.endLoop(), await Le.drawLoop(u, D, "alt", at), xt.bumpVerticalPos(D.stopy - xt.getVerticalPos()), xt.models.addLoop(D);
        break;
      case i.db.LINETYPE.PAR_START:
      case i.db.LINETYPE.PAR_OVER_START:
        Ni(
          L,
          N,
          at.boxMargin,
          at.boxMargin + at.boxTextMargin,
          (nt) => xt.newLoop(nt)
        ), xt.saveVerticalPos();
        break;
      case i.db.LINETYPE.PAR_AND:
        Ni(
          L,
          N,
          at.boxMargin + at.boxTextMargin,
          at.boxMargin,
          (nt) => xt.addSectionToLoop(nt)
        );
        break;
      case i.db.LINETYPE.PAR_END:
        D = xt.endLoop(), await Le.drawLoop(u, D, "par", at), xt.bumpVerticalPos(D.stopy - xt.getVerticalPos()), xt.models.addLoop(D);
        break;
      case i.db.LINETYPE.AUTONUMBER:
        b = N.message.start || b, F = N.message.step || F, N.message.visible ? i.db.enableSequenceNumbers() : i.db.disableSequenceNumbers();
        break;
      case i.db.LINETYPE.CRITICAL_START:
        Ni(
          L,
          N,
          at.boxMargin,
          at.boxMargin + at.boxTextMargin,
          (nt) => xt.newLoop(nt)
        );
        break;
      case i.db.LINETYPE.CRITICAL_OPTION:
        Ni(
          L,
          N,
          at.boxMargin + at.boxTextMargin,
          at.boxMargin,
          (nt) => xt.addSectionToLoop(nt)
        );
        break;
      case i.db.LINETYPE.CRITICAL_END:
        D = xt.endLoop(), await Le.drawLoop(u, D, "critical", at), xt.bumpVerticalPos(D.stopy - xt.getVerticalPos()), xt.models.addLoop(D);
        break;
      case i.db.LINETYPE.BREAK_START:
        Ni(
          L,
          N,
          at.boxMargin,
          at.boxMargin + at.boxTextMargin,
          (nt) => xt.newLoop(nt)
        );
        break;
      case i.db.LINETYPE.BREAK_END:
        D = xt.endLoop(), await Le.drawLoop(u, D, "break", at), xt.bumpVerticalPos(D.stopy - xt.getVerticalPos()), xt.models.addLoop(D);
        break;
      default:
        try {
          V = N.msgModel, V.starty = xt.getVerticalPos(), V.sequenceIndex = b, V.sequenceVisible = i.db.showSequenceNumbers();
          const nt = await pj(u, V);
          mj(
            N,
            V,
            nt,
            C,
            h,
            f,
            d
          ), S.push({ messageModel: V, lineStartY: nt }), xt.models.addMessage(V);
        } catch (nt) {
          z.error("error while drawing message", nt);
        }
    }
    [
      i.db.LINETYPE.SOLID_OPEN,
      i.db.LINETYPE.DOTTED_OPEN,
      i.db.LINETYPE.SOLID,
      i.db.LINETYPE.DOTTED,
      i.db.LINETYPE.SOLID_CROSS,
      i.db.LINETYPE.DOTTED_CROSS,
      i.db.LINETYPE.SOLID_POINT,
      i.db.LINETYPE.DOTTED_POINT
    ].includes(N.type) && (b = b + F), C++;
  }
  z.debug("createdActors", f), z.debug("destroyedActors", d), await M1(u, h, y, !1);
  for (const N of S)
    await gj(u, N.messageModel, N.lineStartY, i);
  at.mirrorActors && await M1(u, h, y, !0), x.forEach((N) => Le.drawBackgroundRect(u, N)), U_(u, h, y, at);
  for (const N of xt.models.boxes)
    N.height = xt.getVerticalPos() - N.y, xt.insert(N.x, N.y, N.x + N.width, N.height), N.startx = N.x, N.starty = N.y, N.stopx = N.startx + N.width, N.stopy = N.starty + N.height, N.stroke = "rgb(0,0,0, 0.5)", await Le.drawBox(u, N, at);
  T && xt.bumpVerticalPos(at.boxMargin);
  const g = j_(u, h, y, l), { bounds: I } = xt.getBounds();
  let k = I.stopy - I.starty;
  k < g.maxHeight && (k = g.maxHeight);
  let P = k + 2 * at.diagramMarginY;
  at.mirrorActors && (P = P - at.boxMargin + at.bottomMarginAdj);
  let R = I.stopx - I.startx;
  R < g.maxWidth && (R = g.maxWidth);
  const M = R + 2 * at.diagramMarginX;
  _ && u.append("text").text(_).attr("x", (I.stopx - I.startx) / 2 - 2 * at.diagramMarginX).attr("y", -25), dn(u, P, M, at.useMaxWidth);
  const B = _ ? 40 : 0;
  u.attr(
    "viewBox",
    I.startx - at.diagramMarginX + " -" + (at.diagramMarginY + B) + " " + M + " " + (P + B)
  ), z.debug("models:", xt.models);
};
async function bj(t, e, n) {
  const i = {};
  for (const r of e)
    if (t[r.to] && t[r.from]) {
      const s = t[r.to];
      if (r.placement === n.db.PLACEMENT.LEFTOF && !s.prevActor || r.placement === n.db.PLACEMENT.RIGHTOF && !s.nextActor)
        continue;
      const a = r.placement !== void 0, o = !a, l = a ? Gs(at) : vs(at), u = r.wrap ? Gt.wrapLabel(r.message, at.width - 2 * at.wrapPadding, l) : r.message, f = (hi(u) ? await vl(r.message, Q()) : Gt.calculateTextDimensions(u, l)).width + 2 * at.wrapPadding;
      o && r.from === s.nextActor ? i[r.to] = bt.getMax(
        i[r.to] || 0,
        f
      ) : o && r.from === s.prevActor ? i[r.from] = bt.getMax(
        i[r.from] || 0,
        f
      ) : o && r.from === r.to ? (i[r.from] = bt.getMax(
        i[r.from] || 0,
        f / 2
      ), i[r.to] = bt.getMax(
        i[r.to] || 0,
        f / 2
      )) : r.placement === n.db.PLACEMENT.RIGHTOF ? i[r.from] = bt.getMax(
        i[r.from] || 0,
        f
      ) : r.placement === n.db.PLACEMENT.LEFTOF ? i[s.prevActor] = bt.getMax(
        i[s.prevActor] || 0,
        f
      ) : r.placement === n.db.PLACEMENT.OVER && (s.prevActor && (i[s.prevActor] = bt.getMax(
        i[s.prevActor] || 0,
        f / 2
      )), s.nextActor && (i[r.from] = bt.getMax(
        i[r.from] || 0,
        f / 2
      )));
    }
  return z.debug("maxMessageWidthPerActor:", i), i;
}
const _j = function(t) {
  let e = 0;
  const n = R1(at);
  for (const i in t.links) {
    const s = Gt.calculateTextDimensions(i, n).width + 2 * at.wrapPadding + 2 * at.boxMargin;
    e < s && (e = s);
  }
  return e;
};
async function kj(t, e, n) {
  let i = 0;
  for (const s of Object.keys(t)) {
    const a = t[s];
    a.wrap && (a.description = Gt.wrapLabel(
      a.description,
      at.width - 2 * at.wrapPadding,
      R1(at)
    ));
    const o = hi(a.description) ? await vl(a.description, Q()) : Gt.calculateTextDimensions(a.description, R1(at));
    a.width = a.wrap ? at.width : bt.getMax(at.width, o.width + 2 * at.wrapPadding), a.height = a.wrap ? bt.getMax(o.height, at.height) : at.height, i = bt.getMax(i, a.height);
  }
  for (const s in e) {
    const a = t[s];
    if (!a)
      continue;
    const o = t[a.nextActor];
    if (!o) {
      const f = e[s] + at.actorMargin - a.width / 2;
      a.margin = bt.getMax(f, at.actorMargin);
      continue;
    }
    const u = e[s] + at.actorMargin - a.width / 2 - o.width / 2;
    a.margin = bt.getMax(u, at.actorMargin);
  }
  let r = 0;
  return n.forEach((s) => {
    const a = vs(at);
    let o = s.actorKeys.reduce((h, f) => h += t[f].width + (t[f].margin || 0), 0);
    o -= 2 * at.boxTextMargin, s.wrap && (s.name = Gt.wrapLabel(s.name, o - 2 * at.wrapPadding, a));
    const l = Gt.calculateTextDimensions(s.name, a);
    r = bt.getMax(l.height, r);
    const u = bt.getMax(o, l.width + 2 * at.wrapPadding);
    if (s.margin = at.boxTextMargin, o < u) {
      const h = (u - o) / 2;
      s.margin += h;
    }
  }), n.forEach((s) => s.textMaxHeight = r), bt.getMax(i, at.height);
}
const Tj = async function(t, e, n) {
  const i = e[t.from].x, r = e[t.to].x, s = t.wrap && t.message;
  let a = hi(t.message) ? await vl(t.message, Q()) : Gt.calculateTextDimensions(
    s ? Gt.wrapLabel(t.message, at.width, Gs(at)) : t.message,
    Gs(at)
  );
  const o = {
    width: s ? at.width : bt.getMax(at.width, a.width + 2 * at.noteMargin),
    height: 0,
    startx: e[t.from].x,
    stopx: 0,
    starty: 0,
    stopy: 0,
    message: t.message
  };
  return t.placement === n.db.PLACEMENT.RIGHTOF ? (o.width = s ? bt.getMax(at.width, a.width) : bt.getMax(
    e[t.from].width / 2 + e[t.to].width / 2,
    a.width + 2 * at.noteMargin
  ), o.startx = i + (e[t.from].width + at.actorMargin) / 2) : t.placement === n.db.PLACEMENT.LEFTOF ? (o.width = s ? bt.getMax(at.width, a.width + 2 * at.noteMargin) : bt.getMax(
    e[t.from].width / 2 + e[t.to].width / 2,
    a.width + 2 * at.noteMargin
  ), o.startx = i - o.width + (e[t.from].width - at.actorMargin) / 2) : t.to === t.from ? (a = Gt.calculateTextDimensions(
    s ? Gt.wrapLabel(
      t.message,
      bt.getMax(at.width, e[t.from].width),
      Gs(at)
    ) : t.message,
    Gs(at)
  ), o.width = s ? bt.getMax(at.width, e[t.from].width) : bt.getMax(
    e[t.from].width,
    at.width,
    a.width + 2 * at.noteMargin
  ), o.startx = i + (e[t.from].width - o.width) / 2) : (o.width = Math.abs(i + e[t.from].width / 2 - (r + e[t.to].width / 2)) + at.actorMargin, o.startx = i < r ? i + e[t.from].width / 2 - at.actorMargin / 2 : r + e[t.to].width / 2 - at.actorMargin / 2), s && (o.message = Gt.wrapLabel(
    t.message,
    o.width - 2 * at.wrapPadding,
    Gs(at)
  )), z.debug(
    `NM:[${o.startx},${o.stopx},${o.starty},${o.stopy}:${o.width},${o.height}=${t.message}]`
  ), o;
}, wj = function(t, e, n) {
  if (![
    n.db.LINETYPE.SOLID_OPEN,
    n.db.LINETYPE.DOTTED_OPEN,
    n.db.LINETYPE.SOLID,
    n.db.LINETYPE.DOTTED,
    n.db.LINETYPE.SOLID_CROSS,
    n.db.LINETYPE.DOTTED_CROSS,
    n.db.LINETYPE.SOLID_POINT,
    n.db.LINETYPE.DOTTED_POINT
  ].includes(t.type))
    return {};
  const [i, r] = Z2(t.from, e), [s, a] = Z2(t.to, e), o = i <= s, l = o ? r : i;
  let u = o ? s : a;
  const h = Math.abs(s - a) > 2, f = (m) => o ? -m : m;
  t.from === t.to ? u = l : (t.activate && !h && (u += f(at.activationWidth / 2 - 1)), [n.db.LINETYPE.SOLID_OPEN, n.db.LINETYPE.DOTTED_OPEN].includes(t.type) || (u += f(3)));
  const d = [i, r, s, a], p = Math.abs(l - u);
  t.wrap && t.message && (t.message = Gt.wrapLabel(
    t.message,
    bt.getMax(p + 2 * at.wrapPadding, at.width),
    vs(at)
  ));
  const y = Gt.calculateTextDimensions(t.message, vs(at));
  return {
    width: bt.getMax(
      t.wrap ? 0 : y.width + 2 * at.wrapPadding,
      p + 2 * at.wrapPadding,
      at.width
    ),
    height: 0,
    startx: l,
    stopx: u,
    starty: 0,
    stopy: 0,
    message: t.message,
    type: t.type,
    wrap: t.wrap,
    fromBounds: Math.min.apply(null, d),
    toBounds: Math.max.apply(null, d)
  };
}, vj = async function(t, e, n, i) {
  const r = {}, s = [];
  let a, o, l;
  for (const u of t) {
    switch (u.id = Gt.random({ length: 10 }), u.type) {
      case i.db.LINETYPE.LOOP_START:
      case i.db.LINETYPE.ALT_START:
      case i.db.LINETYPE.OPT_START:
      case i.db.LINETYPE.PAR_START:
      case i.db.LINETYPE.PAR_OVER_START:
      case i.db.LINETYPE.CRITICAL_START:
      case i.db.LINETYPE.BREAK_START:
        s.push({
          id: u.id,
          msg: u.message,
          from: Number.MAX_SAFE_INTEGER,
          to: Number.MIN_SAFE_INTEGER,
          width: 0
        });
        break;
      case i.db.LINETYPE.ALT_ELSE:
      case i.db.LINETYPE.PAR_AND:
      case i.db.LINETYPE.CRITICAL_OPTION:
        u.message && (a = s.pop(), r[a.id] = a, r[u.id] = a, s.push(a));
        break;
      case i.db.LINETYPE.LOOP_END:
      case i.db.LINETYPE.ALT_END:
      case i.db.LINETYPE.OPT_END:
      case i.db.LINETYPE.PAR_END:
      case i.db.LINETYPE.CRITICAL_END:
      case i.db.LINETYPE.BREAK_END:
        a = s.pop(), r[a.id] = a;
        break;
      case i.db.LINETYPE.ACTIVE_START:
        {
          const f = e[u.from ? u.from.actor : u.to.actor], d = wh(u.from ? u.from.actor : u.to.actor).length, p = f.x + f.width / 2 + (d - 1) * at.activationWidth / 2, y = {
            startx: p,
            stopx: p + at.activationWidth,
            actor: u.from.actor,
            enabled: !0
          };
          xt.activations.push(y);
        }
        break;
      case i.db.LINETYPE.ACTIVE_END:
        {
          const f = xt.activations.map((d) => d.actor).lastIndexOf(u.from.actor);
          delete xt.activations.splice(f, 1)[0];
        }
        break;
    }
    u.placement !== void 0 ? (o = await Tj(u, e, i), u.noteModel = o, s.forEach((f) => {
      a = f, a.from = bt.getMin(a.from, o.startx), a.to = bt.getMax(a.to, o.startx + o.width), a.width = bt.getMax(a.width, Math.abs(a.from - a.to)) - at.labelBoxWidth;
    })) : (l = wj(u, e, i), u.msgModel = l, l.startx && l.stopx && s.length > 0 && s.forEach((f) => {
      if (a = f, l.startx === l.stopx) {
        const d = e[u.from], p = e[u.to];
        a.from = bt.getMin(
          d.x - l.width / 2,
          d.x - d.width / 2,
          a.from
        ), a.to = bt.getMax(
          p.x + l.width / 2,
          p.x + d.width / 2,
          a.to
        ), a.width = bt.getMax(a.width, Math.abs(a.to - a.from)) - at.labelBoxWidth;
      } else
        a.from = bt.getMin(l.startx, a.from), a.to = bt.getMax(l.stopx, a.to), a.width = bt.getMax(a.width, l.width) - at.labelBoxWidth;
    }));
  }
  return xt.activations = [], z.debug("Loop type widths:", r), r;
}, Ej = {
  bounds: xt,
  drawActors: M1,
  drawActorsPopup: j_,
  setConf: X_,
  draw: xj
}, Cj = {
  parser: TG,
  db: Q2,
  renderer: Ej,
  styles: jG,
  init: ({ wrap: t }) => {
    Q2.setWrap(t);
  }
}, Sj = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: Cj
}, Symbol.toStringTag, { value: "Module" }));
var P1 = (function() {
  var t = function(te, mt, pt, dt) {
    for (pt = pt || {}, dt = te.length; dt--; pt[te[dt]] = mt)
      ;
    return pt;
  }, e = [1, 17], n = [1, 18], i = [1, 19], r = [1, 39], s = [1, 40], a = [1, 25], o = [1, 23], l = [1, 24], u = [1, 31], h = [1, 32], f = [1, 33], d = [1, 34], p = [1, 35], y = [1, 36], m = [1, 26], _ = [1, 27], T = [1, 28], v = [1, 29], A = [1, 43], L = [1, 30], w = [1, 42], b = [1, 44], F = [1, 41], S = [1, 45], x = [1, 9], C = [1, 8, 9], g = [1, 56], I = [1, 57], k = [1, 58], P = [1, 59], R = [1, 60], M = [1, 61], B = [1, 62], N = [1, 8, 9, 39], D = [1, 74], E = [1, 8, 9, 12, 13, 21, 37, 39, 42, 59, 60, 61, 62, 63, 64, 65, 70, 72], V = [1, 8, 9, 12, 13, 19, 21, 37, 39, 42, 46, 59, 60, 61, 62, 63, 64, 65, 70, 72, 74, 80, 95, 97, 98], nt = [13, 74, 80, 95, 97, 98], O = [13, 64, 65, 74, 80, 95, 97, 98], ct = [13, 59, 60, 61, 62, 63, 74, 80, 95, 97, 98], X = [1, 93], H = [1, 110], it = [1, 108], ot = [1, 102], W = [1, 103], Z = [1, 104], q = [1, 105], G = [1, 106], U = [1, 107], ht = [1, 109], Y = [1, 8, 9, 37, 39, 42], wt = [1, 8, 9, 21], J = [1, 8, 9, 78], Ct = [1, 8, 9, 21, 73, 74, 78, 80, 81, 82, 83, 84, 85], Tt = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, mermaidDoc: 4, statements: 5, graphConfig: 6, CLASS_DIAGRAM: 7, NEWLINE: 8, EOF: 9, statement: 10, classLabel: 11, SQS: 12, STR: 13, SQE: 14, namespaceName: 15, alphaNumToken: 16, className: 17, classLiteralName: 18, GENERICTYPE: 19, relationStatement: 20, LABEL: 21, namespaceStatement: 22, classStatement: 23, memberStatement: 24, annotationStatement: 25, clickStatement: 26, styleStatement: 27, cssClassStatement: 28, noteStatement: 29, direction: 30, acc_title: 31, acc_title_value: 32, acc_descr: 33, acc_descr_value: 34, acc_descr_multiline_value: 35, namespaceIdentifier: 36, STRUCT_START: 37, classStatements: 38, STRUCT_STOP: 39, NAMESPACE: 40, classIdentifier: 41, STYLE_SEPARATOR: 42, members: 43, CLASS: 44, ANNOTATION_START: 45, ANNOTATION_END: 46, MEMBER: 47, SEPARATOR: 48, relation: 49, NOTE_FOR: 50, noteText: 51, NOTE: 52, direction_tb: 53, direction_bt: 54, direction_rl: 55, direction_lr: 56, relationType: 57, lineType: 58, AGGREGATION: 59, EXTENSION: 60, COMPOSITION: 61, DEPENDENCY: 62, LOLLIPOP: 63, LINE: 64, DOTTED_LINE: 65, CALLBACK: 66, LINK: 67, LINK_TARGET: 68, CLICK: 69, CALLBACK_NAME: 70, CALLBACK_ARGS: 71, HREF: 72, STYLE: 73, ALPHA: 74, stylesOpt: 75, CSSCLASS: 76, style: 77, COMMA: 78, styleComponent: 79, NUM: 80, COLON: 81, UNIT: 82, SPACE: 83, BRKT: 84, PCT: 85, commentToken: 86, textToken: 87, graphCodeTokens: 88, textNoTagsToken: 89, TAGSTART: 90, TAGEND: 91, "==": 92, "--": 93, DEFAULT: 94, MINUS: 95, keywords: 96, UNICODE_TEXT: 97, BQUOTE_STR: 98, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 7: "CLASS_DIAGRAM", 8: "NEWLINE", 9: "EOF", 12: "SQS", 13: "STR", 14: "SQE", 19: "GENERICTYPE", 21: "LABEL", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 37: "STRUCT_START", 39: "STRUCT_STOP", 40: "NAMESPACE", 42: "STYLE_SEPARATOR", 44: "CLASS", 45: "ANNOTATION_START", 46: "ANNOTATION_END", 47: "MEMBER", 48: "SEPARATOR", 50: "NOTE_FOR", 52: "NOTE", 53: "direction_tb", 54: "direction_bt", 55: "direction_rl", 56: "direction_lr", 59: "AGGREGATION", 60: "EXTENSION", 61: "COMPOSITION", 62: "DEPENDENCY", 63: "LOLLIPOP", 64: "LINE", 65: "DOTTED_LINE", 66: "CALLBACK", 67: "LINK", 68: "LINK_TARGET", 69: "CLICK", 70: "CALLBACK_NAME", 71: "CALLBACK_ARGS", 72: "HREF", 73: "STYLE", 74: "ALPHA", 76: "CSSCLASS", 78: "COMMA", 80: "NUM", 81: "COLON", 82: "UNIT", 83: "SPACE", 84: "BRKT", 85: "PCT", 88: "graphCodeTokens", 90: "TAGSTART", 91: "TAGEND", 92: "==", 93: "--", 94: "DEFAULT", 95: "MINUS", 96: "keywords", 97: "UNICODE_TEXT", 98: "BQUOTE_STR" },
    productions_: [0, [3, 1], [3, 1], [4, 1], [6, 4], [5, 1], [5, 2], [5, 3], [11, 3], [15, 1], [15, 2], [17, 1], [17, 1], [17, 2], [17, 2], [17, 2], [10, 1], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [10, 1], [22, 4], [22, 5], [36, 2], [38, 1], [38, 2], [38, 3], [23, 1], [23, 3], [23, 4], [23, 6], [41, 2], [41, 3], [25, 4], [43, 1], [43, 2], [24, 1], [24, 2], [24, 1], [24, 1], [20, 3], [20, 4], [20, 4], [20, 5], [29, 3], [29, 2], [30, 1], [30, 1], [30, 1], [30, 1], [49, 3], [49, 2], [49, 2], [49, 1], [57, 1], [57, 1], [57, 1], [57, 1], [57, 1], [58, 1], [58, 1], [26, 3], [26, 4], [26, 3], [26, 4], [26, 4], [26, 5], [26, 3], [26, 4], [26, 4], [26, 5], [26, 4], [26, 5], [26, 5], [26, 6], [27, 3], [28, 3], [75, 1], [75, 3], [77, 1], [77, 2], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [79, 1], [86, 1], [86, 1], [87, 1], [87, 1], [87, 1], [87, 1], [87, 1], [87, 1], [87, 1], [89, 1], [89, 1], [89, 1], [89, 1], [16, 1], [16, 1], [16, 1], [16, 1], [18, 1], [51, 1]],
    performAction: function(mt, pt, dt, ft, j, $, et) {
      var rt = $.length - 1;
      switch (j) {
        case 8:
          this.$ = $[rt - 1];
          break;
        case 9:
        case 11:
        case 12:
          this.$ = $[rt];
          break;
        case 10:
        case 13:
          this.$ = $[rt - 1] + $[rt];
          break;
        case 14:
        case 15:
          this.$ = $[rt - 1] + "~" + $[rt] + "~";
          break;
        case 16:
          ft.addRelation($[rt]);
          break;
        case 17:
          $[rt - 1].title = ft.cleanupLabel($[rt]), ft.addRelation($[rt - 1]);
          break;
        case 27:
          this.$ = $[rt].trim(), ft.setAccTitle(this.$);
          break;
        case 28:
        case 29:
          this.$ = $[rt].trim(), ft.setAccDescription(this.$);
          break;
        case 30:
          ft.addClassesToNamespace($[rt - 3], $[rt - 1]);
          break;
        case 31:
          ft.addClassesToNamespace($[rt - 4], $[rt - 1]);
          break;
        case 32:
          this.$ = $[rt], ft.addNamespace($[rt]);
          break;
        case 33:
          this.$ = [$[rt]];
          break;
        case 34:
          this.$ = [$[rt - 1]];
          break;
        case 35:
          $[rt].unshift($[rt - 2]), this.$ = $[rt];
          break;
        case 37:
          ft.setCssClass($[rt - 2], $[rt]);
          break;
        case 38:
          ft.addMembers($[rt - 3], $[rt - 1]);
          break;
        case 39:
          ft.setCssClass($[rt - 5], $[rt - 3]), ft.addMembers($[rt - 5], $[rt - 1]);
          break;
        case 40:
          this.$ = $[rt], ft.addClass($[rt]);
          break;
        case 41:
          this.$ = $[rt - 1], ft.addClass($[rt - 1]), ft.setClassLabel($[rt - 1], $[rt]);
          break;
        case 42:
          ft.addAnnotation($[rt], $[rt - 2]);
          break;
        case 43:
          this.$ = [$[rt]];
          break;
        case 44:
          $[rt].push($[rt - 1]), this.$ = $[rt];
          break;
        case 45:
          break;
        case 46:
          ft.addMember($[rt - 1], ft.cleanupLabel($[rt]));
          break;
        case 47:
          break;
        case 48:
          break;
        case 49:
          this.$ = { id1: $[rt - 2], id2: $[rt], relation: $[rt - 1], relationTitle1: "none", relationTitle2: "none" };
          break;
        case 50:
          this.$ = { id1: $[rt - 3], id2: $[rt], relation: $[rt - 1], relationTitle1: $[rt - 2], relationTitle2: "none" };
          break;
        case 51:
          this.$ = { id1: $[rt - 3], id2: $[rt], relation: $[rt - 2], relationTitle1: "none", relationTitle2: $[rt - 1] };
          break;
        case 52:
          this.$ = { id1: $[rt - 4], id2: $[rt], relation: $[rt - 2], relationTitle1: $[rt - 3], relationTitle2: $[rt - 1] };
          break;
        case 53:
          ft.addNote($[rt], $[rt - 1]);
          break;
        case 54:
          ft.addNote($[rt]);
          break;
        case 55:
          ft.setDirection("TB");
          break;
        case 56:
          ft.setDirection("BT");
          break;
        case 57:
          ft.setDirection("RL");
          break;
        case 58:
          ft.setDirection("LR");
          break;
        case 59:
          this.$ = { type1: $[rt - 2], type2: $[rt], lineType: $[rt - 1] };
          break;
        case 60:
          this.$ = { type1: "none", type2: $[rt], lineType: $[rt - 1] };
          break;
        case 61:
          this.$ = { type1: $[rt - 1], type2: "none", lineType: $[rt] };
          break;
        case 62:
          this.$ = { type1: "none", type2: "none", lineType: $[rt] };
          break;
        case 63:
          this.$ = ft.relationType.AGGREGATION;
          break;
        case 64:
          this.$ = ft.relationType.EXTENSION;
          break;
        case 65:
          this.$ = ft.relationType.COMPOSITION;
          break;
        case 66:
          this.$ = ft.relationType.DEPENDENCY;
          break;
        case 67:
          this.$ = ft.relationType.LOLLIPOP;
          break;
        case 68:
          this.$ = ft.lineType.LINE;
          break;
        case 69:
          this.$ = ft.lineType.DOTTED_LINE;
          break;
        case 70:
        case 76:
          this.$ = $[rt - 2], ft.setClickEvent($[rt - 1], $[rt]);
          break;
        case 71:
        case 77:
          this.$ = $[rt - 3], ft.setClickEvent($[rt - 2], $[rt - 1]), ft.setTooltip($[rt - 2], $[rt]);
          break;
        case 72:
          this.$ = $[rt - 2], ft.setLink($[rt - 1], $[rt]);
          break;
        case 73:
          this.$ = $[rt - 3], ft.setLink($[rt - 2], $[rt - 1], $[rt]);
          break;
        case 74:
          this.$ = $[rt - 3], ft.setLink($[rt - 2], $[rt - 1]), ft.setTooltip($[rt - 2], $[rt]);
          break;
        case 75:
          this.$ = $[rt - 4], ft.setLink($[rt - 3], $[rt - 2], $[rt]), ft.setTooltip($[rt - 3], $[rt - 1]);
          break;
        case 78:
          this.$ = $[rt - 3], ft.setClickEvent($[rt - 2], $[rt - 1], $[rt]);
          break;
        case 79:
          this.$ = $[rt - 4], ft.setClickEvent($[rt - 3], $[rt - 2], $[rt - 1]), ft.setTooltip($[rt - 3], $[rt]);
          break;
        case 80:
          this.$ = $[rt - 3], ft.setLink($[rt - 2], $[rt]);
          break;
        case 81:
          this.$ = $[rt - 4], ft.setLink($[rt - 3], $[rt - 1], $[rt]);
          break;
        case 82:
          this.$ = $[rt - 4], ft.setLink($[rt - 3], $[rt - 1]), ft.setTooltip($[rt - 3], $[rt]);
          break;
        case 83:
          this.$ = $[rt - 5], ft.setLink($[rt - 4], $[rt - 2], $[rt]), ft.setTooltip($[rt - 4], $[rt - 1]);
          break;
        case 84:
          this.$ = $[rt - 2], ft.setCssStyle($[rt - 1], $[rt]);
          break;
        case 85:
          ft.setCssClass($[rt - 1], $[rt]);
          break;
        case 86:
          this.$ = [$[rt]];
          break;
        case 87:
          $[rt - 2].push($[rt]), this.$ = $[rt - 2];
          break;
        case 89:
          this.$ = $[rt - 1] + $[rt];
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: [1, 6], 10: 5, 16: 37, 17: 20, 18: 38, 20: 7, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 27: 13, 28: 14, 29: 15, 30: 16, 31: e, 33: n, 35: i, 36: 21, 40: r, 41: 22, 44: s, 45: a, 47: o, 48: l, 50: u, 52: h, 53: f, 54: d, 55: p, 56: y, 66: m, 67: _, 69: T, 73: v, 74: A, 76: L, 80: w, 95: b, 97: F, 98: S }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3] }, t(x, [2, 5], { 8: [1, 46] }), { 8: [1, 47] }, t(C, [2, 16], { 21: [1, 48] }), t(C, [2, 18]), t(C, [2, 19]), t(C, [2, 20]), t(C, [2, 21]), t(C, [2, 22]), t(C, [2, 23]), t(C, [2, 24]), t(C, [2, 25]), t(C, [2, 26]), { 32: [1, 49] }, { 34: [1, 50] }, t(C, [2, 29]), t(C, [2, 45], { 49: 51, 57: 54, 58: 55, 13: [1, 52], 21: [1, 53], 59: g, 60: I, 61: k, 62: P, 63: R, 64: M, 65: B }), { 37: [1, 63] }, t(N, [2, 36], { 37: [1, 65], 42: [1, 64] }), t(C, [2, 47]), t(C, [2, 48]), { 16: 66, 74: A, 80: w, 95: b, 97: F }, { 16: 37, 17: 67, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, { 16: 37, 17: 68, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, { 16: 37, 17: 69, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, { 74: [1, 70] }, { 13: [1, 71] }, { 16: 37, 17: 72, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, { 13: D, 51: 73 }, t(C, [2, 55]), t(C, [2, 56]), t(C, [2, 57]), t(C, [2, 58]), t(E, [2, 11], { 16: 37, 18: 38, 17: 75, 19: [1, 76], 74: A, 80: w, 95: b, 97: F, 98: S }), t(E, [2, 12], { 19: [1, 77] }), { 15: 78, 16: 79, 74: A, 80: w, 95: b, 97: F }, { 16: 37, 17: 80, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, t(V, [2, 112]), t(V, [2, 113]), t(V, [2, 114]), t(V, [2, 115]), t([1, 8, 9, 12, 13, 19, 21, 37, 39, 42, 59, 60, 61, 62, 63, 64, 65, 70, 72], [2, 116]), t(x, [2, 6], { 10: 5, 20: 7, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 27: 13, 28: 14, 29: 15, 30: 16, 17: 20, 36: 21, 41: 22, 16: 37, 18: 38, 5: 81, 31: e, 33: n, 35: i, 40: r, 44: s, 45: a, 47: o, 48: l, 50: u, 52: h, 53: f, 54: d, 55: p, 56: y, 66: m, 67: _, 69: T, 73: v, 74: A, 76: L, 80: w, 95: b, 97: F, 98: S }), { 5: 82, 10: 5, 16: 37, 17: 20, 18: 38, 20: 7, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 27: 13, 28: 14, 29: 15, 30: 16, 31: e, 33: n, 35: i, 36: 21, 40: r, 41: 22, 44: s, 45: a, 47: o, 48: l, 50: u, 52: h, 53: f, 54: d, 55: p, 56: y, 66: m, 67: _, 69: T, 73: v, 74: A, 76: L, 80: w, 95: b, 97: F, 98: S }, t(C, [2, 17]), t(C, [2, 27]), t(C, [2, 28]), { 13: [1, 84], 16: 37, 17: 83, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, { 49: 85, 57: 54, 58: 55, 59: g, 60: I, 61: k, 62: P, 63: R, 64: M, 65: B }, t(C, [2, 46]), { 58: 86, 64: M, 65: B }, t(nt, [2, 62], { 57: 87, 59: g, 60: I, 61: k, 62: P, 63: R }), t(O, [2, 63]), t(O, [2, 64]), t(O, [2, 65]), t(O, [2, 66]), t(O, [2, 67]), t(ct, [2, 68]), t(ct, [2, 69]), { 8: [1, 89], 23: 90, 38: 88, 41: 22, 44: s }, { 16: 91, 74: A, 80: w, 95: b, 97: F }, { 43: 92, 47: X }, { 46: [1, 94] }, { 13: [1, 95] }, { 13: [1, 96] }, { 70: [1, 97], 72: [1, 98] }, { 21: H, 73: it, 74: ot, 75: 99, 77: 100, 79: 101, 80: W, 81: Z, 82: q, 83: G, 84: U, 85: ht }, { 74: [1, 111] }, { 13: D, 51: 112 }, t(C, [2, 54]), t(C, [2, 117]), t(E, [2, 13]), t(E, [2, 14]), t(E, [2, 15]), { 37: [2, 32] }, { 15: 113, 16: 79, 37: [2, 9], 74: A, 80: w, 95: b, 97: F }, t(Y, [2, 40], { 11: 114, 12: [1, 115] }), t(x, [2, 7]), { 9: [1, 116] }, t(wt, [2, 49]), { 16: 37, 17: 117, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, { 13: [1, 119], 16: 37, 17: 118, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, t(nt, [2, 61], { 57: 120, 59: g, 60: I, 61: k, 62: P, 63: R }), t(nt, [2, 60]), { 39: [1, 121] }, { 23: 90, 38: 122, 41: 22, 44: s }, { 8: [1, 123], 39: [2, 33] }, t(N, [2, 37], { 37: [1, 124] }), { 39: [1, 125] }, { 39: [2, 43], 43: 126, 47: X }, { 16: 37, 17: 127, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, t(C, [2, 70], { 13: [1, 128] }), t(C, [2, 72], { 13: [1, 130], 68: [1, 129] }), t(C, [2, 76], { 13: [1, 131], 71: [1, 132] }), { 13: [1, 133] }, t(C, [2, 84], { 78: [1, 134] }), t(J, [2, 86], { 79: 135, 21: H, 73: it, 74: ot, 80: W, 81: Z, 82: q, 83: G, 84: U, 85: ht }), t(Ct, [2, 88]), t(Ct, [2, 90]), t(Ct, [2, 91]), t(Ct, [2, 92]), t(Ct, [2, 93]), t(Ct, [2, 94]), t(Ct, [2, 95]), t(Ct, [2, 96]), t(Ct, [2, 97]), t(Ct, [2, 98]), t(C, [2, 85]), t(C, [2, 53]), { 37: [2, 10] }, t(Y, [2, 41]), { 13: [1, 136] }, { 1: [2, 4] }, t(wt, [2, 51]), t(wt, [2, 50]), { 16: 37, 17: 137, 18: 38, 74: A, 80: w, 95: b, 97: F, 98: S }, t(nt, [2, 59]), t(C, [2, 30]), { 39: [1, 138] }, { 23: 90, 38: 139, 39: [2, 34], 41: 22, 44: s }, { 43: 140, 47: X }, t(N, [2, 38]), { 39: [2, 44] }, t(C, [2, 42]), t(C, [2, 71]), t(C, [2, 73]), t(C, [2, 74], { 68: [1, 141] }), t(C, [2, 77]), t(C, [2, 78], { 13: [1, 142] }), t(C, [2, 80], { 13: [1, 144], 68: [1, 143] }), { 21: H, 73: it, 74: ot, 77: 145, 79: 101, 80: W, 81: Z, 82: q, 83: G, 84: U, 85: ht }, t(Ct, [2, 89]), { 14: [1, 146] }, t(wt, [2, 52]), t(C, [2, 31]), { 39: [2, 35] }, { 39: [1, 147] }, t(C, [2, 75]), t(C, [2, 79]), t(C, [2, 81]), t(C, [2, 82], { 68: [1, 148] }), t(J, [2, 87], { 79: 135, 21: H, 73: it, 74: ot, 80: W, 81: Z, 82: q, 83: G, 84: U, 85: ht }), t(Y, [2, 8]), t(N, [2, 39]), t(C, [2, 83])],
    defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 3], 78: [2, 32], 113: [2, 10], 116: [2, 4], 126: [2, 44], 139: [2, 35] },
    parseError: function(mt, pt) {
      if (pt.recoverable)
        this.trace(mt);
      else {
        var dt = new Error(mt);
        throw dt.hash = pt, dt;
      }
    },
    parse: function(mt) {
      var pt = this, dt = [0], ft = [], j = [null], $ = [], et = this.table, rt = "", ut = 0, Kt = 0, Zt = 2, Qt = 1, Mt = $.slice.call(arguments, 1), ne = Object.create(this.lexer), Bt = { yy: {} };
      for (var Te in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, Te) && (Bt.yy[Te] = this.yy[Te]);
      ne.setInput(mt, Bt.yy), Bt.yy.lexer = ne, Bt.yy.parser = this, typeof ne.yylloc > "u" && (ne.yylloc = {});
      var ie = ne.yylloc;
      $.push(ie);
      var Bi = ne.options && ne.options.ranges;
      typeof Bt.yy.parseError == "function" ? this.parseError = Bt.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function Ar() {
        var Pt;
        return Pt = ft.pop() || ne.lex() || Qt, typeof Pt != "number" && (Pt instanceof Array && (ft = Pt, Pt = ft.pop()), Pt = pt.symbols_[Pt] || Pt), Pt;
      }
      for (var Jt, se, xe, jt, he = {}, Vt, re, oe, Xt; ; ) {
        if (se = dt[dt.length - 1], this.defaultActions[se] ? xe = this.defaultActions[se] : ((Jt === null || typeof Jt > "u") && (Jt = Ar()), xe = et[se] && et[se][Jt]), typeof xe > "u" || !xe.length || !xe[0]) {
          var Wt = "";
          Xt = [];
          for (Vt in et[se])
            this.terminals_[Vt] && Vt > Zt && Xt.push("'" + this.terminals_[Vt] + "'");
          ne.showPosition ? Wt = "Parse error on line " + (ut + 1) + `:
` + ne.showPosition() + `
Expecting ` + Xt.join(", ") + ", got '" + (this.terminals_[Jt] || Jt) + "'" : Wt = "Parse error on line " + (ut + 1) + ": Unexpected " + (Jt == Qt ? "end of input" : "'" + (this.terminals_[Jt] || Jt) + "'"), this.parseError(Wt, {
            text: ne.match,
            token: this.terminals_[Jt] || Jt,
            line: ne.yylineno,
            loc: ie,
            expected: Xt
          });
        }
        if (xe[0] instanceof Array && xe.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + se + ", token: " + Jt);
        switch (xe[0]) {
          case 1:
            dt.push(Jt), j.push(ne.yytext), $.push(ne.yylloc), dt.push(xe[1]), Jt = null, Kt = ne.yyleng, rt = ne.yytext, ut = ne.yylineno, ie = ne.yylloc;
            break;
          case 2:
            if (re = this.productions_[xe[1]][1], he.$ = j[j.length - re], he._$ = {
              first_line: $[$.length - (re || 1)].first_line,
              last_line: $[$.length - 1].last_line,
              first_column: $[$.length - (re || 1)].first_column,
              last_column: $[$.length - 1].last_column
            }, Bi && (he._$.range = [
              $[$.length - (re || 1)].range[0],
              $[$.length - 1].range[1]
            ]), jt = this.performAction.apply(he, [
              rt,
              Kt,
              ut,
              Bt.yy,
              xe[1],
              j,
              $
            ].concat(Mt)), typeof jt < "u")
              return jt;
            re && (dt = dt.slice(0, -1 * re * 2), j = j.slice(0, -1 * re), $ = $.slice(0, -1 * re)), dt.push(this.productions_[xe[1]][0]), j.push(he.$), $.push(he._$), oe = et[dt[dt.length - 2]][dt[dt.length - 1]], dt.push(oe);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, $t = /* @__PURE__ */ (function() {
    var te = {
      EOF: 1,
      parseError: function(pt, dt) {
        if (this.yy.parser)
          this.yy.parser.parseError(pt, dt);
        else
          throw new Error(pt);
      },
      // resets the lexer, sets new input
      setInput: function(mt, pt) {
        return this.yy = pt || this.yy || {}, this._input = mt, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var mt = this._input[0];
        this.yytext += mt, this.yyleng++, this.offset++, this.match += mt, this.matched += mt;
        var pt = mt.match(/(?:\r\n?|\n).*/g);
        return pt ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), mt;
      },
      // unshifts one char (or a string) into the input
      unput: function(mt) {
        var pt = mt.length, dt = mt.split(/(?:\r\n?|\n)/g);
        this._input = mt + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - pt), this.offset -= pt;
        var ft = 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), dt.length - 1 && (this.yylineno -= dt.length - 1);
        var j = 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: dt ? (dt.length === ft.length ? this.yylloc.first_column : 0) + ft[ft.length - dt.length].length - dt[0].length : this.yylloc.first_column - pt
        }, this.options.ranges && (this.yylloc.range = [j[0], j[0] + this.yyleng - pt]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(mt) {
        this.unput(this.match.slice(mt));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var mt = this.matched.substr(0, this.matched.length - this.match.length);
        return (mt.length > 20 ? "..." : "") + mt.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var mt = this.match;
        return mt.length < 20 && (mt += this._input.substr(0, 20 - mt.length)), (mt.substr(0, 20) + (mt.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var mt = this.pastInput(), pt = new Array(mt.length + 1).join("-");
        return mt + this.upcomingInput() + `
` + pt + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(mt, pt) {
        var dt, ft, j;
        if (this.options.backtrack_lexer && (j = {
          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 && (j.yylloc.range = this.yylloc.range.slice(0))), ft = mt[0].match(/(?:\r\n?|\n).*/g), ft && (this.yylineno += ft.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: ft ? ft[ft.length - 1].length - ft[ft.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + mt[0].length
        }, this.yytext += mt[0], this.match += mt[0], this.matches = mt, 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(mt[0].length), this.matched += mt[0], dt = this.performAction.call(this, this.yy, this, pt, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), dt)
          return dt;
        if (this._backtrack) {
          for (var $ in j)
            this[$] = j[$];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var mt, pt, dt, ft;
        this._more || (this.yytext = "", this.match = "");
        for (var j = this._currentRules(), $ = 0; $ < j.length; $++)
          if (dt = this._input.match(this.rules[j[$]]), dt && (!pt || dt[0].length > pt[0].length)) {
            if (pt = dt, ft = $, this.options.backtrack_lexer) {
              if (mt = this.test_match(dt, j[$]), mt !== !1)
                return mt;
              if (this._backtrack) {
                pt = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return pt ? (mt = this.test_match(pt, j[ft]), mt !== !1 ? mt : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var pt = this.next();
        return pt || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(pt) {
        this.conditionStack.push(pt);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var pt = this.conditionStack.length - 1;
        return pt > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(pt) {
        return pt = this.conditionStack.length - 1 - Math.abs(pt || 0), pt >= 0 ? this.conditionStack[pt] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(pt) {
        this.begin(pt);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: {},
      performAction: function(pt, dt, ft, j) {
        switch (ft) {
          case 0:
            return 53;
          case 1:
            return 54;
          case 2:
            return 55;
          case 3:
            return 56;
          case 4:
            break;
          case 5:
            break;
          case 6:
            return this.begin("acc_title"), 31;
          case 7:
            return this.popState(), "acc_title_value";
          case 8:
            return this.begin("acc_descr"), 33;
          case 9:
            return this.popState(), "acc_descr_value";
          case 10:
            this.begin("acc_descr_multiline");
            break;
          case 11:
            this.popState();
            break;
          case 12:
            return "acc_descr_multiline_value";
          case 13:
            return 8;
          case 14:
            break;
          case 15:
            return 7;
          case 16:
            return 7;
          case 17:
            return "EDGE_STATE";
          case 18:
            this.begin("callback_name");
            break;
          case 19:
            this.popState();
            break;
          case 20:
            this.popState(), this.begin("callback_args");
            break;
          case 21:
            return 70;
          case 22:
            this.popState();
            break;
          case 23:
            return 71;
          case 24:
            this.popState();
            break;
          case 25:
            return "STR";
          case 26:
            this.begin("string");
            break;
          case 27:
            return 73;
          case 28:
            return this.begin("namespace"), 40;
          case 29:
            return this.popState(), 8;
          case 30:
            break;
          case 31:
            return this.begin("namespace-body"), 37;
          case 32:
            return this.popState(), 39;
          case 33:
            return "EOF_IN_STRUCT";
          case 34:
            return 8;
          case 35:
            break;
          case 36:
            return "EDGE_STATE";
          case 37:
            return this.begin("class"), 44;
          case 38:
            return this.popState(), 8;
          case 39:
            break;
          case 40:
            return this.popState(), this.popState(), 39;
          case 41:
            return this.begin("class-body"), 37;
          case 42:
            return this.popState(), 39;
          case 43:
            return "EOF_IN_STRUCT";
          case 44:
            return "EDGE_STATE";
          case 45:
            return "OPEN_IN_STRUCT";
          case 46:
            break;
          case 47:
            return "MEMBER";
          case 48:
            return 76;
          case 49:
            return 66;
          case 50:
            return 67;
          case 51:
            return 69;
          case 52:
            return 50;
          case 53:
            return 52;
          case 54:
            return 45;
          case 55:
            return 46;
          case 56:
            return 72;
          case 57:
            this.popState();
            break;
          case 58:
            return "GENERICTYPE";
          case 59:
            this.begin("generic");
            break;
          case 60:
            this.popState();
            break;
          case 61:
            return "BQUOTE_STR";
          case 62:
            this.begin("bqstring");
            break;
          case 63:
            return 68;
          case 64:
            return 68;
          case 65:
            return 68;
          case 66:
            return 68;
          case 67:
            return 60;
          case 68:
            return 60;
          case 69:
            return 62;
          case 70:
            return 62;
          case 71:
            return 61;
          case 72:
            return 59;
          case 73:
            return 63;
          case 74:
            return 64;
          case 75:
            return 65;
          case 76:
            return 21;
          case 77:
            return 42;
          case 78:
            return 95;
          case 79:
            return "DOT";
          case 80:
            return "PLUS";
          case 81:
            return 81;
          case 82:
            return 78;
          case 83:
            return 84;
          case 84:
            return 84;
          case 85:
            return 85;
          case 86:
            return "EQUALS";
          case 87:
            return "EQUALS";
          case 88:
            return 74;
          case 89:
            return 12;
          case 90:
            return 14;
          case 91:
            return "PUNCTUATION";
          case 92:
            return 80;
          case 93:
            return 97;
          case 94:
            return 83;
          case 95:
            return 83;
          case 96:
            return 9;
        }
      },
      rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:classDiagram-v2\b)/, /^(?:classDiagram\b)/, /^(?:\[\*\])/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:["])/, /^(?:[^"]*)/, /^(?:["])/, /^(?:style\b)/, /^(?:namespace\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[{])/, /^(?:[}])/, /^(?:$)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:\[\*\])/, /^(?:class\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[}])/, /^(?:[{])/, /^(?:[}])/, /^(?:$)/, /^(?:\[\*\])/, /^(?:[{])/, /^(?:[\n])/, /^(?:[^{}\n]*)/, /^(?:cssClass\b)/, /^(?:callback\b)/, /^(?:link\b)/, /^(?:click\b)/, /^(?:note for\b)/, /^(?:note\b)/, /^(?:<<)/, /^(?:>>)/, /^(?:href\b)/, /^(?:[~])/, /^(?:[^~]*)/, /^(?:~)/, /^(?:[`])/, /^(?:[^`]+)/, /^(?:[`])/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:\s*<\|)/, /^(?:\s*\|>)/, /^(?:\s*>)/, /^(?:\s*<)/, /^(?:\s*\*)/, /^(?:\s*o\b)/, /^(?:\s*\(\))/, /^(?:--)/, /^(?:\.\.)/, /^(?::{1}[^:\n;]+)/, /^(?::{3})/, /^(?:-)/, /^(?:\.)/, /^(?:\+)/, /^(?::)/, /^(?:,)/, /^(?:#)/, /^(?:#)/, /^(?:%)/, /^(?:=)/, /^(?:=)/, /^(?:\w+)/, /^(?:\[)/, /^(?:\])/, /^(?:[!"#$%&'*+,-.`?\\/])/, /^(?:[0-9]+)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\s)/, /^(?:\s)/, /^(?:$)/],
      conditions: { "namespace-body": { rules: [26, 32, 33, 34, 35, 36, 37, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, namespace: { rules: [26, 28, 29, 30, 31, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, "class-body": { rules: [26, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, class: { rules: [26, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, acc_descr_multiline: { rules: [11, 12, 26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, acc_descr: { rules: [9, 26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, acc_title: { rules: [7, 26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, callback_args: { rules: [22, 23, 26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, callback_name: { rules: [19, 20, 21, 26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, href: { rules: [26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, struct: { rules: [26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, generic: { rules: [26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, bqstring: { rules: [26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, string: { rules: [24, 25, 26, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 96], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 26, 27, 28, 37, 48, 49, 50, 51, 52, 53, 54, 55, 56, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96], inclusive: !0 } }
    };
    return te;
  })();
  Tt.lexer = $t;
  function Rt() {
    this.yy = {};
  }
  return Rt.prototype = Tt, Tt.Parser = Rt, new Rt();
})();
P1.parser = P1;
const K_ = P1, J2 = ["#", "+", "~", "-", ""];
class ty {
  constructor(e, n) {
    this.memberType = n, this.visibility = "", this.classifier = "";
    const i = Ne(e, Q());
    this.parseMember(i);
  }
  getDisplayDetails() {
    let e = this.visibility + So(this.id);
    this.memberType === "method" && (e += `(${So(this.parameters.trim())})`, this.returnType && (e += " : " + So(this.returnType))), e = e.trim();
    const n = this.parseClassifier();
    return {
      displayText: e,
      cssStyle: n
    };
  }
  parseMember(e) {
    let n = "";
    if (this.memberType === "method") {
      const i = /([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/, r = e.match(i);
      if (r) {
        const s = r[1] ? r[1].trim() : "";
        if (J2.includes(s) && (this.visibility = s), this.id = r[2].trim(), this.parameters = r[3] ? r[3].trim() : "", n = r[4] ? r[4].trim() : "", this.returnType = r[5] ? r[5].trim() : "", n === "") {
          const a = this.returnType.substring(this.returnType.length - 1);
          a.match(/[$*]/) && (n = a, this.returnType = this.returnType.substring(0, this.returnType.length - 1));
        }
      }
    } else {
      const i = e.length, r = e.substring(0, 1), s = e.substring(i - 1);
      J2.includes(r) && (this.visibility = r), s.match(/[$*]/) && (n = s), this.id = e.substring(
        this.visibility === "" ? 0 : 1,
        n === "" ? i : i - 1
      );
    }
    this.classifier = n;
  }
  parseClassifier() {
    switch (this.classifier) {
      case "*":
        return "font-style:italic;";
      case "$":
        return "text-decoration:underline;";
      default:
        return "";
    }
  }
}
const vh = "classId-";
let O0 = [], we = {}, vu = [], ey = 0, $r = {}, z1 = 0, dl = [];
const Es = (t) => bt.sanitizeText(t, Q()), Cs = function(t) {
  const e = bt.sanitizeText(t, Q());
  let n = "", i = e;
  if (e.indexOf("~") > 0) {
    const r = e.split("~");
    i = Es(r[0]), n = Es(r[1]);
  }
  return { className: i, type: n };
}, Aj = function(t, e) {
  const n = bt.sanitizeText(t, Q());
  e && (e = Es(e));
  const { className: i } = Cs(n);
  we[i].label = e;
}, Eu = function(t) {
  const e = bt.sanitizeText(t, Q()), { className: n, type: i } = Cs(e);
  if (Object.hasOwn(we, n))
    return;
  const r = bt.sanitizeText(n, Q());
  we[r] = {
    id: r,
    type: i,
    label: r,
    cssClasses: [],
    methods: [],
    members: [],
    annotations: [],
    styles: [],
    domId: vh + r + "-" + ey
  }, ey++;
}, Q_ = function(t) {
  const e = bt.sanitizeText(t, Q());
  if (e in we)
    return we[e].domId;
  throw new Error("Class not found: " + e);
}, Lj = function() {
  O0 = [], we = {}, vu = [], dl = [], dl.push(J_), $r = {}, z1 = 0, fn();
}, Ij = function(t) {
  return we[t];
}, Bj = function() {
  return we;
}, Dj = function() {
  return O0;
}, Nj = function() {
  return vu;
}, Fj = function(t) {
  z.debug("Adding relation: " + JSON.stringify(t)), Eu(t.id1), Eu(t.id2), t.id1 = Cs(t.id1).className, t.id2 = Cs(t.id2).className, t.relationTitle1 = bt.sanitizeText(t.relationTitle1.trim(), Q()), t.relationTitle2 = bt.sanitizeText(t.relationTitle2.trim(), Q()), O0.push(t);
}, Oj = function(t, e) {
  const n = Cs(t).className;
  we[n].annotations.push(e);
}, Z_ = function(t, e) {
  Eu(t);
  const n = Cs(t).className, i = we[n];
  if (typeof e == "string") {
    const r = e.trim();
    r.startsWith("<<") && r.endsWith(">>") ? i.annotations.push(Es(r.substring(2, r.length - 2))) : r.indexOf(")") > 0 ? i.methods.push(new ty(r, "method")) : r && i.members.push(new ty(r, "attribute"));
  }
}, Rj = function(t, e) {
  Array.isArray(e) && (e.reverse(), e.forEach((n) => Z_(t, n)));
}, Mj = function(t, e) {
  const n = {
    id: `note${vu.length}`,
    class: e,
    text: t
  };
  vu.push(n);
}, Pj = function(t) {
  return t.startsWith(":") && (t = t.substring(1)), Es(t.trim());
}, R0 = function(t, e) {
  t.split(",").forEach(function(n) {
    let i = n;
    n[0].match(/\d/) && (i = vh + i), we[i] !== void 0 && we[i].cssClasses.push(e);
  });
}, zj = function(t, e) {
  t.split(",").forEach(function(n) {
    e !== void 0 && (we[n].tooltip = Es(e));
  });
}, Vj = function(t, e) {
  return e ? $r[e].classes[t].tooltip : we[t].tooltip;
}, qj = function(t, e, n) {
  const i = Q();
  t.split(",").forEach(function(r) {
    let s = r;
    r[0].match(/\d/) && (s = vh + s), we[s] !== void 0 && (we[s].link = Gt.formatUrl(e, i), i.securityLevel === "sandbox" ? we[s].linkTarget = "_top" : typeof n == "string" ? we[s].linkTarget = Es(n) : we[s].linkTarget = "_blank");
  }), R0(t, "clickable");
}, $j = function(t, e, n) {
  t.split(",").forEach(function(i) {
    Yj(i, e, n), we[i].haveCallback = !0;
  }), R0(t, "clickable");
}, Yj = function(t, e, n) {
  const i = bt.sanitizeText(t, Q());
  if (Q().securityLevel !== "loose" || e === void 0)
    return;
  const s = i;
  if (we[s] !== void 0) {
    const a = Q_(s);
    let o = [];
    if (typeof n == "string") {
      o = n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/);
      for (let l = 0; l < o.length; l++) {
        let u = o[l].trim();
        u.charAt(0) === '"' && u.charAt(u.length - 1) === '"' && (u = u.substr(1, u.length - 2)), o[l] = u;
      }
    }
    o.length === 0 && o.push(a), dl.push(function() {
      const l = document.querySelector(`[id="${a}"]`);
      l !== null && l.addEventListener(
        "click",
        function() {
          Gt.runFunc(e, ...o);
        },
        !1
      );
    });
  }
}, Wj = function(t) {
  dl.forEach(function(e) {
    e(t);
  });
}, Uj = {
  LINE: 0,
  DOTTED_LINE: 1
}, Hj = {
  AGGREGATION: 0,
  EXTENSION: 1,
  COMPOSITION: 2,
  DEPENDENCY: 3,
  LOLLIPOP: 4
}, J_ = function(t) {
  let e = yt(".mermaidTooltip");
  (e._groups || e)[0][0] === null && (e = yt("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0)), yt(t).select("svg").selectAll("g.node").on("mouseover", function() {
    const r = yt(this);
    if (r.attr("title") === null)
      return;
    const a = this.getBoundingClientRect();
    e.transition().duration(200).style("opacity", ".9"), e.text(r.attr("title")).style("left", window.scrollX + a.left + (a.right - a.left) / 2 + "px").style("top", window.scrollY + a.top - 14 + document.body.scrollTop + "px"), e.html(e.html().replace(/&lt;br\/&gt;/g, "<br/>")), r.classed("hover", !0);
  }).on("mouseout", function() {
    e.transition().duration(500).style("opacity", 0), yt(this).classed("hover", !1);
  });
};
dl.push(J_);
let t5 = "TB";
const Gj = () => t5, jj = (t) => {
  t5 = t;
}, Xj = function(t) {
  $r[t] === void 0 && ($r[t] = {
    id: t,
    classes: {},
    children: {},
    domId: vh + t + "-" + z1
  }, z1++);
}, Kj = function(t) {
  return $r[t];
}, Qj = function() {
  return $r;
}, Zj = function(t, e) {
  if ($r[t] !== void 0)
    for (const n of e) {
      const { className: i } = Cs(n);
      we[i].parent = t, $r[t].classes[i] = we[i];
    }
}, Jj = function(t, e) {
  const n = we[t];
  if (!(!e || !n))
    for (const i of e)
      i.includes(",") ? n.styles.push(...i.split(",")) : n.styles.push(i);
}, Cu = {
  setAccTitle: pn,
  getAccTitle: vn,
  getAccDescription: Cn,
  setAccDescription: En,
  getConfig: () => Q().class,
  addClass: Eu,
  bindFunctions: Wj,
  clear: Lj,
  getClass: Ij,
  getClasses: Bj,
  getNotes: Nj,
  addAnnotation: Oj,
  addNote: Mj,
  getRelations: Dj,
  addRelation: Fj,
  getDirection: Gj,
  setDirection: jj,
  addMember: Z_,
  addMembers: Rj,
  cleanupLabel: Pj,
  lineType: Uj,
  relationType: Hj,
  setClickEvent: $j,
  setCssClass: R0,
  setLink: qj,
  getTooltip: Vj,
  setTooltip: zj,
  lookUpDomId: Q_,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn,
  setClassLabel: Aj,
  addNamespace: Xj,
  addClassesToNamespace: Zj,
  getNamespace: Kj,
  getNamespaces: Qj,
  setCssStyle: Jj
}, tX = (t) => `g.classGroup text {
  fill: ${t.nodeBorder || t.classText};
  stroke: none;
  font-family: ${t.fontFamily};
  font-size: 10px;

  .title {
    font-weight: bolder;
  }

}

.nodeLabel, .edgeLabel {
  color: ${t.classText};
}
.edgeLabel .label rect {
  fill: ${t.mainBkg};
}
.label text {
  fill: ${t.classText};
}
.edgeLabel .label span {
  background: ${t.mainBkg};
}

.classTitle {
  font-weight: bolder;
}
.node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
    stroke-width: 1px;
  }


.divider {
  stroke: ${t.nodeBorder};
  stroke-width: 1;
}

g.clickable {
  cursor: pointer;
}

g.classGroup rect {
  fill: ${t.mainBkg};
  stroke: ${t.nodeBorder};
}

g.classGroup line {
  stroke: ${t.nodeBorder};
  stroke-width: 1;
}

.classLabel .box {
  stroke: none;
  stroke-width: 0;
  fill: ${t.mainBkg};
  opacity: 0.5;
}

.classLabel .label {
  fill: ${t.nodeBorder};
  font-size: 10px;
}

.relation {
  stroke: ${t.lineColor};
  stroke-width: 1;
  fill: none;
}

.dashed-line{
  stroke-dasharray: 3;
}

.dotted-line{
  stroke-dasharray: 1 2;
}

#compositionStart, .composition {
  fill: ${t.lineColor} !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#compositionEnd, .composition {
  fill: ${t.lineColor} !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#dependencyStart, .dependency {
  fill: ${t.lineColor} !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#dependencyStart, .dependency {
  fill: ${t.lineColor} !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#extensionStart, .extension {
  fill: transparent !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#extensionEnd, .extension {
  fill: transparent !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#aggregationStart, .aggregation {
  fill: transparent !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#aggregationEnd, .aggregation {
  fill: transparent !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#lollipopStart, .lollipop {
  fill: ${t.mainBkg} !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

#lollipopEnd, .lollipop {
  fill: ${t.mainBkg} !important;
  stroke: ${t.lineColor} !important;
  stroke-width: 1;
}

.edgeTerminals {
  font-size: 11px;
  line-height: initial;
}

.classTitleText {
  text-anchor: middle;
  font-size: 18px;
  fill: ${t.textColor};
}
`, e5 = tX;
let ny = 0;
const eX = function(t, e, n, i, r) {
  const s = function(v) {
    switch (v) {
      case r.db.relationType.AGGREGATION:
        return "aggregation";
      case r.db.relationType.EXTENSION:
        return "extension";
      case r.db.relationType.COMPOSITION:
        return "composition";
      case r.db.relationType.DEPENDENCY:
        return "dependency";
      case r.db.relationType.LOLLIPOP:
        return "lollipop";
    }
  };
  e.points = e.points.filter((v) => !Number.isNaN(v.y));
  const a = e.points, o = Tr().x(function(v) {
    return v.x;
  }).y(function(v) {
    return v.y;
  }).curve(Tl), l = t.append("path").attr("d", o(a)).attr("id", "edge" + ny).attr("class", "relation");
  let u = "";
  i.arrowMarkerAbsolute && (u = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, u = u.replace(/\(/g, "\\("), u = u.replace(/\)/g, "\\)")), n.relation.lineType == 1 && l.attr("class", "relation dashed-line"), n.relation.lineType == 10 && l.attr("class", "relation dotted-line"), n.relation.type1 !== "none" && l.attr(
    "marker-start",
    "url(" + u + "#" + s(n.relation.type1) + "Start)"
  ), n.relation.type2 !== "none" && l.attr(
    "marker-end",
    "url(" + u + "#" + s(n.relation.type2) + "End)"
  );
  let h, f;
  const d = e.points.length;
  let p = Gt.calcLabelPosition(e.points);
  h = p.x, f = p.y;
  let y, m, _, T;
  if (d % 2 !== 0 && d > 1) {
    let v = Gt.calcCardinalityPosition(
      n.relation.type1 !== "none",
      e.points,
      e.points[0]
    ), A = Gt.calcCardinalityPosition(
      n.relation.type2 !== "none",
      e.points,
      e.points[d - 1]
    );
    z.debug("cardinality_1_point " + JSON.stringify(v)), z.debug("cardinality_2_point " + JSON.stringify(A)), y = v.x, m = v.y, _ = A.x, T = A.y;
  }
  if (n.title !== void 0) {
    const v = t.append("g").attr("class", "classLabel"), A = v.append("text").attr("class", "label").attr("x", h).attr("y", f).attr("fill", "red").attr("text-anchor", "middle").text(n.title);
    window.label = A;
    const L = A.node().getBBox();
    v.insert("rect", ":first-child").attr("class", "box").attr("x", L.x - i.padding / 2).attr("y", L.y - i.padding / 2).attr("width", L.width + i.padding).attr("height", L.height + i.padding);
  }
  z.info("Rendering relation " + JSON.stringify(n)), n.relationTitle1 !== void 0 && n.relationTitle1 !== "none" && t.append("g").attr("class", "cardinality").append("text").attr("class", "type1").attr("x", y).attr("y", m).attr("fill", "black").attr("font-size", "6").text(n.relationTitle1), n.relationTitle2 !== void 0 && n.relationTitle2 !== "none" && t.append("g").attr("class", "cardinality").append("text").attr("class", "type2").attr("x", _).attr("y", T).attr("fill", "black").attr("font-size", "6").text(n.relationTitle2), ny++;
}, nX = function(t, e, n, i) {
  z.debug("Rendering class ", e, n);
  const r = e.id, s = {
    id: r,
    label: e.id,
    width: 0,
    height: 0
  }, a = t.append("g").attr("id", i.db.lookUpDomId(r)).attr("class", "classGroup");
  let o;
  e.link ? o = a.append("svg:a").attr("xlink:href", e.link).attr("target", e.linkTarget).append("text").attr("y", n.textHeight + n.padding).attr("x", 0) : o = a.append("text").attr("y", n.textHeight + n.padding).attr("x", 0);
  let l = !0;
  e.annotations.forEach(function(A) {
    const L = o.append("tspan").text("«" + A + "»");
    l || L.attr("dy", n.textHeight), l = !1;
  });
  let u = n5(e);
  const h = o.append("tspan").text(u).attr("class", "title");
  l || h.attr("dy", n.textHeight);
  const f = o.node().getBBox().height;
  let d, p, y;
  if (e.members.length > 0) {
    d = a.append("line").attr("x1", 0).attr("y1", n.padding + f + n.dividerMargin / 2).attr("y2", n.padding + f + n.dividerMargin / 2);
    const A = a.append("text").attr("x", n.padding).attr("y", f + n.dividerMargin + n.textHeight).attr("fill", "white").attr("class", "classText");
    l = !0, e.members.forEach(function(L) {
      iy(A, L, l, n), l = !1;
    }), p = A.node().getBBox();
  }
  if (e.methods.length > 0) {
    y = a.append("line").attr("x1", 0).attr("y1", n.padding + f + n.dividerMargin + p.height).attr("y2", n.padding + f + n.dividerMargin + p.height);
    const A = a.append("text").attr("x", n.padding).attr("y", f + 2 * n.dividerMargin + p.height + n.textHeight).attr("fill", "white").attr("class", "classText");
    l = !0, e.methods.forEach(function(L) {
      iy(A, L, l, n), l = !1;
    });
  }
  const m = a.node().getBBox();
  var _ = " ";
  e.cssClasses.length > 0 && (_ = _ + e.cssClasses.join(" "));
  const v = a.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", m.width + 2 * n.padding).attr("height", m.height + n.padding + 0.5 * n.dividerMargin).attr("class", _).node().getBBox().width;
  return o.node().childNodes.forEach(function(A) {
    A.setAttribute("x", (v - A.getBBox().width) / 2);
  }), e.tooltip && o.insert("title").text(e.tooltip), d && d.attr("x2", v), y && y.attr("x2", v), s.width = v, s.height = m.height + n.padding + 0.5 * n.dividerMargin, s;
}, n5 = function(t) {
  let e = t.id;
  return t.type && (e += "<" + So(t.type) + ">"), e;
}, iX = function(t, e, n, i) {
  z.debug("Rendering note ", e, n);
  const r = e.id, s = {
    id: r,
    text: e.text,
    width: 0,
    height: 0
  }, a = t.append("g").attr("id", r).attr("class", "classGroup");
  let o = a.append("text").attr("y", n.textHeight + n.padding).attr("x", 0);
  const l = JSON.parse(`"${e.text}"`).split(`
`);
  l.forEach(function(d) {
    z.debug(`Adding line: ${d}`), o.append("tspan").text(d).attr("class", "title").attr("dy", n.textHeight);
  });
  const u = a.node().getBBox(), f = a.insert("rect", ":first-child").attr("x", 0).attr("y", 0).attr("width", u.width + 2 * n.padding).attr(
    "height",
    u.height + l.length * n.textHeight + n.padding + 0.5 * n.dividerMargin
  ).node().getBBox().width;
  return o.node().childNodes.forEach(function(d) {
    d.setAttribute("x", (f - d.getBBox().width) / 2);
  }), s.width = f, s.height = u.height + l.length * n.textHeight + n.padding + 0.5 * n.dividerMargin, s;
}, iy = function(t, e, n, i) {
  const { displayText: r, cssStyle: s } = e.getDisplayDetails(), a = t.append("tspan").attr("x", i.padding).text(r);
  s !== "" && a.attr("style", e.cssStyle), n || a.attr("dy", i.textHeight);
}, yd = {
  getClassTitleString: n5,
  drawClass: nX,
  drawEdge: eX,
  drawNote: iX
};
let Sc = {};
const ec = 20, lo = function(t) {
  const e = Object.entries(Sc).find((n) => n[1].label === t);
  if (e)
    return e[0];
}, rX = function(t) {
  t.append("defs").append("marker").attr("id", "extensionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), t.append("defs").append("marker").attr("id", "extensionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"), t.append("defs").append("marker").attr("id", "compositionStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", "compositionEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", "aggregationStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", "aggregationEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", "dependencyStart").attr("class", "extension").attr("refX", 0).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), t.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z");
}, sX = function(t, e, n, i) {
  const r = Q().class;
  Sc = {}, z.info("Rendering diagram " + t);
  const s = Q().securityLevel;
  let a;
  s === "sandbox" && (a = yt("#i" + e));
  const o = yt(s === "sandbox" ? a.nodes()[0].contentDocument.body : "body"), l = o.select(`[id='${e}']`);
  rX(l);
  const u = new qe({
    multigraph: !0
  });
  u.setGraph({
    isMultiGraph: !0
  }), u.setDefaultEdgeLabel(function() {
    return {};
  });
  const h = i.db.getClasses(), f = Object.keys(h);
  for (const v of f) {
    const A = h[v], L = yd.drawClass(l, A, r, i);
    Sc[L.id] = L, u.setNode(L.id, L), z.info("Org height: " + L.height);
  }
  i.db.getRelations().forEach(function(v) {
    z.info(
      // cspell:ignore tjoho
      "tjoho" + lo(v.id1) + lo(v.id2) + JSON.stringify(v)
    ), u.setEdge(
      lo(v.id1),
      lo(v.id2),
      {
        relation: v
      },
      v.title || "DEFAULT"
    );
  }), i.db.getNotes().forEach(function(v) {
    z.debug(`Adding note: ${JSON.stringify(v)}`);
    const A = yd.drawNote(l, v, r, i);
    Sc[A.id] = A, u.setNode(A.id, A), v.class && v.class in h && u.setEdge(
      v.id,
      lo(v.class),
      {
        relation: {
          id1: v.id,
          id2: v.class,
          relation: {
            type1: "none",
            type2: "none",
            lineType: 10
          }
        }
      },
      "DEFAULT"
    );
  }), Ha(u), u.nodes().forEach(function(v) {
    v !== void 0 && u.node(v) !== void 0 && (z.debug("Node " + v + ": " + JSON.stringify(u.node(v))), o.select("#" + (i.db.lookUpDomId(v) || v)).attr(
      "transform",
      "translate(" + (u.node(v).x - u.node(v).width / 2) + "," + (u.node(v).y - u.node(v).height / 2) + " )"
    ));
  }), u.edges().forEach(function(v) {
    v !== void 0 && u.edge(v) !== void 0 && (z.debug("Edge " + v.v + " -> " + v.w + ": " + JSON.stringify(u.edge(v))), yd.drawEdge(l, u.edge(v), u.edge(v).relation, r, i));
  });
  const y = l.node().getBBox(), m = y.width + ec * 2, _ = y.height + ec * 2;
  dn(l, _, m, r.useMaxWidth);
  const T = `${y.x - ec} ${y.y - ec} ${m} ${_}`;
  z.debug(`viewBox ${T}`), l.attr("viewBox", T);
}, aX = {
  draw: sX
}, oX = {
  parser: K_,
  db: Cu,
  renderer: aX,
  styles: e5,
  init: (t) => {
    t.class || (t.class = {}), t.class.arrowMarkerAbsolute = t.arrowMarkerAbsolute, Cu.clear();
  }
}, lX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: oX
}, Symbol.toStringTag, { value: "Module" })), M0 = (t) => bt.sanitizeText(t, Q());
let V1 = {
  dividerMargin: 10,
  padding: 5,
  textHeight: 10,
  curve: void 0
};
const cX = function(t, e, n, i) {
  const r = Object.keys(t);
  z.info("keys:", r), z.info(t), r.forEach(function(s) {
    var a, o;
    const l = t[s], h = {
      shape: "rect",
      id: l.id,
      domId: l.domId,
      labelText: M0(l.id),
      labelStyle: "",
      style: "fill: none; stroke: black",
      // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
      padding: ((a = Q().flowchart) == null ? void 0 : a.padding) ?? ((o = Q().class) == null ? void 0 : o.padding)
    };
    e.setNode(l.id, h), i5(l.classes, e, n, i, l.id), z.info("setNode", h);
  });
}, i5 = function(t, e, n, i, r) {
  const s = Object.keys(t);
  z.info("keys:", s), z.info(t), s.filter((a) => t[a].parent == r).forEach(function(a) {
    var o, l;
    const u = t[a], h = u.cssClasses.join(" "), f = $n(u.styles), d = u.label ?? u.id, p = 0, m = {
      labelStyle: f.labelStyle,
      shape: "class_box",
      labelText: M0(d),
      classData: u,
      rx: p,
      ry: p,
      class: h,
      style: f.style,
      id: u.id,
      domId: u.domId,
      tooltip: i.db.getTooltip(u.id, r) || "",
      haveCallback: u.haveCallback,
      link: u.link,
      width: u.type === "group" ? 500 : void 0,
      type: u.type,
      // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
      padding: ((o = Q().flowchart) == null ? void 0 : o.padding) ?? ((l = Q().class) == null ? void 0 : l.padding)
    };
    e.setNode(u.id, m), r && e.setParent(u.id, r), z.info("setNode", m);
  });
}, uX = function(t, e, n, i) {
  z.info(t), t.forEach(function(r, s) {
    var a, o;
    const l = r, u = "", h = { labelStyle: "", style: "" }, f = l.text, d = 0, y = {
      labelStyle: h.labelStyle,
      shape: "note",
      labelText: M0(f),
      noteData: l,
      rx: d,
      ry: d,
      class: u,
      style: h.style,
      id: l.id,
      domId: l.id,
      tooltip: "",
      type: "note",
      // TODO V10: Flowchart ? Keeping flowchart for backwards compatibility. Remove in next major release
      padding: ((a = Q().flowchart) == null ? void 0 : a.padding) ?? ((o = Q().class) == null ? void 0 : o.padding)
    };
    if (e.setNode(l.id, y), z.info("setNode", y), !l.class || !(l.class in i))
      return;
    const m = n + s, _ = {
      id: `edgeNote${m}`,
      //Set relationship style and line type
      classes: "relation",
      pattern: "dotted",
      // Set link type for rendering
      arrowhead: "none",
      //Set edge extra labels
      startLabelRight: "",
      endLabelLeft: "",
      //Set relation arrow types
      arrowTypeStart: "none",
      arrowTypeEnd: "none",
      style: "fill:none",
      labelStyle: "",
      curve: oi(V1.curve, bn)
    };
    e.setEdge(l.id, l.class, _, m);
  });
}, hX = function(t, e) {
  const n = Q().flowchart;
  let i = 0;
  t.forEach(function(r) {
    var s;
    i++;
    const a = {
      //Set relationship style and line type
      classes: "relation",
      pattern: r.relation.lineType == 1 ? "dashed" : "solid",
      id: `id_${r.id1}_${r.id2}_${i}`,
      // Set link type for rendering
      arrowhead: r.type === "arrow_open" ? "none" : "normal",
      //Set edge extra labels
      startLabelRight: r.relationTitle1 === "none" ? "" : r.relationTitle1,
      endLabelLeft: r.relationTitle2 === "none" ? "" : r.relationTitle2,
      //Set relation arrow types
      arrowTypeStart: ry(r.relation.type1),
      arrowTypeEnd: ry(r.relation.type2),
      style: "fill:none",
      labelStyle: "",
      curve: oi(n?.curve, bn)
    };
    if (z.info(a, r), r.style !== void 0) {
      const o = $n(r.style);
      a.style = o.style, a.labelStyle = o.labelStyle;
    }
    r.text = r.title, r.text === void 0 ? r.style !== void 0 && (a.arrowheadStyle = "fill: #333") : (a.arrowheadStyle = "fill: #333", a.labelpos = "c", ((s = Q().flowchart) == null ? void 0 : s.htmlLabels) ?? Q().htmlLabels ? (a.labelType = "html", a.label = '<span class="edgeLabel">' + r.text + "</span>") : (a.labelType = "text", a.label = r.text.replace(bt.lineBreakRegex, `
`), r.style === void 0 && (a.style = a.style || "stroke: #333; stroke-width: 1.5px;fill:none"), a.labelStyle = a.labelStyle.replace("color:", "fill:"))), e.setEdge(r.id1, r.id2, a, i);
  });
}, dX = function(t) {
  V1 = {
    ...V1,
    ...t
  };
}, fX = async function(t, e, n, i) {
  z.info("Drawing class - ", e);
  const r = Q().flowchart ?? Q().class, s = Q().securityLevel;
  z.info("config:", r);
  const a = r?.nodeSpacing ?? 50, o = r?.rankSpacing ?? 50, l = new qe({
    multigraph: !0,
    compound: !0
  }).setGraph({
    rankdir: i.db.getDirection(),
    nodesep: a,
    ranksep: o,
    marginx: 8,
    marginy: 8
  }).setDefaultEdgeLabel(function() {
    return {};
  }), u = i.db.getNamespaces(), h = i.db.getClasses(), f = i.db.getRelations(), d = i.db.getNotes();
  z.info(f), cX(u, l, e, i), i5(h, l, e, i), hX(f, l), uX(d, l, f.length + 1, h);
  let p;
  s === "sandbox" && (p = yt("#i" + e));
  const y = yt(s === "sandbox" ? p.nodes()[0].contentDocument.body : "body"), m = y.select(`[id="${e}"]`), _ = y.select("#" + e + " g");
  if (await g0(
    _,
    l,
    ["aggregation", "extension", "composition", "dependency", "lollipop"],
    "classDiagram",
    e
  ), Gt.insertTitle(m, "classTitleText", r?.titleTopMargin ?? 5, i.db.getDiagramTitle()), Wr(l, m, r?.diagramPadding, r?.useMaxWidth), !r?.htmlLabels) {
    const T = s === "sandbox" ? p.nodes()[0].contentDocument : document, v = T.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
    for (const A of v) {
      const L = A.getBBox(), w = T.createElementNS("http://www.w3.org/2000/svg", "rect");
      w.setAttribute("rx", 0), w.setAttribute("ry", 0), w.setAttribute("width", L.width), w.setAttribute("height", L.height), A.insertBefore(w, A.firstChild);
    }
  }
};
function ry(t) {
  let e;
  switch (t) {
    case 0:
      e = "aggregation";
      break;
    case 1:
      e = "extension";
      break;
    case 2:
      e = "composition";
      break;
    case 3:
      e = "dependency";
      break;
    case 4:
      e = "lollipop";
      break;
    default:
      e = "none";
  }
  return e;
}
const pX = {
  setConf: dX,
  draw: fX
}, gX = {
  parser: K_,
  db: Cu,
  renderer: pX,
  styles: e5,
  init: (t) => {
    t.class || (t.class = {}), t.class.arrowMarkerAbsolute = t.arrowMarkerAbsolute, Cu.clear();
  }
}, yX = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: gX
}, Symbol.toStringTag, { value: "Module" }));
var q1 = (function() {
  var t = function(B, N, D, E) {
    for (D = D || {}, E = B.length; E--; D[B[E]] = N)
      ;
    return D;
  }, e = [1, 2], n = [1, 3], i = [1, 4], r = [2, 4], s = [1, 9], a = [1, 11], o = [1, 15], l = [1, 16], u = [1, 17], h = [1, 18], f = [1, 30], d = [1, 19], p = [1, 20], y = [1, 21], m = [1, 22], _ = [1, 23], T = [1, 25], v = [1, 26], A = [1, 27], L = [1, 28], w = [1, 29], b = [1, 32], F = [1, 33], S = [1, 34], x = [1, 35], C = [1, 31], g = [1, 4, 5, 15, 16, 18, 20, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50], I = [1, 4, 5, 13, 14, 15, 16, 18, 20, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50], k = [4, 5, 15, 16, 18, 20, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50], P = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, SPACE: 4, NL: 5, SD: 6, document: 7, line: 8, statement: 9, classDefStatement: 10, cssClassStatement: 11, idStatement: 12, DESCR: 13, "-->": 14, HIDE_EMPTY: 15, scale: 16, WIDTH: 17, COMPOSIT_STATE: 18, STRUCT_START: 19, STRUCT_STOP: 20, STATE_DESCR: 21, AS: 22, ID: 23, FORK: 24, JOIN: 25, CHOICE: 26, CONCURRENT: 27, note: 28, notePosition: 29, NOTE_TEXT: 30, direction: 31, acc_title: 32, acc_title_value: 33, acc_descr: 34, acc_descr_value: 35, acc_descr_multiline_value: 36, classDef: 37, CLASSDEF_ID: 38, CLASSDEF_STYLEOPTS: 39, DEFAULT: 40, class: 41, CLASSENTITY_IDS: 42, STYLECLASS: 43, direction_tb: 44, direction_bt: 45, direction_rl: 46, direction_lr: 47, eol: 48, ";": 49, EDGE_STATE: 50, STYLE_SEPARATOR: 51, left_of: 52, right_of: 53, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 13: "DESCR", 14: "-->", 15: "HIDE_EMPTY", 16: "scale", 17: "WIDTH", 18: "COMPOSIT_STATE", 19: "STRUCT_START", 20: "STRUCT_STOP", 21: "STATE_DESCR", 22: "AS", 23: "ID", 24: "FORK", 25: "JOIN", 26: "CHOICE", 27: "CONCURRENT", 28: "note", 30: "NOTE_TEXT", 32: "acc_title", 33: "acc_title_value", 34: "acc_descr", 35: "acc_descr_value", 36: "acc_descr_multiline_value", 37: "classDef", 38: "CLASSDEF_ID", 39: "CLASSDEF_STYLEOPTS", 40: "DEFAULT", 41: "class", 42: "CLASSENTITY_IDS", 43: "STYLECLASS", 44: "direction_tb", 45: "direction_bt", 46: "direction_rl", 47: "direction_lr", 49: ";", 50: "EDGE_STATE", 51: "STYLE_SEPARATOR", 52: "left_of", 53: "right_of" },
    productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [10, 3], [10, 3], [11, 3], [31, 1], [31, 1], [31, 1], [31, 1], [48, 1], [48, 1], [12, 1], [12, 1], [12, 3], [12, 3], [29, 1], [29, 1]],
    performAction: function(N, D, E, V, nt, O, ct) {
      var X = O.length - 1;
      switch (nt) {
        case 3:
          return V.setRootDoc(O[X]), O[X];
        case 4:
          this.$ = [];
          break;
        case 5:
          O[X] != "nl" && (O[X - 1].push(O[X]), this.$ = O[X - 1]);
          break;
        case 6:
        case 7:
          this.$ = O[X];
          break;
        case 8:
          this.$ = "nl";
          break;
        case 11:
          this.$ = O[X];
          break;
        case 12:
          const W = O[X - 1];
          W.description = V.trimColon(O[X]), this.$ = W;
          break;
        case 13:
          this.$ = { stmt: "relation", state1: O[X - 2], state2: O[X] };
          break;
        case 14:
          const Z = V.trimColon(O[X]);
          this.$ = { stmt: "relation", state1: O[X - 3], state2: O[X - 1], description: Z };
          break;
        case 18:
          this.$ = { stmt: "state", id: O[X - 3], type: "default", description: "", doc: O[X - 1] };
          break;
        case 19:
          var H = O[X], it = O[X - 2].trim();
          if (O[X].match(":")) {
            var ot = O[X].split(":");
            H = ot[0], it = [it, ot[1]];
          }
          this.$ = { stmt: "state", id: H, type: "default", description: it };
          break;
        case 20:
          this.$ = { stmt: "state", id: O[X - 3], type: "default", description: O[X - 5], doc: O[X - 1] };
          break;
        case 21:
          this.$ = { stmt: "state", id: O[X], type: "fork" };
          break;
        case 22:
          this.$ = { stmt: "state", id: O[X], type: "join" };
          break;
        case 23:
          this.$ = { stmt: "state", id: O[X], type: "choice" };
          break;
        case 24:
          this.$ = { stmt: "state", id: V.getDividerId(), type: "divider" };
          break;
        case 25:
          this.$ = { stmt: "state", id: O[X - 1].trim(), note: { position: O[X - 2].trim(), text: O[X].trim() } };
          break;
        case 28:
          this.$ = O[X].trim(), V.setAccTitle(this.$);
          break;
        case 29:
        case 30:
          this.$ = O[X].trim(), V.setAccDescription(this.$);
          break;
        case 31:
        case 32:
          this.$ = { stmt: "classDef", id: O[X - 1].trim(), classes: O[X].trim() };
          break;
        case 33:
          this.$ = { stmt: "applyClass", id: O[X - 1].trim(), styleClass: O[X].trim() };
          break;
        case 34:
          V.setDirection("TB"), this.$ = { stmt: "dir", value: "TB" };
          break;
        case 35:
          V.setDirection("BT"), this.$ = { stmt: "dir", value: "BT" };
          break;
        case 36:
          V.setDirection("RL"), this.$ = { stmt: "dir", value: "RL" };
          break;
        case 37:
          V.setDirection("LR"), this.$ = { stmt: "dir", value: "LR" };
          break;
        case 40:
        case 41:
          this.$ = { stmt: "state", id: O[X].trim(), type: "default", description: "" };
          break;
        case 42:
          this.$ = { stmt: "state", id: O[X - 2].trim(), classes: [O[X].trim()], type: "default", description: "" };
          break;
        case 43:
          this.$ = { stmt: "state", id: O[X - 2].trim(), classes: [O[X].trim()], type: "default", description: "" };
          break;
      }
    },
    table: [{ 3: 1, 4: e, 5: n, 6: i }, { 1: [3] }, { 3: 5, 4: e, 5: n, 6: i }, { 3: 6, 4: e, 5: n, 6: i }, t([1, 4, 5, 15, 16, 18, 21, 23, 24, 25, 26, 27, 28, 32, 34, 36, 37, 41, 44, 45, 46, 47, 50], r, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: s, 5: a, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 15: o, 16: l, 18: u, 21: h, 23: f, 24: d, 25: p, 26: y, 27: m, 28: _, 31: 24, 32: T, 34: v, 36: A, 37: L, 41: w, 44: b, 45: F, 46: S, 47: x, 50: C }, t(g, [2, 5]), { 9: 36, 10: 12, 11: 13, 12: 14, 15: o, 16: l, 18: u, 21: h, 23: f, 24: d, 25: p, 26: y, 27: m, 28: _, 31: 24, 32: T, 34: v, 36: A, 37: L, 41: w, 44: b, 45: F, 46: S, 47: x, 50: C }, t(g, [2, 7]), t(g, [2, 8]), t(g, [2, 9]), t(g, [2, 10]), t(g, [2, 11], { 13: [1, 37], 14: [1, 38] }), t(g, [2, 15]), { 17: [1, 39] }, t(g, [2, 17], { 19: [1, 40] }), { 22: [1, 41] }, t(g, [2, 21]), t(g, [2, 22]), t(g, [2, 23]), t(g, [2, 24]), { 29: 42, 30: [1, 43], 52: [1, 44], 53: [1, 45] }, t(g, [2, 27]), { 33: [1, 46] }, { 35: [1, 47] }, t(g, [2, 30]), { 38: [1, 48], 40: [1, 49] }, { 42: [1, 50] }, t(I, [2, 40], { 51: [1, 51] }), t(I, [2, 41], { 51: [1, 52] }), t(g, [2, 34]), t(g, [2, 35]), t(g, [2, 36]), t(g, [2, 37]), t(g, [2, 6]), t(g, [2, 12]), { 12: 53, 23: f, 50: C }, t(g, [2, 16]), t(k, r, { 7: 54 }), { 23: [1, 55] }, { 23: [1, 56] }, { 22: [1, 57] }, { 23: [2, 44] }, { 23: [2, 45] }, t(g, [2, 28]), t(g, [2, 29]), { 39: [1, 58] }, { 39: [1, 59] }, { 43: [1, 60] }, { 23: [1, 61] }, { 23: [1, 62] }, t(g, [2, 13], { 13: [1, 63] }), { 4: s, 5: a, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 15: o, 16: l, 18: u, 20: [1, 64], 21: h, 23: f, 24: d, 25: p, 26: y, 27: m, 28: _, 31: 24, 32: T, 34: v, 36: A, 37: L, 41: w, 44: b, 45: F, 46: S, 47: x, 50: C }, t(g, [2, 19], { 19: [1, 65] }), { 30: [1, 66] }, { 23: [1, 67] }, t(g, [2, 31]), t(g, [2, 32]), t(g, [2, 33]), t(I, [2, 42]), t(I, [2, 43]), t(g, [2, 14]), t(g, [2, 18]), t(k, r, { 7: 68 }), t(g, [2, 25]), t(g, [2, 26]), { 4: s, 5: a, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 15: o, 16: l, 18: u, 20: [1, 69], 21: h, 23: f, 24: d, 25: p, 26: y, 27: m, 28: _, 31: 24, 32: T, 34: v, 36: A, 37: L, 41: w, 44: b, 45: F, 46: S, 47: x, 50: C }, t(g, [2, 20])],
    defaultActions: { 5: [2, 1], 6: [2, 2], 44: [2, 44], 45: [2, 45] },
    parseError: function(N, D) {
      if (D.recoverable)
        this.trace(N);
      else {
        var E = new Error(N);
        throw E.hash = D, E;
      }
    },
    parse: function(N) {
      var D = this, E = [0], V = [], nt = [null], O = [], ct = this.table, X = "", H = 0, it = 0, ot = 2, W = 1, Z = O.slice.call(arguments, 1), q = Object.create(this.lexer), G = { yy: {} };
      for (var U in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, U) && (G.yy[U] = this.yy[U]);
      q.setInput(N, G.yy), G.yy.lexer = q, G.yy.parser = this, typeof q.yylloc > "u" && (q.yylloc = {});
      var ht = q.yylloc;
      O.push(ht);
      var Y = q.options && q.options.ranges;
      typeof G.yy.parseError == "function" ? this.parseError = G.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function wt() {
        var j;
        return j = V.pop() || q.lex() || W, typeof j != "number" && (j instanceof Array && (V = j, j = V.pop()), j = D.symbols_[j] || j), j;
      }
      for (var J, Ct, Tt, $t, Rt = {}, te, mt, pt, dt; ; ) {
        if (Ct = E[E.length - 1], this.defaultActions[Ct] ? Tt = this.defaultActions[Ct] : ((J === null || typeof J > "u") && (J = wt()), Tt = ct[Ct] && ct[Ct][J]), typeof Tt > "u" || !Tt.length || !Tt[0]) {
          var ft = "";
          dt = [];
          for (te in ct[Ct])
            this.terminals_[te] && te > ot && dt.push("'" + this.terminals_[te] + "'");
          q.showPosition ? ft = "Parse error on line " + (H + 1) + `:
` + q.showPosition() + `
Expecting ` + dt.join(", ") + ", got '" + (this.terminals_[J] || J) + "'" : ft = "Parse error on line " + (H + 1) + ": Unexpected " + (J == W ? "end of input" : "'" + (this.terminals_[J] || J) + "'"), this.parseError(ft, {
            text: q.match,
            token: this.terminals_[J] || J,
            line: q.yylineno,
            loc: ht,
            expected: dt
          });
        }
        if (Tt[0] instanceof Array && Tt.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + Ct + ", token: " + J);
        switch (Tt[0]) {
          case 1:
            E.push(J), nt.push(q.yytext), O.push(q.yylloc), E.push(Tt[1]), J = null, it = q.yyleng, X = q.yytext, H = q.yylineno, ht = q.yylloc;
            break;
          case 2:
            if (mt = this.productions_[Tt[1]][1], Rt.$ = nt[nt.length - mt], Rt._$ = {
              first_line: O[O.length - (mt || 1)].first_line,
              last_line: O[O.length - 1].last_line,
              first_column: O[O.length - (mt || 1)].first_column,
              last_column: O[O.length - 1].last_column
            }, Y && (Rt._$.range = [
              O[O.length - (mt || 1)].range[0],
              O[O.length - 1].range[1]
            ]), $t = this.performAction.apply(Rt, [
              X,
              it,
              H,
              G.yy,
              Tt[1],
              nt,
              O
            ].concat(Z)), typeof $t < "u")
              return $t;
            mt && (E = E.slice(0, -1 * mt * 2), nt = nt.slice(0, -1 * mt), O = O.slice(0, -1 * mt)), E.push(this.productions_[Tt[1]][0]), nt.push(Rt.$), O.push(Rt._$), pt = ct[E[E.length - 2]][E[E.length - 1]], E.push(pt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, R = /* @__PURE__ */ (function() {
    var B = {
      EOF: 1,
      parseError: function(D, E) {
        if (this.yy.parser)
          this.yy.parser.parseError(D, E);
        else
          throw new Error(D);
      },
      // resets the lexer, sets new input
      setInput: function(N, D) {
        return this.yy = D || this.yy || {}, this._input = N, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var N = this._input[0];
        this.yytext += N, this.yyleng++, this.offset++, this.match += N, this.matched += N;
        var D = N.match(/(?:\r\n?|\n).*/g);
        return D ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), N;
      },
      // unshifts one char (or a string) into the input
      unput: function(N) {
        var D = N.length, E = N.split(/(?:\r\n?|\n)/g);
        this._input = N + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - D), this.offset -= D;
        var V = 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), E.length - 1 && (this.yylineno -= E.length - 1);
        var nt = 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: E ? (E.length === V.length ? this.yylloc.first_column : 0) + V[V.length - E.length].length - E[0].length : this.yylloc.first_column - D
        }, this.options.ranges && (this.yylloc.range = [nt[0], nt[0] + this.yyleng - D]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(N) {
        this.unput(this.match.slice(N));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var N = this.matched.substr(0, this.matched.length - this.match.length);
        return (N.length > 20 ? "..." : "") + N.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var N = this.match;
        return N.length < 20 && (N += this._input.substr(0, 20 - N.length)), (N.substr(0, 20) + (N.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var N = this.pastInput(), D = new Array(N.length + 1).join("-");
        return N + this.upcomingInput() + `
` + D + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(N, D) {
        var E, V, nt;
        if (this.options.backtrack_lexer && (nt = {
          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 && (nt.yylloc.range = this.yylloc.range.slice(0))), V = N[0].match(/(?:\r\n?|\n).*/g), V && (this.yylineno += V.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: V ? V[V.length - 1].length - V[V.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + N[0].length
        }, this.yytext += N[0], this.match += N[0], this.matches = N, 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(N[0].length), this.matched += N[0], E = this.performAction.call(this, this.yy, this, D, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), E)
          return E;
        if (this._backtrack) {
          for (var O in nt)
            this[O] = nt[O];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var N, D, E, V;
        this._more || (this.yytext = "", this.match = "");
        for (var nt = this._currentRules(), O = 0; O < nt.length; O++)
          if (E = this._input.match(this.rules[nt[O]]), E && (!D || E[0].length > D[0].length)) {
            if (D = E, V = O, this.options.backtrack_lexer) {
              if (N = this.test_match(E, nt[O]), N !== !1)
                return N;
              if (this._backtrack) {
                D = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return D ? (N = this.test_match(D, nt[V]), N !== !1 ? N : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var D = this.next();
        return D || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(D) {
        this.conditionStack.push(D);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var D = this.conditionStack.length - 1;
        return D > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(D) {
        return D = this.conditionStack.length - 1 - Math.abs(D || 0), D >= 0 ? this.conditionStack[D] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(D) {
        this.begin(D);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(D, E, V, nt) {
        switch (V) {
          case 0:
            return 40;
          case 1:
            return 44;
          case 2:
            return 45;
          case 3:
            return 46;
          case 4:
            return 47;
          case 5:
            break;
          case 6:
            break;
          case 7:
            return 5;
          case 8:
            break;
          case 9:
            break;
          case 10:
            break;
          case 11:
            break;
          case 12:
            return this.pushState("SCALE"), 16;
          case 13:
            return 17;
          case 14:
            this.popState();
            break;
          case 15:
            return this.begin("acc_title"), 32;
          case 16:
            return this.popState(), "acc_title_value";
          case 17:
            return this.begin("acc_descr"), 34;
          case 18:
            return this.popState(), "acc_descr_value";
          case 19:
            this.begin("acc_descr_multiline");
            break;
          case 20:
            this.popState();
            break;
          case 21:
            return "acc_descr_multiline_value";
          case 22:
            return this.pushState("CLASSDEF"), 37;
          case 23:
            return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
          case 24:
            return this.popState(), this.pushState("CLASSDEFID"), 38;
          case 25:
            return this.popState(), 39;
          case 26:
            return this.pushState("CLASS"), 41;
          case 27:
            return this.popState(), this.pushState("CLASS_STYLE"), 42;
          case 28:
            return this.popState(), 43;
          case 29:
            return this.pushState("SCALE"), 16;
          case 30:
            return 17;
          case 31:
            this.popState();
            break;
          case 32:
            this.pushState("STATE");
            break;
          case 33:
            return this.popState(), E.yytext = E.yytext.slice(0, -8).trim(), 24;
          case 34:
            return this.popState(), E.yytext = E.yytext.slice(0, -8).trim(), 25;
          case 35:
            return this.popState(), E.yytext = E.yytext.slice(0, -10).trim(), 26;
          case 36:
            return this.popState(), E.yytext = E.yytext.slice(0, -8).trim(), 24;
          case 37:
            return this.popState(), E.yytext = E.yytext.slice(0, -8).trim(), 25;
          case 38:
            return this.popState(), E.yytext = E.yytext.slice(0, -10).trim(), 26;
          case 39:
            return 44;
          case 40:
            return 45;
          case 41:
            return 46;
          case 42:
            return 47;
          case 43:
            this.pushState("STATE_STRING");
            break;
          case 44:
            return this.pushState("STATE_ID"), "AS";
          case 45:
            return this.popState(), "ID";
          case 46:
            this.popState();
            break;
          case 47:
            return "STATE_DESCR";
          case 48:
            return 18;
          case 49:
            this.popState();
            break;
          case 50:
            return this.popState(), this.pushState("struct"), 19;
          case 51:
            break;
          case 52:
            return this.popState(), 20;
          case 53:
            break;
          case 54:
            return this.begin("NOTE"), 28;
          case 55:
            return this.popState(), this.pushState("NOTE_ID"), 52;
          case 56:
            return this.popState(), this.pushState("NOTE_ID"), 53;
          case 57:
            this.popState(), this.pushState("FLOATING_NOTE");
            break;
          case 58:
            return this.popState(), this.pushState("FLOATING_NOTE_ID"), "AS";
          case 59:
            break;
          case 60:
            return "NOTE_TEXT";
          case 61:
            return this.popState(), "ID";
          case 62:
            return this.popState(), this.pushState("NOTE_TEXT"), 23;
          case 63:
            return this.popState(), E.yytext = E.yytext.substr(2).trim(), 30;
          case 64:
            return this.popState(), E.yytext = E.yytext.slice(0, -8).trim(), 30;
          case 65:
            return 6;
          case 66:
            return 6;
          case 67:
            return 15;
          case 68:
            return 50;
          case 69:
            return 23;
          case 70:
            return E.yytext = E.yytext.trim(), 13;
          case 71:
            return 14;
          case 72:
            return 27;
          case 73:
            return 51;
          case 74:
            return 5;
          case 75:
            return "INVALID";
        }
      },
      rules: [/^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<<fork>>)/i, /^(?:.*<<join>>)/i, /^(?:.*<<choice>>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { LINE: { rules: [9, 10], inclusive: !1 }, struct: { rules: [9, 10, 22, 26, 32, 39, 40, 41, 42, 51, 52, 53, 54, 68, 69, 70, 71, 72], inclusive: !1 }, FLOATING_NOTE_ID: { rules: [61], inclusive: !1 }, FLOATING_NOTE: { rules: [58, 59, 60], inclusive: !1 }, NOTE_TEXT: { rules: [63, 64], inclusive: !1 }, NOTE_ID: { rules: [62], inclusive: !1 }, NOTE: { rules: [55, 56, 57], inclusive: !1 }, CLASS_STYLE: { rules: [28], inclusive: !1 }, CLASS: { rules: [27], inclusive: !1 }, CLASSDEFID: { rules: [25], inclusive: !1 }, CLASSDEF: { rules: [23, 24], inclusive: !1 }, acc_descr_multiline: { rules: [20, 21], inclusive: !1 }, acc_descr: { rules: [18], inclusive: !1 }, acc_title: { rules: [16], inclusive: !1 }, SCALE: { rules: [13, 14, 30, 31], inclusive: !1 }, ALIAS: { rules: [], inclusive: !1 }, STATE_ID: { rules: [45], inclusive: !1 }, STATE_STRING: { rules: [46, 47], inclusive: !1 }, FORK_STATE: { rules: [], inclusive: !1 }, STATE: { rules: [9, 10, 33, 34, 35, 36, 37, 38, 43, 44, 48, 49, 50], inclusive: !1 }, ID: { rules: [9, 10], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 15, 17, 19, 22, 26, 29, 32, 50, 54, 65, 66, 67, 68, 69, 70, 71, 73, 74, 75], inclusive: !0 } }
    };
    return B;
  })();
  P.lexer = R;
  function M() {
    this.yy = {};
  }
  return M.prototype = P, P.Parser = M, new M();
})();
q1.parser = q1;
const r5 = q1, mX = "LR", xX = "TB", Su = "state", P0 = "relation", bX = "classDef", _X = "applyClass", Rl = "default", s5 = "divider", z0 = "[*]", a5 = "start", o5 = z0, l5 = "end", sy = "color", ay = "fill", kX = "bgFill", TX = ",";
function c5() {
  return {};
}
let u5 = mX, Au = [], Oo = c5();
const h5 = () => ({
  relations: [],
  states: {},
  documents: {}
});
let Lu = {
  root: h5()
}, on = Lu.root, fl = 0, oy = 0;
const wX = {
  LINE: 0,
  DOTTED_LINE: 1
}, vX = {
  AGGREGATION: 0,
  EXTENSION: 1,
  COMPOSITION: 2,
  DEPENDENCY: 3
}, nc = (t) => JSON.parse(JSON.stringify(t)), EX = (t) => {
  z.info("Setting root doc", t), Au = t;
}, CX = () => Au, Ac = (t, e, n) => {
  if (e.stmt === P0)
    Ac(t, e.state1, !0), Ac(t, e.state2, !1);
  else if (e.stmt === Su && (e.id === "[*]" ? (e.id = n ? t.id + "_start" : t.id + "_end", e.start = n) : e.id = e.id.trim()), e.doc) {
    const i = [];
    let r = [], s;
    for (s = 0; s < e.doc.length; s++)
      if (e.doc[s].type === s5) {
        const a = nc(e.doc[s]);
        a.doc = nc(r), i.push(a), r = [];
      } else
        r.push(e.doc[s]);
    if (i.length > 0 && r.length > 0) {
      const a = {
        stmt: Su,
        id: Mx(),
        type: "divider",
        doc: nc(r)
      };
      i.push(nc(a)), e.doc = i;
    }
    e.doc.forEach((a) => Ac(e, a, !0));
  }
}, SX = () => (Ac({ id: "root" }, { id: "root", doc: Au }, !0), { id: "root", doc: Au }), AX = (t) => {
  let e;
  t.doc ? e = t.doc : e = t, z.info(e), d5(!0), z.info("Extract", e), e.forEach((n) => {
    switch (n.stmt) {
      case Su:
        Ss(
          n.id.trim(),
          n.type,
          n.doc,
          n.description,
          n.note,
          n.classes,
          n.styles,
          n.textStyles
        );
        break;
      case P0:
        f5(n.state1, n.state2, n.description);
        break;
      case bX:
        p5(n.id.trim(), n.classes);
        break;
      case _X:
        V0(n.id.trim(), n.styleClass);
        break;
    }
  });
}, Ss = function(t, e = Rl, n = null, i = null, r = null, s = null, a = null, o = null) {
  const l = t?.trim();
  on.states[l] === void 0 ? (z.info("Adding state ", l, i), on.states[l] = {
    id: l,
    descriptions: [],
    type: e,
    doc: n,
    note: r,
    classes: [],
    styles: [],
    textStyles: []
  }) : (on.states[l].doc || (on.states[l].doc = n), on.states[l].type || (on.states[l].type = e)), i && (z.info("Setting state description", l, i), typeof i == "string" && W1(l, i.trim()), typeof i == "object" && i.forEach((u) => W1(l, u.trim()))), r && (on.states[l].note = r, on.states[l].note.text = bt.sanitizeText(
    on.states[l].note.text,
    Q()
  )), s && (z.info("Setting state classes", l, s), (typeof s == "string" ? [s] : s).forEach((h) => V0(l, h.trim()))), a && (z.info("Setting state styles", l, a), (typeof a == "string" ? [a] : a).forEach((h) => PX(l, h.trim()))), o && (z.info("Setting state styles", l, a), (typeof o == "string" ? [o] : o).forEach((h) => zX(l, h.trim())));
}, d5 = function(t) {
  Lu = {
    root: h5()
  }, on = Lu.root, fl = 0, Oo = c5(), t || fn();
}, pl = function(t) {
  return on.states[t];
}, LX = function() {
  return on.states;
}, IX = function() {
  z.info("Documents = ", Lu);
}, BX = function() {
  return on.relations;
};
function $1(t = "") {
  let e = t;
  return t === z0 && (fl++, e = `${a5}${fl}`), e;
}
function Y1(t = "", e = Rl) {
  return t === z0 ? a5 : e;
}
function DX(t = "") {
  let e = t;
  return t === o5 && (fl++, e = `${l5}${fl}`), e;
}
function NX(t = "", e = Rl) {
  return t === o5 ? l5 : e;
}
function FX(t, e, n) {
  let i = $1(t.id.trim()), r = Y1(t.id.trim(), t.type), s = $1(e.id.trim()), a = Y1(e.id.trim(), e.type);
  Ss(
    i,
    r,
    t.doc,
    t.description,
    t.note,
    t.classes,
    t.styles,
    t.textStyles
  ), Ss(
    s,
    a,
    e.doc,
    e.description,
    e.note,
    e.classes,
    e.styles,
    e.textStyles
  ), on.relations.push({
    id1: i,
    id2: s,
    relationTitle: bt.sanitizeText(n, Q())
  });
}
const f5 = function(t, e, n) {
  if (typeof t == "object")
    FX(t, e, n);
  else {
    const i = $1(t.trim()), r = Y1(t), s = DX(e.trim()), a = NX(e);
    Ss(i, r), Ss(s, a), on.relations.push({
      id1: i,
      id2: s,
      title: bt.sanitizeText(n, Q())
    });
  }
}, W1 = function(t, e) {
  const n = on.states[t], i = e.startsWith(":") ? e.replace(":", "").trim() : e;
  n.descriptions.push(bt.sanitizeText(i, Q()));
}, OX = function(t) {
  return t.substring(0, 1) === ":" ? t.substr(2).trim() : t.trim();
}, RX = () => (oy++, "divider-id-" + oy), p5 = function(t, e = "") {
  Oo[t] === void 0 && (Oo[t] = { id: t, styles: [], textStyles: [] });
  const n = Oo[t];
  e?.split(TX).forEach((i) => {
    const r = i.replace(/([^;]*);/, "$1").trim();
    if (i.match(sy)) {
      const a = r.replace(ay, kX).replace(sy, ay);
      n.textStyles.push(a);
    }
    n.styles.push(r);
  });
}, MX = function() {
  return Oo;
}, V0 = function(t, e) {
  t.split(",").forEach(function(n) {
    let i = pl(n);
    if (i === void 0) {
      const r = n.trim();
      Ss(r), i = pl(r);
    }
    i.classes.push(e);
  });
}, PX = function(t, e) {
  const n = pl(t);
  n !== void 0 && n.textStyles.push(e);
}, zX = function(t, e) {
  const n = pl(t);
  n !== void 0 && n.textStyles.push(e);
}, VX = () => u5, qX = (t) => {
  u5 = t;
}, $X = (t) => t && t[0] === ":" ? t.substr(1).trim() : t.trim(), ar = {
  getConfig: () => Q().state,
  addState: Ss,
  clear: d5,
  getState: pl,
  getStates: LX,
  getRelations: BX,
  getClasses: MX,
  getDirection: VX,
  addRelation: f5,
  getDividerId: RX,
  setDirection: qX,
  cleanupLabel: OX,
  lineType: wX,
  relationType: vX,
  logDocuments: IX,
  getRootDoc: CX,
  setRootDoc: EX,
  getRootDocV2: SX,
  extract: AX,
  trimColon: $X,
  getAccTitle: vn,
  setAccTitle: pn,
  getAccDescription: Cn,
  setAccDescription: En,
  addStyleClass: p5,
  setCssClass: V0,
  addDescription: W1,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn
}, YX = (t) => `
defs #statediagram-barbEnd {
    fill: ${t.transitionColor};
    stroke: ${t.transitionColor};
  }
g.stateGroup text {
  fill: ${t.nodeBorder};
  stroke: none;
  font-size: 10px;
}
g.stateGroup text {
  fill: ${t.textColor};
  stroke: none;
  font-size: 10px;

}
g.stateGroup .state-title {
  font-weight: bolder;
  fill: ${t.stateLabelColor};
}

g.stateGroup rect {
  fill: ${t.mainBkg};
  stroke: ${t.nodeBorder};
}

g.stateGroup line {
  stroke: ${t.lineColor};
  stroke-width: 1;
}

.transition {
  stroke: ${t.transitionColor};
  stroke-width: 1;
  fill: none;
}

.stateGroup .composit {
  fill: ${t.background};
  border-bottom: 1px
}

.stateGroup .alt-composit {
  fill: #e0e0e0;
  border-bottom: 1px
}

.state-note {
  stroke: ${t.noteBorderColor};
  fill: ${t.noteBkgColor};

  text {
    fill: ${t.noteTextColor};
    stroke: none;
    font-size: 10px;
  }
}

.stateLabel .box {
  stroke: none;
  stroke-width: 0;
  fill: ${t.mainBkg};
  opacity: 0.5;
}

.edgeLabel .label rect {
  fill: ${t.labelBackgroundColor};
  opacity: 0.5;
}
.edgeLabel .label text {
  fill: ${t.transitionLabelColor || t.tertiaryTextColor};
}
.label div .edgeLabel {
  color: ${t.transitionLabelColor || t.tertiaryTextColor};
}

.stateLabel text {
  fill: ${t.stateLabelColor};
  font-size: 10px;
  font-weight: bold;
}

.node circle.state-start {
  fill: ${t.specialStateColor};
  stroke: ${t.specialStateColor};
}

.node .fork-join {
  fill: ${t.specialStateColor};
  stroke: ${t.specialStateColor};
}

.node circle.state-end {
  fill: ${t.innerEndBackground};
  stroke: ${t.background};
  stroke-width: 1.5
}
.end-state-inner {
  fill: ${t.compositeBackground || t.background};
  // stroke: ${t.background};
  stroke-width: 1.5
}

.node rect {
  fill: ${t.stateBkg || t.mainBkg};
  stroke: ${t.stateBorder || t.nodeBorder};
  stroke-width: 1px;
}
.node polygon {
  fill: ${t.mainBkg};
  stroke: ${t.stateBorder || t.nodeBorder};;
  stroke-width: 1px;
}
#statediagram-barbEnd {
  fill: ${t.lineColor};
}

.statediagram-cluster rect {
  fill: ${t.compositeTitleBackground};
  stroke: ${t.stateBorder || t.nodeBorder};
  stroke-width: 1px;
}

.cluster-label, .nodeLabel {
  color: ${t.stateLabelColor};
}

.statediagram-cluster rect.outer {
  rx: 5px;
  ry: 5px;
}
.statediagram-state .divider {
  stroke: ${t.stateBorder || t.nodeBorder};
}

.statediagram-state .title-state {
  rx: 5px;
  ry: 5px;
}
.statediagram-cluster.statediagram-cluster .inner {
  fill: ${t.compositeBackground || t.background};
}
.statediagram-cluster.statediagram-cluster-alt .inner {
  fill: ${t.altBackground ? t.altBackground : "#efefef"};
}

.statediagram-cluster .inner {
  rx:0;
  ry:0;
}

.statediagram-state rect.basic {
  rx: 5px;
  ry: 5px;
}
.statediagram-state rect.divider {
  stroke-dasharray: 10,10;
  fill: ${t.altBackground ? t.altBackground : "#efefef"};
}

.note-edge {
  stroke-dasharray: 5;
}

.statediagram-note rect {
  fill: ${t.noteBkgColor};
  stroke: ${t.noteBorderColor};
  stroke-width: 1px;
  rx: 0;
  ry: 0;
}
.statediagram-note rect {
  fill: ${t.noteBkgColor};
  stroke: ${t.noteBorderColor};
  stroke-width: 1px;
  rx: 0;
  ry: 0;
}

.statediagram-note text {
  fill: ${t.noteTextColor};
}

.statediagram-note .nodeLabel {
  color: ${t.noteTextColor};
}
.statediagram .edgeLabel {
  color: red; // ${t.noteTextColor};
}

#dependencyStart, #dependencyEnd {
  fill: ${t.lineColor};
  stroke: ${t.lineColor};
  stroke-width: 1;
}

.statediagramTitleText {
  text-anchor: middle;
  font-size: 18px;
  fill: ${t.textColor};
}
`, g5 = YX, WX = (t) => t.append("circle").attr("class", "start-state").attr("r", Q().state.sizeUnit).attr("cx", Q().state.padding + Q().state.sizeUnit).attr("cy", Q().state.padding + Q().state.sizeUnit), UX = (t) => t.append("line").style("stroke", "grey").style("stroke-dasharray", "3").attr("x1", Q().state.textHeight).attr("class", "divider").attr("x2", Q().state.textHeight * 2).attr("y1", 0).attr("y2", 0), HX = (t, e) => {
  const n = t.append("text").attr("x", 2 * Q().state.padding).attr("y", Q().state.textHeight + 2 * Q().state.padding).attr("font-size", Q().state.fontSize).attr("class", "state-title").text(e.id), i = n.node().getBBox();
  return t.insert("rect", ":first-child").attr("x", Q().state.padding).attr("y", Q().state.padding).attr("width", i.width + 2 * Q().state.padding).attr("height", i.height + 2 * Q().state.padding).attr("rx", Q().state.radius), n;
}, GX = (t, e) => {
  const n = function(d, p, y) {
    const m = d.append("tspan").attr("x", 2 * Q().state.padding).text(p);
    y || m.attr("dy", Q().state.textHeight);
  }, r = t.append("text").attr("x", 2 * Q().state.padding).attr("y", Q().state.textHeight + 1.3 * Q().state.padding).attr("font-size", Q().state.fontSize).attr("class", "state-title").text(e.descriptions[0]).node().getBBox(), s = r.height, a = t.append("text").attr("x", Q().state.padding).attr(
    "y",
    s + Q().state.padding * 0.4 + Q().state.dividerMargin + Q().state.textHeight
  ).attr("class", "state-description");
  let o = !0, l = !0;
  e.descriptions.forEach(function(d) {
    o || (n(a, d, l), l = !1), o = !1;
  });
  const u = t.append("line").attr("x1", Q().state.padding).attr("y1", Q().state.padding + s + Q().state.dividerMargin / 2).attr("y2", Q().state.padding + s + Q().state.dividerMargin / 2).attr("class", "descr-divider"), h = a.node().getBBox(), f = Math.max(h.width, r.width);
  return u.attr("x2", f + 3 * Q().state.padding), t.insert("rect", ":first-child").attr("x", Q().state.padding).attr("y", Q().state.padding).attr("width", f + 2 * Q().state.padding).attr("height", h.height + s + 2 * Q().state.padding).attr("rx", Q().state.radius), t;
}, jX = (t, e, n) => {
  const i = Q().state.padding, r = 2 * Q().state.padding, s = t.node().getBBox(), a = s.width, o = s.x, l = t.append("text").attr("x", 0).attr("y", Q().state.titleShift).attr("font-size", Q().state.fontSize).attr("class", "state-title").text(e.id), h = l.node().getBBox().width + r;
  let f = Math.max(h, a);
  f === a && (f = f + r);
  let d;
  const p = t.node().getBBox();
  e.doc, d = o - i, h > a && (d = (a - f) / 2 + i), Math.abs(o - p.x) < i && h > a && (d = o - (h - a) / 2);
  const y = 1 - Q().state.textHeight;
  return t.insert("rect", ":first-child").attr("x", d).attr("y", y).attr("class", n ? "alt-composit" : "composit").attr("width", f).attr(
    "height",
    p.height + Q().state.textHeight + Q().state.titleShift + 1
  ).attr("rx", "0"), l.attr("x", d + i), h <= a && l.attr("x", o + (f - r) / 2 - h / 2 + i), t.insert("rect", ":first-child").attr("x", d).attr(
    "y",
    Q().state.titleShift - Q().state.textHeight - Q().state.padding
  ).attr("width", f).attr("height", Q().state.textHeight * 3).attr("rx", Q().state.radius), t.insert("rect", ":first-child").attr("x", d).attr(
    "y",
    Q().state.titleShift - Q().state.textHeight - Q().state.padding
  ).attr("width", f).attr("height", p.height + 3 + 2 * Q().state.textHeight).attr("rx", Q().state.radius), t;
}, XX = (t) => (t.append("circle").attr("class", "end-state-outer").attr("r", Q().state.sizeUnit + Q().state.miniPadding).attr(
  "cx",
  Q().state.padding + Q().state.sizeUnit + Q().state.miniPadding
).attr(
  "cy",
  Q().state.padding + Q().state.sizeUnit + Q().state.miniPadding
), t.append("circle").attr("class", "end-state-inner").attr("r", Q().state.sizeUnit).attr("cx", Q().state.padding + Q().state.sizeUnit + 2).attr("cy", Q().state.padding + Q().state.sizeUnit + 2)), KX = (t, e) => {
  let n = Q().state.forkWidth, i = Q().state.forkHeight;
  if (e.parentId) {
    let r = n;
    n = i, i = r;
  }
  return t.append("rect").style("stroke", "black").style("fill", "black").attr("width", n).attr("height", i).attr("x", Q().state.padding).attr("y", Q().state.padding);
}, QX = (t, e, n, i) => {
  let r = 0;
  const s = i.append("text");
  s.style("text-anchor", "start"), s.attr("class", "noteText");
  let a = t.replace(/\r\n/g, "<br/>");
  a = a.replace(/\n/g, "<br/>");
  const o = a.split(bt.lineBreakRegex);
  let l = 1.25 * Q().state.noteMargin;
  for (const u of o) {
    const h = u.trim();
    if (h.length > 0) {
      const f = s.append("tspan");
      if (f.text(h), l === 0) {
        const d = f.node().getBBox();
        l += d.height;
      }
      r += l, f.attr("x", e + Q().state.noteMargin), f.attr("y", n + r + 1.25 * Q().state.noteMargin);
    }
  }
  return { textWidth: s.node().getBBox().width, textHeight: r };
}, ZX = (t, e) => {
  e.attr("class", "state-note");
  const n = e.append("rect").attr("x", 0).attr("y", Q().state.padding), i = e.append("g"), { textWidth: r, textHeight: s } = QX(t, 0, 0, i);
  return n.attr("height", s + 2 * Q().state.noteMargin), n.attr("width", r + Q().state.noteMargin * 2), n;
}, ly = function(t, e) {
  const n = e.id, i = {
    id: n,
    label: e.id,
    width: 0,
    height: 0
  }, r = t.append("g").attr("id", n).attr("class", "stateGroup");
  e.type === "start" && WX(r), e.type === "end" && XX(r), (e.type === "fork" || e.type === "join") && KX(r, e), e.type === "note" && ZX(e.note.text, r), e.type === "divider" && UX(r), e.type === "default" && e.descriptions.length === 0 && HX(r, e), e.type === "default" && e.descriptions.length > 0 && GX(r, e);
  const s = r.node().getBBox();
  return i.width = s.width + 2 * Q().state.padding, i.height = s.height + 2 * Q().state.padding, i;
};
let cy = 0;
const JX = function(t, e, n) {
  const i = function(l) {
    switch (l) {
      case ar.relationType.AGGREGATION:
        return "aggregation";
      case ar.relationType.EXTENSION:
        return "extension";
      case ar.relationType.COMPOSITION:
        return "composition";
      case ar.relationType.DEPENDENCY:
        return "dependency";
    }
  };
  e.points = e.points.filter((l) => !Number.isNaN(l.y));
  const r = e.points, s = Tr().x(function(l) {
    return l.x;
  }).y(function(l) {
    return l.y;
  }).curve(Tl), a = t.append("path").attr("d", s(r)).attr("id", "edge" + cy).attr("class", "transition");
  let o = "";
  if (Q().state.arrowMarkerAbsolute && (o = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, o = o.replace(/\(/g, "\\("), o = o.replace(/\)/g, "\\)")), a.attr(
    "marker-end",
    "url(" + o + "#" + i(ar.relationType.DEPENDENCY) + "End)"
  ), n.title !== void 0) {
    const l = t.append("g").attr("class", "stateLabel"), { x: u, y: h } = Gt.calcLabelPosition(e.points), f = bt.getRows(n.title);
    let d = 0;
    const p = [];
    let y = 0, m = 0;
    for (let v = 0; v <= f.length; v++) {
      const A = l.append("text").attr("text-anchor", "middle").text(f[v]).attr("x", u).attr("y", h + d), L = A.node().getBBox();
      y = Math.max(y, L.width), m = Math.min(m, L.x), z.info(L.x, u, h + d), d === 0 && (d = A.node().getBBox().height, z.info("Title height", d, h)), p.push(A);
    }
    let _ = d * f.length;
    if (f.length > 1) {
      const v = (f.length - 1) * d * 0.5;
      p.forEach((A, L) => A.attr("y", h + L * d - v)), _ = d * f.length;
    }
    const T = l.node().getBBox();
    l.insert("rect", ":first-child").attr("class", "box").attr("x", u - y / 2 - Q().state.padding / 2).attr("y", h - _ / 2 - Q().state.padding / 2 - 3.5).attr("width", y + Q().state.padding).attr("height", _ + Q().state.padding), z.info(T);
  }
  cy++;
};
let Mn;
const md = {}, tK = function() {
}, eK = function(t) {
  t.append("defs").append("marker").attr("id", "dependencyEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z");
}, nK = function(t, e, n, i) {
  Mn = Q().state;
  const r = Q().securityLevel;
  let s;
  r === "sandbox" && (s = yt("#i" + e));
  const a = yt(r === "sandbox" ? s.nodes()[0].contentDocument.body : "body"), o = r === "sandbox" ? s.nodes()[0].contentDocument : document;
  z.debug("Rendering diagram " + t);
  const l = a.select(`[id='${e}']`);
  eK(l);
  const u = i.db.getRootDoc();
  y5(u, l, void 0, !1, a, o, i);
  const h = Mn.padding, f = l.node().getBBox(), d = f.width + h * 2, p = f.height + h * 2, y = d * 1.75;
  dn(l, p, y, Mn.useMaxWidth), l.attr(
    "viewBox",
    `${f.x - Mn.padding}  ${f.y - Mn.padding} ` + d + " " + p
  );
}, iK = (t) => t ? t.length * Mn.fontSizeFactor : 1, y5 = (t, e, n, i, r, s, a) => {
  const o = new qe({
    compound: !0,
    multigraph: !0
  });
  let l, u = !0;
  for (l = 0; l < t.length; l++)
    if (t[l].stmt === "relation") {
      u = !1;
      break;
    }
  n ? o.setGraph({
    rankdir: "LR",
    multigraph: !0,
    compound: !0,
    // acyclicer: 'greedy',
    ranker: "tight-tree",
    ranksep: u ? 1 : Mn.edgeLengthFactor,
    nodeSep: u ? 1 : 50,
    isMultiGraph: !0
    // ranksep: 5,
    // nodesep: 1
  }) : o.setGraph({
    rankdir: "TB",
    multigraph: !0,
    compound: !0,
    // isCompound: true,
    // acyclicer: 'greedy',
    // ranker: 'longest-path'
    ranksep: u ? 1 : Mn.edgeLengthFactor,
    nodeSep: u ? 1 : 50,
    ranker: "tight-tree",
    // ranker: 'network-simplex'
    isMultiGraph: !0
  }), o.setDefaultEdgeLabel(function() {
    return {};
  }), a.db.extract(t);
  const h = a.db.getStates(), f = a.db.getRelations(), d = Object.keys(h);
  for (const T of d) {
    const v = h[T];
    n && (v.parentId = n);
    let A;
    if (v.doc) {
      let L = e.append("g").attr("id", v.id).attr("class", "stateGroup");
      A = y5(v.doc, L, v.id, !i, r, s, a);
      {
        L = jX(L, v, i);
        let w = L.node().getBBox();
        A.width = w.width, A.height = w.height + Mn.padding / 2, md[v.id] = { y: Mn.compositTitleSize };
      }
    } else
      A = ly(e, v);
    if (v.note) {
      const L = {
        descriptions: [],
        id: v.id + "-note",
        note: v.note,
        type: "note"
      }, w = ly(e, L);
      v.note.position === "left of" ? (o.setNode(A.id + "-note", w), o.setNode(A.id, A)) : (o.setNode(A.id, A), o.setNode(A.id + "-note", w)), o.setParent(A.id, A.id + "-group"), o.setParent(A.id + "-note", A.id + "-group");
    } else
      o.setNode(A.id, A);
  }
  z.debug("Count=", o.nodeCount(), o);
  let p = 0;
  f.forEach(function(T) {
    p++, z.debug("Setting edge", T), o.setEdge(
      T.id1,
      T.id2,
      {
        relation: T,
        width: iK(T.title),
        height: Mn.labelHeight * bt.getRows(T.title).length,
        labelpos: "c"
      },
      "id" + p
    );
  }), Ha(o), z.debug("Graph after layout", o.nodes());
  const y = e.node();
  o.nodes().forEach(function(T) {
    T !== void 0 && o.node(T) !== void 0 ? (z.warn("Node " + T + ": " + JSON.stringify(o.node(T))), r.select("#" + y.id + " #" + T).attr(
      "transform",
      "translate(" + (o.node(T).x - o.node(T).width / 2) + "," + (o.node(T).y + (md[T] ? md[T].y : 0) - o.node(T).height / 2) + " )"
    ), r.select("#" + y.id + " #" + T).attr("data-x-shift", o.node(T).x - o.node(T).width / 2), s.querySelectorAll("#" + y.id + " #" + T + " .divider").forEach((A) => {
      const L = A.parentElement;
      let w = 0, b = 0;
      L && (L.parentElement && (w = L.parentElement.getBBox().width), b = parseInt(L.getAttribute("data-x-shift"), 10), Number.isNaN(b) && (b = 0)), A.setAttribute("x1", 0 - b + 8), A.setAttribute("x2", w - b - 8);
    })) : z.debug("No Node " + T + ": " + JSON.stringify(o.node(T)));
  });
  let m = y.getBBox();
  o.edges().forEach(function(T) {
    T !== void 0 && o.edge(T) !== void 0 && (z.debug("Edge " + T.v + " -> " + T.w + ": " + JSON.stringify(o.edge(T))), JX(e, o.edge(T), o.edge(T).relation));
  }), m = y.getBBox();
  const _ = {
    id: n || "root",
    label: n || "root",
    width: 0,
    height: 0
  };
  return _.width = m.width + 2 * Mn.padding, _.height = m.height + 2 * Mn.padding, z.debug("Doc rendered", _, o), _;
}, rK = {
  setConf: tK,
  draw: nK
}, sK = {
  parser: r5,
  db: ar,
  renderer: rK,
  styles: g5,
  init: (t) => {
    t.state || (t.state = {}), t.state.arrowMarkerAbsolute = t.arrowMarkerAbsolute, ar.clear();
  }
}, aK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: sK
}, Symbol.toStringTag, { value: "Module" })), Lc = "rect", xd = "rectWithTitle", oK = "start", lK = "end", cK = "divider", uK = "roundedWithTitle", hK = "note", dK = "noteGroup", Oa = "statediagram", fK = "state", pK = `${Oa}-${fK}`, m5 = "transition", gK = "note", yK = "note-edge", mK = `${m5} ${yK}`, xK = `${Oa}-${gK}`, bK = "cluster", _K = `${Oa}-${bK}`, kK = "cluster-alt", TK = `${Oa}-${kK}`, x5 = "parent", b5 = "note", wK = "state", q0 = "----", vK = `${q0}${b5}`, uy = `${q0}${x5}`, _5 = "fill:none", k5 = "fill: #333", T5 = "c", w5 = "text", v5 = "normal";
let Ic = {}, Fr = 0;
const EK = function(t) {
  const e = Object.keys(t);
  for (const n of e)
    t[n];
}, CK = function(t, e) {
  return e.db.extract(e.db.getRootDocV2()), e.db.getClasses();
};
function SK(t) {
  return t == null ? "" : t.classes ? t.classes.join(" ") : "";
}
function bd(t = "", e = 0, n = "", i = q0) {
  const r = n !== null && n.length > 0 ? `${i}${n}` : "";
  return `${wK}-${t}${r}-${e}`;
}
const bo = (t, e, n, i, r, s) => {
  const a = n.id, o = SK(i[a]);
  if (a !== "root") {
    let l = Lc;
    n.start === !0 && (l = oK), n.start === !1 && (l = lK), n.type !== Rl && (l = n.type), Ic[a] || (Ic[a] = {
      id: a,
      shape: l,
      description: bt.sanitizeText(a, Q()),
      classes: `${o} ${pK}`
    });
    const u = Ic[a];
    n.description && (Array.isArray(u.description) ? (u.shape = xd, u.description.push(n.description)) : u.description.length > 0 ? (u.shape = xd, u.description === a ? u.description = [n.description] : u.description = [u.description, n.description]) : (u.shape = Lc, u.description = n.description), u.description = bt.sanitizeTextOrArray(u.description, Q())), u.description.length === 1 && u.shape === xd && (u.shape = Lc), !u.type && n.doc && (z.info("Setting cluster for ", a, U1(n)), u.type = "group", u.dir = U1(n), u.shape = n.type === s5 ? cK : uK, u.classes = u.classes + " " + _K + " " + (s ? TK : ""));
    const h = {
      labelStyle: "",
      shape: u.shape,
      labelText: u.description,
      // typeof newNode.description === 'object'
      //   ? newNode.description[0]
      //   : newNode.description,
      classes: u.classes,
      style: "",
      //styles.style,
      id: a,
      dir: u.dir,
      domId: bd(a, Fr),
      type: u.type,
      padding: 15
      //getConfig().flowchart.padding
    };
    if (h.centerLabel = !0, n.note) {
      const f = {
        labelStyle: "",
        shape: hK,
        labelText: n.note.text,
        classes: xK,
        // useHtmlLabels: false,
        style: "",
        // styles.style,
        id: a + vK + "-" + Fr,
        domId: bd(a, Fr, b5),
        type: u.type,
        padding: 15
        //getConfig().flowchart.padding
      }, d = {
        labelStyle: "",
        shape: dK,
        labelText: n.note.text,
        classes: u.classes,
        style: "",
        // styles.style,
        id: a + uy,
        domId: bd(a, Fr, x5),
        type: "group",
        padding: 0
        //getConfig().flowchart.padding
      };
      Fr++;
      const p = a + uy;
      t.setNode(p, d), t.setNode(f.id, f), t.setNode(a, h), t.setParent(a, p), t.setParent(f.id, p);
      let y = a, m = f.id;
      n.note.position === "left of" && (y = f.id, m = a), t.setEdge(y, m, {
        arrowhead: "none",
        arrowType: "",
        style: _5,
        labelStyle: "",
        classes: mK,
        arrowheadStyle: k5,
        labelpos: T5,
        labelType: w5,
        thickness: v5
      });
    } else
      t.setNode(a, h);
  }
  e && e.id !== "root" && (z.trace("Setting node ", a, " to be child of its parent ", e.id), t.setParent(a, e.id)), n.doc && (z.trace("Adding nodes children "), AK(t, n, n.doc, i, r, !s));
}, AK = (t, e, n, i, r, s) => {
  z.trace("items", n), n.forEach((a) => {
    switch (a.stmt) {
      case Su:
        bo(t, e, a, i, r, s);
        break;
      case Rl:
        bo(t, e, a, i, r, s);
        break;
      case P0:
        {
          bo(t, e, a.state1, i, r, s), bo(t, e, a.state2, i, r, s);
          const o = {
            id: "edge" + Fr,
            arrowhead: "normal",
            arrowTypeEnd: "arrow_barb",
            style: _5,
            labelStyle: "",
            label: bt.sanitizeText(a.description, Q()),
            arrowheadStyle: k5,
            labelpos: T5,
            labelType: w5,
            thickness: v5,
            classes: m5
          };
          t.setEdge(a.state1.id, a.state2.id, o, Fr), Fr++;
        }
        break;
    }
  });
}, U1 = (t, e = xX) => {
  let n = e;
  if (t.doc)
    for (let i = 0; i < t.doc.length; i++) {
      const r = t.doc[i];
      r.stmt === "dir" && (n = r.value);
    }
  return n;
}, LK = async function(t, e, n, i) {
  z.info("Drawing state diagram (v2)", e), Ic = {}, i.db.getDirection();
  const { securityLevel: r, state: s } = Q(), a = s.nodeSpacing || 50, o = s.rankSpacing || 50;
  z.info(i.db.getRootDocV2()), i.db.extract(i.db.getRootDocV2()), z.info(i.db.getRootDocV2());
  const l = i.db.getStates(), u = new qe({
    multigraph: !0,
    compound: !0
  }).setGraph({
    rankdir: U1(i.db.getRootDocV2()),
    nodesep: a,
    ranksep: o,
    marginx: 8,
    marginy: 8
  }).setDefaultEdgeLabel(function() {
    return {};
  });
  bo(u, void 0, i.db.getRootDocV2(), l, i.db, !0);
  let h;
  r === "sandbox" && (h = yt("#i" + e));
  const f = yt(r === "sandbox" ? h.nodes()[0].contentDocument.body : "body"), d = f.select(`[id="${e}"]`), p = f.select("#" + e + " g");
  await g0(p, u, ["barb"], Oa, e);
  const y = 8;
  Gt.insertTitle(d, "statediagramTitleText", s.titleTopMargin, i.db.getDiagramTitle());
  const m = d.node().getBBox(), _ = m.width + y * 2, T = m.height + y * 2;
  d.attr("class", Oa);
  const v = d.node().getBBox();
  dn(d, T, _, s.useMaxWidth);
  const A = `${v.x - y} ${v.y - y} ${_} ${T}`;
  z.debug(`viewBox ${A}`), d.attr("viewBox", A);
  const L = document.querySelectorAll('[id="' + e + '"] .edgeLabel .label');
  for (const w of L) {
    const b = w.getBBox(), F = document.createElementNS("http://www.w3.org/2000/svg", Lc);
    F.setAttribute("rx", 0), F.setAttribute("ry", 0), F.setAttribute("width", b.width), F.setAttribute("height", b.height), w.insertBefore(F, w.firstChild);
  }
}, IK = {
  setConf: EK,
  getClasses: CK,
  draw: LK
}, BK = {
  parser: r5,
  db: ar,
  renderer: IK,
  styles: g5,
  init: (t) => {
    t.state || (t.state = {}), t.state.arrowMarkerAbsolute = t.arrowMarkerAbsolute, ar.clear();
  }
}, DK = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: BK
}, Symbol.toStringTag, { value: "Module" }));
var H1 = (function() {
  var t = function(f, d, p, y) {
    for (p = p || {}, y = f.length; y--; p[f[y]] = d)
      ;
    return p;
  }, e = [6, 8, 10, 11, 12, 14, 16, 17, 18], n = [1, 9], i = [1, 10], r = [1, 11], s = [1, 12], a = [1, 13], o = [1, 14], l = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, journey: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, title: 11, acc_title: 12, acc_title_value: 13, acc_descr: 14, acc_descr_value: 15, acc_descr_multiline_value: 16, section: 17, taskName: 18, taskData: 19, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "journey", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 18: "taskName", 19: "taskData" },
    productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 2]],
    performAction: function(d, p, y, m, _, T, v) {
      var A = T.length - 1;
      switch (_) {
        case 1:
          return T[A - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          T[A - 1].push(T[A]), this.$ = T[A - 1];
          break;
        case 4:
        case 5:
          this.$ = T[A];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          m.setDiagramTitle(T[A].substr(6)), this.$ = T[A].substr(6);
          break;
        case 9:
          this.$ = T[A].trim(), m.setAccTitle(this.$);
          break;
        case 10:
        case 11:
          this.$ = T[A].trim(), m.setAccDescription(this.$);
          break;
        case 12:
          m.addSection(T[A].substr(8)), this.$ = T[A].substr(8);
          break;
        case 13:
          m.addTask(T[A - 1], T[A]), this.$ = "task";
          break;
      }
    },
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: n, 12: i, 14: r, 16: s, 17: a, 18: o }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 15, 11: n, 12: i, 14: r, 16: s, 17: a, 18: o }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 8]), { 13: [1, 16] }, { 15: [1, 17] }, t(e, [2, 11]), t(e, [2, 12]), { 19: [1, 18] }, t(e, [2, 4]), t(e, [2, 9]), t(e, [2, 10]), t(e, [2, 13])],
    defaultActions: {},
    parseError: function(d, p) {
      if (p.recoverable)
        this.trace(d);
      else {
        var y = new Error(d);
        throw y.hash = p, y;
      }
    },
    parse: function(d) {
      var p = this, y = [0], m = [], _ = [null], T = [], v = this.table, A = "", L = 0, w = 0, b = 2, F = 1, S = T.slice.call(arguments, 1), x = Object.create(this.lexer), C = { yy: {} };
      for (var g in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, g) && (C.yy[g] = this.yy[g]);
      x.setInput(d, C.yy), C.yy.lexer = x, C.yy.parser = this, typeof x.yylloc > "u" && (x.yylloc = {});
      var I = x.yylloc;
      T.push(I);
      var k = x.options && x.options.ranges;
      typeof C.yy.parseError == "function" ? this.parseError = C.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function P() {
        var X;
        return X = m.pop() || x.lex() || F, typeof X != "number" && (X instanceof Array && (m = X, X = m.pop()), X = p.symbols_[X] || X), X;
      }
      for (var R, M, B, N, D = {}, E, V, nt, O; ; ) {
        if (M = y[y.length - 1], this.defaultActions[M] ? B = this.defaultActions[M] : ((R === null || typeof R > "u") && (R = P()), B = v[M] && v[M][R]), typeof B > "u" || !B.length || !B[0]) {
          var ct = "";
          O = [];
          for (E in v[M])
            this.terminals_[E] && E > b && O.push("'" + this.terminals_[E] + "'");
          x.showPosition ? ct = "Parse error on line " + (L + 1) + `:
` + x.showPosition() + `
Expecting ` + O.join(", ") + ", got '" + (this.terminals_[R] || R) + "'" : ct = "Parse error on line " + (L + 1) + ": Unexpected " + (R == F ? "end of input" : "'" + (this.terminals_[R] || R) + "'"), this.parseError(ct, {
            text: x.match,
            token: this.terminals_[R] || R,
            line: x.yylineno,
            loc: I,
            expected: O
          });
        }
        if (B[0] instanceof Array && B.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + M + ", token: " + R);
        switch (B[0]) {
          case 1:
            y.push(R), _.push(x.yytext), T.push(x.yylloc), y.push(B[1]), R = null, w = x.yyleng, A = x.yytext, L = x.yylineno, I = x.yylloc;
            break;
          case 2:
            if (V = this.productions_[B[1]][1], D.$ = _[_.length - V], D._$ = {
              first_line: T[T.length - (V || 1)].first_line,
              last_line: T[T.length - 1].last_line,
              first_column: T[T.length - (V || 1)].first_column,
              last_column: T[T.length - 1].last_column
            }, k && (D._$.range = [
              T[T.length - (V || 1)].range[0],
              T[T.length - 1].range[1]
            ]), N = this.performAction.apply(D, [
              A,
              w,
              L,
              C.yy,
              B[1],
              _,
              T
            ].concat(S)), typeof N < "u")
              return N;
            V && (y = y.slice(0, -1 * V * 2), _ = _.slice(0, -1 * V), T = T.slice(0, -1 * V)), y.push(this.productions_[B[1]][0]), _.push(D.$), T.push(D._$), nt = v[y[y.length - 2]][y[y.length - 1]], y.push(nt);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, u = /* @__PURE__ */ (function() {
    var f = {
      EOF: 1,
      parseError: function(p, y) {
        if (this.yy.parser)
          this.yy.parser.parseError(p, y);
        else
          throw new Error(p);
      },
      // resets the lexer, sets new input
      setInput: function(d, p) {
        return this.yy = p || this.yy || {}, this._input = d, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var d = this._input[0];
        this.yytext += d, this.yyleng++, this.offset++, this.match += d, this.matched += d;
        var p = d.match(/(?:\r\n?|\n).*/g);
        return p ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), d;
      },
      // unshifts one char (or a string) into the input
      unput: function(d) {
        var p = d.length, y = d.split(/(?:\r\n?|\n)/g);
        this._input = d + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - p), this.offset -= p;
        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), y.length - 1 && (this.yylineno -= y.length - 1);
        var _ = 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: y ? (y.length === m.length ? this.yylloc.first_column : 0) + m[m.length - y.length].length - y[0].length : this.yylloc.first_column - p
        }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - p]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(d) {
        this.unput(this.match.slice(d));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var d = this.matched.substr(0, this.matched.length - this.match.length);
        return (d.length > 20 ? "..." : "") + d.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var d = this.match;
        return d.length < 20 && (d += this._input.substr(0, 20 - d.length)), (d.substr(0, 20) + (d.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var d = this.pastInput(), p = new Array(d.length + 1).join("-");
        return d + this.upcomingInput() + `
` + p + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(d, p) {
        var y, m, _;
        if (this.options.backtrack_lexer && (_ = {
          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 && (_.yylloc.range = this.yylloc.range.slice(0))), m = d[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 + d[0].length
        }, this.yytext += d[0], this.match += d[0], this.matches = d, 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(d[0].length), this.matched += d[0], y = this.performAction.call(this, this.yy, this, p, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), y)
          return y;
        if (this._backtrack) {
          for (var T in _)
            this[T] = _[T];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var d, p, y, m;
        this._more || (this.yytext = "", this.match = "");
        for (var _ = this._currentRules(), T = 0; T < _.length; T++)
          if (y = this._input.match(this.rules[_[T]]), y && (!p || y[0].length > p[0].length)) {
            if (p = y, m = T, this.options.backtrack_lexer) {
              if (d = this.test_match(y, _[T]), d !== !1)
                return d;
              if (this._backtrack) {
                p = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return p ? (d = this.test_match(p, _[m]), d !== !1 ? d : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var p = this.next();
        return p || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(p) {
        this.conditionStack.push(p);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var p = this.conditionStack.length - 1;
        return p > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(p) {
        return p = this.conditionStack.length - 1 - Math.abs(p || 0), p >= 0 ? this.conditionStack[p] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(p) {
        this.begin(p);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(p, y, m, _) {
        switch (m) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 10;
          case 3:
            break;
          case 4:
            break;
          case 5:
            return 4;
          case 6:
            return 11;
          case 7:
            return this.begin("acc_title"), 12;
          case 8:
            return this.popState(), "acc_title_value";
          case 9:
            return this.begin("acc_descr"), 14;
          case 10:
            return this.popState(), "acc_descr_value";
          case 11:
            this.begin("acc_descr_multiline");
            break;
          case 12:
            this.popState();
            break;
          case 13:
            return "acc_descr_multiline_value";
          case 14:
            return 17;
          case 15:
            return 18;
          case 16:
            return 19;
          case 17:
            return ":";
          case 18:
            return 6;
          case 19:
            return "INVALID";
        }
      },
      rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:journey\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18, 19], inclusive: !0 } }
    };
    return f;
  })();
  l.lexer = u;
  function h() {
    this.yy = {};
  }
  return h.prototype = l, l.Parser = h, new h();
})();
H1.parser = H1;
const NK = H1;
let Ra = "";
const $0 = [], gl = [], yl = [], FK = function() {
  $0.length = 0, gl.length = 0, Ra = "", yl.length = 0, fn();
}, OK = function(t) {
  Ra = t, $0.push(t);
}, RK = function() {
  return $0;
}, MK = function() {
  let t = hy();
  const e = 100;
  let n = 0;
  for (; !t && n < e; )
    t = hy(), n++;
  return gl.push(...yl), gl;
}, PK = function() {
  const t = [];
  return gl.forEach((n) => {
    n.people && t.push(...n.people);
  }), [...new Set(t)].sort();
}, zK = function(t, e) {
  const n = e.substr(1).split(":");
  let i = 0, r = [];
  n.length === 1 ? (i = Number(n[0]), r = []) : (i = Number(n[0]), r = n[1].split(","));
  const s = r.map((o) => o.trim()), a = {
    section: Ra,
    type: Ra,
    people: s,
    task: t,
    score: i
  };
  yl.push(a);
}, VK = function(t) {
  const e = {
    section: Ra,
    type: Ra,
    description: t,
    task: t,
    classes: []
  };
  gl.push(e);
}, hy = function() {
  const t = function(n) {
    return yl[n].processed;
  };
  let e = !0;
  for (const [n, i] of yl.entries())
    t(n), e = e && i.processed;
  return e;
}, qK = function() {
  return PK();
}, dy = {
  getConfig: () => Q().journey,
  clear: FK,
  setDiagramTitle: Yn,
  getDiagramTitle: Sn,
  setAccTitle: pn,
  getAccTitle: vn,
  setAccDescription: En,
  getAccDescription: Cn,
  addSection: OK,
  getSections: RK,
  getTasks: MK,
  addTask: zK,
  addTaskOrg: VK,
  getActors: qK
}, $K = (t) => `.label {
    font-family: 'trebuchet ms', verdana, arial, sans-serif;
    font-family: var(--mermaid-font-family);
    color: ${t.textColor};
  }
  .mouth {
    stroke: #666;
  }

  line {
    stroke: ${t.textColor}
  }

  .legend {
    fill: ${t.textColor};
  }

  .label text {
    fill: #333;
  }
  .label {
    color: ${t.textColor}
  }

  .face {
    ${t.faceColor ? `fill: ${t.faceColor}` : "fill: #FFF8DC"};
    stroke: #999;
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
    stroke-width: 1px;
  }

  .node .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }

  .arrowheadPath {
    fill: ${t.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${t.lineColor};
    stroke-width: 1.5px;
  }

  .flowchart-link {
    stroke: ${t.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${t.edgeLabelBackground};
    rect {
      opacity: 0.5;
    }
    text-align: center;
  }

  .cluster rect {
  }

  .cluster text {
    fill: ${t.titleColor};
  }

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: 'trebuchet ms', verdana, arial, sans-serif;
    font-family: var(--mermaid-font-family);
    font-size: 12px;
    background: ${t.tertiaryColor};
    border: 1px solid ${t.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .task-type-0, .section-type-0  {
    ${t.fillType0 ? `fill: ${t.fillType0}` : ""};
  }
  .task-type-1, .section-type-1  {
    ${t.fillType0 ? `fill: ${t.fillType1}` : ""};
  }
  .task-type-2, .section-type-2  {
    ${t.fillType0 ? `fill: ${t.fillType2}` : ""};
  }
  .task-type-3, .section-type-3  {
    ${t.fillType0 ? `fill: ${t.fillType3}` : ""};
  }
  .task-type-4, .section-type-4  {
    ${t.fillType0 ? `fill: ${t.fillType4}` : ""};
  }
  .task-type-5, .section-type-5  {
    ${t.fillType0 ? `fill: ${t.fillType5}` : ""};
  }
  .task-type-6, .section-type-6  {
    ${t.fillType0 ? `fill: ${t.fillType6}` : ""};
  }
  .task-type-7, .section-type-7  {
    ${t.fillType0 ? `fill: ${t.fillType7}` : ""};
  }

  .actor-0 {
    ${t.actor0 ? `fill: ${t.actor0}` : ""};
  }
  .actor-1 {
    ${t.actor1 ? `fill: ${t.actor1}` : ""};
  }
  .actor-2 {
    ${t.actor2 ? `fill: ${t.actor2}` : ""};
  }
  .actor-3 {
    ${t.actor3 ? `fill: ${t.actor3}` : ""};
  }
  .actor-4 {
    ${t.actor4 ? `fill: ${t.actor4}` : ""};
  }
  .actor-5 {
    ${t.actor5 ? `fill: ${t.actor5}` : ""};
  }
`, YK = $K, Y0 = function(t, e) {
  return oh(t, e);
}, WK = function(t, e) {
  const i = t.append("circle").attr("cx", e.cx).attr("cy", e.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), r = t.append("g");
  r.append("circle").attr("cx", e.cx - 15 / 3).attr("cy", e.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), r.append("circle").attr("cx", e.cx + 15 / 3).attr("cy", e.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
  function s(l) {
    const u = ba().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
    l.append("path").attr("class", "mouth").attr("d", u).attr("transform", "translate(" + e.cx + "," + (e.cy + 2) + ")");
  }
  function a(l) {
    const u = ba().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
    l.append("path").attr("class", "mouth").attr("d", u).attr("transform", "translate(" + e.cx + "," + (e.cy + 7) + ")");
  }
  function o(l) {
    l.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", e.cx - 5).attr("y1", e.cy + 7).attr("x2", e.cx + 5).attr("y2", e.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
  }
  return e.score > 3 ? s(r) : e.score < 3 ? a(r) : o(r), i;
}, E5 = function(t, e) {
  const n = t.append("circle");
  return n.attr("cx", e.cx), n.attr("cy", e.cy), n.attr("class", "actor-" + e.pos), n.attr("fill", e.fill), n.attr("stroke", e.stroke), n.attr("r", e.r), n.class !== void 0 && n.attr("class", n.class), e.title !== void 0 && n.append("title").text(e.title), n;
}, C5 = function(t, e) {
  return MD(t, e);
}, UK = function(t, e) {
  function n(r, s, a, o, l) {
    return r + "," + s + " " + (r + a) + "," + s + " " + (r + a) + "," + (s + o - l) + " " + (r + a - l * 1.2) + "," + (s + o) + " " + r + "," + (s + o);
  }
  const i = t.append("polygon");
  i.attr("points", n(e.x, e.y, 50, 20, 7)), i.attr("class", "labelBox"), e.y = e.y + e.labelMargin, e.x = e.x + 0.5 * e.labelMargin, C5(t, e);
}, HK = function(t, e, n) {
  const i = t.append("g"), r = Vs();
  r.x = e.x, r.y = e.y, r.fill = e.fill, r.width = n.width * e.taskCount + // width of the tasks
  n.diagramMarginX * (e.taskCount - 1), r.height = n.height, r.class = "journey-section section-type-" + e.num, r.rx = 3, r.ry = 3, Y0(i, r), S5(n)(
    e.text,
    i,
    r.x,
    r.y,
    r.width,
    r.height,
    { class: "journey-section section-type-" + e.num },
    n,
    e.colour
  );
};
let fy = -1;
const GK = function(t, e, n) {
  const i = e.x + n.width / 2, r = t.append("g");
  fy++, r.append("line").attr("id", "task" + fy).attr("x1", i).attr("y1", e.y).attr("x2", i).attr("y2", 450).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), WK(r, {
    cx: i,
    cy: 300 + (5 - e.score) * 30,
    score: e.score
  });
  const a = Vs();
  a.x = e.x, a.y = e.y, a.fill = e.fill, a.width = n.width, a.height = n.height, a.class = "task task-type-" + e.num, a.rx = 3, a.ry = 3, Y0(r, a);
  let o = e.x + 14;
  e.people.forEach((l) => {
    const u = e.actors[l].color, h = {
      cx: o,
      cy: e.y,
      r: 7,
      fill: u,
      stroke: "#000",
      title: l,
      pos: e.actors[l].position
    };
    E5(r, h), o += 10;
  }), S5(n)(
    e.task,
    r,
    a.x,
    a.y,
    a.width,
    a.height,
    { class: "task" },
    n,
    e.colour
  );
}, jK = function(t, e) {
  qb(t, e);
}, S5 = /* @__PURE__ */ (function() {
  function t(r, s, a, o, l, u, h, f) {
    const d = s.append("text").attr("x", a + l / 2).attr("y", o + u / 2 + 5).style("font-color", f).style("text-anchor", "middle").text(r);
    i(d, h);
  }
  function e(r, s, a, o, l, u, h, f, d) {
    const { taskFontSize: p, taskFontFamily: y } = f, m = r.split(/<br\s*\/?>/gi);
    for (let _ = 0; _ < m.length; _++) {
      const T = _ * p - p * (m.length - 1) / 2, v = s.append("text").attr("x", a + l / 2).attr("y", o).attr("fill", d).style("text-anchor", "middle").style("font-size", p).style("font-family", y);
      v.append("tspan").attr("x", a + l / 2).attr("dy", T).text(m[_]), v.attr("y", o + u / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), i(v, h);
    }
  }
  function n(r, s, a, o, l, u, h, f) {
    const d = s.append("switch"), y = d.append("foreignObject").attr("x", a).attr("y", o).attr("width", l).attr("height", u).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    y.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(r), e(r, d, a, o, l, u, h, f), i(y, h);
  }
  function i(r, s) {
    for (const a in s)
      a in s && r.attr(a, s[a]);
  }
  return function(r) {
    return r.textPlacement === "fo" ? n : r.textPlacement === "old" ? t : e;
  };
})(), XK = function(t) {
  t.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
}, ml = {
  drawRect: Y0,
  drawCircle: E5,
  drawSection: HK,
  drawText: C5,
  drawLabel: UK,
  drawTask: GK,
  drawBackgroundRect: jK,
  initGraphics: XK
}, KK = function(t) {
  Object.keys(t).forEach(function(n) {
    Eh[n] = t[n];
  });
}, pr = {};
function QK(t) {
  const e = Q().journey;
  let n = 60;
  Object.keys(pr).forEach((i) => {
    const r = pr[i].color, s = {
      cx: 20,
      cy: n,
      r: 7,
      fill: r,
      stroke: "#000",
      pos: pr[i].position
    };
    ml.drawCircle(t, s);
    const a = {
      x: 40,
      y: n + 7,
      fill: "#666",
      text: i,
      textMargin: e.boxTextMargin | 5
    };
    ml.drawText(t, a), n += 20;
  });
}
const Eh = Q().journey, is = Eh.leftMargin, ZK = function(t, e, n, i) {
  const r = Q().journey, s = Q().securityLevel;
  let a;
  s === "sandbox" && (a = yt("#i" + e));
  const o = yt(s === "sandbox" ? a.nodes()[0].contentDocument.body : "body");
  ii.init();
  const l = o.select("#" + e);
  ml.initGraphics(l);
  const u = i.db.getTasks(), h = i.db.getDiagramTitle(), f = i.db.getActors();
  for (const T in pr)
    delete pr[T];
  let d = 0;
  f.forEach((T) => {
    pr[T] = {
      color: r.actorColours[d % r.actorColours.length],
      position: d
    }, d++;
  }), QK(l), ii.insert(0, 0, is, Object.keys(pr).length * 50), JK(l, u, 0);
  const p = ii.getBounds();
  h && l.append("text").text(h).attr("x", is).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 25);
  const y = p.stopy - p.starty + 2 * r.diagramMarginY, m = is + p.stopx + 2 * r.diagramMarginX;
  dn(l, y, m, r.useMaxWidth), l.append("line").attr("x1", is).attr("y1", r.height * 4).attr("x2", m - is - 4).attr("y2", r.height * 4).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)");
  const _ = h ? 70 : 0;
  l.attr("viewBox", `${p.startx} -25 ${m} ${y + _}`), l.attr("preserveAspectRatio", "xMinYMin meet"), l.attr("height", y + _ + 25);
}, ii = {
  data: {
    startx: void 0,
    stopx: void 0,
    starty: void 0,
    stopy: void 0
  },
  verticalPos: 0,
  sequenceItems: [],
  init: function() {
    this.sequenceItems = [], this.data = {
      startx: void 0,
      stopx: void 0,
      starty: void 0,
      stopy: void 0
    }, this.verticalPos = 0;
  },
  updateVal: function(t, e, n, i) {
    t[e] === void 0 ? t[e] = n : t[e] = i(n, t[e]);
  },
  updateBounds: function(t, e, n, i) {
    const r = Q().journey, s = this;
    let a = 0;
    function o(l) {
      return function(h) {
        a++;
        const f = s.sequenceItems.length - a + 1;
        s.updateVal(h, "starty", e - f * r.boxMargin, Math.min), s.updateVal(h, "stopy", i + f * r.boxMargin, Math.max), s.updateVal(ii.data, "startx", t - f * r.boxMargin, Math.min), s.updateVal(ii.data, "stopx", n + f * r.boxMargin, Math.max), s.updateVal(h, "startx", t - f * r.boxMargin, Math.min), s.updateVal(h, "stopx", n + f * r.boxMargin, Math.max), s.updateVal(ii.data, "starty", e - f * r.boxMargin, Math.min), s.updateVal(ii.data, "stopy", i + f * r.boxMargin, Math.max);
      };
    }
    this.sequenceItems.forEach(o());
  },
  insert: function(t, e, n, i) {
    const r = Math.min(t, n), s = Math.max(t, n), a = Math.min(e, i), o = Math.max(e, i);
    this.updateVal(ii.data, "startx", r, Math.min), this.updateVal(ii.data, "starty", a, Math.min), this.updateVal(ii.data, "stopx", s, Math.max), this.updateVal(ii.data, "stopy", o, Math.max), this.updateBounds(r, a, s, o);
  },
  bumpVerticalPos: function(t) {
    this.verticalPos = this.verticalPos + t, this.data.stopy = this.verticalPos;
  },
  getVerticalPos: function() {
    return this.verticalPos;
  },
  getBounds: function() {
    return this.data;
  }
}, _d = Eh.sectionFills, py = Eh.sectionColours, JK = function(t, e, n) {
  const i = Q().journey;
  let r = "";
  const s = i.height * 2 + i.diagramMarginY, a = n + s;
  let o = 0, l = "#CCC", u = "black", h = 0;
  for (const [f, d] of e.entries()) {
    if (r !== d.section) {
      l = _d[o % _d.length], h = o % _d.length, u = py[o % py.length];
      let y = 0;
      const m = d.section;
      for (let T = f; T < e.length && e[T].section == m; T++)
        y = y + 1;
      const _ = {
        x: f * i.taskMargin + f * i.width + is,
        y: 50,
        text: d.section,
        fill: l,
        num: h,
        colour: u,
        taskCount: y
      };
      ml.drawSection(t, _, i), r = d.section, o++;
    }
    const p = d.people.reduce((y, m) => (pr[m] && (y[m] = pr[m]), y), {});
    d.x = f * i.taskMargin + f * i.width + is, d.y = a, d.width = i.diagramMarginX, d.height = i.diagramMarginY, d.colour = u, d.fill = l, d.num = h, d.actors = p, ml.drawTask(t, d, i), ii.insert(d.x, d.y, d.x + d.width + i.taskMargin, 450);
  }
}, gy = {
  setConf: KK,
  draw: ZK
}, tQ = {
  parser: NK,
  db: dy,
  renderer: gy,
  styles: YK,
  init: (t) => {
    gy.setConf(t.journey), dy.clear();
  }
}, eQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: tQ
}, Symbol.toStringTag, { value: "Module" })), nQ = (t, e, n) => {
  const { parentById: i } = n, r = /* @__PURE__ */ new Set();
  let s = t;
  for (; s; ) {
    if (r.add(s), s === e)
      return s;
    s = i[s];
  }
  for (s = e; s; ) {
    if (r.has(s))
      return s;
    s = i[s];
  }
  return "root";
}, yy = new sk();
let ni = {};
const iQ = {};
let xr = {};
const rQ = async function(t, e, n, i, r, s, a) {
  const l = n.select(`[id="${e}"]`).insert("g").attr("class", "nodes"), u = Object.keys(t);
  return await Promise.all(
    u.map(async function(h) {
      const f = t[h];
      let d = "default";
      f.classes.length > 0 && (d = f.classes.join(" ")), d = d + " flowchart-label";
      const p = $n(f.styles);
      let y = f.text !== void 0 ? f.text : f.id;
      const m = { width: 0, height: 0 }, _ = [
        {
          id: f.id + "-west",
          layoutOptions: {
            "port.side": "WEST"
          }
        },
        {
          id: f.id + "-east",
          layoutOptions: {
            "port.side": "EAST"
          }
        },
        {
          id: f.id + "-south",
          layoutOptions: {
            "port.side": "SOUTH"
          }
        },
        {
          id: f.id + "-north",
          layoutOptions: {
            "port.side": "NORTH"
          }
        }
      ];
      let T = 0, v = "", A = {};
      switch (f.type) {
        case "round":
          T = 5, v = "rect";
          break;
        case "square":
          v = "rect";
          break;
        case "diamond":
          v = "question", A = {
            portConstraints: "FIXED_SIDE"
          };
          break;
        case "hexagon":
          v = "hexagon";
          break;
        case "odd":
          v = "rect_left_inv_arrow";
          break;
        case "lean_right":
          v = "lean_right";
          break;
        case "lean_left":
          v = "lean_left";
          break;
        case "trapezoid":
          v = "trapezoid";
          break;
        case "inv_trapezoid":
          v = "inv_trapezoid";
          break;
        case "odd_right":
          v = "rect_left_inv_arrow";
          break;
        case "circle":
          v = "circle";
          break;
        case "ellipse":
          v = "ellipse";
          break;
        case "stadium":
          v = "stadium";
          break;
        case "subroutine":
          v = "subroutine";
          break;
        case "cylinder":
          v = "cylinder";
          break;
        case "group":
          v = "rect";
          break;
        case "doublecircle":
          v = "doublecircle";
          break;
        default:
          v = "rect";
      }
      const L = {
        labelStyle: p.labelStyle,
        shape: v,
        labelText: y,
        labelType: f.labelType,
        rx: T,
        ry: T,
        class: d,
        style: p.style,
        id: f.id,
        link: f.link,
        linkTarget: f.linkTarget,
        tooltip: r.db.getTooltip(f.id) || "",
        domId: r.db.lookUpDomId(f.id),
        haveCallback: f.haveCallback,
        width: f.type === "group" ? 500 : void 0,
        dir: f.dir,
        type: f.type,
        props: f.props,
        padding: Ee().flowchart.padding
      };
      let w, b;
      if (L.type !== "group")
        b = await _h(l, L, f.dir), w = b.node().getBBox();
      else {
        i.createElementNS("http://www.w3.org/2000/svg", "text");
        const { shapeSvg: S, bbox: x } = await Xe(l, L, void 0, !0);
        m.width = x.width, m.wrappingWidth = Ee().flowchart.wrappingWidth, m.height = x.height, m.labelNode = S.node(), L.labelData = m;
      }
      const F = {
        id: f.id,
        ports: f.type === "diamond" ? _ : [],
        // labelStyle: styles.labelStyle,
        // shape: _shape,
        layoutOptions: A,
        labelText: y,
        labelData: m,
        // labels: [{ text: vertexText }],
        // rx: radius,
        // ry: radius,
        // class: classStr,
        // style: styles.style,
        // link: vertex.link,
        // linkTarget: vertex.linkTarget,
        // tooltip: diagObj.db.getTooltip(vertex.id) || '',
        domId: r.db.lookUpDomId(f.id),
        // haveCallback: vertex.haveCallback,
        width: w?.width,
        height: w?.height,
        // dir: vertex.dir,
        type: f.type,
        // props: vertex.props,
        // padding: getConfig().flowchart.padding,
        // boundingBox,
        el: b,
        parent: s.parentById[f.id]
      };
      xr[L.id] = F;
    })
  ), a;
}, my = (t, e, n) => {
  const i = {
    TB: {
      in: {
        north: "north"
      },
      out: {
        south: "west",
        west: "east",
        east: "south"
      }
    },
    LR: {
      in: {
        west: "west"
      },
      out: {
        east: "south",
        south: "north",
        north: "east"
      }
    },
    RL: {
      in: {
        east: "east"
      },
      out: {
        west: "north",
        north: "south",
        south: "west"
      }
    },
    BT: {
      in: {
        south: "south"
      },
      out: {
        north: "east",
        east: "west",
        west: "north"
      }
    }
  };
  return i.TD = i.TB, i[n][e][t];
}, xy = (t, e, n) => {
  if (z.info("getNextPort", { node: t, edgeDirection: e, graphDirection: n }), !ni[t])
    switch (n) {
      case "TB":
      case "TD":
        ni[t] = {
          inPosition: "north",
          outPosition: "south"
        };
        break;
      case "BT":
        ni[t] = {
          inPosition: "south",
          outPosition: "north"
        };
        break;
      case "RL":
        ni[t] = {
          inPosition: "east",
          outPosition: "west"
        };
        break;
      case "LR":
        ni[t] = {
          inPosition: "west",
          outPosition: "east"
        };
        break;
    }
  const i = e === "in" ? ni[t].inPosition : ni[t].outPosition;
  return e === "in" ? ni[t].inPosition = my(
    ni[t].inPosition,
    e,
    n
  ) : ni[t].outPosition = my(
    ni[t].outPosition,
    e,
    n
  ), i;
}, sQ = (t, e) => {
  let n = t.start, i = t.end;
  const r = n, s = i, a = xr[n], o = xr[i];
  return !a || !o ? { source: n, target: i } : (a.type === "diamond" && (n = `${n}-${xy(n, "out", e)}`), o.type === "diamond" && (i = `${i}-${xy(i, "in", e)}`), { source: n, target: i, sourceId: r, targetId: s });
}, aQ = function(t, e, n, i) {
  z.info("abc78 edges = ", t);
  const r = i.insert("g").attr("class", "edgeLabels");
  let s = {}, a = e.db.getDirection(), o, l;
  if (t.defaultStyle !== void 0) {
    const u = $n(t.defaultStyle);
    o = u.style, l = u.labelStyle;
  }
  return t.forEach(function(u) {
    const h = "L-" + u.start + "-" + u.end;
    s[h] === void 0 ? (s[h] = 0, z.info("abc78 new entry", h, s[h])) : (s[h]++, z.info("abc78 new entry", h, s[h]));
    let f = h + "-" + s[h];
    z.info("abc78 new link id to be used is", h, f, s[h]);
    const d = "LS-" + u.start, p = "LE-" + u.end, y = { style: "", labelStyle: "" };
    switch (y.minlen = u.length || 1, u.type === "arrow_open" ? y.arrowhead = "none" : y.arrowhead = "normal", y.arrowTypeStart = "arrow_open", y.arrowTypeEnd = "arrow_open", u.type) {
      case "double_arrow_cross":
        y.arrowTypeStart = "arrow_cross";
      case "arrow_cross":
        y.arrowTypeEnd = "arrow_cross";
        break;
      case "double_arrow_point":
        y.arrowTypeStart = "arrow_point";
      case "arrow_point":
        y.arrowTypeEnd = "arrow_point";
        break;
      case "double_arrow_circle":
        y.arrowTypeStart = "arrow_circle";
      case "arrow_circle":
        y.arrowTypeEnd = "arrow_circle";
        break;
    }
    let m = "", _ = "";
    switch (u.stroke) {
      case "normal":
        m = "fill:none;", o !== void 0 && (m = o), l !== void 0 && (_ = l), y.thickness = "normal", y.pattern = "solid";
        break;
      case "dotted":
        y.thickness = "normal", y.pattern = "dotted", y.style = "fill:none;stroke-width:2px;stroke-dasharray:3;";
        break;
      case "thick":
        y.thickness = "thick", y.pattern = "solid", y.style = "stroke-width: 3.5px;fill:none;";
        break;
    }
    if (u.style !== void 0) {
      const b = $n(u.style);
      m = b.style, _ = b.labelStyle;
    }
    y.style = y.style += m, y.labelStyle = y.labelStyle += _, u.interpolate !== void 0 ? y.curve = oi(u.interpolate, bn) : t.defaultInterpolate !== void 0 ? y.curve = oi(t.defaultInterpolate, bn) : y.curve = oi(iQ.curve, bn), u.text === void 0 ? u.style !== void 0 && (y.arrowheadStyle = "fill: #333") : (y.arrowheadStyle = "fill: #333", y.labelpos = "c"), y.labelType = u.labelType, y.label = u.text.replace(bt.lineBreakRegex, `
`), u.style === void 0 && (y.style = y.style || "stroke: #333; stroke-width: 1.5px;fill:none;"), y.labelStyle = y.labelStyle.replace("color:", "fill:"), y.id = f, y.classes = "flowchart-link " + d + " " + p;
    const T = p0(r, y), { source: v, target: A, sourceId: L, targetId: w } = sQ(u, a);
    z.debug("abc78 source and target", v, A), n.edges.push({
      id: "e" + u.start + u.end,
      sources: [v],
      targets: [A],
      sourceId: L,
      targetId: w,
      labelEl: T,
      labels: [
        {
          width: y.width,
          height: y.height,
          orgWidth: y.width,
          orgHeight: y.height,
          text: y.label,
          layoutOptions: {
            "edgeLabels.inline": "true",
            "edgeLabels.placement": "CENTER"
          }
        }
      ],
      edgeData: y
    });
  }), n;
}, oQ = function(t, e, n, i, r) {
  let s = "";
  i && (s = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, s = s.replace(/\(/g, "\\("), s = s.replace(/\)/g, "\\)")), I4(t, e, s, r, n);
}, lQ = function(t, e) {
  return z.info("Extracting classes"), e.db.getClasses();
}, cQ = function(t) {
  const e = { parentById: {}, childrenById: {} }, n = t.getSubGraphs();
  return z.info("Subgraphs - ", n), n.forEach(function(i) {
    i.nodes.forEach(function(r) {
      e.parentById[r] = i.id, e.childrenById[i.id] === void 0 && (e.childrenById[i.id] = []), e.childrenById[i.id].push(r);
    });
  }), n.forEach(function(i) {
    i.id, e.parentById[i.id] !== void 0 && e.parentById[i.id];
  }), e;
}, uQ = function(t, e, n) {
  const i = nQ(t, e, n);
  if (i === void 0 || i === "root")
    return { x: 0, y: 0 };
  const r = xr[i].offset;
  return { x: r.posX, y: r.posY };
}, hQ = function(t, e, n, i, r, s) {
  const a = uQ(e.sourceId, e.targetId, r), o = e.sections[0].startPoint, l = e.sections[0].endPoint, h = (e.sections[0].bendPoints ? e.sections[0].bendPoints : []).map((A) => [A.x + a.x, A.y + a.y]), f = [
    [o.x + a.x, o.y + a.y],
    ...h,
    [l.x + a.x, l.y + a.y]
  ], { x: d, y: p } = L4(e.edgeData), y = Tr().x(d).y(p).curve(bn), m = t.insert("path").attr("d", y(f)).attr("class", "path " + n.classes).attr("fill", "none"), _ = t.insert("g").attr("class", "edgeLabel"), T = yt(_.node().appendChild(e.labelEl)), v = T.node().firstChild.getBoundingClientRect();
  T.attr("width", v.width), T.attr("height", v.height), _.attr(
    "transform",
    `translate(${e.labels[0].x + a.x}, ${e.labels[0].y + a.y})`
  ), oQ(m, n, i.type, i.arrowMarkerAbsolute, s);
}, A5 = (t, e) => {
  t.forEach((n) => {
    n.children || (n.children = []);
    const i = e.childrenById[n.id];
    i && i.forEach((r) => {
      n.children.push(xr[r]);
    }), A5(n.children, e);
  });
}, dQ = async function(t, e, n, i) {
  var r;
  i.db.clear(), xr = {}, ni = {}, i.db.setGen("gen-2"), i.parser.parse(t);
  const s = yt("body").append("div").attr("style", "height:400px").attr("id", "cy");
  let a = {
    id: "root",
    layoutOptions: {
      "elk.hierarchyHandling": "INCLUDE_CHILDREN",
      "org.eclipse.elk.padding": "[top=100, left=100, bottom=110, right=110]",
      "elk.layered.spacing.edgeNodeBetweenLayers": "30",
      // 'elk.layered.mergeEdges': 'true',
      "elk.direction": "DOWN"
      // 'elk.ports.sameLayerEdges': true,
      // 'nodePlacement.strategy': 'SIMPLE',
    },
    children: [],
    edges: []
  };
  switch (z.info("Drawing flowchart using v3 renderer", yy), i.db.getDirection()) {
    case "BT":
      a.layoutOptions["elk.direction"] = "UP";
      break;
    case "TB":
      a.layoutOptions["elk.direction"] = "DOWN";
      break;
    case "LR":
      a.layoutOptions["elk.direction"] = "RIGHT";
      break;
    case "RL":
      a.layoutOptions["elk.direction"] = "LEFT";
      break;
  }
  const { securityLevel: l, flowchart: u } = Ee();
  let h;
  l === "sandbox" && (h = yt("#i" + e));
  const f = yt(l === "sandbox" ? h.nodes()[0].contentDocument.body : "body"), d = l === "sandbox" ? h.nodes()[0].contentDocument : document, p = f.select(`[id="${e}"]`);
  d0(p, ["point", "circle", "cross"], i.type, e);
  const m = i.db.getVertices();
  let _;
  const T = i.db.getSubGraphs();
  z.info("Subgraphs - ", T);
  for (let S = T.length - 1; S >= 0; S--)
    _ = T[S], i.db.addVertex(
      _.id,
      { text: _.title, type: _.labelType },
      "group",
      void 0,
      _.classes,
      _.dir
    );
  const v = p.insert("g").attr("class", "subgraphs"), A = cQ(i.db);
  a = await rQ(m, e, f, d, i, A, a);
  const L = p.insert("g").attr("class", "edges edgePath"), w = i.db.getEdges();
  a = aQ(w, i, a, p), Object.keys(xr).forEach((S) => {
    const x = xr[S];
    x.parent || a.children.push(x), A.childrenById[S] !== void 0 && (x.labels = [
      {
        text: x.labelText,
        layoutOptions: {
          "nodeLabels.placement": "[H_CENTER, V_TOP, INSIDE]"
        },
        width: x.labelData.width,
        height: x.labelData.height
        // width: 100,
        // height: 100,
      }
    ], delete x.x, delete x.y, delete x.width, delete x.height);
  }), A5(a.children, A), z.info("after layout", JSON.stringify(a, null, 2));
  const F = await yy.layout(a);
  L5(0, 0, F.children, p, v, i, 0), z.info("after layout", F), (r = F.edges) == null || r.map((S) => {
    hQ(L, S, S.edgeData, i, A, e);
  }), Wr({}, p, u.diagramPadding, u.useMaxWidth), s.remove();
}, L5 = (t, e, n, i, r, s, a) => {
  n.forEach(function(o) {
    if (o)
      if (xr[o.id].offset = {
        posX: o.x + t,
        posY: o.y + e,
        x: t,
        y: e,
        depth: a,
        width: o.width,
        height: o.height
      }, o.type === "group") {
        const l = r.insert("g").attr("class", "subgraph");
        l.insert("rect").attr("class", "subgraph subgraph-lvl-" + a % 5 + " node").attr("x", o.x + t).attr("y", o.y + e).attr("width", o.width).attr("height", o.height);
        const u = l.insert("g").attr("class", "label"), h = Ee().flowchart.htmlLabels ? o.labelData.width / 2 : 0;
        u.attr(
          "transform",
          `translate(${o.labels[0].x + t + o.x + h}, ${o.labels[0].y + e + o.y + 3})`
        ), u.node().appendChild(o.labelData.labelNode), z.info("Id (UGH)= ", o.type, o.labels);
      } else
        z.info("Id (UGH)= ", o.id), o.el.attr(
          "transform",
          `translate(${o.x + t + o.width / 2}, ${o.y + e + o.height / 2})`
        );
  }), n.forEach(function(o) {
    o && o.type === "group" && L5(t + o.x, e + o.y, o.children, i, r, s, a + 1);
  });
}, fQ = {
  getClasses: lQ,
  draw: dQ
}, pQ = (t) => {
  let e = "";
  for (let n = 0; n < 5; n++)
    e += `
      .subgraph-lvl-${n} {
        fill: ${t[`surface${n}`]};
        stroke: ${t[`surfacePeer${n}`]};
      }
    `;
  return e;
}, gQ = (t) => `.label {
    font-family: ${t.fontFamily};
    color: ${t.nodeTextColor || t.textColor};
  }
  .cluster-label text {
    fill: ${t.titleColor};
  }
  .cluster-label span {
    color: ${t.titleColor};
  }

  .label text,span {
    fill: ${t.nodeTextColor || t.textColor};
    color: ${t.nodeTextColor || t.textColor};
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
    stroke-width: 1px;
  }

  .node .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }

  .arrowheadPath {
    fill: ${t.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${t.lineColor};
    stroke-width: 2.0px;
  }

  .flowchart-link {
    stroke: ${t.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${t.edgeLabelBackground};
    rect {
      opacity: 0.85;
      background-color: ${t.edgeLabelBackground};
      fill: ${t.edgeLabelBackground};
    }
    text-align: center;
  }

  .cluster rect {
    fill: ${t.clusterBkg};
    stroke: ${t.clusterBorder};
    stroke-width: 1px;
  }

  .cluster text {
    fill: ${t.titleColor};
  }

  .cluster span {
    color: ${t.titleColor};
  }
  /* .cluster div {
    color: ${t.titleColor};
  } */

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: ${t.fontFamily};
    font-size: 12px;
    background: ${t.tertiaryColor};
    border: 1px solid ${t.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .flowchartTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.textColor};
  }
  .subgraph {
    stroke-width:2;
    rx:3;
  }
  // .subgraph-lvl-1 {
  //   fill:#ccc;
  //   // stroke:black;
  // }

  .flowchart-label text {
    text-anchor: middle;
  }

  ${pQ(t)}
`, yQ = gQ, mQ = {
  db: $N,
  renderer: fQ,
  parser: Yf,
  styles: yQ
}, xQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: mQ
}, Symbol.toStringTag, { value: "Module" }));
var G1 = (function() {
  var t = function(d, p, y, m) {
    for (y = y || {}, m = d.length; m--; y[d[m]] = p)
      ;
    return y;
  }, e = [6, 8, 10, 11, 12, 14, 16, 17, 20, 21], n = [1, 9], i = [1, 10], r = [1, 11], s = [1, 12], a = [1, 13], o = [1, 16], l = [1, 17], u = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, timeline: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, title: 11, acc_title: 12, acc_title_value: 13, acc_descr: 14, acc_descr_value: 15, acc_descr_multiline_value: 16, section: 17, period_statement: 18, event_statement: 19, period: 20, event: 21, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "timeline", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 11: "title", 12: "acc_title", 13: "acc_title_value", 14: "acc_descr", 15: "acc_descr_value", 16: "acc_descr_multiline_value", 17: "section", 20: "period", 21: "event" },
    productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 1], [18, 1], [19, 1]],
    performAction: function(p, y, m, _, T, v, A) {
      var L = v.length - 1;
      switch (T) {
        case 1:
          return v[L - 1];
        case 2:
          this.$ = [];
          break;
        case 3:
          v[L - 1].push(v[L]), this.$ = v[L - 1];
          break;
        case 4:
        case 5:
          this.$ = v[L];
          break;
        case 6:
        case 7:
          this.$ = [];
          break;
        case 8:
          _.getCommonDb().setDiagramTitle(v[L].substr(6)), this.$ = v[L].substr(6);
          break;
        case 9:
          this.$ = v[L].trim(), _.getCommonDb().setAccTitle(this.$);
          break;
        case 10:
        case 11:
          this.$ = v[L].trim(), _.getCommonDb().setAccDescription(this.$);
          break;
        case 12:
          _.addSection(v[L].substr(8)), this.$ = v[L].substr(8);
          break;
        case 15:
          _.addTask(v[L], 0, ""), this.$ = v[L];
          break;
        case 16:
          _.addEvent(v[L].substr(2)), this.$ = v[L];
          break;
      }
    },
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: n, 12: i, 14: r, 16: s, 17: a, 18: 14, 19: 15, 20: o, 21: l }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 18, 11: n, 12: i, 14: r, 16: s, 17: a, 18: 14, 19: 15, 20: o, 21: l }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 8]), { 13: [1, 19] }, { 15: [1, 20] }, t(e, [2, 11]), t(e, [2, 12]), t(e, [2, 13]), t(e, [2, 14]), t(e, [2, 15]), t(e, [2, 16]), t(e, [2, 4]), t(e, [2, 9]), t(e, [2, 10])],
    defaultActions: {},
    parseError: function(p, y) {
      if (y.recoverable)
        this.trace(p);
      else {
        var m = new Error(p);
        throw m.hash = y, m;
      }
    },
    parse: function(p) {
      var y = this, m = [0], _ = [], T = [null], v = [], A = this.table, L = "", w = 0, b = 0, F = 2, S = 1, x = v.slice.call(arguments, 1), C = Object.create(this.lexer), g = { yy: {} };
      for (var I in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, I) && (g.yy[I] = this.yy[I]);
      C.setInput(p, g.yy), g.yy.lexer = C, g.yy.parser = this, typeof C.yylloc > "u" && (C.yylloc = {});
      var k = C.yylloc;
      v.push(k);
      var P = C.options && C.options.ranges;
      typeof g.yy.parseError == "function" ? this.parseError = g.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function R() {
        var H;
        return H = _.pop() || C.lex() || S, typeof H != "number" && (H instanceof Array && (_ = H, H = _.pop()), H = y.symbols_[H] || H), H;
      }
      for (var M, B, N, D, E = {}, V, nt, O, ct; ; ) {
        if (B = m[m.length - 1], this.defaultActions[B] ? N = this.defaultActions[B] : ((M === null || typeof M > "u") && (M = R()), N = A[B] && A[B][M]), typeof N > "u" || !N.length || !N[0]) {
          var X = "";
          ct = [];
          for (V in A[B])
            this.terminals_[V] && V > F && ct.push("'" + this.terminals_[V] + "'");
          C.showPosition ? X = "Parse error on line " + (w + 1) + `:
` + C.showPosition() + `
Expecting ` + ct.join(", ") + ", got '" + (this.terminals_[M] || M) + "'" : X = "Parse error on line " + (w + 1) + ": Unexpected " + (M == S ? "end of input" : "'" + (this.terminals_[M] || M) + "'"), this.parseError(X, {
            text: C.match,
            token: this.terminals_[M] || M,
            line: C.yylineno,
            loc: k,
            expected: ct
          });
        }
        if (N[0] instanceof Array && N.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + B + ", token: " + M);
        switch (N[0]) {
          case 1:
            m.push(M), T.push(C.yytext), v.push(C.yylloc), m.push(N[1]), M = null, b = C.yyleng, L = C.yytext, w = C.yylineno, k = C.yylloc;
            break;
          case 2:
            if (nt = this.productions_[N[1]][1], E.$ = T[T.length - nt], E._$ = {
              first_line: v[v.length - (nt || 1)].first_line,
              last_line: v[v.length - 1].last_line,
              first_column: v[v.length - (nt || 1)].first_column,
              last_column: v[v.length - 1].last_column
            }, P && (E._$.range = [
              v[v.length - (nt || 1)].range[0],
              v[v.length - 1].range[1]
            ]), D = this.performAction.apply(E, [
              L,
              b,
              w,
              g.yy,
              N[1],
              T,
              v
            ].concat(x)), typeof D < "u")
              return D;
            nt && (m = m.slice(0, -1 * nt * 2), T = T.slice(0, -1 * nt), v = v.slice(0, -1 * nt)), m.push(this.productions_[N[1]][0]), T.push(E.$), v.push(E._$), O = A[m[m.length - 2]][m[m.length - 1]], m.push(O);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, h = /* @__PURE__ */ (function() {
    var d = {
      EOF: 1,
      parseError: function(y, m) {
        if (this.yy.parser)
          this.yy.parser.parseError(y, m);
        else
          throw new Error(y);
      },
      // resets the lexer, sets new input
      setInput: function(p, y) {
        return this.yy = y || this.yy || {}, this._input = p, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var p = this._input[0];
        this.yytext += p, this.yyleng++, this.offset++, this.match += p, this.matched += p;
        var y = p.match(/(?:\r\n?|\n).*/g);
        return y ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), p;
      },
      // unshifts one char (or a string) into the input
      unput: function(p) {
        var y = p.length, m = p.split(/(?:\r\n?|\n)/g);
        this._input = p + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - y), this.offset -= y;
        var _ = 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), m.length - 1 && (this.yylineno -= m.length - 1);
        var T = 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: m ? (m.length === _.length ? this.yylloc.first_column : 0) + _[_.length - m.length].length - m[0].length : this.yylloc.first_column - y
        }, this.options.ranges && (this.yylloc.range = [T[0], T[0] + this.yyleng - y]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(p) {
        this.unput(this.match.slice(p));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var p = this.matched.substr(0, this.matched.length - this.match.length);
        return (p.length > 20 ? "..." : "") + p.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var p = this.match;
        return p.length < 20 && (p += this._input.substr(0, 20 - p.length)), (p.substr(0, 20) + (p.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var p = this.pastInput(), y = new Array(p.length + 1).join("-");
        return p + this.upcomingInput() + `
` + y + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(p, y) {
        var m, _, T;
        if (this.options.backtrack_lexer && (T = {
          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 && (T.yylloc.range = this.yylloc.range.slice(0))), _ = p[0].match(/(?:\r\n?|\n).*/g), _ && (this.yylineno += _.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: _ ? _[_.length - 1].length - _[_.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + p[0].length
        }, this.yytext += p[0], this.match += p[0], this.matches = p, 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(p[0].length), this.matched += p[0], m = this.performAction.call(this, this.yy, this, y, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), m)
          return m;
        if (this._backtrack) {
          for (var v in T)
            this[v] = T[v];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var p, y, m, _;
        this._more || (this.yytext = "", this.match = "");
        for (var T = this._currentRules(), v = 0; v < T.length; v++)
          if (m = this._input.match(this.rules[T[v]]), m && (!y || m[0].length > y[0].length)) {
            if (y = m, _ = v, this.options.backtrack_lexer) {
              if (p = this.test_match(m, T[v]), p !== !1)
                return p;
              if (this._backtrack) {
                y = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return y ? (p = this.test_match(y, T[_]), p !== !1 ? p : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var y = this.next();
        return y || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(y) {
        this.conditionStack.push(y);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var y = this.conditionStack.length - 1;
        return y > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(y) {
        return y = this.conditionStack.length - 1 - Math.abs(y || 0), y >= 0 ? this.conditionStack[y] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(y) {
        this.begin(y);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(y, m, _, T) {
        switch (_) {
          case 0:
            break;
          case 1:
            break;
          case 2:
            return 10;
          case 3:
            break;
          case 4:
            break;
          case 5:
            return 4;
          case 6:
            return 11;
          case 7:
            return this.begin("acc_title"), 12;
          case 8:
            return this.popState(), "acc_title_value";
          case 9:
            return this.begin("acc_descr"), 14;
          case 10:
            return this.popState(), "acc_descr_value";
          case 11:
            this.begin("acc_descr_multiline");
            break;
          case 12:
            this.popState();
            break;
          case 13:
            return "acc_descr_multiline_value";
          case 14:
            return 17;
          case 15:
            return 21;
          case 16:
            return 20;
          case 17:
            return 6;
          case 18:
            return "INVALID";
        }
      },
      rules: [/^(?:%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:#[^\n]*)/i, /^(?:timeline\b)/i, /^(?:title\s[^#\n;]+)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:section\s[^#:\n;]+)/i, /^(?::\s[^#:\n;]+)/i, /^(?:[^#:\n;]+)/i, /^(?:$)/i, /^(?:.)/i],
      conditions: { acc_descr_multiline: { rules: [12, 13], inclusive: !1 }, acc_descr: { rules: [10], inclusive: !1 }, acc_title: { rules: [8], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 14, 15, 16, 17, 18], inclusive: !0 } }
    };
    return d;
  })();
  u.lexer = h;
  function f() {
    this.yy = {};
  }
  return f.prototype = u, u.Parser = f, new f();
})();
G1.parser = G1;
const bQ = G1;
let Ma = "", I5 = 0;
const W0 = [], Iu = [], Pa = [], B5 = () => cb, D5 = function() {
  W0.length = 0, Iu.length = 0, Ma = "", Pa.length = 0, fn();
}, N5 = function(t) {
  Ma = t, W0.push(t);
}, F5 = function() {
  return W0;
}, O5 = function() {
  let t = by();
  const e = 100;
  let n = 0;
  for (; !t && n < e; )
    t = by(), n++;
  return Iu.push(...Pa), Iu;
}, R5 = function(t, e, n) {
  const i = {
    id: I5++,
    section: Ma,
    type: Ma,
    task: t,
    score: e || 0,
    //if event is defined, then add it the events array
    events: n ? [n] : []
  };
  Pa.push(i);
}, M5 = function(t) {
  Pa.find((n) => n.id === I5 - 1).events.push(t);
}, P5 = function(t) {
  const e = {
    section: Ma,
    type: Ma,
    description: t,
    task: t,
    classes: []
  };
  Iu.push(e);
}, by = function() {
  const t = function(n) {
    return Pa[n].processed;
  };
  let e = !0;
  for (const [n, i] of Pa.entries())
    t(n), e = e && i.processed;
  return e;
}, _Q = {
  clear: D5,
  getCommonDb: B5,
  addSection: N5,
  getSections: F5,
  getTasks: O5,
  addTask: R5,
  addTaskOrg: P5,
  addEvent: M5
}, kQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  addEvent: M5,
  addSection: N5,
  addTask: R5,
  addTaskOrg: P5,
  clear: D5,
  default: _Q,
  getCommonDb: B5,
  getSections: F5,
  getTasks: O5
}, Symbol.toStringTag, { value: "Module" })), TQ = 12, Ch = function(t, e) {
  const n = t.append("rect");
  return n.attr("x", e.x), n.attr("y", e.y), n.attr("fill", e.fill), n.attr("stroke", e.stroke), n.attr("width", e.width), n.attr("height", e.height), n.attr("rx", e.rx), n.attr("ry", e.ry), e.class !== void 0 && n.attr("class", e.class), n;
}, wQ = function(t, e) {
  const i = t.append("circle").attr("cx", e.cx).attr("cy", e.cy).attr("class", "face").attr("r", 15).attr("stroke-width", 2).attr("overflow", "visible"), r = t.append("g");
  r.append("circle").attr("cx", e.cx - 15 / 3).attr("cy", e.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666"), r.append("circle").attr("cx", e.cx + 15 / 3).attr("cy", e.cy - 15 / 3).attr("r", 1.5).attr("stroke-width", 2).attr("fill", "#666").attr("stroke", "#666");
  function s(l) {
    const u = ba().startAngle(Math.PI / 2).endAngle(3 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
    l.append("path").attr("class", "mouth").attr("d", u).attr("transform", "translate(" + e.cx + "," + (e.cy + 2) + ")");
  }
  function a(l) {
    const u = ba().startAngle(3 * Math.PI / 2).endAngle(5 * (Math.PI / 2)).innerRadius(7.5).outerRadius(6.8181818181818175);
    l.append("path").attr("class", "mouth").attr("d", u).attr("transform", "translate(" + e.cx + "," + (e.cy + 7) + ")");
  }
  function o(l) {
    l.append("line").attr("class", "mouth").attr("stroke", 2).attr("x1", e.cx - 5).attr("y1", e.cy + 7).attr("x2", e.cx + 5).attr("y2", e.cy + 7).attr("class", "mouth").attr("stroke-width", "1px").attr("stroke", "#666");
  }
  return e.score > 3 ? s(r) : e.score < 3 ? a(r) : o(r), i;
}, vQ = function(t, e) {
  const n = t.append("circle");
  return n.attr("cx", e.cx), n.attr("cy", e.cy), n.attr("class", "actor-" + e.pos), n.attr("fill", e.fill), n.attr("stroke", e.stroke), n.attr("r", e.r), n.class !== void 0 && n.attr("class", n.class), e.title !== void 0 && n.append("title").text(e.title), n;
}, z5 = function(t, e) {
  const n = e.text.replace(/<br\s*\/?>/gi, " "), i = t.append("text");
  i.attr("x", e.x), i.attr("y", e.y), i.attr("class", "legend"), i.style("text-anchor", e.anchor), e.class !== void 0 && i.attr("class", e.class);
  const r = i.append("tspan");
  return r.attr("x", e.x + e.textMargin * 2), r.text(n), i;
}, EQ = function(t, e) {
  function n(r, s, a, o, l) {
    return r + "," + s + " " + (r + a) + "," + s + " " + (r + a) + "," + (s + o - l) + " " + (r + a - l * 1.2) + "," + (s + o) + " " + r + "," + (s + o);
  }
  const i = t.append("polygon");
  i.attr("points", n(e.x, e.y, 50, 20, 7)), i.attr("class", "labelBox"), e.y = e.y + e.labelMargin, e.x = e.x + 0.5 * e.labelMargin, z5(t, e);
}, CQ = function(t, e, n) {
  const i = t.append("g"), r = U0();
  r.x = e.x, r.y = e.y, r.fill = e.fill, r.width = n.width, r.height = n.height, r.class = "journey-section section-type-" + e.num, r.rx = 3, r.ry = 3, Ch(i, r), V5(n)(
    e.text,
    i,
    r.x,
    r.y,
    r.width,
    r.height,
    { class: "journey-section section-type-" + e.num },
    n,
    e.colour
  );
};
let _y = -1;
const SQ = function(t, e, n) {
  const i = e.x + n.width / 2, r = t.append("g");
  _y++, r.append("line").attr("id", "task" + _y).attr("x1", i).attr("y1", e.y).attr("x2", i).attr("y2", 450).attr("class", "task-line").attr("stroke-width", "1px").attr("stroke-dasharray", "4 2").attr("stroke", "#666"), wQ(r, {
    cx: i,
    cy: 300 + (5 - e.score) * 30,
    score: e.score
  });
  const a = U0();
  a.x = e.x, a.y = e.y, a.fill = e.fill, a.width = n.width, a.height = n.height, a.class = "task task-type-" + e.num, a.rx = 3, a.ry = 3, Ch(r, a), e.x + 14, V5(n)(
    e.task,
    r,
    a.x,
    a.y,
    a.width,
    a.height,
    { class: "task" },
    n,
    e.colour
  );
}, AQ = function(t, e) {
  Ch(t, {
    x: e.startx,
    y: e.starty,
    width: e.stopx - e.startx,
    height: e.stopy - e.starty,
    fill: e.fill,
    class: "rect"
  }).lower();
}, LQ = function() {
  return {
    x: 0,
    y: 0,
    fill: void 0,
    "text-anchor": "start",
    width: 100,
    height: 100,
    textMargin: 0,
    rx: 0,
    ry: 0
  };
}, U0 = function() {
  return {
    x: 0,
    y: 0,
    width: 100,
    anchor: "start",
    height: 100,
    rx: 0,
    ry: 0
  };
}, V5 = /* @__PURE__ */ (function() {
  function t(r, s, a, o, l, u, h, f) {
    const d = s.append("text").attr("x", a + l / 2).attr("y", o + u / 2 + 5).style("font-color", f).style("text-anchor", "middle").text(r);
    i(d, h);
  }
  function e(r, s, a, o, l, u, h, f, d) {
    const { taskFontSize: p, taskFontFamily: y } = f, m = r.split(/<br\s*\/?>/gi);
    for (let _ = 0; _ < m.length; _++) {
      const T = _ * p - p * (m.length - 1) / 2, v = s.append("text").attr("x", a + l / 2).attr("y", o).attr("fill", d).style("text-anchor", "middle").style("font-size", p).style("font-family", y);
      v.append("tspan").attr("x", a + l / 2).attr("dy", T).text(m[_]), v.attr("y", o + u / 2).attr("dominant-baseline", "central").attr("alignment-baseline", "central"), i(v, h);
    }
  }
  function n(r, s, a, o, l, u, h, f) {
    const d = s.append("switch"), y = d.append("foreignObject").attr("x", a).attr("y", o).attr("width", l).attr("height", u).attr("position", "fixed").append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%");
    y.append("div").attr("class", "label").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(r), e(r, d, a, o, l, u, h, f), i(y, h);
  }
  function i(r, s) {
    for (const a in s)
      a in s && r.attr(a, s[a]);
  }
  return function(r) {
    return r.textPlacement === "fo" ? n : r.textPlacement === "old" ? t : e;
  };
})(), IQ = function(t) {
  t.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 5).attr("refY", 2).attr("markerWidth", 6).attr("markerHeight", 4).attr("orient", "auto").append("path").attr("d", "M 0,0 V 4 L6,2 Z");
};
function q5(t, e) {
  t.each(function() {
    var n = yt(this), i = n.text().split(/(\s+|<br>)/).reverse(), r, s = [], a = 1.1, o = n.attr("y"), l = parseFloat(n.attr("dy")), u = n.text(null).append("tspan").attr("x", 0).attr("y", o).attr("dy", l + "em");
    for (let h = 0; h < i.length; h++)
      r = i[i.length - 1 - h], s.push(r), u.text(s.join(" ").trim()), (u.node().getComputedTextLength() > e || r === "<br>") && (s.pop(), u.text(s.join(" ").trim()), r === "<br>" ? s = [""] : s = [r], u = n.append("tspan").attr("x", 0).attr("y", o).attr("dy", a + "em").text(r));
  });
}
const BQ = function(t, e, n, i) {
  const r = n % TQ - 1, s = t.append("g");
  e.section = r, s.attr(
    "class",
    (e.class ? e.class + " " : "") + "timeline-node " + ("section-" + r)
  );
  const a = s.append("g"), o = s.append("g"), u = o.append("text").text(e.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(q5, e.width).node().getBBox(), h = i.fontSize && i.fontSize.replace ? i.fontSize.replace("px", "") : i.fontSize;
  return e.height = u.height + h * 1.1 * 0.5 + e.padding, e.height = Math.max(e.height, e.maxHeight), e.width = e.width + 2 * e.padding, o.attr("transform", "translate(" + e.width / 2 + ", " + e.padding / 2 + ")"), NQ(a, e, r), e;
}, DQ = function(t, e, n) {
  const i = t.append("g"), s = i.append("text").text(e.descr).attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle").call(q5, e.width).node().getBBox(), a = n.fontSize && n.fontSize.replace ? n.fontSize.replace("px", "") : n.fontSize;
  return i.remove(), s.height + a * 1.1 * 0.5 + e.padding;
}, NQ = function(t, e, n) {
  t.append("path").attr("id", "node-" + e.id).attr("class", "node-bkg node-" + e.type).attr(
    "d",
    `M0 ${e.height - 5} v${-e.height + 10} q0,-5 5,-5 h${e.width - 10} q5,0 5,5 v${e.height - 5} H0 Z`
  ), t.append("line").attr("class", "node-line-" + n).attr("x1", 0).attr("y1", e.height).attr("x2", e.width).attr("y2", e.height);
}, rs = {
  drawRect: Ch,
  drawCircle: vQ,
  drawSection: CQ,
  drawText: z5,
  drawLabel: EQ,
  drawTask: SQ,
  drawBackgroundRect: AQ,
  getTextObj: LQ,
  getNoteRect: U0,
  initGraphics: IQ,
  drawNode: BQ,
  getVirtualNodeHeight: DQ
}, FQ = function(t, e, n, i) {
  var r, s;
  const a = Q(), o = a.leftMargin ?? 50;
  z.debug("timeline", i.db);
  const l = a.securityLevel;
  let u;
  l === "sandbox" && (u = yt("#i" + e));
  const f = yt(l === "sandbox" ? u.nodes()[0].contentDocument.body : "body").select("#" + e);
  f.append("g");
  const d = i.db.getTasks(), p = i.db.getCommonDb().getDiagramTitle();
  z.debug("task", d), rs.initGraphics(f);
  const y = i.db.getSections();
  z.debug("sections", y);
  let m = 0, _ = 0, T = 0, v = 0, A = 50 + o, L = 50;
  v = 50;
  let w = 0, b = !0;
  y.forEach(function(g) {
    const I = {
      number: w,
      descr: g,
      section: w,
      width: 150,
      padding: 20,
      maxHeight: m
    }, k = rs.getVirtualNodeHeight(f, I, a);
    z.debug("sectionHeight before draw", k), m = Math.max(m, k + 20);
  });
  let F = 0, S = 0;
  z.debug("tasks.length", d.length);
  for (const [g, I] of d.entries()) {
    const k = {
      number: g,
      descr: I,
      section: I.section,
      width: 150,
      padding: 20,
      maxHeight: _
    }, P = rs.getVirtualNodeHeight(f, k, a);
    z.debug("taskHeight before draw", P), _ = Math.max(_, P + 20), F = Math.max(F, I.events.length);
    let R = 0;
    for (let M = 0; M < I.events.length; M++) {
      const N = {
        descr: I.events[M],
        section: I.section,
        number: I.section,
        width: 150,
        padding: 20,
        maxHeight: 50
      };
      R += rs.getVirtualNodeHeight(f, N, a);
    }
    S = Math.max(S, R);
  }
  z.debug("maxSectionHeight before draw", m), z.debug("maxTaskHeight before draw", _), y && y.length > 0 ? y.forEach((g) => {
    const I = d.filter((M) => M.section === g), k = {
      number: w,
      descr: g,
      section: w,
      width: 200 * Math.max(I.length, 1) - 50,
      padding: 20,
      maxHeight: m
    };
    z.debug("sectionNode", k);
    const P = f.append("g"), R = rs.drawNode(P, k, w, a);
    z.debug("sectionNode output", R), P.attr("transform", `translate(${A}, ${v})`), L += m + 50, I.length > 0 && ky(
      f,
      I,
      w,
      A,
      L,
      _,
      a,
      F,
      S,
      m,
      !1
    ), A += 200 * Math.max(I.length, 1), L = v, w++;
  }) : (b = !1, ky(
    f,
    d,
    w,
    A,
    L,
    _,
    a,
    F,
    S,
    m,
    !0
  ));
  const x = f.node().getBBox();
  z.debug("bounds", x), p && f.append("text").text(p).attr("x", x.width / 2 - o).attr("font-size", "4ex").attr("font-weight", "bold").attr("y", 20), T = b ? m + _ + 150 : _ + 100, f.append("g").attr("class", "lineWrapper").append("line").attr("x1", o).attr("y1", T).attr("x2", x.width + 3 * o).attr("y2", T).attr("stroke-width", 4).attr("stroke", "black").attr("marker-end", "url(#arrowhead)"), Wr(
    void 0,
    f,
    ((r = a.timeline) == null ? void 0 : r.padding) ?? 50,
    ((s = a.timeline) == null ? void 0 : s.useMaxWidth) ?? !1
  );
}, ky = function(t, e, n, i, r, s, a, o, l, u, h) {
  var f;
  for (const d of e) {
    const p = {
      descr: d.task,
      section: n,
      number: n,
      width: 150,
      padding: 20,
      maxHeight: s
    };
    z.debug("taskNode", p);
    const y = t.append("g").attr("class", "taskWrapper"), _ = rs.drawNode(y, p, n, a).height;
    if (z.debug("taskHeight after draw", _), y.attr("transform", `translate(${i}, ${r})`), s = Math.max(s, _), d.events) {
      const T = t.append("g").attr("class", "lineWrapper");
      let v = s;
      r += 100, v = v + OQ(t, d.events, n, i, r, a), r -= 100, T.append("line").attr("x1", i + 190 / 2).attr("y1", r + s).attr("x2", i + 190 / 2).attr(
        "y2",
        r + s + (h ? s : u) + l + 120
      ).attr("stroke-width", 2).attr("stroke", "black").attr("marker-end", "url(#arrowhead)").attr("stroke-dasharray", "5,5");
    }
    i = i + 200, h && !((f = a.timeline) != null && f.disableMulticolor) && n++;
  }
  r = r - 10;
}, OQ = function(t, e, n, i, r, s) {
  let a = 0;
  const o = r;
  r = r + 100;
  for (const l of e) {
    const u = {
      descr: l,
      section: n,
      number: n,
      width: 150,
      padding: 20,
      maxHeight: 50
    };
    z.debug("eventNode", u);
    const h = t.append("g").attr("class", "eventWrapper"), d = rs.drawNode(h, u, n, s).height;
    a = a + d, h.attr("transform", `translate(${i}, ${r})`), r = r + 10 + d;
  }
  return r = o, a;
}, RQ = {
  setConf: () => {
  },
  draw: FQ
}, MQ = (t) => {
  let e = "";
  for (let n = 0; n < t.THEME_COLOR_LIMIT; n++)
    t["lineColor" + n] = t["lineColor" + n] || t["cScaleInv" + n], Ds(t["lineColor" + n]) ? t["lineColor" + n] = Nt(t["lineColor" + n], 20) : t["lineColor" + n] = Ot(t["lineColor" + n], 20);
  for (let n = 0; n < t.THEME_COLOR_LIMIT; n++) {
    const i = "" + (17 - 3 * n);
    e += `
    .section-${n - 1} rect, .section-${n - 1} path, .section-${n - 1} circle, .section-${n - 1} path  {
      fill: ${t["cScale" + n]};
    }
    .section-${n - 1} text {
     fill: ${t["cScaleLabel" + n]};
    }
    .node-icon-${n - 1} {
      font-size: 40px;
      color: ${t["cScaleLabel" + n]};
    }
    .section-edge-${n - 1}{
      stroke: ${t["cScale" + n]};
    }
    .edge-depth-${n - 1}{
      stroke-width: ${i};
    }
    .section-${n - 1} line {
      stroke: ${t["cScaleInv" + n]} ;
      stroke-width: 3;
    }

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

    .disabled, .disabled circle, .disabled text {
      fill: lightgray;
    }
    .disabled text {
      fill: #efefef;
    }
    `;
  }
  return e;
}, PQ = (t) => `
  .edge {
    stroke-width: 3;
  }
  ${MQ(t)}
  .section-root rect, .section-root path, .section-root circle  {
    fill: ${t.git0};
  }
  .section-root text {
    fill: ${t.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .eventWrapper  {
   filter: brightness(120%);
  }
`, zQ = PQ, VQ = {
  db: kQ,
  renderer: RQ,
  parser: bQ,
  styles: zQ
}, qQ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: VQ
}, Symbol.toStringTag, { value: "Module" }));
var j1 = (function() {
  var t = function(L, w, b, F) {
    for (b = b || {}, F = L.length; F--; b[L[F]] = w)
      ;
    return b;
  }, e = [1, 4], n = [1, 13], i = [1, 12], r = [1, 15], s = [1, 16], a = [1, 20], o = [1, 19], l = [6, 7, 8], u = [1, 26], h = [1, 24], f = [1, 25], d = [6, 7, 11], p = [1, 6, 13, 15, 16, 19, 22], y = [1, 33], m = [1, 34], _ = [1, 6, 7, 11, 13, 15, 16, 19, 22], T = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, mindMap: 4, spaceLines: 5, SPACELINE: 6, NL: 7, MINDMAP: 8, document: 9, stop: 10, EOF: 11, statement: 12, SPACELIST: 13, node: 14, ICON: 15, CLASS: 16, nodeWithId: 17, nodeWithoutId: 18, NODE_DSTART: 19, NODE_DESCR: 20, NODE_DEND: 21, NODE_ID: 22, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 6: "SPACELINE", 7: "NL", 8: "MINDMAP", 11: "EOF", 13: "SPACELIST", 15: "ICON", 16: "CLASS", 19: "NODE_DSTART", 20: "NODE_DESCR", 21: "NODE_DEND", 22: "NODE_ID" },
    productions_: [0, [3, 1], [3, 2], [5, 1], [5, 2], [5, 2], [4, 2], [4, 3], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [9, 3], [9, 2], [12, 2], [12, 2], [12, 2], [12, 1], [12, 1], [12, 1], [12, 1], [12, 1], [14, 1], [14, 1], [18, 3], [17, 1], [17, 4]],
    performAction: function(w, b, F, S, x, C, g) {
      var I = C.length - 1;
      switch (x) {
        case 6:
        case 7:
          return S;
        case 8:
          S.getLogger().trace("Stop NL ");
          break;
        case 9:
          S.getLogger().trace("Stop EOF ");
          break;
        case 11:
          S.getLogger().trace("Stop NL2 ");
          break;
        case 12:
          S.getLogger().trace("Stop EOF2 ");
          break;
        case 15:
          S.getLogger().info("Node: ", C[I].id), S.addNode(C[I - 1].length, C[I].id, C[I].descr, C[I].type);
          break;
        case 16:
          S.getLogger().trace("Icon: ", C[I]), S.decorateNode({ icon: C[I] });
          break;
        case 17:
        case 21:
          S.decorateNode({ class: C[I] });
          break;
        case 18:
          S.getLogger().trace("SPACELIST");
          break;
        case 19:
          S.getLogger().trace("Node: ", C[I].id), S.addNode(0, C[I].id, C[I].descr, C[I].type);
          break;
        case 20:
          S.decorateNode({ icon: C[I] });
          break;
        case 25:
          S.getLogger().trace("node found ..", C[I - 2]), this.$ = { id: C[I - 1], descr: C[I - 1], type: S.getType(C[I - 2], C[I]) };
          break;
        case 26:
          this.$ = { id: C[I], descr: C[I], type: S.nodeType.DEFAULT };
          break;
        case 27:
          S.getLogger().trace("node found ..", C[I - 3]), this.$ = { id: C[I - 3], descr: C[I - 1], type: S.getType(C[I - 2], C[I]) };
          break;
      }
    },
    table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 8: e }, { 1: [3] }, { 1: [2, 1] }, { 4: 6, 6: [1, 7], 7: [1, 8], 8: e }, { 6: n, 7: [1, 10], 9: 9, 12: 11, 13: i, 14: 14, 15: r, 16: s, 17: 17, 18: 18, 19: a, 22: o }, t(l, [2, 3]), { 1: [2, 2] }, t(l, [2, 4]), t(l, [2, 5]), { 1: [2, 6], 6: n, 12: 21, 13: i, 14: 14, 15: r, 16: s, 17: 17, 18: 18, 19: a, 22: o }, { 6: n, 9: 22, 12: 11, 13: i, 14: 14, 15: r, 16: s, 17: 17, 18: 18, 19: a, 22: o }, { 6: u, 7: h, 10: 23, 11: f }, t(d, [2, 22], { 17: 17, 18: 18, 14: 27, 15: [1, 28], 16: [1, 29], 19: a, 22: o }), t(d, [2, 18]), t(d, [2, 19]), t(d, [2, 20]), t(d, [2, 21]), t(d, [2, 23]), t(d, [2, 24]), t(d, [2, 26], { 19: [1, 30] }), { 20: [1, 31] }, { 6: u, 7: h, 10: 32, 11: f }, { 1: [2, 7], 6: n, 12: 21, 13: i, 14: 14, 15: r, 16: s, 17: 17, 18: 18, 19: a, 22: o }, t(p, [2, 14], { 7: y, 11: m }), t(_, [2, 8]), t(_, [2, 9]), t(_, [2, 10]), t(d, [2, 15]), t(d, [2, 16]), t(d, [2, 17]), { 20: [1, 35] }, { 21: [1, 36] }, t(p, [2, 13], { 7: y, 11: m }), t(_, [2, 11]), t(_, [2, 12]), { 21: [1, 37] }, t(d, [2, 25]), t(d, [2, 27])],
    defaultActions: { 2: [2, 1], 6: [2, 2] },
    parseError: function(w, b) {
      if (b.recoverable)
        this.trace(w);
      else {
        var F = new Error(w);
        throw F.hash = b, F;
      }
    },
    parse: function(w) {
      var b = this, F = [0], S = [], x = [null], C = [], g = this.table, I = "", k = 0, P = 0, R = 2, M = 1, B = C.slice.call(arguments, 1), N = Object.create(this.lexer), D = { yy: {} };
      for (var E in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, E) && (D.yy[E] = this.yy[E]);
      N.setInput(w, D.yy), D.yy.lexer = N, D.yy.parser = this, typeof N.yylloc > "u" && (N.yylloc = {});
      var V = N.yylloc;
      C.push(V);
      var nt = N.options && N.options.ranges;
      typeof D.yy.parseError == "function" ? this.parseError = D.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function O() {
        var ht;
        return ht = S.pop() || N.lex() || M, typeof ht != "number" && (ht instanceof Array && (S = ht, ht = S.pop()), ht = b.symbols_[ht] || ht), ht;
      }
      for (var ct, X, H, it, ot = {}, W, Z, q, G; ; ) {
        if (X = F[F.length - 1], this.defaultActions[X] ? H = this.defaultActions[X] : ((ct === null || typeof ct > "u") && (ct = O()), H = g[X] && g[X][ct]), typeof H > "u" || !H.length || !H[0]) {
          var U = "";
          G = [];
          for (W in g[X])
            this.terminals_[W] && W > R && G.push("'" + this.terminals_[W] + "'");
          N.showPosition ? U = "Parse error on line " + (k + 1) + `:
` + N.showPosition() + `
Expecting ` + G.join(", ") + ", got '" + (this.terminals_[ct] || ct) + "'" : U = "Parse error on line " + (k + 1) + ": Unexpected " + (ct == M ? "end of input" : "'" + (this.terminals_[ct] || ct) + "'"), this.parseError(U, {
            text: N.match,
            token: this.terminals_[ct] || ct,
            line: N.yylineno,
            loc: V,
            expected: G
          });
        }
        if (H[0] instanceof Array && H.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + X + ", token: " + ct);
        switch (H[0]) {
          case 1:
            F.push(ct), x.push(N.yytext), C.push(N.yylloc), F.push(H[1]), ct = null, P = N.yyleng, I = N.yytext, k = N.yylineno, V = N.yylloc;
            break;
          case 2:
            if (Z = this.productions_[H[1]][1], ot.$ = x[x.length - Z], ot._$ = {
              first_line: C[C.length - (Z || 1)].first_line,
              last_line: C[C.length - 1].last_line,
              first_column: C[C.length - (Z || 1)].first_column,
              last_column: C[C.length - 1].last_column
            }, nt && (ot._$.range = [
              C[C.length - (Z || 1)].range[0],
              C[C.length - 1].range[1]
            ]), it = this.performAction.apply(ot, [
              I,
              P,
              k,
              D.yy,
              H[1],
              x,
              C
            ].concat(B)), typeof it < "u")
              return it;
            Z && (F = F.slice(0, -1 * Z * 2), x = x.slice(0, -1 * Z), C = C.slice(0, -1 * Z)), F.push(this.productions_[H[1]][0]), x.push(ot.$), C.push(ot._$), q = g[F[F.length - 2]][F[F.length - 1]], F.push(q);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, v = /* @__PURE__ */ (function() {
    var L = {
      EOF: 1,
      parseError: function(b, F) {
        if (this.yy.parser)
          this.yy.parser.parseError(b, F);
        else
          throw new Error(b);
      },
      // resets the lexer, sets new input
      setInput: function(w, b) {
        return this.yy = b || this.yy || {}, this._input = w, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var w = this._input[0];
        this.yytext += w, this.yyleng++, this.offset++, this.match += w, this.matched += w;
        var b = w.match(/(?:\r\n?|\n).*/g);
        return b ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), w;
      },
      // unshifts one char (or a string) into the input
      unput: function(w) {
        var b = w.length, F = w.split(/(?:\r\n?|\n)/g);
        this._input = w + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - b), this.offset -= b;
        var S = 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), F.length - 1 && (this.yylineno -= F.length - 1);
        var x = 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: F ? (F.length === S.length ? this.yylloc.first_column : 0) + S[S.length - F.length].length - F[0].length : this.yylloc.first_column - b
        }, this.options.ranges && (this.yylloc.range = [x[0], x[0] + this.yyleng - b]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(w) {
        this.unput(this.match.slice(w));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var w = this.matched.substr(0, this.matched.length - this.match.length);
        return (w.length > 20 ? "..." : "") + w.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var w = this.match;
        return w.length < 20 && (w += this._input.substr(0, 20 - w.length)), (w.substr(0, 20) + (w.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var w = this.pastInput(), b = new Array(w.length + 1).join("-");
        return w + this.upcomingInput() + `
` + b + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(w, b) {
        var F, S, x;
        if (this.options.backtrack_lexer && (x = {
          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 && (x.yylloc.range = this.yylloc.range.slice(0))), S = w[0].match(/(?:\r\n?|\n).*/g), S && (this.yylineno += S.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: S ? S[S.length - 1].length - S[S.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + w[0].length
        }, this.yytext += w[0], this.match += w[0], this.matches = w, 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(w[0].length), this.matched += w[0], F = this.performAction.call(this, this.yy, this, b, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), F)
          return F;
        if (this._backtrack) {
          for (var C in x)
            this[C] = x[C];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var w, b, F, S;
        this._more || (this.yytext = "", this.match = "");
        for (var x = this._currentRules(), C = 0; C < x.length; C++)
          if (F = this._input.match(this.rules[x[C]]), F && (!b || F[0].length > b[0].length)) {
            if (b = F, S = C, this.options.backtrack_lexer) {
              if (w = this.test_match(F, x[C]), w !== !1)
                return w;
              if (this._backtrack) {
                b = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return b ? (w = this.test_match(b, x[S]), w !== !1 ? w : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var b = this.next();
        return b || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(b) {
        this.conditionStack.push(b);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var b = this.conditionStack.length - 1;
        return b > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(b) {
        return b = this.conditionStack.length - 1 - Math.abs(b || 0), b >= 0 ? this.conditionStack[b] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(b) {
        this.begin(b);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(b, F, S, x) {
        switch (S) {
          case 0:
            return b.getLogger().trace("Found comment", F.yytext), 6;
          case 1:
            return 8;
          case 2:
            this.begin("CLASS");
            break;
          case 3:
            return this.popState(), 16;
          case 4:
            this.popState();
            break;
          case 5:
            b.getLogger().trace("Begin icon"), this.begin("ICON");
            break;
          case 6:
            return b.getLogger().trace("SPACELINE"), 6;
          case 7:
            return 7;
          case 8:
            return 15;
          case 9:
            b.getLogger().trace("end icon"), this.popState();
            break;
          case 10:
            return b.getLogger().trace("Exploding node"), this.begin("NODE"), 19;
          case 11:
            return b.getLogger().trace("Cloud"), this.begin("NODE"), 19;
          case 12:
            return b.getLogger().trace("Explosion Bang"), this.begin("NODE"), 19;
          case 13:
            return b.getLogger().trace("Cloud Bang"), this.begin("NODE"), 19;
          case 14:
            return this.begin("NODE"), 19;
          case 15:
            return this.begin("NODE"), 19;
          case 16:
            return this.begin("NODE"), 19;
          case 17:
            return this.begin("NODE"), 19;
          case 18:
            return 13;
          case 19:
            return 22;
          case 20:
            return 11;
          case 21:
            this.begin("NSTR2");
            break;
          case 22:
            return "NODE_DESCR";
          case 23:
            this.popState();
            break;
          case 24:
            b.getLogger().trace("Starting NSTR"), this.begin("NSTR");
            break;
          case 25:
            return b.getLogger().trace("description:", F.yytext), "NODE_DESCR";
          case 26:
            this.popState();
            break;
          case 27:
            return this.popState(), b.getLogger().trace("node end ))"), "NODE_DEND";
          case 28:
            return this.popState(), b.getLogger().trace("node end )"), "NODE_DEND";
          case 29:
            return this.popState(), b.getLogger().trace("node end ...", F.yytext), "NODE_DEND";
          case 30:
            return this.popState(), b.getLogger().trace("node end (("), "NODE_DEND";
          case 31:
            return this.popState(), b.getLogger().trace("node end (-"), "NODE_DEND";
          case 32:
            return this.popState(), b.getLogger().trace("node end (-"), "NODE_DEND";
          case 33:
            return this.popState(), b.getLogger().trace("node end (("), "NODE_DEND";
          case 34:
            return this.popState(), b.getLogger().trace("node end (("), "NODE_DEND";
          case 35:
            return b.getLogger().trace("Long description:", F.yytext), 20;
          case 36:
            return b.getLogger().trace("Long description:", F.yytext), 20;
        }
      },
      rules: [/^(?:\s*%%.*)/i, /^(?:mindmap\b)/i, /^(?::::)/i, /^(?:.+)/i, /^(?:\n)/i, /^(?:::icon\()/i, /^(?:[\s]+[\n])/i, /^(?:[\n]+)/i, /^(?:[^\)]+)/i, /^(?:\))/i, /^(?:-\))/i, /^(?:\(-)/i, /^(?:\)\))/i, /^(?:\))/i, /^(?:\(\()/i, /^(?:\{\{)/i, /^(?:\()/i, /^(?:\[)/i, /^(?:[\s]+)/i, /^(?:[^\(\[\n\)\{\}]+)/i, /^(?:$)/i, /^(?:["][`])/i, /^(?:[^`"]+)/i, /^(?:[`]["])/i, /^(?:["])/i, /^(?:[^"]+)/i, /^(?:["])/i, /^(?:[\)]\))/i, /^(?:[\)])/i, /^(?:[\]])/i, /^(?:\}\})/i, /^(?:\(-)/i, /^(?:-\))/i, /^(?:\(\()/i, /^(?:\()/i, /^(?:[^\)\]\(\}]+)/i, /^(?:.+(?!\(\())/i],
      conditions: { CLASS: { rules: [3, 4], inclusive: !1 }, ICON: { rules: [8, 9], inclusive: !1 }, NSTR2: { rules: [22, 23], inclusive: !1 }, NSTR: { rules: [25, 26], inclusive: !1 }, NODE: { rules: [21, 24, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20], inclusive: !0 } }
    };
    return L;
  })();
  T.lexer = v;
  function A() {
    this.yy = {};
  }
  return A.prototype = T, T.Parser = A, new A();
})();
j1.parser = j1;
const $Q = j1;
let Ci = [], $5 = 0, H0 = {};
const YQ = () => {
  Ci = [], $5 = 0, H0 = {};
}, WQ = function(t) {
  for (let e = Ci.length - 1; e >= 0; e--)
    if (Ci[e].level < t)
      return Ci[e];
  return null;
}, UQ = () => Ci.length > 0 ? Ci[0] : null, HQ = (t, e, n, i) => {
  var r, s;
  z.info("addNode", t, e, n, i);
  const a = Q();
  let o = ((r = a.mindmap) == null ? void 0 : r.padding) ?? be.mindmap.padding;
  switch (i) {
    case Ue.ROUNDED_RECT:
    case Ue.RECT:
    case Ue.HEXAGON:
      o *= 2;
  }
  const l = {
    id: $5++,
    nodeId: Ne(e, a),
    level: t,
    descr: Ne(n, a),
    type: i,
    children: [],
    width: ((s = a.mindmap) == null ? void 0 : s.maxNodeWidth) ?? be.mindmap.maxNodeWidth,
    padding: o
  }, u = WQ(t);
  if (u)
    u.children.push(l), Ci.push(l);
  else if (Ci.length === 0)
    Ci.push(l);
  else
    throw new Error(
      'There can be only one root. No parent could be found for ("' + l.descr + '")'
    );
}, Ue = {
  DEFAULT: 0,
  NO_BORDER: 0,
  ROUNDED_RECT: 1,
  RECT: 2,
  CIRCLE: 3,
  CLOUD: 4,
  BANG: 5,
  HEXAGON: 6
}, GQ = (t, e) => {
  switch (z.debug("In get type", t, e), t) {
    case "[":
      return Ue.RECT;
    case "(":
      return e === ")" ? Ue.ROUNDED_RECT : Ue.CLOUD;
    case "((":
      return Ue.CIRCLE;
    case ")":
      return Ue.CLOUD;
    case "))":
      return Ue.BANG;
    case "{{":
      return Ue.HEXAGON;
    default:
      return Ue.DEFAULT;
  }
}, jQ = (t, e) => {
  H0[t] = e;
}, XQ = (t) => {
  if (!t)
    return;
  const e = Q(), n = Ci[Ci.length - 1];
  t.icon && (n.icon = Ne(t.icon, e)), t.class && (n.class = Ne(t.class, e));
}, KQ = (t) => {
  switch (t) {
    case Ue.DEFAULT:
      return "no-border";
    case Ue.RECT:
      return "rect";
    case Ue.ROUNDED_RECT:
      return "rounded-rect";
    case Ue.CIRCLE:
      return "circle";
    case Ue.CLOUD:
      return "cloud";
    case Ue.BANG:
      return "bang";
    case Ue.HEXAGON:
      return "hexgon";
    default:
      return "no-border";
  }
}, QQ = () => z, ZQ = (t) => H0[t], JQ = {
  clear: YQ,
  addNode: HQ,
  getMindmap: UQ,
  nodeType: Ue,
  getType: GQ,
  setElementForId: jQ,
  decorateNode: XQ,
  type2Str: KQ,
  getLogger: QQ,
  getElementById: ZQ
}, tZ = JQ, eZ = 12, nZ = function(t, e, n, i) {
  e.append("path").attr("id", "node-" + n.id).attr("class", "node-bkg node-" + t.type2Str(n.type)).attr(
    "d",
    `M0 ${n.height - 5} v${-n.height + 10} q0,-5 5,-5 h${n.width - 10} q5,0 5,5 v${n.height - 5} H0 Z`
  ), e.append("line").attr("class", "node-line-" + i).attr("x1", 0).attr("y1", n.height).attr("x2", n.width).attr("y2", n.height);
}, iZ = function(t, e, n) {
  e.append("rect").attr("id", "node-" + n.id).attr("class", "node-bkg node-" + t.type2Str(n.type)).attr("height", n.height).attr("width", n.width);
}, rZ = function(t, e, n) {
  const i = n.width, r = n.height, s = 0.15 * i, a = 0.25 * i, o = 0.35 * i, l = 0.2 * i;
  e.append("path").attr("id", "node-" + n.id).attr("class", "node-bkg node-" + t.type2Str(n.type)).attr(
    "d",
    `M0 0 a${s},${s} 0 0,1 ${i * 0.25},${-1 * i * 0.1}
      a${o},${o} 1 0,1 ${i * 0.4},${-1 * i * 0.1}
      a${a},${a} 1 0,1 ${i * 0.35},${1 * i * 0.2}

      a${s},${s} 1 0,1 ${i * 0.15},${1 * r * 0.35}
      a${l},${l} 1 0,1 ${-1 * i * 0.15},${1 * r * 0.65}

      a${a},${s} 1 0,1 ${-1 * i * 0.25},${i * 0.15}
      a${o},${o} 1 0,1 ${-1 * i * 0.5},0
      a${s},${s} 1 0,1 ${-1 * i * 0.25},${-1 * i * 0.15}

      a${s},${s} 1 0,1 ${-1 * i * 0.1},${-1 * r * 0.35}
      a${l},${l} 1 0,1 ${i * 0.1},${-1 * r * 0.65}

    H0 V0 Z`
  );
}, sZ = function(t, e, n) {
  const i = n.width, r = n.height, s = 0.15 * i;
  e.append("path").attr("id", "node-" + n.id).attr("class", "node-bkg node-" + t.type2Str(n.type)).attr(
    "d",
    `M0 0 a${s},${s} 1 0,0 ${i * 0.25},${-1 * r * 0.1}
      a${s},${s} 1 0,0 ${i * 0.25},0
      a${s},${s} 1 0,0 ${i * 0.25},0
      a${s},${s} 1 0,0 ${i * 0.25},${1 * r * 0.1}

      a${s},${s} 1 0,0 ${i * 0.15},${1 * r * 0.33}
      a${s * 0.8},${s * 0.8} 1 0,0 0,${1 * r * 0.34}
      a${s},${s} 1 0,0 ${-1 * i * 0.15},${1 * r * 0.33}

      a${s},${s} 1 0,0 ${-1 * i * 0.25},${r * 0.15}
      a${s},${s} 1 0,0 ${-1 * i * 0.25},0
      a${s},${s} 1 0,0 ${-1 * i * 0.25},0
      a${s},${s} 1 0,0 ${-1 * i * 0.25},${-1 * r * 0.15}

      a${s},${s} 1 0,0 ${-1 * i * 0.1},${-1 * r * 0.33}
      a${s * 0.8},${s * 0.8} 1 0,0 0,${-1 * r * 0.34}
      a${s},${s} 1 0,0 ${i * 0.1},${-1 * r * 0.33}

    H0 V0 Z`
  );
}, aZ = function(t, e, n) {
  e.append("circle").attr("id", "node-" + n.id).attr("class", "node-bkg node-" + t.type2Str(n.type)).attr("r", n.width / 2);
};
function oZ(t, e, n, i, r) {
  return t.insert("polygon", ":first-child").attr(
    "points",
    i.map(function(s) {
      return s.x + "," + s.y;
    }).join(" ")
  ).attr("transform", "translate(" + (r.width - e) / 2 + ", " + n + ")");
}
const lZ = function(t, e, n) {
  const i = n.height, s = i / 4, a = n.width - n.padding + 2 * s, o = [
    { x: s, y: 0 },
    { x: a - s, y: 0 },
    { x: a, y: -i / 2 },
    { x: a - s, y: -i },
    { x: s, y: -i },
    { x: 0, y: -i / 2 }
  ];
  oZ(e, a, i, o, n);
}, cZ = function(t, e, n) {
  e.append("rect").attr("id", "node-" + n.id).attr("class", "node-bkg node-" + t.type2Str(n.type)).attr("height", n.height).attr("rx", n.padding).attr("ry", n.padding).attr("width", n.width);
}, uZ = function(t, e, n, i, r) {
  const s = r.htmlLabels, a = i % (eZ - 1), o = e.append("g");
  n.section = a;
  let l = "section-" + a;
  a < 0 && (l += " section-root"), o.attr("class", (n.class ? n.class + " " : "") + "mindmap-node " + l);
  const u = o.append("g"), h = o.append("g"), f = n.descr.replace(/(<br\/*>)/g, `
`);
  bh(h, f, {
    useHtmlLabels: s,
    width: n.width,
    classes: "mindmap-node-label"
  }), s || h.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle");
  const d = h.node().getBBox(), [p] = zs(r.fontSize);
  if (n.height = d.height + p * 1.1 * 0.5 + n.padding, n.width = d.width + 2 * n.padding, n.icon)
    if (n.type === t.nodeType.CIRCLE)
      n.height += 50, n.width += 50, o.append("foreignObject").attr("height", "50px").attr("width", n.width).attr("style", "text-align: center;").append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + a + " " + n.icon), h.attr(
        "transform",
        "translate(" + n.width / 2 + ", " + (n.height / 2 - 1.5 * n.padding) + ")"
      );
    else {
      n.width += 50;
      const y = n.height;
      n.height = Math.max(y, 60);
      const m = Math.abs(n.height - y);
      o.append("foreignObject").attr("width", "60px").attr("height", n.height).attr("style", "text-align: center;margin-top:" + m / 2 + "px;").append("div").attr("class", "icon-container").append("i").attr("class", "node-icon-" + a + " " + n.icon), h.attr(
        "transform",
        "translate(" + (25 + n.width / 2) + ", " + (m / 2 + n.padding / 2) + ")"
      );
    }
  else if (s) {
    const y = (n.width - d.width) / 2, m = (n.height - d.height) / 2;
    h.attr("transform", "translate(" + y + ", " + m + ")");
  } else {
    const y = n.width / 2, m = n.padding / 2;
    h.attr("transform", "translate(" + y + ", " + m + ")");
  }
  switch (n.type) {
    case t.nodeType.DEFAULT:
      nZ(t, u, n, a);
      break;
    case t.nodeType.ROUNDED_RECT:
      cZ(t, u, n);
      break;
    case t.nodeType.RECT:
      iZ(t, u, n);
      break;
    case t.nodeType.CIRCLE:
      u.attr("transform", "translate(" + n.width / 2 + ", " + +n.height / 2 + ")"), aZ(t, u, n);
      break;
    case t.nodeType.CLOUD:
      rZ(t, u, n);
      break;
    case t.nodeType.BANG:
      sZ(t, u, n);
      break;
    case t.nodeType.HEXAGON:
      lZ(t, u, n);
      break;
  }
  return t.setElementForId(n.id, o), n.height;
}, hZ = function(t, e) {
  const n = t.getElementById(e.id), i = e.x || 0, r = e.y || 0;
  n.attr("transform", "translate(" + i + "," + r + ")");
};
Fy.use(rk);
function Y5(t, e, n, i, r) {
  uZ(t, e, n, i, r), n.children && n.children.forEach((s, a) => {
    Y5(t, e, s, i < 0 ? a : i, r);
  });
}
function dZ(t, e) {
  e.edges().map((n, i) => {
    const r = n.data();
    if (n[0]._private.bodyBounds) {
      const s = n[0]._private.rscratch;
      z.trace("Edge: ", i, r), t.insert("path").attr(
        "d",
        `M ${s.startX},${s.startY} L ${s.midX},${s.midY} L${s.endX},${s.endY} `
      ).attr("class", "edge section-edge-" + r.section + " edge-depth-" + r.depth);
    }
  });
}
function W5(t, e, n, i) {
  e.add({
    group: "nodes",
    data: {
      id: t.id.toString(),
      labelText: t.descr,
      height: t.height,
      width: t.width,
      level: i,
      nodeId: t.id,
      padding: t.padding,
      type: t.type
    },
    position: {
      x: t.x,
      y: t.y
    }
  }), t.children && t.children.forEach((r) => {
    W5(r, e, n, i + 1), e.add({
      group: "edges",
      data: {
        id: `${t.id}_${r.id}`,
        source: t.id,
        target: r.id,
        depth: i,
        section: r.section
      }
    });
  });
}
function fZ(t, e) {
  return new Promise((n) => {
    const i = yt("body").append("div").attr("id", "cy").attr("style", "display:none"), r = Fy({
      container: document.getElementById("cy"),
      // container to render in
      style: [
        {
          selector: "edge",
          style: {
            "curve-style": "bezier"
          }
        }
      ]
    });
    i.remove(), W5(t, r, e, 0), r.nodes().forEach(function(s) {
      s.layoutDimensions = () => {
        const a = s.data();
        return { w: a.width, h: a.height };
      };
    }), r.layout({
      name: "cose-bilkent",
      // @ts-ignore Types for cose-bilkent are not correct?
      quality: "proof",
      styleEnabled: !1,
      animate: !1
    }).run(), r.ready((s) => {
      z.info("Ready", s), n(r);
    });
  });
}
function pZ(t, e) {
  e.nodes().map((n, i) => {
    const r = n.data();
    r.x = n.position().x, r.y = n.position().y, hZ(t, r);
    const s = t.getElementById(r.nodeId);
    z.info("Id:", i, "Position: (", n.position().x, ", ", n.position().y, ")", r), s.attr(
      "transform",
      `translate(${n.position().x - r.width / 2}, ${n.position().y - r.height / 2})`
    ), s.attr("attr", `apa-${i})`);
  });
}
const gZ = async (t, e, n, i) => {
  var r, s;
  z.debug(`Rendering mindmap diagram
` + t);
  const a = i.db, o = a.getMindmap();
  if (!o)
    return;
  const l = Q();
  l.htmlLabels = !1;
  const u = Cl(e), h = u.append("g");
  h.attr("class", "mindmap-edges");
  const f = u.append("g");
  f.attr("class", "mindmap-nodes"), Y5(a, f, o, -1, l);
  const d = await fZ(o, l);
  dZ(h, d), pZ(a, d), Wr(
    void 0,
    u,
    ((r = l.mindmap) == null ? void 0 : r.padding) ?? be.mindmap.padding,
    ((s = l.mindmap) == null ? void 0 : s.useMaxWidth) ?? be.mindmap.useMaxWidth
  );
}, yZ = {
  draw: gZ
}, mZ = (t) => {
  let e = "";
  for (let n = 0; n < t.THEME_COLOR_LIMIT; n++)
    t["lineColor" + n] = t["lineColor" + n] || t["cScaleInv" + n], Ds(t["lineColor" + n]) ? t["lineColor" + n] = Nt(t["lineColor" + n], 20) : t["lineColor" + n] = Ot(t["lineColor" + n], 20);
  for (let n = 0; n < t.THEME_COLOR_LIMIT; n++) {
    const i = "" + (17 - 3 * n);
    e += `
    .section-${n - 1} rect, .section-${n - 1} path, .section-${n - 1} circle, .section-${n - 1} polygon, .section-${n - 1} path  {
      fill: ${t["cScale" + n]};
    }
    .section-${n - 1} text {
     fill: ${t["cScaleLabel" + n]};
    }
    .node-icon-${n - 1} {
      font-size: 40px;
      color: ${t["cScaleLabel" + n]};
    }
    .section-edge-${n - 1}{
      stroke: ${t["cScale" + n]};
    }
    .edge-depth-${n - 1}{
      stroke-width: ${i};
    }
    .section-${n - 1} line {
      stroke: ${t["cScaleInv" + n]} ;
      stroke-width: 3;
    }

    .disabled, .disabled circle, .disabled text {
      fill: lightgray;
    }
    .disabled text {
      fill: #efefef;
    }
    `;
  }
  return e;
}, xZ = (t) => `
  .edge {
    stroke-width: 3;
  }
  ${mZ(t)}
  .section-root rect, .section-root path, .section-root circle, .section-root polygon  {
    fill: ${t.git0};
  }
  .section-root text {
    fill: ${t.gitBranchLabel0};
  }
  .icon-container {
    height:100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .edge {
    fill: none;
  }
  .mindmap-node-label {
    dy: 1em;
    alignment-baseline: middle;
    text-anchor: middle;
    dominant-baseline: middle;
    text-align: center;
  }
`, bZ = xZ, _Z = {
  db: tZ,
  renderer: yZ,
  parser: $Q,
  styles: bZ
}, kZ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: _Z
}, Symbol.toStringTag, { value: "Module" }));
function Ty(t, e) {
  let n;
  if (e === void 0)
    for (const i of t)
      i != null && (n < i || n === void 0 && i >= i) && (n = i);
  else {
    let i = -1;
    for (let r of t)
      (r = e(r, ++i, t)) != null && (n < r || n === void 0 && r >= r) && (n = r);
  }
  return n;
}
function U5(t, e) {
  let n;
  if (e === void 0)
    for (const i of t)
      i != null && (n > i || n === void 0 && i >= i) && (n = i);
  else {
    let i = -1;
    for (let r of t)
      (r = e(r, ++i, t)) != null && (n > r || n === void 0 && r >= r) && (n = r);
  }
  return n;
}
function kd(t, e) {
  let n = 0;
  if (e === void 0)
    for (let i of t)
      (i = +i) && (n += i);
  else {
    let i = -1;
    for (let r of t)
      (r = +e(r, ++i, t)) && (n += r);
  }
  return n;
}
function TZ(t) {
  return t.target.depth;
}
function wZ(t) {
  return t.depth;
}
function vZ(t, e) {
  return e - 1 - t.height;
}
function H5(t, e) {
  return t.sourceLinks.length ? t.depth : e - 1;
}
function EZ(t) {
  return t.targetLinks.length ? t.depth : t.sourceLinks.length ? U5(t.sourceLinks, TZ) - 1 : 0;
}
function ic(t) {
  return function() {
    return t;
  };
}
function wy(t, e) {
  return Bu(t.source, e.source) || t.index - e.index;
}
function vy(t, e) {
  return Bu(t.target, e.target) || t.index - e.index;
}
function Bu(t, e) {
  return t.y0 - e.y0;
}
function Td(t) {
  return t.value;
}
function CZ(t) {
  return t.index;
}
function SZ(t) {
  return t.nodes;
}
function AZ(t) {
  return t.links;
}
function Ey(t, e) {
  const n = t.get(e);
  if (!n) throw new Error("missing: " + e);
  return n;
}
function Cy({ nodes: t }) {
  for (const e of t) {
    let n = e.y0, i = n;
    for (const r of e.sourceLinks)
      r.y0 = n + r.width / 2, n += r.width;
    for (const r of e.targetLinks)
      r.y1 = i + r.width / 2, i += r.width;
  }
}
function LZ() {
  let t = 0, e = 0, n = 1, i = 1, r = 24, s = 8, a, o = CZ, l = H5, u, h, f = SZ, d = AZ, p = 6;
  function y() {
    const R = { nodes: f.apply(null, arguments), links: d.apply(null, arguments) };
    return m(R), _(R), T(R), v(R), w(R), Cy(R), R;
  }
  y.update = function(R) {
    return Cy(R), R;
  }, y.nodeId = function(R) {
    return arguments.length ? (o = typeof R == "function" ? R : ic(R), y) : o;
  }, y.nodeAlign = function(R) {
    return arguments.length ? (l = typeof R == "function" ? R : ic(R), y) : l;
  }, y.nodeSort = function(R) {
    return arguments.length ? (u = R, y) : u;
  }, y.nodeWidth = function(R) {
    return arguments.length ? (r = +R, y) : r;
  }, y.nodePadding = function(R) {
    return arguments.length ? (s = a = +R, y) : s;
  }, y.nodes = function(R) {
    return arguments.length ? (f = typeof R == "function" ? R : ic(R), y) : f;
  }, y.links = function(R) {
    return arguments.length ? (d = typeof R == "function" ? R : ic(R), y) : d;
  }, y.linkSort = function(R) {
    return arguments.length ? (h = R, y) : h;
  }, y.size = function(R) {
    return arguments.length ? (t = e = 0, n = +R[0], i = +R[1], y) : [n - t, i - e];
  }, y.extent = function(R) {
    return arguments.length ? (t = +R[0][0], n = +R[1][0], e = +R[0][1], i = +R[1][1], y) : [[t, e], [n, i]];
  }, y.iterations = function(R) {
    return arguments.length ? (p = +R, y) : p;
  };
  function m({ nodes: R, links: M }) {
    for (const [N, D] of R.entries())
      D.index = N, D.sourceLinks = [], D.targetLinks = [];
    const B = new Map(R.map((N, D) => [o(N, D, R), N]));
    for (const [N, D] of M.entries()) {
      D.index = N;
      let { source: E, target: V } = D;
      typeof E != "object" && (E = D.source = Ey(B, E)), typeof V != "object" && (V = D.target = Ey(B, V)), E.sourceLinks.push(D), V.targetLinks.push(D);
    }
    if (h != null)
      for (const { sourceLinks: N, targetLinks: D } of R)
        N.sort(h), D.sort(h);
  }
  function _({ nodes: R }) {
    for (const M of R)
      M.value = M.fixedValue === void 0 ? Math.max(kd(M.sourceLinks, Td), kd(M.targetLinks, Td)) : M.fixedValue;
  }
  function T({ nodes: R }) {
    const M = R.length;
    let B = new Set(R), N = /* @__PURE__ */ new Set(), D = 0;
    for (; B.size; ) {
      for (const E of B) {
        E.depth = D;
        for (const { target: V } of E.sourceLinks)
          N.add(V);
      }
      if (++D > M) throw new Error("circular link");
      B = N, N = /* @__PURE__ */ new Set();
    }
  }
  function v({ nodes: R }) {
    const M = R.length;
    let B = new Set(R), N = /* @__PURE__ */ new Set(), D = 0;
    for (; B.size; ) {
      for (const E of B) {
        E.height = D;
        for (const { source: V } of E.targetLinks)
          N.add(V);
      }
      if (++D > M) throw new Error("circular link");
      B = N, N = /* @__PURE__ */ new Set();
    }
  }
  function A({ nodes: R }) {
    const M = Ty(R, (D) => D.depth) + 1, B = (n - t - r) / (M - 1), N = new Array(M);
    for (const D of R) {
      const E = Math.max(0, Math.min(M - 1, Math.floor(l.call(null, D, M))));
      D.layer = E, D.x0 = t + E * B, D.x1 = D.x0 + r, N[E] ? N[E].push(D) : N[E] = [D];
    }
    if (u) for (const D of N)
      D.sort(u);
    return N;
  }
  function L(R) {
    const M = U5(R, (B) => (i - e - (B.length - 1) * a) / kd(B, Td));
    for (const B of R) {
      let N = e;
      for (const D of B) {
        D.y0 = N, D.y1 = N + D.value * M, N = D.y1 + a;
        for (const E of D.sourceLinks)
          E.width = E.value * M;
      }
      N = (i - N + a) / (B.length + 1);
      for (let D = 0; D < B.length; ++D) {
        const E = B[D];
        E.y0 += N * (D + 1), E.y1 += N * (D + 1);
      }
      I(B);
    }
  }
  function w(R) {
    const M = A(R);
    a = Math.min(s, (i - e) / (Ty(M, (B) => B.length) - 1)), L(M);
    for (let B = 0; B < p; ++B) {
      const N = Math.pow(0.99, B), D = Math.max(1 - N, (B + 1) / p);
      F(M, N, D), b(M, N, D);
    }
  }
  function b(R, M, B) {
    for (let N = 1, D = R.length; N < D; ++N) {
      const E = R[N];
      for (const V of E) {
        let nt = 0, O = 0;
        for (const { source: X, value: H } of V.targetLinks) {
          let it = H * (V.layer - X.layer);
          nt += k(X, V) * it, O += it;
        }
        if (!(O > 0)) continue;
        let ct = (nt / O - V.y0) * M;
        V.y0 += ct, V.y1 += ct, g(V);
      }
      u === void 0 && E.sort(Bu), S(E, B);
    }
  }
  function F(R, M, B) {
    for (let N = R.length, D = N - 2; D >= 0; --D) {
      const E = R[D];
      for (const V of E) {
        let nt = 0, O = 0;
        for (const { target: X, value: H } of V.sourceLinks) {
          let it = H * (X.layer - V.layer);
          nt += P(V, X) * it, O += it;
        }
        if (!(O > 0)) continue;
        let ct = (nt / O - V.y0) * M;
        V.y0 += ct, V.y1 += ct, g(V);
      }
      u === void 0 && E.sort(Bu), S(E, B);
    }
  }
  function S(R, M) {
    const B = R.length >> 1, N = R[B];
    C(R, N.y0 - a, B - 1, M), x(R, N.y1 + a, B + 1, M), C(R, i, R.length - 1, M), x(R, e, 0, M);
  }
  function x(R, M, B, N) {
    for (; B < R.length; ++B) {
      const D = R[B], E = (M - D.y0) * N;
      E > 1e-6 && (D.y0 += E, D.y1 += E), M = D.y1 + a;
    }
  }
  function C(R, M, B, N) {
    for (; B >= 0; --B) {
      const D = R[B], E = (D.y1 - M) * N;
      E > 1e-6 && (D.y0 -= E, D.y1 -= E), M = D.y0 - a;
    }
  }
  function g({ sourceLinks: R, targetLinks: M }) {
    if (h === void 0) {
      for (const { source: { sourceLinks: B } } of M)
        B.sort(vy);
      for (const { target: { targetLinks: B } } of R)
        B.sort(wy);
    }
  }
  function I(R) {
    if (h === void 0)
      for (const { sourceLinks: M, targetLinks: B } of R)
        M.sort(vy), B.sort(wy);
  }
  function k(R, M) {
    let B = R.y0 - (R.sourceLinks.length - 1) * a / 2;
    for (const { target: N, width: D } of R.sourceLinks) {
      if (N === M) break;
      B += D + a;
    }
    for (const { source: N, width: D } of M.targetLinks) {
      if (N === R) break;
      B -= D;
    }
    return B;
  }
  function P(R, M) {
    let B = M.y0 - (M.targetLinks.length - 1) * a / 2;
    for (const { source: N, width: D } of M.targetLinks) {
      if (N === R) break;
      B += D + a;
    }
    for (const { target: N, width: D } of R.sourceLinks) {
      if (N === M) break;
      B -= D;
    }
    return B;
  }
  return y;
}
var X1 = Math.PI, K1 = 2 * X1, ts = 1e-6, IZ = K1 - ts;
function Q1() {
  this._x0 = this._y0 = // start of current subpath
  this._x1 = this._y1 = null, this._ = "";
}
function G5() {
  return new Q1();
}
Q1.prototype = G5.prototype = {
  constructor: Q1,
  moveTo: function(t, e) {
    this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +e);
  },
  closePath: function() {
    this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
  },
  lineTo: function(t, e) {
    this._ += "L" + (this._x1 = +t) + "," + (this._y1 = +e);
  },
  quadraticCurveTo: function(t, e, n, i) {
    this._ += "Q" + +t + "," + +e + "," + (this._x1 = +n) + "," + (this._y1 = +i);
  },
  bezierCurveTo: function(t, e, n, i, r, s) {
    this._ += "C" + +t + "," + +e + "," + +n + "," + +i + "," + (this._x1 = +r) + "," + (this._y1 = +s);
  },
  arcTo: function(t, e, n, i, r) {
    t = +t, e = +e, n = +n, i = +i, r = +r;
    var s = this._x1, a = this._y1, o = n - t, l = i - e, u = s - t, h = a - e, f = u * u + h * h;
    if (r < 0) throw new Error("negative radius: " + r);
    if (this._x1 === null)
      this._ += "M" + (this._x1 = t) + "," + (this._y1 = e);
    else if (f > ts) if (!(Math.abs(h * o - l * u) > ts) || !r)
      this._ += "L" + (this._x1 = t) + "," + (this._y1 = e);
    else {
      var d = n - s, p = i - a, y = o * o + l * l, m = d * d + p * p, _ = Math.sqrt(y), T = Math.sqrt(f), v = r * Math.tan((X1 - Math.acos((y + f - m) / (2 * _ * T))) / 2), A = v / T, L = v / _;
      Math.abs(A - 1) > ts && (this._ += "L" + (t + A * u) + "," + (e + A * h)), this._ += "A" + r + "," + r + ",0,0," + +(h * d > u * p) + "," + (this._x1 = t + L * o) + "," + (this._y1 = e + L * l);
    }
  },
  arc: function(t, e, n, i, r, s) {
    t = +t, e = +e, n = +n, s = !!s;
    var a = n * Math.cos(i), o = n * Math.sin(i), l = t + a, u = e + o, h = 1 ^ s, f = s ? i - r : r - i;
    if (n < 0) throw new Error("negative radius: " + n);
    this._x1 === null ? this._ += "M" + l + "," + u : (Math.abs(this._x1 - l) > ts || Math.abs(this._y1 - u) > ts) && (this._ += "L" + l + "," + u), n && (f < 0 && (f = f % K1 + K1), f > IZ ? this._ += "A" + n + "," + n + ",0,1," + h + "," + (t - a) + "," + (e - o) + "A" + n + "," + n + ",0,1," + h + "," + (this._x1 = l) + "," + (this._y1 = u) : f > ts && (this._ += "A" + n + "," + n + ",0," + +(f >= X1) + "," + h + "," + (this._x1 = t + n * Math.cos(r)) + "," + (this._y1 = e + n * Math.sin(r))));
  },
  rect: function(t, e, n, i) {
    this._ += "M" + (this._x0 = this._x1 = +t) + "," + (this._y0 = this._y1 = +e) + "h" + +n + "v" + +i + "h" + -n + "Z";
  },
  toString: function() {
    return this._;
  }
};
function Sy(t) {
  return function() {
    return t;
  };
}
function BZ(t) {
  return t[0];
}
function DZ(t) {
  return t[1];
}
var NZ = Array.prototype.slice;
function FZ(t) {
  return t.source;
}
function OZ(t) {
  return t.target;
}
function RZ(t) {
  var e = FZ, n = OZ, i = BZ, r = DZ, s = null;
  function a() {
    var o, l = NZ.call(arguments), u = e.apply(this, l), h = n.apply(this, l);
    if (s || (s = o = G5()), t(s, +i.apply(this, (l[0] = u, l)), +r.apply(this, l), +i.apply(this, (l[0] = h, l)), +r.apply(this, l)), o) return s = null, o + "" || null;
  }
  return a.source = function(o) {
    return arguments.length ? (e = o, a) : e;
  }, a.target = function(o) {
    return arguments.length ? (n = o, a) : n;
  }, a.x = function(o) {
    return arguments.length ? (i = typeof o == "function" ? o : Sy(+o), a) : i;
  }, a.y = function(o) {
    return arguments.length ? (r = typeof o == "function" ? o : Sy(+o), a) : r;
  }, a.context = function(o) {
    return arguments.length ? (s = o ?? null, a) : s;
  }, a;
}
function MZ(t, e, n, i, r) {
  t.moveTo(e, n), t.bezierCurveTo(e = (e + i) / 2, n, e, r, i, r);
}
function PZ() {
  return RZ(MZ);
}
function zZ(t) {
  return [t.source.x1, t.y0];
}
function VZ(t) {
  return [t.target.x0, t.y1];
}
function qZ() {
  return PZ().source(zZ).target(VZ);
}
var Z1 = (function() {
  var t = function(o, l, u, h) {
    for (u = u || {}, h = o.length; h--; u[o[h]] = l)
      ;
    return u;
  }, e = [1, 9], n = [1, 10], i = [1, 5, 10, 12], r = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, start: 3, SANKEY: 4, NEWLINE: 5, csv: 6, opt_eof: 7, record: 8, csv_tail: 9, EOF: 10, "field[source]": 11, COMMA: 12, "field[target]": 13, "field[value]": 14, field: 15, escaped: 16, non_escaped: 17, DQUOTE: 18, ESCAPED_TEXT: 19, NON_ESCAPED_TEXT: 20, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "SANKEY", 5: "NEWLINE", 10: "EOF", 11: "field[source]", 12: "COMMA", 13: "field[target]", 14: "field[value]", 18: "DQUOTE", 19: "ESCAPED_TEXT", 20: "NON_ESCAPED_TEXT" },
    productions_: [0, [3, 4], [6, 2], [9, 2], [9, 0], [7, 1], [7, 0], [8, 5], [15, 1], [15, 1], [16, 3], [17, 1]],
    performAction: function(l, u, h, f, d, p, y) {
      var m = p.length - 1;
      switch (d) {
        case 7:
          const _ = f.findOrCreateNode(p[m - 4].trim().replaceAll('""', '"')), T = f.findOrCreateNode(p[m - 2].trim().replaceAll('""', '"')), v = parseFloat(p[m].trim());
          f.addLink(_, T, v);
          break;
        case 8:
        case 9:
        case 11:
          this.$ = p[m];
          break;
        case 10:
          this.$ = p[m - 1];
          break;
      }
    },
    table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, { 5: [1, 3] }, { 6: 4, 8: 5, 15: 6, 16: 7, 17: 8, 18: e, 20: n }, { 1: [2, 6], 7: 11, 10: [1, 12] }, t(n, [2, 4], { 9: 13, 5: [1, 14] }), { 12: [1, 15] }, t(i, [2, 8]), t(i, [2, 9]), { 19: [1, 16] }, t(i, [2, 11]), { 1: [2, 1] }, { 1: [2, 5] }, t(n, [2, 2]), { 6: 17, 8: 5, 15: 6, 16: 7, 17: 8, 18: e, 20: n }, { 15: 18, 16: 7, 17: 8, 18: e, 20: n }, { 18: [1, 19] }, t(n, [2, 3]), { 12: [1, 20] }, t(i, [2, 10]), { 15: 21, 16: 7, 17: 8, 18: e, 20: n }, t([1, 5, 10], [2, 7])],
    defaultActions: { 11: [2, 1], 12: [2, 5] },
    parseError: function(l, u) {
      if (u.recoverable)
        this.trace(l);
      else {
        var h = new Error(l);
        throw h.hash = u, h;
      }
    },
    parse: function(l) {
      var u = this, h = [0], f = [], d = [null], p = [], y = this.table, m = "", _ = 0, T = 0, v = 2, A = 1, L = p.slice.call(arguments, 1), w = Object.create(this.lexer), b = { yy: {} };
      for (var F in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, F) && (b.yy[F] = this.yy[F]);
      w.setInput(l, b.yy), b.yy.lexer = w, b.yy.parser = this, typeof w.yylloc > "u" && (w.yylloc = {});
      var S = w.yylloc;
      p.push(S);
      var x = w.options && w.options.ranges;
      typeof b.yy.parseError == "function" ? this.parseError = b.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function C() {
        var V;
        return V = f.pop() || w.lex() || A, typeof V != "number" && (V instanceof Array && (f = V, V = f.pop()), V = u.symbols_[V] || V), V;
      }
      for (var g, I, k, P, R = {}, M, B, N, D; ; ) {
        if (I = h[h.length - 1], this.defaultActions[I] ? k = this.defaultActions[I] : ((g === null || typeof g > "u") && (g = C()), k = y[I] && y[I][g]), typeof k > "u" || !k.length || !k[0]) {
          var E = "";
          D = [];
          for (M in y[I])
            this.terminals_[M] && M > v && D.push("'" + this.terminals_[M] + "'");
          w.showPosition ? E = "Parse error on line " + (_ + 1) + `:
` + w.showPosition() + `
Expecting ` + D.join(", ") + ", got '" + (this.terminals_[g] || g) + "'" : E = "Parse error on line " + (_ + 1) + ": Unexpected " + (g == A ? "end of input" : "'" + (this.terminals_[g] || g) + "'"), this.parseError(E, {
            text: w.match,
            token: this.terminals_[g] || g,
            line: w.yylineno,
            loc: S,
            expected: D
          });
        }
        if (k[0] instanceof Array && k.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + I + ", token: " + g);
        switch (k[0]) {
          case 1:
            h.push(g), d.push(w.yytext), p.push(w.yylloc), h.push(k[1]), g = null, T = w.yyleng, m = w.yytext, _ = w.yylineno, S = w.yylloc;
            break;
          case 2:
            if (B = this.productions_[k[1]][1], R.$ = d[d.length - B], R._$ = {
              first_line: p[p.length - (B || 1)].first_line,
              last_line: p[p.length - 1].last_line,
              first_column: p[p.length - (B || 1)].first_column,
              last_column: p[p.length - 1].last_column
            }, x && (R._$.range = [
              p[p.length - (B || 1)].range[0],
              p[p.length - 1].range[1]
            ]), P = this.performAction.apply(R, [
              m,
              T,
              _,
              b.yy,
              k[1],
              d,
              p
            ].concat(L)), typeof P < "u")
              return P;
            B && (h = h.slice(0, -1 * B * 2), d = d.slice(0, -1 * B), p = p.slice(0, -1 * B)), h.push(this.productions_[k[1]][0]), d.push(R.$), p.push(R._$), N = y[h[h.length - 2]][h[h.length - 1]], h.push(N);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, s = /* @__PURE__ */ (function() {
    var o = {
      EOF: 1,
      parseError: function(u, h) {
        if (this.yy.parser)
          this.yy.parser.parseError(u, h);
        else
          throw new Error(u);
      },
      // resets the lexer, sets new input
      setInput: function(l, u) {
        return this.yy = u || this.yy || {}, this._input = l, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var l = this._input[0];
        this.yytext += l, this.yyleng++, this.offset++, this.match += l, this.matched += l;
        var u = l.match(/(?:\r\n?|\n).*/g);
        return u ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), l;
      },
      // unshifts one char (or a string) into the input
      unput: function(l) {
        var u = l.length, h = l.split(/(?:\r\n?|\n)/g);
        this._input = l + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - u), this.offset -= u;
        var f = 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), h.length - 1 && (this.yylineno -= h.length - 1);
        var d = 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: h ? (h.length === f.length ? this.yylloc.first_column : 0) + f[f.length - h.length].length - h[0].length : this.yylloc.first_column - u
        }, this.options.ranges && (this.yylloc.range = [d[0], d[0] + this.yyleng - u]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(l) {
        this.unput(this.match.slice(l));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var l = this.matched.substr(0, this.matched.length - this.match.length);
        return (l.length > 20 ? "..." : "") + l.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var l = this.match;
        return l.length < 20 && (l += this._input.substr(0, 20 - l.length)), (l.substr(0, 20) + (l.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var l = this.pastInput(), u = new Array(l.length + 1).join("-");
        return l + this.upcomingInput() + `
` + u + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(l, u) {
        var h, f, d;
        if (this.options.backtrack_lexer && (d = {
          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 && (d.yylloc.range = this.yylloc.range.slice(0))), f = l[0].match(/(?:\r\n?|\n).*/g), f && (this.yylineno += f.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: f ? f[f.length - 1].length - f[f.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + l[0].length
        }, this.yytext += l[0], this.match += l[0], this.matches = l, 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(l[0].length), this.matched += l[0], h = this.performAction.call(this, this.yy, this, u, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), h)
          return h;
        if (this._backtrack) {
          for (var p in d)
            this[p] = d[p];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var l, u, h, f;
        this._more || (this.yytext = "", this.match = "");
        for (var d = this._currentRules(), p = 0; p < d.length; p++)
          if (h = this._input.match(this.rules[d[p]]), h && (!u || h[0].length > u[0].length)) {
            if (u = h, f = p, this.options.backtrack_lexer) {
              if (l = this.test_match(h, d[p]), l !== !1)
                return l;
              if (this._backtrack) {
                u = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return u ? (l = this.test_match(u, d[f]), l !== !1 ? l : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var u = this.next();
        return u || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(u) {
        this.conditionStack.push(u);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var u = this.conditionStack.length - 1;
        return u > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(u) {
        return u = this.conditionStack.length - 1 - Math.abs(u || 0), u >= 0 ? this.conditionStack[u] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(u) {
        this.begin(u);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: { "case-insensitive": !0 },
      performAction: function(u, h, f, d) {
        switch (f) {
          case 0:
            return this.pushState("csv"), 4;
          case 1:
            return 10;
          case 2:
            return 5;
          case 3:
            return 12;
          case 4:
            return this.pushState("escaped_text"), 18;
          case 5:
            return 20;
          case 6:
            return this.popState("escaped_text"), 18;
          case 7:
            return 19;
        }
      },
      rules: [/^(?:sankey-beta\b)/i, /^(?:$)/i, /^(?:((\u000D\u000A)|(\u000A)))/i, /^(?:(\u002C))/i, /^(?:(\u0022))/i, /^(?:([\u0020-\u0021\u0023-\u002B\u002D-\u007E])*)/i, /^(?:(\u0022)(?!(\u0022)))/i, /^(?:(([\u0020-\u0021\u0023-\u002B\u002D-\u007E])|(\u002C)|(\u000D)|(\u000A)|(\u0022)(\u0022))*)/i],
      conditions: { csv: { rules: [1, 2, 3, 4, 5, 6, 7], inclusive: !1 }, escaped_text: { rules: [6, 7], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7], inclusive: !0 } }
    };
    return o;
  })();
  r.lexer = s;
  function a() {
    this.yy = {};
  }
  return a.prototype = r, r.Parser = a, new a();
})();
Z1.parser = Z1;
const Du = Z1;
let Sh = [], Ah = [], ea = {};
const $Z = () => {
  Sh = [], Ah = [], ea = {}, fn();
};
class YZ {
  constructor(e, n, i = 0) {
    this.source = e, this.target = n, this.value = i;
  }
}
const WZ = (t, e, n) => {
  Sh.push(new YZ(t, e, n));
};
class UZ {
  constructor(e) {
    this.ID = e;
  }
}
const HZ = (t) => (t = bt.sanitizeText(t, Q()), ea[t] || (ea[t] = new UZ(t), Ah.push(ea[t])), ea[t]), GZ = () => Ah, jZ = () => Sh, XZ = () => ({
  nodes: Ah.map((t) => ({ id: t.ID })),
  links: Sh.map((t) => ({
    source: t.source.ID,
    target: t.target.ID,
    value: t.value
  }))
}), KZ = {
  nodesMap: ea,
  getConfig: () => Q().sankey,
  getNodes: GZ,
  getLinks: jZ,
  getGraph: XZ,
  addLink: WZ,
  findOrCreateNode: HZ,
  getAccTitle: vn,
  setAccTitle: pn,
  getAccDescription: Cn,
  setAccDescription: En,
  getDiagramTitle: Sn,
  setDiagramTitle: Yn,
  clear: $Z
}, j5 = class J1 {
  static next(e) {
    return new J1(e + ++J1.count);
  }
  constructor(e) {
    this.id = e, this.href = `#${e}`;
  }
  toString() {
    return "url(" + this.href + ")";
  }
};
j5.count = 0;
let Ay = j5;
const QZ = {
  left: wZ,
  right: vZ,
  center: EZ,
  justify: H5
}, ZZ = function(t, e, n, i) {
  const { securityLevel: r, sankey: s } = Q(), a = ub.sankey;
  let o;
  r === "sandbox" && (o = yt("#i" + e));
  const l = yt(r === "sandbox" ? o.nodes()[0].contentDocument.body : "body"), u = r === "sandbox" ? l.select(`[id="${e}"]`) : yt(`[id="${e}"]`), h = s?.width ?? a.width, f = s?.height ?? a.width, d = s?.useMaxWidth ?? a.useMaxWidth, p = s?.nodeAlignment ?? a.nodeAlignment, y = s?.prefix ?? a.prefix, m = s?.suffix ?? a.suffix, _ = s?.showValues ?? a.showValues, T = i.db.getGraph(), v = QZ[p];
  LZ().nodeId((C) => C.id).nodeWidth(10).nodePadding(10 + (_ ? 15 : 0)).nodeAlign(v).extent([
    [0, 0],
    [h, f]
  ])(T);
  const w = _l(Nm);
  u.append("g").attr("class", "nodes").selectAll(".node").data(T.nodes).join("g").attr("class", "node").attr("id", (C) => (C.uid = Ay.next("node-")).id).attr("transform", function(C) {
    return "translate(" + C.x0 + "," + C.y0 + ")";
  }).attr("x", (C) => C.x0).attr("y", (C) => C.y0).append("rect").attr("height", (C) => C.y1 - C.y0).attr("width", (C) => C.x1 - C.x0).attr("fill", (C) => w(C.id));
  const b = ({ id: C, value: g }) => _ ? `${C}
${y}${Math.round(g * 100) / 100}${m}` : C;
  u.append("g").attr("class", "node-labels").attr("font-family", "sans-serif").attr("font-size", 14).selectAll("text").data(T.nodes).join("text").attr("x", (C) => C.x0 < h / 2 ? C.x1 + 6 : C.x0 - 6).attr("y", (C) => (C.y1 + C.y0) / 2).attr("dy", `${_ ? "0" : "0.35"}em`).attr("text-anchor", (C) => C.x0 < h / 2 ? "start" : "end").text(b);
  const F = u.append("g").attr("class", "links").attr("fill", "none").attr("stroke-opacity", 0.5).selectAll(".link").data(T.links).join("g").attr("class", "link").style("mix-blend-mode", "multiply"), S = s?.linkColor || "gradient";
  if (S === "gradient") {
    const C = F.append("linearGradient").attr("id", (g) => (g.uid = Ay.next("linearGradient-")).id).attr("gradientUnits", "userSpaceOnUse").attr("x1", (g) => g.source.x1).attr("x2", (g) => g.target.x0);
    C.append("stop").attr("offset", "0%").attr("stop-color", (g) => w(g.source.id)), C.append("stop").attr("offset", "100%").attr("stop-color", (g) => w(g.target.id));
  }
  let x;
  switch (S) {
    case "gradient":
      x = (C) => C.uid;
      break;
    case "source":
      x = (C) => w(C.source.id);
      break;
    case "target":
      x = (C) => w(C.target.id);
      break;
    default:
      x = S;
  }
  F.append("path").attr("d", qZ()).attr("stroke", x).attr("stroke-width", (C) => Math.max(1, C.width)), Wr(void 0, u, 0, d);
}, JZ = {
  draw: ZZ
}, tJ = (t) => t.replaceAll(/^[^\S\n\r]+|[^\S\n\r]+$/g, "").replaceAll(/([\n\r])+/g, `
`).trim(), eJ = Du.parse.bind(Du);
Du.parse = (t) => eJ(tJ(t));
const nJ = {
  parser: Du,
  db: KZ,
  renderer: JZ
}, iJ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: nJ
}, Symbol.toStringTag, { value: "Module" }));
var Ly, Iy, tf = (function() {
  var t = function(A, L, w, b) {
    for (w = w || {}, b = A.length; b--; w[A[b]] = L)
      ;
    return w;
  }, e = [1, 7], n = [1, 13], i = [1, 14], r = [1, 15], s = [1, 19], a = [1, 16], o = [1, 17], l = [1, 18], u = [8, 30], h = [8, 21, 28, 29, 30, 31, 32, 40, 44, 47], f = [1, 23], d = [1, 24], p = [8, 15, 16, 21, 28, 29, 30, 31, 32, 40, 44, 47], y = [8, 15, 16, 21, 27, 28, 29, 30, 31, 32, 40, 44, 47], m = [1, 49], _ = {
    trace: function() {
    },
    yy: {},
    symbols_: { error: 2, spaceLines: 3, SPACELINE: 4, NL: 5, separator: 6, SPACE: 7, EOF: 8, start: 9, BLOCK_DIAGRAM_KEY: 10, document: 11, stop: 12, statement: 13, link: 14, LINK: 15, START_LINK: 16, LINK_LABEL: 17, STR: 18, nodeStatement: 19, columnsStatement: 20, SPACE_BLOCK: 21, blockStatement: 22, classDefStatement: 23, cssClassStatement: 24, styleStatement: 25, node: 26, SIZE: 27, COLUMNS: 28, "id-block": 29, end: 30, block: 31, NODE_ID: 32, nodeShapeNLabel: 33, dirList: 34, DIR: 35, NODE_DSTART: 36, NODE_DEND: 37, BLOCK_ARROW_START: 38, BLOCK_ARROW_END: 39, classDef: 40, CLASSDEF_ID: 41, CLASSDEF_STYLEOPTS: 42, DEFAULT: 43, class: 44, CLASSENTITY_IDS: 45, STYLECLASS: 46, style: 47, STYLE_ENTITY_IDS: 48, STYLE_DEFINITION_DATA: 49, $accept: 0, $end: 1 },
    terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "block", 32: "NODE_ID", 35: "DIR", 36: "NODE_DSTART", 37: "NODE_DEND", 38: "BLOCK_ARROW_START", 39: "BLOCK_ARROW_END", 40: "classDef", 41: "CLASSDEF_ID", 42: "CLASSDEF_STYLEOPTS", 43: "DEFAULT", 44: "class", 45: "CLASSENTITY_IDS", 46: "STYLECLASS", 47: "style", 48: "STYLE_ENTITY_IDS", 49: "STYLE_DEFINITION_DATA" },
    productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [34, 1], [34, 2], [33, 3], [33, 4], [23, 3], [23, 3], [24, 3], [25, 3]],
    performAction: function(L, w, b, F, S, x, C) {
      var g = x.length - 1;
      switch (S) {
        case 4:
          F.getLogger().debug("Rule: separator (NL) ");
          break;
        case 5:
          F.getLogger().debug("Rule: separator (Space) ");
          break;
        case 6:
          F.getLogger().debug("Rule: separator (EOF) ");
          break;
        case 7:
          F.getLogger().debug("Rule: hierarchy: ", x[g - 1]), F.setHierarchy(x[g - 1]);
          break;
        case 8:
          F.getLogger().debug("Stop NL ");
          break;
        case 9:
          F.getLogger().debug("Stop EOF ");
          break;
        case 10:
          F.getLogger().debug("Stop NL2 ");
          break;
        case 11:
          F.getLogger().debug("Stop EOF2 ");
          break;
        case 12:
          F.getLogger().debug("Rule: statement: ", x[g]), typeof x[g].length == "number" ? this.$ = x[g] : this.$ = [x[g]];
          break;
        case 13:
          F.getLogger().debug("Rule: statement #2: ", x[g - 1]), this.$ = [x[g - 1]].concat(x[g]);
          break;
        case 14:
          F.getLogger().debug("Rule: link: ", x[g], L), this.$ = { edgeTypeStr: x[g], label: "" };
          break;
        case 15:
          F.getLogger().debug("Rule: LABEL link: ", x[g - 3], x[g - 1], x[g]), this.$ = { edgeTypeStr: x[g], label: x[g - 1] };
          break;
        case 18:
          const I = parseInt(x[g]), k = F.generateId();
          this.$ = { id: k, type: "space", label: "", width: I, children: [] };
          break;
        case 23:
          F.getLogger().debug("Rule: (nodeStatement link node) ", x[g - 2], x[g - 1], x[g], " typestr: ", x[g - 1].edgeTypeStr);
          const P = F.edgeStrToEdgeData(x[g - 1].edgeTypeStr);
          this.$ = [
            { id: x[g - 2].id, label: x[g - 2].label, type: x[g - 2].type, directions: x[g - 2].directions },
            { id: x[g - 2].id + "-" + x[g].id, start: x[g - 2].id, end: x[g].id, label: x[g - 1].label, type: "edge", directions: x[g].directions, arrowTypeEnd: P, arrowTypeStart: "arrow_open" },
            { id: x[g].id, label: x[g].label, type: F.typeStr2Type(x[g].typeStr), directions: x[g].directions }
          ];
          break;
        case 24:
          F.getLogger().debug("Rule: nodeStatement (abc88 node size) ", x[g - 1], x[g]), this.$ = { id: x[g - 1].id, label: x[g - 1].label, type: F.typeStr2Type(x[g - 1].typeStr), directions: x[g - 1].directions, widthInColumns: parseInt(x[g], 10) };
          break;
        case 25:
          F.getLogger().debug("Rule: nodeStatement (node) ", x[g]), this.$ = { id: x[g].id, label: x[g].label, type: F.typeStr2Type(x[g].typeStr), directions: x[g].directions, widthInColumns: 1 };
          break;
        case 26:
          F.getLogger().debug("APA123", this ? this : "na"), F.getLogger().debug("COLUMNS: ", x[g]), this.$ = { type: "column-setting", columns: x[g] === "auto" ? -1 : parseInt(x[g]) };
          break;
        case 27:
          F.getLogger().debug("Rule: id-block statement : ", x[g - 2], x[g - 1]), F.generateId(), this.$ = { ...x[g - 2], type: "composite", children: x[g - 1] };
          break;
        case 28:
          F.getLogger().debug("Rule: blockStatement : ", x[g - 2], x[g - 1], x[g]);
          const R = F.generateId();
          this.$ = { id: R, type: "composite", label: "", children: x[g - 1] };
          break;
        case 29:
          F.getLogger().debug("Rule: node (NODE_ID separator): ", x[g]), this.$ = { id: x[g] };
          break;
        case 30:
          F.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", x[g - 1], x[g]), this.$ = { id: x[g - 1], label: x[g].label, typeStr: x[g].typeStr, directions: x[g].directions };
          break;
        case 31:
          F.getLogger().debug("Rule: dirList: ", x[g]), this.$ = [x[g]];
          break;
        case 32:
          F.getLogger().debug("Rule: dirList: ", x[g - 1], x[g]), this.$ = [x[g - 1]].concat(x[g]);
          break;
        case 33:
          F.getLogger().debug("Rule: nodeShapeNLabel: ", x[g - 2], x[g - 1], x[g]), this.$ = { typeStr: x[g - 2] + x[g], label: x[g - 1] };
          break;
        case 34:
          F.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", x[g - 3], x[g - 2], " #3:", x[g - 1], x[g]), this.$ = { typeStr: x[g - 3] + x[g], label: x[g - 2], directions: x[g - 1] };
          break;
        case 35:
        case 36:
          this.$ = { type: "classDef", id: x[g - 1].trim(), css: x[g].trim() };
          break;
        case 37:
          this.$ = { type: "applyClass", id: x[g - 1].trim(), styleClass: x[g].trim() };
          break;
        case 38:
          this.$ = { type: "applyStyles", id: x[g - 1].trim(), stylesStr: x[g].trim() };
          break;
      }
    },
    table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 11: 3, 13: 4, 19: 5, 20: 6, 21: e, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: n, 29: i, 31: r, 32: s, 40: a, 44: o, 47: l }, { 8: [1, 20] }, t(u, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 21: e, 28: n, 29: i, 31: r, 32: s, 40: a, 44: o, 47: l }), t(h, [2, 16], { 14: 22, 15: f, 16: d }), t(h, [2, 17]), t(h, [2, 18]), t(h, [2, 19]), t(h, [2, 20]), t(h, [2, 21]), t(h, [2, 22]), t(p, [2, 25], { 27: [1, 25] }), t(h, [2, 26]), { 19: 26, 26: 12, 32: s }, { 11: 27, 13: 4, 19: 5, 20: 6, 21: e, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: n, 29: i, 31: r, 32: s, 40: a, 44: o, 47: l }, { 41: [1, 28], 43: [1, 29] }, { 45: [1, 30] }, { 48: [1, 31] }, t(y, [2, 29], { 33: 32, 36: [1, 33], 38: [1, 34] }), { 1: [2, 7] }, t(u, [2, 13]), { 26: 35, 32: s }, { 32: [2, 14] }, { 17: [1, 36] }, t(p, [2, 24]), { 11: 37, 13: 4, 14: 22, 15: f, 16: d, 19: 5, 20: 6, 21: e, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: n, 29: i, 31: r, 32: s, 40: a, 44: o, 47: l }, { 30: [1, 38] }, { 42: [1, 39] }, { 42: [1, 40] }, { 46: [1, 41] }, { 49: [1, 42] }, t(y, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, t(p, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, t(h, [2, 28]), t(h, [2, 35]), t(h, [2, 36]), t(h, [2, 37]), t(h, [2, 38]), { 37: [1, 47] }, { 34: 48, 35: m }, { 15: [1, 50] }, t(h, [2, 27]), t(y, [2, 33]), { 39: [1, 51] }, { 34: 52, 35: m, 39: [2, 31] }, { 32: [2, 15] }, t(y, [2, 34]), { 39: [2, 32] }],
    defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] },
    parseError: function(L, w) {
      if (w.recoverable)
        this.trace(L);
      else {
        var b = new Error(L);
        throw b.hash = w, b;
      }
    },
    parse: function(L) {
      var w = this, b = [0], F = [], S = [null], x = [], C = this.table, g = "", I = 0, k = 0, P = 2, R = 1, M = x.slice.call(arguments, 1), B = Object.create(this.lexer), N = { yy: {} };
      for (var D in this.yy)
        Object.prototype.hasOwnProperty.call(this.yy, D) && (N.yy[D] = this.yy[D]);
      B.setInput(L, N.yy), N.yy.lexer = B, N.yy.parser = this, typeof B.yylloc > "u" && (B.yylloc = {});
      var E = B.yylloc;
      x.push(E);
      var V = B.options && B.options.ranges;
      typeof N.yy.parseError == "function" ? this.parseError = N.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError;
      function nt() {
        var U;
        return U = F.pop() || B.lex() || R, typeof U != "number" && (U instanceof Array && (F = U, U = F.pop()), U = w.symbols_[U] || U), U;
      }
      for (var O, ct, X, H, it = {}, ot, W, Z, q; ; ) {
        if (ct = b[b.length - 1], this.defaultActions[ct] ? X = this.defaultActions[ct] : ((O === null || typeof O > "u") && (O = nt()), X = C[ct] && C[ct][O]), typeof X > "u" || !X.length || !X[0]) {
          var G = "";
          q = [];
          for (ot in C[ct])
            this.terminals_[ot] && ot > P && q.push("'" + this.terminals_[ot] + "'");
          B.showPosition ? G = "Parse error on line " + (I + 1) + `:
` + B.showPosition() + `
Expecting ` + q.join(", ") + ", got '" + (this.terminals_[O] || O) + "'" : G = "Parse error on line " + (I + 1) + ": Unexpected " + (O == R ? "end of input" : "'" + (this.terminals_[O] || O) + "'"), this.parseError(G, {
            text: B.match,
            token: this.terminals_[O] || O,
            line: B.yylineno,
            loc: E,
            expected: q
          });
        }
        if (X[0] instanceof Array && X.length > 1)
          throw new Error("Parse Error: multiple actions possible at state: " + ct + ", token: " + O);
        switch (X[0]) {
          case 1:
            b.push(O), S.push(B.yytext), x.push(B.yylloc), b.push(X[1]), O = null, k = B.yyleng, g = B.yytext, I = B.yylineno, E = B.yylloc;
            break;
          case 2:
            if (W = this.productions_[X[1]][1], it.$ = S[S.length - W], it._$ = {
              first_line: x[x.length - (W || 1)].first_line,
              last_line: x[x.length - 1].last_line,
              first_column: x[x.length - (W || 1)].first_column,
              last_column: x[x.length - 1].last_column
            }, V && (it._$.range = [
              x[x.length - (W || 1)].range[0],
              x[x.length - 1].range[1]
            ]), H = this.performAction.apply(it, [
              g,
              k,
              I,
              N.yy,
              X[1],
              S,
              x
            ].concat(M)), typeof H < "u")
              return H;
            W && (b = b.slice(0, -1 * W * 2), S = S.slice(0, -1 * W), x = x.slice(0, -1 * W)), b.push(this.productions_[X[1]][0]), S.push(it.$), x.push(it._$), Z = C[b[b.length - 2]][b[b.length - 1]], b.push(Z);
            break;
          case 3:
            return !0;
        }
      }
      return !0;
    }
  }, T = /* @__PURE__ */ (function() {
    var A = {
      EOF: 1,
      parseError: function(w, b) {
        if (this.yy.parser)
          this.yy.parser.parseError(w, b);
        else
          throw new Error(w);
      },
      // resets the lexer, sets new input
      setInput: function(L, w) {
        return this.yy = w || this.yy || {}, this._input = L, 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;
      },
      // consumes and returns one char from the input
      input: function() {
        var L = this._input[0];
        this.yytext += L, this.yyleng++, this.offset++, this.match += L, this.matched += L;
        var w = L.match(/(?:\r\n?|\n).*/g);
        return w ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), L;
      },
      // unshifts one char (or a string) into the input
      unput: function(L) {
        var w = L.length, b = L.split(/(?:\r\n?|\n)/g);
        this._input = L + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - w), this.offset -= w;
        var F = 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), b.length - 1 && (this.yylineno -= b.length - 1);
        var S = 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: b ? (b.length === F.length ? this.yylloc.first_column : 0) + F[F.length - b.length].length - b[0].length : this.yylloc.first_column - w
        }, this.options.ranges && (this.yylloc.range = [S[0], S[0] + this.yyleng - w]), this.yyleng = this.yytext.length, this;
      },
      // When called from action, caches matched text and appends it on next action
      more: function() {
        return this._more = !0, this;
      },
      // 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: 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;
      },
      // retain first n characters of the match
      less: function(L) {
        this.unput(this.match.slice(L));
      },
      // displays already matched input, i.e. for error messages
      pastInput: function() {
        var L = this.matched.substr(0, this.matched.length - this.match.length);
        return (L.length > 20 ? "..." : "") + L.substr(-20).replace(/\n/g, "");
      },
      // displays upcoming input, i.e. for error messages
      upcomingInput: function() {
        var L = this.match;
        return L.length < 20 && (L += this._input.substr(0, 20 - L.length)), (L.substr(0, 20) + (L.length > 20 ? "..." : "")).replace(/\n/g, "");
      },
      // displays the character position where the lexing error occurred, i.e. for error messages
      showPosition: function() {
        var L = this.pastInput(), w = new Array(L.length + 1).join("-");
        return L + this.upcomingInput() + `
` + w + "^";
      },
      // test the lexed token: return FALSE when not a match, otherwise return token
      test_match: function(L, w) {
        var b, F, S;
        if (this.options.backtrack_lexer && (S = {
          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 && (S.yylloc.range = this.yylloc.range.slice(0))), F = L[0].match(/(?:\r\n?|\n).*/g), F && (this.yylineno += F.length), this.yylloc = {
          first_line: this.yylloc.last_line,
          last_line: this.yylineno + 1,
          first_column: this.yylloc.last_column,
          last_column: F ? F[F.length - 1].length - F[F.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + L[0].length
        }, this.yytext += L[0], this.match += L[0], this.matches = L, 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(L[0].length), this.matched += L[0], b = this.performAction.call(this, this.yy, this, w, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), b)
          return b;
        if (this._backtrack) {
          for (var x in S)
            this[x] = S[x];
          return !1;
        }
        return !1;
      },
      // return next match in input
      next: function() {
        if (this.done)
          return this.EOF;
        this._input || (this.done = !0);
        var L, w, b, F;
        this._more || (this.yytext = "", this.match = "");
        for (var S = this._currentRules(), x = 0; x < S.length; x++)
          if (b = this._input.match(this.rules[S[x]]), b && (!w || b[0].length > w[0].length)) {
            if (w = b, F = x, this.options.backtrack_lexer) {
              if (L = this.test_match(b, S[x]), L !== !1)
                return L;
              if (this._backtrack) {
                w = !1;
                continue;
              } else
                return !1;
            } else if (!this.options.flex)
              break;
          }
        return w ? (L = this.test_match(w, S[F]), L !== !1 ? L : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text.
` + this.showPosition(), {
          text: "",
          token: null,
          line: this.yylineno
        });
      },
      // return next match that has a token
      lex: function() {
        var w = this.next();
        return w || this.lex();
      },
      // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
      begin: function(w) {
        this.conditionStack.push(w);
      },
      // pop the previously active lexer condition state off the condition stack
      popState: function() {
        var w = this.conditionStack.length - 1;
        return w > 0 ? this.conditionStack.pop() : this.conditionStack[0];
      },
      // produce the lexer rule set which is active for the currently active lexer condition state
      _currentRules: function() {
        return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules;
      },
      // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
      topState: function(w) {
        return w = this.conditionStack.length - 1 - Math.abs(w || 0), w >= 0 ? this.conditionStack[w] : "INITIAL";
      },
      // alias for begin(condition)
      pushState: function(w) {
        this.begin(w);
      },
      // return the number of states currently on the stack
      stateStackSize: function() {
        return this.conditionStack.length;
      },
      options: {},
      performAction: function(w, b, F, S) {
        switch (F) {
          case 0:
            return 10;
          case 1:
            return w.getLogger().debug("Found space-block"), 31;
          case 2:
            return w.getLogger().debug("Found nl-block"), 31;
          case 3:
            return w.getLogger().debug("Found space-block"), 29;
          case 4:
            w.getLogger().debug(".", b.yytext);
            break;
          case 5:
            w.getLogger().debug("_", b.yytext);
            break;
          case 6:
            return 5;
          case 7:
            return b.yytext = -1, 28;
          case 8:
            return b.yytext = b.yytext.replace(/columns\s+/, ""), w.getLogger().debug("COLUMNS (LEX)", b.yytext), 28;
          case 9:
            this.pushState("md_string");
            break;
          case 10:
            return "MD_STR";
          case 11:
            this.popState();
            break;
          case 12:
            this.pushState("string");
            break;
          case 13:
            w.getLogger().debug("LEX: POPPING STR:", b.yytext), this.popState();
            break;
          case 14:
            return w.getLogger().debug("LEX: STR end:", b.yytext), "STR";
          case 15:
            return b.yytext = b.yytext.replace(/space\:/, ""), w.getLogger().debug("SPACE NUM (LEX)", b.yytext), 21;
          case 16:
            return b.yytext = "1", w.getLogger().debug("COLUMNS (LEX)", b.yytext), 21;
          case 17:
            return 43;
          case 18:
            return "LINKSTYLE";
          case 19:
            return "INTERPOLATE";
          case 20:
            return this.pushState("CLASSDEF"), 40;
          case 21:
            return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID";
          case 22:
            return this.popState(), this.pushState("CLASSDEFID"), 41;
          case 23:
            return this.popState(), 42;
          case 24:
            return this.pushState("CLASS"), 44;
          case 25:
            return this.popState(), this.pushState("CLASS_STYLE"), 45;
          case 26:
            return this.popState(), 46;
          case 27:
            return this.pushState("STYLE_STMNT"), 47;
          case 28:
            return this.popState(), this.pushState("STYLE_DEFINITION"), 48;
          case 29:
            return this.popState(), 49;
          case 30:
            return this.pushState("acc_title"), "acc_title";
          case 31:
            return this.popState(), "acc_title_value";
          case 32:
            return this.pushState("acc_descr"), "acc_descr";
          case 33:
            return this.popState(), "acc_descr_value";
          case 34:
            this.pushState("acc_descr_multiline");
            break;
          case 35:
            this.popState();
            break;
          case 36:
            return "acc_descr_multiline_value";
          case 37:
            return 30;
          case 38:
            return this.popState(), w.getLogger().debug("Lex: (("), "NODE_DEND";
          case 39:
            return this.popState(), w.getLogger().debug("Lex: (("), "NODE_DEND";
          case 40:
            return this.popState(), w.getLogger().debug("Lex: ))"), "NODE_DEND";
          case 41:
            return this.popState(), w.getLogger().debug("Lex: (("), "NODE_DEND";
          case 42:
            return this.popState(), w.getLogger().debug("Lex: (("), "NODE_DEND";
          case 43:
            return this.popState(), w.getLogger().debug("Lex: (-"), "NODE_DEND";
          case 44:
            return this.popState(), w.getLogger().debug("Lex: -)"), "NODE_DEND";
          case 45:
            return this.popState(), w.getLogger().debug("Lex: (("), "NODE_DEND";
          case 46:
            return this.popState(), w.getLogger().debug("Lex: ]]"), "NODE_DEND";
          case 47:
            return this.popState(), w.getLogger().debug("Lex: ("), "NODE_DEND";
          case 48:
            return this.popState(), w.getLogger().debug("Lex: ])"), "NODE_DEND";
          case 49:
            return this.popState(), w.getLogger().debug("Lex: /]"), "NODE_DEND";
          case 50:
            return this.popState(), w.getLogger().debug("Lex: /]"), "NODE_DEND";
          case 51:
            return this.popState(), w.getLogger().debug("Lex: )]"), "NODE_DEND";
          case 52:
            return this.popState(), w.getLogger().debug("Lex: )"), "NODE_DEND";
          case 53:
            return this.popState(), w.getLogger().debug("Lex: ]>"), "NODE_DEND";
          case 54:
            return this.popState(), w.getLogger().debug("Lex: ]"), "NODE_DEND";
          case 55:
            return w.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 36;
          case 56:
            return w.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 36;
          case 57:
            return w.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 36;
          case 58:
            return w.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
          case 59:
            return w.getLogger().debug("Lex: ((("), this.pushState("NODE"), 36;
          case 60:
            return w.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
          case 61:
            return w.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
          case 62:
            return w.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
          case 63:
            return w.getLogger().debug("Lexc: >"), this.pushState("NODE"), 36;
          case 64:
            return w.getLogger().debug("Lexa: (["), this.pushState("NODE"), 36;
          case 65:
            return w.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36;
          case 66:
            return this.pushState("NODE"), 36;
          case 67:
            return this.pushState("NODE"), 36;
          case 68:
            return this.pushState("NODE"), 36;
          case 69:
            return this.pushState("NODE"), 36;
          case 70:
            return this.pushState("NODE"), 36;
          case 71:
            return this.pushState("NODE"), 36;
          case 72:
            return this.pushState("NODE"), 36;
          case 73:
            return w.getLogger().debug("Lexa: ["), this.pushState("NODE"), 36;
          case 74:
            return this.pushState("BLOCK_ARROW"), w.getLogger().debug("LEX ARR START"), 38;
          case 75:
            return w.getLogger().debug("Lex: NODE_ID", b.yytext), 32;
          case 76:
            return w.getLogger().debug("Lex: EOF", b.yytext), 8;
          case 77:
            this.pushState("md_string");
            break;
          case 78:
            this.pushState("md_string");
            break;
          case 79:
            return "NODE_DESCR";
          case 80:
            this.popState();
            break;
          case 81:
            w.getLogger().debug("Lex: Starting string"), this.pushState("string");
            break;
          case 82:
            w.getLogger().debug("LEX ARR: Starting string"), this.pushState("string");
            break;
          case 83:
            return w.getLogger().debug("LEX: NODE_DESCR:", b.yytext), "NODE_DESCR";
          case 84:
            w.getLogger().debug("LEX POPPING"), this.popState();
            break;
          case 85:
            w.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR");
            break;
          case 86:
            return b.yytext = b.yytext.replace(/^,\s*/, ""), w.getLogger().debug("Lex (right): dir:", b.yytext), "DIR";
          case 87:
            return b.yytext = b.yytext.replace(/^,\s*/, ""), w.getLogger().debug("Lex (left):", b.yytext), "DIR";
          case 88:
            return b.yytext = b.yytext.replace(/^,\s*/, ""), w.getLogger().debug("Lex (x):", b.yytext), "DIR";
          case 89:
            return b.yytext = b.yytext.replace(/^,\s*/, ""), w.getLogger().debug("Lex (y):", b.yytext), "DIR";
          case 90:
            return b.yytext = b.yytext.replace(/^,\s*/, ""), w.getLogger().debug("Lex (up):", b.yytext), "DIR";
          case 91:
            return b.yytext = b.yytext.replace(/^,\s*/, ""), w.getLogger().debug("Lex (down):", b.yytext), "DIR";
          case 92:
            return b.yytext = "]>", w.getLogger().debug("Lex (ARROW_DIR end):", b.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END";
          case 93:
            return w.getLogger().debug("Lex: LINK", "#" + b.yytext + "#"), 15;
          case 94:
            return w.getLogger().debug("Lex: LINK", b.yytext), 15;
          case 95:
            return w.getLogger().debug("Lex: LINK", b.yytext), 15;
          case 96:
            return w.getLogger().debug("Lex: LINK", b.yytext), 15;
          case 97:
            return w.getLogger().debug("Lex: START_LINK", b.yytext), this.pushState("LLABEL"), 16;
          case 98:
            return w.getLogger().debug("Lex: START_LINK", b.yytext), this.pushState("LLABEL"), 16;
          case 99:
            return w.getLogger().debug("Lex: START_LINK", b.yytext), this.pushState("LLABEL"), 16;
          case 100:
            this.pushState("md_string");
            break;
          case 101:
            return w.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL";
          case 102:
            return this.popState(), w.getLogger().debug("Lex: LINK", "#" + b.yytext + "#"), 15;
          case 103:
            return this.popState(), w.getLogger().debug("Lex: LINK", b.yytext), 15;
          case 104:
            return this.popState(), w.getLogger().debug("Lex: LINK", b.yytext), 15;
          case 105:
            return w.getLogger().debug("Lex: COLON", b.yytext), b.yytext = b.yytext.slice(1), 27;
        }
      },
      rules: [/^(?:block-beta\b)/, /^(?:block\s+)/, /^(?:block\n+)/, /^(?:block:)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/],
      conditions: { STYLE_DEFINITION: { rules: [29], inclusive: !1 }, STYLE_STMNT: { rules: [28], inclusive: !1 }, CLASSDEFID: { rules: [23], inclusive: !1 }, CLASSDEF: { rules: [21, 22], inclusive: !1 }, CLASS_STYLE: { rules: [26], inclusive: !1 }, CLASS: { rules: [25], inclusive: !1 }, LLABEL: { rules: [100, 101, 102, 103, 104], inclusive: !1 }, ARROW_DIR: { rules: [86, 87, 88, 89, 90, 91, 92], inclusive: !1 }, BLOCK_ARROW: { rules: [77, 82, 85], inclusive: !1 }, NODE: { rules: [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81], inclusive: !1 }, md_string: { rules: [10, 11, 79, 80], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [13, 14, 83, 84], inclusive: !1 }, acc_descr_multiline: { rules: [35, 36], inclusive: !1 }, acc_descr: { rules: [33], inclusive: !1 }, acc_title: { rules: [31], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 24, 27, 30, 32, 34, 37, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 93, 94, 95, 96, 97, 98, 99, 105], inclusive: !0 } }
    };
    return A;
  })();
  _.lexer = T;
  function v() {
    this.yy = {};
  }
  return v.prototype = _, _.Parser = v, new v();
})();
tf.parser = tf;
const rJ = tf;
let Fn = {}, G0 = [], _o = {};
const By = "color", Dy = "fill", sJ = "bgFill", X5 = ",", aJ = Q();
let Ro = {};
const oJ = (t) => bt.sanitizeText(t, aJ), lJ = function(t, e = "") {
  Ro[t] === void 0 && (Ro[t] = { id: t, styles: [], textStyles: [] });
  const n = Ro[t];
  e?.split(X5).forEach((i) => {
    const r = i.replace(/([^;]*);/, "$1").trim();
    if (i.match(By)) {
      const a = r.replace(Dy, sJ).replace(By, Dy);
      n.textStyles.push(a);
    }
    n.styles.push(r);
  });
}, cJ = function(t, e = "") {
  const n = Fn[t];
  e != null && (n.styles = e.split(X5));
}, uJ = function(t, e) {
  t.split(",").forEach(function(n) {
    let i = Fn[n];
    if (i === void 0) {
      const r = n.trim();
      Fn[r] = { id: r, type: "na", children: [] }, i = Fn[r];
    }
    i.classes || (i.classes = []), i.classes.push(e);
  });
}, K5 = (t, e) => {
  const n = t.flat(), i = [];
  for (const r of n) {
    if (r.label && (r.label = oJ(r.label)), r.type === "classDef") {
      lJ(r.id, r.css);
      continue;
    }
    if (r.type === "applyClass") {
      uJ(r.id, r?.styleClass || "");
      continue;
    }
    if (r.type === "applyStyles") {
      r?.stylesStr && cJ(r.id, r?.stylesStr);
      continue;
    }
    if (r.type === "column-setting")
      e.columns = r.columns || -1;
    else if (r.type === "edge")
      _o[r.id] ? _o[r.id]++ : _o[r.id] = 1, r.id = _o[r.id] + "-" + r.id, G0.push(r);
    else {
      r.label || (r.type === "composite" ? r.label = "" : r.label = r.id);
      const s = !Fn[r.id];
      if (s ? Fn[r.id] = r : (r.type !== "na" && (Fn[r.id].type = r.type), r.label !== r.id && (Fn[r.id].label = r.label)), r.children && K5(r.children, r), r.type === "space") {
        const a = r.width || 1;
        for (let o = 0; o < a; o++) {
          const l = P3(r);
          l.id = l.id + "-" + o, Fn[l.id] = l, i.push(l);
        }
      } else s && i.push(r);
    }
  }
  e.children = i;
};
let j0 = [], Mo = { id: "root", type: "composite", children: [], columns: -1 };
const hJ = () => {
  z.debug("Clear called"), fn(), Mo = { id: "root", type: "composite", children: [], columns: -1 }, Fn = { root: Mo }, j0 = [], Ro = {}, G0 = [], _o = {};
};
function dJ(t) {
  switch (z.debug("typeStr2Type", t), t) {
    case "[]":
      return "square";
    case "()":
      return z.debug("we have a round"), "round";
    case "(())":
      return "circle";
    case ">]":
      return "rect_left_inv_arrow";
    case "{}":
      return "diamond";
    case "{{}}":
      return "hexagon";
    case "([])":
      return "stadium";
    case "[[]]":
      return "subroutine";
    case "[()]":
      return "cylinder";
    case "((()))":
      return "doublecircle";
    case "[//]":
      return "lean_right";
    case "[\\\\]":
      return "lean_left";
    case "[/\\]":
      return "trapezoid";
    case "[\\/]":
      return "inv_trapezoid";
    case "<[]>":
      return "block_arrow";
    default:
      return "na";
  }
}
function fJ(t) {
  switch (z.debug("typeStr2Type", t), t) {
    case "==":
      return "thick";
    default:
      return "normal";
  }
}
function pJ(t) {
  switch (t.trim()) {
    case "--x":
      return "arrow_cross";
    case "--o":
      return "arrow_circle";
    default:
      return "arrow_point";
  }
}
let Ny = 0;
const gJ = () => (Ny++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + Ny), yJ = (t) => {
  Mo.children = t, K5(t, Mo), j0 = Mo.children;
}, mJ = (t) => {
  const e = Fn[t];
  return e ? e.columns ? e.columns : e.children ? e.children.length : -1 : -1;
}, xJ = () => [...Object.values(Fn)], bJ = () => j0 || [], _J = () => G0, kJ = (t) => Fn[t], TJ = (t) => {
  Fn[t.id] = t;
}, wJ = () => console, vJ = function() {
  return Ro;
}, EJ = {
  getConfig: () => Ee().block,
  typeStr2Type: dJ,
  edgeTypeStr2Type: fJ,
  edgeStrToEdgeData: pJ,
  getLogger: wJ,
  getBlocksFlat: xJ,
  getBlocks: bJ,
  getEdges: _J,
  setHierarchy: yJ,
  getBlock: kJ,
  setBlock: TJ,
  getColumns: mJ,
  getClasses: vJ,
  clear: hJ,
  generateId: gJ
}, CJ = EJ, rc = (t, e) => {
  const n = tx, i = n(t, "r"), r = n(t, "g"), s = n(t, "b");
  return cs(i, r, s, e);
}, SJ = (t) => `.label {
    font-family: ${t.fontFamily};
    color: ${t.nodeTextColor || t.textColor};
  }
  .cluster-label text {
    fill: ${t.titleColor};
  }
  .cluster-label span,p {
    color: ${t.titleColor};
  }



  .label text,span,p {
    fill: ${t.nodeTextColor || t.textColor};
    color: ${t.nodeTextColor || t.textColor};
  }

  .node rect,
  .node circle,
  .node ellipse,
  .node polygon,
  .node path {
    fill: ${t.mainBkg};
    stroke: ${t.nodeBorder};
    stroke-width: 1px;
  }
  .flowchart-label text {
    text-anchor: middle;
  }
  // .flowchart-label .text-outer-tspan {
  //   text-anchor: middle;
  // }
  // .flowchart-label .text-inner-tspan {
  //   text-anchor: start;
  // }

  .node .label {
    text-align: center;
  }
  .node.clickable {
    cursor: pointer;
  }

  .arrowheadPath {
    fill: ${t.arrowheadColor};
  }

  .edgePath .path {
    stroke: ${t.lineColor};
    stroke-width: 2.0px;
  }

  .flowchart-link {
    stroke: ${t.lineColor};
    fill: none;
  }

  .edgeLabel {
    background-color: ${t.edgeLabelBackground};
    rect {
      opacity: 0.5;
      background-color: ${t.edgeLabelBackground};
      fill: ${t.edgeLabelBackground};
    }
    text-align: center;
  }

  /* For html labels only */
  .labelBkg {
    background-color: ${rc(t.edgeLabelBackground, 0.5)};
    // background-color:
  }

  .node .cluster {
    // fill: ${rc(t.mainBkg, 0.5)};
    fill: ${rc(t.clusterBkg, 0.5)};
    stroke: ${rc(t.clusterBorder, 0.2)};
    box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
    stroke-width: 1px;
  }

  .cluster text {
    fill: ${t.titleColor};
  }

  .cluster span,p {
    color: ${t.titleColor};
  }
  /* .cluster div {
    color: ${t.titleColor};
  } */

  div.mermaidTooltip {
    position: absolute;
    text-align: center;
    max-width: 200px;
    padding: 2px;
    font-family: ${t.fontFamily};
    font-size: 12px;
    background: ${t.tertiaryColor};
    border: 1px solid ${t.border2};
    border-radius: 2px;
    pointer-events: none;
    z-index: 100;
  }

  .flowchartTitleText {
    text-anchor: middle;
    font-size: 18px;
    fill: ${t.textColor};
  }
`, AJ = SJ;
function Q5(t, e, n = !1) {
  var i, r, s;
  const a = t;
  let o = "default";
  (((i = a?.classes) == null ? void 0 : i.length) || 0) > 0 && (o = (a?.classes || []).join(" ")), o = o + " flowchart-label";
  let l = 0, u = "", h;
  switch (a.type) {
    case "round":
      l = 5, u = "rect";
      break;
    case "composite":
      l = 0, u = "composite", h = 0;
      break;
    case "square":
      u = "rect";
      break;
    case "diamond":
      u = "question";
      break;
    case "hexagon":
      u = "hexagon";
      break;
    case "block_arrow":
      u = "block_arrow";
      break;
    case "odd":
      u = "rect_left_inv_arrow";
      break;
    case "lean_right":
      u = "lean_right";
      break;
    case "lean_left":
      u = "lean_left";
      break;
    case "trapezoid":
      u = "trapezoid";
      break;
    case "inv_trapezoid":
      u = "inv_trapezoid";
      break;
    case "rect_left_inv_arrow":
      u = "rect_left_inv_arrow";
      break;
    case "circle":
      u = "circle";
      break;
    case "ellipse":
      u = "ellipse";
      break;
    case "stadium":
      u = "stadium";
      break;
    case "subroutine":
      u = "subroutine";
      break;
    case "cylinder":
      u = "cylinder";
      break;
    case "group":
      u = "rect";
      break;
    case "doublecircle":
      u = "doublecircle";
      break;
    default:
      u = "rect";
  }
  const f = $n(a?.styles || []), d = a.label, p = a.size || { width: 0, height: 0, x: 0, y: 0 };
  return {
    labelStyle: f.labelStyle,
    shape: u,
    labelText: d,
    rx: l,
    ry: l,
    class: o,
    style: f.style,
    id: a.id,
    directions: a.directions,
    width: p.width,
    height: p.height,
    x: p.x,
    y: p.y,
    positioned: n,
    intersect: void 0,
    type: a.type,
    padding: h ?? (((s = (r = Ee()) == null ? void 0 : r.block) == null ? void 0 : s.padding) || 0)
  };
}
async function LJ(t, e, n) {
  const i = Q5(e, n, !1);
  if (i.type === "group")
    return;
  const r = await _h(t, i), s = r.node().getBBox(), a = n.getBlock(i.id);
  a.size = { width: s.width, height: s.height, x: 0, y: 0, node: r }, n.setBlock(a), r.remove();
}
async function IJ(t, e, n) {
  const i = Q5(e, n, !0);
  n.getBlock(i.id).type !== "space" && (await _h(t, i), e.intersect = i?.intersect, b1(i));
}
async function X0(t, e, n, i) {
  for (const r of e)
    await i(t, r, n), r.children && await X0(t, r.children, n, i);
}
async function BJ(t, e, n) {
  await X0(t, e, n, LJ);
}
async function DJ(t, e, n) {
  await X0(t, e, n, IJ);
}
async function NJ(t, e, n, i, r) {
  const s = new qe({
    multigraph: !0,
    compound: !0
  });
  s.setGraph({
    rankdir: "TB",
    nodesep: 10,
    ranksep: 10,
    marginx: 8,
    marginy: 8
  });
  for (const a of n)
    a.size && s.setNode(a.id, {
      width: a.size.width,
      height: a.size.height,
      intersect: a.intersect
    });
  for (const a of e)
    if (a.start && a.end) {
      const o = i.getBlock(a.start), l = i.getBlock(a.end);
      if (o?.size && l?.size) {
        const u = o.size, h = l.size, f = [
          { x: u.x, y: u.y },
          { x: u.x + (h.x - u.x) / 2, y: u.y + (h.y - u.y) / 2 },
          { x: h.x, y: h.y }
        ];
        await D4(
          t,
          { v: a.start, w: a.end, name: a.id },
          {
            ...a,
            arrowTypeEnd: a.arrowTypeEnd,
            arrowTypeStart: a.arrowTypeStart,
            points: f,
            classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1"
          },
          void 0,
          "block",
          s,
          r
        ), a.label && (await p0(t, {
          ...a,
          label: a.label,
          labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;",
          arrowTypeEnd: a.arrowTypeEnd,
          arrowTypeStart: a.arrowTypeStart
        }), await B4(
          { ...a, x: f[1].x, y: f[1].y },
          {
            originalPath: f
          }
        ));
      }
    }
}
const Ie = ((Iy = (Ly = Q()) == null ? void 0 : Ly.block) == null ? void 0 : Iy.padding) || 8;
function FJ(t, e) {
  if (t === 0 || !Number.isInteger(t))
    throw new Error("Columns must be an integer !== 0.");
  if (e < 0 || !Number.isInteger(e))
    throw new Error("Position must be a non-negative integer." + e);
  if (t < 0)
    return { px: e, py: 0 };
  if (t === 1)
    return { px: 0, py: e };
  const n = e % t, i = Math.floor(e / t);
  return { px: n, py: i };
}
const OJ = (t) => {
  let e = 0, n = 0;
  for (const i of t.children) {
    const { width: r, height: s, x: a, y: o } = i.size || { width: 0, height: 0, x: 0, y: 0 };
    z.debug(
      "getMaxChildSize abc95 child:",
      i.id,
      "width:",
      r,
      "height:",
      s,
      "x:",
      a,
      "y:",
      o,
      i.type
    ), i.type !== "space" && (r > e && (e = r / (t.widthInColumns || 1)), s > n && (n = s));
  }
  return { width: e, height: n };
};
function ef(t, e, n = 0, i = 0) {
  var r, s, a, o, l, u, h, f, d, p, y;
  z.debug(
    "setBlockSizes abc95 (start)",
    t.id,
    (r = t?.size) == null ? void 0 : r.x,
    "block width =",
    t?.size,
    "sieblingWidth",
    n
  ), (s = t?.size) != null && s.width || (t.size = {
    width: n,
    height: i,
    x: 0,
    y: 0
  });
  let m = 0, _ = 0;
  if (((a = t.children) == null ? void 0 : a.length) > 0) {
    for (const S of t.children)
      ef(S, e);
    const T = OJ(t);
    m = T.width, _ = T.height, z.debug("setBlockSizes abc95 maxWidth of", t.id, ":s children is ", m, _);
    for (const S of t.children)
      S.size && (z.debug(
        `abc95 Setting size of children of ${t.id} id=${S.id} ${m} ${_} ${S.size}`
      ), S.size.width = m * (S.widthInColumns || 1) + Ie * ((S.widthInColumns || 1) - 1), S.size.height = _, S.size.x = 0, S.size.y = 0, z.debug(
        `abc95 updating size of ${t.id} children child:${S.id} maxWidth:${m} maxHeight:${_}`
      ));
    for (const S of t.children)
      ef(S, e, m, _);
    const v = t.columns || -1;
    let A = 0;
    for (const S of t.children)
      A += S.widthInColumns || 1;
    let L = t.children.length;
    v > 0 && v < A && (L = v), t.widthInColumns;
    const w = Math.ceil(A / L);
    let b = L * (m + Ie) + Ie, F = w * (_ + Ie) + Ie;
    if (b < n) {
      z.debug(
        `Detected to small siebling: abc95 ${t.id} sieblingWidth ${n} sieblingHeight ${i} width ${b}`
      ), b = n, F = i;
      const S = (n - L * Ie - Ie) / L, x = (i - w * Ie - Ie) / w;
      z.debug("Size indata abc88", t.id, "childWidth", S, "maxWidth", m), z.debug("Size indata abc88", t.id, "childHeight", x, "maxHeight", _), z.debug("Size indata abc88 xSize", L, "padding", Ie);
      for (const C of t.children)
        C.size && (C.size.width = S, C.size.height = x, C.size.x = 0, C.size.y = 0);
    }
    if (z.debug(
      `abc95 (finale calc) ${t.id} xSize ${L} ySize ${w} columns ${v}${t.children.length} width=${Math.max(b, ((o = t.size) == null ? void 0 : o.width) || 0)}`
    ), b < (((l = t?.size) == null ? void 0 : l.width) || 0)) {
      b = ((u = t?.size) == null ? void 0 : u.width) || 0;
      const S = v > 0 ? Math.min(t.children.length, v) : t.children.length;
      if (S > 0) {
        const x = (b - S * Ie - Ie) / S;
        z.debug("abc95 (growing to fit) width", t.id, b, (h = t.size) == null ? void 0 : h.width, x);
        for (const C of t.children)
          C.size && (C.size.width = x);
      }
    }
    t.size = {
      width: b,
      height: F,
      x: 0,
      y: 0
    };
  }
  z.debug(
    "setBlockSizes abc94 (done)",
    t.id,
    (f = t?.size) == null ? void 0 : f.x,
    (d = t?.size) == null ? void 0 : d.width,
    (p = t?.size) == null ? void 0 : p.y,
    (y = t?.size) == null ? void 0 : y.height
  );
}
function Z5(t, e) {
  var n, i, r, s, a, o, l, u, h, f, d, p, y, m, _, T, v;
  z.debug(
    `abc85 layout blocks (=>layoutBlocks) ${t.id} x: ${(n = t?.size) == null ? void 0 : n.x} y: ${(i = t?.size) == null ? void 0 : i.y} width: ${(r = t?.size) == null ? void 0 : r.width}`
  );
  const A = t.columns || -1;
  if (z.debug("layoutBlocks columns abc95", t.id, "=>", A, t), t.children && // find max width of children
  t.children.length > 0) {
    const L = ((a = (s = t?.children[0]) == null ? void 0 : s.size) == null ? void 0 : a.width) || 0, w = t.children.length * L + (t.children.length - 1) * Ie;
    z.debug("widthOfChildren 88", w, "posX");
    let b = 0;
    z.debug("abc91 block?.size?.x", t.id, (o = t?.size) == null ? void 0 : o.x);
    let F = (l = t?.size) != null && l.x ? ((u = t?.size) == null ? void 0 : u.x) + (-((h = t?.size) == null ? void 0 : h.width) / 2 || 0) : -Ie, S = 0;
    for (const x of t.children) {
      const C = t;
      if (!x.size)
        continue;
      const { width: g, height: I } = x.size, { px: k, py: P } = FJ(A, b);
      if (P != S && (S = P, F = (f = t?.size) != null && f.x ? ((d = t?.size) == null ? void 0 : d.x) + (-((p = t?.size) == null ? void 0 : p.width) / 2 || 0) : -Ie, z.debug("New row in layout for block", t.id, " and child ", x.id, S)), z.debug(
        `abc89 layout blocks (child) id: ${x.id} Pos: ${b} (px, py) ${k},${P} (${(y = C?.size) == null ? void 0 : y.x},${(m = C?.size) == null ? void 0 : m.y}) parent: ${C.id} width: ${g}${Ie}`
      ), C.size) {
        const R = g / 2;
        x.size.x = F + Ie + R, z.debug(
          `abc91 layout blocks (calc) px, pyid:${x.id} startingPos=X${F} new startingPosX${x.size.x} ${R} padding=${Ie} width=${g} halfWidth=${R} => x:${x.size.x} y:${x.size.y} ${x.widthInColumns} (width * (child?.w || 1)) / 2 ${g * (x?.widthInColumns || 1) / 2}`
        ), F = x.size.x + R, x.size.y = C.size.y - C.size.height / 2 + P * (I + Ie) + I / 2 + Ie, z.debug(
          `abc88 layout blocks (calc) px, pyid:${x.id}startingPosX${F}${Ie}${R}=>x:${x.size.x}y:${x.size.y}${x.widthInColumns}(width * (child?.w || 1)) / 2${g * (x?.widthInColumns || 1) / 2}`
        );
      }
      x.children && Z5(x), b += x?.widthInColumns || 1, z.debug("abc88 columnsPos", x, b);
    }
  }
  z.debug(
    `layout blocks (<==layoutBlocks) ${t.id} x: ${(_ = t?.size) == null ? void 0 : _.x} y: ${(T = t?.size) == null ? void 0 : T.y} width: ${(v = t?.size) == null ? void 0 : v.width}`
  );
}
function J5(t, { minX: e, minY: n, maxX: i, maxY: r } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) {
  if (t.size && t.id !== "root") {
    const { x: s, y: a, width: o, height: l } = t.size;
    s - o / 2 < e && (e = s - o / 2), a - l / 2 < n && (n = a - l / 2), s + o / 2 > i && (i = s + o / 2), a + l / 2 > r && (r = a + l / 2);
  }
  if (t.children)
    for (const s of t.children)
      ({ minX: e, minY: n, maxX: i, maxY: r } = J5(s, { minX: e, minY: n, maxX: i, maxY: r }));
  return { minX: e, minY: n, maxX: i, maxY: r };
}
function RJ(t) {
  const e = t.getBlock("root");
  if (!e)
    return;
  ef(e, t, 0, 0), Z5(e), z.debug("getBlocks", JSON.stringify(e, null, 2));
  const { minX: n, minY: i, maxX: r, maxY: s } = J5(e), a = s - i, o = r - n;
  return { x: n, y: i, width: o, height: a };
}
const MJ = function(t, e) {
  return e.db.getClasses();
}, PJ = async function(t, e, n, i) {
  const { securityLevel: r, block: s } = Ee(), a = i.db;
  let o;
  r === "sandbox" && (o = yt("#i" + e));
  const l = yt(r === "sandbox" ? o.nodes()[0].contentDocument.body : "body"), u = r === "sandbox" ? l.select(`[id="${e}"]`) : yt(`[id="${e}"]`);
  d0(u, ["point", "circle", "cross"], i.type, e);
  const f = a.getBlocks(), d = a.getBlocksFlat(), p = a.getEdges(), y = u.insert("g").attr("class", "block");
  await BJ(y, f, a);
  const m = RJ(a);
  if (await DJ(y, f, a), await NJ(y, p, d, a, e), m) {
    const _ = m, T = Math.max(1, Math.round(0.125 * (_.width / _.height))), v = _.height + T + 10, A = _.width + 10, { useMaxWidth: L } = s;
    dn(u, v, A, !!L), z.debug("Here Bounds", m, _), u.attr(
      "viewBox",
      `${_.x - 5} ${_.y - 5} ${_.width + 10} ${_.height + 10}`
    );
  }
  _l(Nm);
}, zJ = {
  draw: PJ,
  getClasses: MJ
}, VJ = {
  parser: rJ,
  db: CJ,
  renderer: zJ,
  styles: AJ
}, qJ = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  diagram: VJ
}, Symbol.toStringTag, { value: "Module" }));
export {
  KJ as parseMermaidToExcalidraw
};
